diff -Nru lwjgl-2.7.1+dfsg/build.xml lwjgl-2.9.3+dfsg/build.xml --- lwjgl-2.7.1+dfsg/build.xml 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/build.xml 2016-04-09 16:26:57.000000000 +0000 @@ -7,18 +7,20 @@ + - - + + - + + @@ -30,6 +32,8 @@ + + @@ -48,12 +52,13 @@ + - + + + + + + @@ -124,6 +135,7 @@ + @@ -135,6 +147,7 @@ + @@ -146,6 +159,11 @@ + + + + + @@ -161,6 +179,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -180,6 +245,16 @@ + + + + + + + + + + @@ -220,55 +295,81 @@ - + - - - - - - + + + + + + + + + + - - - - - - - + + + + + + + + + + + + + - + - + + + - + - - - - + - + + + + + + + + + + + + + + + + + + @@ -326,6 +427,10 @@ lwjgl.native.windows.version = ${lwjgl.native.windows.version} lwjgl.java.linux.version = ${lwjgl.java.linux.version} lwjgl.native.linux.version = ${lwjgl.native.linux.version} + lwjgl.java.freebsd.version = ${lwjgl.java.linux.version} + lwjgl.native.freebsd.version = ${lwjgl.native.linux.version} + lwjgl.java.openbsd.version = ${lwjgl.java.linux.version} + lwjgl.native.openbsd.version = ${lwjgl.native.linux.version} lwjgl.java.macosx.version = ${lwjgl.java.macosx.version} lwjgl.native.macosx.version = ${lwjgl.native.macosx.version} @@ -357,13 +462,14 @@ - + + @@ -384,6 +490,16 @@ + + + + + + + + + + @@ -413,6 +529,23 @@ + + + + + + + + + + + + + + + + + @@ -426,10 +559,38 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -516,4 +677,16 @@ Copyright © 2002-2009 lwjgl.org. All Rights Reserved.]]> + + + + + + + + + + + + diff -Nru lwjgl-2.7.1+dfsg/debian/changelog lwjgl-2.9.3+dfsg/debian/changelog --- lwjgl-2.7.1+dfsg/debian/changelog 2015-12-09 17:33:01.000000000 +0000 +++ lwjgl-2.9.3+dfsg/debian/changelog 2016-04-09 20:33:57.000000000 +0000 @@ -1,3 +1,22 @@ +lwjgl (2.9.3+dfsg-1) unstable; urgency=medium + + * Team upload. + * Imported Upstream version 2.9.3+dfsg. (Closes: #648624) + * d/control: Build-depend on default-jdk instead of openjdk-7-jdk. + (Closes: #814167) + * Declare compliance with Debian Policy 3.9.7. + * Vcs-Git: Use https. + * d/rules: Use default-java as JAVA_HOME. + * Fix debian/watch file and track the latest 2.x releases. + * Refresh all patches for new release. + * debian/rules: Build with parallel and javahelper. + * Add build-failure.patch and fix a FTBFS. + * Add no-asm-support.patch and remove optional code for asm.jar. + * Export DEB_BUILD_MAINT_OPTIONS = hardening=+all. + * Update debian/copyright for new release. + + -- Markus Koschany Sat, 09 Apr 2016 22:33:53 +0200 + lwjgl (2.7.1+dfsg-5) unstable; urgency=medium * Team upload. diff -Nru lwjgl-2.7.1+dfsg/debian/control lwjgl-2.9.3+dfsg/debian/control --- lwjgl-2.7.1+dfsg/debian/control 2015-12-09 17:33:01.000000000 +0000 +++ lwjgl-2.9.3+dfsg/debian/control 2016-04-09 20:33:57.000000000 +0000 @@ -10,16 +10,16 @@ javahelper, ant, ant-optional, - openjdk-7-jdk (>= 7u71-2.5.3), + default-jdk, libjinput-java, libxrandr-dev, libxxf86vm-dev, libxcursor-dev, libxt-dev, Build-Depends-Indep: - default-jdk-doc, -Standards-Version: 3.9.6 -Vcs-Git: git://anonscm.debian.org/pkg-java/lwjgl.git + default-jdk-doc +Standards-Version: 3.9.7 +Vcs-Git: https://anonscm.debian.org/git/pkg-java/lwjgl.git Vcs-Browser: https://anonscm.debian.org/cgit/pkg-java/lwjgl.git Homepage: http://lwjgl.org diff -Nru lwjgl-2.7.1+dfsg/debian/copyright lwjgl-2.9.3+dfsg/debian/copyright --- lwjgl-2.7.1+dfsg/debian/copyright 2015-12-09 17:33:01.000000000 +0000 +++ lwjgl-2.9.3+dfsg/debian/copyright 2016-04-09 20:33:57.000000000 +0000 @@ -3,7 +3,7 @@ Upstream-Contact: LWJGL developers Files: * -Copyright: 2002-2010, Lightweight Java Game Library Project +Copyright: 2002-2015, Lightweight Java Game Library Project License: BSD-3-clause Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -28,9 +28,12 @@ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -Files: ./src/native/common/extgl.c ./src/native/windows/extgl_wgl.c +Files: src/native/windows/opengl/extgl_wgl.h + src/native/windows/opengl/extgl_wgl.c + src/native/common/opengles/extgl.c + src/native/common/opengl/extgl.c Copyright: 2001-2002, Lev Povalahev -License: BSD-3-clause +License: BSD-3-clause-Povalahev Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -54,11 +57,61 @@ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +Files: src/java/org/lwjgl/opencl/FastLongMap.java + src/java/org/lwjgl/opengles/FastIntMap.java + src/java/org/lwjgl/opengl/FastIntMap.java +Copyright: 2002-2004, The Apache Software Foundation +License: Apache-2.0 + On Debian system the complete license text of the Apache License 2.0 can be + found in /usr/share/common-licenses/Apache-2.0. + +Files: src/native/common/EGL/eglext.h + src/native/common/EGL/eglplatform.h + src/native/common/EGL/egl.h + src/native/common/CL/cl_d3d10.h + src/native/common/CL/cl_gl_ext.h + src/native/common/CL/cl.h + src/native/common/CL/cl_ext.h + src/native/common/CL/cl_gl.h + src/native/common/CL/cl_platform.h + src/native/common/GLES2/gl2.h + src/native/common/opencl.h + src/native/common/OpenCL/cl_platform.h + src/native/common/KHR/khrplatform.h +Copyright: 2007-2010 The Khronos Group Inc +License: Expat + +Files: src/native/common/GLES2/gl2platform.h +Copyright: The Khronos Group Inc +License: SGI-Free-Software-B-License-2.0 + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: The above copyright + notice including the dates of first publication and either this permission + notice or a reference to http://oss.sgi.com/projects/FreeB/ shall be included + in all copies or substantial portions of the Software. + . + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR + IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Files: src/native/common/opengles/extgl.h + src/native/common/opengl/extgl.h +Copyright: 1999-2006, Brian Paul +License: Expat + Files: debian/* Copyright: - 2010 Gabriele Giacone <1o5g4r8o@gmail.com> - 2011-2014 Michael Gilbert -License: BSD-3-clause + 2010, Gabriele Giacone <1o5g4r8o@gmail.com> + 2011-2014, Michael Gilbert + 2016, Markus Koschany +License: BSD-3-clause-Debian Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -81,3 +134,25 @@ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +License: Expat + ** Permission is hereby granted, free of charge, to any person obtaining a + ** copy of this software and/or associated documentation files (the + ** "Materials"), to deal in the Materials without restriction, including + ** without limitation the rights to use, copy, modify, merge, publish, + ** distribute, sublicense, and/or sell copies of the Materials, and to + ** permit persons to whom the Materials are furnished to do so, subject to + ** the following conditions: + ** + ** The above copyright notice and this permission notice shall be included + ** in all copies or substantial portions of the Materials. + ** + ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + ** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + ** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + ** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + ** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. + + diff -Nru lwjgl-2.7.1+dfsg/debian/liblwjgl-java.install lwjgl-2.9.3+dfsg/debian/liblwjgl-java.install --- lwjgl-2.7.1+dfsg/debian/liblwjgl-java.install 2015-12-09 17:33:01.000000000 +0000 +++ lwjgl-2.9.3+dfsg/debian/liblwjgl-java.install 2016-04-09 20:33:57.000000000 +0000 @@ -1,4 +1,4 @@ -libs/lwjgl_test.jar usr/share/java -libs/lwjgl_util.jar usr/share/java -libs/lwjgl_util_applet.jar usr/share/java -libs/lwjgl.jar usr/share/java +libs/lwjgl_test.jar usr/share/java +libs/lwjgl_util.jar usr/share/java +libs/lwjgl_util_applet.jar usr/share/java +libs/lwjgl.jar usr/share/java diff -Nru lwjgl-2.7.1+dfsg/debian/patches/allarchs.patch lwjgl-2.9.3+dfsg/debian/patches/allarchs.patch --- lwjgl-2.7.1+dfsg/debian/patches/allarchs.patch 2015-12-09 17:33:01.000000000 +0000 +++ lwjgl-2.9.3+dfsg/debian/patches/allarchs.patch 2016-04-09 20:33:57.000000000 +0000 @@ -1,11 +1,21 @@ -Author: Gabriele Giacone <1o5g4r8o@gmail.com> -Description: support for building on all architectures +From: Markus Koschany +Date: Sat, 9 Apr 2016 19:07:56 +0200 +Subject: allarchs +Try to support all Debian architectures. + +Forwarded: no +--- + platform_build/linux_ant/build.xml | 36 ++++++++++++++++++++++++++++++++++-- + 1 file changed, 34 insertions(+), 2 deletions(-) + +diff --git a/platform_build/linux_ant/build.xml b/platform_build/linux_ant/build.xml +index e5ce8d1..72eb346 100644 --- a/platform_build/linux_ant/build.xml +++ b/platform_build/linux_ant/build.xml @@ -6,12 +6,14 @@ - + + @@ -18,44 +28,44 @@ -@@ -41,6 +43,7 @@ +@@ -38,6 +40,7 @@ - - -+ + + ++ -@@ -59,8 +62,11 @@ +@@ -56,8 +59,10 @@ - - -+ -+ -+ -+ -+ ++ ++ ++ ++ -@@ -114,4 +120,30 @@ +@@ -123,4 +128,31 @@ -+ -+ ++ + + -+ ++ + + + + + + ++ + ++ + + + diff -Nru lwjgl-2.7.1+dfsg/debian/patches/build-failure.patch lwjgl-2.9.3+dfsg/debian/patches/build-failure.patch --- lwjgl-2.7.1+dfsg/debian/patches/build-failure.patch 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/debian/patches/build-failure.patch 2016-04-09 20:33:57.000000000 +0000 @@ -0,0 +1,24 @@ +From: Markus Koschany +Date: Sat, 9 Apr 2016 19:29:18 +0200 +Subject: build failure + +This file doesn't exist and causes a FTBFS. + +Forwarded: not-needed +--- + build.xml | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/build.xml b/build.xml +index c78b2dc..8d5aa03 100644 +--- a/build.xml ++++ b/build.xml +@@ -7,7 +7,7 @@ + + + +- ++ + + + diff -Nru lwjgl-2.7.1+dfsg/debian/patches/javadoc.patch lwjgl-2.9.3+dfsg/debian/patches/javadoc.patch --- lwjgl-2.7.1+dfsg/debian/patches/javadoc.patch 2015-12-09 17:33:01.000000000 +0000 +++ lwjgl-2.9.3+dfsg/debian/patches/javadoc.patch 2016-04-09 20:33:57.000000000 +0000 @@ -1,9 +1,17 @@ -Author: Gabriele Giacone <1o5g4r8o@gmail.com> -Description: link against system javadoc +From: Debian Java Maintainers +Date: Sat, 9 Apr 2016 18:50:43 +0200 +Subject: javadoc +Forwarded: not-needed +--- + build.xml | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/build.xml b/build.xml +index 7f6bb68..736c91a 100644 --- a/build.xml +++ b/build.xml -@@ -513,6 +513,7 @@ +@@ -672,6 +672,7 @@ diff -Nru lwjgl-2.7.1+dfsg/debian/patches/no-asm-support.patch lwjgl-2.9.3+dfsg/debian/patches/no-asm-support.patch --- lwjgl-2.7.1+dfsg/debian/patches/no-asm-support.patch 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/debian/patches/no-asm-support.patch 2016-04-09 20:33:57.000000000 +0000 @@ -0,0 +1,2484 @@ +From: Markus Koschany +Date: Sat, 9 Apr 2016 20:28:48 +0200 +Subject: no asm support + +We don't support the optional asm.jar because LWJGL is not compatible with +libasm-java. + +Forwarded: not-needed +--- + .../org/lwjgl/test/mapped/TestMappedObject.java | 87 -- + .../test/opengl/sprites/SpriteShootoutMapped.java | 838 ------------- + .../lwjgl/util/mapped/MappedObjectClassLoader.java | 193 --- + .../lwjgl/util/mapped/MappedObjectTransformer.java | 1319 -------------------- + 4 files changed, 2437 deletions(-) + delete mode 100644 src/java/org/lwjgl/test/mapped/TestMappedObject.java + delete mode 100644 src/java/org/lwjgl/test/opengl/sprites/SpriteShootoutMapped.java + delete mode 100644 src/java/org/lwjgl/util/mapped/MappedObjectClassLoader.java + delete mode 100644 src/java/org/lwjgl/util/mapped/MappedObjectTransformer.java + +diff --git a/src/java/org/lwjgl/test/mapped/TestMappedObject.java b/src/java/org/lwjgl/test/mapped/TestMappedObject.java +deleted file mode 100644 +index 0ae560e..0000000 +--- a/src/java/org/lwjgl/test/mapped/TestMappedObject.java ++++ /dev/null +@@ -1,87 +0,0 @@ +-/* +- * Copyright (c) 2002-2011 LWJGL Project +- * All rights reserved. +- * +- * Redistribution and use in source and binary forms, with or without +- * modification, are permitted provided that the following conditions are +- * met: +- * +- * * Redistributions of source code must retain the above copyright +- * notice, this list of conditions and the following disclaimer. +- * +- * * Redistributions in binary form must reproduce the above copyright +- * notice, this list of conditions and the following disclaimer in the +- * documentation and/or other materials provided with the distribution. +- * +- * * Neither the name of 'LWJGL' nor the names of +- * its contributors may be used to endorse or promote products derived +- * from this software without specific prior written permission. +- * +- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +- */ +-package org.lwjgl.test.mapped; +- +-import org.lwjgl.util.mapped.MappedObjectClassLoader; +-import org.lwjgl.util.mapped.MappedObjectTransformer; +- +-/** @author Riven */ +-@SuppressWarnings("static-access") +-public class TestMappedObject { +- +- static { +- boolean assertsEnabled = false; +- assert assertsEnabled = true; // Intentional side effect!!! +- if ( !assertsEnabled ) +- throw new RuntimeException("Asserts must be enabled for this test."); +- } +- +- public static void main(String[] args) throws Exception { +- MappedObjectTransformer.register(MappedFloat.class); +- MappedObjectTransformer.register(MappedVec2.class); +- MappedObjectTransformer.register(MappedVec3.class); +- MappedObjectTransformer.register(MappedSomething.class); +- MappedObjectTransformer.register(MappedObjectTests3.Xyz.class); +- MappedObjectTransformer.register(MappedObjectTests4.MappedPointer.class); +- MappedObjectTransformer.register(MappedObjectTests4.MappedCacheLinePadded.class); +- MappedObjectTransformer.register(MappedObjectTests4.MappedFieldCacheLinePadded.class); +- +- if ( MappedObjectClassLoader.fork(TestMappedObject.class, args) ) { +- return; +- } +- +- MappedObjectTests1.testViewField(); +- +- MappedObjectTests2.testFields(); +- +- // MappedObjectBench.benchmarkMapped(); +- // MappedObjectBench.benchmarkInstances(); +- // MappedObjectBench.benchmarkIndirectArray(); +- // MappedObjectBench.benchmarkDirectArray(); +- // MappedObjectBench.benchmarkUnsafe(); +- +- MappedObjectTests3.testMappedBuffer(); +- MappedObjectTests3.testForeach(); +- MappedObjectTests3.testConstructor(); +- MappedObjectTests3.testMappedSet(); +- +- MappedObjectTests4.testLocalView(); +- //MappedObjectTests4.testLWJGL(); +- MappedObjectTests4.testPointer(); +- MappedObjectTests4.testCacheLineAlignment(); +- MappedObjectTests4.testCacheLinePadding(); +- MappedObjectTests4.testCacheLinePaddingPOJO(); +- +- System.out.println("done"); +- } +- +-} +\ No newline at end of file +diff --git a/src/java/org/lwjgl/test/opengl/sprites/SpriteShootoutMapped.java b/src/java/org/lwjgl/test/opengl/sprites/SpriteShootoutMapped.java +deleted file mode 100644 +index 83805d1..0000000 +--- a/src/java/org/lwjgl/test/opengl/sprites/SpriteShootoutMapped.java ++++ /dev/null +@@ -1,838 +0,0 @@ +-/* +- * Copyright (c) 2002-2011 LWJGL Project +- * All rights reserved. +- * +- * Redistribution and use in source and binary forms, with or without +- * modification, are permitted provided that the following conditions are +- * met: +- * +- * * Redistributions of source code must retain the above copyright +- * notice, this list of conditions and the following disclaimer. +- * +- * * Redistributions in binary form must reproduce the above copyright +- * notice, this list of conditions and the following disclaimer in the +- * documentation and/or other materials provided with the distribution. +- * +- * * Neither the name of 'LWJGL' nor the names of +- * its contributors may be used to endorse or promote products derived +- * from this software without specific prior written permission. +- * +- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +- */ +-package org.lwjgl.test.opengl.sprites; +- +-import org.lwjgl.BufferUtils; +-import org.lwjgl.LWJGLException; +-import org.lwjgl.Sys; +-import org.lwjgl.input.Keyboard; +-import org.lwjgl.input.Mouse; +-import org.lwjgl.opengl.*; +-import org.lwjgl.util.mapped.MappedObject; +-import org.lwjgl.util.mapped.MappedObjectClassLoader; +-import org.lwjgl.util.mapped.MappedObjectTransformer; +-import org.lwjgl.util.mapped.MappedType; +- +-import java.awt.image.BufferedImage; +-import java.awt.image.Raster; +-import java.io.IOException; +-import java.nio.ByteBuffer; +-import java.util.Random; +-import javax.imageio.ImageIO; +- +-import static org.lwjgl.opengl.EXTTransformFeedback.*; +-import static org.lwjgl.opengl.GL11.*; +-import static org.lwjgl.opengl.GL12.*; +-import static org.lwjgl.opengl.GL15.*; +-import static org.lwjgl.opengl.GL20.*; +-import static org.lwjgl.opengl.GL30.*; +- +-/** +- * Sprite rendering demo. Three implementations are supported: +- * a) CPU animation + BufferData VBO update. +- * b) CPU animation + MapBufferRange VBO update. +- * c) GPU animation using transform feedback with a vertex shader. +- * +- * @author Spasi +- * @since 18/3/2011 +- */ +-public final class SpriteShootoutMapped { +- +- static final int SCREEN_WIDTH = 800; +- static final int SCREEN_HEIGHT = 600; +- +- private static final int ANIMATION_TICKS = 60; +- +- private boolean run = true; +- private boolean render = true; +- private boolean colorMask = true; +- private boolean animate = true; +- private boolean smooth; +- private boolean vsync; +- +- int ballSize = 42; +- int ballCount = 100 * 1000; +- +- private SpriteRenderer renderer; +- +- // OpenGL stuff +- private int texID; +- private int texBigID; +- private int texSmallID; +- +- long animateTime; +- +- private SpriteShootoutMapped() { +- } +- +- public static void main(String[] args) { +- MappedObjectTransformer.register(Pixel4b.class); +- MappedObjectTransformer.register(Pixel3b.class); +- MappedObjectTransformer.register(Sprite.class); +- MappedObjectTransformer.register(SpriteRender.class); +- +- if ( MappedObjectClassLoader.fork(SpriteShootoutMapped.class, args) ) +- return; +- +- try { +- new SpriteShootoutMapped().start(); +- } catch (LWJGLException e) { +- e.printStackTrace(); +- } +- } +- +- private void start() throws LWJGLException { +- try { +- initGL(); +- +- final ContextCapabilities caps = GLContext.getCapabilities(); +- if ( !true && (caps.OpenGL30 || caps.GL_EXT_transform_feedback) ) +- renderer = new SpriteRendererTF(); +- else if ( true && caps.GL_ARB_map_buffer_range ) +- renderer = new SpriteRendererMapped(); +- else +- renderer = new SpriteRendererPlain(); +- +- updateBalls(ballCount); +- run(); +- } catch (Throwable t) { +- t.printStackTrace(); +- } finally { +- destroy(); +- } +- } +- +- private void initGL() throws LWJGLException { +- Display.setLocation((Display.getDisplayMode().getWidth() - SCREEN_WIDTH) / 2, +- (Display.getDisplayMode().getHeight() - SCREEN_HEIGHT) / 2); +- Display.setDisplayMode(new DisplayMode(SCREEN_WIDTH, SCREEN_HEIGHT)); +- Display.setTitle("Sprite Shootout"); +- Display.create(); +- //Display.create(new PixelFormat(), new ContextAttribs(4, 1).withProfileCompatibility(true).withDebug(true)); +- //AMDDebugOutput.glDebugMessageCallbackAMD(new AMDDebugOutputCallback()); +- +- if ( !GLContext.getCapabilities().OpenGL20 ) +- throw new RuntimeException("OpenGL 2.0 is required for this demo."); +- +- // Setup viewport +- +- glMatrixMode(GL_PROJECTION); +- glLoadIdentity(); +- glOrtho(0, SCREEN_WIDTH, 0, SCREEN_HEIGHT, -1.0, 1.0); +- +- glMatrixMode(GL_MODELVIEW); +- glLoadIdentity(); +- glViewport(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); +- +- glClearColor(1.0f, 1.0f, 1.0f, 0.0f); +- +- // Create textures +- +- try { +- texSmallID = createTexture("res/ball_sm.png"); +- texBigID = createTexture("res/ball.png"); +- } catch (IOException e) { +- e.printStackTrace(); +- System.exit(-1); +- } +- texID = texBigID; +- +- // Setup rendering state +- +- glEnable(GL_BLEND); +- glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); +- +- glEnable(GL_ALPHA_TEST); +- glAlphaFunc(GL_GREATER, 0.0f); +- +- glColorMask(colorMask, colorMask, colorMask, false); +- glDepthMask(false); +- glDisable(GL_DEPTH_TEST); +- +- // Setup geometry +- +- glEnableClientState(GL_VERTEX_ARRAY); +- +- Util.checkGLError(); +- } +- +- private static int createTexture(final String path) throws IOException { +- final BufferedImage img = ImageIO.read(SpriteShootoutMapped.class.getClassLoader().getResource(path)); +- +- final int w = img.getWidth(); +- final int h = img.getHeight(); +- +- final ByteBuffer buffer = readImage(img); +- +- final int texID = glGenTextures(); +- +- glBindTexture(GL_TEXTURE_2D, texID); +- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); +- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); +- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); +- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); +- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_BGRA, GL_UNSIGNED_BYTE, buffer); +- +- return texID; +- } +- +- public static class Pixel4b extends MappedObject { +- +- public byte r, g, b, a; +- +- } +- +- @MappedType(align = 3) +- public static class Pixel3b extends MappedObject { +- +- public byte r, g, b; +- +- } +- +- private static ByteBuffer readImage(final BufferedImage img) throws IOException { +- final Raster raster = img.getRaster(); +- +- final int bands = raster.getNumBands(); +- +- final int w = img.getWidth(); +- final int h = img.getHeight(); +- +- final int count = w * h; +- +- final byte[] pixels = new byte[count * bands]; +- raster.getDataElements(0, 0, w, h, pixels); +- +- if ( bands == 4 ) { +- Pixel4b p = Pixel4b.malloc(count); +- +- int b = 0; +- for ( int i = 0; i < count; i++, b += 4 ) { +- // Pre-multiply alpha +- final float a = unpackUByte01(pixels[b + 3]); +- +- p.view = i; +- p.r = packUByte01(unpackUByte01(pixels[b + 2]) * a); +- p.g = packUByte01(unpackUByte01(pixels[b + 1]) * a); +- p.b = packUByte01(unpackUByte01(pixels[b + 0]) * a); +- p.a = pixels[b + 3]; +- } +- +- return p.backingByteBuffer(); +- } else if ( bands == 3 ) { +- Pixel3b p = Pixel3b.malloc(count); +- +- int b = 0; +- for ( int i = 0; i < count; i++, b += 3 ) { +- p.view = i; +- p.r = pixels[b + 2]; +- p.g = pixels[b + 1]; +- p.b = pixels[b + 0]; +- } +- +- return p.backingByteBuffer(); +- } else { +- ByteBuffer p = BufferUtils.createByteBuffer(count * bands); +- p.put(pixels, 0, p.capacity()); +- p.flip(); +- return p; +- } +- +- } +- +- private static float unpackUByte01(final byte x) { +- return (x & 0xFF) / 255.0f; +- } +- +- private static byte packUByte01(final float x) { +- return (byte)(x * 255.0f); +- } +- +- private void updateBalls(final int count) { +- System.out.println("NUMBER OF BALLS: " + count); +- renderer.updateBalls(ballCount); +- } +- +- private void run() { +- long startTime = System.currentTimeMillis() + 5000; +- long fps = 0; +- +- long time = Sys.getTime(); +- final int ticksPerUpdate = (int)(Sys.getTimerResolution() / ANIMATION_TICKS); +- +- renderer.render(false, true, 0); +- +- while ( run ) { +- Display.processMessages(); +- handleInput(); +- +- glClear(GL_COLOR_BUFFER_BIT); +- +- final long currTime = Sys.getTime(); +- final int delta = (int)(currTime - time); +- if ( smooth || delta >= ticksPerUpdate ) { +- renderer.render(render, animate, delta); +- time = currTime; +- } else +- renderer.render(render, false, 0); +- +- Display.update(false); +- //Display.sync(60); +- +- if ( startTime > System.currentTimeMillis() ) { +- fps++; +- } else { +- long timeUsed = 5000 + (startTime - System.currentTimeMillis()); +- startTime = System.currentTimeMillis() + 5000; +- System.out.println("FPS: " + (Math.round(fps / (timeUsed / 1000.0) * 10) / 10.0) + ", Balls: " + ballCount); +- System.out.println("Animation: " + animateTime / fps); +- animateTime = 0; +- fps = 0; +- } +- } +- } +- +- private void handleInput() { +- if ( Display.isCloseRequested() ) +- run = false; +- +- while ( Keyboard.next() ) { +- if ( Keyboard.getEventKeyState() ) +- continue; +- +- switch ( Keyboard.getEventKey() ) { +- case Keyboard.KEY_1: +- case Keyboard.KEY_2: +- case Keyboard.KEY_3: +- case Keyboard.KEY_4: +- case Keyboard.KEY_5: +- case Keyboard.KEY_6: +- case Keyboard.KEY_7: +- case Keyboard.KEY_8: +- case Keyboard.KEY_9: +- case Keyboard.KEY_0: +- ballCount = 1 << (Keyboard.getEventKey() - Keyboard.KEY_1); +- updateBalls(ballCount); +- break; +- case Keyboard.KEY_ADD: +- case Keyboard.KEY_SUBTRACT: +- int mult; +- if ( Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) ) +- mult = 1000; +- else if ( Keyboard.isKeyDown(Keyboard.KEY_LMENU) || Keyboard.isKeyDown(Keyboard.KEY_RMENU) ) +- mult = 100; +- else if ( Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) || Keyboard.isKeyDown(Keyboard.KEY_RCONTROL) ) +- mult = 10; +- else +- mult = 1; +- if ( Keyboard.getEventKey() == Keyboard.KEY_SUBTRACT ) +- mult = -mult; +- ballCount += mult * 100; +- if ( ballCount <= 0 ) +- ballCount = 1; +- updateBalls(ballCount); +- break; +- case Keyboard.KEY_ESCAPE: +- run = false; +- break; +- case Keyboard.KEY_A: +- animate = !animate; +- System.out.println("Animation is now " + (animate ? "on" : "off") + "."); +- break; +- case Keyboard.KEY_C: +- colorMask = !colorMask; +- glColorMask(colorMask, colorMask, colorMask, false); +- System.out.println("Color mask is now " + (colorMask ? "on" : "off") + "."); +- // Disable alpha test when color mask is off, else we get no benefit. +- if ( colorMask ) { +- glEnable(GL_BLEND); +- glEnable(GL_ALPHA_TEST); +- } else { +- glDisable(GL_BLEND); +- glDisable(GL_ALPHA_TEST); +- } +- break; +- case Keyboard.KEY_R: +- render = !render; +- System.out.println("Rendering is now " + (render ? "on" : "off") + "."); +- break; +- case Keyboard.KEY_S: +- smooth = !smooth; +- System.out.println("Smooth animation is now " + (smooth ? "on" : "off") + "."); +- break; +- case Keyboard.KEY_T: +- if ( texID == texBigID ) { +- texID = texSmallID; +- ballSize = 16; +- } else { +- texID = texBigID; +- ballSize = 42; +- } +- renderer.updateBallSize(); +- glBindTexture(GL_TEXTURE_2D, texID); +- System.out.println("Now using the " + (texID == texBigID ? "big" : "small") + " texture."); +- break; +- case Keyboard.KEY_V: +- vsync = !vsync; +- Display.setVSyncEnabled(vsync); +- System.out.println("VSYNC is now " + (vsync ? "enabled" : "disabled") + "."); +- break; +- } +- } +- +- while ( Mouse.next() ) ; +- } +- +- private void destroy() { +- Display.destroy(); +- } +- +- public static class Sprite extends MappedObject { +- +- public float dx, x; +- public float dy, y; +- +- } +- +- public static class SpriteRender extends MappedObject { +- +- public float x, y; +- +- } +- +- private abstract class SpriteRenderer { +- +- protected Sprite sprites; +- +- protected int spriteCount; +- +- protected int vshID; +- protected int progID; +- +- protected void createProgram() { +- final int fshID = glCreateShader(GL_FRAGMENT_SHADER); +- glShaderSource(fshID, "uniform sampler2D COLOR_MAP;\n" + +- "void main(void) {\n" + +- " gl_FragColor = texture2D(COLOR_MAP, gl_PointCoord);\n" + +- "}"); +- glCompileShader(fshID); +- if ( glGetShaderi(fshID, GL_COMPILE_STATUS) == GL_FALSE ) { +- System.out.println(glGetShaderInfoLog(fshID, glGetShaderi(fshID, GL_INFO_LOG_LENGTH))); +- throw new RuntimeException("Failed to compile fragment shader."); +- } +- +- progID = glCreateProgram(); +- glAttachShader(progID, vshID); +- glAttachShader(progID, fshID); +- glLinkProgram(progID); +- if ( glGetProgrami(progID, GL_LINK_STATUS) == GL_FALSE ) { +- System.out.println(glGetProgramInfoLog(progID, glGetProgrami(progID, GL_INFO_LOG_LENGTH))); +- throw new RuntimeException("Failed to link shader program."); +- } +- +- glUseProgram(progID); +- glUniform1i(glGetUniformLocation(progID, "COLOR_MAP"), 0); +- +- updateBallSize(); +- +- glEnableClientState(GL_VERTEX_ARRAY); +- } +- +- public void updateBallSize() { +- glPointSize(ballSize); +- } +- +- public abstract void updateBalls(int count); +- +- protected abstract void render(boolean render, boolean animate, int delta); +- +- } +- +- private abstract class SpriteRendererBatched extends SpriteRenderer { +- +- protected static final int BALLS_PER_BATCH = 10 * 1000; +- +- SpriteRendererBatched() { +- vshID = glCreateShader(GL_VERTEX_SHADER); +- glShaderSource(vshID, "void main(void) {\n" + +- " gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n" + +- "}"); +- glCompileShader(vshID); +- if ( glGetShaderi(vshID, GL_COMPILE_STATUS) == GL_FALSE ) { +- System.out.println(glGetShaderInfoLog(vshID, glGetShaderi(vshID, GL_INFO_LOG_LENGTH))); +- throw new RuntimeException("Failed to compile vertex shader."); +- } +- +- createProgram(); +- } +- +- public void updateBalls(final int count) { +- final Random random = new Random(); +- +- final Sprite newSprites = Sprite.malloc(count); +- if ( sprites != null ) { +- sprites.view = 0; +- sprites.copyRange(newSprites, Math.min(count, spriteCount)); +- } +- +- if ( count > spriteCount ) { +- for ( int i = spriteCount; i < count; i++ ) { +- newSprites.view = i; +- +- newSprites.x = (int)(random.nextFloat() * (SCREEN_WIDTH - ballSize) + ballSize * 0.5f); +- newSprites.y = (int)(random.nextFloat() * (SCREEN_HEIGHT - ballSize) + ballSize * 0.5f); +- newSprites.dx = random.nextFloat() * 0.4f - 0.2f; +- newSprites.dy = random.nextFloat() * 0.4f - 0.2f; +- } +- } +- +- sprites = newSprites; +- spriteCount = count; +- } +- +- protected void animate( +- final Sprite sprite, +- final SpriteRender spriteRender, +- final int ballSize, final int ballIndex, final int batchSize, final int delta +- ) { +- final float ballRadius = ballSize * 0.5f; +- final float boundW = SCREEN_WIDTH - ballRadius; +- final float boundH = SCREEN_HEIGHT - ballRadius; +- +- final Sprite[] sprites = sprite.asArray(); +- final SpriteRender[] spritesRender = spriteRender.asArray(); +- for ( int b = ballIndex, r = 0, len = (ballIndex + batchSize); b < len; b++, r++ ) { +- float dx = sprites[b].dx; +- float x = sprites[b].x; +- +- x += dx * delta; +- if ( x < ballRadius ) { +- x = ballRadius; +- dx = -dx; +- } else if ( x > boundW ) { +- x = boundW; +- dx = -dx; +- } +- +- sprites[b].dx = dx; +- sprites[b].x = x; +- spritesRender[r].x = x; +- +- float dy = sprites[b].dy; +- float y = sprites[b].y; +- +- y += dy * delta; +- if ( y < ballRadius ) { +- y = ballRadius; +- dy = -dy; +- } else if ( y > boundH ) { +- y = boundH; +- dy = -dy; +- } +- +- sprites[b].dy = dy; +- sprites[b].y = y; +- spritesRender[r].y = y; +- } +- } +- +- } +- +- private class SpriteRendererPlain extends SpriteRendererBatched { +- +- private final int DATA_PER_BATCH = BALLS_PER_BATCH * 2 * 4; // balls * 2 floats * 4 bytes +- +- protected int[] animVBO; +- +- private SpriteRender spritesRender; +- +- SpriteRendererPlain() { +- System.out.println("Shootout Implementation: CPU animation & BufferData"); +- spritesRender = SpriteRender.malloc(BALLS_PER_BATCH); +- } +- +- public void updateBalls(final int count) { +- super.updateBalls(count); +- +- final int batchCount = count / BALLS_PER_BATCH + (count % BALLS_PER_BATCH == 0 ? 0 : 1); +- if ( animVBO != null && batchCount == animVBO.length ) +- return; +- +- final int[] newAnimVBO = new int[batchCount]; +- if ( animVBO != null ) { +- System.arraycopy(animVBO, 0, newAnimVBO, 0, Math.min(animVBO.length, newAnimVBO.length)); +- for ( int i = newAnimVBO.length; i < animVBO.length; i++ ) +- glDeleteBuffers(animVBO[i]); +- } +- for ( int i = animVBO == null ? 0 : animVBO.length; i < newAnimVBO.length; i++ ) { +- newAnimVBO[i] = glGenBuffers(); +- glBindBuffer(GL_ARRAY_BUFFER, newAnimVBO[i]); +- } +- +- animVBO = newAnimVBO; +- } +- +- public void render(final boolean render, final boolean animate, final int delta) { +- int batchSize = Math.min(ballCount, BALLS_PER_BATCH); +- int ballIndex = 0; +- int batchIndex = 0; +- while ( ballIndex < ballCount ) { +- glBindBuffer(GL_ARRAY_BUFFER, animVBO[batchIndex]); +- +- if ( animate ) +- animate(ballIndex, batchSize, delta); +- +- if ( render ) { +- glVertexPointer(2, GL_FLOAT, 0, 0); +- glDrawArrays(GL_POINTS, 0, batchSize); +- } +- +- ballIndex += batchSize; +- batchSize = Math.min(ballCount - ballIndex, BALLS_PER_BATCH); +- batchIndex++; +- } +- } +- +- private void animate(final int ballIndex, final int batchSize, final int delta) { +- animate( +- sprites, spritesRender, +- ballSize, ballIndex, batchSize, delta +- ); +- +- glBufferData(GL_ARRAY_BUFFER, DATA_PER_BATCH, GL_STREAM_DRAW); +- glBufferSubData(GL_ARRAY_BUFFER, 0, spritesRender.backingByteBuffer()); +- } +- +- } +- +- private class SpriteRendererMapped extends SpriteRendererBatched { +- +- private StreamVBO animVBO; +- +- SpriteRendererMapped() { +- System.out.println("Shootout Implementation: CPU animation & MapBufferRange"); +- } +- +- public void updateBalls(final int count) { +- super.updateBalls(count); +- +- if ( animVBO != null ) +- animVBO.destroy(); +- +- animVBO = new StreamVBO(GL_ARRAY_BUFFER, ballCount * (2 * 4)); +- } +- +- public void render(final boolean render, final boolean animate, final int delta) { +- int batchSize = Math.min(ballCount, BALLS_PER_BATCH); +- int ballIndex = 0; +- while ( ballIndex < ballCount ) { +- if ( animate ) { +- final ByteBuffer buffer = animVBO.map(batchSize * (2 * 4)); +- +- long t0 = System.nanoTime(); +- animate(sprites, SpriteRender.map(buffer), ballSize, ballIndex, batchSize, delta); +- long t1 = System.nanoTime(); +- +- animateTime += t1 - t0; +- +- animVBO.unmap(); +- } +- +- if ( render ) { +- glVertexPointer(2, GL_FLOAT, 0, ballIndex * (2 * 4)); +- glDrawArrays(GL_POINTS, 0, batchSize); +- } +- +- ballIndex += batchSize; +- batchSize = Math.min(ballCount - ballIndex, BALLS_PER_BATCH); +- } +- } +- +- } +- +- private class SpriteRendererTF extends SpriteRenderer { +- +- private int progIDTF; +- private int ballSizeLoc; +- private int deltaLoc; +- +- private int[] tfVBO = new int[2]; +- private int currVBO; +- +- SpriteRendererTF() { +- System.out.println("Shootout Implementation: TF GPU animation"); +- +- // Transform-feedback program +- +- final int vshID = glCreateShader(GL_VERTEX_SHADER); +- glShaderSource(vshID, "#version 130\n" + +- "const float WIDTH = " + SCREEN_WIDTH + ";\n" + +- "const float HEIGHT = " + SCREEN_HEIGHT + ";\n" + +- "uniform float ballSize;\n" + // ballSize / 2 +- "uniform float delta;\n" + +- "void main(void) {\n" + +- " vec4 anim = gl_Vertex;\n" + +- " anim.xy = anim.xy + anim.zw * delta;\n" + +- " vec2 animC = clamp(anim.xy, vec2(ballSize), vec2(WIDTH - ballSize, HEIGHT - ballSize));\n" + +- " if ( anim.x != animC.x ) anim.z = -anim.z;\n" + +- " if ( anim.y != animC.y ) anim.w = -anim.w;\n" + +- " gl_Position = vec4(animC, anim.zw);\n" + +- "}"); +- glCompileShader(vshID); +- if ( glGetShaderi(vshID, GL_COMPILE_STATUS) == GL_FALSE ) { +- System.out.println(glGetShaderInfoLog(vshID, glGetShaderi(vshID, GL_INFO_LOG_LENGTH))); +- throw new RuntimeException("Failed to compile vertex shader."); +- } +- +- progIDTF = glCreateProgram(); +- glAttachShader(progIDTF, vshID); +- glTransformFeedbackVaryings(progIDTF, new CharSequence[] { "gl_Position" }, GL_SEPARATE_ATTRIBS); +- glLinkProgram(progIDTF); +- if ( glGetProgrami(progIDTF, GL_LINK_STATUS) == GL_FALSE ) { +- System.out.println(glGetProgramInfoLog(progIDTF, glGetProgrami(progIDTF, GL_INFO_LOG_LENGTH))); +- throw new RuntimeException("Failed to link shader program."); +- } +- +- glUseProgram(progIDTF); +- +- ballSizeLoc = glGetUniformLocation(progIDTF, "ballSize"); +- deltaLoc = glGetUniformLocation(progIDTF, "delta"); +- +- glUniform1f(ballSizeLoc, ballSize * 0.5f); +- +- // ----------------- +- +- this.vshID = glCreateShader(GL_VERTEX_SHADER); +- glShaderSource(this.vshID, "void main(void) {\n" + +- " gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n" + +- "}"); +- glCompileShader(this.vshID); +- if ( glGetShaderi(this.vshID, GL_COMPILE_STATUS) == GL_FALSE ) { +- System.out.println(glGetShaderInfoLog(this.vshID, glGetShaderi(this.vshID, GL_INFO_LOG_LENGTH))); +- throw new RuntimeException("Failed to compile vertex shader."); +- } +- +- createProgram(); +- } +- +- public void updateBallSize() { +- glUseProgram(progIDTF); +- glUniform1f(ballSizeLoc, ballSize * 0.5f); +- +- glUseProgram(progID); +- super.updateBallSize(); +- } +- +- private void doUpdateBalls(final int count) { +- final Random random = new Random(); +- +- final Sprite newSprites = Sprite.malloc(count); +- if ( sprites != null ) { +- sprites.view = 0; +- sprites.copyRange(newSprites, Math.min(count, spriteCount)); +- } +- +- if ( count > spriteCount ) { +- for ( int i = spriteCount; i < count; i++ ) { +- newSprites.view = i; +- +- newSprites.x = (int)(random.nextFloat() * (SCREEN_WIDTH - ballSize) + ballSize * 0.5f); +- newSprites.y = (int)(random.nextFloat() * (SCREEN_HEIGHT - ballSize) + ballSize * 0.5f); +- newSprites.dx = random.nextFloat() * 0.4f - 0.2f; +- newSprites.dy = random.nextFloat() * 0.4f - 0.2f; +- } +- } +- +- sprites = newSprites; +- spriteCount = count; +- } +- +- public void updateBalls(final int count) { +- if ( tfVBO[0] != 0 ) { +- // Fetch current animation state +- glGetBufferSubData(GL_TRANSFORM_FEEDBACK_BUFFER, 0, sprites.backingByteBuffer()); +- } +- +- doUpdateBalls(count); +- +- if ( tfVBO[0] != 0 ) { +- for ( int i = 0; i < tfVBO.length; i++ ) +- glDeleteBuffers(tfVBO[i]); +- } +- +- for ( int i = 0; i < tfVBO.length; i++ ) { +- tfVBO[i] = glGenBuffers(); +- glBindBuffer(GL_TRANSFORM_FEEDBACK_BUFFER, tfVBO[i]); +- glBufferData(GL_TRANSFORM_FEEDBACK_BUFFER, sprites.backingByteBuffer(), GL_STATIC_DRAW); +- } +- +- glBindBuffer(GL_ARRAY_BUFFER, tfVBO[0]); +- glVertexPointer(2, GL_FLOAT, (4 * 4), 0); +- } +- +- public void render(final boolean render, final boolean animate, final int delta) { +- if ( animate ) { +- glUseProgram(progIDTF); +- glUniform1f(deltaLoc, delta); +- +- final int vbo = currVBO; +- currVBO = 1 - currVBO; +- +- glBindBuffer(GL_ARRAY_BUFFER, tfVBO[vbo]); +- glVertexPointer(4, GL_FLOAT, 0, 0); +- +- glEnable(GL_RASTERIZER_DISCARD); +- if ( GLContext.getCapabilities().OpenGL30 ) { +- glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 0, tfVBO[1 - vbo]); +- +- glBeginTransformFeedback(GL_POINTS); +- glDrawArrays(GL_POINTS, 0, ballCount); +- glEndTransformFeedback(); +- } else { +- glBindBufferBaseEXT(GL_TRANSFORM_FEEDBACK_BUFFER_EXT, 0, tfVBO[1 - vbo]); +- +- glBeginTransformFeedbackEXT(GL_POINTS); +- glDrawArrays(GL_POINTS, 0, ballCount); +- glEndTransformFeedbackEXT(); +- } +- glDisable(GL_RASTERIZER_DISCARD); +- +- glUseProgram(progID); +- glVertexPointer(2, GL_FLOAT, (4 * 4), 0); +- } +- +- if ( render ) +- glDrawArrays(GL_POINTS, 0, ballCount); +- } +- +- } +- +-} +\ No newline at end of file +diff --git a/src/java/org/lwjgl/util/mapped/MappedObjectClassLoader.java b/src/java/org/lwjgl/util/mapped/MappedObjectClassLoader.java +deleted file mode 100644 +index 463823f..0000000 +--- a/src/java/org/lwjgl/util/mapped/MappedObjectClassLoader.java ++++ /dev/null +@@ -1,193 +0,0 @@ +-/* +- * Copyright (c) 2002-2011 LWJGL Project +- * All rights reserved. +- * +- * Redistribution and use in source and binary forms, with or without +- * modification, are permitted provided that the following conditions are +- * met: +- * +- * * Redistributions of source code must retain the above copyright +- * notice, this list of conditions and the following disclaimer. +- * +- * * Redistributions in binary form must reproduce the above copyright +- * notice, this list of conditions and the following disclaimer in the +- * documentation and/or other materials provided with the distribution. +- * +- * * Neither the name of 'LWJGL' nor the names of +- * its contributors may be used to endorse or promote products derived +- * from this software without specific prior written permission. +- * +- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +- */ +-package org.lwjgl.util.mapped; +- +-import org.lwjgl.LWJGLUtil; +- +-import java.io.IOException; +-import java.io.InputStream; +-import java.lang.reflect.InvocationTargetException; +-import java.lang.reflect.Method; +-import java.net.URLClassLoader; +- +-/** +- * This classloader is responsible for applying the bytecode transformation to mapped objects. +- * The transformation can either be applied using a Java agent, or with the convenient {@link #fork} method. +- * +- * @author Riven +- */ +-public class MappedObjectClassLoader extends URLClassLoader { +- +- static final String MAPPEDOBJECT_PACKAGE_PREFIX = MappedObjectClassLoader.class.getPackage().getName() + "."; +- +- static boolean FORKED; +- +- /** +- * Forks the specified class containing a main method, passing the specified arguments. See +- * {@link org.lwjgl.test.mapped.TestMappedObject} for example usage. +- * +- * @param mainClass the class containing the main method +- * @param args the arguments to pass +- * +- * @return true if the fork was successful. +- */ +- public static boolean fork(Class mainClass, String[] args) { +- if ( FORKED ) { +- return false; +- } +- +- FORKED = true; +- +- try { +- MappedObjectClassLoader loader = new MappedObjectClassLoader(mainClass); +- loader.loadMappedObject(); +- +- Class replacedMainClass = loader.loadClass(mainClass.getName()); +- Method mainMethod = replacedMainClass.getMethod("main", String[].class); +- mainMethod.invoke(null, new Object[] { args }); +- } catch (InvocationTargetException exc) { +- Thread.currentThread().getUncaughtExceptionHandler().uncaughtException(Thread.currentThread(), exc.getCause()); +- } catch (Throwable cause) { +- throw new Error("failed to fork", cause); +- } +- +- return true; +- } +- +- private MappedObjectClassLoader(Class mainClass) { +- super(((URLClassLoader)mainClass.getClassLoader()).getURLs()); +- } +- +- protected synchronized Class loadMappedObject() throws ClassNotFoundException { +- final String name = MappedObject.class.getName(); +- String className = name.replace('.', '/'); +- +- byte[] bytecode = readStream(this.getResourceAsStream(className.concat(".class"))); +- +- long t0 = System.nanoTime(); +- bytecode = MappedObjectTransformer.transformMappedObject(bytecode); +- long t1 = System.nanoTime(); +- total_time_transforming += (t1 - t0); +- +- if ( MappedObjectTransformer.PRINT_ACTIVITY ) +- printActivity(className, t0, t1); +- +- Class clazz = super.defineClass(name, bytecode, 0, bytecode.length); +- resolveClass(clazz); +- return clazz; +- } +- +- private static long total_time_transforming; +- +- @Override +- protected synchronized Class loadClass(String name, boolean resolve) throws ClassNotFoundException { +- if ( name.startsWith("java.") +- || name.startsWith("javax.") +- || name.startsWith("sun.") +- || name.startsWith("sunw.") +- || name.startsWith("org.objectweb.asm.") +- ) +- return super.loadClass(name, resolve); +- +- final String className = name.replace('.', '/'); +- final boolean inThisPackage = name.startsWith(MAPPEDOBJECT_PACKAGE_PREFIX); +- +- if ( inThisPackage && ( +- name.equals(MappedObjectClassLoader.class.getName()) +- || name.equals((MappedObjectTransformer.class.getName())) +- || name.equals((CacheUtil.class.getName())) +- ) ) +- return super.loadClass(name, resolve); +- +- byte[] bytecode = readStream(this.getResourceAsStream(className.concat(".class"))); +- +- // Classes in this package do not get transformed, but need to go through here because we have transformed MappedObject. +- if ( !(inThisPackage && name.substring(MAPPEDOBJECT_PACKAGE_PREFIX.length()).indexOf('.') == -1) ) { +- long t0 = System.nanoTime(); +- final byte[] newBytecode = MappedObjectTransformer.transformMappedAPI(className, bytecode); +- long t1 = System.nanoTime(); +- +- total_time_transforming += (t1 - t0); +- +- if ( bytecode != newBytecode ) { +- bytecode = newBytecode; +- if ( MappedObjectTransformer.PRINT_ACTIVITY ) +- printActivity(className, t0, t1); +- } +- } +- +- Class clazz = super.defineClass(name, bytecode, 0, bytecode.length); +- if ( resolve ) +- resolveClass(clazz); +- return clazz; +- } +- +- private static void printActivity(final String className, final long t0, final long t1) { +- final StringBuilder msg = new StringBuilder(MappedObjectClassLoader.class.getSimpleName() + ": " + className); +- +- if ( MappedObjectTransformer.PRINT_TIMING ) +- msg.append("\n\ttransforming took " + (t1 - t0) / 1000 + " micros (total: " + (total_time_transforming / 1000 / 1000) + "ms)"); +- +- LWJGLUtil.log(msg); +- } +- +- private static byte[] readStream(InputStream in) { +- byte[] bytecode = new byte[256]; +- int len = 0; +- try { +- while ( true ) { +- if ( bytecode.length == len ) +- bytecode = copyOf(bytecode, len * 2); +- int got = in.read(bytecode, len, bytecode.length - len); +- if ( got == -1 ) +- break; +- len += got; +- } +- } catch (IOException exc) { +- // stop! +- } finally { +- try { +- in.close(); +- } catch (IOException exc) { +- // ignore... +- } +- } +- return copyOf(bytecode, len); +- } +- +- private static byte[] copyOf(byte[] original, int newLength) { +- byte[] copy = new byte[newLength]; +- System.arraycopy(original, 0, copy, 0, Math.min(original.length, newLength)); +- return copy; +- } +- +-} +\ No newline at end of file +diff --git a/src/java/org/lwjgl/util/mapped/MappedObjectTransformer.java b/src/java/org/lwjgl/util/mapped/MappedObjectTransformer.java +deleted file mode 100644 +index c34c14e..0000000 +--- a/src/java/org/lwjgl/util/mapped/MappedObjectTransformer.java ++++ /dev/null +@@ -1,1319 +0,0 @@ +-/* +- * Copyright (c) 2002-2011 LWJGL Project +- * All rights reserved. +- * +- * Redistribution and use in source and binary forms, with or without +- * modification, are permitted provided that the following conditions are +- * met: +- * +- * * Redistributions of source code must retain the above copyright +- * notice, this list of conditions and the following disclaimer. +- * +- * * Redistributions in binary form must reproduce the above copyright +- * notice, this list of conditions and the following disclaimer in the +- * documentation and/or other materials provided with the distribution. +- * +- * * Neither the name of 'LWJGL' nor the names of +- * its contributors may be used to endorse or promote products derived +- * from this software without specific prior written permission. +- * +- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +- */ +-package org.lwjgl.util.mapped; +- +-import org.lwjgl.BufferUtils; +-import org.lwjgl.LWJGLUtil; +-import org.lwjgl.MemoryUtil; +-import org.objectweb.asm.*; +-import org.objectweb.asm.tree.*; +-import org.objectweb.asm.tree.analysis.*; +-import org.objectweb.asm.tree.analysis.Frame; +-import org.objectweb.asm.util.TraceClassVisitor; +- +-import java.io.PrintWriter; +-import java.io.StringWriter; +-import java.lang.reflect.Field; +-import java.lang.reflect.Modifier; +-import java.nio.Buffer; +-import java.nio.ByteBuffer; +-import java.util.HashMap; +-import java.util.Map; +- +-import static org.objectweb.asm.ClassWriter.*; +-import static org.objectweb.asm.Opcodes.*; +- +-/** +- * This class implements the bytecode transformation that mapped object go through. +- * Mapped object classes need to first be registered with the transformer, see {@link #register(Class)}. +- *

+- * The transformer supports some debugging tools, enabled through JVM system properties:
+- * org.lwjgl.util.mapped.PrintTiming=true, prints timing information for the transformation step.
+- * org.lwjgl.util.mapped.PrintActivity=true, prints activity information.
+- * org.lwjgl.util.mapped.PrintBytecode=true, prints the transformed bytecode.
+- * org.lwjgl.util.Debug must also be set to true for the above to work. +- * +- * @author Riven +- */ +-public class MappedObjectTransformer { +- +- static final boolean PRINT_ACTIVITY = LWJGLUtil.DEBUG && LWJGLUtil.getPrivilegedBoolean("org.lwjgl.util.mapped.PrintActivity"); +- static final boolean PRINT_TIMING = PRINT_ACTIVITY && LWJGLUtil.getPrivilegedBoolean("org.lwjgl.util.mapped.PrintTiming"); +- static final boolean PRINT_BYTECODE = LWJGLUtil.DEBUG && LWJGLUtil.getPrivilegedBoolean("org.lwjgl.util.mapped.PrintBytecode"); +- +- static final Map className_to_subtype; +- +- static final String MAPPED_OBJECT_JVM = jvmClassName(MappedObject.class); +- static final String MAPPED_HELPER_JVM = jvmClassName(MappedHelper.class); +- +- static final String MAPPEDSET_PREFIX = jvmClassName(MappedSet.class); +- static final String MAPPED_SET2_JVM = jvmClassName(MappedSet2.class); +- static final String MAPPED_SET3_JVM = jvmClassName(MappedSet3.class); +- static final String MAPPED_SET4_JVM = jvmClassName(MappedSet4.class); +- +- static final String CACHE_LINE_PAD_JVM = "L" + jvmClassName(CacheLinePad.class) + ";"; +- +- // Public methods +- static final String VIEWADDRESS_METHOD_NAME = "getViewAddress"; +- static final String NEXT_METHOD_NAME = "next"; +- static final String ALIGN_METHOD_NAME = "getAlign"; +- static final String SIZEOF_METHOD_NAME = "getSizeof"; +- static final String CAPACITY_METHOD_NAME = "capacity"; // Used for .asArray().length +- +- // Internal methods +- static final String VIEW_CONSTRUCTOR_NAME = "constructView$LWJGL"; // Used by runViewConstructor +- +- static final Map OPCODE_TO_NAME = new HashMap(); +- static final Map INSNTYPE_TO_NAME = new HashMap(); +- +- static boolean is_currently_computing_frames; +- +- static { +- getClassEnums(Opcodes.class, OPCODE_TO_NAME, "V1_", "ACC_", "T_", "F_", "MH_"); +- getClassEnums(AbstractInsnNode.class, INSNTYPE_TO_NAME); +- +- className_to_subtype = new HashMap(); +- +- { +- // HACK: required for mapped.view++ +- // +- // because the compiler generates: +- // => GETFIELD MappedObject.view +- // => ICONST_1 +- // => IADD +- // => PUTFIELD MyMappedType.view +- // +- // instead of: +- // => GETFIELD MyMappedType.view +- // => ICONST_1 +- // => IADD +- // => PUTFIELD MyMappedType.view +- // +- className_to_subtype.put(MAPPED_OBJECT_JVM, new MappedSubtypeInfo(MAPPED_OBJECT_JVM, null, -1, -1, -1, false)); +- } +- +- final String vmName = System.getProperty("java.vm.name"); +- if ( vmName != null && !vmName.contains("Server") ) { +- System.err.println("Warning: " + MappedObject.class.getSimpleName() + "s have inferiour performance on Client VMs, please consider switching to a Server VM."); +- } +- } +- +- /** +- * Registers a class as a mapped object. +- * The class must extend {@link org.lwjgl.util.mapped.MappedObject} and be annotated with {@link org.lwjgl.util.mapped.MappedField}. +- * +- * @param type the mapped object class. +- */ +- public static void register(Class type) { +- if ( MappedObjectClassLoader.FORKED ) +- return; +- +- final MappedType mapped = type.getAnnotation(MappedType.class); +- +- if ( mapped != null && mapped.padding() < 0 ) +- throw new ClassFormatError("Invalid mapped type padding: " + mapped.padding()); +- +- if ( type.getEnclosingClass() != null && !Modifier.isStatic(type.getModifiers()) ) +- throw new InternalError("only top-level or static inner classes are allowed"); +- +- final String className = jvmClassName(type); +- final Map fields = new HashMap(); +- +- long sizeof = 0; +- for ( Field field : type.getDeclaredFields() ) { +- FieldInfo fieldInfo = registerField(mapped == null || mapped.autoGenerateOffsets(), className, sizeof, field); +- if ( fieldInfo == null ) +- continue; +- +- fields.put(field.getName(), fieldInfo); +- +- sizeof = Math.max(sizeof, fieldInfo.offset + fieldInfo.lengthPadded); +- } +- +- int align = 4; +- int padding = 0; +- boolean cacheLinePadded = false; +- +- if ( mapped != null ) { +- align = mapped.align(); +- if ( mapped.cacheLinePadding() ) { +- if ( mapped.padding() != 0 ) +- throw new ClassFormatError("Mapped type padding cannot be specified together with cacheLinePadding."); +- +- final int cacheLineMod = (int)(sizeof % CacheUtil.getCacheLineSize()); +- if ( cacheLineMod != 0 ) +- padding = CacheUtil.getCacheLineSize() - cacheLineMod; +- +- cacheLinePadded = true; +- } else +- padding = mapped.padding(); +- } +- +- sizeof += padding; +- +- final MappedSubtypeInfo mappedType = new MappedSubtypeInfo(className, fields, (int)sizeof, align, padding, cacheLinePadded); +- if ( className_to_subtype.put(className, mappedType) != null ) +- throw new InternalError("duplicate mapped type: " + mappedType.className); +- } +- +- private static FieldInfo registerField(final boolean autoGenerateOffsets, final String className, long advancingOffset, final Field field) { +- if ( Modifier.isStatic(field.getModifiers()) ) // static fields are never mapped +- return null; +- +- // we only support primitives and ByteBuffers +- if ( !field.getType().isPrimitive() && field.getType() != ByteBuffer.class ) +- throw new ClassFormatError("field '" + className + "." + field.getName() + "' not supported: " + field.getType()); +- +- MappedField meta = field.getAnnotation(MappedField.class); +- if ( meta == null && !autoGenerateOffsets ) +- throw new ClassFormatError("field '" + className + "." + field.getName() + "' missing annotation " + MappedField.class.getName() + ": " + className); +- +- Pointer pointer = field.getAnnotation(Pointer.class); +- if ( pointer != null && field.getType() != long.class ) +- throw new ClassFormatError("The @Pointer annotation can only be used on long fields. @Pointer field found: " + className + "." + field.getName() + ": " + field.getType()); +- +- if ( Modifier.isVolatile(field.getModifiers()) && (pointer != null || field.getType() == ByteBuffer.class) ) +- throw new ClassFormatError("The volatile keyword is not supported for @Pointer or ByteBuffer fields. Volatile field found: " + className + "." + field.getName() + ": " + field.getType()); +- +- // quick hack +- long byteLength; +- if ( field.getType() == long.class || field.getType() == double.class ) { +- if ( pointer == null ) +- byteLength = 8; +- else +- byteLength = MappedObjectUnsafe.INSTANCE.addressSize(); +- } else if ( field.getType() == double.class ) +- byteLength = 8; +- else if ( field.getType() == int.class || field.getType() == float.class ) +- byteLength = 4; +- else if ( field.getType() == char.class || field.getType() == short.class ) +- byteLength = 2; +- else if ( field.getType() == byte.class ) +- byteLength = 1; +- else if ( field.getType() == ByteBuffer.class ) { +- byteLength = meta.byteLength(); +- if ( byteLength < 0 ) +- throw new IllegalStateException("invalid byte length for mapped ByteBuffer field: " + className + "." + field.getName() + " [length=" + byteLength + "]"); +- } else +- throw new ClassFormatError(field.getType().getName()); +- +- if ( field.getType() != ByteBuffer.class && (advancingOffset % byteLength) != 0 ) +- throw new IllegalStateException("misaligned mapped type: " + className + "." + field.getName()); +- +- CacheLinePad pad = field.getAnnotation(CacheLinePad.class); +- +- long byteOffset = advancingOffset; +- if ( meta != null && meta.byteOffset() != -1 ) { +- if ( meta.byteOffset() < 0 ) +- throw new ClassFormatError("Invalid field byte offset: " + className + "." + field.getName() + " [byteOffset=" + meta.byteOffset() + "]"); +- if ( pad != null ) +- throw new ClassFormatError("A field byte offset cannot be specified together with cache-line padding: " + className + "." + field.getName()); +- +- byteOffset = meta.byteOffset(); +- } +- +- long byteLengthPadded = byteLength; +- if ( pad != null ) { +- // Pad before +- if ( pad.before() && byteOffset % CacheUtil.getCacheLineSize() != 0 ) +- byteOffset += CacheUtil.getCacheLineSize() - (byteOffset & (CacheUtil.getCacheLineSize() - 1)); +- +- // Pad after +- if ( pad.after() && (byteOffset + byteLength) % CacheUtil.getCacheLineSize() != 0 ) +- byteLengthPadded += CacheUtil.getCacheLineSize() - (byteOffset + byteLength) % CacheUtil.getCacheLineSize(); +- +- assert !pad.before() || (byteOffset % CacheUtil.getCacheLineSize() == 0); +- assert !pad.after() || ((byteOffset + byteLengthPadded) % CacheUtil.getCacheLineSize() == 0); +- } +- +- if ( PRINT_ACTIVITY ) +- LWJGLUtil.log(MappedObjectTransformer.class.getSimpleName() + ": " + className + "." + field.getName() + " [type=" + field.getType().getSimpleName() + ", offset=" + byteOffset + "]"); +- +- return new FieldInfo(byteOffset, byteLength, byteLengthPadded, Type.getType(field.getType()), Modifier.isVolatile(field.getModifiers()), pointer != null); +- } +- +- /** Removes final from methods that will be overriden by subclasses. */ +- static byte[] transformMappedObject(byte[] bytecode) { +- final ClassWriter cw = new ClassWriter(0); +- +- ClassVisitor cv = new ClassAdapter(cw) { +- +- private final String[] DEFINALIZE_LIST = { +- VIEWADDRESS_METHOD_NAME, +- NEXT_METHOD_NAME, +- ALIGN_METHOD_NAME, +- SIZEOF_METHOD_NAME, +- CAPACITY_METHOD_NAME, +- }; +- +- public MethodVisitor visitMethod(int access, final String name, final String desc, final String signature, final String[] exceptions) { +- for ( String method : DEFINALIZE_LIST ) { +- if ( name.equals(method) ) { +- access &= ~ACC_FINAL; +- break; +- } +- } +- return super.visitMethod(access, name, desc, signature, exceptions); +- } +- }; +- +- new ClassReader(bytecode).accept(cv, 0); +- return cw.toByteArray(); +- } +- +- static byte[] transformMappedAPI(final String className, byte[] bytecode) { +- final ClassWriter cw = new ClassWriter(COMPUTE_FRAMES) { +- +- @Override +- protected String getCommonSuperClass(String a, String b) { +- // HACK: prevent user-code static-initialization-blocks to be executed +- if ( is_currently_computing_frames && !a.startsWith("java/") || !b.startsWith("java/") ) +- return "java/lang/Object"; +- +- return super.getCommonSuperClass(a, b); +- } +- +- }; +- +- final TransformationAdapter ta = new TransformationAdapter(cw, className); +- +- ClassVisitor cv = ta; +- if ( className_to_subtype.containsKey(className) ) // Do a first pass to generate address getters +- cv = getMethodGenAdapter(className, cv); +- +- new ClassReader(bytecode).accept(cv, ClassReader.SKIP_FRAMES); +- +- if ( !ta.transformed ) +- return bytecode; +- +- bytecode = cw.toByteArray(); +- if ( PRINT_BYTECODE ) +- printBytecode(bytecode); +- +- return bytecode; +- } +- +- private static ClassAdapter getMethodGenAdapter(final String className, final ClassVisitor cv) { +- return new ClassAdapter(cv) { +- +- @Override +- public void visitEnd() { +- final MappedSubtypeInfo mappedSubtype = className_to_subtype.get(className); +- +- generateViewAddressGetter(); +- generateCapacity(); +- generateAlignGetter(mappedSubtype); +- generateSizeofGetter(); +- generateNext(); +- +- for ( String fieldName : mappedSubtype.fields.keySet() ) { +- final FieldInfo field = mappedSubtype.fields.get(fieldName); +- +- if ( field.type.getDescriptor().length() > 1 ) { // ByteBuffer, getter only +- generateByteBufferGetter(fieldName, field); +- } else { +- generateFieldGetter(fieldName, field); +- generateFieldSetter(fieldName, field); +- } +- } +- +- super.visitEnd(); +- } +- +- private void generateViewAddressGetter() { +- MethodVisitor mv = super.visitMethod(ACC_PUBLIC, VIEWADDRESS_METHOD_NAME, "(I)J", null, null); +- mv.visitCode(); +- mv.visitVarInsn(ALOAD, 0); +- mv.visitFieldInsn(GETFIELD, MAPPED_OBJECT_JVM, "baseAddress", "J"); +- mv.visitVarInsn(ILOAD, 1); +- mv.visitFieldInsn(GETSTATIC, className, "SIZEOF", "I"); +- mv.visitInsn(IMUL); +- mv.visitInsn(I2L); +- mv.visitInsn(LADD); +- if ( MappedObject.CHECKS ) { +- mv.visitInsn(DUP2); +- mv.visitVarInsn(ALOAD, 0); +- mv.visitMethodInsn(INVOKESTATIC, MAPPED_HELPER_JVM, "checkAddress", "(JL" + MAPPED_OBJECT_JVM + ";)V"); +- } +- mv.visitInsn(LRETURN); +- mv.visitMaxs(3, 2); +- mv.visitEnd(); +- } +- +- private void generateCapacity() { +- // return (backingByteBuffer().capacity() + (int)(MemoryUtil.getAddress0(backingByteBuffer()) - baseAddress)) / SIZEOF; +- MethodVisitor mv = super.visitMethod(ACC_PUBLIC, CAPACITY_METHOD_NAME, "()I", null, null); +- mv.visitCode(); +- mv.visitVarInsn(ALOAD, 0); +- mv.visitMethodInsn(INVOKEVIRTUAL, MAPPED_OBJECT_JVM, "backingByteBuffer", "()L" + jvmClassName(ByteBuffer.class) + ";"); +- mv.visitInsn(DUP); +- mv.visitMethodInsn(INVOKEVIRTUAL, jvmClassName(ByteBuffer.class), "capacity", "()I"); +- mv.visitInsn(SWAP); +- mv.visitMethodInsn(INVOKESTATIC, jvmClassName(MemoryUtil.class), "getAddress0", "(L" + jvmClassName(Buffer.class) + ";)J"); +- mv.visitVarInsn(ALOAD, 0); +- mv.visitFieldInsn(GETFIELD, MAPPED_OBJECT_JVM, "baseAddress", "J"); +- mv.visitInsn(LSUB); +- mv.visitInsn(L2I); +- mv.visitInsn(IADD); +- mv.visitFieldInsn(GETSTATIC, className, "SIZEOF", "I"); +- mv.visitInsn(IDIV); +- mv.visitInsn(IRETURN); +- mv.visitMaxs(3, 1); +- mv.visitEnd(); +- } +- +- private void generateAlignGetter(final MappedSubtypeInfo mappedSubtype) { +- MethodVisitor mv = super.visitMethod(ACC_PUBLIC, ALIGN_METHOD_NAME, "()I", null, null); +- mv.visitCode(); +- visitIntNode(mv, mappedSubtype.sizeof); +- mv.visitInsn(IRETURN); +- mv.visitMaxs(1, 1); +- mv.visitEnd(); +- } +- +- private void generateSizeofGetter() { +- MethodVisitor mv = super.visitMethod(ACC_PUBLIC, SIZEOF_METHOD_NAME, "()I", null, null); +- mv.visitCode(); +- mv.visitFieldInsn(GETSTATIC, className, "SIZEOF", "I"); +- mv.visitInsn(IRETURN); +- mv.visitMaxs(1, 1); +- mv.visitEnd(); +- } +- +- private void generateNext() { +- MethodVisitor mv = super.visitMethod(ACC_PUBLIC, NEXT_METHOD_NAME, "()V", null, null); +- mv.visitCode(); +- mv.visitVarInsn(ALOAD, 0); +- mv.visitInsn(DUP); +- mv.visitFieldInsn(GETFIELD, MAPPED_OBJECT_JVM, "viewAddress", "J"); +- mv.visitFieldInsn(GETSTATIC, className, "SIZEOF", "I"); +- mv.visitInsn(I2L); +- mv.visitInsn(LADD); +- mv.visitMethodInsn(INVOKEVIRTUAL, className, "setViewAddress", "(J)V"); +- mv.visitInsn(RETURN); +- mv.visitMaxs(3, 1); +- mv.visitEnd(); +- } +- +- private void generateByteBufferGetter(final String fieldName, final FieldInfo field) { +- MethodVisitor mv = super.visitMethod(ACC_PUBLIC | ACC_STATIC, getterName(fieldName), "(L" + className + ";I)" + field.type.getDescriptor(), null, null); +- mv.visitCode(); +- mv.visitVarInsn(ALOAD, 0); +- mv.visitVarInsn(ILOAD, 1); +- mv.visitMethodInsn(INVOKEVIRTUAL, className, VIEWADDRESS_METHOD_NAME, "(I)J"); +- visitIntNode(mv, (int)field.offset); +- mv.visitInsn(I2L); +- mv.visitInsn(LADD); +- visitIntNode(mv, (int)field.length); +- mv.visitMethodInsn(INVOKESTATIC, MAPPED_HELPER_JVM, "newBuffer", "(JI)L" + jvmClassName(ByteBuffer.class) + ";"); +- mv.visitInsn(ARETURN); +- mv.visitMaxs(3, 2); +- mv.visitEnd(); +- } +- +- private void generateFieldGetter(final String fieldName, final FieldInfo field) { +- MethodVisitor mv = super.visitMethod(ACC_PUBLIC | ACC_STATIC, getterName(fieldName), "(L" + className + ";I)" + field.type.getDescriptor(), null, null); +- mv.visitCode(); +- mv.visitVarInsn(ALOAD, 0); +- mv.visitVarInsn(ILOAD, 1); +- mv.visitMethodInsn(INVOKEVIRTUAL, className, VIEWADDRESS_METHOD_NAME, "(I)J"); +- visitIntNode(mv, (int)field.offset); +- mv.visitInsn(I2L); +- mv.visitInsn(LADD); +- mv.visitMethodInsn(INVOKESTATIC, MAPPED_HELPER_JVM, field.getAccessType() + "get", "(J)" + field.type.getDescriptor()); +- mv.visitInsn(field.type.getOpcode(IRETURN)); +- mv.visitMaxs(3, 2); +- mv.visitEnd(); +- } +- +- private void generateFieldSetter(final String fieldName, final FieldInfo field) { +- MethodVisitor mv = super.visitMethod(ACC_PUBLIC | ACC_STATIC, setterName(fieldName), "(L" + className + ";I" + field.type.getDescriptor() + ")V", null, null); +- mv.visitCode(); +- int load = 0; +- switch ( field.type.getSort() ) { +- case Type.BOOLEAN: +- case Type.CHAR: +- case Type.BYTE: +- case Type.SHORT: +- case Type.INT: +- load = ILOAD; +- break; +- case Type.FLOAT: +- load = FLOAD; +- break; +- case Type.LONG: +- load = LLOAD; +- break; +- case Type.DOUBLE: +- load = DLOAD; +- break; +- } +- mv.visitVarInsn(load, 2); +- mv.visitVarInsn(ALOAD, 0); +- mv.visitVarInsn(ILOAD, 1); +- mv.visitMethodInsn(INVOKEVIRTUAL, className, VIEWADDRESS_METHOD_NAME, "(I)J"); +- visitIntNode(mv, (int)field.offset); +- mv.visitInsn(I2L); +- mv.visitInsn(LADD); +- mv.visitMethodInsn(INVOKESTATIC, MAPPED_HELPER_JVM, field.getAccessType() + "put", "(" + field.type.getDescriptor() + "J)V"); +- mv.visitInsn(RETURN); +- mv.visitMaxs(4, 4); +- mv.visitEnd(); +- } +- +- }; +- } +- +- private static class TransformationAdapter extends ClassAdapter { +- +- final String className; +- +- boolean transformed; +- +- TransformationAdapter(final ClassVisitor cv, final String className) { +- super(cv); +- this.className = className; +- } +- +- @Override +- public FieldVisitor visitField(final int access, final String name, final String desc, final String signature, final Object value) { +- // remove redirected fields +- final MappedSubtypeInfo mappedSubtype = className_to_subtype.get(className); +- if ( mappedSubtype != null && mappedSubtype.fields.containsKey(name) ) { +- if ( PRINT_ACTIVITY ) +- LWJGLUtil.log(MappedObjectTransformer.class.getSimpleName() + ": discarding field: " + className + "." + name + ":" + desc); +- return null; +- } +- +- if ( (access & ACC_STATIC) == 0 ) { +- return new FieldNode(access, name, desc, signature, value) { +- public void visitEnd() { +- if ( visibleAnnotations == null ) { // early-out +- accept(cv); +- return; +- } +- +- boolean before = false; +- boolean after = false; +- int byteLength = 0; +- for ( AnnotationNode pad : visibleAnnotations ) { +- if ( CACHE_LINE_PAD_JVM.equals(pad.desc) ) { +- if ( "J".equals(desc) || "D".equals(desc) ) +- byteLength = 8; +- else if ( "I".equals(desc) || "F".equals(desc) ) +- byteLength = 4; +- else if ( "S".equals(desc) || "C".equals(desc) ) +- byteLength = 2; +- else if ( "B".equals(desc) || "Z".equals(desc) ) +- byteLength = 1; +- else +- throw new ClassFormatError("The @CacheLinePad annotation cannot be used on non-primitive fields: " + className + "." + name); +- +- transformed = true; +- +- after = true; +- if ( pad.values != null ) { +- for ( int i = 0; i < pad.values.size(); i += 2 ) { +- final boolean value = pad.values.get(i + 1).equals(Boolean.TRUE); +- if ( "before".equals(pad.values.get(i)) ) +- before = value; +- else +- after = value; +- } +- } +- break; +- } +- } +- +- /* +- We make the fields public to force the JVM to keep the fields in the object. +- Instead of using only longs or integers, we use the same type as the original +- field. That's because modern JVMs usually reorder fields by type: +- longs, then doubles, then integers, then booleans, etc. This way it's more +- likely that the padding will work as expected. +- */ +- +- if ( before ) { +- final int count = CacheUtil.getCacheLineSize() / byteLength - 1; +- for ( int i = count; i >= 1; i-- ) +- cv.visitField(access | ACC_PUBLIC | ACC_SYNTHETIC, name + "$PAD_" + i, desc, signature, null); +- } +- +- accept(cv); +- +- if ( after ) { +- final int count = CacheUtil.getCacheLineSize() / byteLength - 1; +- for ( int i = 1; i <= count; i++ ) +- cv.visitField(access | ACC_PUBLIC | ACC_SYNTHETIC, name + "$PAD" + i, desc, signature, null); +- } +- } +- }; +- } else +- return super.visitField(access, name, desc, signature, value); +- } +- +- @Override +- public MethodVisitor visitMethod(final int access, String name, final String desc, final String signature, final String[] exceptions) { +- // Move MappedSubtype constructors to another method +- if ( "".equals(name) ) { +- final MappedSubtypeInfo mappedSubtype = className_to_subtype.get(className); +- if ( mappedSubtype != null ) { +- if ( !"()V".equals(desc) ) +- throw new ClassFormatError(className + " can only have a default constructor, found: " + desc); +- +- final MethodVisitor mv = super.visitMethod(access, name, desc, signature, exceptions); +- mv.visitVarInsn(ALOAD, 0); +- mv.visitMethodInsn(INVOKESPECIAL, MAPPED_OBJECT_JVM, "", "()V"); +- mv.visitInsn(RETURN); +- mv.visitMaxs(0, 0); +- +- // put the method body in another method +- name = VIEW_CONSTRUCTOR_NAME; +- } +- } +- +- final MethodVisitor mv = super.visitMethod(access, name, desc, signature, exceptions); +- return new MethodNode(access, name, desc, signature, exceptions) { +- +- /** When true, the method has touched a mapped object and needs to be transformed. We track this +- * so we can skip the expensive frame analysis and tree API usage. */ +- boolean needsTransformation; +- +- @Override +- public void visitMaxs(int a, int b) { +- try { +- is_currently_computing_frames = true; +- super.visitMaxs(a, b); +- } finally { +- is_currently_computing_frames = false; +- } +- } +- +- @Override +- public void visitFieldInsn(final int opcode, final String owner, final String name, final String desc) { +- if ( className_to_subtype.containsKey(owner) || owner.startsWith(MAPPEDSET_PREFIX) ) +- needsTransformation = true; +- +- super.visitFieldInsn(opcode, owner, name, desc); +- } +- +- @Override +- public void visitMethodInsn(final int opcode, final String owner, final String name, final String desc) { +- if ( className_to_subtype.containsKey(owner) ) +- needsTransformation = true; +- +- super.visitMethodInsn(opcode, owner, name, desc); +- } +- +- @Override +- public void visitEnd() { +- if ( needsTransformation ) { // Early-out for methods that do not touch a mapped object. +- //System.err.println("\nTRANSFORMING: " + className + "." + name + desc); +- transformed = true; +- try { +- transformMethod(analyse()); +- } catch (Exception e) { +- throw new RuntimeException(e); +- } +- } +- +- // Pass the instruction stream to the adapter's MethodVisitor +- accept(mv); +- } +- +- private Frame[] analyse() throws AnalyzerException { +- final Analyzer a = new Analyzer(new SimpleVerifier()); +- a.analyze(className, this); +- return a.getFrames(); +- } +- +- private void transformMethod(final Frame[] frames) { +- final InsnList instructions = this.instructions; +- +- final Map arrayVars = new HashMap(); +- +- /* +- We need this map because we insert/remove instructions from the stream and we need a way +- to match each original instruction with the corresponding frame. +- TODO: Can we keep track of everything more efficiently without a map? +- */ +- final Map> frameMap = new HashMap>(); +- for ( int i = 0; i < frames.length; i++ ) +- frameMap.put(instructions.get(i), frames[i]); +- +- for ( int i = 0; i < instructions.size(); i++ ) { // f is a separate cursor for frames +- final AbstractInsnNode instruction = instructions.get(i); +- +- //System.out.println("MAIN LOOP #" + i + " - " + getOpcodeName(instruction)); +- +- switch ( instruction.getType() ) { +- case AbstractInsnNode.VAR_INSN: +- if ( instruction.getOpcode() == ALOAD ) { +- VarInsnNode varInsn = (VarInsnNode)instruction; +- final MappedSubtypeInfo mappedSubtype = arrayVars.get(varInsn.var); +- if ( mappedSubtype != null ) +- i = transformArrayAccess(instructions, i, frameMap, varInsn, mappedSubtype, varInsn.var); +- } +- break; +- case AbstractInsnNode.FIELD_INSN: +- FieldInsnNode fieldInsn = (FieldInsnNode)instruction; +- +- final InsnList list = transformFieldAccess(fieldInsn); +- if ( list != null ) +- i = replace(instructions, i, instruction, list); +- +- break; +- case AbstractInsnNode.METHOD_INSN: +- MethodInsnNode methodInsn = (MethodInsnNode)instruction; +- final MappedSubtypeInfo mappedType = className_to_subtype.get(methodInsn.owner); +- if ( mappedType != null ) +- i = transformMethodCall(instructions, i, frameMap, methodInsn, mappedType, arrayVars); +- break; +- } +- } +- } +- }; +- } +- } +- +- static int transformMethodCall(final InsnList instructions, int i, final Map> frameMap, final MethodInsnNode methodInsn, final MappedSubtypeInfo mappedType, final Map arrayVars) { +- switch ( methodInsn.getOpcode() ) { +- case INVOKEVIRTUAL: +- if ( "asArray".equals(methodInsn.name) && methodInsn.desc.equals("()[L" + MAPPED_OBJECT_JVM + ";") ) { +- // Go forward and store the local variable index. +- // We only allow this pattern: INVOKEVIRTUAL -> CHECKCAST -> ASTORE. +- // We remove the first two and store the target MappedSubtype in the ASTORE variable +- AbstractInsnNode nextInstruction; +- checkInsnAfterIsArray(nextInstruction = methodInsn.getNext(), CHECKCAST); +- checkInsnAfterIsArray(nextInstruction = nextInstruction.getNext(), ASTORE); +- +- final Frame frame = frameMap.get(nextInstruction); +- final String targetType = frame.getStack(frame.getStackSize() - 1).getType().getElementType().getInternalName(); +- if ( !methodInsn.owner.equals(targetType) ) { +- /* +- This may happen with the current API, like so: +- MappedA foo = MappedA.malloc(...); +- MappedB[] cursor = foo.asArray(); +- We have to parameterize MappedObject to avoid this. +- */ +- throw new ClassCastException("Source: " + methodInsn.owner + " - Target: " + targetType); +- } +- +- final VarInsnNode varInstruction = (VarInsnNode)nextInstruction; +- +- arrayVars.put(varInstruction.var, mappedType); +- +- instructions.remove(methodInsn.getNext()); // Remove CHECKCAST +- instructions.remove(methodInsn); // Remove INVOKEVIRTUAL +- } +- +- if ( "dup".equals(methodInsn.name) && methodInsn.desc.equals("()L" + MAPPED_OBJECT_JVM + ";") ) { +- i = replace(instructions, i, methodInsn, generateDupInstructions(methodInsn)); +- break; +- } +- +- if ( "slice".equals(methodInsn.name) && methodInsn.desc.equals("()L" + MAPPED_OBJECT_JVM + ";") ) { +- i = replace(instructions, i, methodInsn, generateSliceInstructions(methodInsn)); +- break; +- } +- +- if ( "runViewConstructor".equals(methodInsn.name) && "()V".equals(methodInsn.desc) ) { +- i = replace(instructions, i, methodInsn, generateRunViewConstructorInstructions(methodInsn)); +- break; +- } +- +- if ( "copyTo".equals(methodInsn.name) && methodInsn.desc.equals("(L" + MAPPED_OBJECT_JVM + ";)V") ) { +- i = replace(instructions, i, methodInsn, generateCopyToInstructions(mappedType)); +- break; +- } +- +- if ( "copyRange".equals(methodInsn.name) && methodInsn.desc.equals("(L" + MAPPED_OBJECT_JVM + ";I)V") ) { +- i = replace(instructions, i, methodInsn, generateCopyRangeInstructions(mappedType)); +- break; +- } +- +- break; +- case INVOKESPECIAL: +- // super() in VIEW_CONSTRUCTOR_NAME, remove +- if ( methodInsn.owner.equals(MAPPED_OBJECT_JVM) && "".equals(methodInsn.name) && "()V".equals(methodInsn.desc) ) { +- instructions.remove(methodInsn.getPrevious()); // ALOAD +- instructions.remove(methodInsn); // INVOKESPECIAL +- +- i -= 2; +- } +- break; +- case INVOKESTATIC: +- boolean isMapDirectMethod = "map".equals(methodInsn.name) && methodInsn.desc.equals("(JI)L" + MAPPED_OBJECT_JVM + ";"); +- boolean isMapBufferMethod = "map".equals(methodInsn.name) && methodInsn.desc.equals("(Ljava/nio/ByteBuffer;)L" + MAPPED_OBJECT_JVM + ";"); +- boolean isMallocMethod = "malloc".equals(methodInsn.name) && methodInsn.desc.equals("(I)L" + MAPPED_OBJECT_JVM + ";"); +- +- if ( (isMapDirectMethod || isMapBufferMethod) || isMallocMethod ) +- i = replace(instructions, i, methodInsn, generateMapInstructions(mappedType, methodInsn.owner, isMapDirectMethod, isMallocMethod)); +- break; +- } +- +- return i; +- } +- +- private static InsnList generateCopyRangeInstructions(final MappedSubtypeInfo mappedType) { +- final InsnList list = new InsnList(); +- +- // stack: instances, target, this +- list.add(getIntNode(mappedType.sizeof)); +- // stack: sizeof, instances, target, this +- list.add(new InsnNode(IMUL)); +- // stack: bytes, target, this +- list.add(new MethodInsnNode(INVOKESTATIC, MAPPED_HELPER_JVM, "copy", "(L" + MAPPED_OBJECT_JVM + ";L" + MAPPED_OBJECT_JVM + ";I)V")); +- // stack: - +- +- return list; +- } +- +- private static InsnList generateCopyToInstructions(final MappedSubtypeInfo mappedType) { +- final InsnList list = new InsnList(); +- +- // stack: target, this +- list.add(getIntNode(mappedType.sizeof - mappedType.padding)); +- // stack: sizeof, target, this +- list.add(new MethodInsnNode(INVOKESTATIC, MAPPED_HELPER_JVM, "copy", "(L" + MAPPED_OBJECT_JVM + ";L" + MAPPED_OBJECT_JVM + ";I)V")); +- // stack: - +- +- return list; +- } +- +- private static InsnList generateRunViewConstructorInstructions(final MethodInsnNode methodInsn) { +- final InsnList list = new InsnList(); +- +- // stack: this +- list.add(new InsnNode(DUP)); +- // stack: this, this +- list.add(new MethodInsnNode(INVOKEVIRTUAL, methodInsn.owner, VIEW_CONSTRUCTOR_NAME, "()V")); +- // stack: this +- +- return list; +- } +- +- private static InsnList generateSliceInstructions(final MethodInsnNode methodInsn) { +- final InsnList list = new InsnList(); +- +- // stack: this +- list.add(new TypeInsnNode(NEW, methodInsn.owner)); +- // stack: new, this +- list.add(new InsnNode(DUP)); +- // stack: new, new, this +- list.add(new MethodInsnNode(INVOKESPECIAL, methodInsn.owner, "", "()V")); +- // stack: new, this +- list.add(new MethodInsnNode(INVOKESTATIC, MAPPED_HELPER_JVM, "slice", "(L" + MAPPED_OBJECT_JVM + ";L" + MAPPED_OBJECT_JVM + ";)L" + MAPPED_OBJECT_JVM + ";")); +- // stack: new +- +- return list; +- } +- +- private static InsnList generateDupInstructions(final MethodInsnNode methodInsn) { +- final InsnList list = new InsnList(); +- +- // stack: this +- list.add(new TypeInsnNode(NEW, methodInsn.owner)); +- // stack: new, this +- list.add(new InsnNode(DUP)); +- // stack: new, new, this +- list.add(new MethodInsnNode(INVOKESPECIAL, methodInsn.owner, "", "()V")); +- // stack: new, this +- list.add(new MethodInsnNode(INVOKESTATIC, MAPPED_HELPER_JVM, "dup", "(L" + MAPPED_OBJECT_JVM + ";L" + MAPPED_OBJECT_JVM + ";)L" + MAPPED_OBJECT_JVM + ";")); +- // stack: new +- +- return list; +- } +- +- private static InsnList generateMapInstructions(final MappedSubtypeInfo mappedType, final String className, final boolean mapDirectMethod, final boolean mallocMethod) { +- final InsnList trg = new InsnList(); +- +- if ( mallocMethod ) { +- // stack: count +- trg.add(getIntNode(mappedType.sizeof)); +- // stack: sizeof, count +- trg.add(new InsnNode(IMUL)); +- // stack: bytes +- trg.add(new MethodInsnNode(INVOKESTATIC, mappedType.cacheLinePadded ? jvmClassName(CacheUtil.class) : jvmClassName(BufferUtils.class), "createByteBuffer", "(I)L" + jvmClassName(ByteBuffer.class) + ";")); +- // stack: buffer +- } else if ( mapDirectMethod ) { +- // stack: capacity, address +- trg.add(new MethodInsnNode(INVOKESTATIC, MAPPED_HELPER_JVM, "newBuffer", "(JI)L" + jvmClassName(ByteBuffer.class) + ";")); +- // stack: buffer +- } +- +- // stack: buffer +- trg.add(new TypeInsnNode(NEW, className)); +- // stack: new, buffer +- trg.add(new InsnNode(DUP)); +- // stack: new, new, buffer +- trg.add(new MethodInsnNode(INVOKESPECIAL, className, "", "()V")); +- // stack: new, buffer +- trg.add(new InsnNode(DUP_X1)); +- // stack: new, buffer, new +- trg.add(new InsnNode(SWAP)); +- // stack: buffer, new, new +- trg.add(getIntNode(mappedType.align)); +- // stack: int, buffer, new, new +- trg.add(getIntNode(mappedType.sizeof)); +- // stack: int, int, buffer, new, new +- trg.add(new MethodInsnNode(INVOKESTATIC, MAPPED_HELPER_JVM, "setup", "(L" + MAPPED_OBJECT_JVM + ";Ljava/nio/ByteBuffer;II)V")); +- // stack: new +- +- return trg; +- } +- +- static InsnList transformFieldAccess(final FieldInsnNode fieldInsn) { +- final MappedSubtypeInfo mappedSubtype; +- mappedSubtype = className_to_subtype.get(fieldInsn.owner); +- if ( mappedSubtype == null ) { // early out +- // MappedSet.view +- outer: +- if ( "view".equals(fieldInsn.name) && fieldInsn.owner.startsWith(MAPPEDSET_PREFIX) ) +- return generateSetViewInstructions(fieldInsn); +- +- return null; // early out +- } +- +- if ( "SIZEOF".equals(fieldInsn.name) ) +- return generateSIZEOFInstructions(fieldInsn, mappedSubtype); +- +- if ( "view".equals(fieldInsn.name) ) +- return generateViewInstructions(fieldInsn, mappedSubtype); +- +- if ( "baseAddress".equals(fieldInsn.name) || "viewAddress".equals(fieldInsn.name) ) { +- return generateAddressInstructions(fieldInsn); +- } +- +- final FieldInfo field = mappedSubtype.fields.get(fieldInsn.name); +- if ( field == null ) // early out +- return null; +- +- // now we're going to transform ByteBuffer-typed field access +- if ( fieldInsn.desc.equals("L" + jvmClassName(ByteBuffer.class) + ";") ) +- return generateByteBufferInstructions(fieldInsn, mappedSubtype, field.offset); +- +- // we're now going to transform the field access +- return generateFieldInstructions(fieldInsn, field); +- } +- +- private static InsnList generateSetViewInstructions(final FieldInsnNode fieldInsn) { +- if ( fieldInsn.getOpcode() == GETFIELD ) +- throwAccessErrorOnReadOnlyField(fieldInsn.owner, fieldInsn.name); +- if ( fieldInsn.getOpcode() != PUTFIELD ) +- throw new InternalError(); +- +- final InsnList list = new InsnList(); +- +- // stack: index, this +- if ( MAPPED_SET2_JVM.equals(fieldInsn.owner) ) +- list.add(new MethodInsnNode(INVOKESTATIC, MAPPED_HELPER_JVM, "put_views", "(L" + MAPPED_SET2_JVM + ";I)V")); +- else if ( MAPPED_SET3_JVM.equals(fieldInsn.owner) ) +- list.add(new MethodInsnNode(INVOKESTATIC, MAPPED_HELPER_JVM, "put_views", "(L" + MAPPED_SET3_JVM + ";I)V")); +- else if ( MAPPED_SET4_JVM.equals(fieldInsn.owner) ) +- list.add(new MethodInsnNode(INVOKESTATIC, MAPPED_HELPER_JVM, "put_views", "(L" + MAPPED_SET4_JVM + ";I)V")); +- else +- throw new InternalError(); +- // stack: - +- +- return list; +- } +- +- private static InsnList generateSIZEOFInstructions(final FieldInsnNode fieldInsn, final MappedSubtypeInfo mappedSubtype) { +- if ( !"I".equals(fieldInsn.desc) ) +- throw new InternalError(); +- +- final InsnList list = new InsnList(); +- +- if ( fieldInsn.getOpcode() == GETSTATIC ) { +- list.add(getIntNode(mappedSubtype.sizeof)); +- return list; +- } +- +- if ( fieldInsn.getOpcode() == PUTSTATIC ) +- throwAccessErrorOnReadOnlyField(fieldInsn.owner, fieldInsn.name); +- +- throw new InternalError(); +- } +- +- private static InsnList generateViewInstructions(final FieldInsnNode fieldInsn, final MappedSubtypeInfo mappedSubtype) { +- if ( !"I".equals(fieldInsn.desc) ) +- throw new InternalError(); +- +- final InsnList list = new InsnList(); +- +- if ( fieldInsn.getOpcode() == GETFIELD ) { +- if ( mappedSubtype.sizeof_shift != 0 ) { +- // stack: instance +- list.add(getIntNode(mappedSubtype.sizeof_shift)); +- // stack: sizeof, instance +- list.add(new MethodInsnNode(INVOKESTATIC, MAPPED_HELPER_JVM, "get_view_shift", "(L" + MAPPED_OBJECT_JVM + ";I)I")); +- // stack: view +- } else { +- // stack: instance +- list.add(getIntNode(mappedSubtype.sizeof)); +- // stack: sizeof, instance +- list.add(new MethodInsnNode(INVOKESTATIC, MAPPED_HELPER_JVM, "get_view", "(L" + MAPPED_OBJECT_JVM + ";I)I")); +- // stack: view +- } +- return list; +- } +- +- if ( fieldInsn.getOpcode() == PUTFIELD ) { +- if ( mappedSubtype.sizeof_shift != 0 ) { +- // stack: view, instance +- list.add(getIntNode(mappedSubtype.sizeof_shift)); +- // stack: sizeof, view, instance +- list.add(new MethodInsnNode(INVOKESTATIC, MAPPED_HELPER_JVM, "put_view_shift", "(L" + MAPPED_OBJECT_JVM + ";II)V")); +- // stack: - +- } else { +- // stack: view, instance +- list.add(getIntNode(mappedSubtype.sizeof)); +- // stack: sizeof, view, instance +- list.add(new MethodInsnNode(INVOKESTATIC, MAPPED_HELPER_JVM, "put_view", "(L" + MAPPED_OBJECT_JVM + ";II)V")); +- // stack: - +- } +- return list; +- } +- +- throw new InternalError(); +- } +- +- private static InsnList generateAddressInstructions(final FieldInsnNode fieldInsn) { +- if ( !"J".equals(fieldInsn.desc) ) +- throw new IllegalStateException(); +- +- if ( fieldInsn.getOpcode() == GETFIELD ) // do not change a thing +- return null; +- +- if ( fieldInsn.getOpcode() == PUTFIELD ) +- throwAccessErrorOnReadOnlyField(fieldInsn.owner, fieldInsn.name); +- +- throw new InternalError(); +- } +- +- private static InsnList generateByteBufferInstructions(final FieldInsnNode fieldInsn, final MappedSubtypeInfo mappedSubtype, final long fieldOffset) { +- if ( fieldInsn.getOpcode() == PUTFIELD ) +- throwAccessErrorOnReadOnlyField(fieldInsn.owner, fieldInsn.name); +- +- if ( fieldInsn.getOpcode() == GETFIELD ) { +- final InsnList list = new InsnList(); +- +- // stack: ref +- list.add(new FieldInsnNode(GETFIELD, mappedSubtype.className, "viewAddress", "J")); +- // stack: long +- list.add(new LdcInsnNode(fieldOffset)); +- // stack: long, long +- list.add(new InsnNode(LADD)); +- // stack: long +- list.add(new LdcInsnNode(mappedSubtype.fields.get(fieldInsn.name).length)); +- // stack: long, long +- list.add(new InsnNode(L2I)); +- // stack: int, long +- list.add(new MethodInsnNode(INVOKESTATIC, MAPPED_HELPER_JVM, "newBuffer", "(JI)L" + jvmClassName(ByteBuffer.class) + ";")); +- // stack: buffer +- +- return list; +- } +- +- throw new InternalError(); +- } +- +- private static InsnList generateFieldInstructions(final FieldInsnNode fieldInsn, final FieldInfo field) { +- final InsnList list = new InsnList(); +- +- if ( fieldInsn.getOpcode() == PUTFIELD ) { +- // stack: value, ref +- list.add(getIntNode((int)field.offset)); +- // stack: fieldOffset, value, ref +- list.add(new MethodInsnNode(INVOKESTATIC, MAPPED_HELPER_JVM, field.getAccessType() + "put", "(L" + MAPPED_OBJECT_JVM + ";" + fieldInsn.desc + "I)V")); +- // stack - +- return list; +- } +- +- if ( fieldInsn.getOpcode() == GETFIELD ) { +- // stack: ref +- list.add(getIntNode((int)field.offset)); +- // stack: fieldOffset, ref +- list.add(new MethodInsnNode(INVOKESTATIC, MAPPED_HELPER_JVM, field.getAccessType() + "get", "(L" + MAPPED_OBJECT_JVM + ";I)" + fieldInsn.desc)); +- // stack: - +- return list; +- } +- +- throw new InternalError(); +- } +- +- static int transformArrayAccess(final InsnList instructions, int i, final Map> frameMap, final VarInsnNode loadInsn, final MappedSubtypeInfo mappedSubtype, final int var) { +- // We need to go forward in time to find how we use the array var +- final int loadStackSize = frameMap.get(loadInsn).getStackSize() + 1; +- +- AbstractInsnNode nextInsn = loadInsn; +- +- while ( true ) { +- nextInsn = nextInsn.getNext(); +- if ( nextInsn == null ) +- throw new InternalError(); +- +- Frame frame = frameMap.get(nextInsn); +- if ( frame == null ) +- continue; +- +- int stackSize = frame.getStackSize(); +- +- if ( stackSize == loadStackSize + 1 && nextInsn.getOpcode() == AALOAD ) { +- final AbstractInsnNode aaLoadInsn = nextInsn; +- +- while ( true ) { +- nextInsn = nextInsn.getNext(); +- if ( nextInsn == null ) +- break; +- +- frame = frameMap.get(nextInsn); +- if ( frame == null ) +- continue; +- stackSize = frame.getStackSize(); +- +- if ( stackSize == loadStackSize + 1 && nextInsn.getOpcode() == PUTFIELD ) { +- final FieldInsnNode fieldInsn = (FieldInsnNode)nextInsn; +- +- // stack: value, view, ref +- instructions.insert(nextInsn, new MethodInsnNode(INVOKESTATIC, mappedSubtype.className, setterName(fieldInsn.name), "(L" + mappedSubtype.className + ";I" + fieldInsn.desc + ")V")); +- // stack: - +- instructions.remove(nextInsn); +- +- break; +- } else if ( stackSize == loadStackSize && nextInsn.getOpcode() == GETFIELD ) { +- final FieldInsnNode fieldInsn = (FieldInsnNode)nextInsn; +- +- // stack: view, ref +- instructions.insert(nextInsn, new MethodInsnNode(INVOKESTATIC, mappedSubtype.className, getterName(fieldInsn.name), "(L" + mappedSubtype.className + ";I)" + fieldInsn.desc)); +- // stack: value +- instructions.remove(nextInsn); +- +- break; +- } else if ( stackSize == loadStackSize && nextInsn.getOpcode() == DUP && nextInsn.getNext().getOpcode() == GETFIELD ) { +- // May happen with operator+assignment (e.g. cursor[i].value += 10) +- final FieldInsnNode fieldInsn = (FieldInsnNode)nextInsn.getNext(); +- +- final MethodInsnNode getter = new MethodInsnNode(INVOKESTATIC, mappedSubtype.className, getterName(fieldInsn.name), "(L" + mappedSubtype.className + ";I)" + fieldInsn.desc); +- +- // stack: view, ref +- instructions.insert(nextInsn, new InsnNode(DUP2)); +- // stack: view, ref, view, ref +- instructions.insert(nextInsn.getNext(), getter); +- // stack: value, view, ref +- +- instructions.remove(nextInsn); +- instructions.remove(fieldInsn); +- +- nextInsn = getter; +- continue; +- } else if ( stackSize < loadStackSize ) +- throw new ClassFormatError("Invalid " + mappedSubtype.className + " view array usage detected: " + getOpcodeName(nextInsn)); +- } +- +- instructions.remove(aaLoadInsn); +- +- return i; +- } else if ( stackSize == loadStackSize && nextInsn.getOpcode() == ARRAYLENGTH ) { +- if ( LWJGLUtil.DEBUG && loadInsn.getNext() != nextInsn ) +- throw new InternalError(); +- +- instructions.remove(nextInsn); +- loadInsn.var = var; +- instructions.insert(loadInsn, new MethodInsnNode(INVOKEVIRTUAL, mappedSubtype.className, CAPACITY_METHOD_NAME, "()I")); +- +- return i + 1; +- } else if ( stackSize < loadStackSize ) // Consumed by something other than AALOAD or ARRAYLENGTH +- throw new ClassFormatError("Invalid " + mappedSubtype.className + " view array usage detected: " + getOpcodeName(nextInsn)); +- } +- } +- +- private static class FieldInfo { +- +- final long offset; +- final long length; +- final long lengthPadded; +- final Type type; +- final boolean isVolatile; +- final boolean isPointer; +- +- FieldInfo(final long offset, final long length, final long lengthPadded, final Type type, final boolean isVolatile, final boolean isPointer) { +- this.offset = offset; +- this.length = length; +- this.lengthPadded = lengthPadded; +- this.type = type; +- this.isVolatile = isVolatile; +- this.isPointer = isPointer; +- } +- +- String getAccessType() { +- return isPointer ? "a" : type.getDescriptor().toLowerCase() + (isVolatile ? "v" : ""); +- } +- +- } +- +- private static class MappedSubtypeInfo { +- +- final String className; +- +- final int sizeof; +- final int sizeof_shift; +- final int align; +- final int padding; +- final boolean cacheLinePadded; +- +- final Map fields; +- +- MappedSubtypeInfo(String className, Map fields, int sizeof, int align, int padding, final boolean cacheLinePadded) { +- this.className = className; +- +- this.sizeof = sizeof; +- if ( ((sizeof - 1) & sizeof) == 0 ) +- this.sizeof_shift = getPoT(sizeof); +- else +- this.sizeof_shift = 0; +- this.align = align; +- this.padding = padding; +- this.cacheLinePadded = cacheLinePadded; +- +- this.fields = fields; +- } +- +- private static int getPoT(int value) { +- int pot = -1; +- while ( value > 0 ) { +- pot++; +- value >>= 1; +- } +- return pot; +- } +- +- } +- +- // ------------------------------------------------------- +- // -------------------[ MACROS & UTILS ]------------------ +- // ------------------------------------------------------- +- +- private static void getClassEnums(final Class clazz, final Map map, final String... prefixFilters) { +- try { +- OUTER: +- for ( Field field : clazz.getFields() ) { +- if ( !Modifier.isStatic(field.getModifiers()) || field.getType() != int.class ) +- continue; +- +- for ( String filter : prefixFilters ) { +- if ( field.getName().startsWith(filter) ) +- continue OUTER; +- } +- +- if ( map.put((Integer)field.get(null), field.getName()) != null ) +- throw new IllegalStateException(); +- } +- } catch (Exception e) { +- e.printStackTrace(); +- } +- } +- +- static String getOpcodeName(final AbstractInsnNode insn) { +- final String op = OPCODE_TO_NAME.get(insn.getOpcode()); +- return INSNTYPE_TO_NAME.get(insn.getType()) + ": " + insn.getOpcode() + (op == null ? "" : " [" + OPCODE_TO_NAME.get(insn.getOpcode()) + "]"); +- } +- +- static String jvmClassName(Class type) { +- return type.getName().replace('.', '/'); +- } +- +- static String getterName(final String fieldName) { +- return "get$" + Character.toUpperCase(fieldName.charAt(0)) + fieldName.substring(1) + "$LWJGL"; +- } +- +- static String setterName(final String fieldName) { +- return "set$" + Character.toUpperCase(fieldName.charAt(0)) + fieldName.substring(1) + "$LWJGL"; +- } +- +- private static void checkInsnAfterIsArray(final AbstractInsnNode instruction, final int opcode) { +- if ( instruction == null ) +- throw new ClassFormatError("Unexpected end of instructions after .asArray() method."); +- +- if ( instruction.getOpcode() != opcode ) +- throw new ClassFormatError("The result of .asArray() must be stored to a local variable. Found: " + getOpcodeName(instruction)); +- } +- +- static AbstractInsnNode getIntNode(final int value) { +- if ( value <= 5 && -1 <= value ) +- return new InsnNode(ICONST_M1 + value + 1); +- +- if ( value >= Byte.MIN_VALUE && value <= Byte.MAX_VALUE ) +- return new IntInsnNode(BIPUSH, value); +- +- if ( value >= Short.MIN_VALUE && value <= Short.MAX_VALUE ) +- return new IntInsnNode(SIPUSH, value); +- +- return new LdcInsnNode(value); +- } +- +- static void visitIntNode(final MethodVisitor mv, final int value) { +- if ( value <= 5 && -1 <= value ) +- mv.visitInsn(ICONST_M1 + value + 1); +- else if ( value >= Byte.MIN_VALUE && value <= Byte.MAX_VALUE ) +- mv.visitIntInsn(BIPUSH, value); +- else if ( value >= Short.MIN_VALUE && value <= Short.MAX_VALUE ) +- mv.visitIntInsn(SIPUSH, value); +- else +- mv.visitLdcInsn(value); +- } +- +- /** Replace an instruction with a list of instructions. */ +- static int replace(final InsnList instructions, final int i, final AbstractInsnNode location, final InsnList list) { +- final int size = list.size(); +- +- instructions.insert(location, list); +- instructions.remove(location); +- +- return i + (size - 1); +- } +- +- private static void throwAccessErrorOnReadOnlyField(String className, String fieldName) { +- throw new IllegalAccessError("The " + className + "." + fieldName + " field is final."); +- } +- +- private static void printBytecode(byte[] bytecode) { +- StringWriter sw = new StringWriter(); +- ClassVisitor tracer = new TraceClassVisitor(new ClassWriter(0), new PrintWriter(sw)); +- new ClassReader(bytecode).accept(tracer, 0); +- String dump = sw.toString(); +- +- LWJGLUtil.log(dump); +- } +- +-} +\ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/debian/patches/nomacosx.patch lwjgl-2.9.3+dfsg/debian/patches/nomacosx.patch --- lwjgl-2.7.1+dfsg/debian/patches/nomacosx.patch 2015-12-09 17:33:01.000000000 +0000 +++ lwjgl-2.9.3+dfsg/debian/patches/nomacosx.patch 2016-04-09 20:33:57.000000000 +0000 @@ -1,58 +1,72 @@ -Author: Gabriele Giacone <1o5g4r8o@gmail.com> -Description: remove references to macosx-related classes +From: Markus Koschany +Date: Sat, 9 Apr 2016 18:59:10 +0200 +Subject: nomacosx +We don't support MacOSX. + +Forwarded: not-needed +--- + build.xml | 12 ++++++------ + platform_build/build-applet.xml | 4 ++-- + src/java/org/lwjgl/MacOSXSysImplementation.java | 4 ++-- + 3 files changed, 10 insertions(+), 10 deletions(-) + +diff --git a/build.xml b/build.xml +index 736c91a..2b5105e 100644 --- a/build.xml +++ b/build.xml -@@ -246,7 +246,7 @@ - +@@ -331,7 +331,7 @@ + -- -+ ++ --> - + -@@ -293,13 +293,13 @@ +@@ -394,13 +394,13 @@ - -+ ++ --> -@@ -314,13 +314,13 @@ +@@ -415,13 +415,13 @@ - -+ ++ --> lwjgl.java.windows.version = ${lwjgl.java.windows.version} lwjgl.native.windows.version = ${lwjgl.native.windows.version} +diff --git a/platform_build/build-applet.xml b/platform_build/build-applet.xml +index 588347d..5f95b13 100644 --- a/platform_build/build-applet.xml +++ b/platform_build/build-applet.xml @@ -1,7 +1,7 @@ @@ -60,56 +74,36 @@ - -+ ++ +@@ -144,4 +144,4 @@ + + + +- +\ No newline at end of file ++ +diff --git a/src/java/org/lwjgl/MacOSXSysImplementation.java b/src/java/org/lwjgl/MacOSXSysImplementation.java +index b92cdee..599abe2 100644 --- a/src/java/org/lwjgl/MacOSXSysImplementation.java +++ b/src/java/org/lwjgl/MacOSXSysImplementation.java -@@ -33,7 +33,7 @@ package org.lwjgl; - - import java.awt.Toolkit; +@@ -31,7 +31,7 @@ + */ + package org.lwjgl; -import com.apple.eio.FileManager; +//import com.apple.eio.FileManager; - - /** - * -@@ -55,7 +55,7 @@ final class MacOSXSysImplementation exte + import java.security.AccessController; + import java.security.PrivilegedAction; + import java.security.PrivilegedExceptionAction; +@@ -57,7 +57,7 @@ final class MacOSXSysImplementation extends J2SESysImplementation { public boolean openURL(String url) { try { - FileManager.openURL(url); -+// FileManager.openURL(url); ++ //FileManager.openURL(url); return true; } catch (Exception e) { LWJGLUtil.log("Exception occurred while trying to invoke browser: " + e); ---- a/src/java/org/lwjgl/opengl/MacOSXDisplay.java -+++ b/src/java/org/lwjgl/opengl/MacOSXDisplay.java -@@ -54,9 +54,9 @@ import org.lwjgl.BufferUtils; - import org.lwjgl.LWJGLException; - import org.lwjgl.LWJGLUtil; - --import com.apple.eawt.Application; --import com.apple.eawt.ApplicationAdapter; --import com.apple.eawt.ApplicationEvent; -+//import com.apple.eawt.Application; -+//import com.apple.eawt.ApplicationAdapter; -+//import com.apple.eawt.ApplicationEvent; - - import static org.lwjgl.opengl.GL11.*; - -@@ -79,11 +79,11 @@ final class MacOSXDisplay implements Dis - try { - AccessController.doPrivileged(new PrivilegedExceptionAction() { - public Object run() throws Exception { -- Application.getApplication().addApplicationListener(new ApplicationAdapter() { -+/* Application.getApplication().addApplicationListener(new ApplicationAdapter() { - public void handleQuit(ApplicationEvent event) { - doHandleQuit(); - } -- }); -+ }); */ - return null; - } - }); diff -Nru lwjgl-2.7.1+dfsg/debian/patches/ppc64el.patch lwjgl-2.9.3+dfsg/debian/patches/ppc64el.patch --- lwjgl-2.7.1+dfsg/debian/patches/ppc64el.patch 2015-12-09 17:33:01.000000000 +0000 +++ lwjgl-2.9.3+dfsg/debian/patches/ppc64el.patch 2016-04-09 20:33:57.000000000 +0000 @@ -1,7 +1,19 @@ -Index: lwjgl-2.7.1+dfsg/platform_build/linux_ant/build.xml -=================================================================== ---- lwjgl-2.7.1+dfsg.orig/platform_build/linux_ant/build.xml -+++ lwjgl-2.7.1+dfsg/platform_build/linux_ant/build.xml +From: Markus Koschany +Date: Sat, 9 Apr 2016 19:13:26 +0200 +Subject: ppc64el + +Support the ppc64el platform. Not absolutely sure if this is still needed +though. + +Forwarded: not-needed +--- + platform_build/linux_ant/build.xml | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/platform_build/linux_ant/build.xml b/platform_build/linux_ant/build.xml +index 72eb346..2e9a22e 100644 +--- a/platform_build/linux_ant/build.xml ++++ b/platform_build/linux_ant/build.xml @@ -23,6 +23,10 @@ @@ -10,15 +22,6 @@ + + + - + -@@ -124,7 +128,7 @@ - - - -- -+ - - - diff -Nru lwjgl-2.7.1+dfsg/debian/patches/series lwjgl-2.9.3+dfsg/debian/patches/series --- lwjgl-2.7.1+dfsg/debian/patches/series 2015-12-09 17:33:01.000000000 +0000 +++ lwjgl-2.9.3+dfsg/debian/patches/series 2016-04-09 20:33:57.000000000 +0000 @@ -1,5 +1,7 @@ +javadoc.patch nomacosx.patch allarchs.patch -systemjinput.patch -javadoc.patch ppc64el.patch +systemjinput.patch +build-failure.patch +no-asm-support.patch diff -Nru lwjgl-2.7.1+dfsg/debian/patches/systemjinput.patch lwjgl-2.9.3+dfsg/debian/patches/systemjinput.patch --- lwjgl-2.7.1+dfsg/debian/patches/systemjinput.patch 2015-12-09 17:33:01.000000000 +0000 +++ lwjgl-2.9.3+dfsg/debian/patches/systemjinput.patch 2016-04-09 20:33:57.000000000 +0000 @@ -1,25 +1,35 @@ -Author: Gabriele Giacone <1o5g4r8o@gmail.com> -Description: build against system jinput libraries +From: Markus Koschany +Date: Sat, 9 Apr 2016 19:19:25 +0200 +Subject: systemjinput +Use Debian's jinput.jar. + +Forwarded: not-needed +--- + build.xml | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/build.xml b/build.xml +index 2b5105e..c78b2dc 100644 --- a/build.xml +++ b/build.xml -@@ -137,6 +137,7 @@ - +@@ -138,6 +138,7 @@ + + - -@@ -146,6 +147,7 @@ - + +@@ -150,6 +151,7 @@ + + -@@ -501,7 +503,7 @@ +@@ -662,7 +664,7 @@ diff -Nru lwjgl-2.7.1+dfsg/debian/README.source lwjgl-2.9.3+dfsg/debian/README.source --- lwjgl-2.7.1+dfsg/debian/README.source 2015-12-09 17:33:01.000000000 +0000 +++ lwjgl-2.9.3+dfsg/debian/README.source 2016-04-09 20:33:57.000000000 +0000 @@ -6,7 +6,7 @@ To comply with DFSG, the following files have been removed from upstream tarball: - # binary + # binary - platform_build/Pack200Task.jar - platform_build/JLzma.jar diff -Nru lwjgl-2.7.1+dfsg/debian/rules lwjgl-2.9.3+dfsg/debian/rules --- lwjgl-2.7.1+dfsg/debian/rules 2015-12-09 17:33:01.000000000 +0000 +++ lwjgl-2.9.3+dfsg/debian/rules 2016-04-09 20:33:57.000000000 +0000 @@ -6,19 +6,22 @@ TAR := ../$(NAME)_$(VERSION).orig.tar.gz TARDFSG := ../$(NAME)_$(VERSION)+dfsg.orig.tar.gz -export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-$(DEB_BUILD_ARCH) +export JAVA_HOME=/usr/lib/jvm/default-java export PATH:=$(JAVA_HOME)/bin:$(PATH) # NOTE: jutils is explicitly included here (without a depends in our control # file) because jinput.jar lacks jutils in its own "Class-Path" (bug #626002) +# 2016-04-09: Although #626002 appears to be fixed jutils.jar is still required +# on the CLASSPATH. export CLASSPATH=/usr/share/java/jinput.jar:/usr/share/java/jutils.jar +export DEB_BUILD_MAINT_OPTIONS = hardening=+all %: - dh $@ + dh $@ --parallel --with javahelper override_dh_auto_build: ant jars - ant compile_native + ant compile_native ant javadoc override_dh_auto_install: diff -Nru lwjgl-2.7.1+dfsg/debian/watch lwjgl-2.9.3+dfsg/debian/watch --- lwjgl-2.7.1+dfsg/debian/watch 2015-12-09 17:33:01.000000000 +0000 +++ lwjgl-2.9.3+dfsg/debian/watch 2016-04-09 20:33:57.000000000 +0000 @@ -1,3 +1,3 @@ -version=3 +version=4 opts="dversionmangle=s/\+dfsg//" \ -http://sf.net/java-game-lib/lwjgl-source-(.*).zip +http://sf.net/java-game-lib/lwjgl-source-(\d.*).zip diff -Nru lwjgl-2.7.1+dfsg/platform_build/bsd_ant/build.xml lwjgl-2.9.3+dfsg/platform_build/bsd_ant/build.xml --- lwjgl-2.7.1+dfsg/platform_build/bsd_ant/build.xml 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/platform_build/bsd_ant/build.xml 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru lwjgl-2.7.1+dfsg/platform_build/build-definitions.xml lwjgl-2.9.3+dfsg/platform_build/build-definitions.xml --- lwjgl-2.7.1+dfsg/platform_build/build-definitions.xml 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/platform_build/build-definitions.xml 2016-04-09 16:26:57.000000000 +0000 @@ -12,12 +12,19 @@ - + - - - + + + + + + + + + + @@ -27,13 +34,19 @@ + - + + + + + + @@ -46,6 +59,7 @@ + @@ -59,6 +73,14 @@ + + + + + + + + @@ -68,7 +90,7 @@ - + @@ -116,7 +138,7 @@ - + @@ -125,12 +147,12 @@ - + - - + + diff -Nru lwjgl-2.7.1+dfsg/platform_build/build-generator.xml lwjgl-2.9.3+dfsg/platform_build/build-generator.xml --- lwjgl-2.7.1+dfsg/platform_build/build-generator.xml 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/platform_build/build-generator.xml 2016-04-09 16:26:57.000000000 +0000 @@ -1,5 +1,7 @@ + + @@ -14,223 +16,392 @@ - - + + + + + + + + + - + - - + + + + + + + - - - + - - + + + - + - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + diff -Nru lwjgl-2.7.1+dfsg/platform_build/build-maven.xml lwjgl-2.9.3+dfsg/platform_build/build-maven.xml --- lwjgl-2.7.1+dfsg/platform_build/build-maven.xml 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/platform_build/build-maven.xml 2016-04-09 16:26:57.000000000 +0000 @@ -3,13 +3,12 @@ - - - - + + + @@ -23,6 +22,56 @@ + + + + + + + + + + + + + + @@ -34,7 +83,7 @@ - + @@ -45,6 +94,12 @@ + + + + + + @@ -113,7 +168,7 @@ - + @@ -123,7 +178,7 @@ - + @@ -137,6 +192,7 @@ + @@ -148,7 +204,7 @@ - + diff -Nru lwjgl-2.7.1+dfsg/platform_build/linux_ant/build_es.xml lwjgl-2.9.3+dfsg/platform_build/linux_ant/build_es.xml --- lwjgl-2.7.1+dfsg/platform_build/linux_ant/build_es.xml 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/platform_build/linux_ant/build_es.xml 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,127 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/platform_build/linux_ant/build.xml lwjgl-2.9.3+dfsg/platform_build/linux_ant/build.xml --- lwjgl-2.7.1+dfsg/platform_build/linux_ant/build.xml 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/platform_build/linux_ant/build.xml 2016-04-09 16:26:57.000000000 +0000 @@ -4,7 +4,7 @@ - + @@ -21,9 +21,6 @@ - - - @@ -39,8 +36,8 @@ - - + + @@ -65,7 +62,7 @@ - + @@ -73,12 +70,18 @@ + + - - - - + + + + + + + + @@ -91,7 +94,7 @@ - + @@ -99,12 +102,18 @@ + + - - - - + + + + + + + + diff -Nru lwjgl-2.7.1+dfsg/platform_build/macosx_ant/build-symbol-list lwjgl-2.9.3+dfsg/platform_build/macosx_ant/build-symbol-list --- lwjgl-2.7.1+dfsg/platform_build/macosx_ant/build-symbol-list 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/platform_build/macosx_ant/build-symbol-list 2016-04-09 16:26:57.000000000 +0000 @@ -1,4 +1,3 @@ #!/bin/sh -nm -g "$1"/*.o | grep "Java_" | cut -d ' ' -f3 | cut -c 1- -nm -g "$1"/*.o | grep "JNI_" | cut -d ' ' -f3 | cut -c 1- +nm -j -g "$1"/*.o | grep -E "J(ava|NI)_[^.]*$" diff -Nru lwjgl-2.7.1+dfsg/platform_build/macosx_ant/build.xml lwjgl-2.9.3+dfsg/platform_build/macosx_ant/build.xml --- lwjgl-2.7.1+dfsg/platform_build/macosx_ant/build.xml 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/platform_build/macosx_ant/build.xml 2016-04-09 16:26:57.000000000 +0000 @@ -1,38 +1,139 @@ - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - + - + - + - + + + + - - - - + + + + + + + + + + + @@ -40,28 +141,34 @@ - + - - - + + + + + + + + + + + + + + + + + + - - - - - - - - - + - @@ -70,31 +177,46 @@ - - - - - - - - - + + - - + - + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + - + \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/platform_build/mingw_ant/build.xml lwjgl-2.9.3+dfsg/platform_build/mingw_ant/build.xml --- lwjgl-2.7.1+dfsg/platform_build/mingw_ant/build.xml 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/platform_build/mingw_ant/build.xml 2016-04-09 16:26:57.000000000 +0000 @@ -22,7 +22,9 @@ - + + + @@ -53,7 +55,7 @@ - + diff -Nru lwjgl-2.7.1+dfsg/platform_build/windows_ant/build_es.xml lwjgl-2.9.3+dfsg/platform_build/windows_ant/build_es.xml --- lwjgl-2.7.1+dfsg/platform_build/windows_ant/build_es.xml 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/platform_build/windows_ant/build_es.xml 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru lwjgl-2.7.1+dfsg/platform_build/windows_ant/build.xml lwjgl-2.9.3+dfsg/platform_build/windows_ant/build.xml --- lwjgl-2.7.1+dfsg/platform_build/windows_ant/build.xml 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/platform_build/windows_ant/build.xml 2016-04-09 16:26:57.000000000 +0000 @@ -6,17 +6,23 @@ - - + + + + - - + + + + + + @@ -43,7 +49,7 @@ - + diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/BufferChecks.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/BufferChecks.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/BufferChecks.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/BufferChecks.java 2016-04-09 16:26:56.000000000 +0000 @@ -42,8 +42,8 @@ *

* @author cix_foo * @author elias_naur - * @version $Revision: 3419 $ - * $Id: BufferChecks.java 3419 2010-09-30 17:21:50Z spasi $ + * @version $Revision$ + * $Id$ */ public class BufferChecks { /** Static methods only! */ @@ -159,7 +159,7 @@ * This is a separate call to help inline checkBufferSize. */ private static void throwBufferSizeException(Buffer buf, int size) { - throw new IllegalArgumentException("Number of remaining buffer elements is " + buf.remaining() + ", must be at least " + size); + throw new IllegalArgumentException("Number of remaining buffer elements is " + buf.remaining() + ", must be at least " + size + ". Because at most " + size + " elements can be returned, a buffer with at least " + size + " elements is required, regardless of actual returned element count"); } private static void throwBufferSizeException(PointerBuffer buf, int size) { diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/BufferUtils.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/BufferUtils.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/BufferUtils.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/BufferUtils.java 2016-04-09 16:26:56.000000000 +0000 @@ -44,9 +44,9 @@ /** * Some often-used Buffer code for creating native buffers of the appropriate size. * - * @author $Author: matzon $ - * @version $Revision: 3456 $ - * $Id: BufferUtils.java 3456 2010-11-24 21:48:23Z matzon $ + * @author $Author$ + * @version $Revision$ + * $Id$ */ public final class BufferUtils { @@ -192,4 +192,14 @@ /** Fill buffer with zeros from position to remaining */ private static native void zeroBuffer0(Buffer b, long off, long size); + + /** + * Returns the memory address of the specified buffer. + * + * @param buffer the buffer + * + * @return the memory address + */ + static native long getBufferAddress(Buffer buffer); + } diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/DefaultSysImplementation.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/DefaultSysImplementation.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/DefaultSysImplementation.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/DefaultSysImplementation.java 2016-04-09 16:26:56.000000000 +0000 @@ -35,8 +35,8 @@ /** * * @author elias_naur - * @version $Revision: 3426 $ - * $Id: DefaultSysImplementation.java 3426 2010-10-01 22:20:14Z spasi $ + * @version $Revision$ + * $Id$ */ abstract class DefaultSysImplementation implements SysImplementation { public native int getJNIVersion(); diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/examples/Game.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/examples/Game.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/examples/Game.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/examples/Game.java 2016-04-09 16:26:56.000000000 +0000 @@ -42,9 +42,9 @@ * * This is a very basic skeleton to init a game and run it. * - * @author $Author: spasi $ - * @version $Revision: 3418 $ - * $Id: Game.java 3418 2010-09-28 21:11:35Z spasi $ + * @author $Author$ + * @version $Revision$ + * $Id$ */ public class Game { diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/examples/spaceinvaders/SoundManager.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/examples/spaceinvaders/SoundManager.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/examples/spaceinvaders/SoundManager.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/examples/spaceinvaders/SoundManager.java 2016-04-09 16:26:56.000000000 +0000 @@ -47,8 +47,8 @@ * whether it's playing. *

* @author Brian Matzon - * @version $Revision: 3418 $ - * $Id: SoundManager.java 3418 2010-09-28 21:11:35Z spasi $ + * @version $Revision$ + * $Id$ */ public class SoundManager { diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/input/ControllerEvent.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/input/ControllerEvent.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/input/ControllerEvent.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/input/ControllerEvent.java 2016-04-09 16:26:56.000000000 +0000 @@ -52,12 +52,18 @@ private int index; /** Type of control that generated the event */ private int type; + /** True when a button is pressed, if this event was caused by the button */ + private boolean buttonState; /** True if this event was caused by the x axis */ private boolean xaxis; /** True if this event was caused by the y axis */ private boolean yaxis; /** The time stamp of this event */ private long timeStamp; + /** The value on a specified axis, if this event was caused by the x-axis */ + private float xaxisValue; + /** The value on a specified axis, if this event was caused by the y-axis */ + private float yaxisValue; /** * Create a new event @@ -70,12 +76,32 @@ * @param yaxis True if this event was caused by the y-axis */ ControllerEvent(Controller source,long timeStamp, int type,int index,boolean xaxis,boolean yaxis) { + this(source, timeStamp, type, index, false, xaxis, yaxis, 0, 0); + } + + /** + * Create a new event + * + * @param source The source of the event + * @param timeStamp The time stamp given for this event + * @param type The type of control generating this event + * @param index The index of the input that generated the event + * @param buttonState True when a button is pressed, if this event was caused by the button + * @param xaxis True if this event was caused by the x-axis + * @param yaxis True if this event was caused by the y-axis + * @param xaxisValue The value on a specified axis, if this event was caused by the x-axis + * @param yaxisValue The value on a specified axis, if this event was caused by the y-axis + */ + ControllerEvent(Controller source,long timeStamp, int type,int index,boolean buttonState,boolean xaxis,boolean yaxis,float xaxisValue,float yaxisValue) { this.source = source; this.timeStamp = timeStamp; this.type = type; this.index = index; + this.buttonState = buttonState; this.xaxis = xaxis; this.yaxis = yaxis; + this.xaxisValue = xaxisValue; + this.yaxisValue = yaxisValue; } /** @@ -116,6 +142,15 @@ } /** + * Check the button is pressed or not, when this event was caused + * + * @return True when a button is pressed, if this event was caused by the button + */ + public boolean getButtonState() { + return buttonState; + } + + /** * Check if this event was generated by a axis * * @return True if this event was generated by a axis @@ -159,6 +194,24 @@ public boolean isYAxis() { return yaxis; } + + /** + * Get the value on an X axis when this event was caused + * + * @return The value on a specified axis, if this event was caused by the x-axis + */ + public float getXAxisValue() { + return xaxisValue; + } + + /** + * Get the value on an Y axis when this event was caused + * + * @return The value on a specified axis, if this event was caused by the y-axis + */ + public float getYAxisValue() { + return yaxisValue; + } /* * @see java.lang.Object#toString() diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/input/Controller.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/input/Controller.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/input/Controller.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/input/Controller.java 2016-04-09 16:26:56.000000000 +0000 @@ -270,4 +270,21 @@ * @param zone The dead zone to use for the RZ axis */ void setRZAxisDeadZone(float zone); + + + /** Returns the number of rumblers this controller supports */ + int getRumblerCount(); + + /** Returns the name of the specified rumbler + * + * @param index The rumbler index + */ + String getRumblerName(int index); + + /** Sets the vibration strength of the specified rumbler + * + * @param index The index of the rumbler + * @param strength The strength to vibrate at + */ + void setRumblerStrength(int index, float strength); } diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/input/Controllers.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/input/Controllers.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/input/Controllers.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/input/Controllers.java 2016-04-09 16:26:56.000000000 +0000 @@ -262,13 +262,40 @@ /** * Get the timestamp assigned to the current event * - * @return The timestamp assigned ot the current event + * @return The timestamp assigned to the current event */ public static long getEventNanoseconds() { return event.getTimeStamp(); } /** + * Gets the state of the button that generated the current event + * + * @return True if button was down, or false if released + */ + public static boolean getEventButtonState() { + return event.getButtonState(); + } + + /** + * Get the value on an X axis of the current event + * + * @return The value on a x axis of the current event + */ + public static float getEventXAxisValue() { + return event.getXAxisValue(); + } + + /** + * Get the value on an Y axis of the current event + * + * @return The value on a y axis of the current event + */ + public static float getEventYAxisValue() { + return event.getYAxisValue(); + } + + /** * Add an event to the stack of events that have been caused * * @param event The event to add to the list diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/input/Cursor.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/input/Cursor.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/input/Cursor.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/input/Cursor.java 2016-04-09 16:26:56.000000000 +0000 @@ -33,10 +33,10 @@ import java.nio.IntBuffer; +import org.lwjgl.BufferChecks; import org.lwjgl.BufferUtils; import org.lwjgl.LWJGLException; import org.lwjgl.LWJGLUtil; -import org.lwjgl.NondirectBufferWrapper; import org.lwjgl.Sys; /** @@ -45,8 +45,8 @@ * class can be used with Mouse.setCursor(), if available. * * @author elias_naur - * @version $Revision: 3418 $ - * $Id: Cursor.java 3418 2010-09-28 21:11:35Z spasi $ + * @version $Revision$ + * $Id$ */ public class Cursor { @@ -86,9 +86,9 @@ synchronized (OpenGLPackageAccess.global_lock) { if ((getCapabilities() & CURSOR_ONE_BIT_TRANSPARENCY) == 0) throw new LWJGLException("Native cursors not supported"); - images = NondirectBufferWrapper.wrapBuffer(images, width*height*numImages); + BufferChecks.checkBufferSize(images, width*height*numImages); if (delays != null) - delays = NondirectBufferWrapper.wrapBuffer(delays, numImages); + BufferChecks.checkBufferSize(delays, numImages); if (!Mouse.isCreated()) throw new IllegalStateException("Mouse must be created before creating cursor objects"); if (width*height*numImages > images.remaining()) @@ -163,17 +163,32 @@ IntBuffer images_copy = BufferUtils.createIntBuffer(images.remaining()); flipImages(width, height, numImages, images, images_copy); - // Win32 doesn't (afaik) allow for animation based cursors, except when they're - // in the .ani format, which we don't support. + // Mac and Windows doesn't (afaik) allow for animation based cursors, except in the .ani + // format on Windows, which we don't support. // The cursor animation was therefor developed using java side time tracking. // unfortunately X flickers when changing cursor. We therefore check for either - // Win32 or X and do accordingly. This hasn't been implemented on Mac, but we - // might want to split it into a X/Win/Mac cursor if it gets too cluttered + // Windows, Mac or X and do accordingly. + // we might want to split it into a X/Win/Mac cursor if it gets too cluttered CursorElement[] cursors; switch (LWJGLUtil.getPlatform()) { case LWJGLUtil.PLATFORM_MACOSX: - /* Fall through */ + + // OS X requires the image format to be in ABGR format + convertARGBtoABGR(images_copy); + + // create our cursor elements + cursors = new CursorElement[numImages]; + for(int i=0; i>> 24); + byte blue = (byte)(argbColor >>> 16); + byte green = (byte)(argbColor >>> 8); + byte red = (byte)argbColor; + + int abgrColor = ((alpha & 0xff) << 24 ) + ((red & 0xff) << 16 ) + ((green & 0xff) << 8 ) + ((blue & 0xff) ); + + imageBuffer.put(i, abgrColor); + } + } /** * Flips the images so they're oriented according to opengl diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/input/JInputController.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/input/JInputController.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/input/JInputController.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/input/JInputController.java 2016-04-09 16:26:56.000000000 +0000 @@ -38,6 +38,7 @@ import net.java.games.input.Component.Identifier.Button; import net.java.games.input.Event; import net.java.games.input.EventQueue; +import net.java.games.input.Rumbler; /** * A wrapper round a JInput controller that attempts to make the interface @@ -56,6 +57,8 @@ private ArrayList axes = new ArrayList(); /** The POVs that have been detected on the JInput controller */ private ArrayList pov = new ArrayList(); + /** The rumblers exposed by the controller */ + private Rumbler[] rumblers; /** The state of the buttons last check */ private boolean[] buttonState; /** The values that were read from the pov last check */ @@ -86,7 +89,7 @@ * @param index The index this controller has been assigned to * @param target The target JInput controller this class is wrapping */ - JInputController(int index,net.java.games.input.Controller target) { + JInputController(int index, net.java.games.input.Controller target) { this.target = target; this.index = index; @@ -148,6 +151,8 @@ axesMax[i] = 1.0f; deadZones[i] = 0.05f; } + + rumblers = target.getRumblers(); } /* @@ -203,7 +208,8 @@ buttonState[buttonIndex] = event.getValue() != 0; // fire button pressed event - Controllers.addEvent(new ControllerEvent(this,event.getNanos(),ControllerEvent.BUTTON,buttonIndex,false,false)); + Controllers.addEvent(new ControllerEvent(this,event.getNanos(),ControllerEvent.BUTTON,buttonIndex, + buttonState[buttonIndex],false,false,0,0)); } // handle pov events @@ -227,6 +233,8 @@ Component axis = event.getComponent(); int axisIndex = axes.indexOf(axis); float value = axis.getPollData(); + float xaxisValue = 0; + float yaxisValue = 0; // fixed dead zone since most axis don't report it :( if (Math.abs(value) < deadZones[axisIndex]) { @@ -241,9 +249,17 @@ // normalize the value based on maximum value read in the past value /= axesMax[axisIndex]; + + if (axisIndex == xaxis) { + xaxisValue = value; + } + if (axisIndex == yaxis) { + yaxisValue = value; + } + // fire event - Controllers.addEvent(new ControllerEvent(this,event.getNanos(),ControllerEvent.AXIS,axisIndex, - axisIndex == xaxis,axisIndex == yaxis)); + Controllers.addEvent(new ControllerEvent(this,event.getNanos(),ControllerEvent.AXIS,axisIndex,false, + axisIndex == xaxis,axisIndex == yaxis,xaxisValue,yaxisValue)); axesValue[axisIndex] = value; } } @@ -506,5 +522,16 @@ return 0; } + public int getRumblerCount() { + return rumblers.length; + } + + public String getRumblerName(int index) { + return rumblers[index].getAxisName(); + } + + public void setRumblerStrength(int index, float strength) { + rumblers[index].rumble(strength); + } } diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/input/Keyboard.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/input/Keyboard.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/input/Keyboard.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/input/Keyboard.java 2016-04-09 16:26:56.000000000 +0000 @@ -51,8 +51,8 @@ * @author cix_foo * @author elias_naur * @author Brian Matzon - * @version $Revision: 3463 $ - * $Id: Keyboard.java 3463 2010-12-15 18:48:56Z kappa1 $ + * @version $Revision$ + * $Id$ */ public class Keyboard { /** Internal use - event size in bytes */ @@ -158,7 +158,11 @@ public static final int KEY_F13 = 0x64; /* (NEC PC98) */ public static final int KEY_F14 = 0x65; /* (NEC PC98) */ public static final int KEY_F15 = 0x66; /* (NEC PC98) */ + public static final int KEY_F16 = 0x67; /* Extended Function keys - (Mac) */ + public static final int KEY_F17 = 0x68; + public static final int KEY_F18 = 0x69; public static final int KEY_KANA = 0x70; /* (Japanese keyboard) */ + public static final int KEY_F19 = 0x71; /* Extended Function keys - (Mac) */ public static final int KEY_CONVERT = 0x79; /* (Japanese keyboard) */ public static final int KEY_NOCONVERT = 0x7B; /* (Japanese keyboard) */ public static final int KEY_YEN = 0x7D; /* (Japanese keyboard) */ @@ -173,10 +177,12 @@ public static final int KEY_UNLABELED = 0x97; /* (J3100) */ public static final int KEY_NUMPADENTER = 0x9C; /* Enter on numeric keypad */ public static final int KEY_RCONTROL = 0x9D; + public static final int KEY_SECTION = 0xA7; /* Section symbol (Mac) */ public static final int KEY_NUMPADCOMMA = 0xB3; /* , on numeric keypad (NEC PC98) */ public static final int KEY_DIVIDE = 0xB5; /* / on numeric keypad */ public static final int KEY_SYSRQ = 0xB7; public static final int KEY_RMENU = 0xB8; /* right Alt */ + public static final int KEY_FUNCTION = 0xC4; /* Function (Mac) */ public static final int KEY_PAUSE = 0xC5; /* Pause */ public static final int KEY_HOME = 0xC7; /* Home on arrow keypad */ public static final int KEY_UP = 0xC8; /* UpArrow on arrow keypad */ @@ -188,7 +194,8 @@ public static final int KEY_NEXT = 0xD1; /* PgDn on arrow keypad */ public static final int KEY_INSERT = 0xD2; /* Insert on arrow keypad */ public static final int KEY_DELETE = 0xD3; /* Delete on arrow keypad */ - public static final int KEY_LMETA = 0xDB; /* Left Windows/Option key */ + public static final int KEY_CLEAR = 0xDA; /* Clear key (Mac) */ + public static final int KEY_LMETA = 0xDB; /* Left Windows/Option key */ /** * The left windows key, mapped to KEY_LMETA * @@ -216,7 +223,7 @@ private static final int BUFFER_SIZE = 50; /** Key names */ - private static final String[] keyName = new String[255]; + private static final String[] keyName = new String[KEYBOARD_SIZE]; private static final Map keyMap = new HashMap(253); private static int counter; @@ -229,7 +236,8 @@ && Modifier.isPublic(field.getModifiers()) && Modifier.isFinal(field.getModifiers()) && field.getType().equals(int.class) - && field.getName().startsWith("KEY_") ) { + && field.getName().startsWith("KEY_") + && !field.getName().endsWith("WIN") ) { /* Don't use deprecated names */ int key = field.getInt(null); String name = field.getName().substring(4); diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/input/Mouse.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/input/Mouse.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/input/Mouse.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/input/Mouse.java 2016-04-09 16:26:56.000000000 +0000 @@ -59,8 +59,8 @@ * @author cix_foo * @author elias_naur * @author Brian Matzon - * @version $Revision: 3418 $ - * $Id: Mouse.java 3418 2010-09-28 21:11:35Z spasi $ + * @version $Revision$ + * $Id$ */ public class Mouse { /** Internal use - event size in bytes */ @@ -77,6 +77,12 @@ /** Mouse absolute Y position in pixels */ private static int y; + + /** Mouse absolute X position in pixels without any clipping */ + private static int absolute_x; + + /** Mouse absolute Y position in pixels without any clipping */ + private static int absolute_y; /** Buffer to hold the deltas dx, dy and dwheel */ private static IntBuffer coord_buffer; @@ -128,6 +134,9 @@ /** The position of the mouse it was grabbed at */ private static int grab_x; private static int grab_y; + /** The last absolute mouse event position (before clipping) for delta computation */ + private static int last_event_raw_x; + private static int last_event_raw_y; /** Buffer size in events */ private static final int BUFFER_SIZE = 50; @@ -140,7 +149,7 @@ private static final boolean emulateCursorAnimation = LWJGLUtil.getPlatform() == LWJGLUtil.PLATFORM_WINDOWS || LWJGLUtil.getPlatform() == LWJGLUtil.PLATFORM_MACOSX; - private static final boolean allowNegativeMouseCoords = getPrivilegedBoolean("org.lwjgl.input.Mouse.allowNegativeMouseCoords"); + private static boolean clipMouseCoordinatesToWindow = !getPrivilegedBoolean("org.lwjgl.input.Mouse.allowNegativeMouseCoords"); /** * Mouse cannot be constructed. @@ -189,6 +198,14 @@ } } + public static boolean isClipMouseCoordinatesToWindow() { + return clipMouseCoordinatesToWindow; + } + + public static void setClipMouseCoordinatesToWindow(boolean clip) { + clipMouseCoordinatesToWindow = clip; + } + /** * Set the position of the cursor. If the cursor is not grabbed, * the native cursor is moved to the new position. @@ -344,17 +361,21 @@ dy += poll_coord2; x += poll_coord1; y += poll_coord2; + absolute_x += poll_coord1; + absolute_y += poll_coord2; } else { - dx = poll_coord1 - x; - dy = poll_coord2 - y; - x = poll_coord1; - y = poll_coord2; + dx = poll_coord1 - absolute_x; + dy = poll_coord2 - absolute_y; + absolute_x = x = poll_coord1; + absolute_y = y = poll_coord2; + } + + if(clipMouseCoordinatesToWindow) { + x = Math.min(Display.getWidth() - 1, Math.max(0, x)); + y = Math.min(Display.getHeight() - 1, Math.max(0, y)); } - if(!allowNegativeMouseCoords) { - x = Math.min(implementation.getWidth() - 1, Math.max(0, x)); - y = Math.min(implementation.getHeight() - 1, Math.max(0, y)); - } - dwheel += poll_dwheel; + + dwheel += poll_dwheel; read(); } } @@ -412,8 +433,8 @@ /** * Gets the next mouse event. You can query which button caused the event by using * getEventButton() (if any). To get the state of that key, for that event, use - * getEventButtonState. To get the current mouse delta values use getEventDX(), - * getEventDY() and getEventDZ(). + * getEventButtonState. To get the current mouse delta values use getEventDX() + * and getEventDY(). * @see org.lwjgl.input.Mouse#getEventButton() * @see org.lwjgl.input.Mouse#getEventButtonState() * @return true if a mouse event was read, false otherwise @@ -429,16 +450,22 @@ event_dy = readBuffer.getInt(); event_x += event_dx; event_y += event_dy; + last_event_raw_x = event_x; + last_event_raw_y = event_y; } else { int new_event_x = readBuffer.getInt(); int new_event_y = readBuffer.getInt(); - event_dx = new_event_x - event_x; - event_dy = new_event_y - event_y; + event_dx = new_event_x - last_event_raw_x; + event_dy = new_event_y - last_event_raw_y; event_x = new_event_x; event_y = new_event_y; + last_event_raw_x = new_event_x; + last_event_raw_y = new_event_y; + } + if(clipMouseCoordinatesToWindow) { + event_x = Math.min(Display.getWidth() - 1, Math.max(0, event_x)); + event_y = Math.min(Display.getHeight() - 1, Math.max(0, event_y)); } - event_x = Math.min(implementation.getWidth() - 1, Math.max(0, event_x)); - event_y = Math.min(implementation.getHeight() - 1, Math.max(0, event_y)); event_dwheel = readBuffer.getInt(); event_nanos = readBuffer.getLong(); return true; @@ -638,6 +665,8 @@ poll(); event_x = x; event_y = y; + last_event_raw_x = x; + last_event_raw_y = y; resetMouse(); } } diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/J2SESysImplementation.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/J2SESysImplementation.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/J2SESysImplementation.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/J2SESysImplementation.java 2016-04-09 16:26:56.000000000 +0000 @@ -37,9 +37,9 @@ /** * A SysImplementation which delegates as much as it can to J2SE. *

- * @author $Author: matzon $ - * @version $Revision: 2983 $ - * $Id: J2SESysImplementation.java 2983 2008-04-07 18:36:09Z matzon $ + * @author $Author$ + * @version $Revision$ + * $Id$ */ abstract class J2SESysImplementation extends DefaultSysImplementation { diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/LinuxSysImplementation.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/LinuxSysImplementation.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/LinuxSysImplementation.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/LinuxSysImplementation.java 2016-04-09 16:26:56.000000000 +0000 @@ -31,18 +31,36 @@ */ package org.lwjgl; +import java.security.AccessController; +import java.security.PrivilegedAction; +import java.security.PrivilegedExceptionAction; +import java.lang.UnsatisfiedLinkError; /** * * @author elias_naur - * @version $Revision: 3418 $ - * $Id: LinuxSysImplementation.java 3418 2010-09-28 21:11:35Z spasi $ + * @version $Revision$ + * $Id$ */ final class LinuxSysImplementation extends J2SESysImplementation { private static final int JNI_VERSION = 19; static { - java.awt.Toolkit.getDefaultToolkit(); // This will make sure libjawt.so is loaded + // Load libawt.so and libmawt.so, needed for libjawt.so + java.awt.Toolkit.getDefaultToolkit(); + + // manually load libjawt.so into vm, needed since Java 7 + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + try { + System.loadLibrary("jawt"); + } catch (UnsatisfiedLinkError e) { + // catch and ignore an already loaded in another classloader + // exception, as vm already has it loaded + } + return null; + } + }); } public int getRequiredJNIVersion() { @@ -53,7 +71,7 @@ // Linux may as well resort to pure Java hackery, as there's no Linux native way of doing it // right anyway. - String[] browsers = {"xdg-open", "firefox", "mozilla", "opera", "konqueror", "nautilus", "galeon", "netscape"}; + String[] browsers = {"sensible-browser", "xdg-open", "google-chrome", "chromium", "firefox", "iceweasel", "mozilla", "opera", "konqueror", "nautilus", "galeon", "netscape"}; for ( final String browser : browsers ) { try { diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/LWJGLException.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/LWJGLException.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/LWJGLException.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/LWJGLException.java 2016-04-09 16:26:56.000000000 +0000 @@ -38,8 +38,8 @@ *

* * @author Brian Matzon - * @version $Revision: 2983 $ - * $Id: LWJGLException.java 2983 2008-04-07 18:36:09Z matzon $ + * @version $Revision$ + * $Id$ */ public class LWJGLException extends Exception { diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/LWJGLUtil.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/LWJGLUtil.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/LWJGLUtil.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/LWJGLUtil.java 2016-04-09 16:26:56.000000000 +0000 @@ -48,8 +48,8 @@ *

* * @author Brian Matzon - * @version $Revision: 3475 $ - * $Id: LWJGLUtil.java 3475 2011-01-23 07:48:50Z matzon $ + * @version $Revision$ + * $Id$ */ public class LWJGLUtil { public static final int PLATFORM_LINUX = 1; @@ -59,209 +59,207 @@ public static final String PLATFORM_MACOSX_NAME = "macosx"; public static final String PLATFORM_WINDOWS_NAME = "windows"; + private static final String LWJGL_ICON_DATA_16x16 = + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + + "\377\377\377\377\377\377\377\377\376\377\377\377\302\327\350\377" + + "\164\244\313\377\120\213\275\377\124\216\277\377\206\257\322\377" + + "\347\357\366\377\377\377\377\377\377\377\377\377\377\377\377\377" + + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + + "\377\377\377\377\365\365\365\377\215\217\221\377\166\202\215\377" + + "\175\215\233\377\204\231\252\377\224\267\325\377\072\175\265\377" + + "\110\206\272\377\332\347\361\377\377\377\377\377\377\377\377\377" + + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + + "\364\370\373\377\234\236\240\377\000\000\000\377\000\000\000\377" + + "\000\000\000\377\000\000\000\377\344\344\344\377\204\255\320\377" + + "\072\175\265\377\133\222\301\377\374\375\376\377\377\377\377\377" + + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + + "\221\266\325\377\137\137\137\377\000\000\000\377\000\000\000\377" + + "\000\000\000\377\042\042\042\377\377\377\377\377\350\360\366\377" + + "\071\174\265\377\072\175\265\377\304\330\351\377\377\377\377\377" + + "\377\377\377\377\377\377\377\377\377\377\377\377\306\331\351\377" + + "\201\253\316\377\035\035\035\377\000\000\000\377\000\000\000\377" + + "\000\000\000\377\146\146\146\377\377\377\377\377\320\340\355\377" + + "\072\175\265\377\072\175\265\377\215\264\324\377\377\377\377\377" + + "\362\362\362\377\245\245\245\377\337\337\337\377\242\301\334\377" + + "\260\305\326\377\012\012\012\377\000\000\000\377\000\000\000\377" + + "\000\000\000\377\250\250\250\377\377\377\377\377\227\272\330\377" + + "\072\175\265\377\072\175\265\377\161\241\312\377\377\377\377\377" + + "\241\241\241\377\000\000\000\377\001\001\001\377\043\043\043\377" + + "\314\314\314\377\320\320\320\377\245\245\245\377\204\204\204\377" + + "\134\134\134\377\357\357\357\377\377\377\377\377\140\226\303\377" + + "\072\175\265\377\072\175\265\377\155\236\310\377\377\377\377\377" + + "\136\136\136\377\000\000\000\377\000\000\000\377\000\000\000\377" + + "\317\317\317\377\037\037\037\377\003\003\003\377\053\053\053\377" + + "\154\154\154\377\306\306\306\377\372\374\375\377\236\277\332\377" + + "\167\245\314\377\114\211\274\377\174\250\316\377\377\377\377\377" + + "\033\033\033\377\000\000\000\377\000\000\000\377\027\027\027\377" + + "\326\326\326\377\001\001\001\377\000\000\000\377\000\000\000\377" + + "\000\000\000\377\122\122\122\377\345\345\345\377\075\075\075\377" + + "\150\150\150\377\246\246\247\377\332\336\341\377\377\377\377\377" + + "\164\164\164\377\016\016\016\377\000\000\000\377\131\131\131\377" + + "\225\225\225\377\000\000\000\377\000\000\000\377\000\000\000\377" + + "\000\000\000\377\221\221\221\377\233\233\233\377\000\000\000\377" + + "\000\000\000\377\000\000\000\377\002\002\002\377\103\103\103\377" + + "\377\377\377\377\356\356\356\377\214\214\214\377\277\277\277\377" + + "\126\126\126\377\000\000\000\377\000\000\000\377\000\000\000\377" + + "\000\000\000\377\323\323\323\377\130\130\130\377\000\000\000\377" + + "\000\000\000\377\000\000\000\377\000\000\000\377\063\063\063\377" + + "\377\377\377\377\377\377\377\377\374\375\376\377\377\377\377\377" + + "\300\300\300\377\100\100\100\377\002\002\002\377\000\000\000\377" + + "\033\033\033\377\373\373\373\377\027\027\027\377\000\000\000\377" + + "\000\000\000\377\000\000\000\377\000\000\000\377\170\170\170\377" + + "\377\377\377\377\377\377\377\377\322\341\356\377\176\251\316\377" + + "\340\352\363\377\377\377\377\377\324\324\324\377\155\155\155\377" + + "\204\204\204\377\323\323\323\377\000\000\000\377\000\000\000\377" + + "\000\000\000\377\000\000\000\377\000\000\000\377\275\275\275\377" + + "\377\377\377\377\377\377\377\377\376\376\376\377\146\232\305\377" + + "\075\177\266\377\202\254\320\377\344\355\365\377\377\377\377\377" + + "\377\377\377\377\345\345\345\377\055\055\055\377\000\000\000\377" + + "\000\000\000\377\000\000\000\377\014\014\014\377\366\366\366\377" + + "\377\377\377\377\377\377\377\377\377\377\377\377\342\354\364\377" + + "\115\211\274\377\072\175\265\377\076\200\266\377\207\260\322\377" + + "\347\357\366\377\377\377\377\377\376\376\376\377\274\274\274\377" + + "\117\117\117\377\003\003\003\377\112\112\112\377\377\377\377\377" + + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + + "\353\362\370\377\214\263\324\377\126\220\300\377\120\214\275\377" + + "\167\245\314\377\355\363\370\377\377\377\377\377\377\377\377\377" + + "\377\377\377\377\337\337\337\377\346\346\346\377\377\377\377\377"; + + private static final String LWJGL_ICON_DATA_32x32 = + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\372\374\375\377" + + "\313\335\354\377\223\267\326\377\157\240\311\377\134\223\302\377\140\226\303\377\172\247\315\377\254\310\340\377\355\363\370\377" + + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\374\375\376\377\265\316\343\377\132\222\301\377" + + "\072\175\265\377\072\175\265\377\072\175\265\377\072\175\265\377\072\175\265\377\072\175\265\377\072\175\265\377\105\205\271\377" + + "\241\301\334\377\374\375\376\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\374\374\374\377\342\352\361\377\270\317\343\377\256\311\340\377" + + "\243\302\334\377\230\272\330\377\214\263\323\377\201\254\317\377\156\237\310\377\075\177\266\377\072\175\265\377\072\175\265\377" + + "\072\175\265\377\162\242\312\377\365\370\373\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + + "\377\377\377\377\377\377\377\377\377\377\377\377\330\330\330\377\061\061\061\377\044\044\044\377\061\061\061\377\100\100\100\377" + + "\122\122\122\377\145\145\145\377\164\164\164\377\217\217\217\377\367\370\370\377\254\310\337\377\073\175\265\377\072\175\265\377" + + "\072\175\265\377\072\175\265\377\171\247\315\377\374\375\376\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + + "\377\377\377\377\377\377\377\377\376\376\376\377\150\150\150\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377" + + "\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\266\266\266\377\376\376\376\377\206\256\321\377\072\175\265\377" + + "\072\175\265\377\072\175\265\377\072\175\265\377\256\312\341\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + + "\377\377\377\377\323\342\356\377\341\352\362\377\050\050\050\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377" + + "\000\000\000\377\000\000\000\377\000\000\000\377\002\002\002\377\336\336\336\377\377\377\377\377\365\370\373\377\133\222\301\377" + + "\072\175\265\377\072\175\265\377\072\175\265\377\110\206\272\377\364\370\373\377\377\377\377\377\377\377\377\377\377\377\377\377" + + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + + "\354\363\370\377\144\231\305\377\327\331\333\377\005\005\005\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377" + + "\000\000\000\377\000\000\000\377\000\000\000\377\044\044\044\377\376\376\376\377\377\377\377\377\377\377\377\377\300\325\347\377" + + "\071\174\265\377\072\175\265\377\072\175\265\377\072\175\265\377\253\310\340\377\377\377\377\377\377\377\377\377\377\377\377\377" + + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\376\377\377\377" + + "\170\246\314\377\173\247\315\377\236\236\236\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377" + + "\000\000\000\377\000\000\000\377\000\000\000\377\145\145\145\377\377\377\377\377\377\377\377\377\377\377\377\377\342\354\364\377" + + "\067\173\264\377\072\175\265\377\072\175\265\377\072\175\265\377\146\232\305\377\377\377\377\377\377\377\377\377\377\377\377\377" + + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\303\327\350\377" + + "\071\175\265\377\262\314\341\377\130\130\130\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377" + + "\000\000\000\377\000\000\000\377\000\000\000\377\251\251\251\377\377\377\377\377\377\377\377\377\377\377\377\377\274\322\345\377" + + "\072\175\265\377\072\175\265\377\072\175\265\377\072\175\265\377\100\201\267\377\356\364\371\377\377\377\377\377\377\377\377\377" + + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\372\374\375\377\132\222\301\377" + + "\075\177\266\377\335\345\355\377\034\034\034\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377" + + "\000\000\000\377\000\000\000\377\007\007\007\377\347\347\347\377\377\377\377\377\377\377\377\377\377\377\377\377\205\256\321\377" + + "\072\175\265\377\072\175\265\377\072\175\265\377\072\175\265\377\071\175\265\377\314\336\354\377\377\377\377\377\377\377\377\377" + + "\377\377\377\377\377\377\377\377\376\376\376\377\377\377\377\377\377\377\377\377\377\377\377\377\272\322\345\377\072\175\265\377" + + "\127\220\277\377\320\321\321\377\003\003\003\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377" + + "\000\000\000\377\000\000\000\377\063\063\063\377\375\375\375\377\377\377\377\377\377\377\377\377\373\374\375\377\120\213\275\377" + + "\072\175\265\377\072\175\265\377\072\175\265\377\072\175\265\377\071\175\265\377\261\314\342\377\377\377\377\377\377\377\377\377" + + "\377\377\377\377\312\312\312\377\067\067\067\377\141\141\141\377\242\242\242\377\335\335\335\377\344\354\363\377\261\313\341\377" + + "\264\315\342\377\346\346\346\377\043\043\043\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377" + + "\000\000\000\377\000\000\000\377\162\162\162\377\377\377\377\377\377\377\377\377\377\377\377\377\330\345\360\377\072\175\265\377" + + "\072\175\265\377\072\175\265\377\072\175\265\377\072\175\265\377\072\175\265\377\240\300\333\377\377\377\377\377\377\377\377\377" + + "\377\377\377\377\146\146\146\377\000\000\000\377\000\000\000\377\000\000\000\377\006\006\006\377\047\047\047\377\146\146\146\377" + + "\324\324\324\377\377\377\377\377\366\366\366\377\320\320\320\377\227\227\227\377\136\136\136\377\047\047\047\377\004\004\004\377" + + "\000\000\000\377\003\003\003\377\300\300\300\377\377\377\377\377\377\377\377\377\377\377\377\377\242\301\333\377\072\175\265\377" + + "\072\175\265\377\072\175\265\377\072\175\265\377\072\175\265\377\072\175\265\377\236\277\332\377\377\377\377\377\377\377\377\377" + + "\373\373\373\377\045\045\045\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377" + + "\134\134\134\377\377\377\377\377\352\352\352\377\217\217\217\377\265\265\265\377\351\351\351\377\375\375\375\377\347\347\347\377" + + "\262\262\262\377\275\275\275\377\376\376\376\377\377\377\377\377\377\377\377\377\377\377\377\377\153\235\307\377\072\175\265\377" + + "\072\175\265\377\072\175\265\377\072\175\265\377\072\175\265\377\072\175\265\377\241\301\334\377\377\377\377\377\377\377\377\377" + + "\333\333\333\377\003\003\003\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377" + + "\203\203\203\377\377\377\377\377\137\137\137\377\000\000\000\377\000\000\000\377\013\013\013\377\067\067\067\377\166\166\166\377" + + "\267\267\267\377\360\360\360\377\377\377\377\377\377\377\377\377\377\377\377\377\360\365\371\377\113\210\273\377\075\177\266\377" + + "\071\174\265\377\072\175\265\377\072\175\265\377\072\175\265\377\072\175\265\377\262\314\342\377\377\377\377\377\377\377\377\377" + + "\232\232\232\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377" + + "\305\305\305\377\367\367\367\377\035\035\035\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377" + + "\000\000\000\377\007\007\007\377\074\074\074\377\337\337\337\377\377\377\377\377\373\374\375\377\374\375\376\377\363\367\372\377" + + "\314\335\353\377\236\276\332\377\162\241\311\377\114\211\273\377\072\175\265\377\311\334\353\377\377\377\377\377\377\377\377\377" + + "\126\126\126\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\017\017\017\377" + + "\371\371\371\377\321\321\321\377\003\003\003\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377" + + "\000\000\000\377\000\000\000\377\000\000\000\377\216\216\216\377\377\377\377\377\371\371\371\377\204\204\204\377\160\160\160\377" + + "\260\260\260\377\352\352\352\377\377\377\377\377\371\373\374\377\334\350\362\377\366\371\374\377\377\377\377\377\377\377\377\377" + + "\025\025\025\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\116\116\116\377" + + "\377\377\377\377\221\221\221\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377" + + "\000\000\000\377\000\000\000\377\000\000\000\377\273\273\273\377\377\377\377\377\236\236\236\377\000\000\000\377\000\000\000\377" + + "\000\000\000\377\004\004\004\377\057\057\057\377\160\160\160\377\260\260\260\377\346\346\346\377\376\376\376\377\377\377\377\377" + + "\071\071\071\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\220\220\220\377" + + "\377\377\377\377\115\115\115\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377" + + "\000\000\000\377\000\000\000\377\020\020\020\377\360\360\360\377\377\377\377\377\132\132\132\377\000\000\000\377\000\000\000\377" + + "\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\011\011\011\377\062\062\062\377\261\261\261\377" + + "\366\366\366\377\241\241\241\377\065\065\065\377\002\002\002\377\000\000\000\377\000\000\000\377\002\002\002\377\321\321\321\377" + + "\365\365\365\377\023\023\023\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377" + + "\000\000\000\377\000\000\000\377\105\105\105\377\376\376\376\377\370\370\370\377\035\035\035\377\000\000\000\377\000\000\000\377" + + "\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\053\053\053\377" + + "\377\377\377\377\377\377\377\377\374\374\374\377\276\276\276\377\120\120\120\377\005\005\005\377\045\045\045\377\371\371\371\377" + + "\302\302\302\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377" + + "\000\000\000\377\000\000\000\377\206\206\206\377\377\377\377\377\322\322\322\377\001\001\001\377\000\000\000\377\000\000\000\377" + + "\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\103\103\103\377" + + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\376\376\376\377\334\334\334\377\340\340\340\377\377\377\377\377" + + "\225\225\225\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377" + + "\000\000\000\377\001\001\001\377\310\310\310\377\377\377\377\377\216\216\216\377\000\000\000\377\000\000\000\377\000\000\000\377" + + "\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\210\210\210\377" + + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + + "\337\337\337\377\051\051\051\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377" + + "\000\000\000\377\030\030\030\377\365\365\365\377\377\377\377\377\112\112\112\377\000\000\000\377\000\000\000\377\000\000\000\377" + + "\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\317\317\317\377" + + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\361\366\372\377\377\377\377\377\377\377\377\377" + + "\377\377\377\377\371\371\371\377\265\265\265\377\113\113\113\377\006\006\006\377\000\000\000\377\000\000\000\377\000\000\000\377" + + "\000\000\000\377\122\122\122\377\377\377\377\377\370\370\370\377\020\020\020\377\000\000\000\377\000\000\000\377\000\000\000\377" + + "\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\034\034\034\377\370\370\370\377" + + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\206\257\321\377\220\265\325\377\352\361\367\377" + + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\333\333\333\377\170\170\170\377\033\033\033\377\000\000\000\377" + + "\000\000\000\377\226\226\226\377\377\377\377\377\306\306\306\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377" + + "\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\132\132\132\377\377\377\377\377" + + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\303\330\351\377\072\175\265\377\103\203\270\377" + + "\224\270\326\377\355\363\370\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\364\364\364\377\247\247\247\377" + + "\205\205\205\377\364\364\364\377\377\377\377\377\206\206\206\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377" + + "\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\235\235\235\377\377\377\377\377" + + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\372\373\375\377\135\224\302\377\072\175\265\377" + + "\072\175\265\377\106\205\271\377\230\273\330\377\357\364\371\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + + "\377\377\377\377\377\377\377\377\377\377\377\377\233\233\233\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377" + + "\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\005\005\005\377\335\335\335\377\377\377\377\377" + + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\305\331\351\377\073\176\266\377" + + "\072\175\265\377\072\175\265\377\072\175\265\377\110\206\272\377\236\276\332\377\362\366\372\377\377\377\377\377\377\377\377\377" + + "\377\377\377\377\377\377\377\377\377\377\377\377\373\373\373\377\216\216\216\377\045\045\045\377\001\001\001\377\000\000\000\377" + + "\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\054\054\054\377\374\374\374\377\377\377\377\377" + + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\217\265\325\377" + + "\072\175\265\377\072\175\265\377\072\175\265\377\072\175\265\377\072\175\265\377\112\207\273\377\243\302\334\377\363\367\372\377" + + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\372\372\372\377\260\260\260\377\105\105\105\377" + + "\004\004\004\377\000\000\000\377\000\000\000\377\000\000\000\377\000\000\000\377\156\156\156\377\377\377\377\377\377\377\377\377" + + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\374\375\376\377" + + "\205\257\321\377\072\175\265\377\072\175\265\377\072\175\265\377\072\175\265\377\072\175\265\377\072\175\265\377\115\211\274\377" + + "\250\305\336\377\366\371\374\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\376\376\376\377" + + "\322\322\322\377\150\150\150\377\016\016\016\377\000\000\000\377\001\001\001\377\270\270\270\377\377\377\377\377\377\377\377\377" + + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + + "\376\376\377\377\261\313\342\377\114\211\274\377\071\175\265\377\072\175\265\377\072\175\265\377\072\175\265\377\072\175\265\377" + + "\072\175\265\377\115\211\274\377\277\324\347\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + + "\377\377\377\377\377\377\377\377\354\354\354\377\223\223\223\377\233\233\233\377\375\375\375\377\377\377\377\377\377\377\377\377" + + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + + "\377\377\377\377\377\377\377\377\363\367\372\377\265\316\343\377\201\254\320\377\145\231\305\377\141\227\304\377\154\236\310\377" + + "\217\265\325\377\305\331\351\377\367\372\374\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"; + /** LWJGL Logo - 16 by 16 pixels */ - public static final ByteBuffer LWJGLIcon16x16 = BufferUtils.createByteBuffer(16 * 16 * 4).put(new byte[] { - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -2, -1, -1, -1, -62, -41, -24, -1, 116, -92, -53, -1, 80, -117, - -67, -1, 84, -114, -65, -1, -122, -81, -46, -1, -25, -17, -10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -11, -11, -11, -1, - -115, -113, -111, -1, 118, -126, -115, -1, 125, -115, -101, -1, -124, -103, -86, -1, -108, -73, -43, -1, - 58, 125, -75, -1, 72, -122, -70, -1, -38, -25, -15, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -12, -8, -5, -1, -100, -98, -96, -1, 0, 0, 0, -1, 0, 0, 0, -1, - 0, 0, 0, -1, 0, 0, 0, -1, -28, -28, -28, -1, -124, -83, -48, -1, 58, 125, -75, -1, 91, -110, -63, -1, -4, - -3, -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -111, -74, -43, - -1, 95, 95, 95, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 34, 34, 34, -1, -1, -1, -1, -1, -24, -16, -10, - -1, 57, 124, -75, -1, 58, 125, -75, -1, -60, -40, -23, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -58, -39, -23, -1, -127, -85, -50, -1, 29, 29, 29, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, - -1, 102, 102, 102, -1, -1, -1, -1, -1, -48, -32, -19, -1, 58, 125, -75, -1, 58, 125, -75, -1, -115, -76, - -44, -1, -1, -1, -1, -1, -14, -14, -14, -1, -91, -91, -91, -1, -33, -33, -33, -1, -94, -63, -36, -1, -80, - -59, -42, -1, 10, 10, 10, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, -88, -88, -88, -1, -1, -1, -1, -1, - -105, -70, -40, -1, 58, 125, -75, -1, 58, 125, -75, -1, 113, -95, -54, -1, -1, -1, -1, -1, -95, -95, -95, - -1, 0, 0, 0, -1, 1, 1, 1, -1, 35, 35, 35, -1, -52, -52, -52, -1, -48, -48, -48, -1, -91, -91, -91, -1, - -124, -124, -124, -1, 92, 92, 92, -1, -17, -17, -17, -1, -1, -1, -1, -1, 96, -106, -61, -1, 58, 125, -75, - -1, 58, 125, -75, -1, 109, -98, -56, -1, -1, -1, -1, -1, 94, 94, 94, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, - -1, -49, -49, -49, -1, 31, 31, 31, -1, 3, 3, 3, -1, 43, 43, 43, -1, 108, 108, 108, -1, -58, -58, -58, -1, - -6, -4, -3, -1, -98, -65, -38, -1, 119, -91, -52, -1, 76, -119, -68, -1, 124, -88, -50, -1, -1, -1, -1, -1, - 27, 27, 27, -1, 0, 0, 0, -1, 0, 0, 0, -1, 23, 23, 23, -1, -42, -42, -42, -1, 1, 1, 1, -1, 0, 0, 0, -1, 0, - 0, 0, -1, 0, 0, 0, -1, 82, 82, 82, -1, -27, -27, -27, -1, 61, 61, 61, -1, 104, 104, 104, -1, -90, -90, -89, - -1, -38, -34, -31, -1, -1, -1, -1, -1, 116, 116, 116, -1, 14, 14, 14, -1, 0, 0, 0, -1, 89, 89, 89, -1, - -107, -107, -107, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, -111, -111, -111, -1, -101, -101, - -101, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 2, 2, 2, -1, 67, 67, 67, -1, -1, -1, -1, -1, -18, -18, - -18, -1, -116, -116, -116, -1, -65, -65, -65, -1, 86, 86, 86, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, - 0, 0, -1, -45, -45, -45, -1, 88, 88, 88, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 51, 51, - 51, -1, -1, -1, -1, -1, -1, -1, -1, -1, -4, -3, -2, -1, -1, -1, -1, -1, -64, -64, -64, -1, 64, 64, 64, -1, - 2, 2, 2, -1, 0, 0, 0, -1, 27, 27, 27, -1, -5, -5, -5, -1, 23, 23, 23, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, - 0, -1, 0, 0, 0, -1, 120, 120, 120, -1, -1, -1, -1, -1, -1, -1, -1, -1, -46, -31, -18, -1, 126, -87, -50, - -1, -32, -22, -13, -1, -1, -1, -1, -1, -44, -44, -44, -1, 109, 109, 109, -1, -124, -124, -124, -1, -45, - -45, -45, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, -67, -67, -67, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -2, -2, -2, -1, 102, -102, -59, -1, 61, 127, -74, -1, -126, -84, -48, -1, -28, -19, - -11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -27, -27, -27, -1, 45, 45, 45, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, - 0, -1, 12, 12, 12, -1, -10, -10, -10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -30, -20, -12, - -1, 77, -119, -68, -1, 58, 125, -75, -1, 62, -128, -74, -1, -121, -80, -46, -1, -25, -17, -10, -1, -1, -1, - -1, -1, -2, -2, -2, -1, -68, -68, -68, -1, 79, 79, 79, -1, 3, 3, 3, -1, 74, 74, 74, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -21, -14, -8, -1, -116, -77, -44, -1, 86, -112, - -64, -1, 80, -116, -67, -1, 119, -91, -52, -1, -19, -13, -8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -33, -33, -33, -1, -26, -26, -26, -1, -1, -1, -1, -1 - }); + public static final ByteBuffer LWJGLIcon16x16 = loadIcon(LWJGL_ICON_DATA_16x16); /** LWJGL Logo - 32 by 32 pixels */ - public static final ByteBuffer LWJGLIcon32x32 = BufferUtils.createByteBuffer(32 * 32 * 4).put(new byte[] { - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -6, -4, -3, -1, -53, -35, - -20, -1, -109, -73, -42, -1, 111, -96, -55, -1, 92, -109, -62, -1, 96, -106, -61, -1, 122, -89, -51, -1, - -84, -56, -32, -1, -19, -13, -8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -4, -3, -2, -1, -75, -50, -29, -1, 90, -110, -63, -1, - 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, - 58, 125, -75, -1, 69, -123, -71, -1, -95, -63, -36, -1, -4, -3, -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -4, -4, -4, -1, -30, -22, -15, -1, -72, -49, -29, -1, -82, -55, -32, - -1, -93, -62, -36, -1, -104, -70, -40, -1, -116, -77, -45, -1, -127, -84, -49, -1, 110, -97, -56, -1, 61, - 127, -74, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 114, -94, -54, -1, -11, -8, -5, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -40, -40, -40, -1, 49, 49, 49, -1, 36, 36, 36, -1, 49, 49, 49, -1, 64, - 64, 64, -1, 82, 82, 82, -1, 101, 101, 101, -1, 116, 116, 116, -1, -113, -113, -113, -1, -9, -8, -8, -1, - -84, -56, -33, -1, 59, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 121, -89, -51, - -1, -4, -3, -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -2, -2, -2, -1, 104, 104, 104, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, - 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, -74, -74, -74, -1, -2, -2, -2, -1, -122, -82, - -47, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, -82, -54, -31, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -45, -30, -18, - -1, -31, -22, -14, -1, 40, 40, 40, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, - 0, 0, -1, 0, 0, 0, -1, 2, 2, 2, -1, -34, -34, -34, -1, -1, -1, -1, -1, -11, -8, -5, -1, 91, -110, -63, -1, - 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 72, -122, -70, -1, -12, -8, -5, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -20, -13, -8, -1, 100, -103, -59, -1, -41, -39, -37, - -1, 5, 5, 5, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, - 36, 36, 36, -1, -2, -2, -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -64, -43, -25, -1, 57, 124, -75, -1, 58, - 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, -85, -56, -32, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -2, -1, -1, -1, 120, -90, -52, -1, 123, -89, -51, -1, -98, -98, -98, -1, 0, 0, 0, -1, 0, 0, - 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 101, 101, 101, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -30, -20, -12, -1, 55, 123, -76, -1, 58, 125, -75, -1, 58, 125, - -75, -1, 58, 125, -75, -1, 102, -102, -59, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -61, - -41, -24, -1, 57, 125, -75, -1, -78, -52, -31, -1, 88, 88, 88, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, - 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, -87, -87, -87, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -68, -46, -27, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, - -75, -1, 64, -127, -73, -1, -18, -12, -7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -6, -4, -3, -1, 90, -110, -63, -1, 61, - 127, -74, -1, -35, -27, -19, -1, 28, 28, 28, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, - 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 7, 7, 7, -1, -25, -25, -25, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -123, -82, -47, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 57, - 125, -75, -1, -52, -34, -20, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -2, -2, - -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -70, -46, -27, -1, 58, 125, -75, -1, 87, -112, -65, - -1, -48, -47, -47, -1, 3, 3, 3, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, - 0, -1, 0, 0, 0, -1, 51, 51, 51, -1, -3, -3, -3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -5, -4, -3, -1, 80, - -117, -67, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 57, 125, -75, -1, - -79, -52, -30, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -54, -54, -54, -1, 55, 55, 55, -1, 97, - 97, 97, -1, -94, -94, -94, -1, -35, -35, -35, -1, -28, -20, -13, -1, -79, -53, -31, -1, -76, -51, -30, -1, - -26, -26, -26, -1, 35, 35, 35, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, - 0, -1, 0, 0, 0, -1, 114, 114, 114, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -40, -27, -16, -1, - 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, - -96, -64, -37, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 102, 102, 102, -1, 0, 0, 0, -1, 0, 0, 0, - -1, 0, 0, 0, -1, 6, 6, 6, -1, 39, 39, 39, -1, 102, 102, 102, -1, -44, -44, -44, -1, -1, -1, -1, -1, -10, - -10, -10, -1, -48, -48, -48, -1, -105, -105, -105, -1, 94, 94, 94, -1, 39, 39, 39, -1, 4, 4, 4, -1, 0, 0, - 0, -1, 3, 3, 3, -1, -64, -64, -64, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -94, -63, -37, -1, - 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, - -98, -65, -38, -1, -1, -1, -1, -1, -1, -1, -1, -1, -5, -5, -5, -1, 37, 37, 37, -1, 0, 0, 0, -1, 0, 0, 0, - -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 92, 92, 92, -1, -1, -1, -1, -1, -22, -22, -22, -1, - -113, -113, -113, -1, -75, -75, -75, -1, -23, -23, -23, -1, -3, -3, -3, -1, -25, -25, -25, -1, -78, -78, - -78, -1, -67, -67, -67, -1, -2, -2, -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 107, -99, -57, - -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, - -1, -95, -63, -36, -1, -1, -1, -1, -1, -1, -1, -1, -1, -37, -37, -37, -1, 3, 3, 3, -1, 0, 0, 0, -1, 0, 0, - 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, -125, -125, -125, -1, -1, -1, -1, -1, 95, 95, - 95, -1, 0, 0, 0, -1, 0, 0, 0, -1, 11, 11, 11, -1, 55, 55, 55, -1, 118, 118, 118, -1, -73, -73, -73, -1, - -16, -16, -16, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -16, -11, -7, -1, 75, -120, -69, -1, 61, - 127, -74, -1, 57, 124, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, - -78, -52, -30, -1, -1, -1, -1, -1, -1, -1, -1, -1, -102, -102, -102, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, - -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, -59, -59, -59, -1, -9, -9, -9, -1, 29, 29, 29, -1, - 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 7, 7, 7, -1, 60, 60, 60, -1, - -33, -33, -33, -1, -1, -1, -1, -1, -5, -4, -3, -1, -4, -3, -2, -1, -13, -9, -6, -1, -52, -35, -21, -1, -98, - -66, -38, -1, 114, -95, -55, -1, 76, -119, -69, -1, 58, 125, -75, -1, -55, -36, -21, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 86, 86, 86, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, - -1, 15, 15, 15, -1, -7, -7, -7, -1, -47, -47, -47, -1, 3, 3, 3, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, - 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, -114, -114, -114, -1, -1, -1, -1, -1, -7, - -7, -7, -1, -124, -124, -124, -1, 112, 112, 112, -1, -80, -80, -80, -1, -22, -22, -22, -1, -1, -1, -1, -1, - -7, -5, -4, -1, -36, -24, -14, -1, -10, -7, -4, -1, -1, -1, -1, -1, -1, -1, -1, -1, 21, 21, 21, -1, 0, 0, - 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 78, 78, 78, -1, -1, -1, -1, -1, - -111, -111, -111, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, - 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, -69, -69, -69, -1, -1, -1, -1, -1, -98, -98, -98, -1, 0, 0, 0, -1, 0, 0, - 0, -1, 0, 0, 0, -1, 4, 4, 4, -1, 47, 47, 47, -1, 112, 112, 112, -1, -80, -80, -80, -1, -26, -26, -26, -1, - -2, -2, -2, -1, -1, -1, -1, -1, 57, 57, 57, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, - 0, -1, 0, 0, 0, -1, -112, -112, -112, -1, -1, -1, -1, -1, 77, 77, 77, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, - 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 16, 16, 16, -1, -16, -16, -16, -1, - -1, -1, -1, -1, 90, 90, 90, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, - -1, 0, 0, 0, -1, 9, 9, 9, -1, 50, 50, 50, -1, -79, -79, -79, -1, -10, -10, -10, -1, -95, -95, -95, -1, 53, - 53, 53, -1, 2, 2, 2, -1, 0, 0, 0, -1, 0, 0, 0, -1, 2, 2, 2, -1, -47, -47, -47, -1, -11, -11, -11, -1, 19, - 19, 19, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, - 0, 0, -1, 69, 69, 69, -1, -2, -2, -2, -1, -8, -8, -8, -1, 29, 29, 29, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, - 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 43, 43, 43, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -4, -4, -4, -1, -66, -66, -66, -1, 80, 80, 80, -1, 5, 5, 5, -1, 37, 37, 37, -1, - -7, -7, -7, -1, -62, -62, -62, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, - 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, -122, -122, -122, -1, -1, -1, -1, -1, -46, -46, -46, -1, 1, - 1, 1, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, - 0, -1, 0, 0, 0, -1, 67, 67, 67, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -2, -2, - -2, -1, -36, -36, -36, -1, -32, -32, -32, -1, -1, -1, -1, -1, -107, -107, -107, -1, 0, 0, 0, -1, 0, 0, 0, - -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 1, 1, 1, -1, -56, -56, - -56, -1, -1, -1, -1, -1, -114, -114, -114, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, - -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, -120, -120, -120, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -33, -33, -33, -1, 41, 41, 41, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, - 0, 0, -1, 0, 0, 0, -1, 24, 24, 24, -1, -11, -11, -11, -1, -1, -1, -1, -1, 74, 74, 74, -1, 0, 0, 0, -1, 0, - 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, - 0, -1, -49, -49, -49, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -15, -10, -6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -7, -7, -7, -1, -75, -75, -75, -1, 75, - 75, 75, -1, 6, 6, 6, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 82, 82, 82, -1, -1, -1, -1, - -1, -8, -8, -8, -1, 16, 16, 16, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, - 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 28, 28, 28, -1, -8, -8, -8, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -122, -81, -47, -1, -112, -75, -43, -1, -22, -15, -9, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -37, -37, -37, -1, 120, 120, 120, -1, - 27, 27, 27, -1, 0, 0, 0, -1, 0, 0, 0, -1, -106, -106, -106, -1, -1, -1, -1, -1, -58, -58, -58, -1, 0, 0, 0, - -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, - 0, 0, 0, -1, 90, 90, 90, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -61, -40, -23, -1, 58, 125, -75, -1, 67, -125, -72, -1, -108, -72, -42, -1, -19, -13, - -8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -12, -12, -12, -1, -89, -89, -89, - -1, -123, -123, -123, -1, -12, -12, -12, -1, -1, -1, -1, -1, -122, -122, -122, -1, 0, 0, 0, -1, 0, 0, 0, - -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, - -99, -99, -99, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -6, -5, -3, -1, 93, -108, -62, -1, 58, 125, -75, -1, 58, 125, -75, -1, 70, -123, -71, -1, -104, - -69, -40, -1, -17, -12, -7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -101, -101, -101, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, - -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 5, 5, 5, -1, -35, -35, -35, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -59, -39, -23, -1, 59, 126, -74, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 72, -122, -70, - -1, -98, -66, -38, -1, -14, -10, -6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -5, -5, -5, -1, -114, -114, -114, -1, 37, 37, 37, -1, 1, 1, 1, -1, 0, 0, 0, -1, 0, 0, 0, - -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 44, 44, 44, -1, -4, -4, -4, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -113, -75, -43, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, - -1, 74, -121, -69, -1, -93, -62, -36, -1, -13, -9, -6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -6, -6, -6, -1, -80, -80, -80, -1, 69, 69, 69, -1, 4, 4, 4, -1, 0, 0, 0, - -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 110, 110, 110, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -4, -3, - -2, -1, -123, -81, -47, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, - 125, -75, -1, 58, 125, -75, -1, 77, -119, -68, -1, -88, -59, -34, -1, -10, -7, -4, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -2, -2, -2, -1, -46, -46, -46, -1, 104, 104, - 104, -1, 14, 14, 14, -1, 0, 0, 0, -1, 1, 1, 1, -1, -72, -72, -72, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -2, -2, -1, -1, -79, -53, -30, -1, 76, -119, -68, -1, 57, 125, -75, -1, 58, 125, -75, -1, - 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 58, 125, -75, -1, 77, -119, -68, -1, -65, -44, -25, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -20, -20, -20, -1, -109, -109, -109, -1, -101, -101, -101, -1, -3, -3, -3, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -13, -9, -6, -1, -75, -50, -29, -1, -127, - -84, -48, -1, 101, -103, -59, -1, 97, -105, -60, -1, 108, -98, -56, -1, -113, -75, -43, -1, -59, -39, -23, - -1, -9, -6, -4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1 - }); + public static final ByteBuffer LWJGLIcon32x32 = loadIcon(LWJGL_ICON_DATA_32x32); /** Debug flag. */ public static final boolean DEBUG = getPrivilegedBoolean("org.lwjgl.util.Debug"); @@ -271,13 +269,10 @@ private static final int PLATFORM; static { - LWJGLIcon16x16.flip(); - LWJGLIcon32x32.flip(); - final String osName = getPrivilegedProperty("os.name"); if ( osName.startsWith("Windows") ) PLATFORM = PLATFORM_WINDOWS; - else if ( osName.startsWith("Linux") || osName.startsWith("FreeBSD") || osName.startsWith("SunOS") ) + else if ( osName.startsWith("Linux") || osName.startsWith("FreeBSD") || osName.startsWith("OpenBSD") || osName.startsWith("SunOS") || osName.startsWith("Unix") ) PLATFORM = PLATFORM_LINUX; else if ( osName.startsWith("Mac OS X") || osName.startsWith("Darwin") ) PLATFORM = PLATFORM_MACOSX; @@ -285,6 +280,15 @@ throw new LinkageError("Unknown platform: " + osName); } + private static ByteBuffer loadIcon(String data) { + int len = data.length(); + ByteBuffer bb = BufferUtils.createByteBuffer(len); + for(int i=0 ; i c = null; + try { log("getPathFromClassLoader: searching for: " + libname); - Class c = classloader.getClass(); + c = classloader.getClass(); while (c != null) { final Class clazz = c; try { @@ -436,7 +457,7 @@ } } } catch (Exception e) { - log("Failure locating " + e + " using classloader:" + e); + log("Failure locating " + e + " using classloader:" + c); } return null; } @@ -444,13 +465,43 @@ /** * Gets a boolean property as a privileged action. */ - private static boolean getPrivilegedBoolean(final String property_name) { - Boolean value = AccessController.doPrivileged(new PrivilegedAction() { + public static boolean getPrivilegedBoolean(final String property_name) { + return AccessController.doPrivileged(new PrivilegedAction() { public Boolean run() { return Boolean.getBoolean(property_name); } }); - return value; + } + + /** + * Gets an integer property as a privileged action. + * + * @param property_name the integer property name + * + * @return the property value + */ + public static Integer getPrivilegedInteger(final String property_name) { + return AccessController.doPrivileged(new PrivilegedAction() { + public Integer run() { + return Integer.getInteger(property_name); + } + }); + } + + /** + * Gets an integer property as a privileged action. + * + * @param property_name the integer property name + * @param default_val the default value to use if the property is not defined + * + * @return the property value + */ + public static Integer getPrivilegedInteger(final String property_name, final int default_val) { + return AccessController.doPrivileged(new PrivilegedAction() { + public Integer run() { + return Integer.getInteger(property_name, default_val); + } + }); } /** @@ -458,9 +509,9 @@ * * @param msg Message to print */ - public static void log(String msg) { + public static void log(CharSequence msg) { if (DEBUG) { - System.err.println(msg); + System.err.println("[LWJGL] " + msg); } } @@ -569,10 +620,10 @@ * @param field the Field to test * @param value the integer value of the field * - * @result true if the Field is accepted + * @return true if the Field is accepted */ boolean accept(Field field, int value); } -} \ No newline at end of file +} diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/MacOSXSysImplementation.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/MacOSXSysImplementation.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/MacOSXSysImplementation.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/MacOSXSysImplementation.java 2016-04-09 16:26:56.000000000 +0000 @@ -31,24 +31,26 @@ */ package org.lwjgl; -import java.awt.Toolkit; - import com.apple.eio.FileManager; +import java.security.AccessController; +import java.security.PrivilegedAction; +import java.security.PrivilegedExceptionAction; +import java.lang.UnsatisfiedLinkError; /** * * @author elias_naur - * @version $Revision: 3418 $ - * $Id: MacOSXSysImplementation.java 3418 2010-09-28 21:11:35Z spasi $ + * @version $Revision$ + * $Id$ */ final class MacOSXSysImplementation extends J2SESysImplementation { - private static final int JNI_VERSION = 19; + private static final int JNI_VERSION = 25; static { - // Make sure AWT is properly initialized. This avoids hangs on Mac OS X 10.3 - Toolkit.getDefaultToolkit(); + // Manually start the AWT Application Loop + java.awt.Toolkit.getDefaultToolkit(); } - + public int getRequiredJNIVersion() { return JNI_VERSION; } diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/MemoryUtil.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/MemoryUtil.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/MemoryUtil.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/MemoryUtil.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,430 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl; + +import java.lang.reflect.Field; +import java.nio.*; +import java.nio.charset.*; + +/** + * [INTERNAL USE ONLY] + *

+ * This class provides utility methods for passing buffers to JNI API calls. + * + * @author Spasi + */ +public final class MemoryUtil { + + private static final Charset ascii; + private static final Charset utf8; + private static final Charset utf16; + + static { + ascii = Charset.forName("ISO-8859-1"); + utf8 = Charset.forName("UTF-8"); + utf16 = Charset.forName("UTF-16LE"); + } + + private static final Accessor memUtil; + + static { + Accessor util; + try { + // Depends on java.nio.Buffer#address and sun.misc.Unsafe + util = loadAccessor("org.lwjgl.MemoryUtilSun$AccessorUnsafe"); + } catch (Exception e0) { + try { + // Depends on java.nio.Buffer#address and sun.reflect.FieldAccessor + util = loadAccessor("org.lwjgl.MemoryUtilSun$AccessorReflectFast"); + } catch (Exception e1) { + try { + // Depends on java.nio.Buffer#address + util = new AccessorReflect(); + } catch (Exception e2) { + LWJGLUtil.log("Unsupported JVM detected, this will likely result in low performance. Please inform LWJGL developers."); + util = new AccessorJNI(); + } + } + } + + LWJGLUtil.log("MemoryUtil Accessor: " + util.getClass().getSimpleName()); + memUtil = util; + + /* + BENCHMARK RESULTS - Oracle Server VM: + + Unsafe: 4ns + ReflectFast: 8ns + Reflect: 10ns + JNI: 82ns + + BENCHMARK RESULTS - Oracle Client VM: + + Unsafe: 5ns + ReflectFast: 81ns + Reflect: 85ns + JNI: 87ns + + On non-Oracle VMs, Unsafe should be the fastest implementation as well. In the absence + of Unsafe, performance will depend on how reflection and JNI are implemented. For now + we'll go with what we see on the Oracle VM (that is, we'll prefer reflection over JNI). + */ + } + + private MemoryUtil() { + } + + /** + * Returns the memory address of the specified buffer. [INTERNAL USE ONLY] + * + * @param buffer the buffer + * + * @return the memory address + */ + public static long getAddress0(Buffer buffer) { return memUtil.getAddress(buffer); } + + public static long getAddress0Safe(Buffer buffer) { return buffer == null ? 0L : memUtil.getAddress(buffer); } + + public static long getAddress0(PointerBuffer buffer) { return memUtil.getAddress(buffer.getBuffer()); } + + public static long getAddress0Safe(PointerBuffer buffer) { return buffer == null ? 0L : memUtil.getAddress(buffer.getBuffer()); } + + // --- [ API utilities ] --- + + public static long getAddress(ByteBuffer buffer) { return getAddress(buffer, buffer.position()); } + + public static long getAddress(ByteBuffer buffer, int position) { return getAddress0(buffer) + position; } + + public static long getAddress(ShortBuffer buffer) { return getAddress(buffer, buffer.position()); } + + public static long getAddress(ShortBuffer buffer, int position) { return getAddress0(buffer) + (position << 1); } + + public static long getAddress(CharBuffer buffer) { return getAddress(buffer, buffer.position()); } + + public static long getAddress(CharBuffer buffer, int position) { return getAddress0(buffer) + (position << 1); } + + public static long getAddress(IntBuffer buffer) { return getAddress(buffer, buffer.position()); } + + public static long getAddress(IntBuffer buffer, int position) { return getAddress0(buffer) + (position << 2); } + + public static long getAddress(FloatBuffer buffer) { return getAddress(buffer, buffer.position()); } + + public static long getAddress(FloatBuffer buffer, int position) { return getAddress0(buffer) + (position << 2); } + + public static long getAddress(LongBuffer buffer) { return getAddress(buffer, buffer.position()); } + + public static long getAddress(LongBuffer buffer, int position) { return getAddress0(buffer) + (position << 3); } + + public static long getAddress(DoubleBuffer buffer) { return getAddress(buffer, buffer.position()); } + + public static long getAddress(DoubleBuffer buffer, int position) { return getAddress0(buffer) + (position << 3); } + + public static long getAddress(PointerBuffer buffer) { return getAddress(buffer, buffer.position()); } + + public static long getAddress(PointerBuffer buffer, int position) { return getAddress0(buffer) + (position * PointerBuffer.getPointerSize()); } + + // --- [ API utilities - Safe ] --- + + public static long getAddressSafe(ByteBuffer buffer) { return buffer == null ? 0L : getAddress(buffer); } + + public static long getAddressSafe(ByteBuffer buffer, int position) { return buffer == null ? 0L : getAddress(buffer, position); } + + public static long getAddressSafe(ShortBuffer buffer) { return buffer == null ? 0L : getAddress(buffer); } + + public static long getAddressSafe(ShortBuffer buffer, int position) { return buffer == null ? 0L : getAddress(buffer, position); } + + public static long getAddressSafe(CharBuffer buffer) { return buffer == null ? 0L : getAddress(buffer); } + + public static long getAddressSafe(CharBuffer buffer, int position) { return buffer == null ? 0L : getAddress(buffer, position); } + + public static long getAddressSafe(IntBuffer buffer) { return buffer == null ? 0L : getAddress(buffer); } + + public static long getAddressSafe(IntBuffer buffer, int position) { return buffer == null ? 0L : getAddress(buffer, position); } + + public static long getAddressSafe(FloatBuffer buffer) { return buffer == null ? 0L : getAddress(buffer); } + + public static long getAddressSafe(FloatBuffer buffer, int position) { return buffer == null ? 0L : getAddress(buffer, position); } + + public static long getAddressSafe(LongBuffer buffer) { return buffer == null ? 0L : getAddress(buffer); } + + public static long getAddressSafe(LongBuffer buffer, int position) { return buffer == null ? 0L : getAddress(buffer, position); } + + public static long getAddressSafe(DoubleBuffer buffer) { return buffer == null ? 0L : getAddress(buffer); } + + public static long getAddressSafe(DoubleBuffer buffer, int position) { return buffer == null ? 0L : getAddress(buffer, position); } + + public static long getAddressSafe(PointerBuffer buffer) { return buffer == null ? 0L : getAddress(buffer); } + + public static long getAddressSafe(PointerBuffer buffer, int position) { return buffer == null ? 0L : getAddress(buffer, position); } + + // --- [ String utilities ] --- + + /** + * Returns a ByteBuffer containing the specified text ASCII encoded and null-terminated. + * If text is null, null is returned. + * + * @param text the text to encode + * + * @return the encoded text or null + * + * @see String#getBytes() + */ + public static ByteBuffer encodeASCII(final CharSequence text) { + return encode(text, ascii); + } + + /** + * Returns a ByteBuffer containing the specified text UTF-8 encoded and null-terminated. + * If text is null, null is returned. + * + * @param text the text to encode + * + * @return the encoded text or null + * + * @see String#getBytes() + */ + public static ByteBuffer encodeUTF8(final CharSequence text) { + return encode(text, utf8); + } + + /** + * Returns a ByteBuffer containing the specified text UTF-16LE encoded and null-terminated. + * If text is null, null is returned. + * + * @param text the text to encode + * + * @return the encoded text + */ + public static ByteBuffer encodeUTF16(final CharSequence text) { + return encode(text, utf16); + } + + /** + * Wraps the specified text in a null-terminated CharBuffer and encodes it using the specified Charset. + * + * @param text the text to encode + * @param charset the charset to use for encoding + * + * @return the encoded text + */ + private static ByteBuffer encode(final CharSequence text, final Charset charset) { + if ( text == null ) + return null; + + return encode(CharBuffer.wrap(new CharSequenceNT(text)), charset); + } + + /** + * A {@link CharsetEncoder#encode(java.nio.CharBuffer)} implementation that uses {@link BufferUtils#createByteBuffer(int)} + * instead of {@link ByteBuffer#allocate(int)}. + * + * @see CharsetEncoder#encode(java.nio.CharBuffer) + */ + private static ByteBuffer encode(final CharBuffer in, final Charset charset) { + final CharsetEncoder encoder = charset.newEncoder(); // encoders are not thread-safe, create a new one on every call + + int n = (int)(in.remaining() * encoder.averageBytesPerChar()); + ByteBuffer out = BufferUtils.createByteBuffer(n); + + if ( n == 0 && in.remaining() == 0 ) + return out; + + encoder.reset(); + while ( true ) { + CoderResult cr = in.hasRemaining() ? encoder.encode(in, out, true) : CoderResult.UNDERFLOW; + if ( cr.isUnderflow() ) + cr = encoder.flush(out); + + if ( cr.isUnderflow() ) + break; + + if ( cr.isOverflow() ) { + n = 2 * n + 1; // Ensure progress; n might be 0! + ByteBuffer o = BufferUtils.createByteBuffer(n); + out.flip(); + o.put(out); + out = o; + continue; + } + + try { + cr.throwException(); + } catch (CharacterCodingException e) { + throw new RuntimeException(e); + } + } + out.flip(); + return out; + } + + public static String decodeASCII(final ByteBuffer buffer) { + return decode(buffer, ascii); + } + + public static String decodeUTF8(final ByteBuffer buffer) { + return decode(buffer, utf8); + } + + public static String decodeUTF16(final ByteBuffer buffer) { + return decode(buffer, utf16); + } + + private static String decode(final ByteBuffer buffer, final Charset charset) { + if ( buffer == null ) + return null; + + return decodeImpl(buffer, charset); + } + + private static String decodeImpl(final ByteBuffer in, final Charset charset) { + final CharsetDecoder decoder = charset.newDecoder(); // decoders are not thread-safe, create a new one on every call + + int n = (int)(in.remaining() * decoder.averageCharsPerByte()); + CharBuffer out = BufferUtils.createCharBuffer(n); + + if ( (n == 0) && (in.remaining() == 0) ) + return ""; + + decoder.reset(); + for (; ; ) { + CoderResult cr = in.hasRemaining() ? decoder.decode(in, out, true) : CoderResult.UNDERFLOW; + if ( cr.isUnderflow() ) + cr = decoder.flush(out); + + if ( cr.isUnderflow() ) + break; + if ( cr.isOverflow() ) { + n = 2 * n + 1; // Ensure progress; n might be 0! + CharBuffer o = BufferUtils.createCharBuffer(n); + out.flip(); + o.put(out); + out = o; + continue; + } + try { + cr.throwException(); + } catch (CharacterCodingException e) { + throw new RuntimeException(e); + } + } + out.flip(); + return out.toString(); + } + + /** A null-terminated CharSequence. */ + private static class CharSequenceNT implements CharSequence { + + final CharSequence source; + + CharSequenceNT(CharSequence source) { + this.source = source; + } + + public int length() { + return source.length() + 1; + + } + + public char charAt(final int index) { + return index == source.length() ? '\0' : source.charAt(index); + + } + + public CharSequence subSequence(final int start, final int end) { + return new CharSequenceNT(source.subSequence(start, Math.min(end, source.length()))); + } + + } + + interface Accessor { + + long getAddress(Buffer buffer); + + } + + private static Accessor loadAccessor(final String className) throws Exception { + return (Accessor)Class.forName(className).newInstance(); + } + + /** Default implementation. */ + private static class AccessorJNI implements Accessor { + + public long getAddress(final Buffer buffer) { + return BufferUtils.getBufferAddress(buffer); + } + + } + + /** Implementation using reflection on ByteBuffer. */ + private static class AccessorReflect implements Accessor { + + private final Field address; + + AccessorReflect() { + try { + address = getAddressField(); + } catch (NoSuchFieldException e) { + throw new UnsupportedOperationException(e); + } + address.setAccessible(true); + } + + public long getAddress(final Buffer buffer) { + try { + return address.getLong(buffer); + } catch (IllegalAccessException e) { + // cannot happen + return 0L; + } + } + + } + + static Field getAddressField() throws NoSuchFieldException { + return getDeclaredFieldRecursive(ByteBuffer.class, "address"); + } + + private static Field getDeclaredFieldRecursive(final Class root, final String fieldName) throws NoSuchFieldException { + Class type = root; + + do { + try { + return type.getDeclaredField(fieldName); + } catch (NoSuchFieldException e) { + type = type.getSuperclass(); + } + } while ( type != null ); + + throw new NoSuchFieldException(fieldName + " does not exist in " + root.getSimpleName() + " or any of its superclasses."); + } + +} diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/MemoryUtilSun.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/MemoryUtilSun.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/MemoryUtilSun.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/MemoryUtilSun.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,135 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl; + +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; +import java.nio.Buffer; + +import sun.misc.Unsafe; +import sun.reflect.FieldAccessor; + +/** + * MemoryUtil.Accessor implementations that depend on sun.misc. + * We use reflection to grab these, so that we can compile on JDKs + * that do not support sun.misc. + * + * @author Spasi + */ +final class MemoryUtilSun { + + private MemoryUtilSun() { + } + + /** Implementation using sun.misc.Unsafe. */ + private static class AccessorUnsafe implements MemoryUtil.Accessor { + + private final Unsafe unsafe; + private final long address; + + AccessorUnsafe() { + try { + unsafe = getUnsafeInstance(); + address = unsafe.objectFieldOffset(MemoryUtil.getAddressField()); + } catch (Exception e) { + throw new UnsupportedOperationException(e); + } + } + + public long getAddress(final Buffer buffer) { + return unsafe.getLong(buffer, address); + } + + private static Unsafe getUnsafeInstance() { + final Field[] fields = Unsafe.class.getDeclaredFields(); + + /* + Different runtimes use different names for the Unsafe singleton, + so we cannot use .getDeclaredField and we scan instead. For example: + + Oracle: theUnsafe + PERC : m_unsafe_instance + Android: THE_ONE + */ + for ( Field field : fields ) { + if ( !field.getType().equals(Unsafe.class) ) + continue; + + final int modifiers = field.getModifiers(); + if ( !(Modifier.isStatic(modifiers) && Modifier.isFinal(modifiers)) ) + continue; + + field.setAccessible(true); + try { + return (Unsafe)field.get(null); + } catch (IllegalAccessException e) { + // ignore + } + break; + } + + throw new UnsupportedOperationException(); + } + + } + + /** Implementation using reflection on ByteBuffer, FieldAccessor is used directly. */ + private static class AccessorReflectFast implements MemoryUtil.Accessor { + + private final FieldAccessor addressAccessor; + + AccessorReflectFast() { + Field address; + try { + address = MemoryUtil.getAddressField(); + } catch (NoSuchFieldException e) { + throw new UnsupportedOperationException(e); + } + address.setAccessible(true); + + try { + Method m = Field.class.getDeclaredMethod("acquireFieldAccessor", boolean.class); + m.setAccessible(true); + addressAccessor = (FieldAccessor)m.invoke(address, true); + } catch (Exception e) { + throw new UnsupportedOperationException(e); + } + } + + public long getAddress(final Buffer buffer) { + return addressAccessor.getLong(buffer); + } + + } + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/NondirectBufferWrapper.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/NondirectBufferWrapper.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/NondirectBufferWrapper.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/NondirectBufferWrapper.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,409 +0,0 @@ -/* - * Copyright (c) 2002-2008 LWJGL Project - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of 'LWJGL' nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package org.lwjgl; - -import java.nio.ByteBuffer; -import java.nio.ShortBuffer; -import java.nio.IntBuffer; -import java.nio.FloatBuffer; -import java.nio.LongBuffer; -import java.nio.DoubleBuffer; -import java.nio.ByteOrder; - -/** - * Utility class to cache thread local direct buffers so when we are passed a non-direct buffer, - * we can put its contents into a cached direct buffer and use that at the native side instead. - * - * Internal class, don't use. - * @author elias_naur - * @version $Revision: 2762 $ - * $Id: BufferChecks.java 2762 2007-04-11 16:13:05Z elias_naur $ - */ -public final class NondirectBufferWrapper { - private static final int INITIAL_BUFFER_SIZE = 1; - - private static final ThreadLocal thread_buffer = new ThreadLocal() { - protected CachedBuffers initialValue() { - return new CachedBuffers(INITIAL_BUFFER_SIZE); - } - }; - - private static CachedBuffers getCachedBuffers(int minimum_byte_size) { - CachedBuffers buffers = thread_buffer.get(); - int current_byte_size = buffers.byte_buffer.capacity(); - if (minimum_byte_size > current_byte_size) { - buffers = new CachedBuffers(minimum_byte_size); - thread_buffer.set(buffers); - } - return buffers; - } - - public static ByteBuffer wrapNoCopyBuffer(ByteBuffer buf, int size) { - BufferChecks.checkBufferSize(buf, size); - return wrapNoCopyDirect(buf); - } - - public static ShortBuffer wrapNoCopyBuffer(ShortBuffer buf, int size) { - BufferChecks.checkBufferSize(buf, size); - return wrapNoCopyDirect(buf); - } - - public static IntBuffer wrapNoCopyBuffer(IntBuffer buf, int size) { - BufferChecks.checkBufferSize(buf, size); - return wrapNoCopyDirect(buf); - } - - public static LongBuffer wrapNoCopyBuffer(LongBuffer buf, int size) { - BufferChecks.checkBufferSize(buf, size); - return wrapNoCopyDirect(buf); - } - - public static FloatBuffer wrapNoCopyBuffer(FloatBuffer buf, int size) { - BufferChecks.checkBufferSize(buf, size); - return wrapNoCopyDirect(buf); - } - - public static DoubleBuffer wrapNoCopyBuffer(DoubleBuffer buf, int size) { - BufferChecks.checkBufferSize(buf, size); - return wrapNoCopyDirect(buf); - } - - public static ByteBuffer wrapBuffer(ByteBuffer buf, int size) { - BufferChecks.checkBufferSize(buf, size); - return wrapDirect(buf); - } - - public static ShortBuffer wrapBuffer(ShortBuffer buf, int size) { - BufferChecks.checkBufferSize(buf, size); - return wrapDirect(buf); - } - - public static IntBuffer wrapBuffer(IntBuffer buf, int size) { - BufferChecks.checkBufferSize(buf, size); - return wrapDirect(buf); - } - - public static LongBuffer wrapBuffer(LongBuffer buf, int size) { - BufferChecks.checkBufferSize(buf, size); - return wrapDirect(buf); - } - - public static FloatBuffer wrapBuffer(FloatBuffer buf, int size) { - BufferChecks.checkBufferSize(buf, size); - return wrapDirect(buf); - } - - public static DoubleBuffer wrapBuffer(DoubleBuffer buf, int size) { - BufferChecks.checkBufferSize(buf, size); - return wrapDirect(buf); - } - - public static ByteBuffer wrapDirect(ByteBuffer buffer) { - if (!buffer.isDirect()) - return doWrap(buffer); - return buffer; - } - - public static ShortBuffer wrapDirect(ShortBuffer buffer) { - if (!buffer.isDirect()) - return doWrap(buffer); - return buffer; - } - - public static FloatBuffer wrapDirect(FloatBuffer buffer) { - if (!buffer.isDirect()) - return doWrap(buffer); - return buffer; - } - - public static IntBuffer wrapDirect(IntBuffer buffer) { - if (!buffer.isDirect()) - return doWrap(buffer); - return buffer; - } - - public static LongBuffer wrapDirect(LongBuffer buffer) { - if (!buffer.isDirect()) - return doWrap(buffer); - return buffer; - } - - public static DoubleBuffer wrapDirect(DoubleBuffer buffer) { - if (!buffer.isDirect()) - return doWrap(buffer); - return buffer; - } - - public static ByteBuffer wrapNoCopyDirect(ByteBuffer buffer) { - if (!buffer.isDirect()) - return doNoCopyWrap(buffer); - return buffer; - } - - public static ShortBuffer wrapNoCopyDirect(ShortBuffer buffer) { - if (!buffer.isDirect()) - return doNoCopyWrap(buffer); - return buffer; - } - - public static FloatBuffer wrapNoCopyDirect(FloatBuffer buffer) { - if (!buffer.isDirect()) - return doNoCopyWrap(buffer); - return buffer; - } - - public static IntBuffer wrapNoCopyDirect(IntBuffer buffer) { - if (!buffer.isDirect()) - return doNoCopyWrap(buffer); - return buffer; - } - - public static LongBuffer wrapNoCopyDirect(LongBuffer buffer) { - if (!buffer.isDirect()) - return doNoCopyWrap(buffer); - return buffer; - } - - public static DoubleBuffer wrapNoCopyDirect(DoubleBuffer buffer) { - if (!buffer.isDirect()) - return doNoCopyWrap(buffer); - return buffer; - } - - public static void copy(ByteBuffer src, ByteBuffer dst) { - if (dst != null && !dst.isDirect()) { - int saved_position = dst.position(); - dst.put(src); - dst.position(saved_position); - } - } - - public static void copy(ShortBuffer src, ShortBuffer dst) { - if (dst != null && !dst.isDirect()) { - int saved_position = dst.position(); - dst.put(src); - dst.position(saved_position); - } - } - - public static void copy(IntBuffer src, IntBuffer dst) { - if (dst != null && !dst.isDirect()) { - int saved_position = dst.position(); - dst.put(src); - dst.position(saved_position); - } - } - - public static void copy(FloatBuffer src, FloatBuffer dst) { - if (dst != null && !dst.isDirect()) { - int saved_position = dst.position(); - dst.put(src); - dst.position(saved_position); - } - } - - public static void copy(LongBuffer src, LongBuffer dst) { - if (dst != null && !dst.isDirect()) { - int saved_position = dst.position(); - dst.put(src); - dst.position(saved_position); - } - } - - public static void copy(DoubleBuffer src, DoubleBuffer dst) { - if (dst != null && !dst.isDirect()) { - int saved_position = dst.position(); - dst.put(src); - dst.position(saved_position); - } - } - - private static ByteBuffer doNoCopyWrap(ByteBuffer buffer) { - ByteBuffer direct_buffer = lookupBuffer(buffer); - direct_buffer.limit(buffer.limit()); - direct_buffer.position(buffer.position()); - return direct_buffer; - } - - private static ShortBuffer doNoCopyWrap(ShortBuffer buffer) { - ShortBuffer direct_buffer = lookupBuffer(buffer); - direct_buffer.limit(buffer.limit()); - direct_buffer.position(buffer.position()); - return direct_buffer; - } - - private static IntBuffer doNoCopyWrap(IntBuffer buffer) { - IntBuffer direct_buffer = lookupBuffer(buffer); - direct_buffer.limit(buffer.limit()); - direct_buffer.position(buffer.position()); - return direct_buffer; - } - - private static FloatBuffer doNoCopyWrap(FloatBuffer buffer) { - FloatBuffer direct_buffer = lookupBuffer(buffer); - direct_buffer.limit(buffer.limit()); - direct_buffer.position(buffer.position()); - return direct_buffer; - } - - private static LongBuffer doNoCopyWrap(LongBuffer buffer) { - LongBuffer direct_buffer = lookupBuffer(buffer); - direct_buffer.limit(buffer.limit()); - direct_buffer.position(buffer.position()); - return direct_buffer; - } - - private static DoubleBuffer doNoCopyWrap(DoubleBuffer buffer) { - DoubleBuffer direct_buffer = lookupBuffer(buffer); - direct_buffer.limit(buffer.limit()); - direct_buffer.position(buffer.position()); - return direct_buffer; - } - - private static ByteBuffer lookupBuffer(ByteBuffer buffer) { - return getCachedBuffers(buffer.remaining()).byte_buffer; - } - - private static ByteBuffer doWrap(ByteBuffer buffer) { - ByteBuffer direct_buffer = lookupBuffer(buffer); - direct_buffer.clear(); - int saved_position = buffer.position(); - direct_buffer.put(buffer); - buffer.position(saved_position); - direct_buffer.flip(); - return direct_buffer; - } - - private static ShortBuffer lookupBuffer(ShortBuffer buffer) { - CachedBuffers buffers = getCachedBuffers(buffer.remaining()*2); - return buffer.order() == ByteOrder.LITTLE_ENDIAN ? buffers.short_buffer_little : buffers.short_buffer_big; - } - - private static ShortBuffer doWrap(ShortBuffer buffer) { - ShortBuffer direct_buffer = lookupBuffer(buffer); - direct_buffer.clear(); - int saved_position = buffer.position(); - direct_buffer.put(buffer); - buffer.position(saved_position); - direct_buffer.flip(); - return direct_buffer; - } - - private static FloatBuffer lookupBuffer(FloatBuffer buffer) { - CachedBuffers buffers = getCachedBuffers(buffer.remaining()*4); - return buffer.order() == ByteOrder.LITTLE_ENDIAN ? buffers.float_buffer_little : buffers.float_buffer_big; - } - - private static FloatBuffer doWrap(FloatBuffer buffer) { - FloatBuffer direct_buffer = lookupBuffer(buffer); - direct_buffer.clear(); - int saved_position = buffer.position(); - direct_buffer.put(buffer); - buffer.position(saved_position); - direct_buffer.flip(); - return direct_buffer; - } - - private static IntBuffer lookupBuffer(IntBuffer buffer) { - CachedBuffers buffers = getCachedBuffers(buffer.remaining()*4); - return buffer.order() == ByteOrder.LITTLE_ENDIAN ? buffers.int_buffer_little : buffers.int_buffer_big; - } - - private static IntBuffer doWrap(IntBuffer buffer) { - IntBuffer direct_buffer = lookupBuffer(buffer); - direct_buffer.clear(); - int saved_position = buffer.position(); - direct_buffer.put(buffer); - buffer.position(saved_position); - direct_buffer.flip(); - return direct_buffer; - } - - private static LongBuffer lookupBuffer(LongBuffer buffer) { - CachedBuffers buffers = getCachedBuffers(buffer.remaining()*8); - return buffer.order() == ByteOrder.LITTLE_ENDIAN ? buffers.long_buffer_little : buffers.long_buffer_big; - } - - private static LongBuffer doWrap(LongBuffer buffer) { - LongBuffer direct_buffer = lookupBuffer(buffer); - direct_buffer.clear(); - int saved_position = buffer.position(); - direct_buffer.put(buffer); - buffer.position(saved_position); - direct_buffer.flip(); - return direct_buffer; - } - - private static DoubleBuffer lookupBuffer(DoubleBuffer buffer) { - CachedBuffers buffers = getCachedBuffers(buffer.remaining()*8); - return buffer.order() == ByteOrder.LITTLE_ENDIAN ? buffers.double_buffer_little : buffers.double_buffer_big; - } - - private static DoubleBuffer doWrap(DoubleBuffer buffer) { - DoubleBuffer direct_buffer = lookupBuffer(buffer); - direct_buffer.clear(); - int saved_position = buffer.position(); - direct_buffer.put(buffer); - buffer.position(saved_position); - direct_buffer.flip(); - return direct_buffer; - } - - private static final class CachedBuffers { - private final ByteBuffer byte_buffer; - private final ShortBuffer short_buffer_big; - private final IntBuffer int_buffer_big; - private final FloatBuffer float_buffer_big; - private final LongBuffer long_buffer_big; - private final DoubleBuffer double_buffer_big; - private final ShortBuffer short_buffer_little; - private final IntBuffer int_buffer_little; - private final FloatBuffer float_buffer_little; - private final LongBuffer long_buffer_little; - private final DoubleBuffer double_buffer_little; - - private CachedBuffers(int size) { - this.byte_buffer = ByteBuffer.allocateDirect(size); - this.short_buffer_big = byte_buffer.asShortBuffer(); - this.int_buffer_big = byte_buffer.asIntBuffer(); - this.float_buffer_big = byte_buffer.asFloatBuffer(); - this.long_buffer_big = byte_buffer.asLongBuffer(); - this.double_buffer_big = byte_buffer.asDoubleBuffer(); - this.byte_buffer.order(ByteOrder.LITTLE_ENDIAN); - this.short_buffer_little = byte_buffer.asShortBuffer(); - this.int_buffer_little = byte_buffer.asIntBuffer(); - this.float_buffer_little = byte_buffer.asFloatBuffer(); - this.long_buffer_little = byte_buffer.asLongBuffer(); - this.double_buffer_little = byte_buffer.asDoubleBuffer(); - } - } -} diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/openal/ALC10.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/openal/ALC10.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/openal/ALC10.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/openal/ALC10.java 2016-04-09 16:26:56.000000000 +0000 @@ -31,12 +31,13 @@ */ package org.lwjgl.openal; -import java.nio.Buffer; +import java.nio.ByteBuffer; import java.nio.IntBuffer; import java.util.HashMap; import org.lwjgl.BufferChecks; import org.lwjgl.LWJGLException; +import org.lwjgl.MemoryUtil; /** * @@ -151,12 +152,11 @@ * @return String property from device */ public static String alcGetString(ALCdevice device, int pname) { - String result; - result = nalcGetString(getDevice(device), pname); + ByteBuffer buffer = nalcGetString(getDevice(device), pname); Util.checkALCError(device); - return result; + return MemoryUtil.decodeUTF8(buffer); } - static native String nalcGetString(long device, int pname); + static native ByteBuffer nalcGetString(long device, int pname); /** * The application can query ALC for information using an integer query function. @@ -180,10 +180,10 @@ */ public static void alcGetInteger(ALCdevice device, int pname, IntBuffer integerdata) { BufferChecks.checkDirect(integerdata); - nalcGetIntegerv(getDevice(device), pname, integerdata.remaining(), integerdata, integerdata.position()); + nalcGetIntegerv(getDevice(device), pname, integerdata.remaining(), MemoryUtil.getAddress(integerdata)); Util.checkALCError(device); } - static native void nalcGetIntegerv(long device, int pname, int size, Buffer integerdata, int offset); + static native void nalcGetIntegerv(long device, int pname, int size, long integerdata); /** * The alcOpenDevice function allows the application (i.e. the client program) to @@ -198,7 +198,8 @@ * @return opened device, or null */ public static ALCdevice alcOpenDevice(String devicename) { - long device_address = nalcOpenDevice(devicename); + ByteBuffer buffer = MemoryUtil.encodeUTF8(devicename); + long device_address = nalcOpenDevice(MemoryUtil.getAddressSafe(buffer)); if(device_address != 0) { ALCdevice device = new ALCdevice(device_address); synchronized (ALC10.devices) { @@ -208,7 +209,7 @@ } return null; } - static native long nalcOpenDevice(String devicename); + static native long nalcOpenDevice(long devicename); /** * The alcCloseDevice function allows the application (i.e. the client program) to @@ -246,7 +247,7 @@ * @return New context, or null if creation failed */ public static ALCcontext alcCreateContext(ALCdevice device, IntBuffer attrList) { - long context_address = nalcCreateContext(getDevice(device), attrList); + long context_address = nalcCreateContext(getDevice(device), MemoryUtil.getAddressSafe(attrList)); Util.checkALCError(device); if(context_address != 0) { @@ -259,7 +260,7 @@ } return null; } - static native long nalcCreateContext(long device, IntBuffer attrList); + static native long nalcCreateContext(long device, long attrList); /** * To make a Context current with respect to AL Operation (state changes by issueing @@ -394,11 +395,12 @@ * @return true if extension is available, false if not */ public static boolean alcIsExtensionPresent(ALCdevice device, String extName) { - boolean result = nalcIsExtensionPresent(getDevice(device), extName); + ByteBuffer buffer = MemoryUtil.encodeASCII(extName); + boolean result = nalcIsExtensionPresent(getDevice(device), MemoryUtil.getAddress(buffer)); Util.checkALCError(device); return result; } - static native boolean nalcIsExtensionPresent(long device, String extName); + private static native boolean nalcIsExtensionPresent(long device, long extName); /** * Enumeration/token values are device independend, but tokens defined for @@ -411,11 +413,12 @@ * @return value of enumeration */ public static int alcGetEnumValue(ALCdevice device, String enumName) { - int result = nalcGetEnumValue(getDevice(device), enumName); + ByteBuffer buffer = MemoryUtil.encodeASCII(enumName); + int result = nalcGetEnumValue(getDevice(device), MemoryUtil.getAddress(buffer)); Util.checkALCError(device); return result; } - static native int nalcGetEnumValue(long device, String enumName); + private static native int nalcGetEnumValue(long device, long enumName); static long getDevice(ALCdevice device) { if(device != null) { diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/openal/ALC11.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/openal/ALC11.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/openal/ALC11.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/openal/ALC11.java 2016-04-09 16:26:56.000000000 +0000 @@ -37,7 +37,7 @@ import org.lwjgl.BufferUtils; import org.lwjgl.LWJGLException; import org.lwjgl.LWJGLUtil; - +import org.lwjgl.MemoryUtil; /** *

@@ -92,7 +92,8 @@ * @return ALCdevice if it was possible to open a device */ public static ALCdevice alcCaptureOpenDevice(String devicename, int frequency, int format, int buffersize) { - long device_address = nalcCaptureOpenDevice(devicename, frequency, format, buffersize); + ByteBuffer buffer = MemoryUtil.encodeASCII(devicename); + long device_address = nalcCaptureOpenDevice(MemoryUtil.getAddressSafe(buffer), frequency, format, buffersize); if(device_address != 0) { ALCdevice device = new ALCdevice(device_address); synchronized (ALC10.devices) { @@ -102,7 +103,7 @@ } return null; } - static native long nalcCaptureOpenDevice( String devicename, int frequency, int format, int buffersize); + private static native long nalcCaptureOpenDevice(long devicename, int frequency, int format, int buffersize); /** * The alcCaptureCloseDevice function allows the application to disconnect from a capture @@ -162,9 +163,9 @@ * @param samples Number of samples to request */ public static void alcCaptureSamples(ALCdevice device, ByteBuffer buffer, int samples ) { - nalcCaptureSamples(ALC10.getDevice(device), buffer, buffer.position(), samples); + nalcCaptureSamples(ALC10.getDevice(device), MemoryUtil.getAddress(buffer), samples); } - static native void nalcCaptureSamples(long device, ByteBuffer buffer, int position, int samples ); + static native void nalcCaptureSamples(long device, long buffer, int samples ); static native void initNativeStubs() throws LWJGLException; diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/openal/ALCcontext.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/openal/ALCcontext.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/openal/ALCcontext.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/openal/ALCcontext.java 2016-04-09 16:26:56.000000000 +0000 @@ -46,8 +46,8 @@ * AL and ALC are threadsafe. * * @author Brian Matzon - * @version $Revision: 3418 $ - * $Id: ALCcontext.java 3418 2010-09-28 21:11:35Z spasi $ + * @version $Revision$ + * $Id$ */ public final class ALCcontext { @@ -82,7 +82,7 @@ * @param contextFrequency Frequency to add * @param contextRefresh Refresh rate to add * @param contextSynchronized Whether to synchronize the context - * @return + * @return attribute list */ static IntBuffer createAttributeList(int contextFrequency, int contextRefresh, int contextSynchronized) { IntBuffer attribList = BufferUtils.createIntBuffer(7); diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/openal/ALCdevice.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/openal/ALCdevice.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/openal/ALCdevice.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/openal/ALCdevice.java 2016-04-09 16:26:56.000000000 +0000 @@ -45,8 +45,8 @@ * which has to map the available backends to unique device specifiers. * * @author Brian Matzon - * @version $Revision: 3418 $ - * $Id: ALCdevice.java 3418 2010-09-28 21:11:35Z spasi $ + * @version $Revision$ + * $Id$ */ public final class ALCdevice { diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/openal/AL.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/openal/AL.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/openal/AL.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/openal/AL.java 2016-04-09 16:26:56.000000000 +0000 @@ -42,8 +42,8 @@ *

* * @author Brian Matzon - * @version $Revision: 3418 $ - * $Id: AL.java 3418 2010-09-28 21:11:35Z spasi $ + * @version $Revision$ + * $Id$ */ public final class AL { /** ALCdevice instance. */ @@ -115,8 +115,13 @@ String[] library_names; switch (LWJGLUtil.getPlatform()) { case LWJGLUtil.PLATFORM_WINDOWS: - libname = "OpenAL32"; - library_names = new String[]{"OpenAL64.dll", "OpenAL32.dll"}; + if ( Sys.is64Bit() ) { + libname = "OpenAL64"; + library_names = new String[]{"OpenAL64.dll"}; + } else { + libname = "OpenAL32"; + library_names = new String[]{"OpenAL32.dll"}; + } break; case LWJGLUtil.PLATFORM_LINUX: libname = "openal"; diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/openal/OpenALException.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/openal/OpenALException.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/openal/OpenALException.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/openal/OpenALException.java 2016-04-09 16:26:56.000000000 +0000 @@ -37,8 +37,8 @@ * causes an error. * * @author Brian Matzon - * @version $Revision: 2983 $ - * $Id: OpenALException.java 2983 2008-04-07 18:36:09Z matzon $ + * @version $Revision$ + * $Id$ */ public class OpenALException extends RuntimeException { diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/openal/Util.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/openal/Util.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/openal/Util.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/openal/Util.java 2016-04-09 16:26:56.000000000 +0000 @@ -37,7 +37,7 @@ * * @author cix_foo * @author Brian Matzon - * @version $Revision: 2983 $ + * @version $Revision$ */ public final class Util { diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opencl/APIUtil.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opencl/APIUtil.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opencl/APIUtil.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opencl/APIUtil.java 2016-04-09 16:26:56.000000000 +0000 @@ -31,9 +31,7 @@ */ package org.lwjgl.opencl; -import org.lwjgl.BufferUtils; -import org.lwjgl.LWJGLUtil; -import org.lwjgl.PointerBuffer; +import org.lwjgl.*; import org.lwjgl.opencl.FastLongMap.Entry; import java.nio.*; @@ -53,7 +51,7 @@ */ final class APIUtil { - private static final int INITIAL_BUFFER_SIZE = 256; + private static final int INITIAL_BUFFER_SIZE = 256; private static final int INITIAL_LENGTHS_SIZE = 4; private static final int BUFFERS_SIZE = 32; @@ -223,10 +221,10 @@ * * @return the String as a ByteBuffer */ - static ByteBuffer getBuffer(final CharSequence string) { + static long getBuffer(final CharSequence string) { final ByteBuffer buffer = encode(getBufferByte(string.length()), string); buffer.flip(); - return buffer; + return MemoryUtil.getAddress0(buffer); } /** @@ -236,10 +234,10 @@ * * @return the String as a ByteBuffer */ - static ByteBuffer getBuffer(final CharSequence string, final int offset) { + static long getBuffer(final CharSequence string, final int offset) { final ByteBuffer buffer = encode(getBufferByteOffset(offset + string.length()), string); buffer.flip(); - return buffer; + return MemoryUtil.getAddress(buffer); } /** @@ -249,11 +247,11 @@ * * @return the String as a ByteBuffer */ - static ByteBuffer getBufferNT(final CharSequence string) { + static long getBufferNT(final CharSequence string) { final ByteBuffer buffer = encode(getBufferByte(string.length() + 1), string); buffer.put((byte)0); buffer.flip(); - return buffer; + return MemoryUtil.getAddress0(buffer); } static int getTotalLength(final CharSequence[] strings) { @@ -271,14 +269,14 @@ * * @return the Strings as a ByteBuffer */ - static ByteBuffer getBuffer(final CharSequence[] strings) { + static long getBuffer(final CharSequence[] strings) { final ByteBuffer buffer = getBufferByte(getTotalLength(strings)); for ( CharSequence string : strings ) encode(buffer, string); buffer.flip(); - return buffer; + return MemoryUtil.getAddress0(buffer); } /** @@ -288,7 +286,7 @@ * * @return the Strings as a ByteBuffer */ - static ByteBuffer getBufferNT(final CharSequence[] strings) { + static long getBufferNT(final CharSequence[] strings) { final ByteBuffer buffer = getBufferByte(getTotalLength(strings) + strings.length); for ( CharSequence string : strings ) { @@ -297,7 +295,7 @@ } buffer.flip(); - return buffer; + return MemoryUtil.getAddress0(buffer); } /** @@ -307,14 +305,14 @@ * * @return the String lengths in a PointerBuffer */ - static PointerBuffer getLengths(final CharSequence[] strings) { + static long getLengths(final CharSequence[] strings) { PointerBuffer buffer = getLengths(strings.length); for ( CharSequence string : strings ) buffer.put(string.length()); buffer.flip(); - return buffer; + return MemoryUtil.getAddress0(buffer); } /** @@ -324,14 +322,14 @@ * * @return the buffer lengths in a PointerBuffer */ - static PointerBuffer getLengths(final ByteBuffer[] buffers) { + static long getLengths(final ByteBuffer[] buffers) { PointerBuffer lengths = getLengths(buffers.length); for ( ByteBuffer buffer : buffers ) lengths.put(buffer.remaining()); lengths.flip(); - return lengths; + return MemoryUtil.getAddress0(lengths); } static int getSize(final PointerBuffer lengths) { @@ -342,14 +340,22 @@ return (int)size; } + static long getPointer(final PointerWrapper pointer) { + return MemoryUtil.getAddress0(getBufferPointer().put(0, pointer)); + } + + static long getPointerSafe(final PointerWrapper pointer) { + return MemoryUtil.getAddress0(getBufferPointer().put(0, pointer == null ? 0L : pointer.getPointer())); + } + private static class Buffers { final ShortBuffer shorts; - final IntBuffer ints; - final IntBuffer intsDebug; - final LongBuffer longs; + final IntBuffer ints; + final IntBuffer intsDebug; + final LongBuffer longs; - final FloatBuffer floats; + final FloatBuffer floats; final DoubleBuffer doubles; final PointerBuffer pointers; @@ -453,7 +459,7 @@ */ static void releaseObjects(final CLDevice device) { // Release objects only if we're about to hit 0. - if ( device.getReferenceCount() > 1 ) + if ( !device.isValid() || device.getReferenceCount() > 1 ) return; releaseObjects(device.getSubCLDeviceRegistry(), DESTRUCTOR_CLSubDevice); @@ -466,7 +472,7 @@ */ static void releaseObjects(final CLContext context) { // Release objects only if we're about to hit 0. - if ( context.getReferenceCount() > 1 ) + if ( !context.isValid() || context.getReferenceCount() > 1 ) return; releaseObjects(context.getCLEventRegistry(), DESTRUCTOR_CLEvent); @@ -483,7 +489,7 @@ */ static void releaseObjects(final CLProgram program) { // Release objects only if we're about to hit 0. - if ( program.getReferenceCount() > 1 ) + if ( !program.isValid() || program.getReferenceCount() > 1 ) return; releaseObjects(program.getCLKernelRegistry(), DESTRUCTOR_CLKernel); @@ -496,7 +502,7 @@ */ static void releaseObjects(final CLCommandQueue queue) { // Release objects only if we're about to hit 0. - if ( queue.getReferenceCount() > 1 ) + if ( !queue.isValid() || queue.getReferenceCount() > 1 ) return; releaseObjects(queue.getCLEventRegistry(), DESTRUCTOR_CLEvent); @@ -513,25 +519,25 @@ } } - private static final ObjectDestructor DESTRUCTOR_CLSubDevice = new ObjectDestructor() { + private static final ObjectDestructor DESTRUCTOR_CLSubDevice = new ObjectDestructor() { public void release(final CLDevice object) { clReleaseDeviceEXT(object); } }; - private static final ObjectDestructor DESTRUCTOR_CLMem = new ObjectDestructor() { + private static final ObjectDestructor DESTRUCTOR_CLMem = new ObjectDestructor() { public void release(final CLMem object) { clReleaseMemObject(object); } }; private static final ObjectDestructor DESTRUCTOR_CLCommandQueue = new ObjectDestructor() { public void release(final CLCommandQueue object) { clReleaseCommandQueue(object); } }; - private static final ObjectDestructor DESTRUCTOR_CLSampler = new ObjectDestructor() { + private static final ObjectDestructor DESTRUCTOR_CLSampler = new ObjectDestructor() { public void release(final CLSampler object) { clReleaseSampler(object); } }; - private static final ObjectDestructor DESTRUCTOR_CLProgram = new ObjectDestructor() { + private static final ObjectDestructor DESTRUCTOR_CLProgram = new ObjectDestructor() { public void release(final CLProgram object) { clReleaseProgram(object); } }; - private static final ObjectDestructor DESTRUCTOR_CLKernel = new ObjectDestructor() { + private static final ObjectDestructor DESTRUCTOR_CLKernel = new ObjectDestructor() { public void release(final CLKernel object) { clReleaseKernel(object); } }; - private static final ObjectDestructor DESTRUCTOR_CLEvent = new ObjectDestructor() { + private static final ObjectDestructor DESTRUCTOR_CLEvent = new ObjectDestructor() { public void release(final CLEvent object) { clReleaseEvent(object); } }; diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opencl/CallbackUtil.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opencl/CallbackUtil.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opencl/CallbackUtil.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opencl/CallbackUtil.java 2016-04-09 16:26:56.000000000 +0000 @@ -70,7 +70,7 @@ * * @param ref the GlobalRef memory address. */ - private static native void deleteGlobalRef(long ref); + static native void deleteGlobalRef(long ref); /** * Deletes the global reference represented by user_data if an OpenCL error occured. @@ -99,41 +99,6 @@ */ static native long getContextCallback(); - /** - * Associates the specified CLContext with the specified global reference. If the context - * is invalid, the global reference is deleted. NO-OP if user_data is 0. - * - * @param context the CLContext to register - * @param user_data the global reference pointer - */ - static void registerCallback(final CLContext context, final long user_data) { - if ( context.getPointerUnsafe() == 0 ) { - if ( user_data != 0 ) - deleteGlobalRef(user_data); - return; - } - - if ( user_data != 0 ) - contextUserData.put(context, user_data); - } - - /** - * Decrements the specified context's reference count, clears its association - * with a CLContextCallback object if it exists and deletes the corresponding - * global reference. - * - * @param context the CLContext to unregister - */ - static void unregisterCallback(final CLContext context) { - if ( context.release() > 0 ) - return; - - final Long user_data = contextUserData.remove(context); - - if ( user_data != null ) - deleteGlobalRef(user_data); - } - /* [ Other callback functionality ] The other callbacks are simpler. We create the GlobalRef before passing the callback, we delete it when we receive the callback call. @@ -151,7 +116,7 @@ * * @return the callback function address */ - static native long getBuildProgramCallback(); + static native long getProgramCallback(); /** * Returns the memory address of the native function we pass to clEnqueueNativeKernel. @@ -168,6 +133,13 @@ static native long getEventCallback(); /** + * Returns the memory address of the native function we pass to clSetPrintfCallback. + * + * @return the callback function address + */ + static native long getPrintfCallback(); + + /** * Returns the memory address of the native function we pass to clCreateContext(FromType), * when APPLEContextLoggingUtil.SYSTEM_LOG_CALLBACK is used. * diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opencl/CLBuildProgramCallback.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opencl/CLBuildProgramCallback.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opencl/CLBuildProgramCallback.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opencl/CLBuildProgramCallback.java 2016-04-09 16:26:56.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2010 LWJGL Project + * Copyright (c) 2002-2011 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -33,29 +33,11 @@ /** * Instances of this class can be used to receive OpenCL program build notifications. + * A single CLBuildProgramCallback instance should only be used with programs created + * in the same CLContext. * * @author Spasi */ -public abstract class CLBuildProgramCallback extends CLCallback { - - protected CLBuildProgramCallback() { - super(CallbackUtil.getBuildProgramCallback()); - } - - /** - * Called from native code. - * - * @param program_address the CLProgram object pointer - */ - private void handleMessage(long program_address) { - handleMessage(CLContext.getCLProgramGlobal(program_address)); - } - - /** - * The callback method. - * - * @param program the CLProgram object that was built - */ - protected abstract void handleMessage(CLProgram program); +public abstract class CLBuildProgramCallback extends CLProgramCallback { } \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opencl/CLCallback.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opencl/CLCallback.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opencl/CLCallback.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opencl/CLCallback.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2002-2010 LWJGL Project - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of 'LWJGL' nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package org.lwjgl.opencl; - -import org.lwjgl.PointerWrapperAbstract; - -/** - * Base class for OpenCL callback objects. - * - * @author Spasi - */ -abstract class CLCallback extends PointerWrapperAbstract { - - private final boolean custom; - - protected CLCallback(final long pointer) { - this(pointer, false); - } - - protected CLCallback(final long pointer, final boolean custom) { - super(pointer); - - this.custom = custom; - } - - final boolean isCustom() { - return custom; - } - -} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opencl/CLChecks.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opencl/CLChecks.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opencl/CLChecks.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opencl/CLChecks.java 2016-04-09 16:26:56.000000000 +0000 @@ -53,23 +53,23 @@ /** * Calculates the number of bytes in the specified cl_mem buffer rectangle region. * - * @param origin the host origin + * @param offset the host offset * @param region the rectangle region * @param row_pitch the host row pitch * @param slice_pitch the host slice pitch * * @return the region size in bytes */ - static int calculateBufferRectSize(final PointerBuffer origin, final PointerBuffer region, long row_pitch, long slice_pitch) { + static int calculateBufferRectSize(final PointerBuffer offset, final PointerBuffer region, long row_pitch, long slice_pitch) { if ( !LWJGLUtil.CHECKS ) return 0; - final long x = origin.get(0); - final long y = origin.get(1); - final long z = origin.get(2); + final long x = offset.get(0); + final long y = offset.get(1); + final long z = offset.get(2); if ( LWJGLUtil.DEBUG && (x < 0 || y < 0 || z < 0) ) - throw new IllegalArgumentException("Invalid cl_mem host origin: " + x + ", " + y + ", " + z); + throw new IllegalArgumentException("Invalid cl_mem host offset: " + x + ", " + y + ", " + z); final long w = region.get(0); final long h = region.get(1); diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opencl/CLCommandQueue.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opencl/CLCommandQueue.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opencl/CLCommandQueue.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opencl/CLCommandQueue.java 2016-04-09 16:26:56.000000000 +0000 @@ -50,7 +50,7 @@ super(pointer, context); if ( isValid() ) { this.device = device; - this.clEvents = new CLObjectRegistryGlobal(CLContext.clEventsGlobal); + this.clEvents = new CLObjectRegistry(); context.getCLCommandQueueRegistry().registerObject(this); } else { this.device = null; diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opencl/CLCompileProgramCallback.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opencl/CLCompileProgramCallback.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opencl/CLCompileProgramCallback.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opencl/CLCompileProgramCallback.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opencl; + +/** + * Instances of this class can be used to receive OpenCL program compilation notifications. + * A single CLCompileProgramCallback instance should only be used with programs created + * in the same CLContext. + * + * @author Spasi + */ +public abstract class CLCompileProgramCallback extends CLProgramCallback { + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opencl/CLContext.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opencl/CLContext.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opencl/CLContext.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opencl/CLContext.java 2016-04-09 16:26:56.000000000 +0000 @@ -49,16 +49,14 @@ private static final CLContextUtil util = (CLContextUtil)CLPlatform.getInfoUtilInstance(CLContext.class, "CL_CONTEXT_UTIL"); private final CLObjectRegistry clCommandQueues; - private final CLObjectRegistry clMems; - private final CLObjectRegistry clSamplers; - private final CLObjectRegistry clPrograms; - private final CLObjectRegistry clEvents; - - /** Global registry for build callbacks. */ - static final FastLongMap clProgramsGlobal = new FastLongMap(); - - /** Global registry for event callbacks. */ - static final FastLongMap clEventsGlobal = new FastLongMap(); + private final CLObjectRegistry clMems; + private final CLObjectRegistry clSamplers; + private final CLObjectRegistry clPrograms; + private final CLObjectRegistry clEvents; + + private long + contextCallback, + printfCallback; CLContext(final long pointer, final CLPlatform platform) { super(pointer, platform); @@ -70,8 +68,8 @@ clCommandQueues = new CLObjectRegistry(); clMems = new CLObjectRegistry(); clSamplers = new CLObjectRegistry(); - clPrograms = new CLObjectRegistryGlobal(clProgramsGlobal); - clEvents = new CLObjectRegistryGlobal(clEventsGlobal); + clPrograms = new CLObjectRegistry(); + clEvents = new CLObjectRegistry(); } else { clCommandQueues = null; clMems = null; @@ -275,8 +273,50 @@ CLObjectRegistry getCLEventRegistry() { return clEvents; } - static CLProgram getCLProgramGlobal(final long id) { return clProgramsGlobal.get(id); } + private boolean checkCallback(final long callback, final int result) { + if ( result == 0 && (callback == 0 || isValid()) ) + return true; + + if ( callback != 0 ) + CallbackUtil.deleteGlobalRef(callback); + return false; + } + + /** + * Associates this context with the specified context callback reference. If the context + * is invalid, the callback reference is deleted. NO-OP if user_data is 0. + * + * @param callback the context callback pointer + */ + void setContextCallback(final long callback) { + if ( checkCallback(callback, 0) ) + this.contextCallback = callback; + } + + /** + * Associates this context with the specified printf callback reference. If the context + * is invalid, the callback reference is deleted. NO-OP if user_data is 0. + * + * @param callback the printf callback pointer + */ + void setPrintfCallback(final long callback, final int result) { + if ( checkCallback(callback, result) ) + this.printfCallback = callback; + } - static CLEvent getCLEventGlobal(final long id) { return clEventsGlobal.get(id); } + /** + * Decrements the context's reference count. If the reference + * count hits zero, it also deletes + * any callback objects associated with it. + */ + void releaseImpl() { + if ( release() > 0 ) + return; + + if ( contextCallback != 0 ) + CallbackUtil.deleteGlobalRef(contextCallback); + if ( printfCallback != 0 ) + CallbackUtil.deleteGlobalRef(printfCallback); + } } \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opencl/CLEventCallback.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opencl/CLEventCallback.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opencl/CLEventCallback.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opencl/CLEventCallback.java 2016-04-09 16:26:56.000000000 +0000 @@ -31,30 +31,46 @@ */ package org.lwjgl.opencl; +import org.lwjgl.PointerWrapperAbstract; + /** - * Instances of this class can be used to receive OpenCL memory object destruction notifications. + * Instances of this class can be used to handle OpenCL event callbacks. A single + * CLEventCallback instance should only be used on events generated from the same + * CLCommandQueue or on user events associated with the same CLContext. * * @author Spasi */ -public abstract class CLEventCallback extends CLCallback { +public abstract class CLEventCallback extends PointerWrapperAbstract { + + private CLObjectRegistry eventRegistry; protected CLEventCallback() { super(CallbackUtil.getEventCallback()); } /** + * Sets the eventRegistry that contains the CLEvents to which we're registered. + * + * @param eventRegistry the CLEvent object registry + */ + void setRegistry(final CLObjectRegistry eventRegistry) { + this.eventRegistry = eventRegistry; + } + + /** * Called from native code. * * @param event_address the CLEvent object pointer */ private void handleMessage(long event_address, int event_command_exec_status) { - handleMessage(CLContext.getCLEventGlobal(event_address), event_command_exec_status); + handleMessage(eventRegistry.getObject(event_address), event_command_exec_status); } /** * The callback method. * - * @param event the CLEvent object + * @param event the CLEvent object + * @param event_command_exec_status the execution status */ protected abstract void handleMessage(CLEvent event, int event_command_exec_status); diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opencl/CLEvent.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opencl/CLEvent.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opencl/CLEvent.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opencl/CLEvent.java 2016-04-09 16:26:56.000000000 +0000 @@ -108,6 +108,13 @@ // -------[ IMPLEMENTATION STUFF BELOW ]------- + CLObjectRegistry getParentRegistry() { + if ( queue == null ) + return getParent().getCLEventRegistry(); + else + return queue.getCLEventRegistry(); + } + int release() { try { return super.release(); diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opencl/CL.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opencl/CL.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opencl/CL.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opencl/CL.java 2016-04-09 16:26:56.000000000 +0000 @@ -33,6 +33,7 @@ import org.lwjgl.LWJGLException; import org.lwjgl.LWJGLUtil; +import org.lwjgl.MemoryUtil; import org.lwjgl.Sys; import java.nio.ByteBuffer; @@ -143,7 +144,12 @@ return 0; } - static native long getFunctionAddress(String name); + /** Helper method to get a pointer to a named function in the OpenCL library. */ + static long getFunctionAddress(String name) { + ByteBuffer buffer = MemoryUtil.encodeASCII(name); + return ngetFunctionAddress(MemoryUtil.getAddress(buffer)); + } + private static native long ngetFunctionAddress(long name); static native ByteBuffer getHostBuffer(final long address, final int size); diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opencl/CLLinkProgramCallback.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opencl/CLLinkProgramCallback.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opencl/CLLinkProgramCallback.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opencl/CLLinkProgramCallback.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opencl; + +/** + * Instances of this class can be used to receive OpenCL program linkage notifications. + * A single CLLinkProgramCallback instance should only be used with programs created + * in the same CLContext. + * + * @author Spasi + */ +public abstract class CLLinkProgramCallback extends CLProgramCallback { + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opencl/CLMemObjectDestructorCallback.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opencl/CLMemObjectDestructorCallback.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opencl/CLMemObjectDestructorCallback.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opencl/CLMemObjectDestructorCallback.java 2016-04-09 16:26:56.000000000 +0000 @@ -31,12 +31,14 @@ */ package org.lwjgl.opencl; +import org.lwjgl.PointerWrapperAbstract; + /** * Instances of this class can be used to receive OpenCL memory object destruction notifications. * * @author Spasi */ -public abstract class CLMemObjectDestructorCallback extends CLCallback { +public abstract class CLMemObjectDestructorCallback extends PointerWrapperAbstract { protected CLMemObjectDestructorCallback() { super(CallbackUtil.getMemObjectDestructorCallback()); diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opencl/CLNativeKernel.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opencl/CLNativeKernel.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opencl/CLNativeKernel.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opencl/CLNativeKernel.java 2016-04-09 16:26:56.000000000 +0000 @@ -31,6 +31,8 @@ */ package org.lwjgl.opencl; +import org.lwjgl.PointerWrapperAbstract; + import java.nio.ByteBuffer; /** @@ -43,7 +45,7 @@ * @see CL10#clEnqueueNativeKernel * @see #execute(java.nio.ByteBuffer[]) */ -public abstract class CLNativeKernel extends CLCallback { +public abstract class CLNativeKernel extends PointerWrapperAbstract { protected CLNativeKernel() { super(CallbackUtil.getNativeKernelCallback()); diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opencl/CLObjectRegistryGlobal.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opencl/CLObjectRegistryGlobal.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opencl/CLObjectRegistryGlobal.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opencl/CLObjectRegistryGlobal.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2002-2010 LWJGL Project - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of 'LWJGL' nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package org.lwjgl.opencl; - -/** - * A CLObject registry that also registers/unregisters objects to/from a global registry. - * - * @author Spasi - */ -final class CLObjectRegistryGlobal extends CLObjectRegistry { - - private final FastLongMap globalRegistry; - - CLObjectRegistryGlobal(final FastLongMap globalRegistry) { - this.globalRegistry = globalRegistry; - } - - void registerObject(final T object) { - super.registerObject(object); - globalRegistry.put(object.getPointer(), object); - } - - void unregisterObject(final T object) { - super.unregisterObject(object); - globalRegistry.remove(object.getPointerUnsafe()); - } - -} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opencl/CLPlatform.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opencl/CLPlatform.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opencl/CLPlatform.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opencl/CLPlatform.java 2016-04-09 16:26:56.000000000 +0000 @@ -53,9 +53,6 @@ private final CLObjectRegistry clDevices; - /** Global registry for build callbacks. */ - static final FastLongMap clDevicesGlobal = new FastLongMap(); - private Object caps; CLPlatform(final long pointer) { @@ -63,7 +60,7 @@ if ( isValid() ) { clPlatforms.put(pointer, this); - clDevices = new CLObjectRegistryGlobal(clDevicesGlobal); + clDevices = new CLObjectRegistry(); } else clDevices = null; } @@ -195,8 +192,6 @@ CLObjectRegistry getCLDeviceRegistry() { return clDevices; } - static CLDevice getCLDeviceGlobal(final long id) { return clDevicesGlobal.get(id); } - /** * Called from clGetDeviceIDs to register new devices. * diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opencl/CLPrintfCallback.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opencl/CLPrintfCallback.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opencl/CLPrintfCallback.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opencl/CLPrintfCallback.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opencl; + +import org.lwjgl.PointerWrapperAbstract; + +/** + * Instances of this class can be used to receive OpenCL printf messages. + * Different CLContexts should use different CLPrintfCallback instances. + * + * @author Spasi + */ +public abstract class CLPrintfCallback extends PointerWrapperAbstract { + + protected CLPrintfCallback() { + super(CallbackUtil.getPrintfCallback()); + } + + /** The callback method. */ + protected abstract void handleMessage(String data); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opencl/CLProgramCallback.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opencl/CLProgramCallback.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opencl/CLProgramCallback.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opencl/CLProgramCallback.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opencl; + +import org.lwjgl.PointerWrapperAbstract; + +/** + * Base class for OpenCL program action notifications. + * + * @author Spasi + */ +abstract class CLProgramCallback extends PointerWrapperAbstract { + + private CLContext context; + + protected CLProgramCallback() { + super(CallbackUtil.getProgramCallback()); + } + + /** + * Sets the context that contains the CLPrograms to which we're registered. + * + * @param context the CLContext object + */ + final void setContext(final CLContext context) { + this.context = context; + } + + /** + * Called from native code. + * + * @param program_address the CLProgram object pointer + */ + private void handleMessage(long program_address) { + handleMessage(context.getCLProgram(program_address)); + } + + /** + * The callback method. + * + * @param program the CLProgram object affected + */ + protected abstract void handleMessage(CLProgram program); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opencl/InfoUtilFactory.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opencl/InfoUtilFactory.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opencl/InfoUtilFactory.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opencl/InfoUtilFactory.java 2016-04-09 16:26:56.000000000 +0000 @@ -118,12 +118,12 @@ final long user_data = pfn_notify == null || pfn_notify.isCustom() ? 0 : CallbackUtil.createGlobalRef(pfn_notify); CLContext __result = null; try { - __result = new CLContext(nclCreateContext(properties.getBuffer(), 0, devices.size(), properties.getBuffer(), propertyCount * PointerBuffer.getPointerSize(), pfn_notify == null ? 0 : pfn_notify.getPointer(), user_data, errcode_ret, errcode_ret != null ? errcode_ret.position() : 0, function_pointer), platform); + __result = new CLContext(nclCreateContext(MemoryUtil.getAddress0(properties.getBuffer()), devices.size(), MemoryUtil.getAddress(properties, propertyCount), pfn_notify == null ? 0 : pfn_notify.getPointer(), user_data, MemoryUtil.getAddressSafe(errcode_ret), function_pointer), platform); if ( LWJGLUtil.DEBUG ) Util.checkCLError(errcode_ret.get(0)); return __result; } finally { - CallbackUtil.registerCallback(__result, user_data); + if ( __result != null ) __result.setContextCallback(user_data); } } @@ -256,7 +256,7 @@ final int size; switch ( param_name ) { - case CL_KERNEL_WORK_GROUP_SIZE: + case CL_KERNEL_COMPILE_WORK_GROUP_SIZE: size = 3; break; default: @@ -304,9 +304,9 @@ else if ( LWJGLUtil.DEBUG ) errcode_ret = APIUtil.getBufferInt(); - CLMem __result = new CLMem(nclCreateImage2D(context.getPointer(), flags, formatBuffer, 0, image_width, image_height, image_row_pitch, host_ptr, - host_ptr != null ? BufferChecks.checkBuffer(host_ptr, CLChecks.calculateImage2DSize(formatBuffer, image_width, image_height, image_row_pitch)) : 0, - errcode_ret, errcode_ret != null ? errcode_ret.position() : 0, function_pointer), context); + CLMem __result = new CLMem(nclCreateImage2D(context.getPointer(), flags, MemoryUtil.getAddress(formatBuffer, 0), image_width, image_height, image_row_pitch, MemoryUtil.getAddress0Safe(host_ptr) + + (host_ptr != null ? BufferChecks.checkBuffer(host_ptr, CLChecks.calculateImage2DSize(formatBuffer, image_width, image_height, image_row_pitch)) : 0), + MemoryUtil.getAddressSafe(errcode_ret), function_pointer), context); if ( LWJGLUtil.DEBUG ) Util.checkCLError(errcode_ret.get(0)); return __result; @@ -324,9 +324,9 @@ else if ( LWJGLUtil.DEBUG ) errcode_ret = APIUtil.getBufferInt(); - CLMem __result = new CLMem(nclCreateImage3D(context.getPointer(), flags, formatBuffer, 0, image_width, image_height, image_depth, image_row_pitch, image_slice_pitch, host_ptr, - host_ptr != null ? BufferChecks.checkBuffer(host_ptr, CLChecks.calculateImage3DSize(formatBuffer, image_width, image_height, image_depth, image_row_pitch, image_slice_pitch)) : 0, - errcode_ret, errcode_ret != null ? errcode_ret.position() : 0, function_pointer), context); + CLMem __result = new CLMem(nclCreateImage3D(context.getPointer(), flags, MemoryUtil.getAddress(formatBuffer, 0), image_width, image_height, image_depth, image_row_pitch, image_slice_pitch, MemoryUtil.getAddress0Safe(host_ptr) + + (host_ptr != null ? BufferChecks.checkBuffer(host_ptr, CLChecks.calculateImage3DSize(formatBuffer, image_width, image_height, image_depth, image_row_pitch, image_slice_pitch)) : 0), + MemoryUtil.getAddressSafe(errcode_ret), function_pointer), context); if ( LWJGLUtil.DEBUG ) Util.checkCLError(errcode_ret.get(0)); return __result; @@ -547,7 +547,7 @@ target = new ByteBuffer[sizes.remaining()]; for ( int i = 0; i < sizes.remaining(); i++ ) - target[i] = BufferUtils.createByteBuffer((int)sizes.get(0)); + target[i] = BufferUtils.createByteBuffer((int)sizes.get(i)); } else if ( LWJGLUtil.DEBUG ) { final PointerBuffer sizes = getSizesBuffer(program, CL_PROGRAM_BINARY_SIZES); diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/AbstractDrawable.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/AbstractDrawable.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/AbstractDrawable.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/AbstractDrawable.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,89 +0,0 @@ -package org.lwjgl.opengl; - -import org.lwjgl.LWJGLException; -import org.lwjgl.LWJGLUtil; -import org.lwjgl.PointerBuffer; - -/** - * @author Spasi - */ -abstract class AbstractDrawable implements DrawableLWJGL { - - /** Handle to the native GL rendering context */ - protected PeerInfo peer_info; - - /** The OpenGL Context. */ - protected Context context; - - protected AbstractDrawable() { - } - - public Context getContext() { - synchronized ( GlobalLock.lock ) { - return context; - } - } - - public Context createSharedContext() throws LWJGLException { - synchronized ( GlobalLock.lock ) { - checkDestroyed(); - return new Context(peer_info, context.getContextAttribs(), context); - } - } - - public boolean isCurrent() throws LWJGLException { - synchronized ( GlobalLock.lock ) { - checkDestroyed(); - return context.isCurrent(); - } - } - - public void makeCurrent() throws LWJGLException { - synchronized ( GlobalLock.lock ) { - checkDestroyed(); - context.makeCurrent(); - } - } - - public void releaseContext() throws LWJGLException { - synchronized ( GlobalLock.lock ) { - checkDestroyed(); - if ( context.isCurrent() ) - Context.releaseCurrentContext(); - } - } - - public void destroy() { - synchronized ( GlobalLock.lock ) { - if ( context == null ) - return; - - try { - releaseContext(); - - context.forceDestroy(); - context = null; - - if ( peer_info != null ) { - peer_info.destroy(); - peer_info = null; - } - } catch (LWJGLException e) { - LWJGLUtil.log("Exception occurred while destroying Drawable: " + e); - } - } - } - - public void setCLSharingProperties(final PointerBuffer properties) throws LWJGLException { - synchronized ( GlobalLock.lock ) { - checkDestroyed(); - context.setCLSharingProperties(properties); - } - } - - protected final void checkDestroyed() { - if ( context == null ) - throw new IllegalStateException("The Drawable has no context available."); - } - -} diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/AMDDebugOutputCallback.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/AMDDebugOutputCallback.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/AMDDebugOutputCallback.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/AMDDebugOutputCallback.java 2016-04-09 16:26:56.000000000 +0000 @@ -110,7 +110,7 @@ description = "OTHER"; break; default: - description = "Unknown (" + Integer.toHexString(category) + ")"; + description = printUnknownToken(category); } System.err.println("\tCategory: " + description); @@ -125,12 +125,16 @@ description = "LOW"; break; default: - description = "Unknown (" + Integer.toHexString(category) + ")"; + description = printUnknownToken(severity); } System.err.println("\tSeverity: " + description); System.err.println("\tMessage: " + message); } + + private String printUnknownToken(final int token) { + return "Unknown (0x" + Integer.toHexString(token).toUpperCase() + ")"; + } }); } diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/APIUtil.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/APIUtil.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/APIUtil.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/APIUtil.java 2016-04-09 16:26:56.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2008 LWJGL Project + * Copyright (c) 2002-2011 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -33,38 +33,46 @@ import org.lwjgl.BufferUtils; import org.lwjgl.LWJGLUtil; +import org.lwjgl.MemoryUtil; import java.nio.*; -/** @author spasi */ +/** + * Utility class for OpenGL API calls. Instances of APIUtil are created in ContextCapabilities, + * so we have an instance per OpenGL context. + * + * @author spasi + */ final class APIUtil { - private static final int INITIAL_BUFFER_SIZE = 256; + private static final int INITIAL_BUFFER_SIZE = 256; private static final int INITIAL_LENGTHS_SIZE = 4; private static final int BUFFERS_SIZE = 32; - private static final ThreadLocal arrayTL = new ThreadLocal() { - protected char[] initialValue() { return new char[INITIAL_BUFFER_SIZE]; } - }; + private char[] array; + private ByteBuffer buffer; + private IntBuffer lengths; - private static final ThreadLocal bufferTL = new ThreadLocal() { - protected ByteBuffer initialValue() { return BufferUtils.createByteBuffer(INITIAL_BUFFER_SIZE); } - }; + private final IntBuffer ints; + private final LongBuffer longs; + private final FloatBuffer floats; + private final DoubleBuffer doubles; - private static final ThreadLocal lengthsTL = new ThreadLocal() { - protected IntBuffer initialValue() { return BufferUtils.createIntBuffer(INITIAL_LENGTHS_SIZE); } - }; + APIUtil() { + array = new char[INITIAL_BUFFER_SIZE]; + buffer = BufferUtils.createByteBuffer(INITIAL_BUFFER_SIZE); + lengths = BufferUtils.createIntBuffer(INITIAL_LENGTHS_SIZE); - private static final ThreadLocal buffersTL = new ThreadLocal() { - protected Buffers initialValue() { return new Buffers(); } - }; + ints = BufferUtils.createIntBuffer(BUFFERS_SIZE); + longs = BufferUtils.createLongBuffer(BUFFERS_SIZE); - private APIUtil() { + floats = BufferUtils.createFloatBuffer(BUFFERS_SIZE); + doubles = BufferUtils.createDoubleBuffer(BUFFERS_SIZE); } - private static char[] getArray(final int size) { - char[] array = arrayTL.get(); + private static char[] getArray(final ContextCapabilities caps, final int size) { + char[] array = caps.util.array; if ( array.length < size ) { int sizeNew = array.length << 1; @@ -72,14 +80,14 @@ sizeNew <<= 1; array = new char[size]; - arrayTL.set(array); + caps.util.array = array; } return array; } - static ByteBuffer getBufferByte(final int size) { - ByteBuffer buffer = bufferTL.get(); + static ByteBuffer getBufferByte(final ContextCapabilities caps, final int size) { + ByteBuffer buffer = caps.util.buffer; if ( buffer.capacity() < size ) { int sizeNew = buffer.capacity() << 1; @@ -87,15 +95,15 @@ sizeNew <<= 1; buffer = BufferUtils.createByteBuffer(size); - bufferTL.set(buffer); + caps.util.buffer = buffer; } else buffer.clear(); return buffer; } - private static ByteBuffer getBufferByteOffset(final int size) { - ByteBuffer buffer = bufferTL.get(); + private static ByteBuffer getBufferByteOffset(final ContextCapabilities caps, final int size) { + ByteBuffer buffer = caps.util.buffer; if ( buffer.capacity() < size ) { int sizeNew = buffer.capacity() << 1; @@ -104,7 +112,7 @@ final ByteBuffer bufferNew = BufferUtils.createByteBuffer(size); bufferNew.put(buffer); - bufferTL.set(buffer = bufferNew); + caps.util.buffer = (buffer = bufferNew); } else { buffer.position(buffer.limit()); buffer.limit(buffer.capacity()); @@ -113,22 +121,20 @@ return buffer; } - static ShortBuffer getBufferShort() { return buffersTL.get().shorts; } + static IntBuffer getBufferInt(final ContextCapabilities caps) { return caps.util.ints; } - static IntBuffer getBufferInt() { return buffersTL.get().ints; } + static LongBuffer getBufferLong(final ContextCapabilities caps) { return caps.util.longs; } - static LongBuffer getBufferLong() { return buffersTL.get().longs; } + static FloatBuffer getBufferFloat(final ContextCapabilities caps) { return caps.util.floats; } - static FloatBuffer getBufferFloat() { return buffersTL.get().floats; } + static DoubleBuffer getBufferDouble(final ContextCapabilities caps) { return caps.util.doubles; } - static DoubleBuffer getBufferDouble() { return buffersTL.get().doubles; } - - static IntBuffer getLengths() { - return getLengths(1); + static IntBuffer getLengths(final ContextCapabilities caps) { + return getLengths(caps, 1); } - static IntBuffer getLengths(final int size) { - IntBuffer lengths = lengthsTL.get(); + static IntBuffer getLengths(final ContextCapabilities caps, final int size) { + IntBuffer lengths = caps.util.lengths; if ( lengths.capacity() < size ) { int sizeNew = lengths.capacity(); @@ -136,7 +142,7 @@ sizeNew <<= 1; lengths = BufferUtils.createIntBuffer(size); - lengthsTL.set(lengths); + caps.util.lengths = lengths; } else lengths.clear(); @@ -168,9 +174,9 @@ * * @return the buffer as a String. */ - static String getString(final ByteBuffer buffer) { + static String getString(final ContextCapabilities caps, final ByteBuffer buffer) { final int length = buffer.remaining(); - final char[] charArray = getArray(length); + final char[] charArray = getArray(caps, length); for ( int i = buffer.position(); i < buffer.limit(); i++ ) charArray[i - buffer.position()] = (char)buffer.get(i); @@ -185,10 +191,10 @@ * * @return the String as a ByteBuffer */ - static ByteBuffer getBuffer(final CharSequence string) { - final ByteBuffer buffer = encode(getBufferByte(string.length()), string); + static long getBuffer(final ContextCapabilities caps, final CharSequence string) { + final ByteBuffer buffer = encode(getBufferByte(caps, string.length()), string); buffer.flip(); - return buffer; + return MemoryUtil.getAddress0(buffer); } /** @@ -198,10 +204,10 @@ * * @return the String as a ByteBuffer */ - static ByteBuffer getBuffer(final CharSequence string, final int offset) { - final ByteBuffer buffer = encode(getBufferByteOffset(offset + string.length()), string); + static long getBuffer(final ContextCapabilities caps, final CharSequence string, final int offset) { + final ByteBuffer buffer = encode(getBufferByteOffset(caps, offset + string.length()), string); buffer.flip(); - return buffer; + return MemoryUtil.getAddress(buffer); } /** @@ -211,11 +217,11 @@ * * @return the String as a ByteBuffer */ - static ByteBuffer getBufferNT(final CharSequence string) { - final ByteBuffer buffer = encode(getBufferByte(string.length() + 1), string); + static long getBufferNT(final ContextCapabilities caps, final CharSequence string) { + final ByteBuffer buffer = encode(getBufferByte(caps, string.length() + 1), string); buffer.put((byte)0); buffer.flip(); - return buffer; + return MemoryUtil.getAddress0(buffer); } static int getTotalLength(final CharSequence[] strings) { @@ -233,14 +239,14 @@ * * @return the Strings as a ByteBuffer */ - static ByteBuffer getBuffer(final CharSequence[] strings) { - final ByteBuffer buffer = getBufferByte(getTotalLength(strings)); + static long getBuffer(final ContextCapabilities caps, final CharSequence[] strings) { + final ByteBuffer buffer = getBufferByte(caps, getTotalLength(strings)); for ( CharSequence string : strings ) encode(buffer, string); buffer.flip(); - return buffer; + return MemoryUtil.getAddress0(buffer); } /** @@ -250,8 +256,8 @@ * * @return the Strings as a ByteBuffer */ - static ByteBuffer getBufferNT(final CharSequence[] strings) { - final ByteBuffer buffer = getBufferByte(getTotalLength(strings) + strings.length); + static long getBufferNT(final ContextCapabilities caps, final CharSequence[] strings) { + final ByteBuffer buffer = getBufferByte(caps, getTotalLength(strings) + strings.length); for ( CharSequence string : strings ) { encode(buffer, string); @@ -259,7 +265,7 @@ } buffer.flip(); - return buffer; + return MemoryUtil.getAddress0(buffer); } /** @@ -269,34 +275,22 @@ * * @return the String lengths in an IntBuffer */ - static IntBuffer getLengths(final CharSequence[] strings) { - IntBuffer buffer = getLengths(strings.length); + static long getLengths(final ContextCapabilities caps, final CharSequence[] strings) { + IntBuffer buffer = getLengths(caps, strings.length); for ( CharSequence string : strings ) buffer.put(string.length()); buffer.flip(); - return buffer; + return MemoryUtil.getAddress0(buffer); } - private static class Buffers { - - final ShortBuffer shorts; - final IntBuffer ints; - final LongBuffer longs; - - final FloatBuffer floats; - final DoubleBuffer doubles; - - Buffers() { - shorts = BufferUtils.createShortBuffer(BUFFERS_SIZE); - ints = BufferUtils.createIntBuffer(BUFFERS_SIZE); - longs = BufferUtils.createLongBuffer(BUFFERS_SIZE); - - floats = BufferUtils.createFloatBuffer(BUFFERS_SIZE); - doubles = BufferUtils.createDoubleBuffer(BUFFERS_SIZE); - } + static long getInt(final ContextCapabilities caps, final int value) { + return MemoryUtil.getAddress0(getBufferInt(caps).put(0, value)); + } + static long getBufferByte0(final ContextCapabilities caps) { + return MemoryUtil.getAddress0(getBufferByte(caps, 0)); } } \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/ARBDebugOutputCallback.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/ARBDebugOutputCallback.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/ARBDebugOutputCallback.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/ARBDebugOutputCallback.java 2016-04-09 16:26:56.000000000 +0000 @@ -113,7 +113,7 @@ description = "OTHER"; break; default: - description = "Unknown (" + Integer.toHexString(source) + ")"; + description = printUnknownToken(source); } System.err.println("\tSource: " + description); @@ -137,7 +137,7 @@ description = "OTHER"; break; default: - description = "Unknown (" + Integer.toHexString(source) + ")"; + description = printUnknownToken(type); } System.err.println("\tType: " + description); @@ -152,12 +152,16 @@ description = "LOW"; break; default: - description = "Unknown (" + Integer.toHexString(source) + ")"; + description = printUnknownToken(severity); } System.err.println("\tSeverity: " + description); System.err.println("\tMessage: " + message); } + + private String printUnknownToken(final int token) { + return "Unknown (0x" + Integer.toHexString(token).toUpperCase() + ")"; + } }); } @@ -184,9 +188,9 @@ /** * This method will be called when an ARB_debug_output message is generated. * - * @param id the message ID * @param source the message source * @param type the message type + * @param id the message ID * @param severity the message severity * @param message the string representation of the message. */ diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/AWTCanvasImplementation.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/AWTCanvasImplementation.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/AWTCanvasImplementation.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/AWTCanvasImplementation.java 2016-04-09 16:26:56.000000000 +0000 @@ -40,14 +40,14 @@ /** * * @author elias_naur - * @version $Revision: 3002 $ - * $Id: AWTCanvasImplementation.java 3002 2008-04-10 20:25:54Z elias_naur $ + * @version $Revision$ + * $Id$ */ interface AWTCanvasImplementation { /** * Return an opaque handle to the canvas peer information required to create a context from it. */ - PeerInfo createPeerInfo(Canvas component, PixelFormat pixel_format) throws LWJGLException; + PeerInfo createPeerInfo(Canvas component, PixelFormat pixel_format, ContextAttribs attribs) throws LWJGLException; /** * Find a proper GraphicsConfiguration from the given GraphicsDevice and PixelFormat. diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/AWTGLCanvas.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/AWTGLCanvas.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/AWTGLCanvas.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/AWTGLCanvas.java 2016-04-09 16:26:56.000000000 +0000 @@ -42,21 +42,23 @@ import java.awt.event.HierarchyEvent; import java.awt.event.HierarchyListener; +import static org.lwjgl.opengl.GL11.*; + /** *

* An AWT rendering context. *

* - * @author $Author: spasi $ - * $Id: AWTGLCanvas.java 3418 2010-09-28 21:11:35Z spasi $ - * @version $Revision: 3418 $ + * @author $Author$ + * $Id$ + * @version $Revision$ */ public class AWTGLCanvas extends Canvas implements DrawableLWJGL, ComponentListener, HierarchyListener { private static final long serialVersionUID = 1L; private static final AWTCanvasImplementation implementation; - private boolean update_context; + private boolean update_context; private Object SYNC_LOCK = new Object(); /** The requested pixel format */ @@ -69,8 +71,8 @@ private final ContextAttribs attribs; /** Context handle */ - private PeerInfo peer_info; - private Context context; + private PeerInfo peer_info; + private ContextGL context; /** * re-entry counter for support for re-entrant @@ -105,20 +107,43 @@ } } + public void setPixelFormat(final PixelFormatLWJGL pf) throws LWJGLException { + throw new UnsupportedOperationException(); + } + + public void setPixelFormat(final PixelFormatLWJGL pf, final ContextAttribs attribs) throws LWJGLException { + throw new UnsupportedOperationException(); + } + + public PixelFormatLWJGL getPixelFormat() { + return pixel_format; + } + /** This method should only be called internally. */ - public Context getContext() { + public ContextGL getContext() { return context; } /** This method should only be called internally. */ - public Context createSharedContext() throws LWJGLException { + public ContextGL createSharedContext() throws LWJGLException { synchronized ( SYNC_LOCK ) { if ( context == null ) throw new IllegalStateException("Canvas not yet displayable"); - return new Context(peer_info, context.getContextAttribs(), context); + return new ContextGL(peer_info, context.getContextAttribs(), context); } } + public void checkGLError() { + Util.checkGLError(); + } + + public void initContext(final float r, final float g, final float b) { + // set background clear color + glClearColor(r, g, b, 0.0f); + // Clear window to avoid the desktop "showing through" + glClear(GL_COLOR_BUFFER_BIT); + } + /** Constructor using the default PixelFormat. */ public AWTGLCanvas() throws LWJGLException { this(new PixelFormat()); @@ -195,7 +220,7 @@ synchronized ( SYNC_LOCK ) { if ( context == null ) throw new IllegalStateException("Canvas not yet displayable"); - Context.setSwapInterval(swap_interval); + ContextGL.setSwapInterval(swap_interval); } } @@ -209,7 +234,7 @@ synchronized ( SYNC_LOCK ) { if ( context == null ) throw new IllegalStateException("Canvas not yet displayable"); - Context.swapBuffers(); + ContextGL.swapBuffers(); } } @@ -238,7 +263,7 @@ if ( context == null ) throw new IllegalStateException("Canvas not yet displayable"); if ( context.isCurrent() ) - Context.releaseCurrentContext(); + context.releaseCurrent(); } } @@ -290,12 +315,12 @@ return; try { if ( peer_info == null ) { - this.peer_info = implementation.createPeerInfo(this, pixel_format); + this.peer_info = implementation.createPeerInfo(this, pixel_format, attribs); } peer_info.lockAndGetHandle(); try { if ( context == null ) { - this.context = new Context(peer_info, attribs, drawable != null ? ((DrawableLWJGL)drawable).getContext() : null); + this.context = new ContextGL(peer_info, attribs, drawable != null ? (ContextGL)((DrawableLWJGL)drawable).getContext() : null); first_run = true; } @@ -315,7 +340,7 @@ } finally { reentry_count--; if ( reentry_count == 0 ) - Context.releaseCurrentContext(); + context.releaseCurrent(); } } finally { peer_info.unlock(); diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/AWTSurfaceLock.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/AWTSurfaceLock.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/AWTSurfaceLock.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/AWTSurfaceLock.java 2016-04-09 16:26:56.000000000 +0000 @@ -32,6 +32,8 @@ package org.lwjgl.opengl; import java.awt.Canvas; +import java.awt.Component; +import java.applet.Applet; import java.nio.ByteBuffer; import java.security.AccessController; import java.security.PrivilegedActionException; @@ -43,8 +45,8 @@ /** * * @author elias_naur - * @version $Revision: 3418 $ - * $Id: AWTSurfaceLock.java 3418 2010-09-28 21:11:35Z spasi $ + * @version $Revision$ + * $Id$ */ final class AWTSurfaceLock { @@ -78,7 +80,8 @@ // We need to elevate privileges because of an AWT bug. Please see // http://192.18.37.44/forums/index.php?topic=10572 for a discussion. // It is only needed on first call, so we avoid it on all subsequent calls - // due to performance. + // due to performance.. + if (firstLockSucceeded) return lockAndInitHandle(lock_buffer, component); else diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/CallbackUtil.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/CallbackUtil.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/CallbackUtil.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/CallbackUtil.java 2016-04-09 16:26:56.000000000 +0000 @@ -42,9 +42,11 @@ final class CallbackUtil { /** Context -> Long */ - private static final Map contextUserParamsARB = new HashMap(); + private static final Map contextUserParamsARB = new HashMap(); /** Context -> Long */ - private static final Map contextUserParamsAMD = new HashMap(); + private static final Map contextUserParamsAMD = new HashMap(); + /** Context -> Long */ + private static final Map contextUserParamsKHR = new HashMap(); private CallbackUtil() {} @@ -84,19 +86,19 @@ * * @param userParam the global reference pointer */ - private static void registerContextCallback(final long userParam, final Map contextUserData) { - Context context = Context.getCurrentContext(); - if ( context == null ) { + private static void registerContextCallback(final long userParam, final Map contextUserData) { + ContextCapabilities caps = GLContext.getCapabilities(); + if ( caps == null ) { deleteGlobalRef(userParam); throw new IllegalStateException("No context is current."); } - final Long userParam_old = contextUserData.remove(context); + final Long userParam_old = contextUserData.remove(caps); if ( userParam_old != null ) deleteGlobalRef(userParam_old); if ( userParam != 0 ) - contextUserData.put(context, userParam); + contextUserData.put(caps, userParam); } /** @@ -104,12 +106,19 @@ * * @param context the Context to unregister */ - static void unregisterCallbacks(final Context context) { - Long userParam = contextUserParamsARB.remove(context); + static void unregisterCallbacks(final Object context) { + // TODO: This is never called for custom contexts. Need to fix for LWJGL 3.0 + final ContextCapabilities caps = GLContext.getCapabilities(context); + + Long userParam = contextUserParamsARB.remove(caps); + if ( userParam != null ) + deleteGlobalRef(userParam); + + userParam = contextUserParamsAMD.remove(caps); if ( userParam != null ) deleteGlobalRef(userParam); - userParam = contextUserParamsAMD.remove(context); + userParam = contextUserParamsKHR.remove(caps); if ( userParam != null ) deleteGlobalRef(userParam); } @@ -154,4 +163,24 @@ registerContextCallback(userParam, contextUserParamsAMD); } + // --------- [ KHR_debug ] --------- + + /** + * Returns the memory address of the native function we pass to glDebugMessageCallback. + * + * @return the callback function address + */ + static native long getDebugCallbackKHR(); + + /** + * Associates the current OpenGL context with the specified global reference. If there + * is no context current, the global reference is deleted and an exception is thrown. + * Any previous callback registrations will be cleared. + * + * @param userParam the global reference pointer + */ + static void registerContextCallbackKHR(final long userParam) { + registerContextCallback(userParam, contextUserParamsKHR); + } + } \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/ContextAttribsImplementation.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/ContextAttribsImplementation.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/ContextAttribsImplementation.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/ContextAttribsImplementation.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2002-2008 LWJGL Project - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of 'LWJGL' nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -package org.lwjgl.opengl; - -/** @author spasi */ -interface ContextAttribsImplementation { - - int getMajorVersionAttrib(); - - int getMinorVersionAttrib(); - - int getLayerPlaneAttrib(); - - int getFlagsAttrib(); - - int getDebugBit(); - - int getForwardCompatibleBit(); - - int getProfileMaskAttrib(); - - int getProfileCoreBit(); - - int getProfileCompatibilityBit(); - -} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/ContextAttribs.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/ContextAttribs.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/ContextAttribs.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/ContextAttribs.java 2016-04-09 16:26:56.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2008 LWJGL Project + * Copyright (c) 2002-2014 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -35,269 +35,399 @@ import org.lwjgl.LWJGLUtil; import java.nio.IntBuffer; +import java.util.LinkedHashMap; +import java.util.Map.Entry; /** - * This class represents the context attributes passed to CreateContextAttribs of the ARB_create_context and - * ARB_create_context_profile extensions. - * These attributes can be used to indicate at context creation which OpenGL interface will be used. This includes the - * OpenGL version, the layer plane on which rendering takes place and also optional debug and forward combatibility modes. - * (read the ARB_create_context spec for details) + * This class represents the context attributes passed to CreateContextAttribs of the ARB_create_context extension. + *

+ * The attributes supported are described in the following extensions:
+ *

*

* Use of this class is optional. If an OpenGL context is created without passing an instance of this class * (or ARB_create_context is not supported), the old context creation code will be used. Support for debug and forward * compatible mobes is not guaranteed by the OpenGL implementation. Developers may encounter debug contexts being the same * as non-debug contexts or forward compatible contexts having support for deprecated functionality. *

- * If the forwardCompatible - * attribute is used, LWJGL will not load the deprecated functionality (as defined in the OpenGL 3.0 specification). This - * means that developers can start working on cleaning up their applications without an OpenGL 3.0 complaint driver. + * If the {@link #CONTEXT_FORWARD_COMPATIBLE_BIT_ARB} flag is used, LWJGL will not load the deprecated functionality (as defined in the OpenGL 3.0 + * specification), even if the driver exposes the corresponding entry points. + *

+ * This extension is not supported on MacOS X. However, in order to enable the GL 3.2 context on MacOS X 10.7 or newer, an instance of this class must be passed + * to LWJGL. The only valid configuration is ContextAttribs(3, 2, CONTEXT_CORE_PROFILE_BIT_ARB), anything else will be ignored. * * @author spasi */ public final class ContextAttribs { - // Same values for GLX & WGL - private static final int CONTEXT_ES2_PROFILE_BIT_EXT = 0x00000004; + // ATTRIBUTES + + public static final int CONTEXT_MAJOR_VERSION_ARB = 0x2091; + public static final int CONTEXT_MINOR_VERSION_ARB = 0x2092; + + public static final int CONTEXT_PROFILE_MASK_ARB = 0x9126, + CONTEXT_CORE_PROFILE_BIT_ARB = 0x00000001, + CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB = 0x00000002, + CONTEXT_ES2_PROFILE_BIT_EXT = 0x00000004; + + public static final int CONTEXT_FLAGS_ARB = 0x2094, + CONTEXT_DEBUG_BIT_ARB = 0x0001, + CONTEXT_FORWARD_COMPATIBLE_BIT_ARB = 0x0002, + CONTEXT_ROBUST_ACCESS_BIT_ARB = 0x00000004, + CONTEXT_RESET_ISOLATION_BIT_ARB = 0x00000008; + + public static final int CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB = 0x8256, + NO_RESET_NOTIFICATION_ARB = 0x8261, + LOSE_CONTEXT_ON_RESET_ARB = 0x8252; + + public static final int CONTEXT_RELEASE_BEHABIOR_ARB = 0x2097, + CONTEXT_RELEASE_BEHAVIOR_NONE_ARB = 0x0000, + CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB = 0x2098; + + public static final int CONTEXT_LAYER_PLANE_ARB = 0x2093; // WGL-only - private static final int CONTEXT_ROBUST_ACCESS_BIT_ARB = 0x00000004; - private static final int CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB = 0x8256; - private static final int - NO_RESET_NOTIFICATION_ARB = 0x8261, - LOSE_CONTEXT_ON_RESET_ARB = 0x8252; + // STATE private int majorVersion; private int minorVersion; - private int layerPlane; + private int profileMask; + private int contextFlags; + + private int contextResetNotificationStrategy = NO_RESET_NOTIFICATION_ARB; + private int contextReleaseBehavior = CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB; - private boolean debug; - private boolean forwardCompatible; - private boolean robustAccess; - - private boolean profileCore; - private boolean profileCompatibility; - private boolean profileES; + private int layerPlane; - private boolean loseContextOnReset; + // CONSTRUCTORS + /** Creates the default ContextAttribs instance. No special attributes will be used when creating the OpenGL context. */ public ContextAttribs() { this(1, 0); } - public ContextAttribs(final int majorVersion, final int minorVersion) { + /** Creates a ContextAttribs instance for the given OpenGL version. */ + public ContextAttribs(int majorVersion, int minorVersion) { + this(majorVersion, minorVersion, 0, 0); + } + + /** + * Creates a new ContextAttribs instance with the given attributes. + * + * @param majorVersion the major OpenGL version + * @param minorVersion the minor OpenGL version + * @param profileMask the context profile mask. One of:
{@link #CONTEXT_CORE_PROFILE_BIT_ARB}, {@link #CONTEXT_FORWARD_COMPATIBLE_BIT_ARB}, {@link #CONTEXT_ES2_PROFILE_BIT_EXT} + */ + public ContextAttribs(int majorVersion, int minorVersion, int profileMask) { + this(majorVersion, minorVersion, 0, profileMask); + } + + /** + * Creates a new ContextAttribs instance with the given attributes. + * + * @param majorVersion the major OpenGL version + * @param minorVersion the minor OpenGL version + * @param profileMask the context profile mask. One of:
{@link #CONTEXT_CORE_PROFILE_BIT_ARB}, {@link #CONTEXT_FORWARD_COMPATIBLE_BIT_ARB}, {@link #CONTEXT_ES2_PROFILE_BIT_EXT} + * @param contextFlags the context flags, a bitfield value. One or more of:
{@link #CONTEXT_DEBUG_BIT_ARB}, {@link #CONTEXT_FORWARD_COMPATIBLE_BIT_ARB}, {@link #CONTEXT_ROBUST_ACCESS_BIT_ARB}, {@link #CONTEXT_RESET_ISOLATION_BIT_ARB} + */ + public ContextAttribs(int majorVersion, int minorVersion, int profileMask, int contextFlags) { if ( majorVersion < 0 || 4 < majorVersion || minorVersion < 0 || - (majorVersion == 4 && 0 < minorVersion) || + (majorVersion == 4 && 5 < minorVersion) || (majorVersion == 3 && 3 < minorVersion) || (majorVersion == 2 && 1 < minorVersion) || (majorVersion == 1 && 5 < minorVersion) ) throw new IllegalArgumentException("Invalid OpenGL version specified: " + majorVersion + '.' + minorVersion); + if ( LWJGLUtil.CHECKS ) { + if ( 1 < Integer.bitCount(profileMask) || CONTEXT_ES2_PROFILE_BIT_EXT < profileMask ) + throw new IllegalArgumentException("Invalid profile mask specified: " + Integer.toBinaryString(profileMask)); + + if ( 0xF < contextFlags ) + throw new IllegalArgumentException("Invalid context flags specified: " + Integer.toBinaryString(profileMask)); + } + this.majorVersion = majorVersion; this.minorVersion = minorVersion; - } - private ContextAttribs(final ContextAttribs attribs) { - this.majorVersion = attribs.majorVersion; - this.minorVersion = attribs.minorVersion; + this.profileMask = profileMask; + this.contextFlags = contextFlags; + } - this.layerPlane = attribs.layerPlane; + // Copy constructor + private ContextAttribs(ContextAttribs other) { + this.majorVersion = other.majorVersion; + this.minorVersion = other.minorVersion; - this.debug = attribs.debug; - this.forwardCompatible = attribs.forwardCompatible; - this.robustAccess = attribs.robustAccess; + this.profileMask = other.profileMask; + this.contextFlags = other.contextFlags; - this.profileCore = attribs.profileCore; - this.profileCompatibility = attribs.profileCompatibility; - this.profileES = attribs.profileES; + this.contextResetNotificationStrategy = other.contextResetNotificationStrategy; + this.contextReleaseBehavior = other.contextReleaseBehavior; - this.loseContextOnReset = attribs.loseContextOnReset; + this.layerPlane = other.layerPlane; } + // GETTERS + + /** Returns the {@link #CONTEXT_MAJOR_VERSION_ARB} value. */ public int getMajorVersion() { return majorVersion; } + /** Returns the {@link #CONTEXT_MINOR_VERSION_ARB} value. */ public int getMinorVersion() { return minorVersion; } - public int getLayerPlane() { - return layerPlane; - } - - public boolean isDebug() { - return debug; + /** Returns the {@link #CONTEXT_PROFILE_MASK_ARB} value. */ + public int getProfileMask() { + return profileMask; } - public boolean isForwardCompatible() { - return forwardCompatible; + private boolean hasMask(int mask) { + return profileMask == mask; } + /** Returns true if the {@link #CONTEXT_CORE_PROFILE_BIT_ARB} has been set. */ public boolean isProfileCore() { - return profileCore; + return hasMask(CONTEXT_CORE_PROFILE_BIT_ARB); } + /** Returns true if the {@link #CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB} has been set. */ public boolean isProfileCompatibility() { - return profileCompatibility; + return hasMask(CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB); } + /** Returns true if the {@link #CONTEXT_ES2_PROFILE_BIT_EXT} has been set. */ public boolean isProfileES() { - return profileES; + return hasMask(CONTEXT_ES2_PROFILE_BIT_EXT); } - public ContextAttribs withLayer(final int layerPlane) { - if ( layerPlane < 0 ) - throw new IllegalArgumentException("Invalid layer plane specified: " + layerPlane); + /** Returns the {@link #CONTEXT_FLAGS_ARB} value. */ + public int getContextFlags() { + return contextFlags; + } - if ( layerPlane == this.layerPlane ) - return this; + private boolean hasFlag(int flag) { + return (contextFlags & flag) != 0; + } - final ContextAttribs attribs = new ContextAttribs(this); - attribs.layerPlane = layerPlane; - return attribs; + /** Returns true if the {@link #CONTEXT_DEBUG_BIT_ARB} has been set. */ + public boolean isDebug() { + return hasFlag(CONTEXT_DEBUG_BIT_ARB); } - public ContextAttribs withDebug(final boolean debug) { - if ( debug == this.debug ) - return this; + /** Returns true if the {@link #CONTEXT_FORWARD_COMPATIBLE_BIT_ARB} has been set. */ + public boolean isForwardCompatible() { + return hasFlag(CONTEXT_FORWARD_COMPATIBLE_BIT_ARB); + } - final ContextAttribs attribs = new ContextAttribs(this); - attribs.debug = debug; - return attribs; + /** Returns true if the {@link #CONTEXT_ROBUST_ACCESS_BIT_ARB} has been set. */ + public boolean isRobustAccess() { return hasFlag(CONTEXT_ROBUST_ACCESS_BIT_ARB); } + + /** Returns true if the {@link #CONTEXT_RESET_ISOLATION_BIT_ARB} has been set. */ + public boolean isContextResetIsolation() { + return hasFlag(CONTEXT_RESET_ISOLATION_BIT_ARB); + } + + /** Returns the {@link #CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB} value. */ + public int getContextResetNotificationStrategy() { + return contextResetNotificationStrategy; } - public ContextAttribs withForwardCompatible(final boolean forwardCompatible) { - if ( forwardCompatible == this.forwardCompatible ) + /** + * Returns true if the {@link #CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB} has been set to {@link #LOSE_CONTEXT_ON_RESET_ARB}. + * + * @deprecated use {@link #getContextResetNotificationStrategy} instead + */ + public boolean isLoseContextOnReset() { return contextResetNotificationStrategy == LOSE_CONTEXT_ON_RESET_ARB; } + + /** Returns the {@link #CONTEXT_RELEASE_BEHABIOR_ARB} value. */ + public int getContextReleaseBehavior() { + return contextReleaseBehavior; + } + + /** Returns the {@link #CONTEXT_LAYER_PLANE_ARB} value. */ + public int getLayerPlane() { + return layerPlane; + } + + // CHAIN CONFIGURATION PATTERN + + private ContextAttribs toggleMask(int mask, boolean value) { + if ( value == hasMask(mask) ) return this; - final ContextAttribs attribs = new ContextAttribs(this); - attribs.forwardCompatible = forwardCompatible; + ContextAttribs attribs = new ContextAttribs(this); + attribs.profileMask = value ? mask : 0; return attribs; } - public ContextAttribs withProfileCore(final boolean profileCore) { + /** + * Returns a new {@code ContextAttribs} instance with the {@link #CONTEXT_CORE_PROFILE_BIT_ARB} bit in {@link #CONTEXT_PROFILE_MASK_ARB} set to the given value. + * If {@code profileCore} is true, all other bits in the mask are cleared. + */ + public ContextAttribs withProfileCore(boolean profileCore) { if ( majorVersion < 3 || (majorVersion == 3 && minorVersion < 2) ) throw new IllegalArgumentException("Profiles are only supported on OpenGL version 3.2 or higher."); - if ( profileCore == this.profileCore ) - return this; - - final ContextAttribs attribs = new ContextAttribs(this); - attribs.profileCore = profileCore; - if ( profileCore ) - attribs.profileCompatibility = false; - - return attribs; + return toggleMask(CONTEXT_CORE_PROFILE_BIT_ARB, profileCore); } - public ContextAttribs withProfileCompatibility(final boolean profileCompatibility) { + /** + * Returns a new {@code ContextAttribs} instance with the {@link #CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB} bit in {@link #CONTEXT_PROFILE_MASK_ARB} set to the given value. + * If {@code profileCompatibility} is true, all other bits in the mask are cleared. + */ + public ContextAttribs withProfileCompatibility(boolean profileCompatibility) { if ( majorVersion < 3 || (majorVersion == 3 && minorVersion < 2) ) throw new IllegalArgumentException("Profiles are only supported on OpenGL version 3.2 or higher."); - if ( profileCompatibility == this.profileCompatibility ) - return this; + return toggleMask(CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB, profileCompatibility); + } + + /** + * Returns a new {@code ContextAttribs} instance with the {@link #CONTEXT_ES2_PROFILE_BIT_EXT} bit in {@link #CONTEXT_PROFILE_MASK_ARB} set to the given value. + * If {@code profileES} is true, all other bits in the mask are cleared. + */ + public ContextAttribs withProfileES(boolean profileES) { + if ( !(majorVersion == 2 && minorVersion == 0) ) + throw new IllegalArgumentException("The OpenGL ES profile is only supported on OpenGL version 2.0."); + + return toggleMask(CONTEXT_ES2_PROFILE_BIT_EXT, profileES); + } - final ContextAttribs attribs = new ContextAttribs(this); - attribs.profileCompatibility = profileCompatibility; - if ( profileCompatibility ) - attribs.profileCore = false; + private ContextAttribs toggleFlag(int flag, boolean value) { + if ( value == hasFlag(flag) ) + return this; + ContextAttribs attribs = new ContextAttribs(this); + attribs.contextFlags ^= flag; // toggle bit return attribs; } - public ContextAttribs withProfileES(final boolean profileES) { - if ( !(majorVersion == 2 && minorVersion == 0) ) - throw new IllegalArgumentException("The OpenGL ES profiles is only supported for OpenGL version 2.0."); + /** Returns a new {@code ContextAttribs} instance with the {@link #CONTEXT_DEBUG_BIT_ARB} bit in {@link #CONTEXT_FLAGS_ARB} set to the given value. */ + public ContextAttribs withDebug(boolean debug) { return toggleFlag(CONTEXT_DEBUG_BIT_ARB, debug); } + + /** Returns a new {@code ContextAttribs} instance with the {@link #CONTEXT_FORWARD_COMPATIBLE_BIT_ARB} bit in {@link #CONTEXT_FLAGS_ARB} set to the given value. */ + public ContextAttribs withForwardCompatible(boolean forwardCompatible) { return toggleFlag(CONTEXT_FORWARD_COMPATIBLE_BIT_ARB, forwardCompatible); } - if ( profileES == this.profileES ) + /** Returns a new {@code ContextAttribs} instance with the {@link #CONTEXT_ROBUST_ACCESS_BIT_ARB} bit in {@link #CONTEXT_FLAGS_ARB} set to the given value. */ + public ContextAttribs withRobustAccess(boolean robustAccess) { return toggleFlag(CONTEXT_ROBUST_ACCESS_BIT_ARB, robustAccess); } + + /** Returns a new {@code ContextAttribs} instance with the {@link #CONTEXT_RESET_ISOLATION_BIT_ARB} bit in {@link #CONTEXT_FLAGS_ARB} set to the given value. */ + public ContextAttribs withContextResetIsolation(boolean contextResetIsolation) { return toggleFlag(CONTEXT_RESET_ISOLATION_BIT_ARB, contextResetIsolation); } + + /** + * Returns a ContextAttribs instance with {@link #CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB} set to the given strategy. The default context reset notification + * strategy is {@link #NO_RESET_NOTIFICATION_ARB}. + * + * @param strategy the context reset notification strategy. One of:
{@link #NO_RESET_NOTIFICATION_ARB}, {@link #LOSE_CONTEXT_ON_RESET_ARB} + * + * @return the new ContextAttribs + */ + public ContextAttribs withResetNotificationStrategy(int strategy) { + if ( strategy == contextResetNotificationStrategy ) return this; - final ContextAttribs attribs = new ContextAttribs(this); - attribs.profileES = profileES; + if ( LWJGLUtil.CHECKS && !(strategy == NO_RESET_NOTIFICATION_ARB || strategy == LOSE_CONTEXT_ON_RESET_ARB) ) + throw new IllegalArgumentException("Invalid context reset notification strategy specified: 0x" + LWJGLUtil.toHexString(strategy)); + ContextAttribs attribs = new ContextAttribs(this); + attribs.contextResetNotificationStrategy = strategy; return attribs; } /** - * Returns a ContextAttribs instance with CONTEXT_RESET_NOTIFICATION_STRATEGY set - * to LOSE_CONTEXT_ON_RESET if the parameter is true or to NO_RESET_NOTIFICATION - * if the parameter is false. + * Returns a ContextAttribs instance with {@link #CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB} set to {@link #LOSE_CONTEXT_ON_RESET_ARB} if the parameter is + * true or to {@link #NO_RESET_NOTIFICATION_ARB} if the parameter is false. + * + * @param loseContextOnReset the context reset notification strategy + * + * @return the new ContextAttribs + * + * @deprecated use {@link #withResetNotificationStrategy} instead + */ + public ContextAttribs withLoseContextOnReset(boolean loseContextOnReset) { + return withResetNotificationStrategy(loseContextOnReset ? LOSE_CONTEXT_ON_RESET_ARB : NO_RESET_NOTIFICATION_ARB); + } + + /** + * Returns a ContextAttribs instance with {@link #CONTEXT_RELEASE_BEHABIOR_ARB} set to the given behavior. The default context release behavior is + * {@link #CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB}. * - * @param loseContextOnReset + * @param behavior the context release behavior. One of:
{@link #CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB}, {@link #CONTEXT_RELEASE_BEHAVIOR_NONE_ARB} * * @return the new ContextAttribs */ - public ContextAttribs withLoseContextOnReset(final boolean loseContextOnReset) { - if ( loseContextOnReset == this.loseContextOnReset ) + public ContextAttribs withContextReleaseBehavior(int behavior) { + if ( behavior == contextReleaseBehavior ) return this; - final ContextAttribs attribs = new ContextAttribs(this); - attribs.loseContextOnReset = loseContextOnReset; + if ( LWJGLUtil.CHECKS && !(behavior == CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB || behavior == CONTEXT_RELEASE_BEHAVIOR_NONE_ARB) ) + throw new IllegalArgumentException("Invalid context release behavior specified: 0x" + LWJGLUtil.toHexString(behavior)); + + ContextAttribs attribs = new ContextAttribs(this); + attribs.contextReleaseBehavior = behavior; return attribs; } - private static ContextAttribsImplementation getImplementation() { - switch ( LWJGLUtil.getPlatform() ) { - case LWJGLUtil.PLATFORM_LINUX: - return new LinuxContextAttribs(); - case LWJGLUtil.PLATFORM_WINDOWS: - return new WindowsContextAttribs(); - case LWJGLUtil.PLATFORM_MACOSX: - return new MacOSXContextAttribs(); - default: - throw new IllegalStateException("Unsupported platform"); - } - } + /** Returns a new {@code ContextAttribs} instance with {@link #CONTEXT_LAYER_PLANE_ARB} set to the given value. */ + public ContextAttribs withLayer(int layerPlane) { + if ( LWJGLUtil.getPlatform() != LWJGLUtil.PLATFORM_WINDOWS ) + throw new IllegalArgumentException("The CONTEXT_LAYER_PLANE_ARB attribute is supported only on the Windows platform."); - IntBuffer getAttribList() { - ContextAttribsImplementation implementation = getImplementation(); + if ( layerPlane == this.layerPlane ) + return this; - int attribCount = 0; + if ( layerPlane < 0 ) + throw new IllegalArgumentException("Invalid layer plane specified: " + layerPlane); - if ( !(majorVersion == 1 && minorVersion == 0) ) - attribCount += 2; - if ( 0 < layerPlane ) - attribCount++; - - int flags = 0; - if ( debug ) - flags |= implementation.getDebugBit(); - if ( forwardCompatible ) - flags |= implementation.getForwardCompatibleBit(); - if ( robustAccess ) - flags |= CONTEXT_ROBUST_ACCESS_BIT_ARB; - if ( 0 < flags ) - attribCount++; - - int profileMask = 0; - if ( profileCore ) - profileMask |= implementation.getProfileCoreBit(); - else if ( profileCompatibility ) - profileMask |= implementation.getProfileCompatibilityBit(); - else if ( profileES ) - profileMask |= CONTEXT_ES2_PROFILE_BIT_EXT; - if ( 0 < profileMask ) - attribCount++; + ContextAttribs attribs = new ContextAttribs(this); + attribs.layerPlane = layerPlane; + return attribs; + } - if ( attribCount == 0 ) + IntBuffer getAttribList() { + if ( LWJGLUtil.getPlatform() == LWJGLUtil.PLATFORM_MACOSX ) return null; - final IntBuffer attribs = BufferUtils.createIntBuffer((attribCount * 2) + 1); + LinkedHashMap map = new LinkedHashMap(8); if ( !(majorVersion == 1 && minorVersion == 0) ) { - attribs.put(implementation.getMajorVersionAttrib()).put(majorVersion); - attribs.put(implementation.getMinorVersionAttrib()).put(minorVersion); + map.put(CONTEXT_MAJOR_VERSION_ARB, majorVersion); + map.put(CONTEXT_MINOR_VERSION_ARB, minorVersion); } - if ( 0 < layerPlane ) - attribs.put(implementation.getLayerPlaneAttrib()).put(layerPlane); - if ( 0 < flags ) - attribs.put(implementation.getFlagsAttrib()).put(flags); - if ( 0 < profileMask ) - attribs.put(implementation.getProfileMaskAttrib()).put(profileMask); - if ( loseContextOnReset ) - attribs.put(CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB).put(LOSE_CONTEXT_ON_RESET_ARB); + if ( contextFlags != 0 ) + map.put(CONTEXT_FLAGS_ARB, contextFlags); + + if ( profileMask != 0 ) + map.put(CONTEXT_PROFILE_MASK_ARB, profileMask); + + if ( contextResetNotificationStrategy != NO_RESET_NOTIFICATION_ARB ) + map.put(CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB, contextResetNotificationStrategy); + + if ( contextReleaseBehavior != CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB ) + map.put(CONTEXT_RELEASE_BEHABIOR_ARB, contextReleaseBehavior); + + if ( layerPlane != 0 ) + map.put(CONTEXT_LAYER_PLANE_ARB, layerPlane); + + if ( map.isEmpty() ) + return null; + + IntBuffer attribs = BufferUtils.createIntBuffer((map.size() * 2) + 1); + for ( Entry attrib : map.entrySet() ) { + attribs + .put(attrib.getKey()) + .put(attrib.getValue()); + } attribs.put(0); attribs.rewind(); return attribs; @@ -308,19 +438,37 @@ sb.append("ContextAttribs:"); sb.append(" Version=").append(majorVersion).append('.').append(minorVersion); - sb.append(" - Layer=").append(layerPlane); - sb.append(" - Debug=").append(debug); - sb.append(" - ForwardCompatible=").append(forwardCompatible); - sb.append(" - RobustAccess=").append(robustAccess); - if ( robustAccess ) - sb.append(" (").append(loseContextOnReset ? "LOSE_CONTEXT_ON_RESET" : "NO_RESET_NOTIFICATION"); - sb.append(" - Profile="); - if ( profileCore ) - sb.append("Core"); - else if ( profileCompatibility ) - sb.append("Compatibility"); - else - sb.append("None"); + + if ( profileMask != 0 ) { + sb.append(", Profile="); + if ( hasMask(CONTEXT_CORE_PROFILE_BIT_ARB) ) + sb.append("CORE"); + else if ( hasMask(CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB) ) + sb.append("COMPATIBLITY"); + else if ( hasMask(CONTEXT_ES2_PROFILE_BIT_EXT) ) + sb.append("ES2"); + else + sb.append("*unknown*"); + } + + if ( contextFlags != 0 ) { + if ( hasFlag(CONTEXT_DEBUG_BIT_ARB) ) + sb.append(", DEBUG"); + if ( hasFlag(CONTEXT_FORWARD_COMPATIBLE_BIT_ARB) ) + sb.append(", FORWARD_COMPATIBLE"); + if ( hasFlag(CONTEXT_ROBUST_ACCESS_BIT_ARB) ) + sb.append(", ROBUST_ACCESS"); + if ( hasFlag(CONTEXT_RESET_ISOLATION_BIT_ARB) ) + sb.append(", RESET_ISOLATION"); + } + + if ( contextResetNotificationStrategy != NO_RESET_NOTIFICATION_ARB ) + sb.append(", LOSE_CONTEXT_ON_RESET"); + if ( contextReleaseBehavior != CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB ) + sb.append(", RELEASE_BEHAVIOR_NONE"); + + if ( layerPlane != 0 ) + sb.append(", Layer=").append(layerPlane); return sb.toString(); } diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/ContextGLES.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/ContextGLES.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/ContextGLES.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/ContextGLES.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,224 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +import org.lwjgl.LWJGLException; +import org.lwjgl.LWJGLUtil; +import org.lwjgl.Sys; +import org.lwjgl.opengles.EGLContext; +import org.lwjgl.opengles.GLContext; +import org.lwjgl.opengles.GLES20; +import org.lwjgl.opengles.PowerManagementEventException; + +import static org.lwjgl.opengles.EGL.*; + +/** + *

+ * Context encapsulates an OpenGL ES context. + *

+ *

+ * This class is thread-safe. + * + * @author elias_naur + * @version $Revision: 3332 $ + * $Id: Context.java 3332 2010-04-20 18:21:05Z spasi $ + */ +final class ContextGLES implements org.lwjgl.opengl.Context { + + /** The current Context */ + private static final ThreadLocal current_context_local = new ThreadLocal(); + + /** Handle to the native GL rendering context */ + private final DrawableGLES drawable; + private final EGLContext eglContext; + + private final org.lwjgl.opengles.ContextAttribs contextAttribs; + + /** Whether the context has been destroyed */ + private boolean destroyed; + + private boolean destroy_requested; + + /** The thread that has this context current, or null. */ + private Thread thread; + + static { + Sys.initialize(); + } + + public EGLContext getEGLContext() { + return eglContext; + } + + org.lwjgl.opengles.ContextAttribs getContextAttribs() { + return contextAttribs; + } + + static ContextGLES getCurrentContext() { + return current_context_local.get(); + } + + /** Create a context with the specified peer info and shared context */ + ContextGLES(DrawableGLES drawable, org.lwjgl.opengles.ContextAttribs attribs, ContextGLES shared_context) throws LWJGLException { + if ( drawable == null ) + throw new IllegalArgumentException(); + + ContextGLES context_lock = shared_context != null ? shared_context : this; + // If shared_context is not null, synchronize on it to make sure it is not deleted + // while this context is created. Otherwise, simply synchronize on ourself to avoid NPE + synchronized ( context_lock ) { + if ( shared_context != null && shared_context.destroyed ) + throw new IllegalArgumentException("Shared context is destroyed"); + + this.drawable = drawable; + this.contextAttribs = attribs; + this.eglContext = drawable.getEGLDisplay().createContext(drawable.getEGLConfig(), + shared_context == null ? null : shared_context.eglContext, + attribs == null ? new org.lwjgl.opengles.ContextAttribs(2).getAttribList() : attribs.getAttribList()); + } + } + + /** Release the current context (if any). After this call, no context is current. */ + public void releaseCurrent() throws LWJGLException, PowerManagementEventException { + eglReleaseCurrent(drawable.getEGLDisplay()); + org.lwjgl.opengles.GLContext.useContext(null); + current_context_local.set(null); + + synchronized ( this ) { + thread = null; + checkDestroy(); + } + } + + /** Swap the buffers on the current context. Only valid for double-buffered contexts */ + public static void swapBuffers() throws LWJGLException, PowerManagementEventException { + ContextGLES current_context = getCurrentContext(); + if ( current_context != null ) + current_context.drawable.getEGLSurface().swapBuffers(); + } + + private boolean canAccess() { + return thread == null || Thread.currentThread() == thread; + } + + private void checkAccess() { + if ( !canAccess() ) + throw new IllegalStateException("From thread " + Thread.currentThread() + ": " + thread + " already has the context current"); + } + + /** Make the context current */ + public synchronized void makeCurrent() throws LWJGLException, PowerManagementEventException { + checkAccess(); + if ( destroyed ) + throw new IllegalStateException("Context is destroyed"); + thread = Thread.currentThread(); + current_context_local.set(this); + eglContext.makeCurrent(drawable.getEGLSurface()); + org.lwjgl.opengles.GLContext.useContext(this); + } + + /** Query whether the context is current */ + public synchronized boolean isCurrent() throws LWJGLException { + if ( destroyed ) + throw new IllegalStateException("Context is destroyed"); + return eglIsCurrentContext(eglContext); + } + + private void checkDestroy() { + if ( !destroyed && destroy_requested ) { + try { + eglContext.destroy(); + destroyed = true; + thread = null; + } catch (LWJGLException e) { + LWJGLUtil.log("Exception occurred while destroying context: " + e); + } + } + } + + /** + * Set the buffer swap interval. This call is a best-attempt at changing + * the monitor swap interval, which is the minimum periodicity of color buffer swaps, + * measured in video frame periods, and is not guaranteed to be successful. + *

+ * A video frame period is the time required to display a full frame of video data. + */ + public static void setSwapInterval(int value) { + ContextGLES current_context = getCurrentContext(); + if ( current_context != null ) { + try { + current_context.drawable.getEGLDisplay().setSwapInterval(value); + } catch (LWJGLException e) { + LWJGLUtil.log("Failed to set swap interval. Reason: " + e.getMessage()); + } + } + } + + /** + * Destroy the context. This method behaves the same as destroy() with the extra + * requirement that the context must be either current to the current thread or not + * current at all. + */ + public synchronized void forceDestroy() throws LWJGLException { + checkAccess(); + destroy(); + } + + /** + * Request destruction of the Context. If the context is current, no context will be current after this call. + * The context is destroyed when no thread has it current. + */ + public synchronized void destroy() throws LWJGLException { + if ( destroyed ) + return; + destroy_requested = true; + boolean was_current = isCurrent(); + int error = GLES20.GL_NO_ERROR; + if ( was_current ) { + if ( org.lwjgl.opengles.GLContext.getCapabilities() != null && GLContext.getCapabilities().OpenGLES20 ) + error = GLES20.glGetError(); + + try { + releaseCurrent(); + } catch (PowerManagementEventException e) { + // Ignore + } + } + checkDestroy(); + if ( was_current && error != GLES20.GL_NO_ERROR ) + throw new OpenGLException(error); + } + + public void releaseDrawable() throws LWJGLException { + } + +} diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/ContextGL.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/ContextGL.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/ContextGL.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/ContextGL.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,299 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +import org.lwjgl.LWJGLException; +import org.lwjgl.LWJGLUtil; +import org.lwjgl.PointerBuffer; +import org.lwjgl.Sys; +import org.lwjgl.opencl.KHRGLSharing; +import org.lwjgl.opencl.APPLEGLSharing; + +import java.nio.ByteBuffer; +import java.nio.IntBuffer; + +import static org.lwjgl.opengl.GL11.*; + +/** + *

+ * Context encapsulates an OpenGL context. + *

+ *

+ * This class is thread-safe. + * + * @author elias_naur + * @version $Revision$ + * $Id$ + */ +final class ContextGL implements Context { + + /** The platform specific implementation of context methods */ + private static final ContextImplementation implementation; + + /** The current Context */ + private static final ThreadLocal current_context_local = new ThreadLocal(); + + /** Handle to the native GL rendering context */ + private final ByteBuffer handle; + private final PeerInfo peer_info; + + private final ContextAttribs contextAttribs; + private final boolean forwardCompatible; + + /** Whether the context has been destroyed */ + private boolean destroyed; + + private boolean destroy_requested; + + /** The thread that has this context current, or null. */ + private Thread thread; + + static { + Sys.initialize(); + implementation = createImplementation(); + } + + private static ContextImplementation createImplementation() { + switch ( LWJGLUtil.getPlatform() ) { + case LWJGLUtil.PLATFORM_LINUX: + return new LinuxContextImplementation(); + case LWJGLUtil.PLATFORM_WINDOWS: + return new WindowsContextImplementation(); + case LWJGLUtil.PLATFORM_MACOSX: + return new MacOSXContextImplementation(); + default: + throw new IllegalStateException("Unsupported platform"); + } + } + + PeerInfo getPeerInfo() { + return peer_info; + } + + ContextAttribs getContextAttribs() { + return contextAttribs; + } + + static ContextGL getCurrentContext() { + return current_context_local.get(); + } + + /** Create a context with the specified peer info and shared context */ + ContextGL(PeerInfo peer_info, ContextAttribs attribs, ContextGL shared_context) throws LWJGLException { + ContextGL context_lock = shared_context != null ? shared_context : this; + // If shared_context is not null, synchronize on it to make sure it is not deleted + // while this context is created. Otherwise, simply synchronize on ourself to avoid NPE + synchronized ( context_lock ) { + if ( shared_context != null && shared_context.destroyed ) + throw new IllegalArgumentException("Shared context is destroyed"); + GLContext.loadOpenGLLibrary(); + try { + this.peer_info = peer_info; + this.contextAttribs = attribs; + + IntBuffer attribList; + if ( attribs != null ) { + attribList = attribs.getAttribList(); + forwardCompatible = attribs.isForwardCompatible(); + } else { + attribList = null; + forwardCompatible = false; + } + + this.handle = implementation.create(peer_info, attribList, shared_context != null ? shared_context.handle : null); + } catch (LWJGLException e) { + GLContext.unloadOpenGLLibrary(); + throw e; + } + } + } + + /** Release the current context (if any). After this call, no context is current. */ + public void releaseCurrent() throws LWJGLException { + ContextGL current_context = getCurrentContext(); + if ( current_context != null ) { + implementation.releaseCurrentContext(); + GLContext.useContext(null); + current_context_local.set(null); + synchronized ( current_context ) { + current_context.thread = null; + current_context.checkDestroy(); + } + } + } + + /** + * Release the context from its drawable. This is necessary on some platforms, + * like Mac OS X, where binding the context to a drawable and binding the context + * for rendering are two distinct actions and where calling releaseDrawable + * on every releaseCurrentContext results in artifacts. + */ + public synchronized void releaseDrawable() throws LWJGLException { + if ( destroyed ) + throw new IllegalStateException("Context is destroyed"); + implementation.releaseDrawable(getHandle()); + } + + /** Update the context. Should be called whenever it's drawable is moved or resized */ + public synchronized void update() { + if ( destroyed ) + throw new IllegalStateException("Context is destroyed"); + implementation.update(getHandle()); + } + + /** Swap the buffers on the current context. Only valid for double-buffered contexts */ + public static void swapBuffers() throws LWJGLException { + implementation.swapBuffers(); + } + + private boolean canAccess() { + return thread == null || Thread.currentThread() == thread; + } + + private void checkAccess() { + if ( !canAccess() ) + throw new IllegalStateException("From thread " + Thread.currentThread() + ": " + thread + " already has the context current"); + } + + /** Make the context current */ + public synchronized void makeCurrent() throws LWJGLException { + checkAccess(); + if ( destroyed ) + throw new IllegalStateException("Context is destroyed"); + thread = Thread.currentThread(); + current_context_local.set(this); + implementation.makeCurrent(peer_info, handle); + GLContext.useContext(this, forwardCompatible); + } + + ByteBuffer getHandle() { + return handle; + } + + /** Query whether the context is current */ + public synchronized boolean isCurrent() throws LWJGLException { + if ( destroyed ) + throw new IllegalStateException("Context is destroyed"); + return implementation.isCurrent(handle); + } + + private void checkDestroy() { + if ( !destroyed && destroy_requested ) { + try { + releaseDrawable(); + implementation.destroy(peer_info, handle); + CallbackUtil.unregisterCallbacks(this); + destroyed = true; + thread = null; + GLContext.unloadOpenGLLibrary(); + } catch (LWJGLException e) { + LWJGLUtil.log("Exception occurred while destroying context: " + e); + } + } + } + + /** + * Set the buffer swap interval. This call is a best-attempt at changing + * the monitor swap interval, which is the minimum periodicity of color buffer swaps, + * measured in video frame periods, and is not guaranteed to be successful. + *

+ * A video frame period is the time required to display a full frame of video data. + */ + public static void setSwapInterval(int value) { + implementation.setSwapInterval(value); + } + + /** + * Destroy the context. This method behaves the same as destroy() with the extra + * requirement that the context must be either current to the current thread or not + * current at all. + */ + public synchronized void forceDestroy() throws LWJGLException { + checkAccess(); + destroy(); + } + + /** + * Request destruction of the Context. If the context is current, no context will be current after this call. + * The context is destroyed when no thread has it current. + */ + public synchronized void destroy() throws LWJGLException { + if ( destroyed ) + return; + destroy_requested = true; + boolean was_current = isCurrent(); + int error = GL_NO_ERROR; + if ( was_current ) { + try { + // May fail on GLContext.getCapabilities() + error = glGetError(); + } catch (Exception e) { + // ignore + } + releaseCurrent(); + } + checkDestroy(); + if ( was_current && error != GL_NO_ERROR ) + throw new OpenGLException(error); + } + + public synchronized void setCLSharingProperties(final PointerBuffer properties) throws LWJGLException { + final ByteBuffer peer_handle = peer_info.lockAndGetHandle(); + try { + switch ( LWJGLUtil.getPlatform() ) { + case LWJGLUtil.PLATFORM_WINDOWS: + final WindowsContextImplementation implWindows = (WindowsContextImplementation)implementation; + properties.put(KHRGLSharing.CL_GL_CONTEXT_KHR).put(implWindows.getHGLRC(handle)); + properties.put(KHRGLSharing.CL_WGL_HDC_KHR).put(implWindows.getHDC(peer_handle)); + break; + case LWJGLUtil.PLATFORM_LINUX: + final LinuxContextImplementation implLinux = (LinuxContextImplementation)implementation; + properties.put(KHRGLSharing.CL_GL_CONTEXT_KHR).put(implLinux.getGLXContext(handle)); + properties.put(KHRGLSharing.CL_GLX_DISPLAY_KHR).put(implLinux.getDisplay(peer_handle)); + break; + case LWJGLUtil.PLATFORM_MACOSX: + if (LWJGLUtil.isMacOSXEqualsOrBetterThan(10, 6)) { // only supported on OS X 10.6+ + // http://oscarbg.blogspot.com/2009/10/about-opencl-opengl-interop.html + final MacOSXContextImplementation implMacOSX = (MacOSXContextImplementation)implementation; + final long CGLShareGroup = implMacOSX.getCGLShareGroup(handle); + properties.put(APPLEGLSharing.CL_CONTEXT_PROPERTY_USE_CGL_SHAREGROUP_APPLE).put(CGLShareGroup); + break; + } + default: + throw new UnsupportedOperationException("CL/GL context sharing is not supported on this platform."); + } + } finally { + peer_info.unlock(); + } + } + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/ContextImplementation.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/ContextImplementation.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/ContextImplementation.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/ContextImplementation.java 2016-04-09 16:26:56.000000000 +0000 @@ -42,8 +42,8 @@ *

* * @author elias_naur - * @version $Revision: 3116 $ - * $Id: ContextImplementation.java 3116 2008-08-19 16:46:03Z spasi $ + * @version $Revision$ + * $Id$ */ interface ContextImplementation { /** diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/Context.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/Context.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/Context.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/Context.java 2016-04-09 16:26:56.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2008 LWJGL Project + * Copyright (c) 2002-2011 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -32,255 +32,19 @@ package org.lwjgl.opengl; import org.lwjgl.LWJGLException; -import org.lwjgl.LWJGLUtil; -import org.lwjgl.PointerBuffer; -import org.lwjgl.Sys; -import org.lwjgl.opencl.KHRGLSharing; - -import java.nio.ByteBuffer; -import java.nio.IntBuffer; - -import static org.lwjgl.opengl.GL11.*; /** - *

- * Context encapsulates an OpenGL context. - *

- *

- * This class is thread-safe. - * - * @author elias_naur - * @version $Revision: 3418 $ - * $Id: Context.java 3418 2010-09-28 21:11:35Z spasi $ + * @author Spasi + * @since 14/5/2011 */ -final class Context { - - /** The platform specific implementation of context methods */ - private static final ContextImplementation implementation; - - /** The current Context */ - private static final ThreadLocal current_context_local = new ThreadLocal(); - - /** Handle to the native GL rendering context */ - private final ByteBuffer handle; - private final PeerInfo peer_info; - - private final ContextAttribs contextAttribs; - private final boolean forwardCompatible; - - /** Whether the context has been destroyed */ - private boolean destroyed; - - private boolean destroy_requested; - - /** The thread that has this context current, or null. */ - private Thread thread; - - static { - Sys.initialize(); - implementation = createImplementation(); - } - - private static ContextImplementation createImplementation() { - switch ( LWJGLUtil.getPlatform() ) { - case LWJGLUtil.PLATFORM_LINUX: - return new LinuxContextImplementation(); - case LWJGLUtil.PLATFORM_WINDOWS: - return new WindowsContextImplementation(); - case LWJGLUtil.PLATFORM_MACOSX: - return new MacOSXContextImplementation(); - default: - throw new IllegalStateException("Unsupported platform"); - } - } - - PeerInfo getPeerInfo() { - return peer_info; - } - - ContextAttribs getContextAttribs() { - return contextAttribs; - } - - static Context getCurrentContext() { - return current_context_local.get(); - } - - /** Create a context with the specified peer info and shared context */ - Context(PeerInfo peer_info, ContextAttribs attribs, Context shared_context) throws LWJGLException { - Context context_lock = shared_context != null ? shared_context : this; - // If shared_context is not null, synchronize on it to make sure it is not deleted - // while this context is created. Otherwise, simply synchronize on ourself to avoid NPE - synchronized ( context_lock ) { - if ( shared_context != null && shared_context.destroyed ) - throw new IllegalArgumentException("Shared context is destroyed"); - GLContext.loadOpenGLLibrary(); - try { - this.peer_info = peer_info; - this.contextAttribs = attribs; - - IntBuffer attribList; - if ( attribs != null ) { - attribList = attribs.getAttribList(); - forwardCompatible = attribs.isForwardCompatible(); - } else { - attribList = null; - forwardCompatible = false; - } - - this.handle = implementation.create(peer_info, attribList, shared_context != null ? shared_context.handle : null); - } catch (LWJGLException e) { - GLContext.unloadOpenGLLibrary(); - throw e; - } - } - } - - /** Release the current context (if any). After this call, no context is current. */ - public static void releaseCurrentContext() throws LWJGLException { - Context current_context = getCurrentContext(); - if ( current_context != null ) { - implementation.releaseCurrentContext(); - GLContext.useContext(null); - current_context_local.set(null); - synchronized ( current_context ) { - current_context.thread = null; - current_context.checkDestroy(); - } - } - } - - /** - * Release the context from its drawable. This is necessary on some platforms, - * like Mac OS X, where binding the context to a drawable and binding the context - * for rendering are two distinct actions and where calling releaseDrawable - * on every releaseCurrentContext results in artifacts. - */ - public synchronized void releaseDrawable() throws LWJGLException { - if ( destroyed ) - throw new IllegalStateException("Context is destroyed"); - implementation.releaseDrawable(getHandle()); - } - - /** Update the context. Should be called whenever it's drawable is moved or resized */ - public synchronized void update() { - if ( destroyed ) - throw new IllegalStateException("Context is destroyed"); - implementation.update(getHandle()); - } - - /** Swap the buffers on the current context. Only valid for double-buffered contexts */ - public static void swapBuffers() throws LWJGLException { - implementation.swapBuffers(); - } - - private boolean canAccess() { - return thread == null || Thread.currentThread() == thread; - } - - private void checkAccess() { - if ( !canAccess() ) - throw new IllegalStateException("From thread " + Thread.currentThread() + ": " + thread + " already has the context current"); - } - - /** Make the context current */ - public synchronized void makeCurrent() throws LWJGLException { - checkAccess(); - if ( destroyed ) - throw new IllegalStateException("Context is destroyed"); - thread = Thread.currentThread(); - current_context_local.set(this); - implementation.makeCurrent(peer_info, handle); - GLContext.useContext(this, forwardCompatible); - } - - ByteBuffer getHandle() { - return handle; - } - - /** Query whether the context is current */ - public synchronized boolean isCurrent() throws LWJGLException { - if ( destroyed ) - throw new IllegalStateException("Context is destroyed"); - return implementation.isCurrent(handle); - } - - private void checkDestroy() { - if ( !destroyed && destroy_requested ) { - try { - releaseDrawable(); - implementation.destroy(peer_info, handle); - CallbackUtil.unregisterCallbacks(this); - destroyed = true; - thread = null; - GLContext.unloadOpenGLLibrary(); - } catch (LWJGLException e) { - LWJGLUtil.log("Exception occurred while destroying context: " + e); - } - } - } +interface Context { - /** - * Set the buffer swap interval. This call is a best-attempt at changing - * the monitor swap interval, which is the minimum periodicity of color buffer swaps, - * measured in video frame periods, and is not guaranteed to be successful. - *

- * A video frame period is the time required to display a full frame of video data. - */ - public static void setSwapInterval(int value) { - implementation.setSwapInterval(value); - } + boolean isCurrent() throws LWJGLException; - /** - * Destroy the context. This method behaves the same as destroy() with the extra - * requirement that the context must be either current to the current thread or not - * current at all. - */ - public synchronized void forceDestroy() throws LWJGLException { - checkAccess(); - destroy(); - } + void makeCurrent() throws LWJGLException; - /** - * Request destruction of the Context. If the context is current, no context will be current after this call. - * The context is destroyed when no thread has it current. - */ - public synchronized void destroy() throws LWJGLException { - if ( destroyed ) - return; - destroy_requested = true; - boolean was_current = isCurrent(); - int error = GL_NO_ERROR; - if ( was_current ) { - if ( GLContext.getCapabilities() != null && GLContext.getCapabilities().OpenGL11 ) - error = glGetError(); - releaseCurrentContext(); - } - checkDestroy(); - if ( was_current && error != GL_NO_ERROR ) - throw new OpenGLException(error); - } + void releaseCurrent() throws LWJGLException; - public synchronized void setCLSharingProperties(final PointerBuffer properties) throws LWJGLException { - final ByteBuffer peer_handle = peer_info.lockAndGetHandle(); - try { - switch ( LWJGLUtil.getPlatform() ) { - case LWJGLUtil.PLATFORM_WINDOWS: - final WindowsContextImplementation implWindows = (WindowsContextImplementation)implementation; - properties.put(KHRGLSharing.CL_GL_CONTEXT_KHR).put(implWindows.getHGLRC(handle)); - properties.put(KHRGLSharing.CL_WGL_HDC_KHR).put(implWindows.getHDC(peer_handle)); - break; - case LWJGLUtil.PLATFORM_LINUX: - final LinuxContextImplementation implLinux = (LinuxContextImplementation)implementation; - properties.put(KHRGLSharing.CL_GL_CONTEXT_KHR).put(implLinux.getGLXContext(handle)); - properties.put(KHRGLSharing.CL_GLX_DISPLAY_KHR).put(implLinux.getDisplay(peer_handle)); - break; - default: - throw new UnsupportedOperationException("CL/GL context sharing is not supposed on this platform."); - } - } finally { - peer_info.unlock(); - } - } + void releaseDrawable() throws LWJGLException; } \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/DisplayImplementation.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/DisplayImplementation.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/DisplayImplementation.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/DisplayImplementation.java 2016-04-09 16:26:56.000000000 +0000 @@ -47,7 +47,7 @@ interface DisplayImplementation extends InputImplementation { - void createWindow(DisplayMode mode, Canvas parent, int x, int y) throws LWJGLException; + void createWindow(DrawableLWJGL drawable, DisplayMode mode, Canvas parent, int x, int y) throws LWJGLException; void destroyWindow(); @@ -108,7 +108,7 @@ * Create the native PeerInfo. * @throws LWJGLException */ - PeerInfo createPeerInfo(PixelFormat pixel_format) throws LWJGLException; + PeerInfo createPeerInfo(PixelFormat pixel_format, ContextAttribs attribs) throws LWJGLException; // void destroyPeerInfo(); @@ -136,7 +136,7 @@ /** * Method to create a Pbuffer */ - PeerInfo createPbuffer(int width, int height, PixelFormat pixel_format, + PeerInfo createPbuffer(int width, int height, PixelFormat pixel_format, ContextAttribs attribs, IntBuffer pixelFormatCaps, IntBuffer pBufferAttribs) throws LWJGLException; @@ -159,4 +159,42 @@ * @return number of icons used. */ int setIcon(ByteBuffer[] icons); + + /** + * Enable or disable the Display window to be resized. + * + * @param resizable set to true to make the Display window resizable; + * false to disable resizing on the Display window. + */ + void setResizable(boolean resizable); + + /** + * @return true if the Display window has been resized since this method was last called. + */ + boolean wasResized(); + + /** + * @return this method will return the width of the Display window. + */ + int getWidth(); + + /** + * @return this method will return the height of the Display window. + */ + int getHeight(); + + /** + * @return this method will return the top-left x position of the Display window. + */ + int getX(); + + /** + * @return this method will return the top-left y position of the Display window. + */ + int getY(); + + /** + * @return this method will return the pixel scale factor of the Display window useful for high resolution modes. + */ + float getPixelScaleFactor(); } diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/Display.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/Display.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/Display.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/Display.java 2016-04-09 16:26:56.000000000 +0000 @@ -62,8 +62,6 @@ import java.util.Arrays; import java.util.HashSet; -import static org.lwjgl.opengl.GL11.*; - public final class Display { private static final Thread shutdown_hook = new Thread() { @@ -84,9 +82,6 @@ /** The current display mode, if created */ private static DisplayMode current_mode; - /** Timer for sync() */ - private static long timeThen; - /** X coordinate of the window */ private static int x = -1; @@ -99,6 +94,12 @@ */ private static int y = -1; + /** the width of the Display window */ + private static int width = 0; + + /** the height of the Display window */ + private static int height = 0; + /** Title of the window (never null) */ private static String title = "Game"; @@ -109,12 +110,16 @@ private static int swap_interval; /** The Drawable instance that tracks the current Display context */ - private static final AbstractDrawable drawable; + private static DrawableLWJGL drawable; private static boolean window_created; private static boolean parent_resized; + private static boolean window_resized; + + private static boolean window_resizable; + /** Initial Background Color of Display */ private static float r, g, b; @@ -134,22 +139,6 @@ LWJGLUtil.log("Initial mode: " + initial_mode); } catch (LWJGLException e) { throw new RuntimeException(e); - } - drawable = new AbstractDrawable() { - public void destroy() { - synchronized ( GlobalLock.lock ) { - if ( !isCreated() ) - return; - - releaseDrawable(); - super.destroy(); - destroyWindow(); - x = y = -1; - cached_icons = null; - reset(); - removeShutdownHook(); - } - } }; } @@ -256,7 +245,7 @@ try { if ( was_fullscreen && !isFullscreen() ) display_impl.resetDisplayMode(); - else if ( isFullscreen() ) + else if ( isFullscreen() ) switchDisplayMode(); createWindow(); makeCurrentAndSetSwapInterval(); @@ -314,9 +303,12 @@ tmp_parent.addComponentListener(component_listener); } DisplayMode mode = getEffectiveMode(); - display_impl.createWindow(mode, tmp_parent, getWindowX(), getWindowY()); + display_impl.createWindow(drawable, mode, tmp_parent, getWindowX(), getWindowY()); window_created = true; + width = Display.getDisplayMode().getWidth(); + height = Display.getDisplayMode().getHeight(); + setTitle(title); initControls(); @@ -330,9 +322,9 @@ private static void releaseDrawable() { try { - Context context = drawable.context; + Context context = drawable.getContext(); if ( context != null && context.isCurrent() ) { - Context.releaseCurrentContext(); + context.releaseCurrent(); context.releaseDrawable(); } } catch (LWJGLException e) { @@ -409,40 +401,14 @@ } } - private static long timeLate; - /** - * Best sync method that works reliably. + * An accurate sync method that will attempt to run at a constant frame rate. + * It should be called once every frame. * - * @param fps The desired frame rate, in frames per second + * @param fps - the desired frame rate, in frames per second */ public static void sync(int fps) { - long timeNow; - long gapTo; - long savedTimeLate; - synchronized ( GlobalLock.lock ) { - gapTo = Sys.getTimerResolution() / fps + timeThen; - timeNow = Sys.getTime(); - savedTimeLate = timeLate; - } - - try { - while ( gapTo > timeNow + savedTimeLate ) { - Thread.sleep(1); - timeNow = Sys.getTime(); - } - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - } - - synchronized ( GlobalLock.lock ) { - if ( gapTo < timeNow ) - timeLate = timeNow - gapTo; - else - timeLate = 0; - - timeThen = timeNow; - } + Sync.sync(fps); } /** @return the title of the window */ @@ -648,8 +614,8 @@ throw new IllegalStateException("Display not created"); if ( LWJGLUtil.DEBUG ) - Util.checkGLError(); - Context.swapBuffers(); + drawable.checkGLError(); + drawable.swapBuffers(); } } @@ -683,9 +649,17 @@ } } + window_resized = !isFullscreen() && parent == null && display_impl.wasResized(); + + if ( window_resized ) { + width = display_impl.getWidth(); + height = display_impl.getHeight(); + } + if ( parent_resized ) { reshape(); parent_resized = false; + window_resized = true; } if ( processMessages ) @@ -762,9 +736,7 @@ * @throws LWJGLException */ public static void create() throws LWJGLException { - synchronized ( GlobalLock.lock ) { - create(new PixelFormat()); - } + create(new PixelFormat()); } /** @@ -782,7 +754,7 @@ */ public static void create(PixelFormat pixel_format) throws LWJGLException { synchronized ( GlobalLock.lock ) { - create(pixel_format, null, null); + create(pixel_format, null, (ContextAttribs)null); } } @@ -802,7 +774,7 @@ */ public static void create(PixelFormat pixel_format, Drawable shared_drawable) throws LWJGLException { synchronized ( GlobalLock.lock ) { - create(pixel_format, shared_drawable, null); + create(pixel_format, shared_drawable, (ContextAttribs)null); } } @@ -851,12 +823,168 @@ registerShutdownHook(); if ( isFullscreen() ) switchDisplayMode(); + + final DrawableGL drawable = new DrawableGL() { + public void destroy() { + synchronized ( GlobalLock.lock ) { + if ( !isCreated() ) + return; + + releaseDrawable(); + super.destroy(); + destroyWindow(); + x = y = -1; + cached_icons = null; + reset(); + removeShutdownHook(); + } + } + }; + Display.drawable = drawable; + try { - drawable.peer_info = display_impl.createPeerInfo(pixel_format); + drawable.setPixelFormat(pixel_format, attribs); try { createWindow(); try { - drawable.context = new Context(drawable.peer_info, attribs, shared_drawable != null ? ((AbstractDrawable)shared_drawable).getContext() : null); + drawable.context = new ContextGL(drawable.peer_info, attribs, shared_drawable != null ? ((DrawableGL)shared_drawable).getContext() : null); + try { + makeCurrentAndSetSwapInterval(); + initContext(); + } catch (LWJGLException e) { + drawable.destroy(); + throw e; + } + } catch (LWJGLException e) { + destroyWindow(); + throw e; + } + } catch (LWJGLException e) { + drawable.destroy(); + throw e; + } + } catch (LWJGLException e) { + display_impl.resetDisplayMode(); + throw e; + } + } + } + + /** + * Create the OpenGL ES context with the given minimum parameters. If isFullscreen() is true or if windowed + * context are not supported on the platform, the display mode will be switched to the mode returned by + * getDisplayMode(), and a fullscreen context will be created. If isFullscreen() is false, a windowed context + * will be created with the dimensions given in the mode returned by getDisplayMode(). If a context can't be + * created with the given parameters, a LWJGLException will be thrown. + *

+ *

The window created will be set up in orthographic 2D projection, with 1:1 pixel ratio with GL coordinates. + * + * @param pixel_format Describes the minimum specifications the context must fulfill. Must be an instance of org.lwjgl.opengles.PixelFormat. + * + * @throws LWJGLException + */ + + public static void create(PixelFormatLWJGL pixel_format) throws LWJGLException { + synchronized ( GlobalLock.lock ) { + create(pixel_format, null, null); + } + } + + /** + * Create the OpenGL ES context with the given minimum parameters. If isFullscreen() is true or if windowed + * context are not supported on the platform, the display mode will be switched to the mode returned by + * getDisplayMode(), and a fullscreen context will be created. If isFullscreen() is false, a windowed context + * will be created with the dimensions given in the mode returned by getDisplayMode(). If a context can't be + * created with the given parameters, a LWJGLException will be thrown. + *

+ *

The window created will be set up in orthographic 2D projection, with 1:1 pixel ratio with GL coordinates. + * + * @param pixel_format Describes the minimum specifications the context must fulfill. Must be an instance of org.lwjgl.opengles.PixelFormat. + * @param shared_drawable The Drawable to share context with. (optional, may be null) + * + * @throws LWJGLException + */ + public static void create(PixelFormatLWJGL pixel_format, Drawable shared_drawable) throws LWJGLException { + synchronized ( GlobalLock.lock ) { + create(pixel_format, shared_drawable, null); + } + } + + /** + * Create the OpenGL ES context with the given minimum parameters. If isFullscreen() is true or if windowed + * context are not supported on the platform, the display mode will be switched to the mode returned by + * getDisplayMode(), and a fullscreen context will be created. If isFullscreen() is false, a windowed context + * will be created with the dimensions given in the mode returned by getDisplayMode(). If a context can't be + * created with the given parameters, a LWJGLException will be thrown. + *

+ *

The window created will be set up in orthographic 2D projection, with 1:1 pixel ratio with GL coordinates. + * + * @param pixel_format Describes the minimum specifications the context must fulfill. Must be an instance of org.lwjgl.opengles.PixelFormat. + * @param attribs The ContextAttribs to use when creating the context. (optional, may be null) + * + * @throws LWJGLException + */ + public static void create(PixelFormatLWJGL pixel_format, org.lwjgl.opengles.ContextAttribs attribs) throws LWJGLException { + synchronized ( GlobalLock.lock ) { + create(pixel_format, null, attribs); + } + } + + /** + * Create the OpenGL ES context with the given minimum parameters. If isFullscreen() is true or if windowed + * context are not supported on the platform, the display mode will be switched to the mode returned by + * getDisplayMode(), and a fullscreen context will be created. If isFullscreen() is false, a windowed context + * will be created with the dimensions given in the mode returned by getDisplayMode(). If a context can't be + * created with the given parameters, a LWJGLException will be thrown. + *

+ *

The window created will be set up in orthographic 2D projection, with 1:1 pixel ratio with GL coordinates. + * + * @param pixel_format Describes the minimum specifications the context must fulfill. Must be an instance of org.lwjgl.opengles.PixelFormat. + * @param shared_drawable The Drawable to share context with. (optional, may be null) + * @param attribs The ContextAttribs to use when creating the context. (optional, may be null) + * + * @throws LWJGLException + */ + public static void create(PixelFormatLWJGL pixel_format, Drawable shared_drawable, org.lwjgl.opengles.ContextAttribs attribs) throws LWJGLException { + synchronized ( GlobalLock.lock ) { + if ( isCreated() ) + throw new IllegalStateException("Only one LWJGL context may be instantiated at any one time."); + if ( pixel_format == null ) + throw new NullPointerException("pixel_format cannot be null"); + removeShutdownHook(); + registerShutdownHook(); + if ( isFullscreen() ) + switchDisplayMode(); + + final DrawableGLES drawable = new DrawableGLES() { + + public void setPixelFormat(final PixelFormatLWJGL pf, final ContextAttribs attribs) throws LWJGLException { + throw new UnsupportedOperationException(); + } + + public void destroy() { + synchronized ( GlobalLock.lock ) { + if ( !isCreated() ) + return; + + releaseDrawable(); + super.destroy(); + destroyWindow(); + x = y = -1; + cached_icons = null; + reset(); + removeShutdownHook(); + } + } + }; + Display.drawable = drawable; + + try { + drawable.setPixelFormat(pixel_format); + try { + createWindow(); + try { + drawable.createContext(attribs, shared_drawable); try { makeCurrentAndSetSwapInterval(); initContext(); @@ -896,7 +1024,7 @@ private static void makeCurrentAndSetSwapInterval() throws LWJGLException { makeCurrent(); try { - Util.checkGLError(); + drawable.checkGLError(); } catch (OpenGLException e) { LWJGLUtil.log("OpenGL error during context creation: " + e.getMessage()); } @@ -904,10 +1032,7 @@ } private static void initContext() { - // set background clear color - glClearColor(r, g, b, 0.0f); - // Clear window to avoid the desktop "showing through" - glClear(GL_COLOR_BUFFER_BIT); + drawable.initContext(r, g, b); update(); } @@ -923,6 +1048,15 @@ } }); } + + /** Gets a string property as a privileged action. */ + static String getPrivilegedString(final String property_name) { + return AccessController.doPrivileged(new PrivilegedAction() { + public String run() { + return System.getProperty(property_name); + } + }); + } private static void initControls() { // Automatically create mouse, keyboard and controller @@ -957,7 +1091,9 @@ * regardless of whether the Display was the current rendering context. */ public static void destroy() { - drawable.destroy(); + if(isCreated()) { + drawable.destroy(); + } } /* @@ -990,7 +1126,8 @@ synchronized ( GlobalLock.lock ) { swap_interval = value; if ( isCreated() ) - Context.setSwapInterval(swap_interval); + drawable.setSwapInterval(swap_interval); + } } @@ -1065,7 +1202,7 @@ *

  • Linux (and similar platforms) expect one 32x32 icon.
  • *
  • Mac OS X should be supplied one 128x128 icon
  • * - * The implementation will use the supplied ByteBuffers with image data in RGBA and perform any conversions nescesarry for the specific platform. + * The implementation will use the supplied ByteBuffers with image data in RGBA (size must be a power of two) and perform any conversions nescesarry for the specific platform. *

    * NOTE: The display will make a deep copy of the supplied byte buffer array, for the purpose * of recreating the icons when you go back and forth fullscreen mode. You therefore only need to @@ -1097,4 +1234,142 @@ } } } + + /** + * Enable or disable the Display window to be resized. + * + * @param resizable set to true to make the Display window resizable; + * false to disable resizing on the Display window. + */ + public static void setResizable(boolean resizable) { + window_resizable = resizable; + if ( isCreated() ) { + display_impl.setResizable(resizable); + } + } + + /** + * @return true if the Display window is resizable. + */ + public static boolean isResizable() { + return window_resizable; + } + + /** + * @return true if the Display window has been resized. + * This value will be updated after a call to Display.update(). + * + * This will return false if running in fullscreen or with Display.setParent(Canvas parent) + */ + public static boolean wasResized() { + return window_resized; + } + + /** + * @return this method will return the x position (top-left) of the Display window. + * + * If running in fullscreen mode it will return 0. + * If Display.setParent(Canvas parent) is being used, the x position of + * the parent will be returned. + */ + public static int getX() { + + if (Display.isFullscreen()) { + return 0; + } + + if (parent != null) { + return parent.getX(); + } + + return display_impl.getX(); + } + + /** + * @return this method will return the y position (top-left) of the Display window. + * + * If running in fullscreen mode it will return 0. + * If Display.setParent(Canvas parent) is being used, the y position of + * the parent will be returned. + */ + public static int getY() { + + if (Display.isFullscreen()) { + return 0; + } + + if (parent != null) { + return parent.getY(); + } + + return display_impl.getY(); + } + + /** + * @return this method will return the width of the Display window. + * + * If running in fullscreen mode it will return the width of the current set DisplayMode. + * If Display.setParent(Canvas parent) is being used, the width of the parent + * will be returned. + * + * This value will be updated after a call to Display.update(). + */ + public static int getWidth() { + + if (Display.isFullscreen()) { + return Display.getDisplayMode().getWidth(); + } + + if (parent != null) { + return parent.getWidth(); + } + + return width; + } + + /** + * @return this method will return the height of the Display window. + * + * If running in fullscreen mode it will return the height of the current set DisplayMode. + * If Display.setParent(Canvas parent) is being used, the height of the parent + * will be returned. + * + * This value will be updated after a call to Display.update(). + */ + public static int getHeight() { + + if (Display.isFullscreen()) { + return Display.getDisplayMode().getHeight(); + } + + if (parent != null) { + return parent.getHeight(); + } + + return height; + } + + /** + * @return this method will return the pixel scale factor of the Display window. + * + * This method should be used when running in high DPI mode. In such modes Operating + * Systems will scale the Display window to avoid the window shrinking due to high + * resolutions. The OpenGL frame buffer will however use the higher resolution and + * not be scaled to match the Display window size. + * + * OpenGL methods that require pixel dependent values e.g. glViewport, glTexImage2D, + * glReadPixels, glScissor, glLineWidth, glRenderbufferStorage, etc can convert the + * scaled Display and Mouse coordinates to the correct high resolution value by + * multiplying them by the pixel scale factor. + * + * e.g. Display.getWidth() * Display.getPixelScaleFactor() will return the high DPI + * width of the OpenGL frame buffer. Whereas Display.getWidth() will be the same as + * the OpenGL frame buffer in non high DPI mode. + * + * Where high DPI mode is not available this method will just return 1.0f therefore + * not have any effect on values that are multiplied by it. + */ + public static float getPixelScaleFactor() { + return display_impl.getPixelScaleFactor(); + } } diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/DisplayMode.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/DisplayMode.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/DisplayMode.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/DisplayMode.java 2016-04-09 16:26:56.000000000 +0000 @@ -38,8 +38,8 @@ * getAvailableDisplayModes() method. * * @author cix_foo - * @version $Revision: 3418 $ - * $Id: DisplayMode.java 3418 2010-09-28 21:11:35Z spasi $ + * @version $Revision$ + * $Id$ */ public final class DisplayMode { @@ -75,7 +75,7 @@ this.fullscreen = fullscreen; } - /** True iff this instance can be used for fullscreen modes */ + /** True if this instance can be used for fullscreen modes */ public boolean isFullscreenCapable() { return fullscreen; } diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/DrawableGLES.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/DrawableGLES.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/DrawableGLES.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/DrawableGLES.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,243 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +import org.lwjgl.BufferUtils; +import org.lwjgl.LWJGLException; +import org.lwjgl.LWJGLUtil; +import org.lwjgl.PointerBuffer; +import org.lwjgl.opengles.ContextAttribs; +import org.lwjgl.opengles.*; +import org.lwjgl.opengles.Util; + +import static org.lwjgl.opengles.EGL.*; +import static org.lwjgl.opengles.GLES20.*; + +/** + * @author Spasi + * @since 14/5/2011 + */ +abstract class DrawableGLES implements DrawableLWJGL { + + /** The PixelFormat used to create the EGLDisplay. */ + protected org.lwjgl.opengles.PixelFormat pixel_format; + + protected EGLDisplay eglDisplay; + protected EGLConfig eglConfig; + protected EGLSurface eglSurface; + + /** The OpenGL Context. */ + protected ContextGLES context; + + /** The Drawable that shares objects with this Drawable. */ + protected Drawable shared_drawable; + + protected DrawableGLES() { + } + + public void setPixelFormat(final PixelFormatLWJGL pf) throws LWJGLException { + synchronized ( GlobalLock.lock ) { + this.pixel_format = (org.lwjgl.opengles.PixelFormat)pf; + } + } + + public PixelFormatLWJGL getPixelFormat() { + synchronized ( GlobalLock.lock ) { + return pixel_format; + } + } + + public void initialize(final long window, final long display_id, final int eglSurfaceType, final org.lwjgl.opengles.PixelFormat pf) throws LWJGLException { + synchronized ( GlobalLock.lock ) { + if ( eglSurface != null ) { + eglSurface.destroy(); + eglSurface = null; + } + + if ( eglDisplay != null ) { + eglDisplay.terminate(); + eglDisplay = null; + } + + final EGLDisplay eglDisplay = eglGetDisplay((int)display_id); + + int[] attribs = { + EGL_LEVEL, 0, + EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, + EGL_NATIVE_RENDERABLE, EGL_FALSE, + }; + + final EGLConfig[] configs = eglDisplay.chooseConfig(pf.getAttribBuffer(eglDisplay, eglSurfaceType, attribs), null, BufferUtils.createIntBuffer(1)); + if ( configs.length == 0 ) + throw new LWJGLException("No EGLConfigs found for the specified PixelFormat."); + + final EGLConfig eglConfig = pf.getBestMatch(configs); + final EGLSurface eglSurface = eglDisplay.createWindowSurface(eglConfig, window, null); + pf.setSurfaceAttribs(eglSurface); + + this.eglDisplay = eglDisplay; + this.eglConfig = eglConfig; + this.eglSurface = eglSurface; + + // This can happen when switching in and out of full-screen mode. + if ( context != null ) + context.getEGLContext().setDisplay(eglDisplay); + } + } + + public void createContext(final ContextAttribs attribs, final Drawable shared_drawable) throws LWJGLException { + synchronized ( GlobalLock.lock ) { + this.context = new ContextGLES(this, attribs, shared_drawable != null ? ((DrawableGLES)shared_drawable).getContext() : null); + this.shared_drawable = shared_drawable; + } + } + + Drawable getSharedDrawable() { + synchronized ( GlobalLock.lock ) { + return shared_drawable; + } + } + + public EGLDisplay getEGLDisplay() { + synchronized ( GlobalLock.lock ) { + return eglDisplay; + } + } + + public EGLConfig getEGLConfig() { + synchronized ( GlobalLock.lock ) { + return eglConfig; + } + } + + public EGLSurface getEGLSurface() { + synchronized ( GlobalLock.lock ) { + return eglSurface; + } + } + + public ContextGLES getContext() { + synchronized ( GlobalLock.lock ) { + return context; + } + } + + public org.lwjgl.opengl.Context createSharedContext() throws LWJGLException { + synchronized ( GlobalLock.lock ) { + checkDestroyed(); + return new ContextGLES(this, context.getContextAttribs(), context); + } + } + + public void checkGLError() { + Util.checkGLError(); + } + + public void setSwapInterval(final int swap_interval) { + ContextGLES.setSwapInterval(swap_interval); + } + + public void swapBuffers() throws LWJGLException { + ContextGLES.swapBuffers(); + } + + public void initContext(final float r, final float g, final float b) { + // set background clear color + glClearColor(r, g, b, 0.0f); + // Clear window to avoid the desktop "showing through" + glClear(GL_COLOR_BUFFER_BIT); + } + + public boolean isCurrent() throws LWJGLException { + synchronized ( GlobalLock.lock ) { + checkDestroyed(); + return context.isCurrent(); + } + } + + public void makeCurrent() throws LWJGLException, PowerManagementEventException { + synchronized ( GlobalLock.lock ) { + checkDestroyed(); + context.makeCurrent(); + } + } + + public void releaseContext() throws LWJGLException, PowerManagementEventException { + synchronized ( GlobalLock.lock ) { + checkDestroyed(); + if ( context.isCurrent() ) + context.releaseCurrent(); + } + } + + public void destroy() { + synchronized ( GlobalLock.lock ) { + try { + if ( context != null ) { + try { + releaseContext(); + } catch (PowerManagementEventException e) { + // Ignore + } + + context.forceDestroy(); + context = null; + } + + if ( eglSurface != null ) { + eglSurface.destroy(); + eglSurface = null; + } + + if ( eglDisplay != null ) { + eglDisplay.terminate(); + eglDisplay = null; + } + + pixel_format = null; + shared_drawable = null; + } catch (LWJGLException e) { + LWJGLUtil.log("Exception occurred while destroying Drawable: " + e); + } + } + } + + protected void checkDestroyed() { + if ( context == null ) + throw new IllegalStateException("The Drawable has no context available."); + } + + public void setCLSharingProperties(final PointerBuffer properties) throws LWJGLException { + throw new UnsupportedOperationException(); + } + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/DrawableGL.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/DrawableGL.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/DrawableGL.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/DrawableGL.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,155 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +import org.lwjgl.LWJGLException; +import org.lwjgl.LWJGLUtil; +import org.lwjgl.PointerBuffer; + +import static org.lwjgl.opengl.GL11.*; + +/** @author Spasi */ +abstract class DrawableGL implements DrawableLWJGL { + + /** The PixelFormat used to create the drawable. */ + protected PixelFormat pixel_format; + + /** Handle to the native GL rendering context */ + protected PeerInfo peer_info; + + /** The OpenGL Context. */ + protected ContextGL context; + + protected DrawableGL() { + } + + public void setPixelFormat(final PixelFormatLWJGL pf) throws LWJGLException { + throw new UnsupportedOperationException(); + } + + public void setPixelFormat(final PixelFormatLWJGL pf, final ContextAttribs attribs) throws LWJGLException { + this.pixel_format = (PixelFormat)pf; + this.peer_info = Display.getImplementation().createPeerInfo(pixel_format, attribs); + } + + public PixelFormatLWJGL getPixelFormat() { + return pixel_format; + } + + public ContextGL getContext() { + synchronized ( GlobalLock.lock ) { + return context; + } + } + + public ContextGL createSharedContext() throws LWJGLException { + synchronized ( GlobalLock.lock ) { + checkDestroyed(); + return new ContextGL(peer_info, context.getContextAttribs(), context); + } + } + + public void checkGLError() { + Util.checkGLError(); + } + + public void setSwapInterval(final int swap_interval) { + ContextGL.setSwapInterval(swap_interval); + } + + public void swapBuffers() throws LWJGLException { + ContextGL.swapBuffers(); + } + + public void initContext(final float r, final float g, final float b) { + // set background clear color + glClearColor(r, g, b, 0.0f); + // Clear window to avoid the desktop "showing through" + glClear(GL_COLOR_BUFFER_BIT); + } + + public boolean isCurrent() throws LWJGLException { + synchronized ( GlobalLock.lock ) { + checkDestroyed(); + return context.isCurrent(); + } + } + + public void makeCurrent() throws LWJGLException { + synchronized ( GlobalLock.lock ) { + checkDestroyed(); + context.makeCurrent(); + } + } + + public void releaseContext() throws LWJGLException { + synchronized ( GlobalLock.lock ) { + checkDestroyed(); + if ( context.isCurrent() ) + context.releaseCurrent(); + } + } + + public void destroy() { + synchronized ( GlobalLock.lock ) { + if ( context == null ) + return; + + try { + releaseContext(); + + context.forceDestroy(); + context = null; + + if ( peer_info != null ) { + peer_info.destroy(); + peer_info = null; + } + } catch (LWJGLException e) { + LWJGLUtil.log("Exception occurred while destroying Drawable: " + e); + } + } + } + + public void setCLSharingProperties(final PointerBuffer properties) throws LWJGLException { + synchronized ( GlobalLock.lock ) { + checkDestroyed(); + context.setCLSharingProperties(properties); + } + } + + protected final void checkDestroyed() { + if ( context == null ) + throw new IllegalStateException("The Drawable has no context available."); + } + +} diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/DrawableLWJGL.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/DrawableLWJGL.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/DrawableLWJGL.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/DrawableLWJGL.java 2016-04-09 16:26:56.000000000 +0000 @@ -1,12 +1,51 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ package org.lwjgl.opengl; import org.lwjgl.LWJGLException; /** + * [INTERNAL USE ONLY] + * * @author Spasi */ interface DrawableLWJGL extends Drawable { + void setPixelFormat(PixelFormatLWJGL pf) throws LWJGLException; + + void setPixelFormat(PixelFormatLWJGL pf, ContextAttribs attribs) throws LWJGLException; + + PixelFormatLWJGL getPixelFormat(); + /** * [INTERNAL USE ONLY] Returns the Drawable's Context. * @@ -21,4 +60,12 @@ */ Context createSharedContext() throws LWJGLException; -} + void checkGLError(); + + void setSwapInterval(int swap_interval); + + void swapBuffers() throws LWJGLException; + + void initContext(final float r, final float g, final float b); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/GLChecks.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/GLChecks.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/GLChecks.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/GLChecks.java 2016-04-09 16:26:56.000000000 +0000 @@ -31,11 +31,12 @@ */ package org.lwjgl.opengl; -import java.nio.Buffer; - import org.lwjgl.BufferUtils; import org.lwjgl.LWJGLUtil; +import java.nio.Buffer; +import java.nio.FloatBuffer; + import static org.lwjgl.opengl.ARBBufferObject.*; import static org.lwjgl.opengl.ATIVertexArrayObject.*; import static org.lwjgl.opengl.EXTAbgr.*; @@ -43,6 +44,7 @@ import static org.lwjgl.opengl.EXTDirectStateAccess.*; import static org.lwjgl.opengl.GL11.*; import static org.lwjgl.opengl.GL15.*; +import static org.lwjgl.opengl.NVPathRendering.*; /** * A class to check buffer boundaries in GL methods. Many GL @@ -54,8 +56,8 @@ * Thrown by the debug build library of the LWJGL if any OpenGL operation causes an error. * * @author cix_foo - * @version $Revision: 3459 $ - * $Id: GLChecks.java 3459 2010-11-29 17:21:05Z spasi $ + * @version $Revision$ + * $Id$ */ class GLChecks { @@ -63,43 +65,27 @@ private GLChecks() { } - static int getBufferObjectSize(ContextCapabilities caps, int buffer_enum) { - return glGetBufferParameter(buffer_enum, GL_BUFFER_SIZE); - } - - static int getBufferObjectSizeARB(ContextCapabilities caps, int buffer_enum) { - return glGetBufferParameterARB(buffer_enum, GL_BUFFER_SIZE_ARB); - } - - static int getBufferObjectSizeATI(ContextCapabilities caps, int buffer) { - return glGetObjectBufferATI(buffer, GL_OBJECT_BUFFER_SIZE_ATI); - } - - static int getNamedBufferObjectSize(ContextCapabilities caps, int buffer) { - return glGetNamedBufferParameterEXT(buffer, GL_BUFFER_SIZE); - } - /** Helper method to ensure that array buffer objects are disabled. If they are enabled, we'll throw an OpenGLException */ static void ensureArrayVBOdisabled(ContextCapabilities caps) { - if( LWJGLUtil.CHECKS && StateTracker.getReferences(caps).arrayBuffer != 0 ) + if ( LWJGLUtil.CHECKS && StateTracker.getReferences(caps).arrayBuffer != 0 ) throw new OpenGLException("Cannot use Buffers when Array Buffer Object is enabled"); } /** Helper method to ensure that array buffer objects are enabled. If they are disabled, we'll throw an OpenGLException */ static void ensureArrayVBOenabled(ContextCapabilities caps) { - if( LWJGLUtil.CHECKS && StateTracker.getReferences(caps).arrayBuffer == 0 ) + if ( LWJGLUtil.CHECKS && StateTracker.getReferences(caps).arrayBuffer == 0 ) throw new OpenGLException("Cannot use offsets when Array Buffer Object is disabled"); } /** Helper method to ensure that element array buffer objects are disabled. If they are enabled, we'll throw an OpenGLException */ static void ensureElementVBOdisabled(ContextCapabilities caps) { - if( LWJGLUtil.CHECKS && StateTracker.getElementArrayBufferBound(caps) != 0 ) + if ( LWJGLUtil.CHECKS && StateTracker.getElementArrayBufferBound(caps) != 0 ) throw new OpenGLException("Cannot use Buffers when Element Array Buffer Object is enabled"); } /** Helper method to ensure that element array buffer objects are enabled. If they are disabled, we'll throw an OpenGLException */ static void ensureElementVBOenabled(ContextCapabilities caps) { - if( LWJGLUtil.CHECKS && StateTracker.getElementArrayBufferBound(caps) == 0 ) + if ( LWJGLUtil.CHECKS && StateTracker.getElementArrayBufferBound(caps) == 0 ) throw new OpenGLException("Cannot use offsets when Element Array Buffer Object is disabled"); } @@ -209,10 +195,10 @@ case GL_FLOAT: bpe = 4; break; - default : + default: // TODO: Add more types (like the GL12 types GL_UNSIGNED_INT_8_8_8_8 return 0; - // throw new IllegalArgumentException("Unknown type " + type); + // throw new IllegalArgumentException("Unknown type " + type); } int epp; switch ( format ) { @@ -233,7 +219,7 @@ case GL_BGRA_EXT: epp = 4; break; - default : + default: // TODO: Add more formats. Assuming 4 is too wasteful on buffer sizes where e.g. 1 is enough (like GL_DEPTH_COMPONENT) return 0; /* // Assume 4 elements per pixel @@ -242,4 +228,116 @@ return bpe * epp; } -} + + // NV_path_rendering checks + + static int calculateBytesPerCharCode(int type) { + switch ( type ) { + case GL_UNSIGNED_BYTE: + case GL_UTF8_NV: + return 1; + case GL_UNSIGNED_SHORT: + case GL_2_BYTES: + case GL_UTF16_NV: + return 2; + case GL_3_BYTES: + return 3; + case GL_4_BYTES: + return 4; + default: + throw new IllegalArgumentException("Unsupported charcode type: " + type); + } + } + + static int calculateBytesPerPathName(int pathNameType) { + switch ( pathNameType ) { + case GL_BYTE: + case GL_UNSIGNED_BYTE: + case GL_UTF8_NV: + return 1; + case GL_SHORT: + case GL_UNSIGNED_SHORT: + case GL_2_BYTES: + case GL_UTF16_NV: + return 2; + case GL_3_BYTES: + return 3; + case GL_INT: + case GL_UNSIGNED_INT: + case GL_FLOAT: + case GL_4_BYTES: + return 4; + default: + throw new IllegalArgumentException("Unsupported path name type: " + pathNameType); + } + } + + static int calculateTransformPathValues(int transformType) { + switch ( transformType ) { + case GL_NONE: + return 0; + case GL_TRANSLATE_X_NV: + case GL_TRANSLATE_Y_NV: + return 1; + case GL_TRANSLATE_2D_NV: + return 2; + case GL_TRANSLATE_3D_NV: + return 3; + case GL_AFFINE_2D_NV: + case GL_TRANSPOSE_AFFINE_2D_NV: + return 6; + case GL_AFFINE_3D_NV: + case GL_TRANSPOSE_AFFINE_3D_NV: + return 12; + default: + throw new IllegalArgumentException("Unsupported transform type: " + transformType); + } + } + + static int calculatePathColorGenCoeffsCount(int genMode, int colorFormat) { + final int coeffsPerComponent = calculatePathGenCoeffsPerComponent(genMode); + + switch ( colorFormat ) { + case GL_RGB: + return 3 * coeffsPerComponent; + case GL_RGBA: + return 4 * coeffsPerComponent; + default: + return coeffsPerComponent; + } + } + + static int calculatePathTextGenCoeffsPerComponent(FloatBuffer coeffs, int genMode) { + if ( genMode == GL_NONE ) + return 0; + + return coeffs.remaining() / calculatePathGenCoeffsPerComponent(genMode); + } + + private static int calculatePathGenCoeffsPerComponent(int genMode) { + switch ( genMode ) { + case GL_NONE: + return 0; + case GL_OBJECT_LINEAR: + case GL_PATH_OBJECT_BOUNDING_BOX_NV: + return 3; + case GL_EYE_LINEAR: + return 4; + default: + throw new IllegalArgumentException("Unsupported gen mode: " + genMode); + } + } + + static int calculateMetricsSize(int metricQueryMask, int stride) { + if ( LWJGLUtil.DEBUG && (stride < 0 || (stride % 4) != 0) ) + throw new IllegalArgumentException("Invalid stride value: " + stride); + + final int metrics = Integer.bitCount(metricQueryMask); + + if ( LWJGLUtil.DEBUG && (stride >> 2) < metrics ) + throw new IllegalArgumentException("The queried metrics do not fit in the specified stride: " + stride); + + return stride == 0 ? metrics : (stride >> 2); + } + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/GLContext.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/GLContext.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/GLContext.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/GLContext.java 2016-04-09 16:26:56.000000000 +0000 @@ -33,9 +33,11 @@ import org.lwjgl.LWJGLException; import org.lwjgl.LWJGLUtil; +import org.lwjgl.MemoryUtil; import org.lwjgl.Sys; import java.lang.reflect.Method; +import java.nio.ByteBuffer; import java.security.AccessController; import java.security.PrivilegedAction; import java.security.PrivilegedExceptionAction; @@ -56,8 +58,8 @@ * That way, multiple threads can have multiple contexts current and render to them concurrently. * * @author elias_naur - * @version $Revision: 3418 $ - * $Id: GLContext.java 3418 2010-09-28 21:11:35Z spasi $ + * @version $Revision$ + * $Id$ */ public final class GLContext { @@ -117,6 +119,14 @@ * @return The current capabilities instance. */ public static ContextCapabilities getCapabilities() { + ContextCapabilities caps = getCapabilitiesImpl(); + if ( caps == null ) + throw new RuntimeException("No OpenGL context found in the current thread."); + + return caps; + } + + private static ContextCapabilities getCapabilitiesImpl() { CapabilitiesCacheEntry recent_cache_entry = fast_path_cache; // Check owner of cache entry if ( recent_cache_entry.owner == Thread.currentThread() ) { @@ -128,6 +138,17 @@ return getThreadLocalCapabilities(); } + /** + * Returns the capabilities instance associated with the specified context object. + * + * @param context the context object + * + * @return the capabilities instance + */ + static ContextCapabilities getCapabilities(Object context) { + return capability_cache.get(context); + } + private static ContextCapabilities getThreadLocalCapabilities() { return current_capabilities.get(); } @@ -187,8 +208,12 @@ return 0; } - /** Helper method to get a pointer to a named function in the OpenGL library */ - static native long getFunctionAddress(String name); + /** Helper method to get a pointer to a named function in the OpenGL library. */ + static long getFunctionAddress(String name) { + ByteBuffer buffer = MemoryUtil.encodeASCII(name); + return ngetFunctionAddress(MemoryUtil.getAddress(buffer)); + } + private static native long ngetFunctionAddress(long name); /** * Determine which extensions are available and returns the context profile mask. Helper method to ContextCapabilities. @@ -218,10 +243,10 @@ } final int[][] GL_VERSIONS = { - { 1, 2, 3, 4, 5 }, // OpenGL 1 - { 0, 1 }, // OpenGL 2 - { 0, 1, 2, 3 }, // OpenGL 3 - { 0, 1 }, // 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 }; for ( int major = 1; major <= GL_VERSIONS.length; major++ ) { diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/GLUConstants.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/GLUConstants.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/GLUConstants.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/GLUConstants.java 2016-04-09 16:26:56.000000000 +0000 @@ -38,8 +38,8 @@ * GLU constants. * * @author cix_foo - * @version $Revision: 3418 $ - * $Id: GLUConstants.java 3418 2010-09-28 21:11:35Z spasi $ + * @version $Revision$ + * $Id$ */ public interface GLUConstants { diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/InputImplementation.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/InputImplementation.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/InputImplementation.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/InputImplementation.java 2016-04-09 16:26:56.000000000 +0000 @@ -69,7 +69,7 @@ void pollMouse(IntBuffer coord_buffer, ByteBuffer buttons); /** - * Method to read the keyboard buffer + * Method to read the mouse buffer */ void readMouse(ByteBuffer buffer); diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/KHRDebugCallback.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/KHRDebugCallback.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/KHRDebugCallback.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/KHRDebugCallback.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,209 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +import org.lwjgl.PointerWrapperAbstract; + +/** + * Instances of this class are needed to use the callback functionality of the KHR_debug extension. + * Users of this class may provide implementations of the {@code Handler} interface to receive notifications. + * The same {@code Handler} instance may be used by different contexts but it is not recommended. + * Handler notifications are synchronized. + * + * @author Spasi + */ +public final class KHRDebugCallback extends PointerWrapperAbstract { + + /** Severity levels. */ + private static final int + GL_DEBUG_SEVERITY_HIGH = 0x9146, + GL_DEBUG_SEVERITY_MEDIUM = 0x9147, + GL_DEBUG_SEVERITY_LOW = 0x9148, + GL_DEBUG_SEVERITY_NOTIFICATION = 0x826B; + + /** Sources. */ + private static final int + GL_DEBUG_SOURCE_API = 0x8246, + GL_DEBUG_SOURCE_WINDOW_SYSTEM = 0x8247, + GL_DEBUG_SOURCE_SHADER_COMPILER = 0x8248, + GL_DEBUG_SOURCE_THIRD_PARTY = 0x8249, + GL_DEBUG_SOURCE_APPLICATION = 0x824A, + GL_DEBUG_SOURCE_OTHER = 0x824B; + + /** Types. */ + private static final int + GL_DEBUG_TYPE_ERROR = 0x824C, + GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR = 0x824D, + GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR = 0x824E, + GL_DEBUG_TYPE_PORTABILITY = 0x824F, + GL_DEBUG_TYPE_PERFORMANCE = 0x8250, + GL_DEBUG_TYPE_OTHER = 0x8251, + GL_DEBUG_TYPE_MARKER = 0x8268; + + private static final long CALLBACK_POINTER; + + static { + long pointer = 0; + try { + // Call reflectively so that we can compile this class for the Generator. + pointer = (Long)Class.forName("org.lwjgl.opengl.CallbackUtil").getDeclaredMethod("getDebugCallbackKHR").invoke(null); + } catch (Exception e) { + // ignore + } + CALLBACK_POINTER = pointer; + } + + private final Handler handler; + + /** + * Creates an KHRebugCallback with a default callback handler. + * The default handler will simply print the message on System.err. + */ + public KHRDebugCallback() { + this(new Handler() { + public void handleMessage(final int source, final int type, final int id, final int severity, final String message) { + System.err.println("[LWJGL] KHR_debug message"); + System.err.println("\tID: " + id); + + String description; + switch ( source ) { + case GL_DEBUG_SOURCE_API: + description = "API"; + break; + case GL_DEBUG_SOURCE_WINDOW_SYSTEM: + description = "WINDOW SYSTEM"; + break; + case GL_DEBUG_SOURCE_SHADER_COMPILER: + description = "SHADER COMPILER"; + break; + case GL_DEBUG_SOURCE_THIRD_PARTY: + description = "THIRD PARTY"; + break; + case GL_DEBUG_SOURCE_APPLICATION: + description = "APPLICATION"; + break; + case GL_DEBUG_SOURCE_OTHER: + description = "OTHER"; + break; + default: + description = printUnknownToken(source); + } + System.err.println("\tSource: " + description); + + switch ( type ) { + case GL_DEBUG_TYPE_ERROR: + description = "ERROR"; + break; + case GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR: + description = "DEPRECATED BEHAVIOR"; + break; + case GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR: + description = "UNDEFINED BEHAVIOR"; + break; + case GL_DEBUG_TYPE_PORTABILITY: + description = "PORTABILITY"; + break; + case GL_DEBUG_TYPE_PERFORMANCE: + description = "PERFORMANCE"; + break; + case GL_DEBUG_TYPE_OTHER: + description = "OTHER"; + break; + case GL_DEBUG_TYPE_MARKER: + description = "MARKER"; + break; + default: + description = printUnknownToken(type); + } + System.err.println("\tType: " + description); + + switch ( severity ) { + case GL_DEBUG_SEVERITY_HIGH: + description = "HIGH"; + break; + case GL_DEBUG_SEVERITY_MEDIUM: + description = "MEDIUM"; + break; + case GL_DEBUG_SEVERITY_LOW: + description = "LOW"; + break; + case GL_DEBUG_SEVERITY_NOTIFICATION: + description = "NOTIFICATION"; + break; + default: + description = printUnknownToken(severity); + } + System.err.println("\tSeverity: " + description); + + System.err.println("\tMessage: " + message); + } + + private String printUnknownToken(final int token) { + return "Unknown (0x" + Integer.toHexString(token).toUpperCase() + ")"; + } + }); + } + + /** + * Creates an ARBDebugOutputCallback with the specified callback handler. + * The handler's {@code handleMessage} method will be called whenever + * debug output is generated by the GL. + * + * @param handler the callback handler + */ + public KHRDebugCallback(final Handler handler) { + super(CALLBACK_POINTER); + + this.handler = handler; + } + + Handler getHandler() { + return handler; + } + + /** Implementations of this interface can be used to receive ARB_debug_output notifications. */ + public interface Handler { + + /** + * This method will be called when an ARB_debug_output message is generated. + * + * @param source the message source + * @param type the message type + * @param id the message ID + * @param severity the message severity + * @param message the string representation of the message. + */ + void handleMessage(int source, int type, int id, int severity, String message); + + } + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/LinuxAWTGLCanvasPeerInfo.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/LinuxAWTGLCanvasPeerInfo.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/LinuxAWTGLCanvasPeerInfo.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/LinuxAWTGLCanvasPeerInfo.java 2016-04-09 16:26:56.000000000 +0000 @@ -40,8 +40,8 @@ /** * * @author elias_naur - * @version $Revision: 3116 $ - * $Id: LinuxAWTGLCanvasPeerInfo.java 3116 2008-08-19 16:46:03Z spasi $ + * @version $Revision$ + * $Id$ */ final class LinuxAWTGLCanvasPeerInfo extends LinuxPeerInfo { private final Canvas component; diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/LinuxCanvasImplementation.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/LinuxCanvasImplementation.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/LinuxCanvasImplementation.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/LinuxCanvasImplementation.java 2016-04-09 16:26:56.000000000 +0000 @@ -44,8 +44,8 @@ /** * * @author elias_naur - * @version $Revision: 3418 $ - * $Id: LinuxCanvasImplementation.java 3418 2010-09-28 21:11:35Z spasi $ + * @version $Revision$ + * $Id$ */ final class LinuxCanvasImplementation implements AWTCanvasImplementation { static int getScreenFromDevice(final GraphicsDevice device) throws LWJGLException { @@ -76,7 +76,7 @@ } } - public PeerInfo createPeerInfo(Canvas component, PixelFormat pixel_format) throws LWJGLException { + public PeerInfo createPeerInfo(Canvas component, PixelFormat pixel_format, ContextAttribs attribs) throws LWJGLException { return new LinuxAWTGLCanvasPeerInfo(component); } diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/LinuxContextAttribs.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/LinuxContextAttribs.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/LinuxContextAttribs.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/LinuxContextAttribs.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,94 +0,0 @@ -/* - * Copyright (c) 2002-2008 LWJGL Project - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of 'LWJGL' nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package org.lwjgl.opengl; - -/** - * An implementation of ContextAttribs using GLX_create_context. - *

    - * ---- WIP - GLX_create_context has not been defined yet ---- - * - * @author spasi - */ -final class LinuxContextAttribs implements ContextAttribsImplementation { - - private static final int GLX_CONTEXT_MAJOR_VERSION_ARB = 0x2091; - private static final int GLX_CONTEXT_MINOR_VERSION_ARB = 0x2092; - private static final int GLX_CONTEXT_LAYER_PLANE_ARB = 0x2093; - private static final int GLX_CONTEXT_FLAGS_ARB = 0x2094; - private static final int GLX_CONTEXT_PROFILE_MASK_ARB = 0x9126; - - private static final int GLX_CONTEXT_DEBUG_BIT_ARB = 0x0001; - private static final int GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB = 0x0002; - - private static final int GLX_CONTEXT_CORE_PROFILE_BIT_ARB = 0x00000001; - private static final int GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB = 0x00000002; - - LinuxContextAttribs() { - } - - public int getMajorVersionAttrib() { - return GLX_CONTEXT_MAJOR_VERSION_ARB; - } - - public int getMinorVersionAttrib() { - return GLX_CONTEXT_MINOR_VERSION_ARB; - } - - public int getLayerPlaneAttrib() { - return GLX_CONTEXT_LAYER_PLANE_ARB; - } - - public int getFlagsAttrib() { - return GLX_CONTEXT_FLAGS_ARB; - } - - public int getDebugBit() { - return GLX_CONTEXT_DEBUG_BIT_ARB; - } - - public int getForwardCompatibleBit() { - return GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB; - } - - public int getProfileMaskAttrib() { - return GLX_CONTEXT_PROFILE_MASK_ARB; - } - - public int getProfileCoreBit() { - return GLX_CONTEXT_CORE_PROFILE_BIT_ARB; - } - - public int getProfileCompatibilityBit() { - return GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB; - } - -} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/LinuxContextImplementation.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/LinuxContextImplementation.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/LinuxContextImplementation.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/LinuxContextImplementation.java 2016-04-09 16:26:56.000000000 +0000 @@ -38,8 +38,8 @@ /** * @author elias_naur - * @version $Revision: 3412 $ - * $Id: LinuxContextImplementation.java 3412 2010-09-26 23:43:24Z spasi $ + * @version $Revision$ + * $Id$ */ final class LinuxContextImplementation implements ContextImplementation { @@ -67,7 +67,7 @@ } public void swapBuffers() throws LWJGLException { - Context current_context = Context.getCurrentContext(); + ContextGL current_context = ContextGL.getCurrentContext(); if ( current_context == null ) throw new IllegalStateException("No context is current"); synchronized ( current_context ) { @@ -89,7 +89,7 @@ private static native void nSwapBuffers(ByteBuffer peer_info_handle) throws LWJGLException; public void releaseCurrentContext() throws LWJGLException { - Context current_context = Context.getCurrentContext(); + ContextGL current_context = ContextGL.getCurrentContext(); if ( current_context == null ) throw new IllegalStateException("No context is current"); synchronized ( current_context ) { @@ -142,17 +142,30 @@ private static native boolean nIsCurrent(ByteBuffer context_handle) throws LWJGLException; public void setSwapInterval(int value) { - Context current_context = Context.getCurrentContext(); + ContextGL current_context = ContextGL.getCurrentContext(); + PeerInfo peer_info = current_context.getPeerInfo(); + if ( current_context == null ) throw new IllegalStateException("No context is current"); synchronized ( current_context ) { LinuxDisplay.lockAWT(); - nSetSwapInterval(current_context.getHandle(), value); - LinuxDisplay.unlockAWT(); + try { + ByteBuffer peer_handle = peer_info.lockAndGetHandle(); + try { + nSetSwapInterval(peer_handle, current_context.getHandle(), value); + } finally { + peer_info.unlock(); + } + } catch (LWJGLException e) { + // API CHANGE - this methods should throw LWJGLException + e.printStackTrace(); + } finally { + LinuxDisplay.unlockAWT(); + } } } - private static native void nSetSwapInterval(ByteBuffer context_handle, int value); + private static native void nSetSwapInterval(ByteBuffer peer_handle, ByteBuffer context_handle, int value); public void destroy(PeerInfo peer_info, ByteBuffer handle) throws LWJGLException { LinuxDisplay.lockAWT(); diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/LinuxDisplay.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/LinuxDisplay.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/LinuxDisplay.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/LinuxDisplay.java 2016-04-09 16:26:56.000000000 +0000 @@ -39,17 +39,24 @@ */ import java.awt.Canvas; +import java.awt.event.FocusListener; +import java.awt.event.FocusEvent; + import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; +import java.nio.ByteOrder; import java.nio.ByteBuffer; import java.nio.FloatBuffer; import java.nio.IntBuffer; +import java.lang.reflect.InvocationTargetException; import org.lwjgl.BufferUtils; import org.lwjgl.LWJGLException; import org.lwjgl.LWJGLUtil; +import org.lwjgl.MemoryUtil; import org.lwjgl.opengl.XRandR.Screen; +import org.lwjgl.opengles.EGL; import java.security.AccessController; import java.security.PrivilegedAction; @@ -79,6 +86,8 @@ private static final int SetModeInsert = 0; private static final int SaveSetRoot = 1; private static final int SaveSetUnmap = 1; + + private static final int X_SetInputFocus = 42; /** Window mode enum */ private static final int FULLSCREEN_LEGACY = 1; @@ -120,7 +129,6 @@ private DisplayMode saved_mode; private DisplayMode current_mode; - private Screen[] savedXrandrConfig; private boolean keyboard_grabbed; private boolean pointer_grabbed; @@ -132,14 +140,42 @@ private boolean close_requested; private long current_cursor; private long blank_cursor; - private Canvas parent; - private long parent_window; - private boolean xembedded; - private boolean parent_focus; private boolean mouseInside = true; + private boolean resizable; + private boolean resized; + private int window_x; + private int window_y; + private int window_width; + private int window_height; + + private Canvas parent; + private long parent_window; + private static boolean xembedded; + private long parent_proxy_focus_window; + private boolean parent_focused; + private boolean parent_focus_changed; + private long last_window_focus = 0; + private LinuxKeyboard keyboard; private LinuxMouse mouse; + + private String wm_class; + + private final FocusListener focus_listener = new FocusListener() { + public void focusGained(FocusEvent e) { + synchronized (GlobalLock.lock) { + parent_focused = true; + parent_focus_changed = true; + } + } + public void focusLost(FocusEvent e) { + synchronized (GlobalLock.lock) { + parent_focused = false; + parent_focus_changed = true; + } + } + }; private static ByteBuffer getCurrentGammaRamp() throws LWJGLException { lockAWT(); @@ -259,7 +295,12 @@ */ static void incDisplay() throws LWJGLException { if (display_connection_usage_count == 0) { - GLContext.loadOpenGLLibrary(); + try { + // TODO: Can we know if we're on desktop or ES? + GLContext.loadOpenGLLibrary(); + org.lwjgl.opengles.GLContext.loadOpenGLLibrary(); + } catch (Throwable t) { + } saved_error_handler = setErrorHandler(); display = openDisplay(); // synchronize(display, true); @@ -272,6 +313,8 @@ private static native void synchronize(long display, boolean synchronize); private static int globalErrorHandler(long display, long event_ptr, long error_display, long serial, long error_code, long request_code, long minor_code) throws LWJGLException { + if (xembedded && request_code == X_SetInputFocus) return 0; // ignore X error in xembeded mode to fix a browser issue when dragging or switching tabs + if (display == getDisplay()) { String error_msg = getErrorText(display, error_code); throw new LWJGLException("X Error - disp: 0x" + Long.toHexString(error_display) + " serial: " + serial + " error: " + error_msg + " request_code: " + request_code + " minor_code: " + minor_code); @@ -408,26 +451,54 @@ ungrabKeyboard(); } - public void createWindow(DisplayMode mode, Canvas parent, int x, int y) throws LWJGLException { + public void createWindow(final DrawableLWJGL drawable, DisplayMode mode, Canvas parent, int x, int y) throws LWJGLException { lockAWT(); try { incDisplay(); try { + if ( drawable instanceof DrawableGLES ) + peer_info = new LinuxDisplayPeerInfo(); + ByteBuffer handle = peer_info.lockAndGetHandle(); try { current_window_mode = getWindowMode(Display.isFullscreen()); + // Try to enable Lecagy FullScreen Support in Compiz, else // we may have trouble with stuff overlapping our fullscreen window. if ( current_window_mode != WINDOWED ) Compiz.setLegacyFullscreenSupport(true); + // Setting _MOTIF_WM_HINTS in fullscreen mode is problematic for certain window // managers. We do not set MWM_HINTS_DECORATIONS in fullscreen mode anymore, // unless org.lwjgl.opengl.Window.undecorated_fs has been specified. // See native/linux/org_lwjgl_opengl_Display.c, createWindow function. boolean undecorated = Display.getPrivilegedBoolean("org.lwjgl.opengl.Window.undecorated") || (current_window_mode != WINDOWED && Display.getPrivilegedBoolean("org.lwjgl.opengl.Window.undecorated_fs")); + this.parent = parent; parent_window = parent != null ? getHandle(parent) : getRootWindow(getDisplay(), getDefaultScreen()); - current_window = nCreateWindow(getDisplay(), getDefaultScreen(), handle, mode, current_window_mode, x, y, undecorated, parent_window); + resizable = Display.isResizable(); + resized = false; + window_x = x; + window_y = y; + window_width = mode.getWidth(); + window_height = mode.getHeight(); + + // overwrite arguments x and y - superclass always uses 0,0 for fullscreen windows + // use the coordinates of XRandRs primary screen instead + // this is required to let the fullscreen window appear on the primary screen + if (mode.isFullscreenCapable() && current_displaymode_extension == XRANDR) { + Screen primaryScreen = XRandR.DisplayModetoScreen(Display.getDisplayMode()); + x = primaryScreen.xPos; + y = primaryScreen.yPos; + } + + current_window = nCreateWindow(getDisplay(), getDefaultScreen(), handle, mode, current_window_mode, x, y, undecorated, parent_window, resizable); + + // Set the WM_CLASS hint which is needed by some WM's e.g. Gnome Shell + wm_class = Display.getPrivilegedString("LWJGL_WM_CLASS"); + if (wm_class == null) wm_class = Display.getTitle(); + setClassHint(Display.getTitle(), wm_class); + mapRaised(getDisplay(), current_window); xembedded = parent != null && isAncestorXEmbedded(parent_window); blank_cursor = createBlankCursor(); @@ -440,6 +511,15 @@ grab = false; minimized = false; dirty = true; + + if ( drawable instanceof DrawableGLES ) + ((DrawableGLES)drawable).initialize(current_window, getDisplay(), EGL.EGL_WINDOW_BIT, (org.lwjgl.opengles.PixelFormat)drawable.getPixelFormat()); + + if (parent != null) { + parent.addFocusListener(focus_listener); + parent_focused = parent.isFocusOwner(); + parent_focus_changed = true; + } } finally { peer_info.unlock(); } @@ -451,12 +531,20 @@ unlockAWT(); } } - private static native long nCreateWindow(long display, int screen, ByteBuffer peer_info_handle, DisplayMode mode, int window_mode, int x, int y, boolean undecorated, long parent_handle) throws LWJGLException; + private static native long nCreateWindow(long display, int screen, ByteBuffer peer_info_handle, DisplayMode mode, int window_mode, int x, int y, boolean undecorated, long parent_handle, boolean resizable) throws LWJGLException; private static native long getRootWindow(long display, int screen); private static native boolean hasProperty(long display, long window, long property); private static native long getParentWindow(long display, long window) throws LWJGLException; + private static native int getChildCount(long display, long window) throws LWJGLException; private static native void mapRaised(long display, long window); private static native void reparentWindow(long display, long window, long parent, int x, int y); + private static native long nGetInputFocus(long display) throws LWJGLException; + private static native void nSetInputFocus(long display, long window, long time); + private static native void nSetWindowSize(long display, long window, int width, int height, boolean resizable); + private static native int nGetX(long display, long window); + private static native int nGetY(long display, long window); + private static native int nGetWidth(long display, long window); + private static native int nGetHeight(long display, long window); private static boolean isAncestorXEmbedded(long window) throws LWJGLException { long xembed_atom = internAtom("_XEMBED_INFO", true); @@ -473,7 +561,7 @@ private static long getHandle(Canvas parent) throws LWJGLException { AWTCanvasImplementation awt_impl = AWTGLCanvas.createImplementation(); - LinuxPeerInfo parent_peer_info = (LinuxPeerInfo)awt_impl.createPeerInfo(parent, null); + LinuxPeerInfo parent_peer_info = (LinuxPeerInfo)awt_impl.createPeerInfo(parent, null, null); ByteBuffer parent_peer_info_handle = parent_peer_info.lockAndGetHandle(); try { return parent_peer_info.getDrawable(); @@ -490,6 +578,9 @@ public void destroyWindow() { lockAWT(); try { + if (parent != null) { + parent.removeFocusListener(focus_listener); + } try { setNativeCursor(null); } catch (LWJGLException e) { @@ -520,12 +611,17 @@ } private void switchDisplayModeOnTmpDisplay(DisplayMode mode) throws LWJGLException { - incDisplay(); - try { - nSwitchDisplayMode(getDisplay(), getDefaultScreen(), current_displaymode_extension, mode); - } finally { - decDisplay(); - } + if (current_displaymode_extension == XRANDR) { + // let Xrandr set the display mode + XRandR.setConfiguration(false, XRandR.DisplayModetoScreen(mode)); + } else { + incDisplay(); + try { + nSwitchDisplayMode(getDisplay(), getDefaultScreen(), current_displaymode_extension, mode); + } finally { + decDisplay(); + } + } } private static native void nSwitchDisplayMode(long display, int screen, int extension, DisplayMode mode) throws LWJGLException; @@ -542,11 +638,11 @@ public void resetDisplayMode() { lockAWT(); try { - if( current_displaymode_extension == XRANDR && savedXrandrConfig.length > 0 ) + if( current_displaymode_extension == XRANDR ) { AccessController.doPrivileged(new PrivilegedAction() { public Object run() { - XRandR.setConfiguration( savedXrandrConfig ); + XRandR.restoreConfiguration(); return null; } }); @@ -644,12 +740,12 @@ throw new LWJGLException("No modes available"); switch (current_displaymode_extension) { case XRANDR: - savedXrandrConfig = AccessController.doPrivileged(new PrivilegedAction() { - public Screen[] run() { - return XRandR.getConfiguration(); + saved_mode = AccessController.doPrivileged(new PrivilegedAction() { + public DisplayMode run() { + XRandR.saveConfiguration(); + return XRandR.ScreentoDisplayMode(XRandR.getConfiguration()); } }); - saved_mode = getCurrentXRandrMode(); break; case XF86VIDMODE: saved_mode = modes[0]; @@ -686,12 +782,27 @@ public void setTitle(String title) { lockAWT(); try { - nSetTitle(getDisplay(), getWindow(), title); + final ByteBuffer titleText = MemoryUtil.encodeUTF8(title); + nSetTitle(getDisplay(), getWindow(), MemoryUtil.getAddress(titleText), titleText.remaining() - 1); + } finally { + unlockAWT(); + } + } + private static native void nSetTitle(long display, long window, long title, int len); + + /** the WM_CLASS hint is needed by some WM's e.g. gnome shell */ + private void setClassHint(String wm_name, String wm_class) { + lockAWT(); + try { + final ByteBuffer nameText = MemoryUtil.encodeUTF8(wm_name); + final ByteBuffer classText = MemoryUtil.encodeUTF8(wm_class); + + nSetClassHint(getDisplay(), getWindow(), MemoryUtil.getAddress(nameText), MemoryUtil.getAddress(classText)); } finally { unlockAWT(); } } - private static native void nSetTitle(long display, long window, String title); + private static native void nSetClassHint(long display, long window, long wm_name, long wm_class); public boolean isCloseRequested() { boolean result = close_requested; @@ -713,13 +824,11 @@ return result; } - public PeerInfo createPeerInfo(PixelFormat pixel_format) throws LWJGLException { + public PeerInfo createPeerInfo(PixelFormat pixel_format, ContextAttribs attribs) throws LWJGLException { peer_info = new LinuxDisplayPeerInfo(pixel_format); return peer_info; } - static native void setInputFocus(long display, long window, long time); - private void relayEventToParent(LinuxEvent event_buffer, int event_mask) { tmp_event_buffer.copyFrom(event_buffer); tmp_event_buffer.setWindow(parent_window); @@ -737,10 +846,10 @@ relayEventToParent(event_buffer, KeyPressMask); break; case LinuxEvent.ButtonPress: - relayEventToParent(event_buffer, KeyPressMask); + if (xembedded || !focused) relayEventToParent(event_buffer, KeyPressMask); break; case LinuxEvent.ButtonRelease: - relayEventToParent(event_buffer, KeyPressMask); + if (xembedded || !focused) relayEventToParent(event_buffer, KeyPressMask); break; default: break; @@ -778,6 +887,23 @@ case LinuxEvent.Expose: dirty = true; break; + case LinuxEvent.ConfigureNotify: + int x = nGetX(getDisplay(), getWindow()); + int y = nGetY(getDisplay(), getWindow()); + + int width = nGetWidth(getDisplay(), getWindow()); + int height = nGetHeight(getDisplay(), getWindow()); + + window_x = x; + window_y = y; + + if (window_width != width || window_height != height) { + resized = true; + window_width = width; + window_height = height; + } + + break; case LinuxEvent.EnterNotify: mouseInside = true; break; @@ -813,13 +939,29 @@ public DisplayMode[] getAvailableDisplayModes() throws LWJGLException { lockAWT(); try { - incDisplay(); - try { - DisplayMode[] modes = nGetAvailableDisplayModes(getDisplay(), getDefaultScreen(), current_displaymode_extension); - return modes; - } finally { - decDisplay(); - } + incDisplay(); + if (current_displaymode_extension == XRANDR) { + // nGetAvailableDisplayModes cannot be trusted. Use it only for bitsPerPixel + DisplayMode[] nDisplayModes = nGetAvailableDisplayModes(getDisplay(), getDefaultScreen(), current_displaymode_extension); + int bpp = 24; + if (nDisplayModes.length > 0) { + bpp = nDisplayModes[0].getBitsPerPixel(); + } + // get the resolutions and frequencys from XRandR + Screen[] resolutions = XRandR.getResolutions(XRandR.getScreenNames()[0]); + DisplayMode[] modes = new DisplayMode[resolutions.length]; + for (int i = 0; i < modes.length; i++) { + modes[i] = new DisplayMode(resolutions[i].width, resolutions[i].height, bpp, resolutions[i].freq); + } + return modes; + } else { + try { + DisplayMode[] modes = nGetAvailableDisplayModes(getDisplay(), getDefaultScreen(), current_displaymode_extension); + return modes; + } finally { + decDisplay(); + } + } } finally { unlockAWT(); } @@ -879,61 +1021,119 @@ private void checkInput() { if (parent == null) return; - if (parent_focus != parent.hasFocus()) { - parent_focus = parent.hasFocus(); + if (xembedded) { + long current_focus_window = 0; - if (parent_focus) { - setInputFocusUnsafe(current_window); + if (last_window_focus != current_focus_window || parent_focused != focused) { + if (isParentWindowActive(current_focus_window)) { + if (parent_focused) { + nSetInputFocus(getDisplay(), current_window, CurrentTime); + last_window_focus = current_window; + focused = true; + } + else { + // return focus to the parent proxy focus window + nSetInputFocus(getDisplay(), parent_proxy_focus_window, CurrentTime); + last_window_focus = parent_proxy_focus_window; + focused = false; + } + } + else { + last_window_focus = current_focus_window; + focused = false; + } + } + } + else { + if (parent_focus_changed && parent_focused) { + setInputFocusUnsafe(getWindow()); + parent_focus_changed = false; } - else if (xembedded) { - setInputFocusUnsafe(1); + } + } + + private void setInputFocusUnsafe(long window) { + try { + nSetInputFocus(getDisplay(), window, CurrentTime); + nSync(getDisplay(), false); + } catch (LWJGLException e) { + // Since we don't have any event timings for XSetInputFocus, a race condition might give a BadMatch, which we'll catch and ignore + LWJGLUtil.log("Got exception while trying to focus: " + e); + } + } + + private static native void nSync(long display, boolean throw_away_events) throws LWJGLException; + + /** + * This method will check if the parent window is active when running + * in xembed mode. Every xembed embedder window has a focus proxy + * window that recieves all the input. This method will test whether + * the provided window handle is the focus proxy, if so it will get its + * parent window and then test whether this is an ancestor to our + * current_window. If so then parent window is active. + * + * @param window - the window handle to test + */ + private boolean isParentWindowActive(long window) { + try { + // parent window already active as window is current_window + if (window == current_window) return true; + + // xembed focus proxy will have no children + if (getChildCount(getDisplay(), window) != 0) return false; + + // get parent, will be xembed embedder window and ancestor of current_window + long parent_window = getParentWindow(getDisplay(), window); + + // parent must not be None + if (parent_window == None) return false; + + // scroll current_window's ancestors to find parent_window + long w = current_window; + + while (w != None) { + w = getParentWindow(getDisplay(), w); + if (w == parent_window) { + parent_proxy_focus_window = window; // save focus proxy window + return true; + } } + } catch (LWJGLException e) { + LWJGLUtil.log("Failed to detect if parent window is active: " + e.getMessage()); + return true; // on failure assume still active } - //else if (parent_focus && !focused && !xembedded) { - // setInputFocusUnsafe(current_window); - //} + + return false; // failed to find an active parent window } private void setFocused(boolean got_focus, int focus_detail) { - if (focused == got_focus || focus_detail == NotifyDetailNone || focus_detail == NotifyPointer || focus_detail == NotifyPointerRoot) + if (focused == got_focus || focus_detail == NotifyDetailNone || focus_detail == NotifyPointer || focus_detail == NotifyPointerRoot || xembedded) return; focused = got_focus; if (focused) { acquireInput(); - if (parent != null && !xembedded) parent.setFocusable(false); } else { releaseInput(); - if (parent != null && !xembedded) parent.setFocusable(true); - } - } - static native long nGetInputFocus(long display); - - private static void setInputFocusUnsafe(long window) { - try { - setInputFocus(getDisplay(), window, CurrentTime); - sync(getDisplay(), false); - } catch (LWJGLException e) { - // Since we don't have any event timings for XSetInputFocus, a race condition might give a BadMatch, which we'll catch and ignore - LWJGLUtil.log("Got exception while trying to focus: " + e); } } - private static native void sync(long display, boolean throw_away_events) throws LWJGLException; private void releaseInput() { if (isLegacyFullscreen() || input_released) return; + if ( keyboard != null ) + keyboard.releaseAll(); input_released = true; updateInputGrab(); if (current_window_mode == FULLSCREEN_NETWM) { nIconifyWindow(getDisplay(), getWindow(), getDefaultScreen()); try { - if( current_displaymode_extension == XRANDR && savedXrandrConfig.length > 0 ) + if( current_displaymode_extension == XRANDR ) { AccessController.doPrivileged(new PrivilegedAction() { public Object run() { - XRandR.setConfiguration( savedXrandrConfig ); + XRandR.restoreConfiguration(); return null; } }); @@ -1143,7 +1343,7 @@ return false; } - public PeerInfo createPbuffer(int width, int height, PixelFormat pixel_format, + public PeerInfo createPbuffer(int width, int height, PixelFormat pixel_format, ContextAttribs attribs, IntBuffer pixelFormatCaps, IntBuffer pBufferAttribs) throws LWJGLException { return new LinuxPbufferPeerInfo(width, height, pixel_format); @@ -1160,50 +1360,58 @@ public void releaseTexImageFromPbuffer(PeerInfo handle, int buffer) { throw new UnsupportedOperationException(); } - - private static ByteBuffer convertIcon(ByteBuffer icon, int width, int height) { - ByteBuffer icon_rgb = BufferUtils.createByteBuffer(icon.capacity()); - int x; - int y; - byte r,g,b; - - int depth = 4; - - for (y = 0; y < height; y++) { - for (x = 0; x < width; x++) { - r = icon.get((x*4)+(y*width*4)); - g = icon.get((x*4)+(y*width*4)+1); - b = icon.get((x*4)+(y*width*4)+2); - - icon_rgb.put((x*depth)+(y*width*depth), b); // blue - icon_rgb.put((x*depth)+(y*width*depth)+1, g); // green - icon_rgb.put((x*depth)+(y*width*depth)+2, r); - } - } - return icon_rgb; - } - - private static ByteBuffer convertIconMask(ByteBuffer icon, int width, int height) { - ByteBuffer icon_mask = BufferUtils.createByteBuffer((icon.capacity()/4)/8); - int x; - int y; - byte a; - - int depth = 4; - - for (y = 0; y < height; y++) { - for (x = 0; x < width; x++) { - a = icon.get((x*4)+(y*width*4)+3); - - int mask_index = x + y*width; - int mask_byte_index = mask_index/8; - int mask_bit_index = mask_index%8; - byte bit = (((int)a) & 0xff) >= 127 ? (byte)1 : (byte)0; - byte new_byte = (byte)((icon_mask.get(mask_byte_index) | (bit< 0 ) { + bufferSize += 2 * 4; // add 32 bit width & height, 4 bytes each + bufferSize += dimension * dimension * 4; + } + } + + if (bufferSize == 0) return null; + + ByteBuffer icon_argb = BufferUtils.createByteBuffer(bufferSize);//icon.capacity()+(2*4)); + icon_argb.order(ByteOrder.BIG_ENDIAN); + + for ( ByteBuffer icon : icons ) { + int size = icon.limit() / 4; + int dimension = (int)Math.sqrt(size); + + icon_argb.putInt(dimension); // width + icon_argb.putInt(dimension); // height + + for (int y = 0; y < dimension; y++) { + for (int x = 0; x < dimension; x++) { + + byte r = icon.get((x*4)+(y*dimension*4)); + byte g = icon.get((x*4)+(y*dimension*4)+1); + byte b = icon.get((x*4)+(y*dimension*4)+2); + byte a = icon.get((x*4)+(y*dimension*4)+3); + + icon_argb.put(a); + icon_argb.put(r); + icon_argb.put(g); + icon_argb.put(b); + } } } - return icon_mask; + + return icon_argb; } /** @@ -1223,17 +1431,11 @@ try { incDisplay(); try { - for ( ByteBuffer icon : icons ) { - int size = icon.limit() / 4; - int dimension = (int)Math.sqrt(size); - if ( dimension > 0 ) { - ByteBuffer icon_rgb = convertIcon(icon, dimension, dimension); - ByteBuffer icon_mask = convertIconMask(icon, dimension, dimension); - nSetWindowIcon(getDisplay(), getWindow(), icon_rgb, icon_rgb.capacity(), icon_mask, icon_mask.capacity(), dimension, dimension); - return 1; - } - } - return 0; + // get icons as cardinal ARGB format + ByteBuffer icons_data = convertIcons(icons); + if (icons_data == null) return 0; + nSetWindowIcon(getDisplay(), getWindow(), icons_data, icons_data.capacity());//, icon_mask, icon_mask.capacity(), dimension, dimension); + return icons.length; } finally { decDisplay(); } @@ -1245,20 +1447,50 @@ } } - private static native void nSetWindowIcon(long display, long window, ByteBuffer icon_rgb, int icon_rgb_size, ByteBuffer icon_mask, int icon_mask_size, int width, int height); + private static native void nSetWindowIcon(long display, long window, ByteBuffer icons_data, int icons_size); + public int getX() { + return window_x; + } + + public int getY() { + return window_y; + } + public int getWidth() { - return Display.getDisplayMode().getWidth(); + return window_width; } public int getHeight() { - return Display.getDisplayMode().getHeight(); + return window_height; } public boolean isInsideWindow() { return mouseInside; } + public void setResizable(boolean resizable) { + if (this.resizable == resizable) { + return; + } + + this.resizable = resizable; + nSetWindowSize(getDisplay(), getWindow(), window_width, window_height, resizable); + } + + public boolean wasResized() { + if (resized) { + resized = false; + return true; + } + + return false; + } + + public float getPixelScaleFactor() { + return 1f; + } + /** * Helper class for managing Compiz's workarounds. We need this to enable Legacy * Fullscreen Support in Compiz, else we'll have trouble with fullscreen windows @@ -1446,4 +1678,4 @@ } } -} \ No newline at end of file +} diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/LinuxDisplayPeerInfo.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/LinuxDisplayPeerInfo.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/LinuxDisplayPeerInfo.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/LinuxDisplayPeerInfo.java 2016-04-09 16:26:56.000000000 +0000 @@ -38,11 +38,20 @@ /** * * @author elias_naur - * @version $Revision: 3116 $ - * $Id: LinuxDisplayPeerInfo.java 3116 2008-08-19 16:46:03Z spasi $ + * @version $Revision$ + * $Id$ */ final class LinuxDisplayPeerInfo extends LinuxPeerInfo { + + final boolean egl; + + LinuxDisplayPeerInfo() throws LWJGLException { + egl = true; + org.lwjgl.opengles.GLContext.loadOpenGLLibrary(); + } + LinuxDisplayPeerInfo(PixelFormat pixel_format) throws LWJGLException { + egl = false; LinuxDisplay.lockAWT(); try { GLContext.loadOpenGLLibrary(); @@ -80,9 +89,14 @@ public void destroy() { super.destroy(); - LinuxDisplay.lockAWT(); - LinuxDisplay.decDisplay(); - GLContext.unloadOpenGLLibrary(); - LinuxDisplay.unlockAWT(); + + if ( egl ) + org.lwjgl.opengles.GLContext.unloadOpenGLLibrary(); + else { + LinuxDisplay.lockAWT(); + LinuxDisplay.decDisplay(); + GLContext.unloadOpenGLLibrary(); + LinuxDisplay.unlockAWT(); + } } } diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/LinuxEvent.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/LinuxEvent.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/LinuxEvent.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/LinuxEvent.java 2016-04-09 16:26:56.000000000 +0000 @@ -53,6 +53,7 @@ public static final int UnmapNotify = 18; public static final int MapNotify = 19; public static final int Expose = 12; + public static final int ConfigureNotify = 22; public static final int ClientMessage = 33; private final ByteBuffer event_buffer; diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/LinuxKeyboard.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/LinuxKeyboard.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/LinuxKeyboard.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/LinuxKeyboard.java 2016-04-09 16:26:56.000000000 +0000 @@ -296,7 +296,7 @@ return keycode; } - private byte getKeyState(int event_type) { + private static byte getKeyState(int event_type) { switch (event_type) { case LinuxEvent.KeyPress: return 1; @@ -307,10 +307,22 @@ } } + /** This is called when the window loses focus: we release all currently pressed keys. */ + void releaseAll() { + for ( int i = 0; i < key_down_buffer.length; i++ ) { + if ( key_down_buffer[i] != 0 ) { + key_down_buffer[i] = 0; + putKeyboardEvent(i, (byte)0, 0, 0L, false); + } + } + } + private void handleKeyEvent(long event_ptr, long millis, int event_type, int event_keycode, int event_state) { int keycode = getKeycode(event_ptr, event_state); byte key_state = getKeyState(event_type); boolean repeat = key_state == key_down_buffer[keycode]; + if ( repeat && event_type == LinuxEvent.KeyRelease ) // This can happen for modifier keys after losing and regaining focus. + return; key_down_buffer[keycode] = key_state; long nanos = millis*1000000; if (event_type == LinuxEvent.KeyPress) { diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/LinuxMouse.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/LinuxMouse.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/LinuxMouse.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/LinuxMouse.java 2016-04-09 16:26:56.000000000 +0000 @@ -43,17 +43,23 @@ import org.lwjgl.input.Mouse; final class LinuxMouse { - private static final int NUM_BUTTONS = 3; private static final int POINTER_WARP_BORDER = 10; // scale the mouse wheel according to DirectInput private static final int WHEEL_SCALE = 120; + private int button_count; + /* X11 constants */ private static final int Button1 = 1; private static final int Button2 = 2; private static final int Button3 = 3; private static final int Button4 = 4; private static final int Button5 = 5; + + private static final int Button6 = 6; // wheel tilt left *rare* + private static final int Button7 = 7; // wheel tilt right *rare* + private static final int Button8 = 8; // back button + private static final int Button9 = 9; // forward button private static final int ButtonPress = 4; private static final int ButtonRelease = 5; @@ -70,7 +76,7 @@ private int accum_dx; private int accum_dy; private int accum_dz; - private byte[] buttons = new byte[NUM_BUTTONS]; + private byte[] buttons; private EventQueue event_queue; private long last_event_nanos; @@ -79,6 +85,8 @@ this.window = window; this.input_window = input_window; this.warp_atom = LinuxDisplay.nInternAtom(display, "_LWJGL", false); + button_count = nGetButtonCount(display); + buttons = new byte[button_count]; reset(false, false); } @@ -189,6 +197,8 @@ } private static native int nGetWindowHeight(long display, long window); private static native int nGetWindowWidth(long display, long window); + + private static native int nGetButtonCount(long display); private static native long nQueryPointer(long display, long window, IntBuffer result); @@ -213,7 +223,23 @@ case Button3: button_num = (byte)1; break; + case Button6: + button_num = (byte)5; + break; + case Button7: + button_num = (byte)6; + break; + case Button8: + button_num = (byte)3; // back button + break; + case Button9: + button_num = (byte)4; // forward button + break; default: + if (button > Button9 && button <= button_count) { + button_num = (byte)(button-1); + break; + } return; } buttons[button_num] = state; diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/LinuxPbufferPeerInfo.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/LinuxPbufferPeerInfo.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/LinuxPbufferPeerInfo.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/LinuxPbufferPeerInfo.java 2016-04-09 16:26:56.000000000 +0000 @@ -38,8 +38,8 @@ /** * * @author elias_naur - * @version $Revision: 3116 $ - * $Id: LinuxPbufferPeerInfo.java 3116 2008-08-19 16:46:03Z spasi $ + * @version $Revision$ + * $Id$ */ final class LinuxPbufferPeerInfo extends LinuxPeerInfo { LinuxPbufferPeerInfo(int width, int height, PixelFormat pixel_format) throws LWJGLException { diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/LinuxPeerInfo.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/LinuxPeerInfo.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/LinuxPeerInfo.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/LinuxPeerInfo.java 2016-04-09 16:26:56.000000000 +0000 @@ -36,8 +36,8 @@ /** * * @author elias_naur - * @version $Revision: 3116 $ - * $Id: LinuxPeerInfo.java 3116 2008-08-19 16:46:03Z spasi $ + * @version $Revision$ + * $Id$ */ abstract class LinuxPeerInfo extends PeerInfo { LinuxPeerInfo() { diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/MacOSXAWTGLCanvasPeerInfo.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/MacOSXAWTGLCanvasPeerInfo.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/MacOSXAWTGLCanvasPeerInfo.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/MacOSXAWTGLCanvasPeerInfo.java 2016-04-09 16:26:56.000000000 +0000 @@ -38,14 +38,14 @@ /** * * @author elias_naur - * @version $Revision: 3116 $ - * $Id: MacOSXAWTGLCanvasPeerInfo.java 3116 2008-08-19 16:46:03Z spasi $ + * @version $Revision$ + * $Id$ */ final class MacOSXAWTGLCanvasPeerInfo extends MacOSXCanvasPeerInfo { private final Canvas component; - MacOSXAWTGLCanvasPeerInfo(Canvas component, PixelFormat pixel_format, boolean support_pbuffer) throws LWJGLException { - super(pixel_format, support_pbuffer); + MacOSXAWTGLCanvasPeerInfo(Canvas component, PixelFormat pixel_format, ContextAttribs attribs, boolean support_pbuffer) throws LWJGLException { + super(pixel_format, attribs, support_pbuffer); this.component = component; } diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/MacOSXCanvasImplementation.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/MacOSXCanvasImplementation.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/MacOSXCanvasImplementation.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/MacOSXCanvasImplementation.java 2016-04-09 16:26:56.000000000 +0000 @@ -40,15 +40,15 @@ /** * * @author elias_naur - * @version $Revision: 3002 $ - * $Id: MacOSXCanvasImplementation.java 3002 2008-04-10 20:25:54Z elias_naur $ + * @version $Revision$ + * $Id$ */ final class MacOSXCanvasImplementation implements AWTCanvasImplementation { - public PeerInfo createPeerInfo(Canvas component, PixelFormat pixel_format) throws LWJGLException { + public PeerInfo createPeerInfo(Canvas component, PixelFormat pixel_format, ContextAttribs attribs) throws LWJGLException { try { - return new MacOSXAWTGLCanvasPeerInfo(component, pixel_format, true); + return new MacOSXAWTGLCanvasPeerInfo(component, pixel_format, attribs, true); } catch (LWJGLException e) { - return new MacOSXAWTGLCanvasPeerInfo(component, pixel_format, false); + return new MacOSXAWTGLCanvasPeerInfo(component, pixel_format, attribs, false); } } diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/MacOSXCanvasListener.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/MacOSXCanvasListener.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/MacOSXCanvasListener.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/MacOSXCanvasListener.java 2016-04-09 16:26:56.000000000 +0000 @@ -47,6 +47,7 @@ private int width; private int height; private boolean context_update; + private boolean resized; MacOSXCanvasListener(Canvas canvas) { this.canvas = canvas; @@ -102,6 +103,7 @@ public void componentResized(ComponentEvent e) { setUpdate(); + resized = true; } public void componentMoved(ComponentEvent e) { @@ -111,4 +113,13 @@ public void hierarchyChanged(HierarchyEvent e) { setUpdate(); } + + public boolean wasResized() { + if (resized) { + resized = false; + return true; + } + + return false; + } } diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/MacOSXCanvasPeerInfo.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/MacOSXCanvasPeerInfo.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/MacOSXCanvasPeerInfo.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/MacOSXCanvasPeerInfo.java 2016-04-09 16:26:56.000000000 +0000 @@ -32,29 +32,151 @@ package org.lwjgl.opengl; import java.awt.Canvas; +import java.awt.event.ComponentEvent; +import java.awt.event.ComponentListener; +import java.awt.Insets; +import java.awt.Container; +import java.awt.Component; +import java.awt.Point; +import java.awt.Window; import java.nio.ByteBuffer; +import javax.swing.SwingUtilities; + import org.lwjgl.LWJGLException; +import org.lwjgl.LWJGLUtil; /** * * @author elias_naur - * @version $Revision: 3116 $ - * $Id: MacOSXCanvasPeerInfo.java 3116 2008-08-19 16:46:03Z spasi $ + * @author kappaOne + * @version $Revision$ + * $Id$ */ abstract class MacOSXCanvasPeerInfo extends MacOSXPeerInfo { private final AWTSurfaceLock awt_surface = new AWTSurfaceLock(); - - protected MacOSXCanvasPeerInfo(PixelFormat pixel_format, boolean support_pbuffer) throws LWJGLException { - super(pixel_format, true, true, support_pbuffer, true); + public ByteBuffer window_handle; + + protected MacOSXCanvasPeerInfo(PixelFormat pixel_format, ContextAttribs attribs, boolean support_pbuffer) throws LWJGLException { + super(pixel_format, attribs, true, true, support_pbuffer, true); } protected void initHandle(Canvas component) throws LWJGLException { - nInitHandle(awt_surface.lockAndGetHandle(component), getHandle()); + boolean forceCALayer = true; + boolean autoResizable = true; // set the CALayer to autoResize + + String javaVersion = System.getProperty("java.version"); + + if (javaVersion.startsWith("1.5") || javaVersion.startsWith("1.6")) { + // On Java 7 and newer CALayer mode is the only way to use OpenGL with AWT + // therefore force it on all JVM's except for the older Java 5 and Java 6 + // where the older cocoaViewRef NSView method maybe be available. + forceCALayer = false; + } + else if (javaVersion.startsWith("1.7")) { + autoResizable = false; + } + + Insets insets = getInsets(component); + + int top = insets != null ? insets.top : 0; + int left = insets != null ? insets.left : 0; + + window_handle = nInitHandle(awt_surface.lockAndGetHandle(component), getHandle(), window_handle, forceCALayer, autoResizable, component.getX()-left, component.getY()-top); + + if (javaVersion.startsWith("1.7")) { + // fix for CALayer position not covering Canvas due to a Java 7 bug + // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7172187 + addComponentListener(component); + + reSetLayerBounds(component, getHandle()); + } } - private static native void nInitHandle(ByteBuffer surface_buffer, ByteBuffer peer_info_handle) throws LWJGLException; + + private void addComponentListener(final Canvas component) { + + ComponentListener[] components = component.getComponentListeners(); + + // avoid adding duplicate listners by checking if one has already been added + for (int i = 0; i < components.length; i++) { + ComponentListener c = components[i]; + if (c.toString() == "CanvasPeerInfoListener") { + return; // already contains the listner below return without adding + } + } + + ComponentListener comp = new ComponentListener() { + public void componentHidden(ComponentEvent e) { + + } + + public void componentMoved(ComponentEvent e) { + + //nSetLayerPosition(getHandle(), component.getX() - left, component.getY() - top); + reSetLayerBounds(component, getHandle()); + } + + public void componentResized(ComponentEvent e) { + + //nSetLayerPosition(getHandle(), component.getX() - left, component.getY() - top); + reSetLayerBounds(component, getHandle()); + } + + public void componentShown(ComponentEvent e) { + + } + + public String toString() { + return "CanvasPeerInfoListener"; + } + }; + + component.addComponentListener(comp); + } + + private static native ByteBuffer nInitHandle(ByteBuffer surface_buffer, ByteBuffer peer_info_handle, ByteBuffer window_handle, boolean forceCALayer, boolean autoResizable, int x, int y) throws LWJGLException; + private static native void nSetLayerPosition(ByteBuffer peer_info_handle, int x, int y); + + private static native void nSetLayerBounds(ByteBuffer peer_info_handle, int x, int y, int width, int height); + + /** + * fix for CALayer position not covering Canvas due to a Java 7 bug + * {@link http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7172187} + * @param component + * @param peer_info_handle + */ + private static void reSetLayerBounds(Canvas component, ByteBuffer peer_info_handle) { + // report the root parent (peer). + Component peer = SwingUtilities.getRoot(component); + + Point rtLoc = SwingUtilities.convertPoint(component.getParent(), component.getLocation(), peer); + int x = (int) rtLoc.getX(), y = (int) rtLoc.getY(); + + Insets insets = getInsets(component); + x -= insets != null ? insets.left : 0; + y -= insets != null ? insets.top : 0; + + // http://hg.openjdk.java.net/jdk8/awt/jdk/rev/65d874d16d59 + y = (int) peer.getHeight() - y - (int) component.getHeight(); + + nSetLayerBounds(peer_info_handle, x, y, component.getWidth(), component.getHeight()); + } + protected void doUnlock() throws LWJGLException { awt_surface.unlock(); } + + /** + * @return rootpane insets (peer insets) values. + */ + private static Insets getInsets(Canvas component) { + Container c = SwingUtilities.getRootPane(component); + + if(c != null) { + return c.getInsets(); + } else { + return new Insets(0, 0, 0, 0); + } + } } diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/MacOSXContextAttribs.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/MacOSXContextAttribs.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/MacOSXContextAttribs.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/MacOSXContextAttribs.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,94 +0,0 @@ -/* - * Copyright (c) 2002-2008 LWJGL Project - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of 'LWJGL' nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package org.lwjgl.opengl; - -/** - * An implementation of ContextAttribs for MacOS X. - *

    - * ---- WIP - No XGL_create_context has been defined for MacOS X yet ---- - * - * @author spasi - */ -final class MacOSXContextAttribs implements ContextAttribsImplementation { - - private static final int XGL_CONTEXT_MAJOR_VERSION_ARB = 0x2091; - private static final int XGL_CONTEXT_MINOR_VERSION_ARB = 0x2092; - private static final int XGL_CONTEXT_LAYER_PLANE_ARB = 0x2093; - private static final int XGL_CONTEXT_FLAGS_ARB = 0x2094; - private static final int XGL_CONTEXT_PROFILE_MASK_ARB = 0x9126; - - private static final int XGL_CONTEXT_DEBUG_BIT_ARB = 0x0001; - private static final int XGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB = 0x0002; - - private static final int XGL_CONTEXT_CORE_PROFILE_BIT_ARB = 0x00000001; - private static final int XGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB = 0x00000002; - - MacOSXContextAttribs() { - } - - public int getMajorVersionAttrib() { - return XGL_CONTEXT_MAJOR_VERSION_ARB; - } - - public int getMinorVersionAttrib() { - return XGL_CONTEXT_MINOR_VERSION_ARB; - } - - public int getLayerPlaneAttrib() { - return XGL_CONTEXT_LAYER_PLANE_ARB; - } - - public int getFlagsAttrib() { - return XGL_CONTEXT_FLAGS_ARB; - } - - public int getDebugBit() { - return XGL_CONTEXT_DEBUG_BIT_ARB; - } - - public int getForwardCompatibleBit() { - return XGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB; - } - - public int getProfileMaskAttrib() { - return XGL_CONTEXT_PROFILE_MASK_ARB; - } - - public int getProfileCoreBit() { - return XGL_CONTEXT_CORE_PROFILE_BIT_ARB; - } - - public int getProfileCompatibilityBit() { - return XGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB; - } - -} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/MacOSXContextImplementation.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/MacOSXContextImplementation.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/MacOSXContextImplementation.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/MacOSXContextImplementation.java 2016-04-09 16:26:56.000000000 +0000 @@ -38,24 +38,24 @@ /** * @author elias_naur - * @version $Revision: 3116 $ - * $Id: MacOSXContextImplementation.java 3116 2008-08-19 16:46:03Z spasi $ + * @version $Revision$ + * $Id$ */ final class MacOSXContextImplementation implements ContextImplementation { public ByteBuffer create(PeerInfo peer_info, IntBuffer attribs, ByteBuffer shared_context_handle) throws LWJGLException { ByteBuffer peer_handle = peer_info.lockAndGetHandle(); try { - return nCreate(peer_handle, attribs, shared_context_handle); + return nCreate(peer_handle, shared_context_handle); } finally { peer_info.unlock(); } } - private static native ByteBuffer nCreate(ByteBuffer peer_handle, IntBuffer attribs, ByteBuffer shared_context_handle) throws LWJGLException; + private static native ByteBuffer nCreate(ByteBuffer peer_handle, ByteBuffer shared_context_handle) throws LWJGLException; public void swapBuffers() throws LWJGLException { - Context current_context = Context.getCurrentContext(); + ContextGL current_context = ContextGL.getCurrentContext(); if ( current_context == null ) throw new IllegalStateException("No context is current"); synchronized ( current_context ) { @@ -63,6 +63,8 @@ } } + native long getCGLShareGroup(ByteBuffer context_handle); + private static native void nSwapBuffers(ByteBuffer context_handle) throws LWJGLException; public void update(ByteBuffer context_handle) { @@ -83,7 +85,7 @@ private static native void clearDrawable(ByteBuffer handle) throws LWJGLException; - static void resetView(PeerInfo peer_info, Context context) throws LWJGLException { + static void resetView(PeerInfo peer_info, ContextGL context) throws LWJGLException { ByteBuffer peer_handle = peer_info.lockAndGetHandle(); try { synchronized ( context ) { @@ -117,7 +119,7 @@ private static native boolean nIsCurrent(ByteBuffer context_handle) throws LWJGLException; public void setSwapInterval(int value) { - Context current_context = Context.getCurrentContext(); + ContextGL current_context = ContextGL.getCurrentContext(); synchronized ( current_context ) { nSetSwapInterval(current_context.getHandle(), value); } diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/MacOSXDisplay.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/MacOSXDisplay.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/MacOSXDisplay.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/MacOSXDisplay.java 2016-04-09 16:26:56.000000000 +0000 @@ -35,11 +35,13 @@ * This is the Display implementation interface. Display delegates * to implementors of this interface. There is one DisplayImplementation * for each supported platform. - * @author elias_naur + * + * @author elias_naur + * @author mojang + * @author kappaOne */ import java.awt.Canvas; -import java.awt.Cursor; import java.awt.Robot; import java.nio.ByteBuffer; import java.nio.FloatBuffer; @@ -50,96 +52,171 @@ import java.util.ArrayList; import java.util.List; +import org.lwjgl.input.Cursor; +import org.lwjgl.opengl.Display; +import org.lwjgl.opengl.DisplayMode; import org.lwjgl.BufferUtils; +import org.lwjgl.MemoryUtil; import org.lwjgl.LWJGLException; import org.lwjgl.LWJGLUtil; -import com.apple.eawt.Application; -import com.apple.eawt.ApplicationAdapter; -import com.apple.eawt.ApplicationEvent; - import static org.lwjgl.opengl.GL11.*; final class MacOSXDisplay implements DisplayImplementation { private static final int PBUFFER_HANDLE_SIZE = 24; private static final int GAMMA_LENGTH = 256; - private MacOSXCanvasListener canvas_listener; - private MacOSXFrame frame; + //private MacOSXCanvasListener canvas_listener; private Canvas canvas; private Robot robot; private MacOSXMouseEventQueue mouse_queue; private KeyboardEventQueue keyboard_queue; - private java.awt.DisplayMode requested_mode; - - /* States */ + private DisplayMode requested_mode; + + /* Members for native window use */ + private MacOSXNativeMouse mouse; + private MacOSXNativeKeyboard keyboard; + private ByteBuffer window; + private ByteBuffer context; + + private boolean skipViewportValue = false; + private static final IntBuffer current_viewport = BufferUtils.createIntBuffer(16); + + private boolean mouseInsideWindow; + private boolean close_requested; + + private boolean native_mode = true; + + private boolean updateNativeCursor = false; + + private long currentNativeCursor = 0; + + private boolean enableHighDPI = false; + + private float scaleFactor = 1.0f; MacOSXDisplay() { - try { - AccessController.doPrivileged(new PrivilegedExceptionAction() { - public Object run() throws Exception { - Application.getApplication().addApplicationListener(new ApplicationAdapter() { - public void handleQuit(ApplicationEvent event) { - doHandleQuit(); - } - }); - return null; - } - }); - } catch (Throwable e) { - /** - * In an applet environment, referencing com.apple.eawt.Application can fail with - * a native exception. So log any exceptions instead of re-throwing. - */ - LWJGLUtil.log("Failed to register quit handler: " + e.getMessage()); - } + } - public void createWindow(DisplayMode mode, Canvas parent, int x, int y) throws LWJGLException { + private native ByteBuffer nCreateWindow(int x, int y, int width, int height, boolean fullscreen, boolean undecorated, boolean resizable, boolean parented, boolean enableFullscreenModeAPI, boolean enableHighDPI, ByteBuffer peer_info_handle, ByteBuffer window_handle) throws LWJGLException; + + private native Object nGetCurrentDisplayMode(); + + private native void nGetDisplayModes(Object modesList); + + private native boolean nIsMiniaturized(ByteBuffer window_handle); + + private native boolean nIsFocused(ByteBuffer window_handle); + + private native void nSetResizable(ByteBuffer window_handle, boolean resizable); + + private native void nResizeWindow(ByteBuffer window_handle, int x, int y, int width, int height); + + private native boolean nWasResized(ByteBuffer window_handle); + + private native int nGetX(ByteBuffer window_handle); + + private native int nGetY(ByteBuffer window_handle); + + private native int nGetWidth(ByteBuffer window_handle); + + private native int nGetHeight(ByteBuffer window_handle); + + private native boolean nIsNativeMode(ByteBuffer peer_info_handle); + + private static boolean isUndecorated() { + return Display.getPrivilegedBoolean("org.lwjgl.opengl.Window.undecorated"); + } + + public void createWindow(final DrawableLWJGL drawable, DisplayMode mode, Canvas parent, int x, int y) throws LWJGLException { boolean fullscreen = Display.isFullscreen(); - hideUI(fullscreen); + boolean resizable = Display.isResizable(); + boolean parented = (parent != null) && !fullscreen; + + // OS X fullscreen mode API is only available on OS X 10.7+ + boolean enableFullscreenModeAPI = LWJGLUtil.isMacOSXEqualsOrBetterThan(10, 7) && parent == null && + !Display.getPrivilegedBoolean("org.lwjgl.opengl.Display.disableOSXFullscreenModeAPI"); + + // OS X high DPI mode is only available on OS X 10.7+ + enableHighDPI = LWJGLUtil.isMacOSXEqualsOrBetterThan(10, 7) && parent == null && + (Display.getPrivilegedBoolean("org.lwjgl.opengl.Display.enableHighDPI") || fullscreen); + + if (parented) this.canvas = parent; + else this.canvas = null; + close_requested = false; + + DrawableGL gl_drawable = (DrawableGL)Display.getDrawable(); + PeerInfo peer_info = gl_drawable.peer_info; + ByteBuffer peer_handle = peer_info.lockAndGetHandle(); + ByteBuffer window_handle = parented ? ((MacOSXCanvasPeerInfo)peer_info).window_handle : window; + try { - if (parent == null) { - frame = new MacOSXFrame(mode, requested_mode, fullscreen, x, y); - canvas = frame.getCanvas(); - } else { - frame = null; - canvas = parent; + + window = nCreateWindow(x, y, mode.getWidth(), mode.getHeight(), + fullscreen, isUndecorated(), resizable, + parented, enableFullscreenModeAPI, enableHighDPI, peer_handle, window_handle); + + if (fullscreen) { + // when going to fullscreen viewport is set to screen size by Cocoa, ignore this value + skipViewportValue = true; + // if starting in fullscreen then set initial viewport to displaymode size + current_viewport.put(2, mode.getWidth()); + current_viewport.put(3, mode.getHeight()); + } + + native_mode = nIsNativeMode(peer_handle); + + if (!native_mode) { + robot = AWTUtil.createRobot(canvas); } - canvas_listener = new MacOSXCanvasListener(canvas); - robot = AWTUtil.createRobot(canvas); + } catch (LWJGLException e) { destroyWindow(); throw e; + } finally { + peer_info.unlock(); } } - private void doHandleQuit() { + public void doHandleQuit() { synchronized (this) { close_requested = true; } } + + public void mouseInsideWindow(boolean inside) { + synchronized (this) { + mouseInsideWindow = inside; + } + updateNativeCursor = true; + } + + public void setScaleFactor(float scale) { + synchronized (this) { + scaleFactor = scale; + } + } + + public native void nDestroyCALayer(ByteBuffer peer_info_handle); + + public native void nDestroyWindow(ByteBuffer window_handle); public void destroyWindow() { - if (canvas_listener != null) { - canvas_listener.disableListeners(); - canvas_listener = null; - } - if (frame != null) { - AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { - if (MacOSXFrame.getDevice().getFullScreenWindow() == frame) - MacOSXFrame.getDevice().setFullScreenWindow(null); - return null; - } - }); - if (frame.isDisplayable()) - frame.dispose(); - frame = null; + + if (!native_mode) { + DrawableGL gl_drawable = (DrawableGL)Display.getDrawable(); + PeerInfo peer_info = gl_drawable.peer_info; + if (peer_info != null) { + ByteBuffer peer_handle = peer_info.getHandle(); + nDestroyCALayer(peer_handle); + } + robot = null; } - hideUI(false); + + nDestroyWindow(window); } public int getGammaRampLength() { @@ -155,81 +232,80 @@ public String getVersion() { return null; } - - private static boolean equals(java.awt.DisplayMode awt_mode, DisplayMode mode) { - return awt_mode.getWidth() == mode.getWidth() && awt_mode.getHeight() == mode.getHeight() - && awt_mode.getBitDepth() == mode.getBitsPerPixel() && awt_mode.getRefreshRate() == mode.getFrequency(); + + private static boolean equals(DisplayMode mode1, DisplayMode mode2) { + return mode1.getWidth() == mode2.getWidth() && mode1.getHeight() == mode2.getHeight() + && mode1.getBitsPerPixel() == mode2.getBitsPerPixel() && mode1.getFrequency() == mode2.getFrequency(); } public void switchDisplayMode(DisplayMode mode) throws LWJGLException { - java.awt.DisplayMode[] awt_modes = MacOSXFrame.getDevice().getDisplayModes(); - for ( java.awt.DisplayMode awt_mode : awt_modes ) { - if (equals(awt_mode, mode)) { - requested_mode = awt_mode; + DisplayMode[] modes = getAvailableDisplayModes(); + + for (DisplayMode available_mode : modes) { + if (equals(available_mode, mode)) { + requested_mode = available_mode; return; } } + throw new LWJGLException(mode + " is not supported"); } public void resetDisplayMode() { - if (MacOSXFrame.getDevice().getFullScreenWindow() != null) - MacOSXFrame.getDevice().setFullScreenWindow(null); - requested_mode = null; + requested_mode = null; restoreGamma(); } private native void restoreGamma(); - private static DisplayMode createLWJGLDisplayMode(java.awt.DisplayMode awt_mode) { - int bit_depth; - int refresh_rate; - int awt_bit_depth = awt_mode.getBitDepth(); - int awt_refresh_rate = awt_mode.getRefreshRate(); - if (awt_bit_depth != java.awt.DisplayMode.BIT_DEPTH_MULTI) - bit_depth = awt_bit_depth; - else - bit_depth = 32; // Assume the best bit depth - if (awt_refresh_rate != java.awt.DisplayMode.REFRESH_RATE_UNKNOWN) - refresh_rate = awt_refresh_rate; - else - refresh_rate = 0; - return new DisplayMode(awt_mode.getWidth(), awt_mode.getHeight(), bit_depth, refresh_rate); + public Object createDisplayMode(int width, int height, int bitsPerPixel, int refreshRate) { + return new DisplayMode(width, height, bitsPerPixel, refreshRate); } - + public DisplayMode init() throws LWJGLException { - return createLWJGLDisplayMode(MacOSXFrame.getDevice().getDisplayMode()); + return (DisplayMode) nGetCurrentDisplayMode(); + } + + public void addDisplayMode(Object modesList, int width, int height, int bitsPerPixel, int refreshRate) { + List modes = (List) modesList; + DisplayMode displayMode = new DisplayMode(width, height, bitsPerPixel, refreshRate); + modes.add(displayMode); } public DisplayMode[] getAvailableDisplayModes() throws LWJGLException { - java.awt.DisplayMode[] awt_modes = MacOSXFrame.getDevice().getDisplayModes(); List modes = new ArrayList(); - for ( java.awt.DisplayMode awt_mode : awt_modes ) - if ( awt_mode.getBitDepth() >= 16 ) - modes.add(createLWJGLDisplayMode(awt_mode)); + nGetDisplayModes(modes); // will populate the above list + modes.add(Display.getDesktopDisplayMode()); // add desktop resolution as scaled resolutions do not appear return modes.toArray(new DisplayMode[modes.size()]); } + private native void nSetTitle(ByteBuffer window_handle, ByteBuffer title_buffer); + public void setTitle(String title) { - if (frame != null) - frame.setTitle(title); + ByteBuffer buffer = MemoryUtil.encodeUTF8(title); + nSetTitle(window, buffer); } public boolean isCloseRequested() { boolean result; synchronized (this) { - result = close_requested || (frame != null && frame.syncIsCloseRequested()); + result = close_requested; close_requested = false; } return result; } public boolean isVisible() { - return frame == null || frame.syncIsVisible(); + return true; } public boolean isActive() { - return canvas.isFocusOwner(); + if (native_mode) { + return nIsFocused(window); + } + else { + return Display.getParent().hasFocus(); + } } public Canvas getCanvas() { @@ -237,82 +313,48 @@ } public boolean isDirty() { - return frame != null && frame.getCanvas().syncIsDirty(); + return false; } - public PeerInfo createPeerInfo(PixelFormat pixel_format) throws LWJGLException { + public PeerInfo createPeerInfo(PixelFormat pixel_format, ContextAttribs attribs) throws LWJGLException { try { - return new MacOSXDisplayPeerInfo(pixel_format, true); + return new MacOSXDisplayPeerInfo(pixel_format, attribs, true); } catch (LWJGLException e) { - return new MacOSXDisplayPeerInfo(pixel_format, false); + return new MacOSXDisplayPeerInfo(pixel_format, attribs, false); } } - private static final IntBuffer current_viewport = BufferUtils.createIntBuffer(16); public void update() { - boolean should_update = canvas_listener.syncShouldUpdateContext(); - /* - * Workaround for the "white screen in fullscreen mode" problem - * - * Sometimes, switching from windowed mode to fullscreen or simply creating the Display - * in fullscreen mode will result in the context not being bound to the window correctly. - * The program runs fine, but the canvas background (white) is shown instead of the context - * front buffer. - * - * I've discovered that re-binding the context with another setView() won't fix the problem, while a - * clearDrawable() followed by a setView() does work. A straightforward workaround would be - * to simply run the combination at every update(). This is not sufficient, since the clearDrawable() - * call makes the the background appear shortly, causing visual artifacts. - * What we really need is a way to detect that a setView() failed, and then do the magic combo. I've not - * been able to find such a detection so alternatively I'm triggering the combo if the display is fullscreen - * (I've not seen the white screen problem in windowed mode) and if the canvas has gotten a paint message or - * if its update flag was set. - * - * My testing seems to indicate that the workaround works, since I've not seen the problem after the fix. - * - * - elias - */ - AbstractDrawable drawable = (AbstractDrawable)Display.getDrawable(); - if (Display.isFullscreen() && (frame != null && frame.getCanvas().syncCanvasPainted() || should_update)) { - try { - MacOSXContextImplementation.resetView(drawable.peer_info, drawable.context); - } catch (LWJGLException e) { - LWJGLUtil.log("Failed to reset context: " + e); - } - } + boolean should_update = true; + + DrawableGL drawable = (DrawableGL)Display.getDrawable(); if (should_update) { + + // Save the current viewport size as cocoa will automatically + // set the viewport size to the window size on context update + if (skipViewportValue) skipViewportValue = false; + else glGetInteger(GL_VIEWPORT, current_viewport); + drawable.context.update(); - /* This is necessary to make sure the context won't "forget" about the view size */ - glGetInteger(GL_VIEWPORT, current_viewport); + + // restore the original viewport size that was set before the update glViewport(current_viewport.get(0), current_viewport.get(1), current_viewport.get(2), current_viewport.get(3)); } - if (frame != null && mouse_queue != null) { - if (frame.syncShouldReleaseCursor()) - MacOSXMouseEventQueue.nGrabMouse(false); - if (frame.syncShouldWarpCursor()) - mouse_queue.warpCursor(); + + if (native_mode && updateNativeCursor) { + updateNativeCursor = false; + try { + setNativeCursor(currentNativeCursor); + } catch (LWJGLException e) { + e.printStackTrace(); + } } } - /** - * This is an interface to the native Carbon call - * SetSystemUIMode. It is used to hide the dock in a way - * that will prevent AWT from shifting the fullscreen window - * - * The workaround is not necessary on 10.4, and since 10.4 shows - * instability problems calling SetSystemUIMode, we'll only call it - * when the OS version is 10.3 or lower. - */ - private void hideUI(boolean hide) { - if (!LWJGLUtil.isMacOSXEqualsOrBetterThan(10, 4)) - nHideUI(hide); - } - - private native void nHideUI(boolean hide); - public void reshape(int x, int y, int width, int height) { - if (frame != null) - frame.resize(x, y, width, height); + //if (native_mode) { + // nResizeWindow(window, x, y, width, height); + //} } /* Mouse */ @@ -325,119 +367,190 @@ } public void createMouse() throws LWJGLException { - this.mouse_queue = new MacOSXMouseEventQueue(canvas); - mouse_queue.register(); + if (native_mode) { + mouse = new MacOSXNativeMouse(this, window); + mouse.register(); + } + else { + this.mouse_queue = new MacOSXMouseEventQueue(canvas); + mouse_queue.register(); + } } public void destroyMouse() { - if (mouse_queue != null) { - MacOSXMouseEventQueue.nGrabMouse(false); - mouse_queue.unregister(); + if (native_mode) { + // restore default native cursor + try { + MacOSXNativeMouse.setCursor(0); + } catch (LWJGLException e) {}; + + // release any mouse grab + grabMouse(false); + + if (mouse != null) { + mouse.unregister(); + } + mouse = null; + } + else { + if (mouse_queue != null) { + MacOSXMouseEventQueue.nGrabMouse(false); + mouse_queue.unregister(); + } + this.mouse_queue = null; } - this.mouse_queue = null; } public void pollMouse(IntBuffer coord_buffer, ByteBuffer buttons_buffer) { - mouse_queue.poll(coord_buffer, buttons_buffer); + if (native_mode) { + mouse.poll(coord_buffer, buttons_buffer); + } + else { + mouse_queue.poll(coord_buffer, buttons_buffer); + } } public void readMouse(ByteBuffer buffer) { - mouse_queue.copyEvents(buffer); + if (native_mode) { + mouse.copyEvents(buffer); + } + else { + mouse_queue.copyEvents(buffer); + } } public void grabMouse(boolean grab) { - mouse_queue.setGrabbed(grab); + if (native_mode) { + mouse.setGrabbed(grab); + } + else { + mouse_queue.setGrabbed(grab); + } } public int getNativeCursorCapabilities() { + if (native_mode) { + return Cursor.CURSOR_ONE_BIT_TRANSPARENCY | Cursor.CURSOR_8_BIT_ALPHA | Cursor.CURSOR_ANIMATION; + } + return AWTUtil.getNativeCursorCapabilities(); } public void setCursorPosition(int x, int y) { - AWTUtil.setCursorPosition(canvas, robot, x, y); + if (native_mode) { + if (mouse != null) { + mouse.setCursorPosition(x, y); + } + } + //else { + //MacOSXMouseEventQueue.nWarpCursor(x, y); + //} } public void setNativeCursor(Object handle) throws LWJGLException { - Cursor awt_cursor = (Cursor)handle; - if (frame != null) - frame.setCursor(awt_cursor); + if (native_mode) { + currentNativeCursor = getCursorHandle(handle); + if (Display.isCreated()) { + if (mouseInsideWindow) MacOSXNativeMouse.setCursor(currentNativeCursor); + else MacOSXNativeMouse.setCursor(0); // restore default cursor if outside Display + } + } } public int getMinCursorSize() { - return AWTUtil.getMinCursorSize(); + return 1; } public int getMaxCursorSize() { - return AWTUtil.getMaxCursorSize(); + // as there is no max cursor size limit on OS X + // return the max cursor size as half the screen resolution + DisplayMode dm = Display.getDesktopDisplayMode(); + return Math.min(dm.getWidth(), dm.getHeight()) / 2; } /* Keyboard */ public void createKeyboard() throws LWJGLException { - this.keyboard_queue = new KeyboardEventQueue(canvas); - keyboard_queue.register(); + if (native_mode) { + this.keyboard = new MacOSXNativeKeyboard(window); + keyboard.register(); + } + else { + this.keyboard_queue = new KeyboardEventQueue(canvas); + keyboard_queue.register(); + } } public void destroyKeyboard() { - if (keyboard_queue != null) - keyboard_queue.unregister(); - this.keyboard_queue = null; + if (native_mode) { + if (keyboard != null) { + keyboard.unregister(); + } + keyboard = null; + } + else { + if (keyboard_queue != null) { + keyboard_queue.unregister(); + } + this.keyboard_queue = null; + } } public void pollKeyboard(ByteBuffer keyDownBuffer) { - keyboard_queue.poll(keyDownBuffer); + if (native_mode) { + keyboard.poll(keyDownBuffer); + } + else { + keyboard_queue.poll(keyDownBuffer); + } } public void readKeyboard(ByteBuffer buffer) { - keyboard_queue.copyEvents(buffer); - } - -/* public int isStateKeySet(int key) { - int awt_key; - switch (key) { - case Keyboard.KEY_CAPITAL: - awt_key = KeyEvent.VK_CAPS_LOCK; - break; - case Keyboard.KEY_NUMLOCK: - awt_key = KeyEvent.VK_NUM_LOCK; - break; - case Keyboard.KEY_SYSRQ: - awt_key = KeyEvent.VK_SCROLL_LOCK; - break; - default: - return Keyboard.STATE_UNKNOWN; + if (native_mode) { + keyboard.copyEvents(buffer); } - try { - boolean state = Toolkit.getDefaultToolkit().getLockingKeyState(awt_key); - return state ? Keyboard.STATE_ON : Keyboard.STATE_OFF; - } catch (Exception e) { - LWJGLUtil.log("Failed to query key state: " + e); - return Keyboard.STATE_UNKNOWN; + else { + keyboard_queue.copyEvents(buffer); } } -*/ + /** Native cursor handles */ public Object createCursor(int width, int height, int xHotspot, int yHotspot, int numImages, IntBuffer images, IntBuffer delays) throws LWJGLException { - return AWTUtil.createCursor(width, height, xHotspot, yHotspot, numImages, images, delays); + if (native_mode) { + long cursor = MacOSXNativeMouse.createCursor(width, height, xHotspot, yHotspot, numImages, images, delays); + return cursor; + } + else { + return AWTUtil.createCursor(width, height, xHotspot, yHotspot, numImages, images, delays); + } } public void destroyCursor(Object cursor_handle) { + long handle = getCursorHandle(cursor_handle); + + // reset current cursor if same + if (currentNativeCursor == handle) { + currentNativeCursor = 0; + } + + MacOSXNativeMouse.destroyCursor(handle); + } + + private static long getCursorHandle(Object cursor_handle) { + return cursor_handle != null ? (Long)cursor_handle : 0; } public int getPbufferCapabilities() { - if (LWJGLUtil.isMacOSXEqualsOrBetterThan(10, 3)) - return Pbuffer.PBUFFER_SUPPORTED; - else - return 0; + return Pbuffer.PBUFFER_SUPPORTED; } public boolean isBufferLost(PeerInfo handle) { return false; } - public PeerInfo createPbuffer(int width, int height, PixelFormat pixel_format, + public PeerInfo createPbuffer(int width, int height, PixelFormat pixel_format, ContextAttribs attribs, IntBuffer pixelFormatCaps, IntBuffer pBufferAttribs) throws LWJGLException { - return new MacOSXPbufferPeerInfo(width, height, pixel_format); + return new MacOSXPbufferPeerInfo(width, height, pixel_format, attribs); } public void setPbufferAttrib(PeerInfo handle, int attrib, int value) { @@ -465,7 +578,7 @@ * @return number of icons used. */ public int setIcon(ByteBuffer[] icons) { -/* int size = 0; + /*int size = 0; int biggest = -1; for (int i=0;i - * @version $Revision: 3418 $ - * $Id: MacOSXDisplayPeerInfo.java 3418 2010-09-28 21:11:35Z spasi $ + * @version $Revision$ + * $Id$ */ final class MacOSXDisplayPeerInfo extends MacOSXCanvasPeerInfo { private boolean locked; - MacOSXDisplayPeerInfo(PixelFormat pixel_format, boolean support_pbuffer) throws LWJGLException { - super(pixel_format, support_pbuffer); + MacOSXDisplayPeerInfo(PixelFormat pixel_format, ContextAttribs attribs, boolean support_pbuffer) throws LWJGLException { + super(pixel_format, attribs, support_pbuffer); } protected void doLockAndInitHandle() throws LWJGLException { diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/MacOSXFrame.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/MacOSXFrame.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/MacOSXFrame.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/MacOSXFrame.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,228 +0,0 @@ -/* - * Copyright (c) 2002-2008 LWJGL Project - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of 'LWJGL' nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package org.lwjgl.opengl; - -/** - * This is the Mac OS X AWT Frame. It contains thread safe - * methods to manipulateit from non-AWT threads - * @author elias_naur - */ - -import java.awt.BorderLayout; -import java.awt.Frame; -import java.awt.GraphicsDevice; -import java.awt.GraphicsEnvironment; -import java.awt.Insets; -import java.awt.Rectangle; -import java.awt.event.ComponentEvent; -import java.awt.event.ComponentListener; -import java.awt.event.WindowEvent; -import java.awt.event.WindowListener; -import java.security.AccessController; -import java.security.PrivilegedActionException; -import java.security.PrivilegedExceptionAction; - -import org.lwjgl.LWJGLException; - -final class MacOSXFrame extends Frame implements WindowListener, ComponentListener { - - private static final long serialVersionUID = -5823294716668988777L; - - private final MacOSXGLCanvas canvas; - private boolean close_requested; - - /* States */ - private Rectangle bounds; - private boolean active; - private boolean minimized; - private boolean should_warp_cursor; - private boolean should_release_cursor; - - MacOSXFrame(DisplayMode mode, final java.awt.DisplayMode requested_mode, boolean fullscreen, int x, int y) throws LWJGLException { - setResizable(false); - addWindowListener(this); - addComponentListener(this); - canvas = new MacOSXGLCanvas(); - canvas.setFocusTraversalKeysEnabled(false); - add(canvas, BorderLayout.CENTER); - boolean undecorated = Display.getPrivilegedBoolean("org.lwjgl.opengl.Window.undecorated"); - setUndecorated(fullscreen || undecorated); - if ( fullscreen ) { - try { - AccessController.doPrivileged(new PrivilegedExceptionAction() { - public Object run() throws Exception { - getDevice().setFullScreenWindow(MacOSXFrame.this); - getDevice().setDisplayMode(requested_mode); - java.awt.DisplayMode real_mode = getDevice().getDisplayMode(); - /** For some strange reason, the display mode is sometimes silently capped even though the mode is reported as supported */ - if ( requested_mode.getWidth() != real_mode.getWidth() || requested_mode.getHeight() != real_mode.getHeight() ) { - getDevice().setFullScreenWindow(null); - if (isDisplayable()) - dispose(); - throw new LWJGLException("AWT capped mode: requested mode = " + requested_mode.getWidth() + "x" + requested_mode.getHeight() + - " but got " + real_mode.getWidth() + " " + real_mode.getHeight()); - } - return null; - } - }); - } catch (PrivilegedActionException e) { - throw new LWJGLException(e); - } - } - pack(); - resize(x, y, mode.getWidth(), mode.getHeight()); - setVisible(true); - requestFocus(); - canvas.requestFocus(); - updateBounds(); - } - - public void resize(int x, int y, int width, int height) { - Insets insets = getInsets(); - setBounds(x, y, width + insets.left + insets.right, height + insets.top + insets.bottom); - } - - public Rectangle syncGetBounds() { - synchronized ( this ) { - return bounds; - } - } - - public void componentShown(ComponentEvent e) { - } - - public void componentHidden(ComponentEvent e) { - } - - private void updateBounds() { - synchronized ( this ) { - bounds = getBounds(); - } - } - - public void componentResized(ComponentEvent e) { - updateBounds(); - } - - public void componentMoved(ComponentEvent e) { - updateBounds(); - } - - public static GraphicsDevice getDevice() { - GraphicsEnvironment g_env = GraphicsEnvironment.getLocalGraphicsEnvironment(); - GraphicsDevice device = g_env.getDefaultScreenDevice(); - return device; - } - - public void windowIconified(WindowEvent e) { - synchronized ( this ) { - minimized = true; - } - } - - public void windowDeiconified(WindowEvent e) { - synchronized ( this ) { - minimized = false; - } - } - - public void windowOpened(WindowEvent e) { - } - - public void windowClosed(WindowEvent e) { - } - - public void windowClosing(WindowEvent e) { - synchronized ( this ) { - close_requested = true; - } - } - - public void windowDeactivated(WindowEvent e) { - synchronized ( this ) { - active = false; - should_release_cursor = true; - should_warp_cursor = false; - } - } - - public void windowActivated(WindowEvent e) { - synchronized ( this ) { - active = true; - should_warp_cursor = true; - should_release_cursor = false; - } - } - - public boolean syncIsCloseRequested() { - boolean result; - synchronized ( this ) { - result = close_requested; - close_requested = false; - } - return result; - } - - public boolean syncIsVisible() { - synchronized ( this ) { - return !minimized; - } - } - - public boolean syncIsActive() { - synchronized ( this ) { - return active; - } - } - - public MacOSXGLCanvas getCanvas() { - return canvas; - } - - public boolean syncShouldReleaseCursor() { - boolean result; - synchronized ( this ) { - result = should_release_cursor; - should_release_cursor = false; - } - return result; - } - - public boolean syncShouldWarpCursor() { - boolean result; - synchronized ( this ) { - result = should_warp_cursor; - should_warp_cursor = false; - } - return result; - } -} diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/MacOSXMouseEventQueue.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/MacOSXMouseEventQueue.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/MacOSXMouseEventQueue.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/MacOSXMouseEventQueue.java 2016-04-09 16:26:56.000000000 +0000 @@ -96,13 +96,13 @@ // If we're going to warp the cursor position, we'll skip the next event to avoid bogus delta values skip_event = isGrabbed(); } -/* if (isGrabbed()) { + if (isGrabbed()) { Rectangle bounds = getComponent().getBounds(); Point location_on_screen = getComponent().getLocationOnScreen(); int x = location_on_screen.x + bounds.width/2; int y = location_on_screen.y + bounds.height/2; nWarpCursor(x, y); - }*/ + } } private static native void getMouseDeltas(IntBuffer delta_buffer); @@ -110,4 +110,4 @@ private static native void nWarpCursor(int x, int y); static native void nGrabMouse(boolean grab); -} +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/MacOSXNativeKeyboard.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/MacOSXNativeKeyboard.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/MacOSXNativeKeyboard.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/MacOSXNativeKeyboard.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,296 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +/** + * A native implementation of a LWJGL compatible Keyboard event queue. + * @author elias_naur + * @author mojang + */ + +import java.awt.event.KeyEvent; +import java.util.HashMap; +import java.nio.ByteBuffer; + +import org.lwjgl.input.Keyboard; + +final class MacOSXNativeKeyboard extends EventQueue { + private final byte[] key_states = new byte[Keyboard.KEYBOARD_SIZE]; + + /** Event scratch array */ + private final ByteBuffer event = ByteBuffer.allocate(Keyboard.EVENT_SIZE); + + private ByteBuffer window_handle; + + private boolean has_deferred_event; + private long deferred_nanos; + private int deferred_key_code; + private byte deferred_key_state; + private int deferred_character; + + private HashMap nativeToLwjglMap; + + MacOSXNativeKeyboard(ByteBuffer window_handle) { + super(Keyboard.EVENT_SIZE); + nativeToLwjglMap = new HashMap(); + initKeyboardMappings(); + this.window_handle = window_handle; + } + + private native void nRegisterKeyListener(ByteBuffer window_handle); + + private native void nUnregisterKeyListener(ByteBuffer window_handle); + + // These are from: + private void initKeyboardMappings() { + nativeToLwjglMap.put((short)0x1D, Keyboard.KEY_0); + nativeToLwjglMap.put((short)0x12, Keyboard.KEY_1); + nativeToLwjglMap.put((short)0x13, Keyboard.KEY_2); + nativeToLwjglMap.put((short)0x14, Keyboard.KEY_3); + nativeToLwjglMap.put((short)0x15, Keyboard.KEY_4); + nativeToLwjglMap.put((short)0x17, Keyboard.KEY_5); + nativeToLwjglMap.put((short)0x16, Keyboard.KEY_6); + nativeToLwjglMap.put((short)0x1A, Keyboard.KEY_7); + nativeToLwjglMap.put((short)0x1C, Keyboard.KEY_8); + nativeToLwjglMap.put((short)0x19, Keyboard.KEY_9); + nativeToLwjglMap.put((short)0x00, Keyboard.KEY_A); + nativeToLwjglMap.put((short)0x0B, Keyboard.KEY_B); + nativeToLwjglMap.put((short)0x08, Keyboard.KEY_C); + nativeToLwjglMap.put((short)0x02, Keyboard.KEY_D); + nativeToLwjglMap.put((short)0x0E, Keyboard.KEY_E); + nativeToLwjglMap.put((short)0x03, Keyboard.KEY_F); + nativeToLwjglMap.put((short)0x05, Keyboard.KEY_G); + nativeToLwjglMap.put((short)0x04, Keyboard.KEY_H); + nativeToLwjglMap.put((short)0x22, Keyboard.KEY_I); + nativeToLwjglMap.put((short)0x26, Keyboard.KEY_J); + nativeToLwjglMap.put((short)0x28, Keyboard.KEY_K); + nativeToLwjglMap.put((short)0x25, Keyboard.KEY_L); + nativeToLwjglMap.put((short)0x2E, Keyboard.KEY_M); + nativeToLwjglMap.put((short)0x2D, Keyboard.KEY_N); + nativeToLwjglMap.put((short)0x1F, Keyboard.KEY_O); + nativeToLwjglMap.put((short)0x23, Keyboard.KEY_P); + nativeToLwjglMap.put((short)0x0C, Keyboard.KEY_Q); + nativeToLwjglMap.put((short)0x0F, Keyboard.KEY_R); + nativeToLwjglMap.put((short)0x01, Keyboard.KEY_S); + nativeToLwjglMap.put((short)0x11, Keyboard.KEY_T); + nativeToLwjglMap.put((short)0x20, Keyboard.KEY_U); + nativeToLwjglMap.put((short)0x09, Keyboard.KEY_V); + nativeToLwjglMap.put((short)0x0D, Keyboard.KEY_W); + nativeToLwjglMap.put((short)0x07, Keyboard.KEY_X); + nativeToLwjglMap.put((short)0x10, Keyboard.KEY_Y); + nativeToLwjglMap.put((short)0x06, Keyboard.KEY_Z); + + nativeToLwjglMap.put((short)0x2A, Keyboard.KEY_BACKSLASH); + nativeToLwjglMap.put((short)0x2B, Keyboard.KEY_COMMA); + nativeToLwjglMap.put((short)0x18, Keyboard.KEY_EQUALS); + nativeToLwjglMap.put((short)0x21, Keyboard.KEY_LBRACKET); + nativeToLwjglMap.put((short)0x1B, Keyboard.KEY_MINUS); + nativeToLwjglMap.put((short)0x27, Keyboard.KEY_APOSTROPHE); + nativeToLwjglMap.put((short)0x1E, Keyboard.KEY_RBRACKET); + nativeToLwjglMap.put((short)0x29, Keyboard.KEY_SEMICOLON); + nativeToLwjglMap.put((short)0x2C, Keyboard.KEY_SLASH); + nativeToLwjglMap.put((short)0x2F, Keyboard.KEY_PERIOD); + nativeToLwjglMap.put((short)0x32, Keyboard.KEY_GRAVE); + + nativeToLwjglMap.put((short)0x41, Keyboard.KEY_DECIMAL); + nativeToLwjglMap.put((short)0x43, Keyboard.KEY_MULTIPLY); + nativeToLwjglMap.put((short)0x45, Keyboard.KEY_ADD); + nativeToLwjglMap.put((short)0x47, Keyboard.KEY_CLEAR); + nativeToLwjglMap.put((short)0x4B, Keyboard.KEY_DIVIDE); + nativeToLwjglMap.put((short)0x4C, Keyboard.KEY_NUMPADENTER); + nativeToLwjglMap.put((short)0x4E, Keyboard.KEY_SUBTRACT); + nativeToLwjglMap.put((short)0x51, Keyboard.KEY_NUMPADEQUALS); + + nativeToLwjglMap.put((short)0x52, Keyboard.KEY_NUMPAD0); + nativeToLwjglMap.put((short)0x53, Keyboard.KEY_NUMPAD1); + nativeToLwjglMap.put((short)0x54, Keyboard.KEY_NUMPAD2); + nativeToLwjglMap.put((short)0x55, Keyboard.KEY_NUMPAD3); + nativeToLwjglMap.put((short)0x56, Keyboard.KEY_NUMPAD4); + nativeToLwjglMap.put((short)0x57, Keyboard.KEY_NUMPAD5); + nativeToLwjglMap.put((short)0x58, Keyboard.KEY_NUMPAD6); + nativeToLwjglMap.put((short)0x59, Keyboard.KEY_NUMPAD7); + nativeToLwjglMap.put((short)0x5B, Keyboard.KEY_NUMPAD8); + nativeToLwjglMap.put((short)0x5C, Keyboard.KEY_NUMPAD9); + + + nativeToLwjglMap.put((short)0x24, Keyboard.KEY_RETURN); + nativeToLwjglMap.put((short)0x30, Keyboard.KEY_TAB); + nativeToLwjglMap.put((short)0x31, Keyboard.KEY_SPACE); + nativeToLwjglMap.put((short)0x33, Keyboard.KEY_BACK); + nativeToLwjglMap.put((short)0x35, Keyboard.KEY_ESCAPE); + nativeToLwjglMap.put((short)0x36, Keyboard.KEY_RMETA); // not in Events.h - works on MBP + nativeToLwjglMap.put((short)0x37, Keyboard.KEY_LMETA); + nativeToLwjglMap.put((short)0x38, Keyboard.KEY_LSHIFT); + nativeToLwjglMap.put((short)0x39, Keyboard.KEY_CAPITAL); + nativeToLwjglMap.put((short)0x3A, Keyboard.KEY_LMENU); + nativeToLwjglMap.put((short)0x3B, Keyboard.KEY_LCONTROL); + nativeToLwjglMap.put((short)0x3C, Keyboard.KEY_RSHIFT); + nativeToLwjglMap.put((short)0x3D, Keyboard.KEY_RMENU); + nativeToLwjglMap.put((short)0x3E, Keyboard.KEY_RCONTROL); + + nativeToLwjglMap.put((short)0x3F, Keyboard.KEY_FUNCTION); + nativeToLwjglMap.put((short)0x77, Keyboard.KEY_END); + + nativeToLwjglMap.put((short)0x7A, Keyboard.KEY_F1); + nativeToLwjglMap.put((short)0x78, Keyboard.KEY_F2); + nativeToLwjglMap.put((short)0x63, Keyboard.KEY_F3); + nativeToLwjglMap.put((short)0x76, Keyboard.KEY_F4); + nativeToLwjglMap.put((short)0x60, Keyboard.KEY_F5); + nativeToLwjglMap.put((short)0x61, Keyboard.KEY_F6); + nativeToLwjglMap.put((short)0x62, Keyboard.KEY_F7); + nativeToLwjglMap.put((short)0x64, Keyboard.KEY_F8); + nativeToLwjglMap.put((short)0x65, Keyboard.KEY_F9); + nativeToLwjglMap.put((short)0x6D, Keyboard.KEY_F10); + nativeToLwjglMap.put((short)0x67, Keyboard.KEY_F11); + nativeToLwjglMap.put((short)0x6F, Keyboard.KEY_F12); + nativeToLwjglMap.put((short)0x69, Keyboard.KEY_F13); + nativeToLwjglMap.put((short)0x6B, Keyboard.KEY_F14); + nativeToLwjglMap.put((short)0x71, Keyboard.KEY_F15); + nativeToLwjglMap.put((short)0x6A, Keyboard.KEY_F16); + nativeToLwjglMap.put((short)0x40, Keyboard.KEY_F17); + nativeToLwjglMap.put((short)0x4F, Keyboard.KEY_F18); + nativeToLwjglMap.put((short)0x50, Keyboard.KEY_F19); + // nativeToLwjglMap.put((short)0x5A, Keyboard.KEY_F20); + + nativeToLwjglMap.put((short)0x75, Keyboard.KEY_DELETE); + nativeToLwjglMap.put((short)0x72, Keyboard.KEY_INSERT); // 'Help' in Events.h + nativeToLwjglMap.put((short)0x73, Keyboard.KEY_HOME); + // nativeToLwjglMap.put((short)0xA4, Keyboard.KEY_MUTE); + nativeToLwjglMap.put((short)0x79, Keyboard.KEY_NEXT); + nativeToLwjglMap.put((short)0x74, Keyboard.KEY_PRIOR); + // nativeToLwjglMap.put((short)0x49, Keyboard.KEY_VOLUMEDOWN); + // nativeToLwjglMap.put((short)0x48, Keyboard.KEY_VOLUMEUP); + nativeToLwjglMap.put((short)0x7B, Keyboard.KEY_LEFT); + nativeToLwjglMap.put((short)0x7C, Keyboard.KEY_RIGHT); + nativeToLwjglMap.put((short)0x7D, Keyboard.KEY_DOWN); + nativeToLwjglMap.put((short)0x7E, Keyboard.KEY_UP); + + nativeToLwjglMap.put((short)0x0A, Keyboard.KEY_SECTION); + + nativeToLwjglMap.put((short)0x6E, Keyboard.KEY_APPS); // not in Events.h + nativeToLwjglMap.put((short)0x129, Keyboard.KEY_COLON); // not in Events.h -- do we need it? + } + + public void register() { + nRegisterKeyListener(window_handle); + } + + public void unregister() { + nUnregisterKeyListener(window_handle); + } + + public void putKeyboardEvent(int key_code, byte state, int character, long nanos, boolean repeat) { + event.clear(); + event.putInt(key_code).put(state).putInt(character).putLong(nanos).put(repeat ? (byte)1 : (byte)0); + event.flip(); + putEvent(event); + } + + public synchronized void poll(ByteBuffer key_down_buffer) { + flushDeferredEvent(); + int old_position = key_down_buffer.position(); + key_down_buffer.put(key_states); + key_down_buffer.position(old_position); + } + + public synchronized void copyEvents(ByteBuffer dest) { + flushDeferredEvent(); + super.copyEvents(dest); + } + + private synchronized void handleKey(int key_code, byte state, int character, long nanos) { + if (character == KeyEvent.CHAR_UNDEFINED) + character = Keyboard.CHAR_NONE; + if (state == 1) { + boolean repeat = false; + if (has_deferred_event) { + if ((nanos == deferred_nanos && deferred_key_code == key_code)) { + has_deferred_event = false; + repeat = true; // Repeat event + } else + flushDeferredEvent(); + } + putKeyEvent(key_code, state, character, nanos, repeat); + } else { + flushDeferredEvent(); + has_deferred_event = true; + deferred_nanos = nanos; + deferred_key_code = key_code; + deferred_key_state = state; + deferred_character = character; + } + } + + private void flushDeferredEvent() { + if (has_deferred_event) { + putKeyEvent(deferred_key_code, deferred_key_state, deferred_character, deferred_nanos, false); + has_deferred_event = false; + } + } + + public void putKeyEvent(int key_code, byte state, int character, long nanos, boolean repeat) { + /* Ignore repeating presses */ + int mapped_code = getMappedKeyCode((short)key_code); + if (mapped_code < 0) { + System.out.println("Unrecognized keycode: " + key_code); + /* Unrecognized / unmapped code, do nothing */ + return; + } + if ( key_states[mapped_code] == state ) + repeat = true; + key_states[mapped_code] = state; + int key_int_char = character & 0xffff; + putKeyboardEvent(mapped_code, state, key_int_char, nanos, repeat); + } + + private int getMappedKeyCode(short key_code) { + if (nativeToLwjglMap.containsKey(key_code)) { + return nativeToLwjglMap.get(key_code); + } + return -1; + } + + public void keyPressed(int key_code, String chars, long nanos) { + // use only first character of chars returned for key press + int character = (chars == null || chars.length() == 0) ? 0 : (int)chars.charAt(0); + handleKey(key_code, (byte)1, character, nanos); + } + + public void keyReleased(int key_code, String chars, long nanos) { + // use only first character of chars returned for key release + int character = (chars == null || chars.length() == 0) ? 0 : (int)chars.charAt(0); + handleKey(key_code, (byte)0, character, nanos); + } + + public void keyTyped(KeyEvent e) { + } +} diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/MacOSXNativeMouse.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/MacOSXNativeMouse.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/MacOSXNativeMouse.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/MacOSXNativeMouse.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,228 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +/** + * A Cocoa implementation of a LWJGL compatible Mouse. + * @author mojang + * @author kappaOne + */ + +import java.nio.ByteBuffer; +import java.nio.IntBuffer; + +import org.lwjgl.input.Mouse; +import org.lwjgl.LWJGLException; + +import java.lang.reflect.*; +import java.lang.Integer; +import java.lang.Long; + +import org.lwjgl.BufferUtils; + +final class MacOSXNativeMouse extends EventQueue { + private static final int WHEEL_SCALE = 120; + private static final int NUM_BUTTONS = 3; + + private ByteBuffer window_handle; + private MacOSXDisplay display; + + private boolean grabbed; + + /** The accumulated mouse deltas returned by poll() */ + private float accum_dx; + private float accum_dy; + private int accum_dz; + + /** The last mouse position */ + private float last_x; + private float last_y; + + /** Saved control key state for ctrl-click right button emulation */ + private boolean saved_control_state; + + private final ByteBuffer event = ByteBuffer.allocate(Mouse.EVENT_SIZE); + private IntBuffer delta_buffer = BufferUtils.createIntBuffer(2); + private int skip_event; + + private final byte[] buttons = new byte[NUM_BUTTONS]; + + MacOSXNativeMouse(MacOSXDisplay display, ByteBuffer window_handle) { + super(Mouse.EVENT_SIZE); + this.display = display; + this.window_handle = window_handle; + } + + private native void nSetCursorPosition(ByteBuffer window_handle, int x, int y); + + public static native void nGrabMouse(boolean grab); + + private native void nRegisterMouseListener(ByteBuffer window_handle); + + private native void nUnregisterMouseListener(ByteBuffer window_handle); + + private static native long nCreateCursor(int width, int height, int xHotspot, int yHotspot, int numImages, IntBuffer images, int images_offset, IntBuffer delays, int delays_offset) throws LWJGLException; + + private static native void nDestroyCursor(long cursor_handle); + + private static native void nSetCursor(long cursor_handle) throws LWJGLException; + + public synchronized void register() { + nRegisterMouseListener(window_handle); + } + + public static long createCursor(int width, int height, int xHotspot, int yHotspot, int numImages, IntBuffer images, IntBuffer delays) throws LWJGLException { + try { + return nCreateCursor(width, height, xHotspot, yHotspot, numImages, images, images.position(), delays, delays != null ? delays.position() : -1); + } catch (LWJGLException e) { + throw e; + } + } + + public static void destroyCursor(long cursor_handle) { + nDestroyCursor(cursor_handle); + } + + public static void setCursor(long cursor_handle) throws LWJGLException { + try { + nSetCursor(cursor_handle); + } catch (LWJGLException e) { + throw e; + } + } + + public synchronized void setCursorPosition(int x, int y) { + nSetCursorPosition(window_handle, x, y); + } + + public synchronized void unregister() { + nUnregisterMouseListener(window_handle); + } + + public synchronized void setGrabbed(boolean grabbed) { + this.grabbed = grabbed; + nGrabMouse(grabbed); + skip_event = 1; + accum_dx = accum_dy = 0; + } + + public synchronized boolean isGrabbed() { + return grabbed; + } + + protected void resetCursorToCenter() { + clearEvents(); + accum_dx = accum_dy = 0; + if (display != null) { + last_x = display.getWidth() / 2; + last_y = display.getHeight() / 2; + } + } + + private void putMouseEvent(byte button, byte state, int dz, long nanos) { + if (grabbed) + putMouseEventWithCoords(button, state, 0, 0, dz, nanos); + else + putMouseEventWithCoords(button, state, (int)last_x, (int)last_y, dz, nanos); + } + + protected void putMouseEventWithCoords(byte button, byte state, int coord1, int coord2, int dz, long nanos) { + event.clear(); + event.put(button).put(state).putInt(coord1).putInt(coord2).putInt(dz).putLong(nanos); + event.flip(); + putEvent(event); + } + + public synchronized void poll(IntBuffer coord_buffer, ByteBuffer buttons_buffer) { + if (grabbed) { + coord_buffer.put(0, (int)accum_dx); + coord_buffer.put(1, (int)accum_dy); + } else { + coord_buffer.put(0, (int)last_x); + coord_buffer.put(1, (int)last_y); + } + coord_buffer.put(2, accum_dz); + accum_dx = accum_dy = accum_dz = 0; + int old_position = buttons_buffer.position(); + buttons_buffer.put(buttons, 0, buttons.length); + buttons_buffer.position(old_position); + } + + private void setCursorPos(float x, float y, long nanos) { + if ( grabbed ) + return; + float dx = x - last_x; + float dy = y - last_y; + addDelta(dx, dy); + last_x = x; + last_y = y; + putMouseEventWithCoords((byte)-1, (byte)0, (int)x, (int)y, 0, nanos); + } + + protected void addDelta(float dx, float dy) { + accum_dx += dx; + accum_dy += -dy; + } + + public synchronized void setButton(int button, int state, long nanos) { + buttons[button] = (byte)state; + putMouseEvent((byte)button, (byte)state, 0, nanos); + } + + public synchronized void mouseMoved(float x, float y, float dx, float dy, float dz, long nanos) { + if (skip_event > 0) { + skip_event--; + if (skip_event == 0) { + last_x = x; + last_y = y; + } + return; + } + + if ( dz != 0 ) { // if scroll wheel event + // if no vertical wheel events, then map the horizontal wheel event to it + if (dy == 0) dy = dx; + + int wheel_amount = (int)(dy * WHEEL_SCALE); + accum_dz += wheel_amount; + putMouseEvent((byte)-1, (byte)0, wheel_amount, nanos); + } + else if (grabbed) { + if ( dx != 0 || dy != 0 ) { + putMouseEventWithCoords((byte)-1, (byte)0, (int)dx, (int)-dy, 0, nanos); + addDelta(dx, dy); + } + } else { + setCursorPos(x, y, nanos); + } + } +} diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/MacOSXPbufferPeerInfo.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/MacOSXPbufferPeerInfo.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/MacOSXPbufferPeerInfo.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/MacOSXPbufferPeerInfo.java 2016-04-09 16:26:56.000000000 +0000 @@ -38,12 +38,12 @@ /** * * @author elias_naur - * @version $Revision: 3116 $ - * $Id: MacOSXPbufferPeerInfo.java 3116 2008-08-19 16:46:03Z spasi $ + * @version $Revision$ + * $Id$ */ final class MacOSXPbufferPeerInfo extends MacOSXPeerInfo { - MacOSXPbufferPeerInfo(int width, int height, PixelFormat pixel_format) throws LWJGLException { - super(pixel_format, false, false, true, false); + MacOSXPbufferPeerInfo(int width, int height, PixelFormat pixel_format, ContextAttribs attribs) throws LWJGLException { + super(pixel_format, attribs, false, false, true, false); nCreate(getHandle(), width, height); } private static native void nCreate(ByteBuffer handle, int width, int height) throws LWJGLException; diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/MacOSXPeerInfo.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/MacOSXPeerInfo.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/MacOSXPeerInfo.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/MacOSXPeerInfo.java 2016-04-09 16:26:56.000000000 +0000 @@ -39,22 +39,25 @@ /** * * @author elias_naur - * @version $Revision: 3116 $ - * $Id: MacOSXPeerInfo.java 3116 2008-08-19 16:46:03Z spasi $ + * @version $Revision$ + * $Id$ */ abstract class MacOSXPeerInfo extends PeerInfo { - MacOSXPeerInfo(PixelFormat pixel_format, boolean use_display_bpp, boolean support_window, boolean support_pbuffer, boolean double_buffered) throws LWJGLException { + MacOSXPeerInfo(PixelFormat pixel_format, ContextAttribs attribs, boolean use_display_bpp, boolean support_window, boolean support_pbuffer, boolean double_buffered) throws LWJGLException { super(createHandle()); - if (pixel_format.isFloatingPoint() && !LWJGLUtil.isMacOSXEqualsOrBetterThan(10, 4)) - throw new LWJGLException("Floating point pixel format requested, but is not supported"); - choosePixelFormat(pixel_format, use_display_bpp, support_window, support_pbuffer, double_buffered); + + boolean gl32 = attribs != null && (3 < attribs.getMajorVersion() || (attribs.getMajorVersion() == 3 && 2 <= attribs.getMinorVersion())) && attribs.isProfileCore(); + if ( gl32 && !LWJGLUtil.isMacOSXEqualsOrBetterThan(10, 7) ) + throw new LWJGLException("OpenGL 3.2+ requested, but it requires MacOS X 10.7 or newer"); + + choosePixelFormat(pixel_format, gl32, use_display_bpp, support_window, support_pbuffer, double_buffered); } private static native ByteBuffer createHandle(); - private void choosePixelFormat(PixelFormat pixel_format, boolean use_display_bpp, boolean support_window, boolean support_pbuffer, boolean double_buffered) throws LWJGLException { - nChoosePixelFormat(getHandle(), pixel_format, use_display_bpp, support_window, support_pbuffer, double_buffered); + private void choosePixelFormat(PixelFormat pixel_format, boolean gl32, boolean use_display_bpp, boolean support_window, boolean support_pbuffer, boolean double_buffered) throws LWJGLException { + nChoosePixelFormat(getHandle(), pixel_format, gl32, use_display_bpp, support_window, support_pbuffer, double_buffered); } - private static native void nChoosePixelFormat(ByteBuffer peer_info_handle, PixelFormat pixel_format, boolean use_display_bpp, boolean support_window, boolean support_pbuffer, boolean double_buffered) throws LWJGLException; + private static native void nChoosePixelFormat(ByteBuffer peer_info_handle, PixelFormat pixel_format, boolean gl32, boolean use_display_bpp, boolean support_window, boolean support_pbuffer, boolean double_buffered) throws LWJGLException; public void destroy() { nDestroy(getHandle()); diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/MouseEventQueue.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/MouseEventQueue.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/MouseEventQueue.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/MouseEventQueue.java 2016-04-09 16:26:56.000000000 +0000 @@ -81,15 +81,19 @@ public synchronized void register() { resetCursorToCenter(); - component.addMouseListener(this); - component.addMouseMotionListener(this); - component.addMouseWheelListener(this); + if (component != null) { + component.addMouseListener(this); + component.addMouseMotionListener(this); + component.addMouseWheelListener(this); + } } public synchronized void unregister() { - component.removeMouseListener(this); - component.removeMouseMotionListener(this); - component.removeMouseWheelListener(this); + if (component != null) { + component.removeMouseListener(this); + component.removeMouseMotionListener(this); + component.removeMouseWheelListener(this); + } } protected Component getComponent() { @@ -105,18 +109,23 @@ return grabbed; } - private int transformY(int y) { - return component.getHeight() - 1 - y; + protected int transformY(int y) { + if (component != null) { + return component.getHeight() - 1 - y; + } + return y; } protected void resetCursorToCenter() { clearEvents(); accum_dx = accum_dy = 0; - Point cursor_location = AWTUtil.getCursorPosition(component); - if (cursor_location != null) { - last_x = cursor_location.x; - last_y = cursor_location.y; - } + if (component != null) { + Point cursor_location = AWTUtil.getCursorPosition(component); + if (cursor_location != null) { + last_x = cursor_location.x; + last_y = cursor_location.y; + } + } } private void putMouseEvent(byte button, byte state, int dz, long nanos) { diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/NVPresentVideoUtil.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/NVPresentVideoUtil.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/NVPresentVideoUtil.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/NVPresentVideoUtil.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,122 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package org.lwjgl.opengl; + +import org.lwjgl.BufferChecks; +import org.lwjgl.LWJGLUtil; + +import java.nio.ByteBuffer; +import java.nio.IntBuffer; +import java.nio.LongBuffer; + +/** + * This class exposes the platform specific functionality present in the + * NV_present_video extension. + * + * @author Spasi + * @since 20/5/2011 + */ +public final class NVPresentVideoUtil { + + private NVPresentVideoUtil() {} + + private static void checkExtension() { + if ( LWJGLUtil.CHECKS && !GLContext.getCapabilities().GL_NV_present_video ) + throw new IllegalStateException("NV_present_video is not supported"); + } + + private static ByteBuffer getPeerInfo() { + return ContextGL.getCurrentContext().getPeerInfo().getHandle(); + } + + /** + * Enumerate the available video output devices. This method is the cross-platform + * equivalent of glXEnumerateVideoDevicesNV and wglEnumerateVideoDevicesNV. Since they are + * not really compatible, this method works like the WGL version. That is, you first + * call it with a null devices buffer, get the number of devices, then call it again + * with an appropriately sized buffer. + * + * @param devices the buffer to store devices in + * + * @return the number of available video output devices + */ + public static int glEnumerateVideoDevicesNV(LongBuffer devices) { + checkExtension(); + + if ( devices != null ) + BufferChecks.checkBuffer(devices, 1); + return nglEnumerateVideoDevicesNV(getPeerInfo(), devices, devices == null ? 0 : devices.position()); + } + + private static native int nglEnumerateVideoDevicesNV(ByteBuffer peer_info, LongBuffer devices, int devices_position); + + /** + * Binds the video output device specified to one of the context's available video output slots. + * This method is the cross-platform equivalent of glXBindVideoDeviceNV and wglBindVideoDeviceNV. + * To release a video device without binding another device to the same slot, call it with + * video_device set to 0 (will use INVALID_HANDLE_VALUE on WGL). + * + * @param video_slot the video slot + * @param video_device the video device + * @param attrib_list the attributes to use + * + * @return true if the binding was successful + */ + public static boolean glBindVideoDeviceNV(int video_slot, long video_device, IntBuffer attrib_list) { + checkExtension(); + + if ( attrib_list != null ) + BufferChecks.checkNullTerminated(attrib_list); + return nglBindVideoDeviceNV(getPeerInfo(), video_slot, video_device, attrib_list, attrib_list == null ? 0 : attrib_list.position()); + } + + private static native boolean nglBindVideoDeviceNV(ByteBuffer peer_info, int video_slot, long video_device, IntBuffer attrib_list, int attrib_list_position); + + /** + * Queries an attribute associated with the current context. This method is the cross-platform + * equivalent of glXQueryContext and wglQueryCurrentContextNV. + * + * @param attrib the attribute to query + * @param value the buffer to store the value in + */ + public static boolean glQueryContextNV(int attrib, IntBuffer value) { + checkExtension(); + + BufferChecks.checkBuffer(value, 1); + ContextGL ctx = ContextGL.getCurrentContext(); + return nglQueryContextNV(ctx.getPeerInfo().getHandle(), ctx.getHandle(), attrib, value, value.position()); + } + + private static native boolean nglQueryContextNV(ByteBuffer peer_info, ByteBuffer context_handle, int attrib, IntBuffer value, int value_position); + +} diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/NVVideoCaptureUtil.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/NVVideoCaptureUtil.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/NVVideoCaptureUtil.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/NVVideoCaptureUtil.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,153 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package org.lwjgl.opengl; + +import org.lwjgl.BufferChecks; +import org.lwjgl.LWJGLUtil; + +import java.nio.ByteBuffer; +import java.nio.IntBuffer; +import java.nio.LongBuffer; + +/** + * This class exposes the platform specific functionality present in the + * NV_video_capture extension. + * + * @author Spasi + * @since 20/5/2011 + */ +public final class NVVideoCaptureUtil { + + private NVVideoCaptureUtil() {} + + private static void checkExtension() { + if ( LWJGLUtil.CHECKS && !GLContext.getCapabilities().GL_NV_video_capture ) + throw new IllegalStateException("NV_video_capture is not supported"); + } + + private static ByteBuffer getPeerInfo() { + return ContextGL.getCurrentContext().getPeerInfo().getHandle(); + } + + /** + * After successfully locking a video capture device, use this method to bind it + * to the capture slot specified in the current context. This method is the cross- + * platform equivalent of glXBindVideoCaptureDeviceNV and wglBindVideoCaptureDeviceNV. + * + * @param video_slot the video slot + * @param device the video capture device + * + * @return true if the binding was successful + */ + public static boolean glBindVideoCaptureDeviceNV(int video_slot, long device) { + checkExtension(); + return nglBindVideoCaptureDeviceNV(getPeerInfo(), video_slot, device); + } + + private static native boolean nglBindVideoCaptureDeviceNV(ByteBuffer peer_info, int video_slot, long device); + + /** + * Enumerate the available video capture devices. This method is the cross-platform + * equivalent of glXEnumerateVideoCaptureDevicesNV and wglEnumerateVideoCaptureDevicesNV. + * Since they are not really compatible, this method works like the WGL version. That is, + * you first call it with a null devices buffer, get the number of devices, then call it + * again with an appropriately sized buffer. + * + * @param devices the buffer to store devices in + * + * @return the number of available video capture devices + */ + public static int glEnumerateVideoCaptureDevicesNV(LongBuffer devices) { + checkExtension(); + + if ( devices != null ) + BufferChecks.checkBuffer(devices, 1); + return nglEnumerateVideoCaptureDevicesNV(getPeerInfo(), devices, devices == null ? 0 : devices.position()); + } + + private static native int nglEnumerateVideoCaptureDevicesNV(ByteBuffer peer_info, LongBuffer devices, int devices_position); + + /** + * To lock a video capture device to a display connection, use this method. + * Before using a video capture device, it must be locked. Once a + * video capture device is locked by a process, no other process can + * lock a video capture device with the same unique ID until the lock + * is released or the process ends. + * + * @param device the device to lock + * + * @return true if the lock was successful + */ + public static boolean glLockVideoCaptureDeviceNV(long device) { + checkExtension(); + return nglLockVideoCaptureDeviceNV(getPeerInfo(), device); + } + + private static native boolean nglLockVideoCaptureDeviceNV(ByteBuffer peer_info, long device); + + /** + * Use this method to query the unique ID of the physical device backing a + * video capture device handle. + * + * @param device the device + * @param attribute the attribute to query + * @param value the buffer to store the value in + * + * @return true if the query was successful + */ + public static boolean glQueryVideoCaptureDeviceNV(long device, int attribute, IntBuffer value) { + checkExtension(); + + BufferChecks.checkBuffer(value, 1); + return nglQueryVideoCaptureDeviceNV(getPeerInfo(), device, attribute, value, value.position()); + } + + private static native boolean nglQueryVideoCaptureDeviceNV(ByteBuffer peer_info, long device, int attribute, IntBuffer value, int value_position); + + /** + * Use this method when finished capturing data on a locked video capture device + * to unlock it. + * + * @param device the device + * + * @return true if the device was unlocked successfully + */ + public static boolean glReleaseVideoCaptureDeviceNV(long device) { + checkExtension(); + return nglReleaseVideoCaptureDeviceNV(getPeerInfo(), device); + } + + private static native boolean nglReleaseVideoCaptureDeviceNV(ByteBuffer peer_info, long device); + +} + diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/OpenGLException.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/OpenGLException.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/OpenGLException.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/OpenGLException.java 2016-04-09 16:26:56.000000000 +0000 @@ -36,8 +36,8 @@ * Thrown by the debug build library of the LWJGL if any OpenGL operation causes an error. * * @author cix_foo - * @version $Revision: 2983 $ - * $Id: OpenGLException.java 2983 2008-04-07 18:36:09Z matzon $ + * @version $Revision$ + * $Id$ */ public class OpenGLException extends RuntimeException { diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/Pbuffer.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/Pbuffer.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/Pbuffer.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/Pbuffer.java 2016-04-09 16:26:56.000000000 +0000 @@ -45,10 +45,10 @@ * This class is thread-safe. * * @author elias_naur - * @version $Revision: 3334 $ - * $Id: Pbuffer.java 3334 2010-04-22 23:21:48Z spasi $ + * @version $Revision$ + * $Id$ */ -public final class Pbuffer extends AbstractDrawable { +public final class Pbuffer extends DrawableGL { /** * Indicates that Pbuffers can be created. */ @@ -216,24 +216,24 @@ throw new NullPointerException("Pixel format must be non-null"); this.width = width; this.height = height; - this.peer_info = createPbuffer(width, height, pixel_format, renderTexture); - Context shared_context; + this.peer_info = createPbuffer(width, height, pixel_format, attribs, renderTexture); + Context shared_context = null; + if ( shared_drawable == null ) + shared_drawable = Display.getDrawable(); // May be null if (shared_drawable != null) shared_context = ((DrawableLWJGL)shared_drawable).getContext(); - else - shared_context = ((DrawableLWJGL)Display.getDrawable()).getContext(); // May be null - this.context = new Context(peer_info, attribs, shared_context); + this.context = new ContextGL(peer_info, attribs, (ContextGL)shared_context); } - private static PeerInfo createPbuffer(int width, int height, PixelFormat pixel_format, RenderTexture renderTexture) throws LWJGLException { + private static PeerInfo createPbuffer(int width, int height, PixelFormat pixel_format, ContextAttribs attribs, RenderTexture renderTexture) throws LWJGLException { if ( renderTexture == null ) { // Though null is a perfectly valid argument, Matrox Parhelia drivers expect // a 0 terminated list, or else they crash. Supplying NULL or 0, should // cause the drivers to use default settings IntBuffer defaultAttribs = BufferUtils.createIntBuffer(1); - return Display.getImplementation().createPbuffer(width, height, pixel_format, null, defaultAttribs); + return Display.getImplementation().createPbuffer(width, height, pixel_format, attribs, null, defaultAttribs); } else - return Display.getImplementation().createPbuffer(width, height, pixel_format, + return Display.getImplementation().createPbuffer(width, height, pixel_format, attribs, renderTexture.pixelFormatCaps, renderTexture.pBufferAttribs); } diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/PeerInfo.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/PeerInfo.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/PeerInfo.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/PeerInfo.java 2016-04-09 16:26:56.000000000 +0000 @@ -39,8 +39,8 @@ /** * * @author elias_naur - * @version $Revision: 3418 $ - * $Id: PeerInfo.java 3418 2010-09-28 21:11:35Z spasi $ + * @version $Revision$ + * $Id$ */ abstract class PeerInfo { private final ByteBuffer handle; diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/PixelFormat.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/PixelFormat.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/PixelFormat.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/PixelFormat.java 2016-04-09 16:26:56.000000000 +0000 @@ -38,17 +38,16 @@ *

    * Instants of this class are immutable. An example of the expected way to set * the PixelFormat property values is the following: - * PixelFormat pf = new PixelFormat().withDepth(24).withSamples(4).withSRGB(true); + * PixelFormat pf = new PixelFormat().withDepthBits(24).withSamples(4).withSRGB(true); *

    * WARNING: Some pixel formats are known to cause troubles on certain buggy drivers. * Example: Under Windows, specifying samples != 0 will enable the ARB * pixel format selection path, which could trigger a crash. * * @author elias_naur@sourceforge.net - * @version $Revision: 3355 $ + * @version $Revision$ */ - -public final class PixelFormat { +public final class PixelFormat implements PixelFormatLWJGL { /** * The number of bits per pixel, exluding alpha. diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/PixelFormatLWJGL.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/PixelFormatLWJGL.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/PixelFormatLWJGL.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/PixelFormatLWJGL.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +/** + * [INTERNAL USE ONLY] + * + * @author Spasi + */ +public interface PixelFormatLWJGL { + // Marker interface +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/SharedDrawable.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/SharedDrawable.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/SharedDrawable.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/SharedDrawable.java 2016-04-09 16:26:56.000000000 +0000 @@ -44,13 +44,13 @@ * * @author Spasi */ -public final class SharedDrawable extends AbstractDrawable { +public final class SharedDrawable extends DrawableGL { public SharedDrawable(final Drawable drawable) throws LWJGLException { - this.context = ((DrawableLWJGL)drawable).createSharedContext(); + this.context = (ContextGL)((DrawableLWJGL)drawable).createSharedContext(); } - public Context createSharedContext() { + public ContextGL createSharedContext() { throw new UnsupportedOperationException(); } diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/Sync.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/Sync.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/Sync.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/Sync.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,175 @@ +/* + * Copyright (c) 2002-2012 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +import org.lwjgl.Sys; + +/** +* A highly accurate sync method that continually adapts to the system +* it runs on to provide reliable results. +* +* @author Riven +* @author kappaOne +*/ +class Sync { + + /** number of nano seconds in a second */ + private static final long NANOS_IN_SECOND = 1000L * 1000L * 1000L; + + /** The time to sleep/yield until the next frame */ + private static long nextFrame = 0; + + /** whether the initialisation code has run */ + private static boolean initialised = false; + + /** for calculating the averages the previous sleep/yield times are stored */ + private static RunningAvg sleepDurations = new RunningAvg(10); + private static RunningAvg yieldDurations = new RunningAvg(10); + + + /** + * An accurate sync method that will attempt to run at a constant frame rate. + * It should be called once every frame. + * + * @param fps - the desired frame rate, in frames per second + */ + public static void sync(int fps) { + if (fps <= 0) return; + if (!initialised) initialise(); + + try { + // sleep until the average sleep time is greater than the time remaining till nextFrame + for (long t0 = getTime(), t1; (nextFrame - t0) > sleepDurations.avg(); t0 = t1) { + Thread.sleep(1); + sleepDurations.add((t1 = getTime()) - t0); // update average sleep time + } + + // slowly dampen sleep average if too high to avoid yielding too much + sleepDurations.dampenForLowResTicker(); + + // yield until the average yield time is greater than the time remaining till nextFrame + for (long t0 = getTime(), t1; (nextFrame - t0) > yieldDurations.avg(); t0 = t1) { + Thread.yield(); + yieldDurations.add((t1 = getTime()) - t0); // update average yield time + } + } catch (InterruptedException e) { + + } + + // schedule next frame, drop frame(s) if already too late for next frame + nextFrame = Math.max(nextFrame + NANOS_IN_SECOND / fps, getTime()); + } + + /** + * This method will initialise the sync method by setting initial + * values for sleepDurations/yieldDurations and nextFrame. + * + * If running on windows it will start the sleep timer fix. + */ + private static void initialise() { + initialised = true; + + sleepDurations.init(1000 * 1000); + yieldDurations.init((int) (-(getTime() - getTime()) * 1.333)); + + nextFrame = getTime(); + + String osName = System.getProperty("os.name"); + + if (osName.startsWith("Win")) { + // On windows the sleep functions can be highly inaccurate by + // over 10ms making in unusable. However it can be forced to + // be a bit more accurate by running a separate sleeping daemon + // thread. + Thread timerAccuracyThread = new Thread(new Runnable() { + public void run() { + try { + Thread.sleep(Long.MAX_VALUE); + } catch (Exception e) {} + } + }); + + timerAccuracyThread.setName("LWJGL Timer"); + timerAccuracyThread.setDaemon(true); + timerAccuracyThread.start(); + } + } + + /** + * Get the system time in nano seconds + * + * @return will return the current time in nano's + */ + private static long getTime() { + return (Sys.getTime() * NANOS_IN_SECOND) / Sys.getTimerResolution(); + } + + private static class RunningAvg { + private final long[] slots; + private int offset; + + private static final long DAMPEN_THRESHOLD = 10 * 1000L * 1000L; // 10ms + private static final float DAMPEN_FACTOR = 0.9f; // don't change: 0.9f is exactly right! + + public RunningAvg(int slotCount) { + this.slots = new long[slotCount]; + this.offset = 0; + } + + public void init(long value) { + while (this.offset < this.slots.length) { + this.slots[this.offset++] = value; + } + } + + public void add(long value) { + this.slots[this.offset++ % this.slots.length] = value; + this.offset %= this.slots.length; + } + + public long avg() { + long sum = 0; + for (int i = 0; i < this.slots.length; i++) { + sum += this.slots[i]; + } + return sum / this.slots.length; + } + + public void dampenForLowResTicker() { + if (this.avg() > DAMPEN_THRESHOLD) { + for (int i = 0; i < this.slots.length; i++) { + this.slots[i] *= DAMPEN_FACTOR; + } + } + } + } +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/Util.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/Util.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/Util.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/Util.java 2016-04-09 16:26:56.000000000 +0000 @@ -39,7 +39,7 @@ * Simple utility class. * * @author cix_foo - * @version $Revision: 3418 $ + * @version $Revision$ */ public final class Util { diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/WindowsAWTGLCanvasPeerInfo.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/WindowsAWTGLCanvasPeerInfo.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/WindowsAWTGLCanvasPeerInfo.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/WindowsAWTGLCanvasPeerInfo.java 2016-04-09 16:26:56.000000000 +0000 @@ -40,8 +40,8 @@ /** * * @author elias_naur - * @version $Revision: 3418 $ - * $Id: WindowsAWTGLCanvasPeerInfo.java 3418 2010-09-28 21:11:35Z spasi $ + * @version $Revision$ + * $Id$ */ final class WindowsAWTGLCanvasPeerInfo extends WindowsPeerInfo { private final Canvas component; diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/WindowsCanvasImplementation.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/WindowsCanvasImplementation.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/WindowsCanvasImplementation.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/WindowsCanvasImplementation.java 2016-04-09 16:26:56.000000000 +0000 @@ -44,8 +44,8 @@ /** * * @author elias_naur - * @version $Revision: 3418 $ - * $Id: WindowsCanvasImplementation.java 3418 2010-09-28 21:11:35Z spasi $ + * @version $Revision$ + * $Id$ */ final class WindowsCanvasImplementation implements AWTCanvasImplementation { static { @@ -66,7 +66,7 @@ }); } - public PeerInfo createPeerInfo(Canvas component, PixelFormat pixel_format) throws LWJGLException { + public PeerInfo createPeerInfo(Canvas component, PixelFormat pixel_format, ContextAttribs attribs) throws LWJGLException { return new WindowsAWTGLCanvasPeerInfo(component, pixel_format); } diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/WindowsContextAttribs.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/WindowsContextAttribs.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/WindowsContextAttribs.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/WindowsContextAttribs.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,92 +0,0 @@ -/* - * Copyright (c) 2002-2008 LWJGL Project - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of 'LWJGL' nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package org.lwjgl.opengl; - -/** - * An implementation of ContextAttribs using WGL_create_context. - * - * @author spasi - */ -final class WindowsContextAttribs implements ContextAttribsImplementation { - - private static final int WGL_CONTEXT_MAJOR_VERSION_ARB = 0x2091; - private static final int WGL_CONTEXT_MINOR_VERSION_ARB = 0x2092; - private static final int WGL_CONTEXT_LAYER_PLANE_ARB = 0x2093; - private static final int WGL_CONTEXT_FLAGS_ARB = 0x2094; - private static final int WGL_CONTEXT_PROFILE_MASK_ARB = 0x9126; - - private static final int WGL_CONTEXT_DEBUG_BIT_ARB = 0x0001; - private static final int WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB = 0x0002; - - private static final int WGL_CONTEXT_CORE_PROFILE_BIT_ARB = 0x00000001; - private static final int WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB = 0x00000002; - - WindowsContextAttribs() { - } - - public int getMajorVersionAttrib() { - return WGL_CONTEXT_MAJOR_VERSION_ARB; - } - - public int getMinorVersionAttrib() { - return WGL_CONTEXT_MINOR_VERSION_ARB; - } - - public int getLayerPlaneAttrib() { - return WGL_CONTEXT_LAYER_PLANE_ARB; - } - - public int getFlagsAttrib() { - return WGL_CONTEXT_FLAGS_ARB; - } - - public int getDebugBit() { - return WGL_CONTEXT_DEBUG_BIT_ARB; - } - - public int getForwardCompatibleBit() { - return WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB; - } - - public int getProfileMaskAttrib() { - return WGL_CONTEXT_PROFILE_MASK_ARB; - } - - public int getProfileCoreBit() { - return WGL_CONTEXT_CORE_PROFILE_BIT_ARB; - } - - public int getProfileCompatibilityBit() { - return WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB; - } - -} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/WindowsContextImplementation.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/WindowsContextImplementation.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/WindowsContextImplementation.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/WindowsContextImplementation.java 2016-04-09 16:26:56.000000000 +0000 @@ -39,8 +39,8 @@ /** * @author elias_naur - * @version $Revision: 3412 $ - * $Id: WindowsContextImplementation.java 3412 2010-09-26 23:43:24Z spasi $ + * @version $Revision$ + * $Id$ */ final class WindowsContextImplementation implements ContextImplementation { @@ -60,7 +60,7 @@ native long getHDC(ByteBuffer peer_info_handle); public void swapBuffers() throws LWJGLException { - Context current_context = Context.getCurrentContext(); + ContextGL current_context = ContextGL.getCurrentContext(); if ( current_context == null ) throw new IllegalStateException("No context is current"); synchronized ( current_context ) { diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/WindowsDisplay.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/WindowsDisplay.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/WindowsDisplay.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/WindowsDisplay.java 2016-04-09 16:26:56.000000000 +0000 @@ -38,21 +38,28 @@ * @author elias_naur */ -import java.nio.ByteBuffer; -import java.nio.FloatBuffer; -import java.nio.IntBuffer; -import java.awt.Canvas; +import java.awt.*; +import java.awt.event.FocusAdapter; +import java.awt.event.FocusEvent; +import java.lang.reflect.Method; +import java.nio.*; +import java.util.concurrent.atomic.AtomicBoolean; import org.lwjgl.LWJGLException; import org.lwjgl.LWJGLUtil; import org.lwjgl.BufferUtils; +import org.lwjgl.MemoryUtil; import org.lwjgl.input.Cursor; -import org.lwjgl.input.Keyboard; import org.lwjgl.input.Mouse; +import org.lwjgl.opengles.EGL; + +import javax.swing.*; final class WindowsDisplay implements DisplayImplementation { private static final int GAMMA_LENGTH = 256; + private static final int WM_WINDOWPOSCHANGED = 0x0047; + private static final int WM_MOVE = 0x0003; private static final int WM_CANCELMODE = 0x001F; private static final int WM_MOUSEMOVE = 0x0200; private static final int WM_LBUTTONDOWN = 0x0201; @@ -64,16 +71,25 @@ private static final int WM_MBUTTONDOWN = 0x0207; private static final int WM_MBUTTONUP = 0x0208; private static final int WM_MBUTTONDBLCLK = 0x0209; + private static final int WM_XBUTTONDOWN = 0x020B; + private static final int WM_XBUTTONUP = 0x020C; + private static final int WM_XBUTTONDBLCLK = 0x020D; private static final int WM_MOUSEWHEEL = 0x020A; private static final int WM_CAPTURECHANGED = 0x0215; - private static final int WM_MOUSELEAVE = 0x02A3; + private static final int WM_MOUSELEAVE = 0x02A3; + private static final int WM_ENTERSIZEMOVE = 0x0231; + private static final int WM_EXITSIZEMOVE = 0x0232; + private static final int WM_SIZING = 0x0214; private static final int WM_KEYDOWN = 256; private static final int WM_KEYUP = 257; private static final int WM_SYSKEYUP = 261; private static final int WM_SYSKEYDOWN = 260; private static final int WM_SYSCHAR = 262; private static final int WM_CHAR = 258; + private static final int WM_GETICON = 0x007F; private static final int WM_SETICON = 0x0080; + private static final int WM_SETCURSOR = 0x0020; + private static final int WM_MOUSEACTIVATE = 0x0021; private static final int WM_QUIT = 0x0012; private static final int WM_SYSCOMMAND = 0x0112; @@ -115,24 +131,54 @@ private static final int WA_INACTIVE = 0; private static final int WA_ACTIVE = 1; private static final int WA_CLICKACTIVE = 2; + private static final int SW_NORMAL = 1; private static final int SW_SHOWMINNOACTIVE = 7; private static final int SW_SHOWDEFAULT = 10; private static final int SW_RESTORE = 9; + private static final int SW_MAXIMIZE = 3; private static final int ICON_SMALL = 0; private static final int ICON_BIG = 1; private static final IntBuffer rect_buffer = BufferUtils.createIntBuffer(4); private static final Rect rect = new Rect(); - private static final Rect rect2 = new Rect(); + + private static final long HWND_TOP = 0; + private static final long HWND_BOTTOM = 1; + private static final long HWND_TOPMOST = -1; + private static final long HWND_NOTOPMOST = -2; + + private static final int SWP_NOSIZE = 0x0001; + private static final int SWP_NOMOVE = 0x0002; + private static final int SWP_NOZORDER = 0x0004; + private static final int SWP_FRAMECHANGED = 0x0020; + + private static final int GWL_STYLE = -16; + private static final int GWL_EXSTYLE = -20; + + private static final int WS_THICKFRAME = 0x00040000; + private static final int WS_MAXIMIZEBOX = 0x00010000; + + private static final int HTCLIENT = 0x01; + + private static final int MK_XBUTTON1 = 0x0020; + private static final int MK_XBUTTON2 = 0x0040; + private static final int XBUTTON1 = 0x0001; + private static final int XBUTTON2 = 0x0002; + private static WindowsDisplay current_display; private static boolean cursor_clipped; private WindowsDisplayPeerInfo peer_info; private Object current_cursor; - private Canvas parent; + private static boolean hasParent; + private Canvas parent; + private long parent_hwnd; + private FocusAdapter parent_focus_tracker; + private AtomicBoolean parent_focused; + private WindowsKeyboard keyboard; private WindowsMouse mouse; @@ -146,33 +192,47 @@ private boolean mode_set; private boolean isMinimized; private boolean isFocused; - private boolean did_maximize; + private boolean redoMakeContextCurrent; private boolean inAppActivate; + private boolean resized; + private boolean resizable; + private int x; + private int y; + private int width; + private int height; private long hwnd; private long hdc; private long small_icon; private long large_icon; + private boolean iconsLoaded; private int captureMouse = -1; - private boolean trackingMouse; private boolean mouseInside; + static { + try { + Method windowProc = WindowsDisplay.class.getDeclaredMethod("handleMessage", long.class, int.class, long.class, long.class, long.class); + setWindowProc(windowProc); + } catch (NoSuchMethodException e) { + throw new RuntimeException(e); + } + } + WindowsDisplay() { current_display = this; } - public void createWindow(DisplayMode mode, Canvas parent, int x, int y) throws LWJGLException { - close_requested = false; - is_dirty = false; - isMinimized = false; - isFocused = false; - did_maximize = false; + public void createWindow(DrawableLWJGL drawable, DisplayMode mode, Canvas parent, int x, int y) throws LWJGLException { this.parent = parent; hasParent = parent != null; - long parent_hwnd = parent != null ? getHwnd(parent) : 0; + parent_hwnd = parent != null ? getHwnd(parent) : 0; this.hwnd = nCreateWindow(x, y, mode.getWidth(), mode.getHeight(), Display.isFullscreen() || isUndecorated(), parent != null, parent_hwnd); + if ( Display.isResizable() && parent == null ) { + setResizable(true); + } + if (hwnd == 0) { throw new LWJGLException("Failed to create window"); } @@ -181,21 +241,51 @@ nDestroyWindow(hwnd); throw new LWJGLException("Failed to get dc"); } + try { - int format = WindowsPeerInfo.choosePixelFormat(getHdc(), 0, 0, peer_info.getPixelFormat(), null, true, true, false, true); - WindowsPeerInfo.setPixelFormat(getHdc(), format); + if ( drawable instanceof DrawableGL ) { + int format = WindowsPeerInfo.choosePixelFormat(getHdc(), 0, 0, (PixelFormat)drawable.getPixelFormat(), null, true, true, false, true); + WindowsPeerInfo.setPixelFormat(getHdc(), format); + } else { + peer_info = new WindowsDisplayPeerInfo(true); + ((DrawableGLES)drawable).initialize(hwnd, hdc, EGL.EGL_WINDOW_BIT, (org.lwjgl.opengles.PixelFormat)drawable.getPixelFormat()); + } peer_info.initDC(getHwnd(), getHdc()); showWindow(getHwnd(), SW_SHOWDEFAULT); - if (parent == null) { + + updateWidthAndHeight(); + + if ( parent == null ) { setForegroundWindow(getHwnd()); - setFocus(getHwnd()); + } else { + parent_focused = new AtomicBoolean(false); + parent.addFocusListener(parent_focus_tracker = new FocusAdapter() { + public void focusGained(FocusEvent e) { + parent_focused.set(true); + clearAWTFocus(); + } + }); + SwingUtilities.invokeLater(new Runnable() { + public void run() { + clearAWTFocus(); + } + }); } + grabFocus(); } catch (LWJGLException e) { nReleaseDC(hwnd, hdc); nDestroyWindow(hwnd); throw e; } } + + private void updateWidthAndHeight() { + getClientRect(hwnd, rect_buffer); + rect.copyFromBuffer(rect_buffer); + width = rect.right - rect.left; + height = rect.bottom - rect.top; + } + private static native long nCreateWindow(int x, int y, int width, int height, boolean undecorated, boolean child_window, long parent_hwnd) throws LWJGLException; private static boolean isUndecorated() { @@ -204,7 +294,7 @@ private static long getHwnd(Canvas parent) throws LWJGLException { AWTCanvasImplementation awt_impl = AWTGLCanvas.createImplementation(); - WindowsPeerInfo parent_peer_info = (WindowsPeerInfo)awt_impl.createPeerInfo(parent, null); + WindowsPeerInfo parent_peer_info = (WindowsPeerInfo)awt_impl.createPeerInfo(parent, null, null); ByteBuffer parent_peer_info_handle = parent_peer_info.lockAndGetHandle(); try { return parent_peer_info.getHwnd(); @@ -214,11 +304,24 @@ } public void destroyWindow() { + if ( parent != null ) { + parent.removeFocusListener(parent_focus_tracker); + parent_focus_tracker = null; + } + nReleaseDC(hwnd, hdc); nDestroyWindow(hwnd); freeLargeIcon(); freeSmallIcon(); resetCursorClipping(); + + // reset state + close_requested = false; + is_dirty = false; + isMinimized = false; + isFocused = false; + redoMakeContextCurrent = false; + mouseInside = false; } private static native void nReleaseDC(long hwnd, long hdc); private static native void nDestroyWindow(long hwnd); @@ -261,7 +364,7 @@ /* * Called when the application is alt-tabbed to or from */ - private void appActivate(boolean active) { + private void appActivate(boolean active, long millis) { if (inAppActivate) { return; } @@ -272,18 +375,21 @@ restoreDisplayMode(); } if (parent == null) { - showWindow(getHwnd(), SW_RESTORE); setForegroundWindow(getHwnd()); - setFocus(getHwnd()); } - did_maximize = true; + setFocus(getHwnd()); + redoMakeContextCurrent = true; if (Display.isFullscreen()) updateClipping(); - } else if (Display.isFullscreen()) { - showWindow(getHwnd(), SW_SHOWMINNOACTIVE); - resetDisplayMode(); - } else - updateClipping(); + } else { + if ( keyboard != null ) + keyboard.releaseAll(millis); + if ( Display.isFullscreen() ) { + showWindow(getHwnd(), SW_SHOWMINNOACTIVE); + resetDisplayMode(); + } else + updateClipping(); + } updateCursor(); inAppActivate = false; } @@ -291,6 +397,26 @@ private static native void setForegroundWindow(long hwnd); private static native void setFocus(long hwnd); + private void clearAWTFocus() { + // This is needed so that the last focused component AWT remembers is NOT our Canvas + WindowsDisplay.this.parent.setFocusable(false); + WindowsDisplay.this.parent.setFocusable(true); + + // Clear AWT focus owner + KeyboardFocusManager.getCurrentKeyboardFocusManager().clearGlobalFocusOwner(); + } + + private void grabFocus() { + if ( parent == null ) + setFocus(getHwnd()); + else + SwingUtilities.invokeLater(new Runnable() { + public void run() { + parent.requestFocus(); + } + }); + } + private void restoreDisplayMode() { try { doSetGammaRamp(current_gamma); @@ -395,9 +521,10 @@ private static native DisplayMode getCurrentDisplayMode() throws LWJGLException; public void setTitle(String title) { - nSetTitle(hwnd, title); + ByteBuffer buffer = MemoryUtil.encodeUTF16(title); + nSetTitle(hwnd, MemoryUtil.getAddress0(buffer)); } - private static native void nSetTitle(long hwnd, String title); + private static native void nSetTitle(long hwnd, long title); public boolean isCloseRequested() { boolean saved = close_requested; @@ -419,18 +546,20 @@ return saved; } - public PeerInfo createPeerInfo(PixelFormat pixel_format) throws LWJGLException { - peer_info = new WindowsDisplayPeerInfo(pixel_format); + public PeerInfo createPeerInfo(PixelFormat pixel_format, ContextAttribs attribs) throws LWJGLException { + peer_info = new WindowsDisplayPeerInfo(false); return peer_info; } public void update() { nUpdate(); - if (parent != null && parent.isFocusOwner()) { + + if ( !isFocused && parent != null && parent_focused.compareAndSet(true, false) ) { setFocus(getHwnd()); } - if (did_maximize) { - did_maximize = false; + + if (redoMakeContextCurrent) { + redoMakeContextCurrent = false; /** * WORKAROUND: * Making the context current (redundantly) when the window @@ -473,7 +602,7 @@ } public void pollMouse(IntBuffer coord_buffer, ByteBuffer buttons) { - mouse.poll(coord_buffer, buttons); + mouse.poll(coord_buffer, buttons, this); } public void readMouse(ByteBuffer buffer) { @@ -565,11 +694,10 @@ /* Keyboard */ public void createKeyboard() throws LWJGLException { - keyboard = new WindowsKeyboard(getHwnd()); + keyboard = new WindowsKeyboard(); } public void destroyKeyboard() { - keyboard.destroy(); keyboard = null; } @@ -613,7 +741,7 @@ return ((WindowsPbufferPeerInfo)handle).isBufferLost(); } - public PeerInfo createPbuffer(int width, int height, PixelFormat pixel_format, + public PeerInfo createPbuffer(int width, int height, PixelFormat pixel_format, ContextAttribs attribs, IntBuffer pixelFormatCaps, IntBuffer pBufferAttribs) throws LWJGLException { return new WindowsPbufferPeerInfo(width, height, pixel_format, pixelFormatCaps, pBufferAttribs); @@ -668,18 +796,37 @@ int size = icon.limit() / 4; if ( (((int)Math.sqrt(size)) == small_icon_size) && (!done_small) ) { + long small_new_icon = createIcon(small_icon_size, small_icon_size, icon.asIntBuffer()); + sendMessage(hwnd, WM_SETICON, ICON_SMALL, small_new_icon); freeSmallIcon(); - small_icon = createIcon(small_icon_size, small_icon_size, icon.asIntBuffer()); - sendMessage(hwnd, WM_SETICON, ICON_SMALL, small_icon); + small_icon = small_new_icon; used++; done_small = true; } if ( (((int)Math.sqrt(size)) == large_icon_size) && (!done_large) ) { + long large_new_icon = createIcon(large_icon_size, large_icon_size, icon.asIntBuffer()); + sendMessage(hwnd, WM_SETICON, ICON_BIG, large_new_icon); freeLargeIcon(); - large_icon = createIcon(large_icon_size, large_icon_size, icon.asIntBuffer()); - sendMessage(hwnd, WM_SETICON, ICON_BIG, large_icon); + large_icon = large_new_icon; used++; done_large = true; + + // Problem: The taskbar icon won't update until Windows sends a WM_GETICON to our window proc and we reply. But this method is usually called + // on init and it might take a while before the next call to nUpdate (because of resources being loaded, etc). So we wait for the next + // WM_GETICON message (usually received about 100ms after WM_SETICON) to make sure the taskbar icon has updated before we return to the user. + // (We wouldn't need to do this if the event loop was running continuously on its own thread.) + iconsLoaded = false; + + // Track how long the wait takes and give up at 500ms, just in case. + long time = System.nanoTime(); + long MAX_WAIT = 500L * 1000L * 1000L; + while ( true ) { + nUpdate(); + if ( iconsLoaded || MAX_WAIT < System.nanoTime() - time ) + break; + + Thread.yield(); + } } } @@ -688,6 +835,9 @@ private static native long createIcon(int width, int height, IntBuffer icon); private static native void destroyIcon(long handle); private static native long sendMessage(long hwnd, long msg, long wparam, long lparam); + private static native long setWindowLongPtr(long hwnd, int nindex, long longPtr); + private static native long getWindowLongPtr(long hwnd, int nindex); + private static native boolean setWindowPos(long hwnd, long hwnd_after, int x, int y, int cx, int cy, long uflags); private void handleMouseButton(int button, int state, long millis) { if (mouse != null) { @@ -705,22 +855,12 @@ nReleaseCapture(); } } - - if (parent != null && !isFocused) { - setFocus(getHwnd()); - } } private boolean shouldGrab() { return !isMinimized && isFocused && Mouse.isGrabbed(); } - private void handleMouseMoved(int x, int y, long millis) { - if (mouse != null) { - mouse.handleMouseMoved(x, y, millis, shouldGrab()); - } - } - private static native long nSetCapture(long hwnd); private static native boolean nReleaseCapture(); @@ -736,18 +876,20 @@ byte state = (byte)(1 - ((lParam >>> 31) & 0x1)); boolean repeat = state == previous_state; if (keyboard != null) - keyboard.handleChar((int)(wParam & 0xFF), millis, repeat); + keyboard.handleChar((int)(wParam & 0xFFFF), millis, repeat); } private void handleKeyButton(long wParam, long lParam, long millis) { + if ( keyboard == null ) + return; + byte previous_state = (byte)((lParam >>> 30) & 0x1); byte state = (byte)(1 - ((lParam >>> 31) & 0x1)); boolean repeat = state == previous_state; // Repeat message byte extended = (byte)((lParam >>> 24) & 0x1); int scan_code = (int)((lParam >>> 16) & 0xFF); - if (keyboard != null) { - keyboard.handleKey((int)wParam, scan_code, extended != 0, state, millis, repeat); - } + + keyboard.handleKey((int)wParam, scan_code, extended != 0, state, millis, repeat); } private static int transformY(long hwnd, int y) { @@ -758,18 +900,16 @@ private static native void clientToScreen(long hwnd, IntBuffer point); - private static int handleMessage(long hwnd, int msg, long wParam, long lParam, long millis) { + private static native void setWindowProc(Method windowProc); + + private static long handleMessage(long hwnd, int msg, long wParam, long lParam, long millis) { if (current_display != null) return current_display.doHandleMessage(hwnd, msg, wParam, lParam, millis); else return defWindowProc(hwnd, msg, wParam, lParam); } - private static native int defWindowProc(long hwnd, int msg, long wParam, long lParam); - - private void checkCursorState() { - updateClipping(); - } + private static native long defWindowProc(long hwnd, int msg, long wParam, long lParam); private void updateClipping() { if ((Display.isFullscreen() || (mouse != null && mouse.isGrabbed())) && !isMinimized && isFocused && (getForegroundWindow() == getHwnd() || hasParent)) { @@ -784,15 +924,37 @@ } private void setMinimized(boolean m) { - isMinimized = m; - checkCursorState(); + if ( m != isMinimized ) { + isMinimized = m; + updateClipping(); + } } - private int doHandleMessage(long hwnd, int msg, long wParam, long lParam, long millis) { + private long doHandleMessage(long hwnd, int msg, long wParam, long lParam, long millis) { + /*switch ( msg ) { + case 0x0: + case 0x0020: + case 0x0084: + case WM_MOUSEMOVE: + break; + default: + WindowsEventDebug.printMessage(msg, wParam, lParam); + }*/ + + if ( parent != null && !isFocused ) { + switch ( msg ) { + case WM_LBUTTONDOWN: + case WM_RBUTTONDOWN: + case WM_MBUTTONDOWN: + case WM_XBUTTONDOWN: + sendMessage(parent_hwnd, msg, wParam, lParam); + } + } + switch (msg) { // disable screen saver and monitor power down messages which wreak havoc case WM_ACTIVATE: - switch ((int)wParam) { + /*switch ((int)wParam) { case WA_ACTIVE: case WA_CLICKACTIVE: appActivate(true); @@ -800,62 +962,106 @@ case WA_INACTIVE: appActivate(false); break; - } - return 0; + }*/ + return 0L; case WM_SIZE: switch ((int)wParam) { case SIZE_RESTORED: case SIZE_MAXIMIZED: + resized = true; + updateWidthAndHeight(); setMinimized(false); break; case SIZE_MINIMIZED: setMinimized(true); break; } - return defWindowProc(hwnd, msg, wParam, lParam); + break; + case WM_SIZING: + resized = true; + updateWidthAndHeight(); + break; + case WM_SETCURSOR: + if((lParam & 0xFFFF) == HTCLIENT) { + // if the cursor is inside the client area, reset it + // to the current LWJGL-cursor + updateCursor(); + return -1; //TRUE + } else { + // let Windows handle cursors outside the client area for resizing, etc. + return defWindowProc(hwnd, msg, wParam, lParam); + } case WM_KILLFOCUS: - appActivate(false); - return 0; + appActivate(false, millis); + return 0L; case WM_SETFOCUS: - appActivate(true); - return 0; + appActivate(true, millis); + return 0L; + case WM_MOUSEACTIVATE: + if ( parent != null ) { + if ( !isFocused ) + grabFocus(); + return 3L; // MA_NOACTIVATE + } + break; case WM_MOUSEMOVE: - int xPos = (int)(short)(lParam & 0xFFFF); - int yPos = transformY(getHwnd(), (int)(short)((lParam >> 16) & 0xFFFF)); - handleMouseMoved(xPos, yPos, millis); - checkCursorState(); - mouseInside = true; - if(!trackingMouse) { - trackingMouse = nTrackMouseEvent(hwnd); - } - return 0; + if ( mouse != null ) { + int xPos = (short)(lParam & 0xFFFF); + int yPos = transformY(getHwnd(), (short)(lParam >>> 16)); + mouse.handleMouseMoved(xPos, yPos, millis); + } + if ( !mouseInside ) { + mouseInside = true; + updateClipping(); + nTrackMouseEvent(hwnd); + } + return 0L; case WM_MOUSEWHEEL: int dwheel = (int)(short)((wParam >> 16) & 0xFFFF); handleMouseScrolled(dwheel, millis); - return 0; + return 0L; case WM_LBUTTONDOWN: handleMouseButton(0, 1, millis); - return 0; + return 0L; case WM_LBUTTONUP: handleMouseButton(0, 0, millis); - return 0; + return 0L; case WM_RBUTTONDOWN: handleMouseButton(1, 1, millis); - return 0; + return 0L; case WM_RBUTTONUP: handleMouseButton(1, 0, millis); - return 0; + return 0L; case WM_MBUTTONDOWN: handleMouseButton(2, 1, millis); - return 0; + return 0L; case WM_MBUTTONUP: handleMouseButton(2, 0, millis); - return 0; + return 0L; + case WM_XBUTTONUP: + if((wParam >> 16) == XBUTTON1) { + handleMouseButton(3, 0, millis); + } else { + handleMouseButton(4, 0, millis); + } + return 1; + case WM_XBUTTONDOWN: + if((wParam & 0xFF) == MK_XBUTTON1) { + handleMouseButton(3, 1, millis); + } else { + handleMouseButton(4, 1, millis); + } + return 1; case WM_SYSCHAR: case WM_CHAR: handleChar(wParam, lParam, millis); - return 0; + return 0L; case WM_SYSKEYUP: + // Disable WM_SYSCOMMAND/SC_KEYMENU + if ( wParam == WindowsKeycodes.VK_MENU || wParam == WindowsKeycodes.VK_F10 ) { + handleKeyButton(wParam, lParam, millis); + return 0L; + } /* Fall through */ case WM_KEYUP: // SysRq apparently only generates WM_KEYUP, so we'll fake a WM_KEYDOWN @@ -872,31 +1078,26 @@ /* Fall through */ case WM_KEYDOWN: handleKeyButton(wParam, lParam, millis); - return defWindowProc(hwnd, msg, wParam, lParam); + break; case WM_QUIT: close_requested = true; - return 0; + return 0L; case WM_SYSCOMMAND: switch ((int)(wParam & 0xfff0)) { - case SC_KEYMENU: - case SC_MOUSEMENU: case SC_SCREENSAVE: case SC_MONITORPOWER: - return 0; + return 0L; case SC_CLOSE: close_requested = true; - return 0; - default: - break; + return 0L; } - return defWindowProc(hwnd, msg, wParam, lParam); + break; case WM_PAINT: is_dirty = true; - return defWindowProc(hwnd, msg, wParam, lParam); - case WM_MOUSELEAVE: - mouseInside = false; - trackingMouse = false; - return defWindowProc(hwnd, msg, wParam, lParam); + break; + case WM_MOUSELEAVE: + mouseInside = false; + break; case WM_CANCELMODE: nReleaseCapture(); /* fall through */ @@ -905,68 +1106,140 @@ handleMouseButton(captureMouse, 0, millis); captureMouse = -1; } - return 0; - default: - return defWindowProc(hwnd, msg, wParam, lParam); + return 0L; + case WM_WINDOWPOSCHANGED: + if(getWindowRect(hwnd, rect_buffer)) { + rect.copyFromBuffer(rect_buffer); + x = rect.left; + y = rect.top; + } else { + LWJGLUtil.log("WM_WINDOWPOSCHANGED: Unable to get window rect"); + } + break; + case WM_GETICON: + iconsLoaded = true; + break; } + + return defWindowProc(hwnd, msg, wParam, lParam); + } + + private native boolean getWindowRect(long hwnd, IntBuffer rectBuffer); + + public int getX() { + return x; + } + + public int getY() { + return y; } public int getWidth() { - return Display.getDisplayMode().getWidth(); + return width; } public int getHeight() { - return Display.getDisplayMode().getHeight(); + return height; } - private int firstMouseButtonDown() { - for(int i=0; i - * @version $Revision: 3116 $ - * $Id: WindowsDisplayPeerInfo.java 3116 2008-08-19 16:46:03Z spasi $ + * @version $Revision$ + * $Id$ */ final class WindowsDisplayPeerInfo extends WindowsPeerInfo { - private final PixelFormat pixel_format; - WindowsDisplayPeerInfo(PixelFormat pixel_format) throws LWJGLException { - this.pixel_format = pixel_format; - GLContext.loadOpenGLLibrary(); - } + final boolean egl; + + WindowsDisplayPeerInfo(boolean egl) throws LWJGLException { + this.egl = egl; - PixelFormat getPixelFormat() { - return pixel_format; + if ( egl) + org.lwjgl.opengles.GLContext.loadOpenGLLibrary(); + else + GLContext.loadOpenGLLibrary(); } void initDC(long hwnd, long hdc) throws LWJGLException { @@ -68,6 +69,10 @@ public void destroy() { super.destroy(); - GLContext.unloadOpenGLLibrary(); + + if ( egl ) + org.lwjgl.opengles.GLContext.unloadOpenGLLibrary(); + else + GLContext.unloadOpenGLLibrary(); } } diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/WindowsEventDebug.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/WindowsEventDebug.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/WindowsEventDebug.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/WindowsEventDebug.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,483 @@ +package org.lwjgl.opengl; + +import org.lwjgl.LWJGLUtil; + +final class WindowsEventDebug { + + private WindowsEventDebug() { + } + + static int printMessage(String msg, long wParam, long lParam) { + System.out.println(msg + ": 0x" + Long.toHexString(wParam).toUpperCase() + " | " + Long.toHexString(lParam).toUpperCase()); + return 0; + } + + static int printMessage(int msg, long wParam, long lParam) { + System.out.print(LWJGLUtil.toHexString(msg) + ": "); + switch ( msg ) { + case 0x0000: + return printMessage("WM_NULL", wParam, lParam); + case 0x0001: + return printMessage("WM_CREATE", wParam, lParam); + case 0x0002: + return printMessage("WM_DESTROY", wParam, lParam); + case 0x0003: + return printMessage("WM_MOVE", wParam, lParam); + case 0x0005: + return printMessage("WM_SIZE", wParam, lParam); + case 0x0006: + return printMessage("WM_ACTIVATE", wParam, lParam); + case 0x0007: + return printMessage("WM_SETFOCUS", wParam, lParam); + case 0x0008: + return printMessage("WM_KILLFOCUS", wParam, lParam); + case 0x000A: + return printMessage("WM_ENABLE", wParam, lParam); + case 0x000B: + return printMessage("WM_SETREDRAW", wParam, lParam); + case 0x000C: + return printMessage("WM_SETTEXT", wParam, lParam); + case 0x000D: + return printMessage("WM_GETTEXT", wParam, lParam); + case 0x000E: + return printMessage("WM_GETTEXTLENGTH", wParam, lParam); + case 0x000F: + return printMessage("WM_PAINT", wParam, lParam); + case 0x0010: + return printMessage("WM_CLOSE", wParam, lParam); + case 0x0011: + return printMessage("WM_QUERYENDSESSION", wParam, lParam); + case 0x0013: + return printMessage("WM_QUERYOPEN", wParam, lParam); + case 0x0016: + return printMessage("WM_ENDSESSION", wParam, lParam); + case 0x0012: + return printMessage("WM_QUIT", wParam, lParam); + case 0x0014: + return printMessage("WM_ERASEBKGND", wParam, lParam); + case 0x0015: + return printMessage("WM_SYSCOLORCHANGE", wParam, lParam); + case 0x0018: + return printMessage("WM_SHOWWINDOW", wParam, lParam); + case 0x001A: + return printMessage("WM_WININICHANGE", wParam, lParam); + case 0x001B: + return printMessage("WM_DEVMODECHANGE", wParam, lParam); + case 0x001C: + return printMessage("WM_ACTIVATEAPP", wParam, lParam); + case 0x001D: + return printMessage("WM_FONTCHANGE", wParam, lParam); + case 0x001E: + return printMessage("WM_TIMECHANGE", wParam, lParam); + case 0x001F: + return printMessage("WM_CANCELMODE", wParam, lParam); + case 0x0020: + return printMessage("WM_SETCURSOR", wParam, lParam); + case 0x0021: + return printMessage("WM_MOUSEACTIVATE", wParam, lParam); + case 0x0022: + return printMessage("WM_CHILDACTIVATE", wParam, lParam); + case 0x0023: + return printMessage("WM_QUEUESYNC", wParam, lParam); + case 0x0024: + return printMessage("WM_GETMINMAXINFO", wParam, lParam); + case 0x0026: + return printMessage("WM_PAINTICON", wParam, lParam); + case 0x0027: + return printMessage("WM_ICONERASEBKGND", wParam, lParam); + case 0x0028: + return printMessage("WM_NEXTDLGCTL", wParam, lParam); + case 0x002A: + return printMessage("WM_SPOOLERSTATUS", wParam, lParam); + case 0x002B: + return printMessage("WM_DRAWITEM", wParam, lParam); + case 0x002C: + return printMessage("WM_MEASUREITEM", wParam, lParam); + case 0x002D: + return printMessage("WM_DELETEITEM", wParam, lParam); + case 0x002E: + return printMessage("WM_VKEYTOITEM", wParam, lParam); + case 0x002F: + return printMessage("WM_CHARTOITEM", wParam, lParam); + case 0x0030: + return printMessage("WM_SETFONT", wParam, lParam); + case 0x0031: + return printMessage("WM_GETFONT", wParam, lParam); + case 0x0032: + return printMessage("WM_SETHOTKEY", wParam, lParam); + case 0x0033: + return printMessage("WM_GETHOTKEY", wParam, lParam); + case 0x0037: + return printMessage("WM_QUERYDRAGICON", wParam, lParam); + case 0x0039: + return printMessage("WM_COMPAREITEM", wParam, lParam); + case 0x003D: + return printMessage("WM_GETOBJECT", wParam, lParam); + case 0x0041: + return printMessage("WM_COMPACTING", wParam, lParam); + case 0x0044: + return printMessage("WM_COMMNOTIFY", wParam, lParam); + case 0x0046: + return printMessage("WM_WINDOWPOSCHANGING", wParam, lParam); + case 0x0047: + return printMessage("WM_WINDOWPOSCHANGED", wParam, lParam); + case 0x0048: + return printMessage("WM_POWER", wParam, lParam); + case 0x004A: + return printMessage("WM_COPYDATA", wParam, lParam); + case 0x004B: + return printMessage("WM_CANCELJOURNAL", wParam, lParam); + case 0x004E: + return printMessage("WM_NOTIFY", wParam, lParam); + case 0x0050: + return printMessage("WM_INPUTLANGCHANGEREQUEST", wParam, lParam); + case 0x0051: + return printMessage("WM_INPUTLANGCHANGE", wParam, lParam); + case 0x0052: + return printMessage("WM_TCARD", wParam, lParam); + case 0x0053: + return printMessage("WM_HELP", wParam, lParam); + case 0x0054: + return printMessage("WM_USERCHANGED", wParam, lParam); + case 0x0055: + return printMessage("WM_NOTIFYFORMAT", wParam, lParam); + case 0x007B: + return printMessage("WM_CONTEXTMENU", wParam, lParam); + case 0x007C: + return printMessage("WM_STYLECHANGING", wParam, lParam); + case 0x007D: + return printMessage("WM_STYLECHANGED", wParam, lParam); + case 0x007E: + return printMessage("WM_DISPLAYCHANGE", wParam, lParam); + case 0x007F: + return printMessage("WM_GETICON", wParam, lParam); + case 0x0080: + return printMessage("WM_SETICON", wParam, lParam); + case 0x0081: + return printMessage("WM_NCCREATE", wParam, lParam); + case 0x0082: + return printMessage("WM_NCDESTROY", wParam, lParam); + case 0x0083: + return printMessage("WM_NCCALCSIZE", wParam, lParam); + case 0x0084: + return printMessage("WM_NCHITTEST", wParam, lParam); + case 0x0085: + return printMessage("WM_NCPAINT", wParam, lParam); + case 0x0086: + return printMessage("WM_NCACTIVATE", wParam, lParam); + case 0x0087: + return printMessage("WM_GETDLGCODE", wParam, lParam); + case 0x0088: + return printMessage("WM_SYNCPAINT", wParam, lParam); + case 0x00A0: + return printMessage("WM_NCMOUSEMOVE", wParam, lParam); + case 0x00A1: + return printMessage("WM_NCLBUTTONDOWN", wParam, lParam); + case 0x00A2: + return printMessage("WM_NCLBUTTONUP", wParam, lParam); + case 0x00A3: + return printMessage("WM_NCLBUTTONDBLCLK", wParam, lParam); + case 0x00A4: + return printMessage("WM_NCRBUTTONDOWN", wParam, lParam); + case 0x00A5: + return printMessage("WM_NCRBUTTONUP", wParam, lParam); + case 0x00A6: + return printMessage("WM_NCRBUTTONDBLCLK", wParam, lParam); + case 0x00A7: + return printMessage("WM_NCMBUTTONDOWN", wParam, lParam); + case 0x00A8: + return printMessage("WM_NCMBUTTONUP", wParam, lParam); + case 0x00A9: + return printMessage("WM_NCMBUTTONDBLCLK", wParam, lParam); + case 0x00AB: + return printMessage("WM_NCXBUTTONDOWN", wParam, lParam); + case 0x00AC: + return printMessage("WM_NCXBUTTONUP", wParam, lParam); + case 0x00AD: + return printMessage("WM_NCXBUTTONDBLCLK", wParam, lParam); + case 0x00FE: + return printMessage("WM_INPUT_DEVICE_CHANGE", wParam, lParam); + case 0x00FF: + return printMessage("WM_INPUT", wParam, lParam); + case 0x0100: + return printMessage("WM_KEYDOWN", wParam, lParam); + case 0x0101: + return printMessage("WM_KEYUP", wParam, lParam); + case 0x0102: + return printMessage("WM_CHAR", wParam, lParam); + case 0x0103: + return printMessage("WM_DEADCHAR", wParam, lParam); + case 0x0104: + return printMessage("WM_SYSKEYDOWN", wParam, lParam); + case 0x0105: + return printMessage("WM_SYSKEYUP", wParam, lParam); + case 0x0106: + return printMessage("WM_SYSCHAR", wParam, lParam); + case 0x0107: + return printMessage("WM_SYSDEADCHAR", wParam, lParam); + case 0x0109: + return printMessage("WM_UNICHAR", wParam, lParam); + case 0xFFFF: + return printMessage("UNICODE_NOCHAR", wParam, lParam); + case 0x0108: + return printMessage("WM_KEYLAST", wParam, lParam); + case 0x010D: + return printMessage("WM_IME_STARTCOMPOSITION", wParam, lParam); + case 0x010E: + return printMessage("WM_IME_ENDCOMPOSITION", wParam, lParam); + case 0x010F: + return printMessage("WM_IME_COMPOSITION", wParam, lParam); + case 0x0110: + return printMessage("WM_INITDIALOG", wParam, lParam); + case 0x0111: + return printMessage("WM_COMMAND", wParam, lParam); + case 0x0112: + return printMessage("WM_SYSCOMMAND", wParam, lParam); + case 0x0113: + return printMessage("WM_TIMER", wParam, lParam); + case 0x0114: + return printMessage("WM_HSCROLL", wParam, lParam); + case 0x0115: + return printMessage("WM_VSCROLL", wParam, lParam); + case 0x0116: + return printMessage("WM_INITMENU", wParam, lParam); + case 0x0117: + return printMessage("WM_INITMENUPOPUP", wParam, lParam); + case 0x0119: + return printMessage("WM_GESTURE", wParam, lParam); + case 0x011A: + return printMessage("WM_GESTURENOTIFY", wParam, lParam); + case 0x011F: + return printMessage("WM_MENUSELECT", wParam, lParam); + case 0x0120: + return printMessage("WM_MENUCHAR", wParam, lParam); + case 0x0121: + return printMessage("WM_ENTERIDLE", wParam, lParam); + case 0x0122: + return printMessage("WM_MENURBUTTONUP", wParam, lParam); + case 0x0123: + return printMessage("WM_MENUDRAG", wParam, lParam); + case 0x0124: + return printMessage("WM_MENUGETOBJECT", wParam, lParam); + case 0x0125: + return printMessage("WM_UNINITMENUPOPUP", wParam, lParam); + case 0x0126: + return printMessage("WM_MENUCOMMAND", wParam, lParam); + case 0x0127: + return printMessage("WM_CHANGEUISTATE", wParam, lParam); + case 0x0128: + return printMessage("WM_UPDATEUISTATE", wParam, lParam); + case 0x0129: + return printMessage("WM_QUERYUISTATE", wParam, lParam); + case 0x0132: + return printMessage("WM_CTLCOLORMSGBOX", wParam, lParam); + case 0x0133: + return printMessage("WM_CTLCOLOREDIT", wParam, lParam); + case 0x0134: + return printMessage("WM_CTLCOLORLISTBOX", wParam, lParam); + case 0x0135: + return printMessage("WM_CTLCOLORBTN", wParam, lParam); + case 0x0136: + return printMessage("WM_CTLCOLORDLG", wParam, lParam); + case 0x0137: + return printMessage("WM_CTLCOLORSCROLLBAR", wParam, lParam); + case 0x0138: + return printMessage("WM_CTLCOLORSTATIC", wParam, lParam); + case 0x01E1: + return printMessage("MN_GETHMENU", wParam, lParam); + case 0x0200: + return printMessage("WM_MOUSEMOVE", wParam, lParam); + case 0x0201: + return printMessage("WM_LBUTTONDOWN", wParam, lParam); + case 0x0202: + return printMessage("WM_LBUTTONUP", wParam, lParam); + case 0x0203: + return printMessage("WM_LBUTTONDBLCLK", wParam, lParam); + case 0x0204: + return printMessage("WM_RBUTTONDOWN", wParam, lParam); + case 0x0205: + return printMessage("WM_RBUTTONUP", wParam, lParam); + case 0x0206: + return printMessage("WM_RBUTTONDBLCLK", wParam, lParam); + case 0x0207: + return printMessage("WM_MBUTTONDOWN", wParam, lParam); + case 0x0208: + return printMessage("WM_MBUTTONUP", wParam, lParam); + case 0x0209: + return printMessage("WM_MBUTTONDBLCLK", wParam, lParam); + case 0x020A: + return printMessage("WM_MOUSEWHEEL", wParam, lParam); + case 0x020B: + return printMessage("WM_XBUTTONDOWN", wParam, lParam); + case 0x020C: + return printMessage("WM_XBUTTONUP", wParam, lParam); + case 0x020D: + return printMessage("WM_XBUTTONDBLCLK", wParam, lParam); + case 0x020E: + return printMessage("WM_MOUSEHWHEEL", wParam, lParam); + case 0x0210: + return printMessage("WM_PARENTNOTIFY", wParam, lParam); + case 0x0211: + return printMessage("WM_ENTERMENULOOP", wParam, lParam); + case 0x0212: + return printMessage("WM_EXITMENULOOP", wParam, lParam); + case 0x0213: + return printMessage("WM_NEXTMENU", wParam, lParam); + case 0x0214: + return printMessage("WM_SIZING", wParam, lParam); + case 0x0215: + return printMessage("WM_CAPTURECHANGED", wParam, lParam); + case 0x0216: + return printMessage("WM_MOVING", wParam, lParam); + case 0x0218: + return printMessage("WM_POWERBROADCAST", wParam, lParam); + case 0x8013: + return printMessage("PBT_POWERSETTINGCHANGE", wParam, lParam); + case 0x0219: + return printMessage("WM_DEVICECHANGE", wParam, lParam); + case 0x0220: + return printMessage("WM_MDICREATE", wParam, lParam); + case 0x0221: + return printMessage("WM_MDIDESTROY", wParam, lParam); + case 0x0222: + return printMessage("WM_MDIACTIVATE", wParam, lParam); + case 0x0223: + return printMessage("WM_MDIRESTORE", wParam, lParam); + case 0x0224: + return printMessage("WM_MDINEXT", wParam, lParam); + case 0x0225: + return printMessage("WM_MDIMAXIMIZE", wParam, lParam); + case 0x0226: + return printMessage("WM_MDITILE", wParam, lParam); + case 0x0227: + return printMessage("WM_MDICASCADE", wParam, lParam); + case 0x0228: + return printMessage("WM_MDIICONARRANGE", wParam, lParam); + case 0x0229: + return printMessage("WM_MDIGETACTIVE", wParam, lParam); + case 0x0230: + return printMessage("WM_MDISETMENU", wParam, lParam); + case 0x0231: + return printMessage("WM_ENTERSIZEMOVE", wParam, lParam); + case 0x0232: + return printMessage("WM_EXITSIZEMOVE", wParam, lParam); + case 0x0233: + return printMessage("WM_DROPFILES", wParam, lParam); + case 0x0234: + return printMessage("WM_MDIREFRESHMENU", wParam, lParam); + case 0x0240: + return printMessage("WM_TOUCH", wParam, lParam); + case 0x0281: + return printMessage("WM_IME_SETCONTEXT", wParam, lParam); + case 0x0282: + return printMessage("WM_IME_NOTIFY", wParam, lParam); + case 0x0283: + return printMessage("WM_IME_CONTROL", wParam, lParam); + case 0x0284: + return printMessage("WM_IME_COMPOSITIONFULL", wParam, lParam); + case 0x0285: + return printMessage("WM_IME_SELECT", wParam, lParam); + case 0x0286: + return printMessage("WM_IME_CHAR", wParam, lParam); + case 0x0288: + return printMessage("WM_IME_REQUEST", wParam, lParam); + case 0x0290: + return printMessage("WM_IME_KEYDOWN", wParam, lParam); + case 0x0291: + return printMessage("WM_IME_KEYUP", wParam, lParam); + case 0x02A1: + return printMessage("WM_MOUSEHOVER", wParam, lParam); + case 0x02A3: + return printMessage("WM_MOUSELEAVE", wParam, lParam); + case 0x02A0: + return printMessage("WM_NCMOUSEHOVER", wParam, lParam); + case 0x02A2: + return printMessage("WM_NCMOUSELEAVE", wParam, lParam); + case 0x02B1: + return printMessage("WM_WTSSESSION_CHANGE", wParam, lParam); + case 0x02c0: + return printMessage("WM_TABLET_FIRST", wParam, lParam); + case 0x02df: + return printMessage("WM_TABLET_LAST", wParam, lParam); + case 0x0300: + return printMessage("WM_CUT", wParam, lParam); + case 0x0301: + return printMessage("WM_COPY", wParam, lParam); + case 0x0302: + return printMessage("WM_PASTE", wParam, lParam); + case 0x0303: + return printMessage("WM_CLEAR", wParam, lParam); + case 0x0304: + return printMessage("WM_UNDO", wParam, lParam); + case 0x0305: + return printMessage("WM_RENDERFORMAT", wParam, lParam); + case 0x0306: + return printMessage("WM_RENDERALLFORMATS", wParam, lParam); + case 0x0307: + return printMessage("WM_DESTROYCLIPBOARD", wParam, lParam); + case 0x0308: + return printMessage("WM_DRAWCLIPBOARD", wParam, lParam); + case 0x0309: + return printMessage("WM_PAINTCLIPBOARD", wParam, lParam); + case 0x030A: + return printMessage("WM_VSCROLLCLIPBOARD", wParam, lParam); + case 0x030B: + return printMessage("WM_SIZECLIPBOARD", wParam, lParam); + case 0x030C: + return printMessage("WM_ASKCBFORMATNAME", wParam, lParam); + case 0x030D: + return printMessage("WM_CHANGECBCHAIN", wParam, lParam); + case 0x030E: + return printMessage("WM_HSCROLLCLIPBOARD", wParam, lParam); + case 0x030F: + return printMessage("WM_QUERYNEWPALETTE", wParam, lParam); + case 0x0310: + return printMessage("WM_PALETTEISCHANGING", wParam, lParam); + case 0x0311: + return printMessage("WM_PALETTECHANGED", wParam, lParam); + case 0x0312: + return printMessage("WM_HOTKEY", wParam, lParam); + case 0x0317: + return printMessage("WM_PRINT", wParam, lParam); + case 0x0318: + return printMessage("WM_PRINTCLIENT", wParam, lParam); + case 0x0319: + return printMessage("WM_APPCOMMAND", wParam, lParam); + case 0x031A: + return printMessage("WM_THEMECHANGED", wParam, lParam); + case 0x031D: + return printMessage("WM_CLIPBOARDUPDATE", wParam, lParam); + case 0x031E: + return printMessage("WM_DWMCOMPOSITIONCHANGED", wParam, lParam); + case 0x031F: + return printMessage("WM_DWMNCRENDERINGCHANGED", wParam, lParam); + case 0x0320: + return printMessage("WM_DWMCOLORIZATIONCOLORCHANGED", wParam, lParam); + case 0x0321: + return printMessage("WM_DWMWINDOWMAXIMIZEDCHANGE", wParam, lParam); + case 0x0323: + return printMessage("WM_DWMSENDICONICTHUMBNAIL", wParam, lParam); + case 0x0326: + return printMessage("WM_DWMSENDICONICLIVEPREVIEWBITMAP", wParam, lParam); + case 0x033F: + return printMessage("WM_GETTITLEBARINFOEX", wParam, lParam); + case 0x0358: + return printMessage("WM_HANDHELDFIRST", wParam, lParam); + case 0x035F: + return printMessage("WM_HANDHELDLAST", wParam, lParam); + case 0x0360: + return printMessage("WM_AFXFIRST", wParam, lParam); + case 0x037F: + return printMessage("WM_AFXLAST", wParam, lParam); + case 0x0380: + return printMessage("WM_PENWINFIRST", wParam, lParam); + case 0x038F: + return printMessage("WM_PENWINLAST", wParam, lParam); + case 0x8000: + return printMessage("WM_APP", wParam, lParam); + default: + return printMessage("", wParam, lParam); + } + } + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/WindowsKeyboard.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/WindowsKeyboard.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/WindowsKeyboard.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/WindowsKeyboard.java 2016-04-09 16:26:56.000000000 +0000 @@ -39,23 +39,16 @@ import java.nio.ByteBuffer; import java.nio.CharBuffer; -import org.lwjgl.BufferUtils; import org.lwjgl.LWJGLException; import org.lwjgl.input.Keyboard; final class WindowsKeyboard { - private static final int MAPVK_VK_TO_VSC = 0; - private static final int BUFFER_SIZE = 50; - - private final long hwnd; - private final ByteBuffer keyboard_state; private final byte[] key_down_buffer = new byte[Keyboard.KEYBOARD_SIZE]; + private final byte[] virt_key_down_buffer = new byte[Keyboard.KEYBOARD_SIZE]; private final EventQueue event_queue = new EventQueue(Keyboard.EVENT_SIZE); private final ByteBuffer tmp_event = ByteBuffer.allocate(Keyboard.EVENT_SIZE); - private boolean grabbed; - private boolean has_retained_event; // Indicates if we're waiting for a WM_CHAR private int retained_key_code; private byte retained_state; @@ -63,32 +56,26 @@ private long retained_millis; private boolean retained_repeat; - WindowsKeyboard(long hwnd) throws LWJGLException { - this.hwnd = hwnd; - keyboard_state = BufferUtils.createByteBuffer(256); + WindowsKeyboard() throws LWJGLException { } - private static native boolean isWindowsNT(); - public void destroy() { - } + private static native boolean isWindowsNT(); boolean isKeyDown(int lwjgl_keycode) { return key_down_buffer[lwjgl_keycode] == 1; } - public void grab(boolean grab) { - if(grab) { - if (!grabbed) { - grabbed = true; - } - } else { - if (grabbed) { - grabbed = false; - } - } - } + void poll(ByteBuffer keyDownBuffer) { + // Handle shift key release while both are pressed. + // Windows will not send an up event for the first button that was released in this case. + // There will only be one up event, for the last button only. We handle this problem + // here, using asynchronous state queries. + if ( isKeyDown(Keyboard.KEY_LSHIFT) && !isKeyPressedAsync(WindowsKeycodes.VK_LSHIFT) ) + handleKey(WindowsKeycodes.VK_SHIFT, Keyboard.KEY_LSHIFT, false, (byte)0, 0L, false); + + if ( isKeyDown(Keyboard.KEY_RSHIFT) && !isKeyPressedAsync(WindowsKeycodes.VK_RSHIFT) ) + handleKey(WindowsKeycodes.VK_SHIFT, Keyboard.KEY_RSHIFT, false, (byte)0, 0L, false); - public void poll(ByteBuffer keyDownBuffer) { int old_position = keyDownBuffer.position(); keyDownBuffer.put(key_down_buffer); keyDownBuffer.position(old_position); @@ -98,7 +85,8 @@ private static native int ToUnicode(int wVirtKey, int wScanCode, ByteBuffer lpKeyState, CharBuffer pwszBuff, int cchBuff, int flags); private static native int ToAscii(int wVirtKey, int wScanCode, ByteBuffer lpKeyState, ByteBuffer lpChar, int flags); private static native int GetKeyboardState(ByteBuffer lpKeyState); - private static native int GetKeyState(int virt_key); + private static native short GetKeyState(int virt_key); + private static native short GetAsyncKeyState(int virt_key); private void putEvent(int keycode, byte state, int ch, long millis, boolean repeat) { tmp_event.clear(); @@ -107,33 +95,10 @@ event_queue.putEvent(tmp_event); } - private boolean checkShiftKey(int virt_key, byte state) { - int key_state = (GetKeyState(virt_key) >>> 15) & 0x1; - int lwjgl_code = WindowsKeycodes.mapVirtualKeyToLWJGLCode(virt_key); - return (key_down_buffer[lwjgl_code] == 1 - state) && (key_state == state); - } - - private int translateShift(int scan_code, byte state) { - if (checkShiftKey(WindowsKeycodes.VK_LSHIFT, state)) { - return WindowsKeycodes.VK_LSHIFT; - } else if (checkShiftKey(WindowsKeycodes.VK_RSHIFT, state)) { - return WindowsKeycodes.VK_RSHIFT; - } else { - if (scan_code== 0x2A) - return WindowsKeycodes.VK_LSHIFT; - else { - if (scan_code == 0x36) - return WindowsKeycodes.VK_RSHIFT; - else - return WindowsKeycodes.VK_LSHIFT; - } - } - } - - private int translateExtended(int virt_key, int scan_code, byte state, boolean extended) { + private static int translateExtended(int virt_key, int scan_code, boolean extended) { switch (virt_key) { case WindowsKeycodes.VK_SHIFT: - return translateShift(scan_code, state); + return scan_code == 0x36 ? WindowsKeycodes.VK_RSHIFT : WindowsKeycodes.VK_LSHIFT; case WindowsKeycodes.VK_CONTROL: return extended ? WindowsKeycodes.VK_RCONTROL : WindowsKeycodes.VK_LCONTROL; case WindowsKeycodes.VK_MENU: @@ -150,13 +115,39 @@ } } - public void handleKey(int virt_key, int scan_code, boolean extended, byte event_state, long millis, boolean repeat) { - virt_key = translateExtended(virt_key, scan_code, event_state, extended); + private static boolean isKeyPressed(int state) { + return (state & 1) == 1; + } + + private static boolean isKeyPressedAsync(int virt_key) { + return (GetAsyncKeyState(virt_key) & 0x8000) != 0; + } + + /** + * This is called when the window loses focus: we release all currently pressed keys. If a key has been pressed (or hasn't been released at all), before we + * regain focus, we'll start receiving repeat press events. We'll treat the first of those as a non-repeat press. + */ + void releaseAll(long millis) { + for ( int i = 0; i < virt_key_down_buffer.length; i++ ) { + if ( isKeyPressed(virt_key_down_buffer[i]) ) { + handleKey(i, 0, false, (byte)0, millis, false); + } + } + } + + void handleKey(int virt_key, int scan_code, boolean extended, byte event_state, long millis, boolean repeat) { + virt_key = translateExtended(virt_key, scan_code, extended); + if ( !repeat && isKeyPressed(event_state) == isKeyPressed(virt_key_down_buffer[virt_key]) ) + return; + flushRetained(); has_retained_event = true; int keycode = WindowsKeycodes.mapVirtualKeyToLWJGLCode(virt_key); - if (keycode < key_down_buffer.length) + if (keycode < key_down_buffer.length) { key_down_buffer[keycode] = event_state; + repeat &= isKeyPressed(virt_key_down_buffer[virt_key]); // Treat the first repeat event after releaseAll() as a non-repeat press. + virt_key_down_buffer[virt_key] = event_state; + } retained_key_code = keycode; retained_state = event_state; retained_millis = millis; @@ -164,7 +155,7 @@ retained_repeat = repeat; } - public void handleChar(int event_char, long millis, boolean repeat) { + void handleChar(int event_char, long millis, boolean repeat) { if (has_retained_event && retained_char != 0) flushRetained(); if (!has_retained_event) { @@ -173,7 +164,7 @@ retained_char = event_char; } - public void read(ByteBuffer buffer) { + void read(ByteBuffer buffer) { flushRetained(); event_queue.copyEvents(buffer); } diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/WindowsMouse.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/WindowsMouse.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/WindowsMouse.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/WindowsMouse.java 2016-04-09 16:26:56.000000000 +0000 @@ -65,7 +65,7 @@ WindowsMouse(long hwnd) throws LWJGLException { this.hwnd = hwnd; - this.mouse_button_count = WindowsDisplay.getSystemMetrics(WindowsDisplay.SM_CMOUSEBUTTONS); + this.mouse_button_count = Math.min(5, WindowsDisplay.getSystemMetrics(WindowsDisplay.SM_CMOUSEBUTTONS)); this.has_wheel = WindowsDisplay.getSystemMetrics(WindowsDisplay.SM_MOUSEWHEELPRESENT) != 0; this.blank_cursor = createBlankCursor(); this.button_states = new byte[mouse_button_count]; @@ -90,7 +90,7 @@ return mouse_button_count; } - public void poll(IntBuffer coord_buffer, ByteBuffer buttons) { + public void poll(IntBuffer coord_buffer, ByteBuffer buttons, WindowsDisplay display) { for (int i = 0; i < coord_buffer.remaining(); i++) coord_buffer.put(coord_buffer.position() + i, 0); int num_buttons = mouse_button_count; @@ -103,6 +103,9 @@ if (isGrabbed()) { coord_buffer.put(coord_buffer.position() + 0, accum_dx); coord_buffer.put(coord_buffer.position() + 1, accum_dy); + + if ( display.isActive() && display.isVisible() && (accum_dx != 0 || accum_dy != 0) ) + centerCursor(); } else { coord_buffer.put(coord_buffer.position() + 0, last_x); coord_buffer.put(coord_buffer.position() + 1, last_y); @@ -172,7 +175,7 @@ WindowsDisplay.doDestroyCursor(blank_cursor); } - public void handleMouseMoved(int x, int y, long millis, boolean should_center) { + public void handleMouseMoved(int x, int y, long millis) { int dx = x - last_x; int dy = y - last_y; if (dx != 0 || dy != 0) { @@ -183,8 +186,6 @@ long nanos = millis*1000000; if (mouse_grabbed) { putMouseEventWithCoords((byte)-1, (byte)0, dx, dy, 0, nanos); - if (should_center) - centerCursor(); } else { putMouseEventWithCoords((byte)-1, (byte)0, x, y, 0, nanos); } diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/WindowsPbufferPeerInfo.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/WindowsPbufferPeerInfo.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/WindowsPbufferPeerInfo.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/WindowsPbufferPeerInfo.java 2016-04-09 16:26:56.000000000 +0000 @@ -39,8 +39,8 @@ /** * * @author elias_naur - * @version $Revision: 3116 $ - * $Id: WindowsPbufferPeerInfo.java 3116 2008-08-19 16:46:03Z spasi $ + * @version $Revision$ + * $Id$ */ final class WindowsPbufferPeerInfo extends WindowsPeerInfo { WindowsPbufferPeerInfo(int width, int height, PixelFormat pixel_format, IntBuffer pixelFormatCaps, IntBuffer pBufferAttribs) throws LWJGLException { diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/WindowsPeerInfo.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/WindowsPeerInfo.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/WindowsPeerInfo.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/WindowsPeerInfo.java 2016-04-09 16:26:56.000000000 +0000 @@ -39,8 +39,8 @@ /** * * @author elias_naur - * @version $Revision: 3116 $ - * $Id: WindowsPeerInfo.java 3116 2008-08-19 16:46:03Z spasi $ + * @version $Revision$ + * $Id$ */ abstract class WindowsPeerInfo extends PeerInfo { protected WindowsPeerInfo() { diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/XRandR.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/XRandR.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengl/XRandR.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengl/XRandR.java 2016-04-09 16:26:56.000000000 +0000 @@ -27,126 +27,160 @@ package org.lwjgl.opengl; +import org.lwjgl.LWJGLUtil; + import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; -import org.lwjgl.LWJGLUtil; - /** * Utility for working with the xrandr commmand-line utility. Assumes * xrandr v1.2 or higher. * * @author ryanm */ -public class XRandR -{ +public class XRandR { + private static Screen[] current; + /** + * Either the screen marked as "primary" (if it is turned on) + * or the one with the largest (current) resolution. + */ + private static String primaryScreenIdentifier; + + /** + * Used to save the configuration of all output devices to + * restore it on exit or in case of crash. + */ + private static Screen[] savedConfiguration; + private static Map screens; - private static void populate() - { - if( screens == null ) - { - screens = new HashMap(); - - // ProcessBuilder pb = new ProcessBuilder( "xrandr", "-q" ); - // pb.redirectErrorStream(); - try - { - // Process p= pb.start(); - Process p = Runtime.getRuntime().exec( new String[] { "xrandr", "-q" } ); - - List currentList = new ArrayList(); - List possibles = new ArrayList(); - String name = null; - - BufferedReader br = new BufferedReader( new InputStreamReader( p.getInputStream() ) ); - String line; - while( ( line = br.readLine() ) != null ) - { - line = line.trim(); - String[] sa = line.split( "\\s+" ); - - if( "connected".equals(sa[1]) ) - { - // found a new screen block - if( name != null ) - { - screens.put( name, possibles.toArray( new Screen[ possibles.size() ] ) ); - possibles.clear(); - } - name = sa[ 0 ]; + private static final Pattern WHITESPACE_PATTERN = Pattern.compile("\\s+"); + + private static void populate() { + if ( screens != null ) + return; + + screens = new HashMap(); - // record the current config - parseScreen( currentList, name, sa[ 2 ] ); + try { + Process p = Runtime.getRuntime().exec(new String[] { "xrandr", "-q" }); + + List currentList = new ArrayList(); + List possibles = new ArrayList(); + String name = null; + // saves the position of the current screen. this is specified in the header of the screen block, + // but required later when parsing the screen modelines + int[] currentScreenPosition = new int[2]; + + BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream())); + String line; + while ( (line = br.readLine()) != null ) { + line = line.trim(); + String[] sa = WHITESPACE_PATTERN.split(line); + + if ( "connected".equals(sa[1]) ) { + // found a new screen block + if ( name != null ) { + screens.put(name, possibles.toArray(new Screen[possibles.size()])); + possibles.clear(); } - else if( Pattern.matches( "\\d*x\\d*", sa[ 0 ] ) ) - { + name = sa[0]; + + // save position of this screen, will be used later when current modeline is parsed + if ( "primary".equals(sa[2]) ) { + parseScreenHeader(currentScreenPosition, sa[3]); + // save primary + primaryScreenIdentifier = name; + } else { + parseScreenHeader(currentScreenPosition, sa[2]); + } + } else { + Matcher m = SCREEN_MODELINE_PATTERN.matcher(sa[0]); + if ( m.matches() ) { // found a new mode line - parseScreen( possibles, name, sa[ 0 ] ); + parseScreenModeline( + possibles, currentList, name, + Integer.parseInt(m.group(1)), Integer.parseInt(m.group(2)), + sa, currentScreenPosition + ); } } + } - screens.put( name, possibles.toArray( new Screen[ possibles.size() ] ) ); + screens.put(name, possibles.toArray(new Screen[possibles.size()])); - current = currentList.toArray(new Screen[currentList.size()]); - } - catch( Throwable e ) - { - LWJGLUtil.log( "Exception in XRandR.populate(): " + e.getMessage() ); - screens.clear(); - current = new Screen[ 0 ]; + current = currentList.toArray(new Screen[currentList.size()]); + + // set primary to largest screen if not set yet + if ( primaryScreenIdentifier == null ) { + long totalPixels = Long.MIN_VALUE; + for ( Screen screen : current ) { + if ( 1l * screen.width * screen.height > totalPixels ) { + primaryScreenIdentifier = screen.name; + totalPixels = 1l * screen.width * screen.height; + } + } } + } catch (Throwable e) { + LWJGLUtil.log("Exception in XRandR.populate(): " + e.getMessage()); + screens.clear(); + current = new Screen[0]; } } /** - * @return The current screen configuration, or an empty array if - * xrandr is not supported + * @return The current screen configuration of the primary device, + * or an empty array if xrandr is not supported */ - public static Screen[] getConfiguration() - { + public static Screen[] getConfiguration() { populate(); + // find and return primary + for ( Screen screen : current ) { + if ( screen.name.equals(primaryScreenIdentifier) ) { + return new Screen[] { screen }; + } + } + + // problem with primary device, fall back to old behaviour return current.clone(); } /** - * @param screens - * The desired screen set, may not be null - * @throws IllegalArgumentException - * if no screens are specified - */ - public static void setConfiguration(Screen... screens) - { - if( screens.length == 0 ) - throw new IllegalArgumentException( "Must specify at least one screen" ); + * @param disableOthers if screens not included in screens should be turned off (true) or left alone (false) + * @param screens The desired screen set, may not be null + * + * @throws IllegalArgumentException if no screens are specified + */ + public static void setConfiguration(boolean disableOthers, Screen... screens) { + if ( screens.length == 0 ) + throw new IllegalArgumentException("Must specify at least one screen"); List cmd = new ArrayList(); - cmd.add( "xrandr" ); + cmd.add("xrandr"); - // switch off those in the current set not in the new set - for ( Screen screen : current ) { - boolean found = false; - for ( Screen screen1 : screens ) { - if ( screen1.name.equals(screen.name) ) { - found = true; - break; + if ( disableOthers ) { + // switch off those in the current set not in the new set + for ( Screen screen : current ) { + boolean disable = true; + for ( Screen screen1 : screens ) { + if ( screen1.name.equals(screen.name) ) { + disable = false; + break; + } } - } - if ( !found ) { - cmd.add("--output"); - cmd.add(screen.name); - cmd.add("--off"); + if ( disable ) { + cmd.add("--output"); + cmd.add(screen.name); + cmd.add("--off"); + } } } @@ -154,151 +188,192 @@ for ( Screen screen : screens ) screen.getArgs(cmd); - try - { - // ProcessBuilder pb = new ProcessBuilder( cmd ); - // pb.redirectErrorStream(); - // Process p = pb.start(); - Process p = - Runtime.getRuntime().exec( cmd.toArray( new String[ cmd.size() ] ) ); + try { + Process p = Runtime.getRuntime().exec(cmd.toArray(new String[cmd.size()])); // no output is expected, but check anyway - BufferedReader br = new BufferedReader( new InputStreamReader( p.getInputStream() ) ); + BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream())); String line; - while( ( line = br.readLine() ) != null ) - { - LWJGLUtil.log( "Unexpected output from xrandr process: " + line ); + while ( (line = br.readLine()) != null ) { + LWJGLUtil.log("Unexpected output from xrandr process: " + line); } current = screens; + } catch (IOException e) { + LWJGLUtil.log("XRandR exception in setConfiguration(): " + e.getMessage()); } - catch( IOException e ) - { - LWJGLUtil.log( "XRandR exception in setConfiguration(): " + e.getMessage() ); + } + + /** + * Saves the current configuration for all connected display devices. + * This configuration can be restored on exit/crash by calling + * restoreConfiguration() + */ + public static void saveConfiguration() { + populate(); + savedConfiguration = current.clone(); + } + + /** + * Restores the configuration for all connected display devices. + * Used on exit or in case of a crash to reset all devices. + */ + public static void restoreConfiguration() { + if ( savedConfiguration != null ) { + setConfiguration(true, savedConfiguration); } } /** * @return the name of connected screens, or an empty array if - * xrandr is not supported + * xrandr is not supported */ - public static String[] getScreenNames() - { + public static String[] getScreenNames() { populate(); - return screens.keySet().toArray( new String[ screens.size() ] ); + return screens.keySet().toArray(new String[screens.size()]); } /** * @param name + * * @return the possible resolutions of the named screen, or - * null if there is no such screen + * null if there is no such screen */ - public static Screen[] getResolutions( String name ) - { + public static Screen[] getResolutions(String name) { populate(); // clone the array to prevent held copies being altered return screens.get(name).clone(); } - private static final Pattern SCREEN_PATTERN1 = - Pattern.compile( "^(\\d+)x(\\d+)\\+(\\d+)\\+(\\d+)$" ); - - private static final Pattern SCREEN_PATTERN2 = Pattern.compile( "^(\\d+)x(\\d+)$" ); + private static final Pattern SCREEN_HEADER_PATTERN = Pattern.compile("^(\\d+)x(\\d+)[+](\\d+)[+](\\d+)$"); + private static final Pattern SCREEN_MODELINE_PATTERN = Pattern.compile("^(\\d+)x(\\d+)$"); + private static final Pattern FREQ_PATTERN = Pattern.compile("^(\\d+)[.](\\d+)(?:\\s*[*])?(?:\\s*[+])?$"); /** - * Parses a screen configuration and adds it to the list if it's - * valid. + * Parses a screen configuration and adds it to one of the lists if valid. * - * @param list - * the list to add the Screen to if it's valid - * @param name - * the name of this screen - * @param what - * config string, format either widthxheight or - * widthxheight+xPos+yPos - */ - private static void parseScreen( List list, String name, String what ) - { - Matcher m = SCREEN_PATTERN1.matcher( what ); - if( !m.matches() ) - { - m = SCREEN_PATTERN2.matcher( what ); - if( !m.matches() ) - { - LWJGLUtil.log( "Did not match: " + what ); + * @param allModes the list to add the Screen to if it's valid + * @param current the list to add the current screen config to + * @param name the name of this screen + * @param modeLine config string + * @param screenPosition position of this screen + */ + private static void parseScreenModeline(List allModes, List current, String name, int width, int height, String[] modeLine, int[] screenPosition) { + for ( int i = 1; i < modeLine.length; i++ ) { + String freqS = modeLine[i]; + if ( "+".equals(freqS) ) { + // previous rate was the "preferred" refresh rate + // no way to get this info to the application, so ignore it + continue; + } + + Matcher m = FREQ_PATTERN.matcher(freqS); + if ( !m.matches() ) { + LWJGLUtil.log("Frequency match failed: " + Arrays.toString(modeLine)); return; } + + int freq = Integer.parseInt(m.group(1)); + + Screen s = new Screen(name, width, height, freq, 0, 0); + if ( freqS.contains("*") ) { + // current mode, save to current list with screen position + current.add(new Screen(name, width, height, freq, screenPosition[0], screenPosition[1])); + // make sure the current mode is always first + allModes.add(0, s); + } else { + // always add to List of all modes without screen position + allModes.add(s); + } } - int width = Integer.parseInt( m.group( 1 ) ); - int height = Integer.parseInt( m.group( 2 ) ); - int xpos, ypos; - if( m.groupCount() > 3 ) - { - xpos = Integer.parseInt( m.group( 3 ) ); - ypos = Integer.parseInt( m.group( 4 ) ); + } + + /** + * Parses a screen configuration header and extracts information about the position of the screen. + * + * @param screenPosition the int-array to write the position into + * @param resPos String containing resolution and position, from xrandr + */ + private static void parseScreenHeader(int[] screenPosition, String resPos) { + Matcher m = SCREEN_HEADER_PATTERN.matcher(resPos); + if ( !m.matches() ) { + // screen not active! + screenPosition[0] = 0; + screenPosition[1] = 0; + return; } - else - { - xpos = 0; - ypos = 0; + screenPosition[0] = Integer.parseInt(m.group(3)); + screenPosition[1] = Integer.parseInt(m.group(4)); + } + + static Screen DisplayModetoScreen(DisplayMode mode) { + populate(); + Screen primary = findPrimary(current); + return new Screen(primary.name, mode.getWidth(), mode.getHeight(), mode.getFrequency(), primary.xPos, primary.yPos); + } + + static DisplayMode ScreentoDisplayMode(Screen... screens) { + populate(); + Screen primary = findPrimary(screens); + return new DisplayMode(primary.width, primary.height, 24, primary.freq); + } + + private static Screen findPrimary(Screen... screens) { + for ( Screen screen : screens ) { + if ( screen.name.equals(primaryScreenIdentifier) ) { + return screen; + } } - list.add( new Screen( name, width, height, xpos, ypos ) ); + // fallback + return screens[0]; } /** - * Encapsulates the configuration of a monitor. Resolution is - * fixed, position is mutable + * Encapsulates the configuration of a monitor. + * Resolution and freq are fixed, position is mutable * * @author ryanm */ - public static class Screen implements Cloneable - { - /** - * Name for this output - */ + public static class Screen implements Cloneable { + /** Name for this output */ public final String name; - /** - * Width in pixels - */ + /** Width in pixels */ public final int width; - /** - * Height in pixels - */ + /** Height in pixels */ public final int height; - /** - * Position on the x-axis, in pixels - */ + /** Frequency in Hz */ + public final int freq; + + /** Position on the x-axis, in pixels */ public int xPos; - /** - * Position on the y-axis, in pixels - */ + /** Position on the y-axis, in pixels */ public int yPos; - private Screen( String name, int width, int height, int xPos, int yPos ) - { + Screen(String name, int width, int height, int freq, int xPos, int yPos) { this.name = name; this.width = width; this.height = height; + this.freq = freq; this.xPos = xPos; this.yPos = yPos; } - private void getArgs( List argList ) - { - argList.add( "--output" ); - argList.add( name ); - argList.add( "--mode" ); - argList.add( width + "x" + height ); - argList.add( "--pos" ); - argList.add( xPos + "x" + yPos ); + private void getArgs(List argList) { + argList.add("--output"); + argList.add(name); + argList.add("--mode"); + argList.add(width + "x" + height); + argList.add("--rate"); + argList.add(Integer.toString(freq)); + argList.add("--pos"); + argList.add(xPos + "x" + yPos); } //@Override - public String toString() - { - return name + " " + width + "x" + height + " @ " + xPos + "x" + yPos; + public String toString() { + return name + " " + width + "x" + height + " @ " + xPos + "x" + yPos + " with " + freq + "Hz"; } } } \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengles/APIUtil.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengles/APIUtil.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengles/APIUtil.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengles/APIUtil.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,329 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +import org.lwjgl.BufferUtils; +import org.lwjgl.LWJGLUtil; +import org.lwjgl.MemoryUtil; +import org.lwjgl.PointerBuffer; + +import java.nio.ByteBuffer; +import java.nio.FloatBuffer; +import java.nio.IntBuffer; +import java.nio.LongBuffer; + +/** + * Utility class for OpenGL ES API calls. + * + * @author spasi + */ +final class APIUtil { + + private static final int INITIAL_BUFFER_SIZE = 256; + private static final int INITIAL_LENGTHS_SIZE = 4; + + private static final int BUFFERS_SIZE = 32; + + private static final ThreadLocal arrayTL = new ThreadLocal() { + protected char[] initialValue() { return new char[INITIAL_BUFFER_SIZE]; } + }; + + private static final ThreadLocal bufferTL = new ThreadLocal() { + protected ByteBuffer initialValue() { return BufferUtils.createByteBuffer(INITIAL_BUFFER_SIZE); } + }; + + private static final ThreadLocal bufferPointerTL = new ThreadLocal() { + protected PointerBuffer initialValue() { return BufferUtils.createPointerBuffer(INITIAL_BUFFER_SIZE); } + }; + + private static final ThreadLocal lengthsTL = new ThreadLocal() { + protected IntBuffer initialValue() { return BufferUtils.createIntBuffer(INITIAL_LENGTHS_SIZE); } + }; + + private static final ThreadLocal buffersTL = new ThreadLocal() { + protected Buffers initialValue() { return new Buffers(); } + }; + + private APIUtil() { + } + + private static char[] getArray(final int size) { + char[] array = arrayTL.get(); + + if ( array.length < size ) { + int sizeNew = array.length << 1; + while ( sizeNew < size ) + sizeNew <<= 1; + + array = new char[size]; + arrayTL.set(array); + } + + return array; + } + + static ByteBuffer getBufferByte(final int size) { + ByteBuffer buffer = bufferTL.get(); + + if ( buffer.capacity() < size ) { + int sizeNew = buffer.capacity() << 1; + while ( sizeNew < size ) + sizeNew <<= 1; + + buffer = BufferUtils.createByteBuffer(size); + bufferTL.set(buffer); + } else + buffer.clear(); + + return buffer; + } + + private static ByteBuffer getBufferByteOffset(final int size) { + ByteBuffer buffer = bufferTL.get(); + + if ( buffer.capacity() < size ) { + int sizeNew = buffer.capacity() << 1; + while ( sizeNew < size ) + sizeNew <<= 1; + + final ByteBuffer bufferNew = BufferUtils.createByteBuffer(size); + bufferNew.put(buffer); + bufferTL.set(buffer = bufferNew); + } else { + buffer.position(buffer.limit()); + buffer.limit(buffer.capacity()); + } + + return buffer; + } + + static PointerBuffer getBufferPointer(final int size) { + PointerBuffer buffer = bufferPointerTL.get(); + + if ( buffer.capacity() < size ) { + int sizeNew = buffer.capacity() << 1; + while ( sizeNew < size ) + sizeNew <<= 1; + + buffer = BufferUtils.createPointerBuffer(size); + bufferPointerTL.set(buffer); + } else + buffer.clear(); + + return buffer; + } + + static IntBuffer getBufferInt() { return buffersTL.get().ints; } + + static LongBuffer getBufferLong() { return buffersTL.get().longs; } + + static FloatBuffer getBufferFloat() { return buffersTL.get().floats; } + + static IntBuffer getLengths() { + return getLengths(1); + } + + static IntBuffer getLengths(final int size) { + IntBuffer lengths = lengthsTL.get(); + + if ( lengths.capacity() < size ) { + int sizeNew = lengths.capacity(); + while ( sizeNew < size ) + sizeNew <<= 1; + + lengths = BufferUtils.createIntBuffer(size); + lengthsTL.set(lengths); + } else + lengths.clear(); + + return lengths; + } + + /** + * Simple ASCII encoding. + * + * @param buffer The target buffer + * @param string The source string + */ + private static ByteBuffer encode(final ByteBuffer buffer, final CharSequence string) { + for ( int i = 0; i < string.length(); i++ ) { + final char c = string.charAt(i); + if ( LWJGLUtil.DEBUG && 0x80 <= c ) // Silently ignore and map to 0x1A. + buffer.put((byte)0x1A); + else + buffer.put((byte)c); + } + + return buffer; + } + + /** + * Reads a byte string from the specified buffer. + * + * @param buffer + * + * @return the buffer as a String. + */ + static String getString(final ByteBuffer buffer) { + final int length = buffer.remaining(); + final char[] charArray = getArray(length); + + for ( int i = buffer.position(); i < buffer.limit(); i++ ) + charArray[i - buffer.position()] = (char)buffer.get(i); + + return new String(charArray, 0, length); + } + + /** + * Returns a buffer containing the specified string as bytes. + * + * @param string + * + * @return the String as a ByteBuffer + */ + static long getBuffer(final CharSequence string) { + final ByteBuffer buffer = encode(getBufferByte(string.length()), string); + buffer.flip(); + return MemoryUtil.getAddress0(buffer); + } + + /** + * Returns a buffer containing the specified string as bytes, starting at the specified offset. + * + * @param string + * + * @return the String as a ByteBuffer + */ + static long getBuffer(final CharSequence string, final int offset) { + final ByteBuffer buffer = encode(getBufferByteOffset(offset + string.length()), string); + buffer.flip(); + return MemoryUtil.getAddress(buffer); + } + + /** + * Returns a buffer containing the specified string as bytes, including null-termination. + * + * @param string + * + * @return the String as a ByteBuffer + */ + static long getBufferNT(final CharSequence string) { + final ByteBuffer buffer = encode(getBufferByte(string.length() + 1), string); + buffer.put((byte)0); + buffer.flip(); + return MemoryUtil.getAddress0(buffer); + } + + static int getTotalLength(final CharSequence[] strings) { + int length = 0; + for ( CharSequence string : strings ) + length += string.length(); + + return length; + } + + /** + * Returns a buffer containing the specified strings as bytes. + * + * @param strings + * + * @return the Strings as a ByteBuffer + */ + static long getBuffer(final CharSequence[] strings) { + final ByteBuffer buffer = getBufferByte(getTotalLength(strings)); + + for ( CharSequence string : strings ) + encode(buffer, string); + + buffer.flip(); + return MemoryUtil.getAddress0(buffer); + } + + /** + * Returns a buffer containing the specified strings as bytes, including null-termination. + * + * @param strings + * + * @return the Strings as a ByteBuffer + */ + static long getBufferNT(final CharSequence[] strings) { + final ByteBuffer buffer = getBufferByte(getTotalLength(strings) + strings.length); + + for ( CharSequence string : strings ) { + encode(buffer, string); + buffer.put((byte)0); + } + + buffer.flip(); + return MemoryUtil.getAddress0(buffer); + } + + /** + * Returns a buffer containing the lengths of the specified strings. + * + * @param strings + * + * @return the String lengths in an IntBuffer + */ + static long getLengths(final CharSequence[] strings) { + IntBuffer buffer = getLengths(strings.length); + + for ( CharSequence string : strings ) + buffer.put(string.length()); + + buffer.flip(); + return MemoryUtil.getAddress0(buffer); + } + + static long getInt(final int value) { + return MemoryUtil.getAddress(getBufferInt().put(0, value), 0); + } + + static long getBufferByte0() { + return MemoryUtil.getAddress0(getBufferByte(0)); + } + + private static class Buffers { + + final IntBuffer ints; + final LongBuffer longs; + final FloatBuffer floats; + + Buffers() { + ints = BufferUtils.createIntBuffer(BUFFERS_SIZE); + longs = BufferUtils.createLongBuffer(BUFFERS_SIZE); + floats = BufferUtils.createFloatBuffer(BUFFERS_SIZE); + } + + } + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengles/CallbackUtil.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengles/CallbackUtil.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengles/CallbackUtil.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengles/CallbackUtil.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,134 @@ +/* + * Copyright (c) 2002-2010 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +import java.util.HashMap; +import java.util.Map; + +/** + * Utility class that handles OpenGL API callbacks. + * + * @author Spasi + */ +final class CallbackUtil { + + /** Context -> Long */ + private static final Map contextUserParamsKHR = new HashMap(); + + private CallbackUtil() {} + + /** + * Creates a new global reference to the specified Object. + * + * @param obj the Object + * + * @return the GlobalRef memory address or 0 if the Object is null. + */ + static long createGlobalRef(final Object obj) { + return obj == null ? 0 : ncreateGlobalRef(obj); + } + + /** + * Creates a new global reference to the specified Object. + * + * @param obj the Object + * + * @return the GlobalRef memory address. + */ + private static native long ncreateGlobalRef(Object obj); + + /** + * Deletes a global reference. + * + * @param ref the GlobalRef memory address. + */ + private static native void deleteGlobalRef(long ref); + + // --------- [ XXX_debug_output ] --------- + + /** + * Associates the current OpenGL context with the specified global reference. If there + * is no context current, the global reference is deleted and an exception is thrown. + * Any previous callback registrations will be cleared. + * + * @param userParam the global reference pointer + */ + private static void registerContextCallback(final long userParam, final Map contextUserData) { + ContextCapabilities caps = GLContext.getCapabilities(); + if ( caps == null ) { + deleteGlobalRef(userParam); + throw new IllegalStateException("No context is current."); + } + + final Long userParam_old = contextUserData.remove(caps); + if ( userParam_old != null ) + deleteGlobalRef(userParam_old); + + if ( userParam != 0 ) + contextUserData.put(caps, userParam); + } + + /** + * Releases references to any callbacks associated with the specified GL context. + * + * @param context the Context to unregister + */ + static void unregisterCallbacks(final Object context) { + // TODO: This is never called for custom contexts. Need to fix for LWJGL 3.0 + final ContextCapabilities caps = GLContext.getCapabilities(); + + Long userParam = contextUserParamsKHR.remove(caps); + if ( userParam != null ) + deleteGlobalRef(userParam); + } + + // --------- [ KHR_debug ] --------- + + /** + * Returns the memory address of the native function we pass to glDebugMessageCallback. + * + * @return the callback function address + */ + static native long getDebugCallbackKHR(); + + /** + * Associates the current OpenGL context with the specified global reference. If there + * is no context current, the global reference is deleted and an exception is thrown. + * Any previous callback registrations will be cleared. + * + * @param userParam the global reference pointer + */ + static void registerContextCallbackKHR(final long userParam) { + registerContextCallback(userParam, contextUserParamsKHR); + } + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengles/ContextAttribs.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengles/ContextAttribs.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengles/ContextAttribs.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengles/ContextAttribs.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +import org.lwjgl.BufferUtils; + +import java.nio.IntBuffer; + +import static org.lwjgl.opengles.EGL.*; + +/** + * This class represents the context attributes passed to EGL's eglCreateContext. + * The only attribute allowed is EGL_CONTEXT_CLIENT_VERSION and it must be 2 or 3 (LWJGL does not support GLES 1.x). + */ +public final class ContextAttribs { + + private int version; + + public ContextAttribs() { + this(2); + } + + public ContextAttribs(final int version) { + if ( 3 < version ) + throw new IllegalArgumentException("Invalid OpenGL ES version specified: " + version); + + this.version = version; + } + + private ContextAttribs(final ContextAttribs attribs) { + this.version = attribs.version; + } + + public int getVersion() { + return version; + } + + public IntBuffer getAttribList() { + int attribCount = 1; + + final IntBuffer attribs = BufferUtils.createIntBuffer((attribCount * 2) + 1); + + attribs.put(EGL_CONTEXT_CLIENT_VERSION).put(version); + + attribs.put(EGL_NONE); + attribs.rewind(); + return attribs; + } + + public String toString() { + StringBuilder sb = new StringBuilder(32); + + sb.append("ContextAttribs:"); + sb.append(" Version=").append(version); + + return sb.toString(); + } + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengles/EGLConfig.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengles/EGLConfig.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengles/EGLConfig.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengles/EGLConfig.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,120 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +import org.lwjgl.LWJGLException; +import org.lwjgl.PointerWrapperAbstract; + +import static org.lwjgl.opengles.EGL.*; + +/** EGLConfig wrapper class. */ +public final class EGLConfig extends PointerWrapperAbstract { + + private final EGLDisplay display; + + private final int configID; + + EGLConfig(final EGLDisplay display, final long pointer) throws LWJGLException { + super(pointer); + + this.display = display; + this.configID = getAttribute(EGL_CONFIG_ID); + } + + /** + * Returns the EGL display from which this EGL config was retrieved. + * + * @return the EGL display + */ + public EGLDisplay getDisplay() { + return display; + } + + /** + * Returns the EGL_CONFIG_ID attribute of this EGLConfig. + * + * @return the EGL_CONFIG_ID + */ + public int getConfigID() { + return configID; + } + + /** + * Returns the value of the specified EGL config attribute. + * + * @param attribute the attribute + * + * @return the attribute value + */ + public int getAttribute(final int attribute) throws LWJGLException { + return eglGetConfigAttrib(display, this, attribute); + } + + public boolean equals(final Object obj) { + if ( obj == null || !(obj instanceof EGLConfig) ) + return false; + + return getPointer() == ((EGLConfig)obj).getPointer(); + } + + public String toString() { + final StringBuilder sb = new StringBuilder(512); + + sb.append("EGLConfig (").append(configID).append(")"); + sb.append("\n------------"); + + try { + sb.append("\nEGL_LEVEL").append(": ").append(getAttribute(EGL_LEVEL)); + sb.append("\nEGL_RENDERABLE_TYPE").append(": ").append(Integer.toBinaryString(getAttribute(EGL_RENDERABLE_TYPE))); + sb.append("\nEGL_NATIVE_RENDERABLE").append(": ").append(getAttribute(EGL_NATIVE_RENDERABLE) == EGL_TRUE); + sb.append("\nEGL_SURFACE_TYPE").append(": ").append(Integer.toBinaryString(getAttribute(EGL_SURFACE_TYPE))); + } catch (LWJGLException e) { + } + + final PixelFormat.Attrib[] attribEnums = PixelFormat.Attrib.values(); + for ( PixelFormat.Attrib attribEnum : attribEnums ) { + if ( attribEnum.isSurfaceAttrib() ) + continue; + + try { + final int attrib = getAttribute(attribEnum.getEGLAttrib()); + sb.append("\nEGL_").append(attribEnum.name()).append(": ").append(attrib); + } catch (LWJGLException e) { + //System.out.println("Failed to retrieve: " + attribEnum.name()); + // Ignore, can happen when querying unsupported attributes (e.g. extension ones) + } + } + + return sb.toString(); + } + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengles/EGLContext.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengles/EGLContext.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengles/EGLContext.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengles/EGLContext.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,114 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +import org.lwjgl.LWJGLException; +import org.lwjgl.PointerWrapperAbstract; + +import java.nio.IntBuffer; + +import static org.lwjgl.opengles.EGL.*; + +/** EGLContext wrapper class. */ +public final class EGLContext extends PointerWrapperAbstract { + + private EGLDisplay display; + private final EGLConfig config; + + private boolean destroyed; + + EGLContext(final EGLDisplay display, final EGLConfig config, final long pointer) { + super(pointer); + + if ( !display.isInitialized() ) + throw new IllegalStateException("Invalid EGL display specified."); + + if ( config.getDisplay() != display ) + throw new IllegalStateException("Invalid EGL config specified."); + + this.display = display; + this.config = config; + } + + public void setDisplay(EGLDisplay display) { + this.display = display; + } + + EGLDisplay getDisplay() { + return display; + } + + EGLConfig getConfig() { + return config; + } + + private void checkDestroyed() { + if ( destroyed ) + throw new IllegalStateException("The EGL surface has been destroyed."); + } + + public void destroy() throws LWJGLException { + eglDestroyContext(display, this); + destroyed = true; + } + + /** + * Returns the value of the specified EGL context attribute. + * + * @param attribute the context attribute + * + * @return the attribute value + */ + int getAttribute(final int attribute) throws LWJGLException { + checkDestroyed(); + + IntBuffer value = APIUtil.getBufferInt(); + eglQueryContext(display, this, attribute, value); + return value.get(0); + } + + public void makeCurrent(final EGLSurface surface) throws LWJGLException, PowerManagementEventException { + makeCurrent(surface, surface); + } + + public void makeCurrent(final EGLSurface draw, final EGLSurface read) throws LWJGLException, PowerManagementEventException { + eglMakeCurrent(display, draw, read, this); + } + + public boolean equals(final Object obj) { + if ( obj == null || !(obj instanceof EGLContext) ) + return false; + + return getPointer() == ((EGLContext)obj).getPointer(); + } + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengles/EGLDisplay.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengles/EGLDisplay.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengles/EGLDisplay.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengles/EGLDisplay.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,216 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +import org.lwjgl.LWJGLException; +import org.lwjgl.PointerWrapperAbstract; + +import java.nio.IntBuffer; +import java.util.HashSet; +import java.util.Set; +import java.util.StringTokenizer; + +import static org.lwjgl.opengles.EGL.*; + +/** EGLDisplay wrapper class. */ +public final class EGLDisplay extends PointerWrapperAbstract { + + private int majorVersion; + private int minorVersion; + + private Set extensions; + + private boolean initialized; + + EGLDisplay(final long pointer) throws LWJGLException { + super(pointer); + + initialize(); + + /*final EGLConfig[] configs = eglGetConfigs(this, null, APIUtil.getBufferInt()); + for ( EGLConfig config : configs ) { + System.out.println(config); + System.out.println(""); + }*/ + } + + /** + * Returns the major EGL version of this EGL display. + * + * @return the major EGL version + */ + public int getMajorVersion() { + return majorVersion; + } + + /** + * Returns the minor EGL version of this EGL display. + * + * @return the minor EGL version + */ + public int getMinorVersion() { + return minorVersion; + } + + /** + * Returns true if the specified EGL extension is supported by this EGL display. + * + * @param eglExtension the EGL extension + * + * @return true if the extension is supported + */ + public boolean isExtensionSupported(final String eglExtension) { + checkInitialized(); + if ( extensions == null ) { + extensions = new HashSet(16); + + final StringTokenizer tokenizer = new StringTokenizer(eglQueryString(this, EGL_EXTENSIONS)); + while ( tokenizer.hasMoreTokens() ) + extensions.add(tokenizer.nextToken()); + } + + return extensions.contains(eglExtension); + } + + boolean isInitialized() { + return initialized; + } + + private void initialize() throws LWJGLException { + IntBuffer version = APIUtil.getBufferInt(); + eglInitialize(this, version); + + majorVersion = version.get(0); + minorVersion = version.get(1); + + initialized = true; + } + + private void checkInitialized() { + if ( !initialized ) + throw new IllegalStateException("The EGL display needs to be initialized first."); + } + + /** Release the resources associated with this EGL display. */ + public void terminate() throws LWJGLException { + eglTerminate(this); + + majorVersion = 0; + minorVersion = 0; + + initialized = false; + } + + /** + * Returns a string describing some aspect of the EGL implementation running on the specified display. + * + * @param name the value to query + * + * @return the description + */ + public String query(int name) { + checkInitialized(); + return eglQueryString(this, name); + } + + int getConfigsNum() throws LWJGLException { + checkInitialized(); + return eglGetConfigsNum(this); + } + + EGLConfig[] getConfigs(EGLConfig[] configs, IntBuffer num_config) throws LWJGLException { + checkInitialized(); + return eglGetConfigs(this, configs, num_config); + } + + int getConfigNum(IntBuffer attrib_list) throws LWJGLException { + checkInitialized(); + return eglChooseConfigNum(this, attrib_list); + } + + /** Returns the available EGL configs on this display that satisfy the specified list of attributes. */ + public EGLConfig[] chooseConfig(IntBuffer attrib_list, EGLConfig[] configs, IntBuffer num_config) throws LWJGLException { + checkInitialized(); + return eglChooseConfig(this, attrib_list, configs, num_config); + } + + /** + * Creates an on-screen rendering surface on this EGL display. + * + * @param config the EGL config + * @param window the native window handle + * @param attrib_list an attribute list (may be null) + * + * @return the EGL surface + */ + public EGLSurface createWindowSurface(EGLConfig config, long window, IntBuffer attrib_list) throws LWJGLException { + checkInitialized(); + + if ( config.getDisplay() != this ) + throw new IllegalArgumentException("Invalid EGL config specified."); + + return eglCreateWindowSurface(this, config, window, attrib_list); + } + + EGLSurface createPbufferSurface(EGLConfig config, IntBuffer attrib_list) throws LWJGLException { + checkInitialized(); + + if ( config.getDisplay() != this ) + throw new IllegalArgumentException("Invalid EGL config specified."); + + return eglCreatePbufferSurface(this, config, attrib_list); + } + + public EGLContext createContext(EGLConfig config, EGLContext shareContext, IntBuffer attrib_list) throws LWJGLException { + checkInitialized(); + + if ( config.getDisplay() != this ) + throw new IllegalStateException("Invalid EGL config specified."); + + if ( shareContext != null && shareContext.getDisplay() != this ) + throw new IllegalStateException("Invalid shared EGL context specified."); + + return eglCreateContext(this, config, shareContext, attrib_list); + } + + public void setSwapInterval(final int interval) throws LWJGLException { + eglSwapInterval(this, interval); + } + + public boolean equals(final Object obj) { + if ( obj == null || !(obj instanceof EGLDisplay) ) + return false; + + return getPointer() == ((EGLDisplay)obj).getPointer(); + } + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengles/EGLImageOES.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengles/EGLImageOES.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengles/EGLImageOES.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengles/EGLImageOES.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +import org.lwjgl.PointerWrapperAbstract; + +/** EGLImageOES wrapper class. */ +public final class EGLImageOES extends PointerWrapperAbstract { + + public EGLImageOES(final long pointer) { + super(pointer); + } + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengles/EGL.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengles/EGL.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengles/EGL.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengles/EGL.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,922 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +import org.lwjgl.BufferChecks; +import org.lwjgl.LWJGLException; +import org.lwjgl.MemoryUtil; +import org.lwjgl.PointerBuffer; + +import java.nio.IntBuffer; + +/** EGL wrapper class. */ +public final class EGL { + + /** EGL aliases */ + public static final int + EGL_FALSE = 0, + EGL_TRUE = 1; + + /** Out-of-band handle values */ + public static final int + EGL_DEFAULT_DISPLAY = 0, + EGL_NO_CONTEXT = 0, + EGL_NO_DISPLAY = 0, + EGL_NO_SURFACE = 0; + + /** Out-of-band attribute value */ + public static final int EGL_DONT_CARE = -1; + + /** Errors / GetError return values */ + public static final int + EGL_SUCCESS = 0x3000, + EGL_NOT_INITIALIZED = 0x3001, + EGL_BAD_ACCESS = 0x3002, + EGL_BAD_ALLOC = 0x3003, + EGL_BAD_ATTRIBUTE = 0x3004, + EGL_BAD_CONFIG = 0x3005, + EGL_BAD_CONTEXT = 0x3006, + EGL_BAD_CURRENT_SURFACE = 0x3007, + EGL_BAD_DISPLAY = 0x3008, + EGL_BAD_MATCH = 0x3009, + EGL_BAD_NATIVE_PIXMAP = 0x300A, + EGL_BAD_NATIVE_WINDOW = 0x300B, + EGL_BAD_PARAMETER = 0x300C, + EGL_BAD_SURFACE = 0x300D, + EGL_CONTEXT_LOST = 0x300E; // EGL 1.1 - IMG_power_management + + /** Reserved =0x300F;-=0x301F; for additional errors */ + + /** Config attributes */ + public static final int + EGL_BUFFER_SIZE = 0x3020, + EGL_ALPHA_SIZE = 0x3021, + EGL_BLUE_SIZE = 0x3022, + EGL_GREEN_SIZE = 0x3023, + EGL_RED_SIZE = 0x3024, + EGL_DEPTH_SIZE = 0x3025, + EGL_STENCIL_SIZE = 0x3026, + EGL_CONFIG_CAVEAT = 0x3027, + EGL_CONFIG_ID = 0x3028, + EGL_LEVEL = 0x3029, + EGL_MAX_PBUFFER_HEIGHT = 0x302A, + EGL_MAX_PBUFFER_PIXELS = 0x302B, + EGL_MAX_PBUFFER_WIDTH = 0x302C, + EGL_NATIVE_RENDERABLE = 0x302D, + EGL_NATIVE_VISUAL_ID = 0x302E, + EGL_NATIVE_VISUAL_TYPE = 0x302F, + EGL_SAMPLES = 0x3031, + EGL_SAMPLE_BUFFERS = 0x3032, + EGL_SURFACE_TYPE = 0x3033, + EGL_TRANSPARENT_TYPE = 0x3034, + EGL_TRANSPARENT_BLUE_VALUE = 0x3035, + EGL_TRANSPARENT_GREEN_VALUE = 0x3036, + EGL_TRANSPARENT_RED_VALUE = 0x3037, + EGL_NONE = 0x3038, // Attrib list terminator + EGL_BIND_TO_TEXTURE_RGB = 0x3039, + EGL_BIND_TO_TEXTURE_RGBA = 0x303A, + EGL_MIN_SWAP_INTERVAL = 0x303B, + EGL_MAX_SWAP_INTERVAL = 0x303C, + EGL_LUMINANCE_SIZE = 0x303D, + EGL_ALPHA_MASK_SIZE = 0x303E, + EGL_COLOR_BUFFER_TYPE = 0x303F, + EGL_RENDERABLE_TYPE = 0x3040, + EGL_MATCH_NATIVE_PIXMAP = 0x3041, // Pseudo-attribute (not queryable) + EGL_CONFORMANT = 0x3042; + + /** Reserved =0x3041;-=0x304F; for additional config attributes */ + + /** Config attribute values */ + public static final int + EGL_SLOW_CONFIG = 0x3050, // EGL_CONFIG_CAVEAT value + EGL_NON_CONFORMANT_CONFIG = 0x3051, // EGL_CONFIG_CAVEAT value + EGL_TRANSPARENT_RGB = 0x3052, // EGL_TRANSPARENT_TYPE value + EGL_RGB_BUFFER = 0x308E, // EGL_COLOR_BUFFER_TYPE value + EGL_LUMINANCE_BUFFER = 0x308F; // EGL_COLOR_BUFFER_TYPE value + + /** More config attribute values, for EGL_TEXTURE_FORMAT */ + public static final int + EGL_NO_TEXTURE = 0x305C, + EGL_TEXTURE_RGB = 0x305D, + EGL_TEXTURE_RGBA = 0x305E, + EGL_TEXTURE_2D = 0x305F; + + /** EGL_SURFACE_TYPE mask bits */ + public static final int + EGL_PBUFFER_BIT = 0x0001, + EGL_PIXMAP_BIT = 0x0002, + EGL_WINDOW_BIT = 0x0004, + EGL_VG_COLORSPACE_LINEAR_BIT = 0x0020, + EGL_VG_ALPHA_FORMAT_PRE_BIT = 0x0040, + EGL_MULTISAMPLE_RESOLVE_BOX_BIT = 0x0200, + EGL_SWAP_BEHAVIOR_PRESERVED_BIT = 0x0400; + + /** EGL_RENDERABLE_TYPE mask bits */ + public static final int + EGL_OPENGL_ES_BIT = 0x0001, + EGL_OPENVG_BIT = 0x0002, + EGL_OPENGL_ES2_BIT = 0x0004, + EGL_OPENGL_BIT = 0x0008; + + /** QueryString targets */ + public static final int + EGL_VENDOR = 0x3053, + EGL_VERSION = 0x3054, + EGL_EXTENSIONS = 0x3055, + EGL_CLIENT_APIS = 0x308D; + + /** QuerySurface / SurfaceAttrib / CreatePbufferSurface targets */ + public static final int + EGL_HEIGHT = 0x3056, + EGL_WIDTH = 0x3057, + EGL_LARGEST_PBUFFER = 0x3058, + EGL_TEXTURE_FORMAT = 0x3080, + EGL_TEXTURE_TARGET = 0x3081, + EGL_MIPMAP_TEXTURE = 0x3082, + EGL_MIPMAP_LEVEL = 0x3083, + EGL_RENDER_BUFFER = 0x3086, + EGL_VG_COLORSPACE = 0x3087, + EGL_VG_ALPHA_FORMAT = 0x3088, + EGL_HORIZONTAL_RESOLUTION = 0x3090, + EGL_VERTICAL_RESOLUTION = 0x3091, + EGL_PIXEL_ASPECT_RATIO = 0x3092, + EGL_SWAP_BEHAVIOR = 0x3093, + EGL_MULTISAMPLE_RESOLVE = 0x3099; + + /** EGL_RENDER_BUFFER values / BindTexImage / ReleaseTexImage buffer targets */ + public static final int + EGL_BACK_BUFFER = 0x3084, + EGL_SINGLE_BUFFER = 0x3085; + + /** OpenVG color spaces */ + public static final int + EGL_VG_COLORSPACE_sRGB = 0x3089, // EGL_VG_COLORSPACE value + EGL_VG_COLORSPACE_LINEAR = 0x308A; // EGL_VG_COLORSPACE value + + /** OpenVG alpha formats */ + public static final int + EGL_VG_ALPHA_FORMAT_NONPRE = 0x308B, // EGL_ALPHA_FORMAT value + EGL_VG_ALPHA_FORMAT_PRE = 0x308C; // EGL_ALPHA_FORMAT + + /** + * Constant scale factor by which fractional display resolutions & + * aspect ratio are scaled when queried as integer values. + */ + public static final int EGL_DISPLAY_SCALING = 10000; + + /** Unknown display resolution/aspect ratio */ + public static final int EGL_UNKNOWN = -1; + + /** Back buffer swap behaviors */ + public static final int + EGL_BUFFER_PRESERVED = 0x3094, // EGL_SWAP_BEHAVIOR value + EGL_BUFFER_DESTROYED = 0x3095; // EGL_SWAP_BEHAVIOR value + + /** CreatePbufferFromClientBuffer buffer types */ + static final int EGL_OPENVG_IMAGE = 0x3096; + + /** QueryContext targets */ + public static final int EGL_CONTEXT_CLIENT_TYPE = 0x3097; + + /** CreateContext attributes */ + public static final int EGL_CONTEXT_CLIENT_VERSION = 0x3098; + + /** Multisample resolution behaviors */ + public static final int + EGL_MULTISAMPLE_RESOLVE_DEFAULT = 0x309A, // EGL_MULTISAMPLE_RESOLVE value + EGL_MULTISAMPLE_RESOLVE_BOX = 0x309B; // EGL_MULTISAMPLE_RESOLVE value + + /** BindAPI/QueryAPI targets */ + public static final int + EGL_OPENGL_ES_API = 0x30A0, + EGL_OPENVG_API = 0x30A1, + EGL_OPENGL_API = 0x30A2; + + /** GetCurrentSurface targets */ + public static final int + EGL_DRAW = 0x3059, + EGL_READ = 0x305A; + + /** WaitNative engines */ + static final int EGL_CORE_NATIVE_ENGINE = 0x305B; + + private EGL() { + } + + public static native int eglGetError(); + + /** + * Obtains an EGL display from the specified native display and initializes it. + * + * @param display_id the handle to the native display. + * + * @return the EGL Display + * + * @throws org.lwjgl.LWJGLException if no display is available or an EGL error occurs + */ + public static EGLDisplay eglGetDisplay(long display_id) throws LWJGLException { + //LWJGLUtil.log("eglGetDisplay"); + final long pointer = neglGetDisplay(display_id); + + if ( pointer == EGL_NO_DISPLAY ) // No error is generated when this happens + throw new LWJGLException("Failed to get EGL display from native display handle: " + display_id); + + return new EGLDisplay(pointer); + } + + private static native long neglGetDisplay(long display_id); + + /** + * Initializes the specified EGL display. + * + * @param dpy the EGL display to initialize + * @param version the EGL major and minor version will be returned in this buffer. + * + * @throws org.lwjgl.LWJGLException if an EGL error occurs + */ + static void eglInitialize(EGLDisplay dpy, IntBuffer version) throws LWJGLException { + //LWJGLUtil.log("eglInitialize"); + BufferChecks.checkBuffer(version, 2); + if ( !neglInitialize(dpy.getPointer(), MemoryUtil.getAddress(version)) ) + throwEGLError("Failed to initialize EGL display."); + } + + private static native boolean neglInitialize(long dpy_ptr, long version); + + /** + * Release the resources associated with the specified EGL display. + * + * @param dpy the EGL display to terminate + */ + static void eglTerminate(EGLDisplay dpy) throws LWJGLException { + //LWJGLUtil.log("eglTerminate"); + if ( !neglTerminate(dpy.getPointer()) ) + throwEGLError("Failed to terminate EGL display."); + } + + private static native boolean neglTerminate(long dpy_ptr); + + /** + * Returns a string describing some aspect of the EGL implementation running on the specified display. + * + * @param dpy the EGL display to query + * @param name the value to query + * + * @return the description + */ + public static String eglQueryString(EGLDisplay dpy, int name) { + //LWJGLUtil.log("eglQueryString"); + return neglQueryString(dpy.getPointer(), name); + } + + private static native String neglQueryString(long dpy, int name); + + /** + * Returns the number of EGLConfigs that are available on the specified display. + * + * @param dpy the EGLDisplay + * + * @return the number of EGLConfigs available + * + * @throws org.lwjgl.LWJGLException if an EGL error occurs + * @see #eglGetConfigs(EGLDisplay, EGLConfig[], IntBuffer) + */ + static int eglGetConfigsNum(EGLDisplay dpy) throws LWJGLException { + //LWJGLUtil.log("eglGetConfigsNum"); + IntBuffer num_config = APIUtil.getBufferInt(); + + if ( !neglGetConfigs(dpy.getPointer(), 0L, 0, MemoryUtil.getAddress0(num_config)) ) + throwEGLError("Failed to get EGL configs."); + + return num_config.get(0); + } + + /** + * Returns the available EGLConfigs on the speficied display. The number of available EGLConfigs + * is returned in the num_config parameter. The configs array may be null. If it is null, a new + * array will be allocated, with size equal to the result of {@link #eglGetConfigsNum(EGLDisplay)} eglGetConfigsNum}. + * If it is not null, no more than {@code configs.length} EGLConfigs will be returned. If the array is bigger + * than the number of available EGLConfigs, the remaining array elements will not be affected. + * + * @param dpy the EGLDisplay + * @param configs the EGLConfigs array + * @param num_config the number of available EGLConfigs returned + * + * @return the available EGLConfigs + * + * @throws org.lwjgl.LWJGLException if an EGL error occurs + */ + static EGLConfig[] eglGetConfigs(EGLDisplay dpy, EGLConfig[] configs, IntBuffer num_config) throws LWJGLException { + //LWJGLUtil.log("eglGetConfigs"); + BufferChecks.checkBuffer(num_config, 1); + + if ( configs == null ) { + if ( !neglGetConfigs(dpy.getPointer(), 0L, 0, MemoryUtil.getAddress(num_config)) ) + throwEGLError("Failed to get number of available EGL configs."); + + configs = new EGLConfig[num_config.get(num_config.position())]; + } + + final PointerBuffer configs_buffer = APIUtil.getBufferPointer(configs.length); + if ( !neglGetConfigs(dpy.getPointer(), MemoryUtil.getAddress0(configs_buffer), configs.length, MemoryUtil.getAddress(num_config)) ) + throwEGLError("Failed to get EGL configs."); + + final int config_size = num_config.get(num_config.position()); + for ( int i = 0; i < config_size; i++ ) + configs[i] = new EGLConfig(dpy, configs_buffer.get(i)); + + return configs; + } + + private static native boolean neglGetConfigs(long dpy_ptr, long configs, int config_size, long num_config); + + /** + * Returns the number of EGLConfigs that are available on the specified display and + * match the speficied list of attributes. + * + * @param dpy the EGLDisplay + * @param attrib_list the attribute list (may be null) + * + * @return the number of EGLConfigs available that satisft the attribute list + * + * @throws org.lwjgl.LWJGLException if an EGL error occurs + * @see #eglChooseConfig(EGLDisplay, IntBuffer, EGLConfig[], IntBuffer) + */ + static int eglChooseConfigNum(EGLDisplay dpy, IntBuffer attrib_list) throws LWJGLException { + //LWJGLUtil.log("eglChooseConfigNum"); + checkAttribList(attrib_list); + IntBuffer num_config = APIUtil.getBufferInt(); + + if ( !neglChooseConfig(dpy.getPointer(), MemoryUtil.getAddressSafe(attrib_list), 0L, 0, MemoryUtil.getAddress0(num_config)) ) + throwEGLError("Failed to get EGL configs."); + + return num_config.get(0); + } + + /** + * Returns the available EGLConfigs on the speficied display that satisfy the specified list of attributes. + * The number of available EGLConfigs is returned in the num_config parameter. The configs array may be null. + * If it is null, a new array will be allocated, with size equal to the result of {@link #eglGetConfigsNum(EGLDisplay)} eglGetConfigsNum}. + * If it is not null, no more than {@code configs.length} EGLConfigs will be returned. If the array is bigger + * than the number of available EGLConfigs, the remaining array elements will not be affected. + * + * @param dpy the EGLDisplay + * @param attrib_list the attribute list (may be null) + * @param configs the EGLConfigs array + * @param num_config the number of available EGLConfigs returned + * + * @return the available EGLConfigs that satisfy the attribute list + * + * @throws org.lwjgl.LWJGLException if an EGL error occurs + */ + static EGLConfig[] eglChooseConfig(EGLDisplay dpy, IntBuffer attrib_list, EGLConfig[] configs, IntBuffer num_config) throws LWJGLException { + //LWJGLUtil.log("eglChooseConfig"); + checkAttribList(attrib_list); + BufferChecks.checkBuffer(num_config, 1); + + int config_size; + if ( configs == null ) { + if ( !neglChooseConfig(dpy.getPointer(), MemoryUtil.getAddressSafe(attrib_list), 0L, 0, MemoryUtil.getAddress(num_config)) ) + throwEGLError("Failed to get number of available EGL configs."); + + config_size = num_config.get(num_config.position()); + } else + config_size = configs.length; + + //LWJGLUtil.log("config_size = " + config_size); + PointerBuffer configs_buffer = APIUtil.getBufferPointer(config_size); + if ( !neglChooseConfig(dpy.getPointer(), MemoryUtil.getAddressSafe(attrib_list), MemoryUtil.getAddress0(configs_buffer), config_size, MemoryUtil.getAddress(num_config)) ) + throwEGLError("Failed to choose EGL config."); + + // Get the true number of configurations (the first neglChooseConfig call may return more than the second) + config_size = num_config.get(num_config.position()); + if ( configs == null ) + configs = new EGLConfig[config_size]; + for ( int i = 0; i < config_size; i++ ) + configs[i] = new EGLConfig(dpy, configs_buffer.get(i)); + + return configs; + } + + private static native boolean neglChooseConfig(long dpy_ptr, long attrib_list, long configs, int config_size, long num_config); + + /** + * Returns the value of an EGL config attribute. + * + * @param dpy the EGL display + * @param config the EGL config + * @param attribute the attribute + * + * @throws org.lwjgl.LWJGLException if an EGL error occurs + */ + static int eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config, int attribute) throws LWJGLException { + //LWJGLUtil.log("eglGetConfigAttrib"); + final IntBuffer value = APIUtil.getBufferInt(); + + if ( !neglGetConfigAttrib(dpy.getPointer(), config.getPointer(), attribute, MemoryUtil.getAddress(value)) ) + throwEGLError("Failed to get EGL config attribute."); + + return value.get(0); + } + + private static native boolean neglGetConfigAttrib(long dpy_ptr, long config_ptr, int attribute, long value); + + /** + * Creates an on-screen rendering surface on the specified EGL display. + * + * @param dpy the EGL display + * @param config the EGL config + * @param win the native window handle + * @param attrib_list an attribute list (may be null) + * + * @return the created EGL surface + * + * @throws org.lwjgl.LWJGLException if an EGL error occurs + */ + static EGLSurface eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config, long win, IntBuffer attrib_list) throws LWJGLException { + //LWJGLUtil.log("eglCreateWindowSurface"); + checkAttribList(attrib_list); + final long pointer = neglCreateWindowSurface(dpy.getPointer(), config.getPointer(), win, MemoryUtil.getAddressSafe(attrib_list)); + + if ( pointer == EGL_NO_SURFACE ) + throwEGLError("Failed to create EGL window surface."); + + return new EGLSurface(dpy, config, pointer); + } + + private static native long neglCreateWindowSurface(long dpy_ptr, long config_ptr, long win, long attrib_list); + + /** + * Creates an off-screen rendering surface on the specified EGL display. + * + * @param dpy the EGL display + * @param config the EGL config + * @param attrib_list an attribute list (may be null) + * + * @return the created EGL surface + * + * @throws org.lwjgl.LWJGLException if an EGL error occurs + */ + static EGLSurface eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config, IntBuffer attrib_list) throws LWJGLException { + //LWJGLUtil.log("eglCreatePbufferSurface"); + checkAttribList(attrib_list); + final long pointer = neglCreatePbufferSurface(dpy.getPointer(), config.getPointer(), MemoryUtil.getAddressSafe(attrib_list)); + + if ( pointer == EGL_NO_SURFACE ) + throwEGLError("Failed to create EGL pbuffer surface."); + + return new EGLSurface(dpy, config, pointer); + } + + private static native long neglCreatePbufferSurface(long dpy_ptr, long config_ptr, long attrib_list); + + /* + EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint *attrib_list); + */ + + /** + * Sets the specified EGL surface attribute to the specified value. + * + * @param dpy the EGL display + * @param surface the EGL surface + * @param attribute the attribute + * @param value the attribute value + * + * @throws org.lwjgl.LWJGLException if an EGL error occurs + */ + static void eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface, int attribute, int value) throws LWJGLException { + //LWJGLUtil.log("eglSurfaceAttrib"); + if ( !neglSurfaceAttrib(dpy.getPointer(), surface.getPointer(), attribute, value) ) + throwEGLError("Failed to set surface attribute."); + } + + private static native boolean neglSurfaceAttrib(long dpy_ptr, long surface_ptr, int attribute, int value); + + /** + * Destroys the specified EGL surface. + * + * @param dpy the EGL display + * @param surface the EGL surface to destroy + * + * @throws org.lwjgl.LWJGLException if an EGL error occurs + */ + static void eglDestroySurface(EGLDisplay dpy, EGLSurface surface) throws LWJGLException { + //LWJGLUtil.log("eglDestroySurface"); + if ( !neglDestroySurface(dpy.getPointer(), surface.getPointer()) ) + throwEGLError("Failed to destroy EGL surface."); + } + + private static native boolean neglDestroySurface(long dpy_ptr, long surface_ptr); + + /** + * Returns the value of the specified EGL surface attribute in the value parameter. + * + * @param dpy the EGL display + * @param surface the EGL surface + * @param attribute the surface attribute + * @param value the attribute value will be returned here + * + * @throws org.lwjgl.LWJGLException if an EGL error occurs + */ + public static void eglQuerySurface(EGLDisplay dpy, EGLSurface surface, int attribute, IntBuffer value) throws LWJGLException { + //LWJGLUtil.log("eglQuerySurface"); + BufferChecks.checkBuffer(value, 1); + if ( !neglQuerySurface(dpy.getPointer(), surface.getPointer(), attribute, MemoryUtil.getAddress(value)) ) + throwEGLError("Failed to query surface attribute."); + } + + private static native boolean neglQuerySurface(long dpy_ptr, long surface_ptr, int attribute, long value); + + /** + * Binds the specified rendering API to the current thread. + * + * @param api the API to bind + * + * @return true if the bind was successful, false if an EGL error occurs + */ + public static native boolean eglBindAPI(int api); + + /** + * Returns the current rendering API. + * + * @return the rendering API bound to the current thread + */ + public static native int eglQueryAPI(); + + /** + * Returns EGL to its state at thread initialization. This includes the following:
    + *

    + * For each client API supported by EGL, if there is a currently bound context, + * that context is released. This is equivalent to calling eglMakeCurrent + * with ctx set to EGL_NO_CONTEXT and both draw and read set to EGL_NO_SURFACE + *


    + *

    The current rendering API is reset to its value at thread initialization


    + *

    Any additional implementation-dependent per-thread state maintained by EGL + * is marked for deletion as soon as possible.

    + * + * @return true if thread state was released successfully, false is an EGL error occurs + */ + static native boolean eglReleaseThread(); + + /* + EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list); + EGLAPI EGLBoolean EGLAPIENTRY eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer); + EGLAPI EGLBoolean EGLAPIENTRY eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer); + */ + + /** + * Specifies the minimum number of video frame periods per buffer swap for + * the window associated with the current context. + * + * @param dpy the EGL display + * @param interval the frame interval + * + * @throws org.lwjgl.LWJGLException if an EGL error occurs + */ + static void eglSwapInterval(EGLDisplay dpy, int interval) throws LWJGLException { + //LWJGLUtil.log("eglSwapInterval"); + if ( !neglSwapInterval(dpy.getPointer(), interval) ) + throwEGLError("Failed to set swap interval."); + } + + private static native boolean neglSwapInterval(long dpy_ptr, int interval); + + /** + * Creates a new EGL context for the current rendering API. + * + * @param dpy the EGL display + * @param config the EGL config + * @param share_context the EGL context to share data with + * @param attrib_list the attribute list (may be null) + * + * @return the created EGL context + * + * @throws org.lwjgl.LWJGLException if an EGL error occurs + */ + static EGLContext eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_context, IntBuffer attrib_list) throws LWJGLException { + //LWJGLUtil.log("eglCreateContext"); + checkAttribList(attrib_list); + final long pointer = neglCreateContext(dpy.getPointer(), config.getPointer(), + share_context == null ? EGL_NO_CONTEXT : share_context.getPointer(), + MemoryUtil.getAddressSafe(attrib_list)); + + if ( pointer == EGL_NO_CONTEXT ) + throwEGLError("Failed to create EGL context."); + + return new EGLContext(dpy, config, pointer); + } + + private static native long neglCreateContext(long dpy_ptr, long config_ptr, long share_context_ptr, long attrib_list); + + /** + * Destroys a rendering context. + * + * @param dpy the EGL display + * @param ctx the EGL context + * + * @throws org.lwjgl.LWJGLException if an EGL error occurs + */ + static void eglDestroyContext(EGLDisplay dpy, EGLContext ctx) throws LWJGLException { + //LWJGLUtil.log("eglDestroyContext"); + if ( !neglDestroyContext(dpy.getPointer(), ctx.getPointer()) ) + throwEGLError("Failed to destroy context."); + } + + private static native boolean neglDestroyContext(long dpy_ptr, long ctx_ptr); + + /** + * Binds the specified context to the current thread and to the draw and read surfaces. + * + * @param dpy the EGL display + * @param draw the draw EGL surface + * @param read the read EGL surface + * @param ctx the EGL context to make current + * + * @throws org.lwjgl.LWJGLException if an EGL error occurs + * @throws PowerManagementEventException if an EGL power management event occurs + */ + static void eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx) throws LWJGLException, PowerManagementEventException { + //LWJGLUtil.log("eglMakeCurrent"); + if ( !neglMakeCurrent(dpy.getPointer(), + draw == null ? EGL_NO_SURFACE : draw.getPointer(), + read == null ? EGL_NO_SURFACE : read.getPointer(), + ctx == null ? EGL_NO_CONTEXT : ctx.getPointer()) ) { + final int error = eglGetError(); + if ( error == EGL_CONTEXT_LOST ) + throw new PowerManagementEventException(); + else + throwEGLError("Failed to change the current context.", error); + } + } + + /** + * Releases the current context without assigning a new one. + * + * @param dpy the EGL display + * + * @throws org.lwjgl.LWJGLException if an EGL error occurs + * @throws PowerManagementEventException if an EGL power management event occurs + * @see #eglMakeCurrent(EGLDisplay, EGLSurface, EGLSurface, EGLContext) + */ + public static void eglReleaseCurrent(EGLDisplay dpy) throws LWJGLException, PowerManagementEventException { + //LWJGLUtil.log("eglReleaseCurrent"); + eglMakeCurrent(dpy, null, null, null); + } + + private static native boolean neglMakeCurrent(long dpy_ptr, long draw_ptr, long read_ptr, long ctx_ptr); + + /** + * Returns the current EGL context for the current rendering API. + * If there is no context current, null is returned. + * + * @return the current context + * + * @throws org.lwjgl.LWJGLException if an EGL error occurs + */ + public static EGLContext eglGetCurrentContext() throws LWJGLException { + //LWJGLUtil.log("eglGetCurrentContext"); + // Get current context + final long ctx = neglGetCurrentContext(); + if ( ctx == EGL_NO_CONTEXT ) + return null; + + // Get current display + final EGLDisplay display = eglGetCurrentDisplay(); + + // Query context's CONFIG_ID + final IntBuffer attrib_list = APIUtil.getBufferInt(); + neglQueryContext(display.getPointer(), ctx, EGL_CONFIG_ID, MemoryUtil.getAddress0(attrib_list)); + + final EGLConfig config = getEGLConfig(display, attrib_list); + + // Create the context handle + return new EGLContext(display, config, ctx); + } + + /** + * Returns true if the specified EGL context is the current context. + * This method is faster than using {@code #eglGetCurrentContext} + * and comparing the two EGLContext objects. + * + * @param context the EGL context + * + * @return true if the EGL context is current + * + * @see #eglGetCurrentContext() + */ + public static boolean eglIsCurrentContext(EGLContext context) { + //LWJGLUtil.log("eglIsCurrentContext"); + return neglGetCurrentContext() == context.getPointer(); + } + + private static native long neglGetCurrentContext(); + + /** + * Returns the EGL surfaces used for rendering by the current context. + * If there is no context current, null is returned. + * + * @param readdraw the read or draw surface + * + * @return the current surface + * + * @throws org.lwjgl.LWJGLException if an EGL error occurs + */ + public static EGLSurface eglGetCurrentSurface(int readdraw) throws LWJGLException { + //LWJGLUtil.log("eglGetCurrentSurface"); + final long surface = neglGetCurrentSurface(readdraw); + if ( surface == EGL_NO_SURFACE ) + return null; + + // Get current display + EGLDisplay display = eglGetCurrentDisplay(); + + // Query context's CONFIG_ID + final IntBuffer attrib_list = APIUtil.getBufferInt(); + if ( !neglQuerySurface(display.getPointer(), surface, EGL_CONFIG_ID, MemoryUtil.getAddress0(attrib_list)) ) + throwEGLError("Failed to query surface EGL config ID."); + + final EGLConfig config = getEGLConfig(display, attrib_list); + + // Create the surface handle + return new EGLSurface(display, config, surface); + } + + private static native long neglGetCurrentSurface(int readdraw); + + /** + * Returns the EGL display associated with the current context. + * + * @return the current display + * + * @throws org.lwjgl.LWJGLException if an EGL error occurs + */ + public static EGLDisplay eglGetCurrentDisplay() throws LWJGLException { + //LWJGLUtil.log("eglGetCurrentDisplay"); + return new EGLDisplay(neglGetCurrentDisplay()); + } + + private static native long neglGetCurrentDisplay(); + + /** + * Returns the value of the specified EGL context attribute in the value parameter. + * + * @param dpy the EGL display + * @param ctx the EGL context + * @param attribute the context attribute + * @param value the attribute value will be returned here + * + * @throws org.lwjgl.LWJGLException if an EGL error occurs + */ + public static void eglQueryContext(EGLDisplay dpy, EGLContext ctx, int attribute, IntBuffer value) throws LWJGLException { + //LWJGLUtil.log("eglQueryContext"); + BufferChecks.checkBuffer(value, 1); + if ( !neglQueryContext(dpy.getPointer(), ctx.getPointer(), attribute, MemoryUtil.getAddress(value)) ) + throwEGLError("Failed to query context attribute."); + } + + private static native boolean neglQueryContext(long dpy_ptr, long ctx_ptr, int attribute, long value); + + /** + * Prevents native rendering API functions from executing until any + * outstanding client API rendering affecting the same surface is complete. + * + * @return true if the wait was successful, false is an EGL error occurs + */ + public static native boolean eglWaitClient(); + + /** + * This method does the equivalent of:
    + * + * EGLenum api = eglQueryAPI(); + * eglBindAPI(EGL_OPENGL_ES_API); + * eglWaitClient(); + * eglBindAPI(api); + * + * + * @return true if the wait was successful, false if an EGL error occurs + */ + public static native boolean eglWaitGL(); + + /** + * Prevents a client API command sequence from executing until any outstanding + * native rendering affecting the same surface is complete. + * + * @param engine the native rendering engine + * + * @return true if the wait was successful, false if an EGL error occurs + */ + public static native boolean eglWaitNative(int engine); + + /** + * Posts the color buffer to the window. + * + * @param dpy the EGL display + * @param surface the EGL back-buffered window surface + * + * @throws org.lwjgl.LWJGLException if an EGL occurs + * @throws PowerManagementEventException if an EGL power management event occurs + */ + static void eglSwapBuffers(EGLDisplay dpy, EGLSurface surface) throws LWJGLException, PowerManagementEventException { + //LWJGLUtil.log("eglSwapBuffers"); + if ( !neglSwapBuffers(dpy.getPointer(), surface.getPointer()) ) { + final int error = eglGetError(); + if ( error == EGL_CONTEXT_LOST ) + throw new PowerManagementEventException(); + else + throwEGLError("Failed to swap buffers.", error); + } + } + + private static native boolean neglSwapBuffers(long dpy_ptr, long surface_ptr); + + //EGLAPI EGLBoolean EGLAPIENTRY eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target); + + /* -------------------------------- + HELPER METHODS + -------------------------------- */ + + static void checkAttribList(IntBuffer attrib_list) { + if ( attrib_list == null ) + return; + + //BufferChecks.checkDirect(attrib_list); + if ( attrib_list.remaining() % 2 != 1 ) + throw new IllegalArgumentException("Invalid number of values in attribute list."); + if ( attrib_list.get(attrib_list.limit() - 1) != EGL_NONE ) + throw new IllegalArgumentException("The attribute list is not terminated with EGL_NONE."); + } + + private static EGLConfig getEGLConfig(final EGLDisplay dpy, final IntBuffer attrib_list) throws LWJGLException { + final int configID = attrib_list.get(0); + + // -- This fails on the emulator + // Get EGL config used by the context + attrib_list.put(0, EGL_CONFIG_ID).put(1, configID).put(2, EGL_NONE); + + final PointerBuffer configs_buffer = APIUtil.getBufferPointer(1); + if ( !neglChooseConfig(dpy.getPointer(), MemoryUtil.getAddress(attrib_list), MemoryUtil.getAddress0(configs_buffer), 1, MemoryUtil.getAddress(attrib_list, 3)) ) + throwEGLError("Failed to choose EGL config."); + + return new EGLConfig(dpy, configs_buffer.get(0)); + + // -- Emulator workaround + /* + EGLConfig config = null; + + final EGLConfig[] configs = eglGetConfigs(dpy, null, attrib_list); + final int config_size = attrib_list.get(0); + for ( int i = 0; i < config_size; i++ ) { + if ( configs[i].getConfigID() == configID ) { + config = configs[i]; + break; + } + } + + if ( config == null ) + throwEGLError("Failed to retrieve EGL config for current context."); + + return config; + //*/ + } + + static void throwEGLError(final String msg) throws LWJGLException { + throwEGLError(msg, eglGetError()); + } + + static void throwEGLError(String msg, final int error) throws LWJGLException { + if ( error != EGL_SUCCESS ) + msg += " EGL error: " + Util.translateEGLErrorString(error); + + throw new LWJGLException(msg); + } + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengles/EGLKHRFenceSync.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengles/EGLKHRFenceSync.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengles/EGLKHRFenceSync.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengles/EGLKHRFenceSync.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,174 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +import org.lwjgl.LWJGLException; +import org.lwjgl.MemoryUtil; + +import java.nio.IntBuffer; + +import static org.lwjgl.opengles.EGL.*; + +/** EGL_KHR_fence_sync wrapper class. */ +public final class EGLKHRFenceSync { + + /** + * Accepted by the <type> parameter of eglCreateSyncKHR, and returned + * in <value> when eglGetSyncAttribKHR is called with <attribute> + * EGL_SYNC_TYPE_KHR: + */ + public static final int EGL_SYNC_FENCE_KHR = 0x30F9; + + /** Accepted by the <attribute> parameter of eglGetSyncAttribKHR: */ + public static final int EGL_SYNC_TYPE_KHR = 0x30F7, + EGL_SYNC_STATUS_KHR = 0x30F1, + EGL_SYNC_CONDITION_KHR = 0x30F8; + + /** + * Returned in <value> when eglGetSyncAttribKHR is called with + * <attribute> EGL_SYNC_STATUS_KHR: + */ + public static final int EGL_SIGNALED_KHR = 0x30F2, + EGL_UNSIGNALED_KHR = 0x30F3; + + /** + * Returned in <value> when eglGetSyncAttribKHR is called with + * <attribute> EGL_SYNC_CONDITION_KHR: + */ + public static final int EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR = 0x30F0; + + /** Accepted in the <flags> parameter of eglClientWaitSyncKHR: */ + public static final int EGL_SYNC_FLUSH_COMMANDS_BIT_KHR = 0x0001; + + /** Accepted in the <timeout> parameter of eglClientWaitSyncKHR: */ + public static final long EGL_FOREVER_KHR = 0xFFFFFFFFFFFFFFFFl; + + /** Returned by eglClientWaitSyncKHR: */ + public static final int EGL_TIMEOUT_EXPIRED_KHR = 0x30F5, + EGL_CONDITION_SATISFIED_KHR = 0x30F6; + + /** Returned by eglCreateSyncKHR in the event of an error: */ + public static final long EGL_NO_SYNC_KHR = 0; + + static { + initNativeStubs(); + } + + private EGLKHRFenceSync() { + } + + private static native void initNativeStubs(); + + /** + * Creates a fence sync object for the specified EGL display and returns + * a handle to the new object. + * + * @param dpy the EGL display + * @param type the sync type + * @param attrib_list an attribute list (may be null) + * + * @return the created fence sync object + * + * @throws org.lwjgl.LWJGLException if an EGL error occurs. + */ + public static EGLSyncKHR eglCreateSyncKHR(EGLDisplay dpy, int type, IntBuffer attrib_list) throws LWJGLException { + checkAttribList(attrib_list); + + final long pointer = neglCreateSyncKHR(dpy.getPointer(), type, MemoryUtil.getAddressSafe(attrib_list)); + + if ( pointer == EGL_NO_SYNC_KHR ) + throwEGLError("Failed to create KHR fence sync object."); + + return new EGLSyncKHR(pointer); + } + + private static native long neglCreateSyncKHR(long dpy_ptr, int type, long attrib_list); + + /** + * Destroys an existing sync object. + * + * @param sync the sync object + * + * @throws org.lwjgl.LWJGLException if an EGL error occurs. + */ + public static void eglDestroySyncKHR(EGLDisplay dpy, EGLSyncKHR sync) throws LWJGLException { + if ( !neglDestroySyncKHR(dpy.getPointer(), sync.getPointer()) ) + throwEGLError("Failed to destroy KHR fence sync object."); + } + + private static native boolean neglDestroySyncKHR(long dpy_ptr, long sync_ptr); + + /** + * Blocks the calling thread until the specified sync object is + * signaled, or until a specified timeout value expires. + * + * @param sync the sync object + * @param flags the block flags + * @param timeout the block timeout + * + * @return the sync object status + * + * @throws org.lwjgl.LWJGLException if an EGL error occurs. + */ + public static int eglClientWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, int flags, long timeout) throws LWJGLException { + final int status = neglClientWaitSyncKHR(dpy.getPointer(), sync.getPointer(), flags, timeout); + + if ( status == EGL_FALSE ) + throwEGLError("Failed to block on KHR fence sync object."); + + return status; + } + + private static native int neglClientWaitSyncKHR(long dpy_ptr, long sync_ptr, int flags, long timeout); + + /** + * Returns the value of the sync object attribute. + * + * @param sync the sync object + * @param attribute the attribute to query + * + * @return the attribute value + * + * @throws org.lwjgl.LWJGLException if an EGL error occurs. + */ + public static int eglGetSyncAttribKHR(EGLDisplay dpy, EGLSyncKHR sync, int attribute) throws LWJGLException { + final IntBuffer value = APIUtil.getBufferInt(); + + if ( !neglGetSyncAttribKHR(dpy.getPointer(), sync.getPointer(), attribute, MemoryUtil.getAddress(value)) ) + throwEGLError("Failed to get KHR fence sync object attribute."); + + return value.get(0); + } + + private static native boolean neglGetSyncAttribKHR(long dpy_ptr, long sync_ptr, int attribute, long value); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengles/EGLKHRReusableSync.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengles/EGLKHRReusableSync.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengles/EGLKHRReusableSync.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengles/EGLKHRReusableSync.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,156 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +import org.lwjgl.LWJGLException; + +import java.nio.IntBuffer; + +import static org.lwjgl.opengles.EGL.*; + +/** EGL_KHR_reusable_sync wrapper class. */ +public final class EGLKHRReusableSync { + + /** + * Accepted by the <type> parameter of eglCreateSyncKHR, and returned + * in <value> when eglGetSyncAttribKHR is called with <attribute> + * EGL_SYNC_TYPE_KHR: + */ + public static final int EGL_SYNC_REUSABLE_KHR = 0x30FA; + + /** Accepted by the <attribute> parameter of eglGetSyncAttribKHR: */ + public static final int EGL_SYNC_TYPE_KHR = 0x30F7, + EGL_SYNC_STATUS_KHR = 0x30F1; + + /** + * Returned in <value> when eglGetSyncAttribKHR is called with + * <attribute> EGL_SYNC_STATUS_KHR: + */ + public static final int EGL_SIGNALED_KHR = 0x30F2, + EGL_UNSIGNALED_KHR = 0x30F3; + + /** Accepted in the <flags> parameter of eglClientWaitSyncKHR: */ + public static final int EGL_SYNC_FLUSH_COMMANDS_BIT_KHR = 0x0001; + + /** Accepted in the <timeout> parameter of eglClientWaitSyncKHR: */ + public static final long EGL_FOREVER_KHR = 0xFFFFFFFFFFFFFFFFl; + + /** Returned by eglClientWaitSyncKHR: */ + public static final int EGL_TIMEOUT_EXPIRED_KHR = 0x30F5, + EGL_CONDITION_SATISFIED_KHR = 0x30F6; + + /** Returned by eglCreateSyncKHR in the event of an error: */ + public static final long EGL_NO_SYNC_KHR = 0; + + static { + initNativeStubs(); + } + + private EGLKHRReusableSync() { + } + + private static native void initNativeStubs(); + + /** + * Creates a fence sync object for the specified EGL display and returns + * a handle to the new object. + * + * @param dpy the EGL display + * @param type the sync type + * @param attrib_list an attribute list (may be null) + * + * @return the created fence sync object + * + * @throws org.lwjgl.LWJGLException if an EGL error occurs. + */ + public static EGLSyncKHR eglCreateSyncKHR(EGLDisplay dpy, int type, IntBuffer attrib_list) throws LWJGLException { + return EGLKHRFenceSync.eglCreateSyncKHR(dpy, type, attrib_list); + } + + /** + * Destroys an existing sync object. + * + * @param sync the sync object + * + * @throws org.lwjgl.LWJGLException if an EGL error occurs. + */ + public static void eglDestroySyncKHR(EGLDisplay dpy, EGLSyncKHR sync) throws LWJGLException { + EGLKHRFenceSync.eglDestroySyncKHR(dpy, sync); + } + + /** + * Blocks the calling thread until the specified sync object is + * signaled, or until a specified timeout value expires. + * + * @param sync the sync object + * @param flags the block flags + * @param timeout the block timeout + * + * @return the sync object status + * + * @throws org.lwjgl.LWJGLException if an EGL error occurs. + */ + public static int eglClientWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, int flags, long timeout) throws LWJGLException { + return EGLKHRFenceSync.eglClientWaitSyncKHR(dpy, sync, flags, timeout); + } + + /** + * Signals or unsignals the sync object by changing its status to + * the specified mode. + * + * @param sync the sync object + * @param mode the mode + * + * @throws org.lwjgl.LWJGLException if an EGL error occurs. + */ + public static void eglSignalSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, int mode) throws LWJGLException { + if ( !neglSignalSyncKHR(dpy.getPointer(), sync.getPointer(), mode) ) + throwEGLError("Failed to signal the KHR fence sync object."); + } + + private static native boolean neglSignalSyncKHR(long dpy_ptr, long sync_ptr, int mode); + + /** + * Returns the value of the sync object attribute. + * + * @param sync the sync object + * @param attribute the attribute to query + * + * @return the attribute value + * + * @throws org.lwjgl.LWJGLException if an EGL error occurs. + */ + public static int eglGetSyncAttribKHR(EGLDisplay dpy, EGLSyncKHR sync, int attribute) throws LWJGLException { + return EGLKHRFenceSync.eglGetSyncAttribKHR(dpy, sync, attribute); + } + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengles/EGLNVSync.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengles/EGLNVSync.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengles/EGLNVSync.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengles/EGLNVSync.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,215 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +import org.lwjgl.LWJGLException; +import org.lwjgl.MemoryUtil; + +import java.nio.IntBuffer; + +import static org.lwjgl.opengles.EGL.*; + +/** EGL_NV_sync wrapper class. */ +public final class EGLNVSync { + + /** + * Accepted in the <condition> parameter of eglCreateFenceSyncNV, and + * returned in <value> when eglGetSyncAttribNV is called with <attribute> + * EGL_SYNC_CONDITION_NV: + */ + public static final int EGL_SYNC_PRIOR_COMMANDS_COMPLETE_NV = 0x30E6; + + /** + * Accepted as an attribute name in the <attrib_list> parameter of + * eglCreateFenceSyncNV, and by the <attribute> parameter of + * eglGetSyncAttribNV: + */ + public static final int EGL_SYNC_STATUS_NV = 0x30E7; + + /** + * Accepted as an attribute value in the <attrib_list> parameter of + * eglCreateFenceSyncNV for the EGL_SYNC_STATUS_NV attribute, by + * the <mode> parameter of eglSignalSyncNV and returned in <value> + * when eglGetSyncAttribNV is called with <attribute> + * EGL_SYNC_STATUS_NV: + */ + public static final int EGL_SIGNALED_NV = 0x30E8, + EGL_UNSIGNALED_NV = 0x30E9; + + /** Accepted in the <flags> parameter of eglClientWaitSyncNV: */ + public static final int EGL_SYNC_FLUSH_COMMANDS_BIT_NV = 0x0001; + + /** Accepted in the <timeout> parameter of eglClientWaitSyncNV: */ + public static final long EGL_FOREVER_NV = 0xFFFFFFFFFFFFFFFFL; + + /** Returned by eglClientWaitSyncNV: */ + public static final int EGL_ALREADY_SIGNALED_NV = 0x30EA, + EGL_TIMEOUT_EXPIRED_NV = 0x30EB, + EGL_CONDITION_SATISFIED_NV = 0x30EC; + + /** Accepted in the <attribute> parameter of eglGetSyncAttribNV: */ + public static final int EGL_SYNC_TYPE_NV = 0x30ED, + EGL_SYNC_CONDITION_NV = 0x30EE; + + /** + * Returned in <value> when eglGetSyncAttribNV is called with + * <attribute> EGL_SYNC_TYPE_NV: + */ + public static final int EGL_SYNC_FENCE_NV = 0x30EF; + + /** Returned by eglCreateFenceSyncNV in the event of an error: */ + public static final long EGL_NO_SYNC_NV = 0; + + static { + initNativeStubs(); + } + + private EGLNVSync() { + } + + private static native void initNativeStubs(); + + /** + * Creates a fence sync object for the specified EGL display and returns + * a handle to the new object. + * + * @param dpy the EGL display + * @param condition the sync condition + * @param attrib_list an attribute list (may be null) + * + * @return the created fence sync object + * + * @throws org.lwjgl.LWJGLException if an EGL error occurs. + */ + public static EGLSyncNV eglCreateFenceSyncNV(EGLDisplay dpy, int condition, IntBuffer attrib_list) throws LWJGLException { + checkAttribList(attrib_list); + + final long pointer = neglCreateFenceSyncNV(dpy.getPointer(), condition, MemoryUtil.getAddressSafe(attrib_list)); + + if ( pointer == EGL_NO_SYNC_NV ) + throwEGLError("Failed to create NV fence sync object."); + + return new EGLSyncNV(pointer); + } + + private static native long neglCreateFenceSyncNV(long dpy_ptr, int condition, long attrib_list); + + /** + * Destroys an existing sync object. + * + * @param sync the sync object + * + * @throws org.lwjgl.LWJGLException if an EGL error occurs. + */ + public static void eglDestroySyncNV(EGLSyncNV sync) throws LWJGLException { + if ( !neglDestroySyncNV(sync.getPointer()) ) + throwEGLError("Failed to destroy NV fence sync object."); + } + + private static native boolean neglDestroySyncNV(long sync_ptr); + + /** + * Inserts a fence command into the command stream of the bound API's current + * context and associates it with sync object. + * + * @param sync the sync object + * + * @throws org.lwjgl.LWJGLException if an EGL error occurs. + */ + public static void eglFenceNV(EGLSyncNV sync) throws LWJGLException { + if ( !neglFenceNV(sync.getPointer()) ) + throwEGLError("Failed to insert NV fence command."); + } + + private static native boolean neglFenceNV(long sync_ptr); + + /** + * Blocks the calling thread until the specified sync object is + * signaled, or until a specified timeout value expires. + * + * @param sync the sync object + * @param flags the block flags + * @param timeout the block timeout + * + * @return the sync object status + * + * @throws org.lwjgl.LWJGLException if an EGL error occurs. + */ + public static int eglClientWaitSyncNV(EGLSyncNV sync, int flags, long timeout) throws LWJGLException { + final int status = neglClientWaitSyncNV(sync.getPointer(), flags, timeout); + + if ( status == EGL_FALSE ) + throwEGLError("Failed to block on NV fence sync object."); + + return status; + } + + private static native int neglClientWaitSyncNV(long sync_ptr, int flags, long timeout); + + /** + * Signals or unsignals the sync object by changing its status to + * the specified mode. + * + * @param sync the sync object + * @param mode the mode + * + * @throws org.lwjgl.LWJGLException if an EGL error occurs. + */ + public static void eglSignalSyncNV(EGLSyncNV sync, int mode) throws LWJGLException { + if ( !neglSignalSyncNV(sync.getPointer(), mode) ) + throwEGLError("Failed to signal the NV fence sync object."); + } + + private static native boolean neglSignalSyncNV(long sync_ptr, int mode); + + /** + * Returns the value of the sync object attribute. + * + * @param sync the sync object + * @param attribute the attribute to query + * + * @return the attribute value + * + * @throws org.lwjgl.LWJGLException if an EGL error occurs. + */ + public static int eglGetSyncAttribNV(EGLSyncNV sync, int attribute) throws LWJGLException { + final IntBuffer value = APIUtil.getBufferInt(); + + if ( !neglGetSyncAttribNV(sync.getPointer(), attribute, MemoryUtil.getAddress0(value)) ) + throwEGLError("Failed to get NV fence sync object attribute."); + + return value.get(0); + } + + private static native boolean neglGetSyncAttribNV(long sync_ptr, int attribute, long value); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengles/EGLSurface.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengles/EGLSurface.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengles/EGLSurface.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengles/EGLSurface.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,120 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +import org.lwjgl.LWJGLException; +import org.lwjgl.PointerWrapperAbstract; + +import java.nio.IntBuffer; + +import static org.lwjgl.opengles.EGL.*; + +/** EGLSurface wrapper class. */ +public final class EGLSurface extends PointerWrapperAbstract { + + private final EGLDisplay display; + private final EGLConfig config; + + private boolean destroyed; + + EGLSurface(final EGLDisplay display, final EGLConfig config, final long pointer) { + super(pointer); + + if ( !display.isInitialized() ) + throw new IllegalStateException("Invalid EGL display specified."); + + this.display = display; + this.config = config; + } + + /** + * Returns the EGL display from which this EGL surface was created. + * + * @return the EGL display + */ + public EGLDisplay getDisplay() { + return display; + } + + /** + * Returns the EGL config associated with this EGL surface. + * + * @return the EGL config + */ + public EGLConfig getConfig() { + return config; + } + + private void checkDestroyed() { + if ( destroyed ) + throw new IllegalStateException("The EGL surface has been destroyed."); + } + + /** Destroys this EGL surface. */ + public void destroy() throws LWJGLException { + eglDestroySurface(display, this); + destroyed = true; + } + + void setAttribute(int attribute, int value) throws LWJGLException { + checkDestroyed(); + eglSurfaceAttrib(display, this, attribute, value); + } + + /** + * Returns the value of the specified EGL surface attribute. + * + * @param attribute the surface attribute + * + * @return the attribute value + */ + public int getAttribute(int attribute) throws LWJGLException { + checkDestroyed(); + + IntBuffer value = APIUtil.getBufferInt(); + eglQuerySurface(display, this, attribute, value); + return value.get(0); + } + + public void swapBuffers() throws LWJGLException, PowerManagementEventException { + checkDestroyed(); + eglSwapBuffers(display, this); + } + + public boolean equals(final Object obj) { + if ( obj == null || !(obj instanceof EGLSurface) ) + return false; + + return getPointer() == ((EGLSurface)obj).getPointer(); + } + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengles/EGLSyncKHR.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengles/EGLSyncKHR.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengles/EGLSyncKHR.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengles/EGLSyncKHR.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +import org.lwjgl.PointerWrapperAbstract; + +/** EGLSyncKHR wrapper class. */ +public class EGLSyncKHR extends PointerWrapperAbstract { + + public EGLSyncKHR(final long pointer) { + super(pointer); + } + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengles/EGLSyncNV.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengles/EGLSyncNV.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengles/EGLSyncNV.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengles/EGLSyncNV.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +import org.lwjgl.PointerWrapperAbstract; + +/** EGLSyncNV wrapper class. */ +public class EGLSyncNV extends PointerWrapperAbstract { + + public EGLSyncNV(final long pointer) { + super(pointer); + } + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengles/FastIntMap.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengles/FastIntMap.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengles/FastIntMap.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengles/FastIntMap.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,238 @@ +/* + * Copyright 2002-2004 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" + * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.lwjgl.opengles; + +import java.util.Iterator; + +/** + * A hash map using primitive ints as keys rather than objects. + * + * @author Justin Couch + * @author Alex Chaffee (alex@apache.org) + * @author Stephen Colebourne + * @author Nathan Sweet + */ +final class FastIntMap implements Iterable> { + + private Entry[] table; + private int size, mask, capacity, threshold; + + /** Same as: FastIntMap(16, 0.75f); */ + FastIntMap() { + this(16, 0.75f); + } + + /** Same as: FastIntMap(initialCapacity, 0.75f); */ + FastIntMap(int initialCapacity) { + this(initialCapacity, 0.75f); + } + + FastIntMap(int initialCapacity, float loadFactor) { + if ( initialCapacity > 1 << 30 ) throw new IllegalArgumentException("initialCapacity is too large."); + if ( initialCapacity < 0 ) throw new IllegalArgumentException("initialCapacity must be greater than zero."); + if ( loadFactor <= 0 ) throw new IllegalArgumentException("initialCapacity must be greater than zero."); + capacity = 1; + while ( capacity < initialCapacity ) + capacity <<= 1; + this.threshold = (int)(capacity * loadFactor); + this.table = new Entry[capacity]; + this.mask = capacity - 1; + } + + private int index(final int key) { + return index(key, mask); + } + + private static int index(final int key, final int mask) { + return key & mask; + } + + public V put(int key, V value) { + final Entry[] table = this.table; + int index = index(key); + + // Check if key already exists. + for ( Entry e = table[index]; e != null; e = e.next ) { + if ( e.key != key ) continue; + V oldValue = e.value; + e.value = value; + return oldValue; + } + + table[index] = new Entry(key, value, table[index]); + + if ( size++ >= threshold ) + rehash(table); + + return null; + } + + private void rehash(final Entry[] table) { + final int newCapacity = 2 * capacity; + final int newMask = newCapacity - 1; + + final Entry[] newTable = new Entry[newCapacity]; + + for ( int i = 0, index; i < table.length; i++ ) { + Entry e = table[i]; + if ( e == null ) continue; + do { + final Entry next = e.next; + index = index(e.key, newMask); + e.next = newTable[index]; + newTable[index] = e; + e = next; + } while ( e != null ); + } + + this.table = newTable; + capacity = newCapacity; + mask = newMask; + threshold *= 2; + } + + public V get(int key) { + final int index = index(key); + for ( Entry e = table[index]; e != null; e = e.next ) + if ( e.key == key ) return e.value; + return null; + } + + public boolean containsValue(Object value) { + final Entry[] table = this.table; + for ( int i = table.length - 1; i >= 0; i-- ) + for ( Entry e = table[i]; e != null; e = e.next ) + if ( e.value.equals(value) ) return true; + return false; + } + + public boolean containsKey(int key) { + final int index = index(key); + for ( Entry e = table[index]; e != null; e = e.next ) + if ( e.key == key ) return true; + return false; + } + + public V remove(int key) { + final int index = index(key); + + Entry prev = table[index]; + Entry e = prev; + while ( e != null ) { + Entry next = e.next; + if ( e.key == key ) { + size--; + if ( prev == e ) + table[index] = next; + else + prev.next = next; + return e.value; + } + prev = e; + e = next; + } + return null; + } + + public int size() { + return size; + } + + public boolean isEmpty() { + return size == 0; + } + + public void clear() { + final Entry[] table = this.table; + for ( int index = table.length - 1; index >= 0; index-- ) + table[index] = null; + size = 0; + } + + public EntryIterator iterator() { + return new EntryIterator(); + } + + public class EntryIterator implements Iterator> { + + private int nextIndex; + private Entry current; + + EntryIterator() { + reset(); + } + + public void reset() { + current = null; + // Find first bucket. + final Entry[] table = FastIntMap.this.table; + int i; + for ( i = table.length - 1; i >= 0; i-- ) + if ( table[i] != null ) break; + nextIndex = i; + } + + public boolean hasNext() { + if ( nextIndex >= 0 ) return true; + Entry e = current; + return e != null && e.next != null; + } + + public Entry next() { + // Next entry in current bucket. + Entry e = current; + if ( e != null ) { + e = e.next; + if ( e != null ) { + current = e; + return e; + } + } + // Use the bucket at nextIndex and find the next nextIndex. + final Entry[] table = FastIntMap.this.table; + int i = nextIndex; + e = current = table[i]; + while ( --i >= 0 ) + if ( table[i] != null ) break; + nextIndex = i; + return e; + } + + public void remove() { + FastIntMap.this.remove(current.key); + } + } + + static final class Entry { + + final int key; + T value; + Entry next; + + Entry(int key, T value, Entry next) { + this.key = key; + this.value = value; + this.next = next; + } + + public int getKey() { + return key; + } + + public T getValue() { + return value; + } + + } + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengles/GLChecks.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengles/GLChecks.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengles/GLChecks.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengles/GLChecks.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,208 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +import org.lwjgl.BufferUtils; +import org.lwjgl.LWJGLUtil; +import org.lwjgl.opengl.OpenGLException; + +import java.nio.Buffer; + +import static org.lwjgl.opengles.GLES20.*; + +/** + * A class to check buffer boundaries in GL methods. Many GL + * methods read data from the GL into a native Buffer at its current position. If there is unsufficient space in the buffer when + * the call is made then a buffer overflow would otherwise occur and cause unexpected behaviour, a crash, or worse, a security + * risk. Therefore in those methods where GL reads data back into a buffer, we will call a bounds check method from this class + * to ensure that there is sufficient space in the buffer. + *

    + * Thrown by the debug build library of the LWJGL if any OpenGL operation causes an error. + * + * @author cix_foo + * @version $Revision: 3459 $ + * $Id: GLChecks.java 3459 2010-11-29 17:21:05Z spasi $ + */ +class GLChecks { + + /** Static methods only! */ + private GLChecks() { + } + + /** Helper method to ensure that array buffer objects are disabled. If they are enabled, we'll throw an OpenGLException */ + static void ensureArrayVBOdisabled() { + if ( LWJGLUtil.CHECKS && StateTracker.getTracker().arrayBuffer != 0 ) + throw new OpenGLException("Cannot use Buffers when Array Buffer Object is enabled"); + } + + /** Helper method to ensure that array buffer objects are enabled. If they are disabled, we'll throw an OpenGLException */ + static void ensureArrayVBOenabled() { + if ( LWJGLUtil.CHECKS && StateTracker.getTracker().arrayBuffer == 0 ) + throw new OpenGLException("Cannot use offsets when Array Buffer Object is disabled"); + } + + /** Helper method to ensure that element array buffer objects are disabled. If they are enabled, we'll throw an OpenGLException */ + static void ensureElementVBOdisabled() { + if ( LWJGLUtil.CHECKS && StateTracker.getTracker().elementArrayBuffer != 0 ) + throw new OpenGLException("Cannot use Buffers when Element Array Buffer Object is enabled"); + } + + /** Helper method to ensure that element array buffer objects are enabled. If they are disabled, we'll throw an OpenGLException */ + static void ensureElementVBOenabled() { + if ( LWJGLUtil.CHECKS && StateTracker.getTracker().elementArrayBuffer == 0 ) + throw new OpenGLException("Cannot use offsets when Element Array Buffer Object is disabled"); + } + + /** Helper method to ensure that pixel pack buffer objects are disabled. If they are enabled, we'll throw an OpenGLException */ + static void ensurePackPBOdisabled() { + if ( LWJGLUtil.CHECKS && StateTracker.getTracker().pixelPackBuffer != 0 ) + throw new OpenGLException("Cannot use Buffers when Pixel Pack Buffer Object is enabled"); + } + + /** Helper method to ensure that pixel pack buffer objects are enabled. If they are disabled, we'll throw an OpenGLException */ + static void ensurePackPBOenabled() { + if ( LWJGLUtil.CHECKS && StateTracker.getTracker().pixelPackBuffer == 0 ) + throw new OpenGLException("Cannot use offsets when Pixel Pack Buffer Object is disabled"); + } + + /** Helper method to ensure that pixel unpack buffer objects are disabled. If they are enabled, we'll throw an OpenGLException */ + static void ensureUnpackPBOdisabled() { + if ( LWJGLUtil.CHECKS && StateTracker.getTracker().pixelUnpackBuffer != 0 ) + throw new OpenGLException("Cannot use Buffers when Pixel Unpack Buffer Object is enabled"); + } + + /** Helper method to ensure that pixel unpack buffer objects are enabled. If they are disabled, we'll throw an OpenGLException */ + static void ensureUnpackPBOenabled() { + if ( LWJGLUtil.CHECKS && StateTracker.getTracker().pixelUnpackBuffer == 0 ) + throw new OpenGLException("Cannot use offsets when Pixel Unpack Buffer Object is disabled"); + } + + /** + * Calculate the storage required for an image in elements + * + * @param format The format of the image (example: GL_RGBA) + * @param type The type of the image elements (example: GL_UNSIGNED_BYTE) + * @param width The width of the image + * @param height The height of the image (1 for 1D images) + * @param depth The depth of the image (1 for 2D images) + * + * @return the size, in elements, of the image + */ + static int calculateImageStorage(Buffer buffer, int format, int type, int width, int height, int depth) { + return LWJGLUtil.CHECKS ? calculateImageStorage(format, type, width, height, depth) >> BufferUtils.getElementSizeExponent(buffer) : 0; + } + + static int calculateTexImage1DStorage(Buffer buffer, int format, int type, int width) { + return LWJGLUtil.CHECKS ? calculateTexImage1DStorage(format, type, width) >> BufferUtils.getElementSizeExponent(buffer) : 0; + } + + static int calculateTexImage2DStorage(Buffer buffer, int format, int type, int width, int height) { + return LWJGLUtil.CHECKS ? calculateTexImage2DStorage(format, type, width, height) >> BufferUtils.getElementSizeExponent(buffer) : 0; + } + + static int calculateTexImage3DStorage(Buffer buffer, int format, int type, int width, int height, int depth) { + return LWJGLUtil.CHECKS ? calculateTexImage3DStorage(format, type, width, height, depth) >> BufferUtils.getElementSizeExponent(buffer) : 0; + } + + /** + * Calculate the storage required for an image in bytes. + * + * @param format The format of the image (example: GL_RGBA) + * @param type The type of the image elements (example: GL_UNSIGNED_BYTE) + * @param width The width of the image + * @param height The height of the image (1 for 1D images) + * @param depth The depth of the image (1 for 2D images) + * + * @return the size, in bytes, of the image + */ + private static int calculateImageStorage(int format, int type, int width, int height, int depth) { + return calculateBytesPerPixel(format, type) * width * height * depth; + } + + private static int calculateTexImage1DStorage(int format, int type, int width) { + return calculateBytesPerPixel(format, type) * width; + } + + private static int calculateTexImage2DStorage(int format, int type, int width, int height) { + return calculateTexImage1DStorage(format, type, width) * height; + } + + private static int calculateTexImage3DStorage(int format, int type, int width, int height, int depth) { + return calculateTexImage2DStorage(format, type, width, height) * depth; + } + + private static int calculateBytesPerPixel(int format, int type) { + int bpe; + switch ( type ) { + case GL_UNSIGNED_BYTE: + case GL_BYTE: + bpe = 1; + break; + case GL_UNSIGNED_SHORT: + case GL_SHORT: + bpe = 2; + break; + case GL_UNSIGNED_INT: + case GL_INT: + case GL_FLOAT: + bpe = 4; + break; + default: + // TODO: Add more types (like the GL12 types GL_UNSIGNED_INT_8_8_8_8 + return 0; + // throw new IllegalArgumentException("Unknown type " + type); + } + int epp; + switch ( format ) { + case GL_LUMINANCE: + case GL_ALPHA: + epp = 1; + break; + + case GL_LUMINANCE_ALPHA: + epp = 2; + break; + case GL_RGB: + epp = 3; + break; + case GL_RGBA: + epp = 4; + break; + default: + // TODO: Add more formats. Assuming 4 is too wasteful on buffer sizes where e.g. 1 is enough (like GL_DEPTH_COMPONENT) + return 0; + } + + return bpe * epp; + } + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengles/GLContext.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengles/GLContext.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengles/GLContext.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengles/GLContext.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,312 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +import org.lwjgl.LWJGLException; +import org.lwjgl.LWJGLUtil; +import org.lwjgl.Sys; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.security.AccessController; +import java.security.PrivilegedActionException; +import java.security.PrivilegedExceptionAction; +import java.util.Map; +import java.util.Set; +import java.util.StringTokenizer; +import java.util.WeakHashMap; + +import static org.lwjgl.opengles.GLES20.*; + +/** + *

    + * Manages GL contexts. Before any rendering is done by a LWJGL system, a call should be made to GLContext.useContext() with a + * context. This will ensure that GLContext has an accurate reflection of the current context's capabilities and function + * pointers. + *

    + * This class is thread-safe in the sense that multiple threads can safely call all public methods. The class is also + * thread-aware in the sense that it tracks a per-thread current context (including capabilities and function pointers). + * That way, multiple threads can have multiple contexts current and render to them concurrently. + * + * @author elias_naur + * @version $Revision: 3279 $ + * $Id: GLContext.java 3279 2010-03-11 21:06:49Z spasi $ + */ +public final class GLContext { + + /** Maps threads to their current context's ContextCapabilities, if any */ + private static final ThreadLocal current_capabilities = new ThreadLocal(); + + /** + * The getCapabilities() method is a potential hot spot in any LWJGL application, since + * it is needed for context capability discovery (e.g. is OpenGL 2.0 supported?), and + * for the function pointers of gl functions. However, the 'current_capabilities' ThreadLocal + * is (relatively) expensive to look up, and since most OpenGL applications use are single threaded + * rendering, the following two is an optimization for this case. + *

    + * ThreadLocals can be thought of as a mapping between threads and values, so the idea + * is to use a lock-less cache of mappings between threads and the current ContextCapabilities. The cache + * could be any size, but in our case, we want a single sized cache for optimal performance + * in the single threaded case. + *

    + * 'fast_path_cache' is the most recent ContextCapabilities (potentially null) and its owner. By + * recent I mean the last thread setting the value in setCapabilities(). When getCapabilities() + * is called, a check to see if the current is the owner of the ContextCapabilities instance in + * fast_path_cache. If so, the instance is returned, if not, some thread has since taken ownership + * of the cache entry and the slower current_capabilities ThreadLocal is queried instead. + *

    + * No locks are needed in get/setCapabilities, because even though fast_path_cache can be accessed + * from multiple threads at once, we are guaranteed by the JVM spec that its value is always valid. + * Furthermore, if the ownership test in getCapabilities() succeeds, the cache entry can only contain + * the correct ContextCapabilites (that is, the one from getThreadLocalCapabilites()), + * since no other thread can set the owner to anyone else than itself. + */ + private static CapabilitiesCacheEntry fast_path_cache = new CapabilitiesCacheEntry(); + + /** + * Simple lock-free cache of CapabilitesEntryCache to avoid allocating more than one + * cache entry per thread + */ + private static final ThreadLocal thread_cache_entries = new ThreadLocal(); + + /** + * The weak mapping from context Object instances to ContextCapabilities. Used + * to avoid recreating a ContextCapabilities every time a context is made current. + */ + private static final Map capability_cache = new WeakHashMap(); + + /** Reference count of the native opengl implementation library */ + private static int gl_ref_count; + private static boolean did_auto_load; + + static { + Sys.initialize(); + } + + /** + * Get the current capabilities instance. It contains the flags used + * to test for support of a particular extension. + * + * @return The current capabilities instance. + */ + public static ContextCapabilities getCapabilities() { + CapabilitiesCacheEntry recent_cache_entry = fast_path_cache; + // Check owner of cache entry + if ( recent_cache_entry.owner == Thread.currentThread() ) { + /* The owner ship test succeeded, so the cache must contain the current ContextCapabilities instance + * assert recent_cache_entry.capabilities == getThreadLocalCapabilities(); + */ + return recent_cache_entry.capabilities; + } else // Some other thread has written to the cache since, and we fall back to the slower path + return getThreadLocalCapabilities(); + } + + private static ContextCapabilities getThreadLocalCapabilities() { + return current_capabilities.get(); + } + + /** + * Set the current capabilities instance. It contains the flags used + * to test for support of a particular extension. + * + * @return The current capabilities instance. + */ + static void setCapabilities(ContextCapabilities capabilities) { + current_capabilities.set(capabilities); + + CapabilitiesCacheEntry thread_cache_entry = thread_cache_entries.get(); + if ( thread_cache_entry == null ) { + thread_cache_entry = new CapabilitiesCacheEntry(); + thread_cache_entries.set(thread_cache_entry); + } + thread_cache_entry.owner = Thread.currentThread(); + thread_cache_entry.capabilities = capabilities; + + fast_path_cache = thread_cache_entry; + } + + /** + * Determine which extensions are available and returns the context profile mask. Helper method to ContextCapabilities. + * + * @param supported_extensions the Set to fill with the available extension names + * + * @return the context profile mask, will be 0 for any version < 3.2 + */ + static void getSupportedExtensions(final Set supported_extensions) { + // Detect OpenGL version first + final String version = glGetString(GL_VERSION); + if ( version == null ) + throw new IllegalStateException("glGetString(GL_VERSION) returned null - possibly caused by missing current context."); + + final String VERSION_PREFIX = "OpenGL ES "; + final StringTokenizer version_tokenizer = new StringTokenizer(version.substring(VERSION_PREFIX.length()), ". "); + + int majorVersion = 0; + int minorVersion = 0; + try { + majorVersion = Integer.parseInt(version_tokenizer.nextToken()); + minorVersion = Integer.parseInt(version_tokenizer.nextToken()); + } catch (NumberFormatException e) { + LWJGLUtil.log("The major and/or minor OpenGL version is malformed: " + e.getMessage()); + } + + // ----------------------[ 2.X ]---------------------- + if ( 3 <= majorVersion ) + supported_extensions.add("OpenGLES30"); + if ( 2 <= majorVersion ) + supported_extensions.add("OpenGLES20"); + + // Parse EXTENSIONS string + final String extensions_string = glGetString(GL_EXTENSIONS); + if ( extensions_string == null ) + throw new IllegalStateException("glGetString(GL_EXTENSIONS) returned null - is there a context current?"); + + final StringTokenizer tokenizer = new StringTokenizer(extensions_string); + while ( tokenizer.hasMoreTokens() ) + supported_extensions.add(tokenizer.nextToken()); + } + + /** + * Helper method to ContextCapabilities. It will try to initialize the native stubs, + * and remove the given extension name from the extension set if the initialization fails. + */ + static void initNativeStubs(final Class extension_class, Set supported_extensions, String ext_name) { + //resetNativeStubs(extension_class); + if ( supported_extensions.contains(ext_name) ) { + try { + doInitNativeStubs(extension_class); + } catch (LWJGLException e) { + LWJGLUtil.log("Failed to initialize extension " + extension_class + " - exception: " + e); + supported_extensions.remove(ext_name); + } + } + } + + static void doInitNativeStubs(final Class extension_class) throws LWJGLException { + try { + AccessController.doPrivileged(new PrivilegedExceptionAction() { + public Object run() throws Exception { + Method init_stubs_method = extension_class.getDeclaredMethod("initNativeStubs"); + init_stubs_method.invoke(null); + return null; + } + }); + } catch (PrivilegedActionException e) { + final Throwable c = e.getCause(); + if ( c instanceof InvocationTargetException ) + throw new LWJGLException(c.getCause()); + else + throw new LWJGLException(c); + } + } + + /** + * Makes a GL context the current LWJGL context by loading GL function pointers. The context must be current before a call to + * this method! Instead it simply ensures that the current context is reflected accurately by GLContext's extension caps and + * function pointers. Use useContext(null) when no context is active.

    If the context is the same as last time, then this is + * a no-op.

    If the context has not been encountered before it will be fully initialized from scratch. Otherwise a cached set + * of caps and function pointers will be used.

    The reference to the context is held in a weak reference; therefore if no + * strong reference exists to the GL context it will automatically be forgotten by the VM at an indeterminate point in the + * future, freeing up a little RAM. + * + * @param context The context object, which uniquely identifies a GL context. If context is null, the native stubs are + * unloaded. + * + * @throws org.lwjgl.LWJGLException if context non-null, and the gl library can't be loaded or the basic GL11 functions can't be loaded + */ + public static synchronized void useContext(Object context) throws LWJGLException { + if ( context == null ) { + // Moved this to the shutdown hook + ContextCapabilities.unloadAllStubs(); + setCapabilities(null); + if ( did_auto_load ) + unloadOpenGLLibrary(); + return; + } + + if ( gl_ref_count == 0 ) { + loadOpenGLLibrary(); + did_auto_load = true; + } + + try { + ContextCapabilities capabilities = capability_cache.get(context); + if ( capabilities == null ) { + /* + * The capabilities object registers itself as current. This behaviour is caused + * by a chicken-and-egg situation where the constructor needs to call GL functions + * as part of its capability discovery, but GL functions cannot be called before + * a capabilities object has been set. + */ + new ContextCapabilities(); + capability_cache.put(context, getCapabilities()); + } else + setCapabilities(capabilities); + } catch (LWJGLException e) { + if ( did_auto_load ) + unloadOpenGLLibrary(); + throw e; + + } + } + + /** If the OpenGL reference count is 0, the library is loaded. The reference count is then incremented. */ + public static synchronized void loadOpenGLLibrary() throws LWJGLException { + if ( gl_ref_count == 0 ) + nLoadOpenGLLibrary(); + gl_ref_count++; + } + + private static native void nLoadOpenGLLibrary() throws LWJGLException; + + /** The OpenGL library reference count is decremented, and if it reaches 0, the library is unloaded. */ + public static synchronized void unloadOpenGLLibrary() { + gl_ref_count--; + /* + * Unload the native OpenGL library unless we're on linux, since + * some drivers (NVIDIA proprietary) crash on exit when unloading the library. + */ + if ( gl_ref_count == 0 && LWJGLUtil.getPlatform() != LWJGLUtil.PLATFORM_LINUX ) + nUnloadOpenGLLibrary(); + } + + private static native void nUnloadOpenGLLibrary(); + + /** Native method to clear native stub bindings */ + static native void resetNativeStubs(Class clazz); + + private static final class CapabilitiesCacheEntry { + + Thread owner; + ContextCapabilities capabilities; + } +} diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengles/GLSync.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengles/GLSync.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengles/GLSync.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengles/GLSync.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2002-2012 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +import org.lwjgl.PointerWrapperAbstract; + +/** + * This class is a wrapper around a GLsync pointer. + * + * @author spasi + */ +public final class GLSync extends PointerWrapperAbstract { + + GLSync(final long sync) { + super(sync); + } + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengles/KHRDebugCallback.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengles/KHRDebugCallback.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengles/KHRDebugCallback.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengles/KHRDebugCallback.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,205 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +import org.lwjgl.PointerWrapperAbstract; + +/** + * Instances of this class are needed to use the callback functionality of the KHR_debug extension. + * Users of this class may provide implementations of the {@code Handler} interface to receive notifications. + * The same {@code Handler} instance may be used by different contexts but it is not recommended. + * Handler notifications are synchronized. + * + * @author Spasi + */ +public final class KHRDebugCallback extends PointerWrapperAbstract { + + /** Severity levels. */ + private static final int + GL_DEBUG_SEVERITY_HIGH = 0x9146, + GL_DEBUG_SEVERITY_MEDIUM = 0x9147, + GL_DEBUG_SEVERITY_LOW = 0x9148, + GL_DEBUG_SEVERITY_NOTIFICATION = 0x826B; + + /** Sources. */ + private static final int + GL_DEBUG_SOURCE_API = 0x8246, + GL_DEBUG_SOURCE_WINDOW_SYSTEM = 0x8247, + GL_DEBUG_SOURCE_SHADER_COMPILER = 0x8248, + GL_DEBUG_SOURCE_THIRD_PARTY = 0x8249, + GL_DEBUG_SOURCE_APPLICATION = 0x824A, + GL_DEBUG_SOURCE_OTHER = 0x824B; + + /** Types. */ + private static final int + GL_DEBUG_TYPE_ERROR = 0x824C, + GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR = 0x824D, + GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR = 0x824E, + GL_DEBUG_TYPE_PORTABILITY = 0x824F, + GL_DEBUG_TYPE_PERFORMANCE = 0x8250, + GL_DEBUG_TYPE_OTHER = 0x8251, + GL_DEBUG_TYPE_MARKER = 0x8268; + + private static final long CALLBACK_POINTER; + + static { + long pointer = 0; + try { + // Call reflectively so that we can compile this class for the Generator. + pointer = (Long)Class.forName("org.lwjgl.opengles.CallbackUtil").getDeclaredMethod("getDebugCallbackKHR").invoke(null); + } catch (Exception e) { + // ignore + } + CALLBACK_POINTER = pointer; + } + + private final Handler handler; + + /** + * Creates an KHRebugCallback with a default callback handler. + * The default handler will simply print the message on System.err. + */ + public KHRDebugCallback() { + this(new Handler() { + public void handleMessage(final int source, final int type, final int id, final int severity, final String message) { + System.err.println("[LWJGL] KHR_debug message"); + System.err.println("\tID: " + id); + + String description; + switch ( source ) { + case GL_DEBUG_SOURCE_API: + description = "API"; + break; + case GL_DEBUG_SOURCE_WINDOW_SYSTEM: + description = "WINDOW SYSTEM"; + break; + case GL_DEBUG_SOURCE_SHADER_COMPILER: + description = "SHADER COMPILER"; + break; + case GL_DEBUG_SOURCE_THIRD_PARTY: + description = "THIRD PARTY"; + break; + case GL_DEBUG_SOURCE_APPLICATION: + description = "APPLICATION"; + break; + case GL_DEBUG_SOURCE_OTHER: + description = "OTHER"; + break; + default: + description = "Unknown (" + Integer.toHexString(source) + ")"; + } + System.err.println("\tSource: " + description); + + switch ( type ) { + case GL_DEBUG_TYPE_ERROR: + description = "ERROR"; + break; + case GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR: + description = "DEPRECATED BEHAVIOR"; + break; + case GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR: + description = "UNDEFINED BEHAVIOR"; + break; + case GL_DEBUG_TYPE_PORTABILITY: + description = "PORTABILITY"; + break; + case GL_DEBUG_TYPE_PERFORMANCE: + description = "PERFORMANCE"; + break; + case GL_DEBUG_TYPE_OTHER: + description = "OTHER"; + break; + case GL_DEBUG_TYPE_MARKER: + description = "MARKER"; + break; + default: + description = "Unknown (" + Integer.toHexString(source) + ")"; + } + System.err.println("\tType: " + description); + + switch ( severity ) { + case GL_DEBUG_SEVERITY_HIGH: + description = "HIGH"; + break; + case GL_DEBUG_SEVERITY_MEDIUM: + description = "MEDIUM"; + break; + case GL_DEBUG_SEVERITY_LOW: + description = "LOW"; + break; + case GL_DEBUG_SEVERITY_NOTIFICATION: + description = "NOTIFICATION"; + break; + default: + description = "Unknown (" + Integer.toHexString(source) + ")"; + } + System.err.println("\tSeverity: " + description); + + System.err.println("\tMessage: " + message); + } + }); + } + + /** + * Creates an ARBDebugOutputCallback with the specified callback handler. + * The handler's {@code handleMessage} method will be called whenever + * debug output is generated by the GL. + * + * @param handler the callback handler + */ + public KHRDebugCallback(final Handler handler) { + super(CALLBACK_POINTER); + + this.handler = handler; + } + + Handler getHandler() { + return handler; + } + + /** Implementations of this interface can be used to receive ARB_debug_output notifications. */ + public interface Handler { + + /** + * This method will be called when an ARB_debug_output message is generated. + * + * @param id the message ID + * @param source the message source + * @param type the message type + * @param severity the message severity + * @param message the string representation of the message. + */ + void handleMessage(int source, int type, int id, int severity, String message); + + } + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengles/PeerInfo.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengles/PeerInfo.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengles/PeerInfo.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengles/PeerInfo.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,97 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +import org.lwjgl.LWJGLException; +import org.lwjgl.LWJGLUtil; + +import java.nio.ByteBuffer; + +/** + * + * @author elias_naur + * @version $Revision: 3418 $ + * $Id: PeerInfo.java 3418 2010-09-28 21:11:35Z spasi $ + */ +abstract class PeerInfo { + private final ByteBuffer handle; + private Thread locking_thread; // Thread that has locked this PeerInfo + private int lock_count; + + protected PeerInfo(ByteBuffer handle) { + this.handle = handle; + } + + private void lockAndInitHandle() throws LWJGLException { + doLockAndInitHandle(); + } + + public final synchronized void unlock() throws LWJGLException { + if (lock_count <= 0) + throw new IllegalStateException("PeerInfo not locked!"); + if (Thread.currentThread() != locking_thread) + throw new IllegalStateException("PeerInfo already locked by " + locking_thread); + lock_count--; + if (lock_count == 0) { + doUnlock(); + locking_thread = null; + notify(); + } + } + + protected abstract void doLockAndInitHandle() throws LWJGLException; + protected abstract void doUnlock() throws LWJGLException; + + public final synchronized ByteBuffer lockAndGetHandle() throws LWJGLException { + Thread this_thread = Thread.currentThread(); + while (locking_thread != null && locking_thread != this_thread) { + try { + wait(); + } catch (InterruptedException e) { + LWJGLUtil.log("Interrupted while waiting for PeerInfo lock: " + e); + } + } + if (lock_count == 0) { + locking_thread = this_thread; + doLockAndInitHandle(); + } + lock_count++; + return getHandle(); + } + + final ByteBuffer getHandle() { + return handle; + } + + public void destroy() { + } +} diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengles/PixelFormat.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengles/PixelFormat.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengles/PixelFormat.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengles/PixelFormat.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,767 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +import org.lwjgl.BufferUtils; +import org.lwjgl.LWJGLException; +import org.lwjgl.LWJGLUtil; +import org.lwjgl.opengl.PixelFormatLWJGL; + +import java.nio.IntBuffer; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +import static org.lwjgl.opengles.EGL.*; +import static org.lwjgl.opengles.NVCoverageSample.*; +import static org.lwjgl.opengles.NVDepthNonlinear.*; +import static org.lwjgl.opengles.PixelFormat.Attrib.*; + +/** + * This class describes the configuration settings for an EGL surface. Instances + * of this class are used as arguments to Display.create(). The attributes specified + * in this class will be used to get EGLConfigs from an EGLDisplay. PixelFormat + * is not the best name for this class, but it matches the corresponding class + * in the official desktop LWJGL. + *

    + * Instances of this class are immutable. An example of the expected way to set + * the PixelFormat property values is the following: + * PixelFormat pf = new PixelFormat().withDepth(24).withSamples(4); + *

    + * Attributes that correspond to EGL extensions will be silently ignored if those + * extensions are not supported by the EGLDisplay. + */ +public final class PixelFormat implements PixelFormatLWJGL { + + public static enum Attrib { + // CORE ATTRIBUTES + + RED_SIZE(EGL_RED_SIZE, 0), + GREEN_SIZE(EGL_GREEN_SIZE, 0), + BLUE_SIZE(EGL_BLUE_SIZE, 0), + ALPHA_SIZE(EGL_ALPHA_SIZE, 0), + + LUMINANCE_SIZE(EGL_LUMINANCE_SIZE, 0), + + DEPTH_SIZE(EGL_DEPTH_SIZE, 0), + STENCIL_SIZE(EGL_STENCIL_SIZE, 0), + + MIN_SWAP_INTERVAL(EGL_MIN_SWAP_INTERVAL, EGL_DONT_CARE), + MAX_SWAP_INTERVAL(EGL_MAX_SWAP_INTERVAL, EGL_DONT_CARE), + + SAMPLES(EGL_SAMPLES, 0), + SAMPLE_BUFFERS(EGL_SAMPLE_BUFFERS, 0), + + TRANSPARENT_TYPE(EGL_TRANSPARENT_TYPE, EGL_NONE), + TRANSPARENT_RED_VALUE(EGL_TRANSPARENT_RED_VALUE, EGL_DONT_CARE), + TRANSPARENT_GREEN_VALUE(EGL_TRANSPARENT_GREEN_VALUE, EGL_DONT_CARE), + TRANSPARENT_BLUE_VALUE(EGL_TRANSPARENT_BLUE_VALUE, EGL_DONT_CARE), + + // SURFACE ATTRIBUTES + + MULTISAMPLE_RESOLVE(EGL_MULTISAMPLE_RESOLVE, EGL_MULTISAMPLE_RESOLVE_DEFAULT, true), + SWAP_BEHAVIOR(EGL_SWAP_BEHAVIOR, EGL_DONT_CARE, true), + + // EXTENSION ATTRIBUTES + + COVERAGE_SAMPLES_NV(EGL_COVERAGE_SAMPLES_NV, 0), + COVERAGE_BUFFERS_NV(EGL_COVERAGE_BUFFERS_NV, 0), + + DEPTH_ENCODING_NONLINEAR_NV(EGL_DEPTH_ENCODING_NONLINEAR_NV, EGL_DONT_CARE); + + private final int eglAttrib; + private final int defaultValue; + + private final boolean surfaceAttrib; + + Attrib(final int eglAttrib, final int defaultValue) { + this(eglAttrib, defaultValue, false); + } + + Attrib(final int eglAttrib, final int defaultValue, final boolean surfaceAttrib) { + this.eglAttrib = eglAttrib; + this.defaultValue = defaultValue; + + this.surfaceAttrib = surfaceAttrib; + } + + /** + * Returns the EGL token that corresponds to this attribute. + * + * @return the EGL attribute token + */ + public int getEGLAttrib() { + return eglAttrib; + } + + /** + * Returns the default value of this attribute. Attributes + * with default values will be ignored when choosing the EGLConfig. + * + * @return the default value + */ + public int getDefaultValue() { + return defaultValue; + } + + public boolean isSurfaceAttrib() { + return surfaceAttrib; + } + + } + + private final Map config = new HashMap(16); + + /** + * Creates a new PixelFormat with rgbSize = 8, alphaSize = 8 and depthSize = 16. + * + * @see #PixelFormat(int, int, int, int, int, int) + */ + public PixelFormat() { + this(8, 16, 0); + } + + /** + * Creates a new PixelFormat with rgbSize = 8 and the specified + * alphaSize, depthSize and stencilSize. + * + * @param alphaSize the EGL_ALPHA_SIZE value + * @param depthSize the EGL_DEPTH_SIZE value + * @param stencilSize the EGL_STENCIL_SIZE value + * + * @see #PixelFormat(int, int, int, int, int, int) + */ + public PixelFormat(int alphaSize, int depthSize, int stencilSize) { + this(alphaSize, depthSize, stencilSize, 0); + } + + /** + * Creates a new PixelFormat with rgbSize = 8 and the specified + * alphaSize, depthSize, stencilSize and samples. + * + * @param alphaSize the EGL_ALPHA_SIZE value + * @param depthSize the EGL_DEPTH_SIZE value + * @param stencilSize the EGL_STENCIL_SIZE value + * @param samples the EGL_SAMPLE_SIZE value + * + * @see #PixelFormat(int, int, int, int, int, int) + */ + public PixelFormat(int alphaSize, int depthSize, int stencilSize, int samples) { + this(8, alphaSize, 0, depthSize, stencilSize, samples); + } + + /** + * Creates a new PixelFormat with the specified RGB sizes, EGL_ALPHA_SIZE, + * EGL_LUMINANCE_SIZE, EGL_DEPTH_SIZE, EGL_STENCIL_SIZE, EGL_SAMPLES. + * All values must be greater than or equal to 0. rgbSize and luminanceSize + * cannot both be greater than 0. depthSize greater than 24 and stencilSize + * greater than 8 are not recommended. + * The corresponding EGL_SAMPLE_BUFFERS value will become 0 if samples is 0, + * or 1 if samples is greater than 0. + * + * @param rgbSize the RGB sizes + * @param alphaSize the EGL_ALPHA_SIZE value + * @param luminanceSize the EGL_LUMINANCE_SIZE value + * @param depthSize the EGL_DEPTH_SIZE value + * @param stencilSize the EGL_STENCIL_SIZE value + * @param samples the EGL_SAMPLE_SIZE value + */ + public PixelFormat(int rgbSize, int alphaSize, int luminanceSize, int depthSize, int stencilSize, int samples) { + if ( rgbSize < 0 ) + throw new IllegalArgumentException("Invalid RGB size specified: " + rgbSize); + + if ( alphaSize < 0 ) + throw new IllegalArgumentException("Invalid EGL_ALPHA_SIZE specified: " + alphaSize); + + if ( luminanceSize < 0 || (0 < luminanceSize && 0 < rgbSize) ) + throw new IllegalArgumentException("Invalid EGL_LUMINANCE_SIZE specified: " + luminanceSize); + + if ( depthSize < 0 ) + throw new IllegalArgumentException("Invalid EGL_DEPTH_SIZE specified: " + depthSize); + + if ( stencilSize < 0 ) + throw new IllegalArgumentException("Invalid EGL_STENCIL_SIZE specified: " + stencilSize); + + if ( samples < 0 ) + throw new IllegalArgumentException("Invalid EGL_SAMPLES specified: " + samples); + + if ( 0 < rgbSize ) { + setAttrib(RED_SIZE, rgbSize); + setAttrib(GREEN_SIZE, rgbSize); + setAttrib(BLUE_SIZE, rgbSize); + } + setAttrib(ALPHA_SIZE, alphaSize); + + setAttrib(LUMINANCE_SIZE, luminanceSize); + + setAttrib(DEPTH_SIZE, depthSize); + setAttrib(STENCIL_SIZE, stencilSize); + + setAttrib(SAMPLES, samples); + setAttrib(SAMPLE_BUFFERS, samples == 0 ? 0 : 1); + } + + /** + * Creates a new PixelFormat that is a copy of the specified PixelFormat. + * + * @param pf the source PixelFormat + */ + private PixelFormat(final PixelFormat pf) { + config.clear(); + config.putAll(pf.config); + } + + /** + * Sets the value of an attribute to the current configuration. + * If the value matches the default attribute value, the + * attribute will be removed from the configuration. + * + * @param attrib the attribute + * @param value the new value + */ + private void setAttrib(final Attrib attrib, final int value) { + if ( attrib.defaultValue == value ) + config.remove(attrib); + else + config.put(attrib, value); + } + + /** + * Returns an IntBuffer that can be used to get/choose EGLConfigs. + * The contents of the IntBuffer will be the sum of the source + * LWJGL attributes and the user-defined attributes from this + * PixelFormat's configuration. + *

    + * The source LWJGL attributes should not contain the EGL_SURFACE_TYPE + * attirube, or any attributes that are handled by PixelFormat. + *

    + * Attributes that correspond to EGL extensions will be checked + * against the extensions supported in the specified EGLDisplay. + * Attributes that correspond to unsupported extensions will not + * be included in the final EGLConfig query. + * + * @param display the EGL display from which the EGLConfig is going to be retrieved + * @param lwjglAttribs the LWJGL attributes + * + * @return the IntBuffer + */ + public IntBuffer getAttribBuffer(final EGLDisplay display, int surfaceType, final int[] lwjglAttribs) { + // Create a copy of the configuration attributes + Set keys = new HashSet(config.keySet()); + + // Handle surface type bits + if ( keys.contains(MULTISAMPLE_RESOLVE) ) { + if ( display.getMajorVersion() == 1 && display.getMinorVersion() < 4 ) + keys.remove(MULTISAMPLE_RESOLVE); + else if ( getAttrib(MULTISAMPLE_RESOLVE) == EGL_MULTISAMPLE_RESOLVE_BOX ) + surfaceType |= EGL_MULTISAMPLE_RESOLVE_BOX_BIT; + } + + if ( keys.contains(SWAP_BEHAVIOR) ) { + if ( display.getMajorVersion() == 1 && display.getMinorVersion() < 4 ) + keys.remove(SWAP_BEHAVIOR); + else if ( getAttrib(SWAP_BEHAVIOR) == EGL_BUFFER_PRESERVED ) + surfaceType |= EGL_SWAP_BEHAVIOR_PRESERVED_BIT; + } + + // Check NV_coverage_sample + if ( keys.contains(COVERAGE_BUFFERS_NV) && !display.isExtensionSupported("EGL_NV_coverage_sample") ) { + keys.remove(COVERAGE_BUFFERS_NV); + keys.remove(COVERAGE_SAMPLES_NV); + } + + // Check NV_depth_nonlinear + if ( keys.contains(DEPTH_ENCODING_NONLINEAR_NV) && !display.isExtensionSupported("EGL_NV_depth_nonlinear") ) + keys.remove(DEPTH_ENCODING_NONLINEAR_NV); + + // Create IntBuffer and insert the attributes + final IntBuffer attribs = BufferUtils.createIntBuffer( + 2 // SURFACE_TYPE + + lwjglAttribs.length // Source LWJGL attributes + + (keys.size() * 2) // PixelFormat attributes + + 1 // Termination + ); + + attribs.put(EGL_SURFACE_TYPE).put(surfaceType); + attribs.put(lwjglAttribs); + + for ( Attrib key : keys ) { + if ( !key.isSurfaceAttrib() ) + attribs.put(key.eglAttrib).put(config.get(key)); + } + + // Finish the attribute list + attribs.put(EGL_NONE); + attribs.flip(); + + return attribs; + } + + /** + * Returns true if the requested attribute matches the attribute in the specified EGL config. + * + * @param attrib the requested attribute + * @param config the EGL config + * + * @return true if the two attributes match + * + * @throws org.lwjgl.LWJGLException if an EGL error occurs + */ + private boolean matches(final Attrib attrib, final EGLConfig config) throws LWJGLException { + return getAttrib(attrib) == config.getAttribute(attrib.getEGLAttrib()); + } + + /** + * Returns true if the requested attribute matches the attribute in the specified EGL config. + * If the requested attribute is equal to 1, then it will match with any EGL config attribute + * that is greater than 0. + * + * @param attrib the requested attribute + * @param config the EGL config + * + * @return true if the two attributes match + * + * @throws org.lwjgl.LWJGLException if an EGL error occurs + */ + private boolean matchesNonZero(final Attrib attrib, final EGLConfig config) throws LWJGLException { + final int reqValue = getAttrib(attrib); + final int cfgValue = config.getAttribute(attrib.getEGLAttrib()); + + return reqValue == cfgValue || (reqValue == 1 && cfgValue > 0); + } + + /** + * Returns the EGL config from the specified array that best matches this PixelFormat. + * + * @param configs the EGL configs + * + * @return the best match + */ + public EGLConfig getBestMatch(final EGLConfig[] configs) throws LWJGLException { + if ( configs == null || configs.length == 0 ) + throw new IllegalArgumentException("No EGLConfigs specified."); + + if ( configs.length == 1 ) + return configs[0]; + + /*System.out.println("\nASKED FOR:"); + for ( Attrib attrib : config.keySet() ) { + System.out.println("EGL_" + attrib.name() + ": " + getAttrib(attrib)); + } + + for ( EGLConfig config : configs ) { + if ( config == null ) + continue; + + System.out.println("\n----"); + System.out.println(config); + }*/ + + for ( EGLConfig config : configs ) { + if ( config == null ) + continue; + + if ( !(matches(ALPHA_SIZE, config) && matchesNonZero(DEPTH_SIZE, config) && matchesNonZero(STENCIL_SIZE, config)) ) + continue; + + final int luminance = getAttrib(LUMINANCE_SIZE); + if ( 0 < luminance && !matches(LUMINANCE_SIZE, config) ) + continue; + + if ( luminance == 0 && !(matches(RED_SIZE, config) && matches(GREEN_SIZE, config) && matches(BLUE_SIZE, config)) ) + continue; + + if ( !(matches(SAMPLE_BUFFERS, config) && matches(SAMPLES, config)) ) + continue; + + // TODO: Add more? NV's Tegra SDK checks a hardcoded 5 value for COVERAGE_SAMPLES_NV (nv_main.c, line: 1823) + + return config; + } + + // No match found, use the one recommended by the EGL implementation. + LWJGLUtil.log("Could not find an exact EGLConfig match for the PixelFormat requested, using first returned."); + return configs[0]; + } + + /** + * Applies this PixelFormat's surface attributes to the specified EGL surface. + * + * @param surface the EGL surface + */ + public void setSurfaceAttribs(final EGLSurface surface) throws LWJGLException { + setSurfaceAttrib(surface, SWAP_BEHAVIOR); + setSurfaceAttrib(surface, MULTISAMPLE_RESOLVE); + } + + private void setSurfaceAttrib(final EGLSurface surface, final Attrib attrib) throws LWJGLException { + final int value = getAttrib(attrib); + if ( value != attrib.getDefaultValue() ) + surface.setAttribute(attrib.getEGLAttrib(), value); + } + + /** + * Returns the value of the specified attribute. + * + * @param attrib the attribute to retrieve + * + * @return the attribute's value + */ + public int getAttrib(final Attrib attrib) { + final Integer value = config.get(attrib); + if ( value == null ) + return attrib.defaultValue; + + return value; + } + + /* ----------------------------------------- + CORE ATTRIBUTES + ----------------------------------------- */ + + /** + * Returns a new PixelFormat with the specified RGB sizes. + * + * @param rgb the new EGL_RED_SIZE, EGL_GREEN_SIZE and EGL_BLUE_SIZE + * + * @return the new PixelFormat + * + * @see #withRGBSize(int, int, int) + */ + public PixelFormat withRGBSize(final int rgb) { + return withRGBSize(rgb, rgb, rgb); + } + + /** + * Returns a new PixelFormat with the specified EGL_RED_SIZE, EGL_GREEN_SIZE and EGL_BLUE_SIZE. + * All 3 values must be greater than or equal to 0. If any of the 3 values is greater than 0, + * the luminanceSize will be set to 0. + * + * @param r the new EGL_RED_SIZE + * @param g the new EGL_GREEN_SIZE + * @param b the new EGL_BLUE_SIZE + * + * @return the new PixelFormat + */ + public PixelFormat withRGBSize(final int r, final int g, final int b) { + if ( r < 0 || g < 0 || b < 0 ) + throw new IllegalArgumentException("Invalid RGB sizes specified: " + r + ", " + g + ", " + b); + + final PixelFormat pf = new PixelFormat(this); + pf.setAttrib(RED_SIZE, r); + pf.setAttrib(GREEN_SIZE, g); + pf.setAttrib(BLUE_SIZE, b); + if ( 0 < r || 0 < g || 0 < b ) + pf.setAttrib(LUMINANCE_SIZE, 0); + return pf; + } + + /** + * Returns a new PixelFormat with the specified EGL_ALPHA_SIZE. + * The alphaSize value must be greater than or equal to 0. + * + * @param alphaSize the new EGL_ALPHA_SIZE + * + * @return the new PixelFormat + */ + public PixelFormat withAlphaSize(final int alphaSize) { + if ( alphaSize < 0 ) + throw new IllegalArgumentException("Invalid EGL_ALPHA_SIZE specified: " + alphaSize); + + final PixelFormat pf = new PixelFormat(this); + pf.setAttrib(ALPHA_SIZE, alphaSize); + return pf; + } + + /** + * Returns a new PixelFormat with the specified EGL_LUMINANCE_SIZE. + * The luminanceSize value must be greater than or equal to 0. If + * luminanceSize is greater than 0, the RGB sizes will be set to 0. + * + * @param luminanceSize the new EGL_LUMINANCE_SIZE + * + * @return the new PixelFormat + */ + public PixelFormat withLuminanceSize(final int luminanceSize) { + if ( luminanceSize < 0 ) + throw new IllegalArgumentException("Invalid EGL_LUMINANCE_SIZE specified: " + luminanceSize); + + final PixelFormat pf = new PixelFormat(this); + pf.setAttrib(LUMINANCE_SIZE, luminanceSize); + if ( 0 < luminanceSize ) { + pf.setAttrib(RED_SIZE, 0); + pf.setAttrib(GREEN_SIZE, 0); + pf.setAttrib(BLUE_SIZE, 0); + } + return pf; + } + + /** + * Returns a new PixelFormat with the specified EGL_DEPTH_SIZE. + * The depthSize value must be greater than or equal to 0. + * Values greater than 24 are not recommended. + * + * @param depthSize the new EGL_DEPTH_SIZE + * + * @return the new PixelFormat + */ + public PixelFormat withDepthSize(final int depthSize) { + if ( depthSize < 0 ) + throw new IllegalArgumentException("Invalid EGL_DEPTH_SIZE specified: " + depthSize); + + final PixelFormat pf = new PixelFormat(this); + pf.setAttrib(DEPTH_SIZE, depthSize); + return pf; + } + + /** + * Returns a new PixelFormat with the specified EGL_STENCIL_SIZE. + * The stencilSize value must be greater than or equal to 0. + * Values greater than 8 are not recommended. + * + * @param stencilSize the new EGL_STENCIL_SIZE + * + * @return the new PixelFormat + */ + public PixelFormat withStencilSize(final int stencilSize) { + if ( stencilSize < 0 ) + throw new IllegalArgumentException("Invalid EGL_STENCIL_SIZE specified: " + stencilSize); + + final PixelFormat pf = new PixelFormat(this); + pf.setAttrib(STENCIL_SIZE, stencilSize); + return pf; + } + + /** + * Returns a new PixelFormat with the specified EGL_MIN_SWAP_INTERVAL. + * The minSwapInterval value must be between 0 and this PixelFormat's EGL_MAX_SWAP_INTERVAL. + * + * @param minSwapInterval the new EGL_MIN_SWAP_INTERVAL value + * + * @return the new PixelFormat + */ + public PixelFormat withMinSwapInterval(final int minSwapInterval) { + final int maxSwapInterval = getAttrib(MAX_SWAP_INTERVAL); + if ( minSwapInterval != EGL_DONT_CARE && (minSwapInterval < 0 || (maxSwapInterval != EGL_DONT_CARE && maxSwapInterval < minSwapInterval)) ) + throw new IllegalArgumentException("Invalid EGL_MIN_SWAP_INTERVAL specified: " + minSwapInterval); + + final PixelFormat pf = new PixelFormat(this); + pf.setAttrib(MIN_SWAP_INTERVAL, minSwapInterval); + return pf; + } + + /** + * Returns a new PixelFormat with the specified EGL_MAX_SWAP_INTERVAL. + * The maxSwapInterval value must be greater than or equal to this PixelFormat's EGL_MIN_SWAP_INTERVAL. + * + * @param maxSwapInterval the new EGL_MAX_SWAP_INTERVAL value + * + * @return the new PixelFormat + */ + public PixelFormat withMaxSwapInterval(final int maxSwapInterval) { + if ( maxSwapInterval < getAttrib(MIN_SWAP_INTERVAL) ) + throw new IllegalArgumentException("Invalid EGL_MAX_SWAP_INTERVAL specified: " + maxSwapInterval); + + final PixelFormat pf = new PixelFormat(this); + pf.setAttrib(MAX_SWAP_INTERVAL, maxSwapInterval); + return pf; + } + + /** + * Returns a new PixelFormat with the specified number of EGL_SAMPLES. + * The samples value must be either 0 or greater than or equal to 2. The related + * EGL_SAMPLE_BUFFERS value will become 0 if samples is 0, or 1 if samples + * is greater than or equal to 2. + * + * @param samples the new EGL_SAMPLES value + * + * @return the new PixelFormat + */ + public PixelFormat withSamples(final int samples) { + if ( samples != 0 && samples < 2 ) + throw new IllegalArgumentException("Invalid number of EGL_SAMPLES specified: " + samples); + + final PixelFormat pf = new PixelFormat(this); + pf.setAttrib(SAMPLES, samples); + pf.setAttrib(SAMPLE_BUFFERS, samples == 0 ? 0 : 1); + return pf; + } + + private static int maxValue(final int bits) { + return (2 << bits) - 1; + } + + /** + * Returns a new PixelFormat with the specified EGL_TRANSPARENT_TYPE and + * the specified transparent RGB values. The transparentType must be + * either EGL_NONE or EGL_TRANSPARENT_RGB. When it is EGL_NONE, the RGB + * values are set to zero and ignored. When it is EGL_TRANSPARENT_RGB, + * the RGB values must be between 0 and 2^rgbSize - 1. + * + * @param transparentType the new EGL_TRANSPARENT_TYPE value + * @param r the new EGL_TRANSPARENT_RED_VALUE + * @param g the new EGL_TRANSPARENT_GREEN_VALUE + * @param b the new EGL_TRANSPARENT_BLUE_VALUE + * + * @return the new PixelFormat + */ + public PixelFormat withTransparentType(final int transparentType, int r, int g, int b) { + if ( transparentType == EGL_TRANSPARENT_RGB ) { + final int redSize = getAttrib(RED_SIZE); + final int greenSize = getAttrib(GREEN_SIZE); + final int blueSize = getAttrib(BLUE_SIZE); + if ( r < 0 || (0 < redSize && maxValue(redSize) < r) ) + throw new IllegalArgumentException("Invalid EGL_TRANSPARENT_RED_VALUE specified: " + r); + + if ( r < 0 || (0 < greenSize && maxValue(greenSize) < g) ) + throw new IllegalArgumentException("Invalid EGL_TRANSPARENT_GREEN_VALUE specified: " + g); + + if ( r < 0 || (0 < blueSize && maxValue(blueSize) < b) ) + throw new IllegalArgumentException("Invalid EGL_TRANSPARENT_BLUE_VALUE specified: " + b); + } else if ( transparentType != EGL_NONE ) + throw new IllegalArgumentException("Invalid EGL_TRANSPARENT_TYPE specified: " + transparentType); + else + r = g = b = EGL_DONT_CARE; + + final PixelFormat pf = new PixelFormat(this); + + pf.setAttrib(TRANSPARENT_TYPE, transparentType); + + pf.setAttrib(TRANSPARENT_RED_VALUE, r); + pf.setAttrib(TRANSPARENT_GREEN_VALUE, g); + pf.setAttrib(TRANSPARENT_BLUE_VALUE, b); + + return pf; + } + + /* ----------------------------------------- + SURFACE ATTRIBUTES + ----------------------------------------- */ + + /** + * Returns a new PixelFormat with the specified EGL_MULTISAMPLE_RESOLVE value. + * Valid values for multisampleResolve are EGL_MULTISAMPLE_RESOLVE_DEFAULT + * and EGL_MULTISAMPLE_RESOLVE_BOX. + *

    + * An IllegalStateException will be thrown if EGL_SAMPLES has not been previously defined + * to be greater than or equal to 2. + * + * @param multisampleResolve the new EGL_MULTISAMPLE_RESOLVE value + * + * @return the new PixelFormat + */ + public PixelFormat withMultisampleResolve(final int multisampleResolve) { + if ( multisampleResolve != EGL_MULTISAMPLE_RESOLVE_DEFAULT && multisampleResolve != EGL_MULTISAMPLE_RESOLVE_BOX ) + throw new IllegalArgumentException("Invalid EGL_MULTISAMPLE_RESOLVE value specified: " + multisampleResolve); + + if ( getAttrib(SAMPLE_BUFFERS) == 0 ) + throw new IllegalStateException("An EGL_MULTISAMPLE_RESOLVE value cannot be specified unless EGL_SAMPLE_BUFFERS is 1."); + + final PixelFormat pf = new PixelFormat(this); + pf.setAttrib(MULTISAMPLE_RESOLVE, multisampleResolve); + return pf; + } + + /** + * Returns a new PixelFormat with the specified EGL_SWAP_BEHAVIOR value. + * Valid values for swapBehavior are EGL_DONT_CARE, EGL_BUFFER_PRESERVED + * and EGL_BUFFER_DESTROYED. + * + * @param swapBehavior the new EGL_SWAP_BEHAVIOR value + * + * @return the new PixelFormat + */ + public PixelFormat withSwapBehavior(final int swapBehavior) { + switch ( swapBehavior ) { + case EGL_DONT_CARE: + case EGL_BUFFER_PRESERVED: + case EGL_BUFFER_DESTROYED: + break; + default: + throw new IllegalArgumentException("Invalid EGL_SWAP_BEHAVIOR value specified: " + swapBehavior); + } + + final PixelFormat pf = new PixelFormat(this); + pf.setAttrib(SWAP_BEHAVIOR, swapBehavior); + return pf; + } + + /* ----------------------------------------- + EXTENSION ATTRIBUTES + ----------------------------------------- */ + + /** + * Returns a new PixelFormat with the specified number of EGL_COVERAGE_SAMPLES_NV. + * The samples value must be greater than or equal to 0. The related + * EGL_COVERAGE_BUFFERS_NV value will become 0 if samples is 0, or 1 if samples + * is greater than 0. + * + * @param samples the new EGL_SAMPLES value + * + * @return the new PixelFormat + */ + public PixelFormat withCoverageSamplesNV(final int samples) { + if ( samples < 0 ) + throw new IllegalArgumentException("Invalid number of EGL_COVERAGE_SAMPLES_NV specified: " + samples); + + final PixelFormat pf = new PixelFormat(this); + pf.setAttrib(COVERAGE_SAMPLES_NV, samples); + pf.setAttrib(COVERAGE_BUFFERS_NV, samples == 0 ? 0 : 1); + return pf; + } + + /** + * Returns a new PixelFormat with the specified EGL_DEPTH_ENCODING_NONLINEAR_NV. + * Valid values for depthEncoding are EGL_DONT_CARE, EGL_DEPTH_ENCODING_NONE_NV + * and EGL_DEPTH_ENCODING_NONLINEAR_NV. + * + * @param depthEncoding the new EGL_DEPTH_ENCODING_NONLINEAR_NV value + * + * @return the new PixelFormat + */ + public PixelFormat withDepthEncodingNonlinearNV(final int depthEncoding) { + switch ( depthEncoding ) { + case EGL_DONT_CARE: + case EGL_DEPTH_ENCODING_NONE_NV: + case EGL_DEPTH_ENCODING_NONLINEAR_NV: + break; + default: + throw new IllegalArgumentException("Invalid EGL_DEPTH_ENCODING_NONLINEAR_NV value specified: " + depthEncoding); + } + + final PixelFormat pf = new PixelFormat(this); + pf.setAttrib(DEPTH_ENCODING_NONLINEAR_NV, depthEncoding); + return pf; + } + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengles/PowerManagementEventException.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengles/PowerManagementEventException.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengles/PowerManagementEventException.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengles/PowerManagementEventException.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +/** + * A PowerManagementEventException exception will be thrown when a call + * to eglSwapBuffers, eglCopyBuffers or eglMakeCurrent returns EGL_FALSE + * and the EGL_ERROR generated is EGL_CONTEXT_LOST. + *

    + * On detection of this error, the application must destroy all contexts. + * To continue rendering the application must recreate any contexts it + * requires, and subsequently restore any client API state and objects + * it wishes to use. + *

    + * Note that not all implementations can be made to generate power management + * events, and developers should continue to refer to platform-specific + * documentation in this area. + */ +public class PowerManagementEventException extends RuntimeException { + + static final long serialVersionUID = -1L; + + public PowerManagementEventException() { + super(); + } + + public PowerManagementEventException(final String message) { + super(message); + } + + public PowerManagementEventException(final String message, final Throwable cause) { + super(message, cause); + } + + public PowerManagementEventException(final Throwable cause) { + super(cause); + } + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengles/StateTracker.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengles/StateTracker.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengles/StateTracker.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengles/StateTracker.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,116 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +import java.nio.Buffer; +import java.nio.IntBuffer; + +import static org.lwjgl.opengles.GLES20.*; +import static org.lwjgl.opengles.GLES30.*; + +final class StateTracker { + + private static StateTracker tracker = new StateTracker(); + + int elementArrayBuffer; + int arrayBuffer; + int pixelPackBuffer; + int pixelUnpackBuffer; + + Buffer[] glVertexAttribPointer_buffer; + + private final FastIntMap vaoMap = new FastIntMap(); + + int vertexArrayObject; + + StateTracker() { + } + + void init() { + glVertexAttribPointer_buffer = new Buffer[glGetInteger(GL_MAX_VERTEX_ATTRIBS)]; + } + + static StateTracker getTracker() { + return tracker; + } + + static void bindBuffer(int target, int buffer) { + final StateTracker tracker = getTracker(); + + switch ( target ) { + case GL_ARRAY_BUFFER: + tracker.arrayBuffer = buffer; + break; + case GL_ELEMENT_ARRAY_BUFFER: + tracker.elementArrayBuffer = buffer; + break; + case GL_PIXEL_PACK_BUFFER: + tracker.pixelPackBuffer = buffer; + break; + case GL_PIXEL_UNPACK_BUFFER: + tracker.pixelUnpackBuffer = buffer; + break; + } + } + + static void bindVAO(final int array) { + final FastIntMap vaoMap = tracker.vaoMap; + if ( !vaoMap.containsKey(array) ) + vaoMap.put(array, new VAOState()); + + tracker.vertexArrayObject = array; + } + + static void deleteVAO(final IntBuffer arrays) { + for ( int i = arrays.position(); i < arrays.limit(); i++ ) + deleteVAO(arrays.get(i)); + } + + static void deleteVAO(final int array) { + tracker.vaoMap.remove(array); + + if ( tracker.vertexArrayObject == array ) + tracker.vertexArrayObject = 0; + } + + /** + * Simple class to help us track VAO state. Currently + * only ELEMENT_ARRAY_BUFFER_BINDING is tracked, since + * that's the only state we check from tables 6.6-6.9. + */ + private static class VAOState { + + int elementArrayBuffer; + + } + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengles/Util.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengles/Util.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/opengles/Util.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/opengles/Util.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,139 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +import org.lwjgl.LWJGLException; +import org.lwjgl.opengl.OpenGLException; + +import static org.lwjgl.opengles.EGL.*; +import static org.lwjgl.opengles.GLES20.*; + +/** + * Simple utility class. + * + * @author Spasi + */ +public final class Util { + + private Util() { + } + + /** + * Checks for OpenGL ES errors. + * + * @throws org.lwjgl.opengl.OpenGLException + * if GLES20.glGetError() returns anything else than GLES20.GL_NO_ERROR + */ + public static void checkGLError() throws OpenGLException { + int err = glGetError(); + if ( err != GL_NO_ERROR ) + throw new OpenGLException(err); + } + + /** + * Translates a GL error code to a String describing the error. + * + * @param error_code the OpenGL ES error code + * + * @return the error description + */ + public static String translateGLErrorString(int error_code) { + switch ( error_code ) { + case GL_NO_ERROR: + return "No error"; + case GL_INVALID_ENUM: + return "Invalid enum"; + case GL_INVALID_VALUE: + return "Invalid value"; + case GL_INVALID_OPERATION: + return "Invalid operation"; + case GL_OUT_OF_MEMORY: + return "Out of memory"; + default: + return null; + } + } + + /** + * Checks for EGL errors. + * + * @throws org.lwjgl.LWJGLException if EGL.eglGetError() returns anything else than EGL.EGL_SUCCESS + */ + static void checkEGLError() throws LWJGLException { + int err = eglGetError(); + if ( err != EGL_SUCCESS ) + throw new LWJGLException(translateEGLErrorString(err)); + } + + /** + * Translates an EGL error code to a String describing the error. + * + * @param error_code the EGL error code + * + * @return the error description + */ + static String translateEGLErrorString(int error_code) { + switch ( error_code ) { + case EGL_NOT_INITIALIZED: + return "EGL not initialized"; + case EGL_BAD_ACCESS: + return "Bad access"; + case EGL_BAD_ALLOC: + return "Bad allocation"; + case EGL_BAD_ATTRIBUTE: + return "Bad attribute"; + case EGL_BAD_CONFIG: + return "Bad config"; + case EGL_BAD_CONTEXT: + return "Bad EGL context"; + case EGL_BAD_CURRENT_SURFACE: + return "Bad current EGL surface"; + case EGL_BAD_DISPLAY: + return "Bad EGL display"; + case EGL_BAD_MATCH: + return "Bad match"; + case EGL_BAD_NATIVE_PIXMAP: + return "Bad native pixmap"; + case EGL_BAD_NATIVE_WINDOW: + return "Bad native window"; + case EGL_BAD_PARAMETER: + return "Bad parameter"; + case EGL_BAD_SURFACE: + return "Bad EGL surface"; + case EGL_CONTEXT_LOST: + return "EGL context lost"; + default: + return null; + } + } + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/PointerBuffer.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/PointerBuffer.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/PointerBuffer.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/PointerBuffer.java 2016-04-09 16:26:56.000000000 +0000 @@ -59,8 +59,8 @@ protected final ByteBuffer pointers; - protected final Buffer view; - protected final IntBuffer view32; + protected final Buffer view; + protected final IntBuffer view32; protected final LongBuffer view64; /** @@ -80,8 +80,8 @@ * @param source the source buffer */ public PointerBuffer(final ByteBuffer source) { - if ( !source.isDirect() ) - throw new IllegalArgumentException("ByteBuffer is not direct"); + if ( LWJGLUtil.CHECKS ) + checkSource(source); pointers = source.slice().order(source.order()); @@ -94,6 +94,15 @@ } } + private static void checkSource(final ByteBuffer source) { + if ( !source.isDirect() ) + throw new IllegalArgumentException("The source buffer is not direct."); + + final int alignment = is64Bit ? 8 : 4; + if ( (MemoryUtil.getAddress0(source) + source.position()) % alignment != 0 || source.remaining() % alignment != 0 ) + throw new IllegalArgumentException("The source buffer is not aligned to " + alignment + " bytes."); + } + /** * Returns the ByteBuffer that backs this PointerBuffer. * @@ -541,9 +550,9 @@ */ public static void put(final ByteBuffer target, int index, long l) { if ( is64Bit ) - target.putLong(index * 8, l); + target.putLong(index, l); else - target.putInt(index * 4, (int)l); + target.putInt(index, (int)l); } // -- Bulk get operations -- diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/SysImplementation.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/SysImplementation.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/SysImplementation.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/SysImplementation.java 2016-04-09 16:26:56.000000000 +0000 @@ -37,8 +37,8 @@ * * @author cix_foo * @author elias_naur - * @version $Revision: 3426 $ - * $Id: SysImplementation.java 3426 2010-10-01 22:20:14Z spasi $ + * @version $Revision$ + * $Id$ */ interface SysImplementation { /** diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/Sys.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/Sys.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/Sys.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/Sys.java 2016-04-09 16:26:56.000000000 +0000 @@ -46,15 +46,15 @@ * System class (named Sys so as not to conflict with java.lang.System) *

    * @author cix_foo - * @version $Revision: 3488 $ - * $Id: Sys.java 3488 2011-02-09 21:09:33Z matzon $ + * @version $Revision$ + * $Id$ */ public final class Sys { /** The native library name */ private static final String JNI_LIBRARY_NAME = "lwjgl"; /** Current version of library */ - private static final String VERSION = "2.7.1"; + private static final String VERSION = "2.9.3"; private static final String POSTFIX64BIT = "64"; @@ -67,8 +67,7 @@ public Object run() { String library_path = System.getProperty("org.lwjgl.librarypath"); if (library_path != null) { - System.load(library_path + File.separator + - System.mapLibraryName(lib_name)); + System.load(library_path + File.separator + LWJGLUtil.mapLibraryName(lib_name)); } else { System.loadLibrary(lib_name); } @@ -78,9 +77,27 @@ } private static void loadLibrary(final String lib_name) { + // actively try to load 64bit libs on 64bit architectures first + String osArch = System.getProperty("os.arch"); + boolean try64First = LWJGLUtil.getPlatform() != LWJGLUtil.PLATFORM_MACOSX && ("amd64".equals(osArch) || "x86_64".equals(osArch)); + + Error err = null; + if ( try64First ) { + try { + doLoadLibrary(lib_name + POSTFIX64BIT); + return; + } catch (UnsatisfiedLinkError e) { + err = e; + } + } + + // fallback to loading the "old way" try { doLoadLibrary(lib_name); } catch (UnsatisfiedLinkError e) { + if ( try64First ) + throw err; + if (implementation.has64Bit()) { try { doLoadLibrary(lib_name + POSTFIX64BIT); @@ -89,6 +106,7 @@ LWJGLUtil.log("Failed to load 64 bit library: " + e2.getMessage()); } } + // Throw original error throw e; } diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/DisplayTest.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/DisplayTest.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/DisplayTest.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/DisplayTest.java 2016-04-09 16:26:56.000000000 +0000 @@ -40,8 +40,8 @@ * Test class for Display & DisplayMode * * @author Brian Matzon - * @version $Revision: 3418 $ - * $Id: DisplayTest.java 3418 2010-09-28 21:11:35Z spasi $ + * @version $Revision$ + * $Id$ */ public class DisplayTest { diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/DuplicateTokens.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/DuplicateTokens.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/DuplicateTokens.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/DuplicateTokens.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,69 @@ +package org.lwjgl.test; + +import java.io.File; +import java.io.FileFilter; +import java.lang.reflect.Field; +import java.lang.reflect.Modifier; +import java.util.Arrays; +import java.util.Comparator; +import java.util.HashMap; +import java.util.Map; +import java.util.regex.Pattern; + +public class DuplicateTokens { + + private static Pattern CORE; + + private DuplicateTokens() { + } + + public static void main(String[] args) { + File path = new File("bin/" + args[0].replace('.', '/')); + + Map tokens = new HashMap(256); + + CORE = Pattern.compile(args[1] + "[0-9]*"); + + checkFiles(tokens, filterPath(path, Pattern.compile(CORE.pattern() + "\\.class")), args[0]); + checkFiles(tokens, filterPath(path, Pattern.compile("((?!" + CORE.pattern() + ")[^.])+\\.class")), args[0]); + } + + private static File[] filterPath(File path, final Pattern pattern) { + File[] files = path.listFiles(new FileFilter() { + public boolean accept(File pathname) { + return pattern.matcher(pathname.getName()).matches(); + } + }); + + Arrays.sort(files, new Comparator() { + public int compare(final File o1, final File o2) { + return o1.getName().compareTo(o2.getName()); + } + }); + + return files; + } + + private static void checkFiles(Map tokens, File[] files, String root) { + try { + for ( File file : files ) { + Class c = Class.forName(root + '.' + file.getName().substring(0, file.getName().length() - ".class".length())); + for ( Field f : c.getFields() ) { + int mod = f.getModifiers(); + if ( !Modifier.isStatic(mod) ) + continue; + + if ( tokens.containsKey(f.getName()) ) { + Class src = tokens.get(f.getName()); + if ( CORE.matcher(src.getSimpleName()).matches() || CORE.matcher(c.getSimpleName()).matches() ) + System.out.println("DUPLICATE: " + f.getName() + " at " + c.getSimpleName() + " [" + src.getSimpleName() + ']'); + } else + tokens.put(f.getName(), c); + } + } + } catch (Exception e) { + throw new RuntimeException(e); + } + } + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/input/ControlFail.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/input/ControlFail.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/input/ControlFail.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/input/ControlFail.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,95 @@ +package org.lwjgl.test.input; + +import org.lwjgl.LWJGLException; +import org.lwjgl.Sys; +import org.lwjgl.input.Keyboard; +import org.lwjgl.input.Mouse; +import org.lwjgl.opengl.Display; +import org.lwjgl.opengl.GL11; + +import java.awt.*; +import java.awt.event.*; +import java.util.Random; +import javax.swing.*; + +/** @author Spasi */ +public class ControlFail { + + public ControlFail() { + + } + + public static void main(String[] args) { + Canvas canvas = new Canvas(); + JFrame frame = new JFrame("Test"); + + MenuBar menu = new MenuBar(); + Menu file = new Menu("File"); + file.add(new MenuItem("New")); + file.add(new MenuItem("Open")); + file.add(new MenuItem("Save")); + menu.add(file); + + frame.setMenuBar(menu); + + JComboBox combo = new JComboBox(new String[] { "foo", "bar", "yo", "sakis" }); + combo.setLightWeightPopupEnabled(false); + + frame.getContentPane().setLayout(new BorderLayout()); + frame.getContentPane().add(combo, BorderLayout.NORTH); + frame.getContentPane().add(canvas, BorderLayout.CENTER); + frame.getContentPane().add(new JTextField(32), BorderLayout.SOUTH); + + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + frame.setSize(new Dimension(640, 480)); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + canvas.setBackground(Color.RED); + canvas.addMouseListener(new MouseAdapter() { + public void mousePressed(final MouseEvent e) { + System.out.println("e = " + e); + } + }); + + try { + Display.setParent(canvas); + Display.setVSyncEnabled(true); + Display.create(); + //Mouse.setGrabbed(true); + OUTER: + while ( !Display.isCloseRequested() ) { + float color = new Random().nextFloat(); + GL11.glClearColor(color, color, color, 0.0f); + GL11.glClear(GL11.GL_COLOR_BUFFER_BIT); + Display.update(); + + /*if ( Display.isActive() && !Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) ) + System.out.println("control is up " + System.currentTimeMillis());*/ + + while ( Keyboard.next() ) { + int character_code = ((int)Keyboard.getEventCharacter()) & 0xffff; + System.out.println("Checking key:" + Keyboard.getKeyName(Keyboard.getEventKey())); + System.out.println("Pressed:" + Keyboard.getEventKeyState()); + System.out.println("Key character code: 0x" + Integer.toHexString(character_code)); + System.out.println("Key character: " + Keyboard.getEventCharacter()); + System.out.println("Repeat event: " + Keyboard.isRepeatEvent()); + + if ( Keyboard.getEventKey() == Keyboard.KEY_G && Keyboard.getEventKeyState() ) { + Mouse.setGrabbed(!Mouse.isGrabbed()); + } + if ( Keyboard.getEventKey() == Keyboard.KEY_ESCAPE ) { + break OUTER; + } + } + + //Display.sync(10); + } + + Display.destroy(); + frame.dispose(); + } catch (LWJGLException e) { + e.printStackTrace(); + } + } + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/input/HWCursorTest.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/input/HWCursorTest.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/input/HWCursorTest.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/input/HWCursorTest.java 2016-04-09 16:26:56.000000000 +0000 @@ -49,8 +49,8 @@ * Tests switching between windowed and fullscreen - including hardware cursor test * * @author Brian Matzon - * @version $Revision: 3418 $ - * $Id: HWCursorTest.java 3418 2010-09-28 21:11:35Z spasi $ + * @version $Revision$ + * $Id$ */ public class HWCursorTest { diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/input/KeyboardTest.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/input/KeyboardTest.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/input/KeyboardTest.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/input/KeyboardTest.java 2016-04-09 16:26:56.000000000 +0000 @@ -44,8 +44,8 @@ * Keyboard test * * @author Brian Matzon - * @version $Revision: 3418 $ - * $Id: KeyboardTest.java 3418 2010-09-28 21:11:35Z spasi $ + * @version $Revision$ + * $Id$ */ public class KeyboardTest { @@ -202,10 +202,7 @@ render(); - try { - Thread.sleep(0); - } catch (Exception e) { - } + Display.sync(60); } } diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/input/MouseCreationTest.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/input/MouseCreationTest.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/input/MouseCreationTest.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/input/MouseCreationTest.java 2016-04-09 16:26:56.000000000 +0000 @@ -44,8 +44,8 @@ * Mouse test * * @author Brian Matzon - * @version $Revision: 3418 $ - * $Id: MouseCreationTest.java 3418 2010-09-28 21:11:35Z spasi $ + * @version $Revision$ + * $Id$ */ public class MouseCreationTest { /** position of quad to draw */ diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/input/MouseTest.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/input/MouseTest.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/input/MouseTest.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/input/MouseTest.java 2016-04-09 16:26:56.000000000 +0000 @@ -46,8 +46,8 @@ * Mouse test * * @author Brian Matzon - * @version $Revision: 3418 $ - * $Id: MouseTest.java 3418 2010-09-28 21:11:35Z spasi $ + * @version $Revision$ + * $Id$ */ public class MouseTest { /** Direction mouse has moved */ @@ -354,6 +354,10 @@ if(Keyboard.getEventKey() == Keyboard.KEY_SPACE && Keyboard.getEventKeyState()) { Mouse.setGrabbed(!Mouse.isGrabbed()); } + + if(Keyboard.getEventKey() == Keyboard.KEY_R && Keyboard.getEventKeyState()) { + Display.setResizable(!Display.isResizable()); + } } } diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/LwjglShiftTest.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/LwjglShiftTest.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/LwjglShiftTest.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/LwjglShiftTest.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,61 @@ +package org.lwjgl.test; + +import org.lwjgl.input.Keyboard; +import org.lwjgl.input.Mouse; +import org.lwjgl.opengl.Display; +import org.lwjgl.opengl.DisplayMode; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.PixelFormat; + +public class LwjglShiftTest { + + public static final int SCREEN_WIDTH = 640; + public static final int SCREEN_HEIGHT = 480; + + public static void main(String[] args) throws Exception { + setDisplayMode(); + Display.setTitle("Shift Test"); + Display.setFullscreen(false); + Display.setVSyncEnabled(true); + Display.create(new PixelFormat(32, 0, 24, 8, 0)); + Mouse.setGrabbed(false); + + GL11.glMatrixMode(GL11.GL_PROJECTION); + GL11.glLoadIdentity(); + GL11.glOrtho(0, 800, 0, 600, 1, -1); + GL11.glMatrixMode(GL11.GL_MODELVIEW); + + boolean lcurr = false; + boolean rcurr = false; + while ( true ) { + + if ( Display.isCloseRequested() || Keyboard.isKeyDown(Keyboard.KEY_ESCAPE) ) { + break; + } + + GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); + + //Text.drawString("left shift", 10, 10); + //Text.drawString("right shift", 300, 10); + + System.out.println(Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) + " - " + Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)); + + Display.update(); + //Display.sync(15); + + /*while ( Keyboard.next() ) { + System.out.println(Keyboard.getEventKey() + " - " + Keyboard.getEventKeyState()); + }*/ + } + } + + private static void setDisplayMode() throws Exception { + DisplayMode[] dm = org.lwjgl.util.Display.getAvailableDisplayModes(SCREEN_WIDTH, SCREEN_HEIGHT, -1, -1, -1, -1, 60, 60); + org.lwjgl.util.Display.setDisplayMode(dm, new String[] { + "width=" + SCREEN_WIDTH, + "height=" + SCREEN_HEIGHT, + "freq=" + 60, + "bpp=" + org.lwjgl.opengl.Display.getDisplayMode().getBitsPerPixel() + }); + } +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/mapped/MappedFloat.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/mapped/MappedFloat.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/mapped/MappedFloat.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/mapped/MappedFloat.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.test.mapped; + +import org.lwjgl.util.mapped.MappedObject; + +/** @author Riven */ +public class MappedFloat extends MappedObject { + + public MappedFloat() { + this.test(); + } + + public float value; + + public void test() { + this.value = 4; + } + + @Override + public String toString() { + return "MappedFloat[" + value + "]"; + } + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/mapped/MappedObjectBench.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/mapped/MappedObjectBench.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/mapped/MappedObjectBench.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/mapped/MappedObjectBench.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,237 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.test.mapped; + +import org.lwjgl.MemoryUtil; + +import java.nio.ByteBuffer; +import java.util.Arrays; + +import static org.lwjgl.util.mapped.MappedHelper.*; + +/** @author Riven */ +@SuppressWarnings("static-access") +public class MappedObjectBench { + + static class InstanceVec3 { + + float x, y, z; + + @Override + public String toString() { + return "InstanceVec3[" + x + ", " + y + ", " + z + "]"; + } + } + + static class ArrayVec3 { + + float[] a; + int i; + + @Override + public String toString() { + return "ArrayVec3[" + a[i * 3 + 0] + ", " + a[i * 3 + 1] + ", " + a[i * 3 + 2] + "]"; + } + } + + static void benchmarkInstances() { + final int runs = 64; + final int iterations = 64 * 1024; + + InstanceVec3 vec1 = new InstanceVec3(); + InstanceVec3 vec2 = new InstanceVec3(); + InstanceVec3 vec3 = new InstanceVec3(); + + long[] took = new long[runs]; + for ( int run = 0; run < runs; run++ ) { + long t0 = System.nanoTime(); + for ( int iteration = 0; iteration < iterations; iteration++ ) { + vec1.x = 13; + vec1.y += vec1.y * vec1.x + 0.3f; + vec1.z += vec2.y + vec1.x + 0.3f; + vec2.z += vec2.y + vec1.x; + vec3.z += vec2.z + vec1.y; + } + long t1 = System.nanoTime(); + took[run] = t1 - t0; + } + + Arrays.sort(took); + System.out.println("instance took: " + took[took.length / 2] / 1024 + "us"); + + System.out.println(vec1); + System.out.println(vec2); + System.out.println(vec3); + } + + static void benchmarkMapped() { + final int runs = 64; + final int iterations = 64 * 1024; + + ByteBuffer bb = ByteBuffer.allocateDirect(200); + + MappedVec3 vecs = MappedVec3.map(bb); + + MappedVec3 vec1 = vecs.dup(); + MappedVec3 vec2 = vecs.dup(); + MappedVec3 vec3 = vecs.dup(); + + vec1.view = 0; + vec2.view = 1; + vec3.view = 2; + + long[] took = new long[runs]; + for ( int run = 0; run < runs; run++ ) { + long t0 = System.nanoTime(); + for ( int iteration = 0; iteration < iterations; iteration += 2 ) { + vec1.x = 13; + vec1.y += vec1.y * vec1.x + 0.3f; + vec1.z += vec2.y + vec1.x + 0.3f; + vec2.z += vec2.y + vec1.x; + vec3.z += vec2.z + vec1.y; + + vec1.x = 13; + vec1.y += vec1.y * vec1.x + 0.3f; + vec1.z += vec2.y + vec1.x + 0.3f; + vec2.z += vec2.y + vec1.x; + vec3.z += vec2.z + vec1.y; + } + long t1 = System.nanoTime(); + took[run] = t1 - t0; + } + + Arrays.sort(took); + System.out.println("mapped took: " + took[took.length / 2] / 1024 + "us"); + + System.out.println(vec1); + System.out.println(vec2); + System.out.println(vec3); + + System.out.println(bb); + } + + static void benchmarkIndirectArray() { + final int runs = 64; + final int iterations = 64 * 1024; + + float[] bb = new float[200]; + + ArrayVec3 vec1 = new ArrayVec3(); + ArrayVec3 vec2 = new ArrayVec3(); + ArrayVec3 vec3 = new ArrayVec3(); + + vec1.a = bb; + vec2.a = bb; + vec3.a = bb; + + vec1.i = 0; + vec2.i = 1; + vec3.i = 2; + + long[] took = new long[runs]; + for ( int run = 0; run < runs; run++ ) { + long t0 = System.nanoTime(); + for ( int iteration = 0; iteration < iterations; iteration++ ) { + vec1.a[vec1.i * 3 + 0] = 13; + vec1.a[vec1.i * 3 + 1] += vec1.a[vec1.i * 3 + 1] * vec1.a[vec1.i * 3 + 0] + 0.3f; + vec1.a[vec1.i * 3 + 2] += vec2.a[vec2.i * 3 + 1] + vec1.a[vec1.i * 3 + 0] + 0.3f; + vec2.a[vec2.i * 3 + 2] += vec2.a[vec2.i * 3 + 1] + vec1.a[vec1.i * 3 + 0]; + vec3.a[vec3.i * 3 + 2] += vec2.a[vec2.i * 3 + 2] + vec2.a[vec2.i * 3 + 1]; + } + long t1 = System.nanoTime(); + took[run] = t1 - t0; + } + + Arrays.sort(took); + System.out.println("array took: " + took[took.length / 2] / 1024 + "us"); + + System.out.println(vec1); + System.out.println(vec2); + System.out.println(vec3); + + System.out.println(bb); + } + + static void benchmarkDirectArray() { + final int runs = 64; + final int iterations = 64 * 1024; + + float[] bb = new float[200]; + + long[] took = new long[runs]; + for ( int run = 0; run < runs; run++ ) { + long t0 = System.nanoTime(); + for ( int iteration = 0; iteration < iterations; iteration++ ) { + bb[1 * 3 + 0] = 13; + bb[1 * 3 + 1] += bb[1 * 3 + 1] * bb[1 * 3 + 0] + 0.3f; + bb[1 * 3 + 2] += bb[2 * 3 + 1] + bb[1 * 3 + 0] + 0.3f; + bb[2 * 3 + 2] += bb[2 * 3 + 1] + bb[1 * 3 + 0]; + bb[3 * 3 + 2] += bb[2 * 3 + 2] + bb[2 * 3 + 1]; + } + long t1 = System.nanoTime(); + took[run] = t1 - t0; + } + + Arrays.sort(took); + System.out.println("array2 took: " + took[took.length / 2] / 1024 + "us"); + + System.out.println(bb); + } + + static void benchmarkUnsafe() { + final int runs = 64; + final int iterations = 64 * 1024; + + ByteBuffer bb = ByteBuffer.allocateDirect(200); + long addr = MemoryUtil.getAddress(bb); + + long[] took = new long[runs]; + for ( int run = 0; run < runs; run++ ) { + long t0 = System.nanoTime(); + for ( int iteration = 0; iteration < iterations; iteration++ ) { + fput(13, addr + (1 * 3 + 0) * 4); + fput(fget(addr + (1 * 3 + 1) * 4) + fget(addr + (1 * 3 + 1) * 4) * fget(addr + (1 * 3 + 0) * 4) + 0.3f, addr + (1 * 3 + 1) * 4); + fput(fget(addr + (1 * 3 + 2) * 4) + fget(addr + (2 * 3 + 1) * 4) + fget(addr + (1 * 3 + 0) * 4) + 0.3f, addr + (1 * 3 + 2) * 4); + fput(fget(addr + (2 * 3 + 2) * 4) + fget(addr + (2 * 3 + 1) * 4) + fget(addr + (1 * 3 + 0) * 4), addr + (2 * 3 + 2) * 4); + fput(fget(addr + (3 * 3 + 2) * 4) + fget(addr + (2 * 3 + 2) * 4) + fget(addr + (2 * 3 + 1) * 4), addr + (3 * 3 + 2) * 4); + } + long t1 = System.nanoTime(); + took[run] = t1 - t0; + } + + Arrays.sort(took); + System.out.println("unsafe took: " + took[took.length / 2] / 1024 + "us"); + + System.out.println(bb); + } + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/mapped/MappedObjectTests1.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/mapped/MappedObjectTests1.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/mapped/MappedObjectTests1.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/mapped/MappedObjectTests1.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,180 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.test.mapped; + +import org.lwjgl.MemoryUtil; +import org.lwjgl.util.mapped.MappedHelper; + +import java.nio.ByteBuffer; + +/** @author Riven */ +@SuppressWarnings("static-access") +public class MappedObjectTests1 { + + static class Test { + + int value; + } + + static void testViewField() { + Test test = new Test(); + test.value = 13; + test.value += 1; + test.value++; + System.out.println(test); + + ByteBuffer bb = ByteBuffer.allocateDirect(200); + MappedFloat vecs = MappedFloat.map(bb); + + // verify 'malloc', SIZEOF and capacity() + { + MappedFloat vecs1 = MappedFloat.malloc(1234); + + assert (vecs1.getSizeof() == MappedFloat.SIZEOF); + assert (vecs1.getSizeof() * 1234 == vecs1.backingByteBuffer().capacity()); + assert (MappedFloat.SIZEOF * 1234 == vecs1.backingByteBuffer().capacity()); + assert(vecs1.capacity() == vecs1.backingByteBuffer().capacity() / MappedFloat.SIZEOF); + + ByteBuffer buf = ByteBuffer.allocateDirect(200); + buf.position(10 * MappedFloat.SIZEOF); + + MappedFloat vecs2 = MappedFloat.map(buf); + assert(vecs2.capacity() == (vecs2.backingByteBuffer().capacity() / MappedFloat.SIZEOF) - 10); + } + + // manipulate 'mapped.value' + { + assert (vecs.value == 0.0f); // 4.0 is set in constructor, but runViewConstructor is not called + vecs.value = 1.1f; + assert (vecs.value == 1.1f); + } + + // manipulate 'view' with assignment + { + assert (vecs.view == 0); + vecs.view = 1; + assert (vecs.view == 1); + assert (vecs.value != 1.1f); // old view + vecs.view = 0; + } + + // manipulate 'view' with iinc + { + assert (vecs.view == 0); + vecs.view++; + assert (vecs.view == 1); + assert (vecs.value != 1.1f); // old view + vecs.view = 0; + } + + // manipulate 'view' with next() + { + assert (vecs.view == 0); + vecs.next(); + assert (vecs.view == 1); + assert (vecs.value != 1.1f); // old view + vecs.view = 0; + } + + // test bounds checking + { + assert (vecs.view == 0); + try { + vecs.view = 49; + assert vecs.view == 49; + vecs.view = 0; + vecs.view = 50; + System.out.println("org.lwjgl.util.mapped.Checks is false or there is a bug in bounds checking."); + vecs.view = 0; + } catch (IndexOutOfBoundsException e) { + // expected, ignore + } + + assert (vecs.view == 0); + + try { + vecs.view = 10; + MappedFloat vecs2 = vecs.slice(); + vecs.view = 0; + + vecs2.view = 39; + assert vecs2.view == 39; + vecs2.view = 40; + System.out.println("org.lwjgl.util.mapped.Checks is false or there is a bug in bounds checking."); + } catch (IndexOutOfBoundsException e) { + // expected, ignore + } + + try { + ByteBuffer posTest = ByteBuffer.allocateDirect(200); + posTest.position(10 * MappedFloat.SIZEOF); // position > 0 + + MappedFloat vecs2 = MappedFloat.map(posTest); + vecs2.view = 39; + assert vecs2.view == 39; + vecs2.view = 40; + System.out.println("org.lwjgl.util.mapped.Checks is false or there is a bug in bounds checking."); + } catch (IndexOutOfBoundsException e) { + // expected, ignore + } + } + + // test newBuffer + { + long addr1 = MemoryUtil.getAddress(bb); + ByteBuffer bb2 = MappedHelper.newBuffer(addr1, bb.capacity()); + long addr2 = MemoryUtil.getAddress(bb); + + System.out.println(bb); + System.out.println(bb2); + System.out.println(addr1); + System.out.println(addr2); + } + + // test 'copy' + { + vecs.value = 13.37f; + MappedFloat dec2 = vecs.dup(); + dec2.view = 1; + System.out.println(vecs); + System.out.println(dec2); + vecs.copyTo(dec2); + System.out.println(vecs); + System.out.println(dec2); + assert (dec2.value == 13.37f); + + vecs.value = 73.31f; + vecs.copyRange(dec2, 1); + assert (dec2.value == 73.31f); + } + } +} diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/mapped/MappedObjectTests2.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/mapped/MappedObjectTests2.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/mapped/MappedObjectTests2.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/mapped/MappedObjectTests2.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,98 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.test.mapped; + +import java.nio.ByteBuffer; + +/** @author Riven */ +@SuppressWarnings("static-access") +public class MappedObjectTests2 { + + static void testWriteFieldAccess(MappedVec3 vecs) { + // write access results into a transform-time IllegalAccessException + + System.out.println(vecs.baseAddress); // test read-access + + System.out.println(vecs.viewAddress); // test read-access + + System.out.println(vecs.getAlign()); // test read-access + + System.out.println(MappedVec3.SIZEOF); // test read-access + } + + static void testFields() { + ByteBuffer bb = ByteBuffer.allocateDirect(200); + MappedVec3 vecs = MappedVec3.map(bb); + + testWriteFieldAccess(vecs); + + vecs.x = 13.13f; + vecs.y = 14.14f; + vecs.z = 15.15f; + + System.out.println(vecs.viewAddress); + + assert (vecs.x == 13.13f); + assert (vecs.y == 14.14f); + assert (vecs.z == 15.15f); + + vecs.view = 0; + + assert (vecs.x == 13.13f); + assert (vecs.y == 14.14f); + assert (vecs.z == 15.15f); + + System.out.println(vecs); + vecs.view = 1; + System.out.println(vecs); + + assert (vecs.x == 0.0f); + assert (vecs.y == 0.0f); + assert (vecs.z == 0.0f); + + // now it becomes weird: offsets and strides + + vecs.view = 1; + vecs.x = 0.1234f; + vecs.view = 0; + + // test stride & sizeof + { + long a1 = vecs.viewAddress; + vecs.view = 1; + long a2 = vecs.viewAddress; + assert (a2 - a1 == MappedVec3.SIZEOF); + assert (a2 - a1 == vecs.getSizeof()); + vecs.view = 0; + } + } +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/mapped/MappedObjectTests3.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/mapped/MappedObjectTests3.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/mapped/MappedObjectTests3.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/mapped/MappedObjectTests3.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,145 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.test.mapped; + +import org.lwjgl.MemoryUtil; +import org.lwjgl.util.mapped.MappedObject; +import org.lwjgl.util.mapped.MappedSet; +import org.lwjgl.util.mapped.MappedSet2; + +import java.nio.ByteBuffer; +import java.nio.ByteOrder; + +import static org.lwjgl.util.mapped.MappedObject.*; + +/** @author Riven */ +@SuppressWarnings("static-access") +public class MappedObjectTests3 { + + static void testMappedBuffer() { + int elementCount = 4; + + MappedSomething some = MappedSomething.malloc(elementCount); + + assert (some.data != some.data); + + long addr1 = MemoryUtil.getAddress(some.backingByteBuffer()); + + ByteBuffer mapped = some.data; // creates new ByteBuffer instance + long addr2 = MemoryUtil.getAddress(mapped); + + assert (addr2 - addr1 == 4); + assert (mapped.capacity() == MappedSomething.SIZEOF - 4); + + { + assert (some.shared == 0); + assert (mapped.getInt(8) == 0); + + some.shared = 1234; + + assert (some.shared == 1234); + assert (mapped.getInt(8) == 1234); + } + + some.view++; + mapped = some.data; // creates new ByteBuffer instance + + long addr3 = MemoryUtil.getAddress(mapped); + assert (addr3 - addr1 == 4 + MappedSomething.SIZEOF); + assert (addr3 - addr2 == 0 + MappedSomething.SIZEOF); + assert (mapped.capacity() == MappedSomething.SIZEOF - 4); + } + + static void testForeach() { + int elementCount = 10; + MappedSomething some = MappedSomething.malloc(elementCount); + + int i = 0; + for ( MappedSomething item : foreach(some, elementCount / 2) ) { + assert (item.view == i++); + } + assert (some.view == (elementCount / 2) - 1); + System.out.println("current.view=" + some.view + ", not " + (elementCount / 2) + ", as you might expect"); + + i = 0; + for ( MappedSomething item : foreach(some) ) { + assert (item.view == i++); + } + assert (some.view == elementCount - 1); + } + + public static class Xyz extends MappedObject { + + int x, y, z; + } + + static void testConstructor() { + int capacity = 1024; + ByteBuffer bb = ByteBuffer.allocateDirect(capacity).order(ByteOrder.nativeOrder()); + long address = MemoryUtil.getAddress(bb); + + MappedFloat mf = MappedFloat.map(address, capacity); + + assert (address == mf.baseAddress); + + assert (mf.value == 0.0f); + mf.view = 1; + assert (mf.value == 0.0f); + mf.runViewConstructor(); + assert (mf.value == 4.0f); + + Xyz.malloc(3); + } + + static void testMappedSet() { + MappedVec2 vec2 = MappedVec2.malloc(3); + MappedVec3 vec3 = MappedVec3.malloc(3); + + MappedSet2 set = MappedSet.create(vec2, vec3); + + assert (vec2.view == 0); + assert (vec3.view == 0); + + set.view = 2; + assert (vec2.view == 2); + assert (vec3.view == 2); + + set.view = 0; + assert (vec2.view == 0); + assert (vec3.view == 0); + + set.next(); + assert (vec2.view == 1); + assert (vec3.view == 1); + } + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/mapped/MappedObjectTests4.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/mapped/MappedObjectTests4.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/mapped/MappedObjectTests4.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/mapped/MappedObjectTests4.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,253 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.test.mapped; + +import org.lwjgl.MemoryUtil; +import org.lwjgl.PointerBuffer; +import org.lwjgl.opengl.Display; +import org.lwjgl.util.mapped.*; + +import java.io.File; +import java.lang.reflect.Field; +import java.nio.ByteBuffer; + +/** @author Riven */ +@SuppressWarnings("static-access") +public class MappedObjectTests4 { + + public static void testLWJGL() throws Exception { + System.out.println(new File(System.getProperty("java.library.path")).getCanonicalPath()); + Display.create(); + } + + public static void testLocalView() { + MappedFloat mapped1 = MappedFloat.malloc(5); + MappedFloat mapped2 = MappedFloat.malloc(5); + + testLocalView(mapped1); + testLocalView(mapped1, mapped2); + + MappedSomething some = MappedSomething.malloc(5); + testLocalView(some); + } + + private static void testLocalView(MappedFloat mapped1) { + final MappedFloat[] array = mapped1.asArray(); + + assert (array.length == 5); + + int l = 10 * array.length; + for ( int localView1 = 0; localView1 < 5; localView1++ ) { + array[localView1].value = localView1 * 5; + array[localView1].value *= 2.0f; + } + System.out.println(); + float x = 0.0f; + for ( int localView1 = 0; localView1 < 5; localView1++ ) { + System.out.println("[" + localView1 + "] =>" + array[localView1].value); + x += array[localView1].value; + } + System.out.println("x = " + x); + } + + private static void testLocalView(MappedFloat mo1, MappedFloat mo2) { + final MappedFloat[] array1 = mo1.asArray(); + for ( int v1 = 0; v1 < 5; v1++ ) { + array1[v1].value = (float)Math.random(); + array1[v1].value *= 2.0f; + } + final MappedFloat[] array2 = mo2.asArray(); + for ( int v2 = 0; v2 < 5; v2++ ) { + array2[v2].value = (float)Math.random(); + array2[v2].value *= 2.0f; + } + + System.out.println(); + + for ( int v1 = 0; v1 < 5; v1++ ) { + System.out.println("[" + v1 + "] =>" + array1[v1].value); + } + for ( int v2 = 0; v2 < 5; v2++ ) { + System.out.println("[" + v2 + "] =>" + array2[v2].value); + } + } + + private static void testLocalView(MappedSomething some) { + final MappedSomething[] array = some.asArray(); + + assert (array.length == 5); + + final long baseAddress = MemoryUtil.getAddress(some.backingByteBuffer()); + for ( int i = 0; i < array.length; i++ ) { + ByteBuffer data = array[i].data; + + assert (data.capacity() == (64 - 4)); + assert (MemoryUtil.getAddress(data) == baseAddress + i * MappedSomething.SIZEOF + 4); + } + } + + public static class MappedPointer extends MappedObject { + + int foo; + @Pointer long pointer; + int bar; + + } + + public static void testPointer() { + MappedPointer data = MappedPointer.malloc(100); + + assert (data.backingByteBuffer().capacity() == 100 * (4 + 4 + PointerBuffer.getPointerSize())); + + for ( int i = 0; i < 100; i++ ) { + data.view = i; + + data.foo = i; + data.pointer = i * 1000; + data.bar = i * 2; + } + + for ( int i = 0; i < 100; i++ ) { + data.view = i; + + assert (data.foo == i); + assert (data.pointer == i * 1000); + assert (data.bar == i * 2); + } + } + + @MappedType(cacheLinePadding = true) + public static class MappedCacheLinePadded extends MappedObject { + + int foo; + int bar; + + } + + public static void testCacheLineAlignment() { + MappedCacheLinePadded data = MappedCacheLinePadded.malloc(10); + + assert (data.backingByteBuffer().capacity() == 10 * CacheUtil.getCacheLineSize()); + assert (MemoryUtil.getAddress(data.backingByteBuffer()) % CacheUtil.getCacheLineSize() == 0); + + for ( int i = 0; i < 10; i++ ) { + data.view = i; + + data.foo = i; + data.bar = i * 2; + } + + for ( int i = 0; i < 10; i++ ) { + data.view = i; + + assert (data.foo == i); + assert (data.bar == i * 2); + } + } + + public static class MappedFieldCacheLinePadded extends MappedObject { + + // If we assume CacheUtil.getCacheLineSize() == 64 + // 0 - 63 + @CacheLinePad long longBar; + // 64 - 71 + long longFoo; + // 72 - 75 + int intFoo; + // 128 - 131 + @CacheLinePad(before = true) int intBar; + // 192 - 195 + int foo; + // 256 - 267 + @CacheLinePad(before = true, after = false) + @MappedField(byteLength = 12) + ByteBuffer buffer; + // 268 - 271 + int bar; + + } + + public static void testCacheLinePadding() { + MappedFieldCacheLinePadded data = MappedFieldCacheLinePadded.map(CacheUtil.createByteBuffer(10 * MappedFieldCacheLinePadded.SIZEOF)); + + final int sizeof = + CacheUtil.getCacheLineSize() + + 8 + + (CacheUtil.getCacheLineSize() - 8) + + CacheUtil.getCacheLineSize() + + 4 + + (CacheUtil.getCacheLineSize() - 4) + + 12 + + 4; + + assert (MappedFieldCacheLinePadded.SIZEOF == sizeof); + assert (data.backingByteBuffer().capacity() == sizeof * 10); + + for ( int i = 0; i < 10; i++ ) { + data.view = i; + + data.longFoo = i * 1000000000L; + data.longBar = i * 2000000000L; + data.intFoo = i * 1000; + data.intBar = i * 2000; + data.foo = i; + } + + for ( int i = 0; i < 10; i++ ) { + data.view = i; + + assert (data.longFoo == i * 1000000000L); + assert (data.longBar == i * 2000000000L); + assert (data.intFoo == i * 1000); + assert (data.intBar == i * 2000); + assert (data.foo == i); + } + } + + public static class POJOFieldCacheLinePadded { + + @CacheLinePad long longBar; + long longFoo; + int intFoo; + @CacheLinePad(before = true) int intBar; + int foo; + @CacheLinePad boolean bool; + int bar; + + } + + public static void testCacheLinePaddingPOJO() { + Field[] fields = new POJOFieldCacheLinePadded().getClass().getDeclaredFields(); + assert (fields.length == (1 + 7) + 1 + 1 + (15 + 1 + 15) + 1 + (1 + 63) + 1); + } + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/mapped/MappedObjectWithLibrary.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/mapped/MappedObjectWithLibrary.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/mapped/MappedObjectWithLibrary.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/mapped/MappedObjectWithLibrary.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,17 @@ +/* + * Created on Jul 12, 2011 + */ + +package org.lwjgl.test.mapped; + +import org.lwjgl.opengl.Display; + +import java.io.File; + +public class MappedObjectWithLibrary { + + public static void testLWJGL() throws Exception { + System.out.println(new File(System.getProperty("java.library.path")).getCanonicalPath()); + Display.create(); + } +} diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/mapped/MappedSomething.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/mapped/MappedSomething.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/mapped/MappedSomething.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/mapped/MappedSomething.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.test.mapped; + +import org.lwjgl.util.mapped.MappedField; +import org.lwjgl.util.mapped.MappedObject; + +import java.nio.ByteBuffer; + +/** @author Riven */ +public class MappedSomething extends MappedObject { + + @MappedField(byteOffset = 0) + public int used; + + @MappedField(byteLength = 64 - 4) // optional byteOffset + public ByteBuffer data; + + @MappedField(byteOffset = 12) // inside data + public int shared; + + @Override + public String toString() { + return "MappedSomething[" + used + "]"; + } + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/mapped/MappedVec2.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/mapped/MappedVec2.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/mapped/MappedVec2.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/mapped/MappedVec2.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.test.mapped; + +import org.lwjgl.util.mapped.MappedObject; + +/** @author Riven */ +public class MappedVec2 extends MappedObject { + + public float x; + + public float y; + + @Override + public String toString() { + return "MappedVec2[" + x + "," + y + "]"; + } + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/mapped/MappedVec3.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/mapped/MappedVec3.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/mapped/MappedVec3.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/mapped/MappedVec3.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.test.mapped; + +import org.lwjgl.util.mapped.MappedObject; + +/** @author Riven */ +public class MappedVec3 extends MappedObject { + + public float x; + + public float y; + + public float z; + + @Override + public String toString() { + return "[" + x + "," + y + "," + z + "]"; + } + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/mapped/TestMappedObject.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/mapped/TestMappedObject.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/mapped/TestMappedObject.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/mapped/TestMappedObject.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.test.mapped; + +import org.lwjgl.util.mapped.MappedObjectClassLoader; +import org.lwjgl.util.mapped.MappedObjectTransformer; + +/** @author Riven */ +@SuppressWarnings("static-access") +public class TestMappedObject { + + static { + boolean assertsEnabled = false; + assert assertsEnabled = true; // Intentional side effect!!! + if ( !assertsEnabled ) + throw new RuntimeException("Asserts must be enabled for this test."); + } + + public static void main(String[] args) throws Exception { + MappedObjectTransformer.register(MappedFloat.class); + MappedObjectTransformer.register(MappedVec2.class); + MappedObjectTransformer.register(MappedVec3.class); + MappedObjectTransformer.register(MappedSomething.class); + MappedObjectTransformer.register(MappedObjectTests3.Xyz.class); + MappedObjectTransformer.register(MappedObjectTests4.MappedPointer.class); + MappedObjectTransformer.register(MappedObjectTests4.MappedCacheLinePadded.class); + MappedObjectTransformer.register(MappedObjectTests4.MappedFieldCacheLinePadded.class); + + if ( MappedObjectClassLoader.fork(TestMappedObject.class, args) ) { + return; + } + + MappedObjectTests1.testViewField(); + + MappedObjectTests2.testFields(); + + // MappedObjectBench.benchmarkMapped(); + // MappedObjectBench.benchmarkInstances(); + // MappedObjectBench.benchmarkIndirectArray(); + // MappedObjectBench.benchmarkDirectArray(); + // MappedObjectBench.benchmarkUnsafe(); + + MappedObjectTests3.testMappedBuffer(); + MappedObjectTests3.testForeach(); + MappedObjectTests3.testConstructor(); + MappedObjectTests3.testMappedSet(); + + MappedObjectTests4.testLocalView(); + //MappedObjectTests4.testLWJGL(); + MappedObjectTests4.testPointer(); + MappedObjectTests4.testCacheLineAlignment(); + MappedObjectTests4.testCacheLinePadding(); + MappedObjectTests4.testCacheLinePaddingPOJO(); + + System.out.println("done"); + } + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/openal/ALCTest.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/openal/ALCTest.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/openal/ALCTest.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/openal/ALCTest.java 2016-04-09 16:26:56.000000000 +0000 @@ -42,8 +42,8 @@ * This is a test for the ALC part of OpenAL * * @author Brian Matzon - * @version $Revision: 2983 $ - * $Id: ALCTest.java 2983 2008-04-07 18:36:09Z matzon $ + * @version $Revision$ + * $Id$ */ public class ALCTest extends BasicTest { diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/openal/BasicTest.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/openal/BasicTest.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/openal/BasicTest.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/openal/BasicTest.java 2016-04-09 16:26:56.000000000 +0000 @@ -44,8 +44,8 @@ * This is a basic test, which contains the most used stuff * * @author Brian Matzon - * @version $Revision: 3418 $ - * $Id: BasicTest.java 3418 2010-09-28 21:11:35Z spasi $ + * @version $Revision$ + * $Id$ */ public abstract class BasicTest { diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/openal/MovingSoundTest.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/openal/MovingSoundTest.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/openal/MovingSoundTest.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/openal/MovingSoundTest.java 2016-04-09 16:26:56.000000000 +0000 @@ -46,8 +46,8 @@ * a source moving around the listener using the keyboard * * @author Brian Matzon - * @version $Revision: 2983 $ - * $Id: MovingSoundTest.java 2983 2008-04-07 18:36:09Z matzon $ + * @version $Revision$ + * $Id$ */ public class MovingSoundTest extends BasicTest { diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/openal/OpenALCreationTest.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/openal/OpenALCreationTest.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/openal/OpenALCreationTest.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/openal/OpenALCreationTest.java 2016-04-09 16:26:56.000000000 +0000 @@ -45,8 +45,8 @@ * We cannot inherit from BasicTest since it follows another structure. * * @author Brian Matzon - * @version $Revision: 2983 $ - * $Id: OpenALCreationTest.java 2983 2008-04-07 18:36:09Z matzon $ + * @version $Revision$ + * $Id$ */ public class OpenALCreationTest { diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/openal/PlayTest.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/openal/PlayTest.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/openal/PlayTest.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/openal/PlayTest.java 2016-04-09 16:26:56.000000000 +0000 @@ -47,8 +47,8 @@ * Yes, over zealous use of getError ;) * * @author Brian Matzon - * @version $Revision: 2983 $ - * $Id: PlayTest.java 2983 2008-04-07 18:36:09Z matzon $ + * @version $Revision$ + * $Id$ */ public class PlayTest extends BasicTest { diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/openal/PlayTestMemory.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/openal/PlayTestMemory.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/openal/PlayTestMemory.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/openal/PlayTestMemory.java 2016-04-09 16:26:56.000000000 +0000 @@ -47,8 +47,8 @@ * Yes, over zealous use of getError ;) * * @author Brian Matzon - * @version $Revision: 2983 $ - * $Id: PlayTestMemory.java 2983 2008-04-07 18:36:09Z matzon $ + * @version $Revision$ + * $Id$ */ public class PlayTestMemory extends BasicTest { diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/openal/PositionTest.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/openal/PositionTest.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/openal/PositionTest.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/openal/PositionTest.java 2016-04-09 16:26:56.000000000 +0000 @@ -52,8 +52,8 @@ * (http://www.edenwaith.com/products/pige/tutorials/openal.php) * * @author Brian Matzon - * @version $Revision: 3418 $ - * $Id: PositionTest.java 3418 2010-09-28 21:11:35Z spasi $ + * @version $Revision$ + * $Id$ */ public class PositionTest extends BasicTest { diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/openal/SourceLimitTest.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/openal/SourceLimitTest.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/openal/SourceLimitTest.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/openal/SourceLimitTest.java 2016-04-09 16:26:56.000000000 +0000 @@ -42,8 +42,8 @@ * Simple test for testing the number of available sources * * @author Brian Matzon - * @version $Revision: 2983 $ - * $Id: SourceLimitTest.java 2983 2008-04-07 18:36:09Z matzon $ + * @version $Revision$ + * $Id$ */ public class SourceLimitTest extends BasicTest { diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/openal/StressTest.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/openal/StressTest.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/openal/StressTest.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/openal/StressTest.java 2016-04-09 16:26:56.000000000 +0000 @@ -42,8 +42,8 @@ * Simple test for stresstesting OpenAL playing random samples ad nausea * * @author Brian Matzon - * @version $Revision: 2983 $ - * $Id: StressTest.java 2983 2008-04-07 18:36:09Z matzon $ + * @version $Revision$ + * $Id$ */ public class StressTest extends BasicTest { diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opencl/gl/DemoFractal.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opencl/gl/DemoFractal.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opencl/gl/DemoFractal.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opencl/gl/DemoFractal.java 2016-04-09 16:26:56.000000000 +0000 @@ -518,12 +518,9 @@ glDeleteBuffers(glIDs); } - if ( useTextures ) + if ( useTextures ) { glGenTextures(glIDs); - else - glGenBuffers(glIDs); - if ( useTextures ) { // Init textures for ( int i = 0; i < slices; i++ ) { glBindTexture(GL_TEXTURE_2D, glIDs.get(i)); @@ -535,6 +532,8 @@ } glBindTexture(GL_TEXTURE_2D, 0); } else { + glGenBuffers(glIDs); + // setup one empty PBO per slice for ( int i = 0; i < slices; i++ ) { glBindBuffer(GL_PIXEL_UNPACK_BUFFER, glIDs.get(i)); diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opencl/gl/Mandelbrot.cl lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opencl/gl/Mandelbrot.cl --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opencl/gl/Mandelbrot.cl 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opencl/gl/Mandelbrot.cl 2016-04-09 16:26:56.000000000 +0000 @@ -2,7 +2,9 @@ #ifdef AMD_FP #pragma OPENCL EXTENSION cl_amd_fp64 : enable #else - #pragma OPENCL EXTENSION cl_khr_fp64 : enable + #ifndef CL_VERSION_1_2 + #pragma OPENCL EXTENSION cl_khr_fp64 : enable + #endif #endif #define varfloat double #define _255 255.0 @@ -57,7 +59,7 @@ output[iy * width + ix] = 0; #endif } else { - varfloat alpha = (varfloat)iteration / maxIterations; + float alpha = (float)iteration / maxIterations; int colorIndex = (int)(alpha * colorMapSize); #ifdef USE_TEXTURE // We could have changed colorMap to a texture + sampler, but the @@ -69,9 +71,9 @@ (c & 0xFF) >> 0, (c & 0xFF00) >> 8, (c & 0xFF0000) >> 16, - _255 + 255.0f ); - write_imagef(output, (int2)(ix, iy), oc / _255); + write_imagef(output, (int2)(ix, iy), oc / 255.0f); #else output[iy * width + ix] = colorMap[colorIndex]; #endif diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opencl/HelloOpenCL.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opencl/HelloOpenCL.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opencl/HelloOpenCL.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opencl/HelloOpenCL.java 2016-04-09 16:26:56.000000000 +0000 @@ -81,7 +81,7 @@ System.out.println(caps); System.out.println("\t-------------------------"); - System.out.println("\tCL_DEVICE_TYPE = " + device.getInfoInt(CL_DEVICE_TYPE)); + System.out.println("\tCL_DEVICE_TYPE = " + device.getInfoLong(CL_DEVICE_TYPE)); System.out.println("\tCL_DEVICE_VENDOR_ID = " + device.getInfoInt(CL_DEVICE_VENDOR_ID)); System.out.println("\tCL_DEVICE_MAX_COMPUTE_UNITS = " + device.getInfoInt(CL_DEVICE_MAX_COMPUTE_UNITS)); System.out.println("\tCL_DEVICE_MAX_WORK_ITEM_DIMENSIONS = " + device.getInfoInt(CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS)); @@ -143,23 +143,41 @@ System.out.println("-TRYING TO EXEC NATIVE KERNEL-"); final CLCommandQueue queue = clCreateCommandQueue(context, device, 0, null); + final PointerBuffer ev = BufferUtils.createPointerBuffer(1); + clEnqueueNativeKernel(queue, new CLNativeKernel() { protected void execute(final ByteBuffer[] memobjs) { - if ( memobjs == null ) - System.out.println("OK, it's null"); - else { - System.out.println("memobjs = " + memobjs.length); - for ( int k = 0; k < memobjs.length; k++ ) { - System.out.println("memobjs[" + k + "].remaining() = " + memobjs[k].remaining()); - for ( int l = memobjs[k].position(); l < memobjs[k].limit(); l++ ) { - memobjs[k].put(l, (byte)l); - } + System.out.println("\tmemobjs.length = " + memobjs.length); + for ( int k = 0; k < memobjs.length; k++ ) { + System.out.println("\tmemobjs[" + k + "].remaining() = " + memobjs[k].remaining()); + for ( int l = memobjs[k].position(); l < memobjs[k].limit(); l++ ) { + memobjs[k].put(l, (byte)l); } } + System.out.println("\tNative kernel done."); } - }, new CLMem[] { buffer }, new long[] { 128 }, null, null); + }, new CLMem[] { buffer }, new long[] { 128 }, null, ev); + + final CLEvent e = queue.getCLEvent(ev.get(0)); - clFinish(queue); + clSetEventCallback(e, CL_COMPLETE, new CLEventCallback() { + protected void handleMessage(final CLEvent event, final int event_command_exec_status) { + System.out.println("\t\tEvent callback status: " + getEventStatusName(event_command_exec_status)); + } + }); + + int status = e.getInfoInt(CL_EVENT_COMMAND_EXECUTION_STATUS); + System.out.println("NATIVE KERNEL STATUS: " + getEventStatusName(status)); + clFlush(queue); + do { + int newStatus = e.getInfoInt(CL_EVENT_COMMAND_EXECUTION_STATUS); + if ( newStatus != status ) { + status = newStatus; + System.out.println("NATIVE KERNEL STATUS: " + getEventStatusName(status)); + } + } while ( status != CL_SUCCESS ); // Busy-spin until we're done + + clReleaseEvent(e); } } @@ -182,6 +200,19 @@ System.out.println("\t" + param_name + " = " + device.getInfoString(param)); } + private static String getEventStatusName(final int status) { + switch ( status ) { + case CL_QUEUED: + return "CL_QUEUED"; + case CL_SUBMITTED: + return "CL_SUBMITTED"; + case CL_RUNNING: + return "CL_RUNNING"; + default: + return "CL_COMPLETE"; + } + } + private static void die(String kind, String description) { System.out.println(kind + " error " + description + " occured"); } diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opengl/awt/AWTGears.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opengl/awt/AWTGears.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opengl/awt/AWTGears.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opengl/awt/AWTGears.java 2016-04-09 16:26:56.000000000 +0000 @@ -35,17 +35,8 @@ import java.awt.Color; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; -import java.nio.FloatBuffer; -import org.lwjgl.BufferUtils; import org.lwjgl.LWJGLException; -import org.lwjgl.LWJGLUtil; -import org.lwjgl.Sys; -import org.lwjgl.opengl.AWTGLCanvas; -import org.lwjgl.opengl.GLContext; - -import static org.lwjgl.opengl.ARBTransposeMatrix.*; -import static org.lwjgl.opengl.GL11.*; /** *

    @@ -57,23 +48,6 @@ */ public class AWTGears extends Frame { - /** AWT GL canvas */ - private AWTGLCanvas canvas0; - - private float view_rotx = 20.0f; - - private float view_roty = 30.0f; - - private float view_rotz; - - private int gear1; - - private int gear2; - - private int gear3; - - private float angle; - /** * C'tor */ @@ -94,185 +68,6 @@ setVisible(true); } - private void setup() { - // setup ogl - FloatBuffer pos = BufferUtils.createFloatBuffer(4).put(new float[] { 5.0f, 5.0f, 10.0f, 0.0f}); - FloatBuffer red = BufferUtils.createFloatBuffer(4).put(new float[] { 0.8f, 0.1f, 0.0f, 1.0f}); - FloatBuffer green = BufferUtils.createFloatBuffer(4).put(new float[] { 0.0f, 0.8f, 0.2f, 1.0f}); - FloatBuffer blue = BufferUtils.createFloatBuffer(4).put(new float[] { 0.2f, 0.2f, 1.0f, 1.0f}); - pos.flip(); - red.flip(); - green.flip(); - blue.flip(); - - glLight(GL_LIGHT0, GL_POSITION, pos); - glEnable(GL_CULL_FACE); - glEnable(GL_LIGHTING); - glEnable(GL_LIGHT0); - glEnable(GL_DEPTH_TEST); - - /* make the gears */ - gear1 = glGenLists(1); - glNewList(gear1, GL_COMPILE); - glMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, red); - gear(1.0f, 4.0f, 1.0f, 20, 0.7f); - glEndList(); - - gear2 = glGenLists(1); - glNewList(gear2, GL_COMPILE); - glMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, green); - gear(0.5f, 2.0f, 2.0f, 10, 0.7f); - glEndList(); - - gear3 = glGenLists(1); - glNewList(gear3, GL_COMPILE); - glMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, blue); - gear(1.3f, 2.0f, 0.5f, 10, 0.7f); - glEndList(); - - glEnable(GL_NORMALIZE); - - glMatrixMode(GL_PROJECTION); - - System.err.println("LWJGL: " + Sys.getVersion() + " / " + LWJGLUtil.getPlatformName()); - System.err.println("GL_VENDOR: " + glGetString(GL_VENDOR)); - System.err.println("GL_RENDERER: " + glGetString(GL_RENDERER)); - System.err.println("GL_VERSION: " + glGetString(GL_VERSION)); - System.err.println(); - System.err.println("glLoadTransposeMatrixfARB() supported: " + GLContext.getCapabilities().GL_ARB_transpose_matrix); - if (!GLContext.getCapabilities().GL_ARB_transpose_matrix) { - // --- not using extensions - glLoadIdentity(); - } else { - // --- using extensions - final FloatBuffer identityTranspose = BufferUtils.createFloatBuffer(16).put( - new float[] { 1, 0, 0, 0, 0, 1, 0, 0, - 0, 0, 1, 0, 0, 0, 0, 1}); - identityTranspose.flip(); - glLoadTransposeMatrixARB(identityTranspose); - } - - float h = (float) 300 / (float) 300; - glFrustum(-1.0f, 1.0f, -h, h, 5.0f, 60.0f); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - glTranslatef(0.0f, 0.0f, -40.0f); - } - - /** - * Draw a gear wheel. You'll probably want to call this function when - * building a display list since we do a lot of trig here. - * - * @param inner_radius radius of hole at center - * @param outer_radius radius at center of teeth - * @param width width of gear - * @param teeth number of teeth - * @param tooth_depth depth of tooth - */ - private void gear(float inner_radius, float outer_radius, float width, int teeth, float tooth_depth) { - int i; - float r0, r1, r2; - float angle, da; - float u, v, len; - - r0 = inner_radius; - r1 = outer_radius - tooth_depth / 2.0f; - r2 = outer_radius + tooth_depth / 2.0f; - - da = 2.0f * (float) Math.PI / teeth / 4.0f; - - glShadeModel(GL_FLAT); - - glNormal3f(0.0f, 0.0f, 1.0f); - - /* draw front face */ - glBegin(GL_QUAD_STRIP); - for (i = 0; i <= teeth; i++) { - angle = i * 2.0f * (float) Math.PI / teeth; - glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), width * 0.5f); - glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), width * 0.5f); - if (i < teeth) { - glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), width * 0.5f); - glVertex3f(r1 * (float) Math.cos(angle + 3.0f * da), r1 * (float) Math.sin(angle + 3.0f * da), - width * 0.5f); - } - } - glEnd(); - - /* draw front sides of teeth */ - glBegin(GL_QUADS); - for (i = 0; i < teeth; i++) { - angle = i * 2.0f * (float) Math.PI / teeth; - glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), width * 0.5f); - glVertex3f(r2 * (float) Math.cos(angle + da), r2 * (float) Math.sin(angle + da), width * 0.5f); - glVertex3f(r2 * (float) Math.cos(angle + 2.0f * da), r2 * (float) Math.sin(angle + 2.0f * da), width * 0.5f); - glVertex3f(r1 * (float) Math.cos(angle + 3.0f * da), r1 * (float) Math.sin(angle + 3.0f * da), width * 0.5f); - } - glEnd(); - - /* draw back face */ - glBegin(GL_QUAD_STRIP); - for (i = 0; i <= teeth; i++) { - angle = i * 2.0f * (float) Math.PI / teeth; - glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), -width * 0.5f); - glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), -width * 0.5f); - glVertex3f(r1 * (float) Math.cos(angle + 3 * da), r1 * (float) Math.sin(angle + 3 * da), -width * 0.5f); - glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), -width * 0.5f); - } - glEnd(); - - /* draw back sides of teeth */ - glBegin(GL_QUADS); - for (i = 0; i < teeth; i++) { - angle = i * 2.0f * (float) Math.PI / teeth; - glVertex3f(r1 * (float) Math.cos(angle + 3 * da), r1 * (float) Math.sin(angle + 3 * da), -width * 0.5f); - glVertex3f(r2 * (float) Math.cos(angle + 2 * da), r2 * (float) Math.sin(angle + 2 * da), -width * 0.5f); - glVertex3f(r2 * (float) Math.cos(angle + da), r2 * (float) Math.sin(angle + da), -width * 0.5f); - glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), -width * 0.5f); - } - glEnd(); - - /* draw outward faces of teeth */ - glBegin(GL_QUAD_STRIP); - for (i = 0; i < teeth; i++) { - angle = i * 2.0f * (float) Math.PI / teeth; - glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), width * 0.5f); - glVertex3f(r1 * (float) Math.cos(angle), r1 * (float) Math.sin(angle), -width * 0.5f); - u = r2 * (float) Math.cos(angle + da) - r1 * (float) Math.cos(angle); - v = r2 * (float) Math.sin(angle + da) - r1 * (float) Math.sin(angle); - len = (float) Math.sqrt(u * u + v * v); - u /= len; - v /= len; - glNormal3f(v, -u, 0.0f); - glVertex3f(r2 * (float) Math.cos(angle + da), r2 * (float) Math.sin(angle + da), width * 0.5f); - glVertex3f(r2 * (float) Math.cos(angle + da), r2 * (float) Math.sin(angle + da), -width * 0.5f); - glNormal3f((float) Math.cos(angle), (float) Math.sin(angle), 0.0f); - glVertex3f(r2 * (float) Math.cos(angle + 2 * da), r2 * (float) Math.sin(angle + 2 * da), width * 0.5f); - glVertex3f(r2 * (float) Math.cos(angle + 2 * da), r2 * (float) Math.sin(angle + 2 * da), -width * 0.5f); - u = r1 * (float) Math.cos(angle + 3 * da) - r2 * (float) Math.cos(angle + 2 * da); - v = r1 * (float) Math.sin(angle + 3 * da) - r2 * (float) Math.sin(angle + 2 * da); - glNormal3f(v, -u, 0.0f); - glVertex3f(r1 * (float) Math.cos(angle + 3 * da), r1 * (float) Math.sin(angle + 3 * da), width * 0.5f); - glVertex3f(r1 * (float) Math.cos(angle + 3 * da), r1 * (float) Math.sin(angle + 3 * da), -width * 0.5f); - glNormal3f((float) Math.cos(angle), (float) Math.sin(angle), 0.0f); - } - glVertex3f(r1 * (float) Math.cos(0), r1 * (float) Math.sin(0), width * 0.5f); - glVertex3f(r1 * (float) Math.cos(0), r1 * (float) Math.sin(0), -width * 0.5f); - glEnd(); - - glShadeModel(GL_SMOOTH); - - /* draw inside radius cylinder */ - glBegin(GL_QUAD_STRIP); - for (i = 0; i <= teeth; i++) { - angle = i * 2.0f * (float) Math.PI / teeth; - glNormal3f(-(float) Math.cos(angle), -(float) Math.sin(angle), 0.0f); - glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), -width * 0.5f); - glVertex3f(r0 * (float) Math.cos(angle), r0 * (float) Math.sin(angle), width * 0.5f); - } - glEnd(); - } - public static void main(String[] args) throws LWJGLException { new AWTGears(); } diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opengl/awt/AWTTest.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opengl/awt/AWTTest.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opengl/awt/AWTTest.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opengl/awt/AWTTest.java 2016-04-09 16:26:56.000000000 +0000 @@ -46,9 +46,9 @@ *

    * Tests AWTGLCanvas functionality *

    - * @version $Revision: 3418 $ - * @author $Author: spasi $ - * $Id: AWTTest.java 3418 2010-09-28 21:11:35Z spasi $ + * @version $Revision$ + * @author $Author$ + * $Id$ */ public class AWTTest extends Frame { diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opengl/awt/DisplayParentTest.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opengl/awt/DisplayParentTest.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opengl/awt/DisplayParentTest.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opengl/awt/DisplayParentTest.java 2016-04-09 16:26:56.000000000 +0000 @@ -49,9 +49,9 @@ *

    * Tests Display.setParent() *

    - * @version $Revision: 3418 $ - * @author $Author: spasi $ - * $Id: DisplayParentTest.java 3418 2010-09-28 21:11:35Z spasi $ + * @version $Revision$ + * @author $Author$ + * $Id$ */ public class DisplayParentTest extends Frame { boolean killswitch; diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opengl/CanvasFocusTest.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opengl/CanvasFocusTest.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opengl/CanvasFocusTest.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opengl/CanvasFocusTest.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,270 @@ +package org.lwjgl.test.opengl; + +import org.lwjgl.LWJGLException; +import org.lwjgl.input.Mouse; +import org.lwjgl.opengl.Display; +import org.lwjgl.opengl.GL11; + +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; +import javax.swing.event.InternalFrameEvent; +import javax.swing.event.InternalFrameListener; +import javax.swing.plaf.metal.MetalLookAndFeel; + +import static org.lwjgl.opengl.GL11.*; + +public class CanvasFocusTest extends JFrame { + + private static final long serialVersionUID = 2853176700479564421L; + private JMenuBar menuBar; + private Canvas canvas; + private Thread gameThread; + + private boolean running; + + private JInternalFrame createDebugFrame() { + + JInternalFrame internalFrame = new JInternalFrame("Debug Frame"); + internalFrame.setLayout(new FlowLayout(FlowLayout.CENTER)); + internalFrame.setSize(400, 100); + internalFrame.setVisible(true); + + JButton focus = new JButton("Focus"); + focus.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + canvas.setFocusable(true); + } + }); + internalFrame.add(focus); + + JButton unfocus = new JButton("Unfocus"); + unfocus.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + canvas.setFocusable(false); + } + }); + + internalFrame.add(unfocus); + + JButton metal = new JButton("Metal"); + metal.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + switchMetal(); + } + }); + + internalFrame.add(metal); + + JButton substance = new JButton("Substance"); + substance.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + switchSubstance(); + } + }); + + internalFrame.add(substance); + return internalFrame; + } + + private JInternalFrame createGameFrame() { + final JInternalFrame canvasFrame = new JInternalFrame("Game Frame"); + canvasFrame.setSize(800, 600); + canvasFrame.setLocation(80, 80); + canvasFrame.setVisible(true); + + canvas = new Canvas() { + @Override + public void addNotify() { + super.addNotify(); + startLWJGL(); + } + + @Override + public void removeNotify() { + stopLWJGL(); + super.removeNotify(); + } + }; + + canvasFrame.add(canvas); + canvas.setSize(canvasFrame.getContentPane().getSize()); + canvas.setFocusable(true); + canvas.requestFocus(); + canvas.setIgnoreRepaint(true); + + canvasFrame.addInternalFrameListener(new InternalFrameListener() { + public void internalFrameOpened(InternalFrameEvent e) { + SwingUtilities.getWindowAncestor(canvasFrame).validate(); + } + + public void internalFrameClosing(InternalFrameEvent e) { + SwingUtilities.getWindowAncestor(canvasFrame).validate(); + } + + public void internalFrameClosed(InternalFrameEvent e) { + SwingUtilities.getWindowAncestor(canvasFrame).validate(); + } + + public void internalFrameIconified(InternalFrameEvent e) { + SwingUtilities.getWindowAncestor(canvasFrame).validate(); + } + + public void internalFrameDeiconified(InternalFrameEvent e) { + SwingUtilities.getWindowAncestor(canvasFrame).validate(); + } + + public void internalFrameActivated(InternalFrameEvent e) { + SwingUtilities.getWindowAncestor(canvasFrame).validate(); + } + + public void internalFrameDeactivated(InternalFrameEvent e) { + SwingUtilities.getWindowAncestor(canvasFrame).validate(); + } + }); + canvasFrame.addComponentListener(new ComponentAdapter() { + public void componentResized(ComponentEvent e) { + SwingUtilities.getWindowAncestor(canvasFrame).validate(); + } + + public void componentMoved(ComponentEvent e) { + SwingUtilities.getWindowAncestor(canvasFrame).validate(); + + } + }); + + Thread thread = new Thread() { + @Override + public void run() { + while ( true ) { + while ( !Mouse.isCreated() ) { + try { + Thread.sleep(10); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + while ( Mouse.next() ) { + int wheelD = Mouse.getDWheel(); + if ( wheelD != 0 ) { + System.out.println("" + wheelD); + } + } + } + } + }; + thread.start(); + + return canvasFrame; + } + + protected void gameLoop() { + glClearColor(1f, 0f, 1f, 0f); + + Boolean active = null; + while ( running ) { + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + + Display.update(); + Display.sync(60); + + boolean a = Display.isActive(); + if ( active == null || active != a ) { + System.out.println("Diplay.isActive() = " + a + " - " +canvas.isFocusOwner()); + active = a; + } + } + + Display.destroy(); + } + + public void init() { + + } + + protected void initGL() { + } + + private void loadSwing() { + + switchSubstance(); + + menuBar = new JMenuBar(); + JMenu file = new JMenu("File"); + file.add(new JMenuItem("Item 1")); + file.add(new JMenuItem("Item 2")); + file.add(new JMenuItem("Item 3")); + menuBar.add(file); + + setJMenuBar(menuBar); + + JDesktopPane desktop = new JDesktopPane(); + this.add(desktop); + + JInternalFrame canvasFrame = createGameFrame(); + desktop.add(canvasFrame); + + JInternalFrame debugFrame = createDebugFrame(); + desktop.add(debugFrame); + + this.setSize(1024, 768); + + setVisible(true); + setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); + } + + public void start() { + + EventQueue.invokeLater(new Runnable() { + public void run() { + loadSwing(); + } + }); + + } + + public void startLWJGL() { + gameThread = new Thread() { + + @Override + public void run() { + running = true; + try { + Display.setParent(canvas); + Display.create(); + initGL(); + } catch (LWJGLException e) { + e.printStackTrace(); + return; + } + gameLoop(); + } + }; + gameThread.start(); + } + + private void stopLWJGL() { + Display.destroy(); + } + + protected void switchMetal() { + try { + UIManager.setLookAndFeel(new MetalLookAndFeel()); + UIManager.getLookAndFeelDefaults().put("ClassLoader", getClass().getClassLoader()); + SwingUtilities.updateComponentTreeUI(this); + } catch (UnsupportedLookAndFeelException e) { + e.printStackTrace(); + } + } + + protected void switchSubstance() { + UIManager.getLookAndFeelDefaults().put("ClassLoader", getClass().getClassLoader()); + SwingUtilities.updateComponentTreeUI(this); + } + + public static void main(String[] args) { + new CanvasFocusTest().start(); + } + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opengl/CrashTest.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opengl/CrashTest.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opengl/CrashTest.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opengl/CrashTest.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,102 @@ +package org.lwjgl.test.opengl; + +import org.lwjgl.input.Keyboard; +import org.lwjgl.input.Mouse; +import org.lwjgl.opengl.*; + +import java.lang.reflect.Field; +import java.nio.ByteBuffer; +import java.nio.ByteOrder; +import java.nio.IntBuffer; + +import static org.lwjgl.opengl.GL11.*; +import static org.lwjgl.opengl.GL15.*; + +/** + * + */ +public class CrashTest { + + /** + * The main method. + * + * @param args command-line arguments (ignored) + */ + public static void main(String[] args) { + try { + + // native library loading + /*System.setProperty("java.library.path", "lib/native/macosx"); + Field fieldSysPath = ClassLoader.class.getDeclaredField("sys_paths"); + fieldSysPath.setAccessible(true); + fieldSysPath.set(null, null);*/ + + // initialize LWJGL + Display.setDisplayMode(new DisplayMode(640, 480)); + Display.create(new PixelFormat(), new ContextAttribs(4, 2).withProfileCompatibility(true).withDebug(true)); + Mouse.create(); + Mouse.setGrabbed(true); + Mouse.poll(); + Keyboard.create(); + + AMDDebugOutput.glDebugMessageCallbackAMD(new AMDDebugOutputCallback()); + + // initialize OpenGL + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + + // clear screen + glDepthMask(true); + glClearColor(0.0f, 0.0f, 0.0f, 1.0f); + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + + // prepare data (24 quads, 4 vertices each, 2 floats each, 4 bytes each) + IntBuffer buffer = ByteBuffer.allocateDirect(24 * 4 * 2 * 4).order(ByteOrder.nativeOrder()).asIntBuffer(); + for ( int i = 0; i < 6; i++ ) { + for ( int j = 0; j < 4; j++ ) { + buffer.put(2 * i); + buffer.put(2 * j); + buffer.put(2 * i + 1); + buffer.put(2 * j); + buffer.put(2 * i + 1); + buffer.put(2 * j + 1); + buffer.put(2 * i); + buffer.put(2 * j + 1); + } + } + + // prepare OpenGL buffer + int arrayBufferName = glGenBuffers(); + glBindBuffer(GL_ARRAY_BUFFER, arrayBufferName); + //buffer.rewind(); // <-- forget this and it crashes! + glBufferData(GL_ARRAY_BUFFER, buffer, GL_STATIC_DRAW); + + // set up OpenGL state + glScalef(0.25f, 1.0f / 3.0f, 1.0f); + glVertexPointer(2, GL_INT, 0, 0); + glEnableClientState(GL_VERTEX_ARRAY); + + // draw the frame + glDrawArrays(GL_TRIANGLES, 0, 24 * 4); + glFlush(); + Display.swapBuffers(); + + // wait for keypress + while ( !Keyboard.isKeyDown(Keyboard.KEY_ESCAPE) ) { + Keyboard.poll(); + } + + // clean up + Keyboard.destroy(); + Mouse.destroy(); + Display.destroy(); + + } catch (Throwable e) { + System.err.println("got an exception"); + throw new RuntimeException(e); + } + } + +} diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opengl/FullScreenWindowedTest.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opengl/FullScreenWindowedTest.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opengl/FullScreenWindowedTest.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opengl/FullScreenWindowedTest.java 2016-04-09 16:26:56.000000000 +0000 @@ -46,8 +46,8 @@ * Tests switching between windowed and fullscreen * * @author Brian Matzon - * @version $Revision: 3418 $ - * $Id: FullScreenWindowedTest.java 3418 2010-09-28 21:11:35Z spasi $ + * @version $Revision$ + * $Id$ */ public class FullScreenWindowedTest { /** Intended deiplay mode */ diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opengl/Gears.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opengl/Gears.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opengl/Gears.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opengl/Gears.java 2016-04-09 16:26:56.000000000 +0000 @@ -53,8 +53,8 @@ * This is the OpenGL "standard" Gears demo, originally by Brian Paul *

    * @author Brian Matzon - * @version $Revision: 3418 $ - * $Id: Gears.java 3418 2010-09-28 21:11:35Z spasi $ + * @version $Revision$ + * $Id$ */ public class Gears { diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opengl/JNIPerfTestLWJGL.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opengl/JNIPerfTestLWJGL.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opengl/JNIPerfTestLWJGL.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opengl/JNIPerfTestLWJGL.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,67 @@ +package org.lwjgl.test.opengl; + +import org.lwjgl.BufferUtils; +import org.lwjgl.LWJGLException; +import org.lwjgl.opengl.Display; + +import java.nio.IntBuffer; + +import static org.lwjgl.opengl.GL11.*; + +public class JNIPerfTestLWJGL { + + private JNIPerfTestLWJGL() { + } + + public static void main(String[] args) { + try { + Display.setFullscreen(false); + Display.create(); + } catch (LWJGLException e) { + e.printStackTrace(); + } + + int DURATION = 1024 * 1024; + int WARMUP = 5 * DURATION; + int BENCH = 10 * DURATION; + + benchmark(WARMUP, BENCH); + + //BufferUtils.noop4(0.0f, 0.0f, 0.0f, 0.0f); + } + + private static void benchmark(int WARMUP, int BENCH) { + IntBuffer buffer = BufferUtils.createIntBuffer(16); + + int sum = 0; + sum += benchLoop(buffer, WARMUP); + + System.out.println("WARMUP DONE"); + + long time = System.nanoTime(); + sum += benchLoop(buffer, BENCH); + time = (System.nanoTime() - time) / BENCH; + + System.out.println(time); + if ( sum == Integer.MIN_VALUE ) + throw new RuntimeException(); + } + + private static int benchLoop(IntBuffer buffer, int duration) { + int sum = 0; + for ( int i = 0; i < duration; i++ ) { + //glGetInteger(GL_MAX_TEXTURE_IMAGE_UNITS, buffer); // 18 + //sum += buffer.get(0); + //glDepthMask(true); // 12 + //glColor4f(1.0f, 1.0f, 1.0f, 0.0f); // 13 + + //glColor3f(1.0f, 1.0f, 1.0f); // 16 + //BufferUtils.noop0(); // 7 + //BufferUtils.noop0f(0L); // 8 + //BufferUtils.noop3(1, 2, 3); // 8 + //BufferUtils.noop4f(1.0f, 1.0f, 1.0f, 0.0f, 0L); // 8 + } + return sum; + } + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opengl/multithread/BackgroundLoader.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opengl/multithread/BackgroundLoader.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opengl/multithread/BackgroundLoader.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opengl/multithread/BackgroundLoader.java 2016-04-09 16:26:56.000000000 +0000 @@ -40,26 +40,33 @@ import org.lwjgl.BufferUtils; import org.lwjgl.LWJGLException; import org.lwjgl.opengl.Drawable; +import org.lwjgl.opengl.GLContext; +import org.lwjgl.opengl.GLSync; import org.lwjgl.util.Color; import org.lwjgl.util.ReadableColor; import java.nio.ByteBuffer; +import java.util.concurrent.locks.ReentrantLock; import static org.lwjgl.opengl.GL11.*; +import static org.lwjgl.opengl.GL32.*; abstract class BackgroundLoader { - private static final int WIDTH = 32; + private static final int WIDTH = 32; private static final int HEIGHT = 32; - private static final Object lock = new Object(); + // CPU synchronization + private final ReentrantLock lock = new ReentrantLock(); + // GPU synchronization + private GLSync fence; private Drawable drawable; private boolean running; private ByteBuffer texture; - private int texID; + private int texID; protected BackgroundLoader() { running = true; @@ -73,6 +80,9 @@ } void start() throws LWJGLException { + // The shared context must be created on the main thread. + drawable = getDrawable(); + new Thread(new Runnable() { public void run() { System.out.println("-- Background Thread started --"); @@ -86,7 +96,7 @@ } try { - drawable = getDrawable(); + // Make the shared context current in the worker thread drawable.makeCurrent(); } catch (LWJGLException e) { throw new RuntimeException(e); @@ -94,19 +104,29 @@ System.out.println("** Drawable created **"); - synchronized ( lock ) { - // Create a "dummy" texture while we wait for texture IO - createCheckerTexture(Color.RED, Color.WHITE, 2); + // Create a "dummy" texture while we wait for texture IO + createCheckerTexture(Color.RED, Color.WHITE, 2); - texID = glGenTextures(); - glBindTexture(GL_TEXTURE_2D, texID); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, WIDTH, HEIGHT, 0, GL_RGB, GL_UNSIGNED_BYTE, texture); + lock.lock(); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + texID = glGenTextures(); + glBindTexture(GL_TEXTURE_2D, texID); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, WIDTH, HEIGHT, 0, GL_RGB, GL_UNSIGNED_BYTE, texture); - glBindTexture(GL_TEXTURE_2D, 0); - } + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + + glBindTexture(GL_TEXTURE_2D, 0); + + // OpenGL commands from different contexts may be executed in any order. So we need a way to synchronize + final boolean useFences = GLContext.getCapabilities().OpenGL32; + + if ( useFences ) + fence = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0); + else + glFlush(); // Best we can do without fences. This will force rendering on the main thread to happen after we upload the texture. + + lock.unlock(); System.out.println("** Dummy texture created **"); @@ -129,14 +149,23 @@ else createGradientTexture(Color.GREEN, Color.YELLOW); + lock.lock(); + glBindTexture(GL_TEXTURE_2D, texID); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, WIDTH, HEIGHT, 0, GL_RGB, GL_UNSIGNED_BYTE, texture); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glBindTexture(GL_TEXTURE_2D, 0); + if ( useFences ) + fence = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0); + else + glFlush(); + + lock.unlock(); + System.out.println("** Created new gradient texture **"); lastTextureCreated = System.currentTimeMillis(); @@ -151,8 +180,15 @@ } int getTexID() { - synchronized ( lock ) { + lock.lock(); + try { + if ( fence != null ) { + glWaitSync(fence, 0, GL_TIMEOUT_IGNORED); + fence = null; + } return texID; + } finally { + lock.unlock(); } } diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opengl/pbuffers/MSAATest.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opengl/pbuffers/MSAATest.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opengl/pbuffers/MSAATest.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opengl/pbuffers/MSAATest.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,22 @@ +package org.lwjgl.test.opengl.pbuffers; + +import org.lwjgl.LWJGLException; +import org.lwjgl.opengl.Pbuffer; +import org.lwjgl.opengl.PixelFormat; + +public class MSAATest { + + public MSAATest() { + + } + + public static void main(String[] args) { + try { + new Pbuffer(64, 64, new PixelFormat(32, 8, 24, 8, 4), null); + } catch (LWJGLException e) { + throw new RuntimeException(e); + } + System.out.println("done"); + } + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opengl/pbuffers/PbufferTest.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opengl/pbuffers/PbufferTest.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opengl/pbuffers/PbufferTest.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opengl/pbuffers/PbufferTest.java 2016-04-09 16:26:56.000000000 +0000 @@ -50,8 +50,8 @@ * Tests Pbuffers * * @author elias_naur - * @version $Revision: 3418 $ - * $Id: PbufferTest.java 3418 2010-09-28 21:11:35Z spasi $ + * @version $Revision$ + * $Id$ */ public final class PbufferTest { diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opengl/PbufferTest.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opengl/PbufferTest.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opengl/PbufferTest.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opengl/PbufferTest.java 2016-04-09 16:26:56.000000000 +0000 @@ -51,8 +51,8 @@ * Tests Pbuffers * * @author elias_naur - * @version $Revision: 3418 $ - * $Id: PbufferTest.java 3418 2010-09-28 21:11:35Z spasi $ + * @version $Revision$ + * $Id$ */ public class PbufferTest { diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opengl/shaders/ShadersTest.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opengl/shaders/ShadersTest.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opengl/shaders/ShadersTest.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opengl/shaders/ShadersTest.java 2016-04-09 16:26:56.000000000 +0000 @@ -137,7 +137,7 @@ System.out.println("Setting display mode to: " + displayMode); Display.setDisplayMode(displayMode); - Display.create(new PixelFormat(8, 24, 0), "UNI".equalsIgnoreCase(args[0]) ? new ContextAttribs(3, 1) : null); + Display.create(new PixelFormat(8, 24, 0)); ShadersTest.displayMode = displayMode; } catch (LWJGLException e) { kill(e.getMessage()); diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opengl/shaders/ShaderUNI.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opengl/shaders/ShaderUNI.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opengl/shaders/ShaderUNI.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opengl/shaders/ShaderUNI.java 2016-04-09 16:26:56.000000000 +0000 @@ -75,7 +75,7 @@ printShaderObjectInfoLog(file, shaderID); - if ( glGetShader(shaderID, GL_COMPILE_STATUS) == GL_FALSE ) + if ( glGetShaderi(shaderID, GL_COMPILE_STATUS) == GL_FALSE ) ShadersTest.kill("A compilation error occured in a vertex shader."); programID = glCreateProgram(); @@ -85,14 +85,14 @@ printShaderProgramInfoLog(programID); - if ( glGetProgram(programID, GL_LINK_STATUS) == GL_FALSE ) + if ( glGetProgrami(programID, GL_LINK_STATUS) == GL_FALSE ) ShadersTest.kill("A linking error occured in a shader program."); final String[] uniformNames = { "uniformA", "uniformB" }; // Get uniform block index and data size final int blockIndex = glGetUniformBlockIndex(programID, "test"); - final int blockSize = glGetActiveUniformBlock(programID, blockIndex, GL_UNIFORM_BLOCK_DATA_SIZE); + final int blockSize = glGetActiveUniformBlocki(programID, blockIndex, GL_UNIFORM_BLOCK_DATA_SIZE); System.out.println("blockSize = " + blockSize); diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opengl/sprites/SpriteShootout2P.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opengl/sprites/SpriteShootout2P.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opengl/sprites/SpriteShootout2P.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opengl/sprites/SpriteShootout2P.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,624 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.test.opengl.sprites; + +import org.lwjgl.BufferUtils; +import org.lwjgl.LWJGLException; +import org.lwjgl.Sys; +import org.lwjgl.input.Keyboard; +import org.lwjgl.input.Mouse; +import org.lwjgl.opengl.*; + +import java.awt.image.BufferedImage; +import java.awt.image.Raster; +import java.io.IOException; +import java.nio.ByteBuffer; +import java.nio.FloatBuffer; +import java.util.Random; +import javax.imageio.ImageIO; + +import static org.lwjgl.opengl.EXTTransformFeedback.*; +import static org.lwjgl.opengl.GL11.*; +import static org.lwjgl.opengl.GL12.*; +import static org.lwjgl.opengl.GL15.*; +import static org.lwjgl.opengl.GL20.*; +import static org.lwjgl.opengl.GL30.*; + +/** + * Sprite rendering demo. In this version we're doing the animation + * computations on the GPU, using transform feedback and a vertex + * shader, then rendering is performed in 2 passes, with depth testing + * enabled: + * 1) Sprites are rendered front-to-back, opaque fragments only, blending is disabled. + * 2) Sprites are rendered back-to-front, transparent fragments only, blending is enabled. + * Sorting is free, because we're animating double the amount of sprites rendered, the + * first batch is sorted f2b, the second is sorted b2f. Ordering is achieved by modifying + * the z-axis position of the sprites in the vertex shader. + * + * @author Spasi + * @since 18/3/2011 + */ +public final class SpriteShootout2P { + + private static final int SCREEN_WIDTH = 800; + private static final int SCREEN_HEIGHT = 600; + + private static final int ANIMATION_TICKS = 60; + + private boolean run = true; + private boolean render = true; + private boolean colorMask = true; + private boolean animate = true; + private boolean smooth; + private boolean vsync; + + private int ballSize = 42; + private int ballCount = 100 * 1000; + + private SpriteRenderer renderer; + + // OpenGL stuff + private int texID; + private int texBigID; + private int texSmallID; + + private SpriteShootout2P() { + } + + public static void main(String[] args) { + try { + new SpriteShootout2P().start(); + } catch (LWJGLException e) { + e.printStackTrace(); + } + } + + private void start() throws LWJGLException { + try { + initGL(); + + renderer = new SpriteRendererTF(); + + updateBalls(ballCount); + run(); + } catch (Throwable t) { + t.printStackTrace(); + } finally { + destroy(); + } + } + + private void initGL() throws LWJGLException { + Display.setLocation((Display.getDisplayMode().getWidth() - SCREEN_WIDTH) / 2, + (Display.getDisplayMode().getHeight() - SCREEN_HEIGHT) / 2); + Display.setDisplayMode(new DisplayMode(SCREEN_WIDTH, SCREEN_HEIGHT)); + Display.setTitle("Sprite Shootout 2-pass"); + Display.create(new PixelFormat(0, 24, 0)); + //Display.create(new PixelFormat(), new ContextAttribs(4, 1).withProfileCompatibility(true).withDebug(true)); + //AMDDebugOutput.glDebugMessageCallbackAMD(new AMDDebugOutputCallback()); + + final ContextCapabilities caps = GLContext.getCapabilities(); + if ( !(caps.OpenGL30 || (caps.OpenGL20 && caps.GL_EXT_transform_feedback)) ) + throw new RuntimeException("OpenGL 3.0 or 2.0 + EXT_transform_feedback is required for this demo."); + + // Setup viewport + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glOrtho(0, SCREEN_WIDTH, 0, SCREEN_HEIGHT, -1.0, 1.0); + + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + glViewport(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); + + glClearColor(1.0f, 1.0f, 1.0f, 0.0f); + + // Create textures + + try { + texSmallID = createTexture("res/ball_sm.png"); + texBigID = createTexture("res/ball.png"); + } catch (IOException e) { + e.printStackTrace(); + System.exit(-1); + } + texID = texBigID; + + // Setup rendering state + + glEnable(GL_BLEND); + glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); + + glEnable(GL_ALPHA_TEST); + + glColorMask(colorMask, colorMask, colorMask, false); + glDepthMask(true); + glEnable(GL_DEPTH_TEST); + glDepthFunc(GL_LESS); + glClearDepth(1.0f); + + if ( caps.GL_ARB_compatibility || !caps.OpenGL31 ) + glEnable(GL_POINT_SPRITE); + + // Setup geometry + + glEnableClientState(GL_VERTEX_ARRAY); + + Util.checkGLError(); + } + + private static int createTexture(final String path) throws IOException { + final BufferedImage img = ImageIO.read(SpriteShootout2P.class.getClassLoader().getResource(path)); + + final int w = img.getWidth(); + final int h = img.getHeight(); + + final ByteBuffer buffer = readImage(img); + + final int texID = glGenTextures(); + + glBindTexture(GL_TEXTURE_2D, texID); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_BGRA, GL_UNSIGNED_BYTE, buffer); + + return texID; + } + + private static ByteBuffer readImage(final BufferedImage img) throws IOException { + final Raster raster = img.getRaster(); + + final int bands = raster.getNumBands(); + + final int w = img.getWidth(); + final int h = img.getHeight(); + + final int size = w * h * bands; + + final byte[] pixels = new byte[size]; + raster.getDataElements(0, 0, w, h, pixels); + + final ByteBuffer pbuffer = BufferUtils.createByteBuffer(size); + + if ( bands == 4 ) { + for ( int i = 0; i < (w * h * 4); i += 4 ) { + // Pre-multiply alpha + final float a = unpackUByte01(pixels[i + 3]); + pbuffer.put(packUByte01(unpackUByte01(pixels[i + 2]) * a)); + pbuffer.put(packUByte01(unpackUByte01(pixels[i + 1]) * a)); + pbuffer.put(packUByte01(unpackUByte01(pixels[i + 0]) * a)); + pbuffer.put(pixels[i + 3]); + } + } else if ( bands == 3 ) { + for ( int i = 0; i < (w * h * 3); i += 3 ) { + pbuffer.put(pixels[i + 2]); + pbuffer.put(pixels[i + 1]); + pbuffer.put(pixels[i + 0]); + } + } else + pbuffer.put(pixels, 0, size); + + pbuffer.flip(); + + return pbuffer; + } + + private static float unpackUByte01(final byte x) { + return (x & 0xFF) / 255.0f; + } + + private static byte packUByte01(final float x) { + return (byte)(x * 255.0f); + } + + private void updateBalls(final int count) { + System.out.println("NUMBER OF BALLS: " + count); + renderer.updateBalls(ballCount); + } + + private void run() { + long startTime = System.currentTimeMillis() + 5000; + long fps = 0; + + long time = Sys.getTime(); + final int ticksPerUpdate = (int)(Sys.getTimerResolution() / ANIMATION_TICKS); + + renderer.render(false, true, 0); + + while ( run ) { + Display.processMessages(); + handleInput(); + + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + + final long currTime = Sys.getTime(); + final int delta = (int)(currTime - time); + if ( smooth || delta >= ticksPerUpdate ) { + renderer.render(render, animate, delta); + time = currTime; + } else + renderer.render(render, false, 0); + + Display.update(false); + //Display.sync(60); + + if ( startTime > System.currentTimeMillis() ) { + fps++; + } else { + long timeUsed = 5000 + (startTime - System.currentTimeMillis()); + startTime = System.currentTimeMillis() + 5000; + System.out.println("FPS: " + (Math.round(fps / (timeUsed / 1000.0) * 10) / 10.0) + ", Balls: " + ballCount); + fps = 0; + } + } + } + + private void handleInput() { + if ( Display.isCloseRequested() ) + run = false; + + while ( Keyboard.next() ) { + if ( Keyboard.getEventKeyState() ) + continue; + + switch ( Keyboard.getEventKey() ) { + case Keyboard.KEY_1: + case Keyboard.KEY_2: + case Keyboard.KEY_3: + case Keyboard.KEY_4: + case Keyboard.KEY_5: + case Keyboard.KEY_6: + case Keyboard.KEY_7: + case Keyboard.KEY_8: + case Keyboard.KEY_9: + case Keyboard.KEY_0: + ballCount = 1 << (Keyboard.getEventKey() - Keyboard.KEY_1); + updateBalls(ballCount); + break; + case Keyboard.KEY_ADD: + case Keyboard.KEY_SUBTRACT: + int mult; + if ( Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) ) { + mult = 1000; + if ( Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) || Keyboard.isKeyDown(Keyboard.KEY_RCONTROL) ) + mult *= 5; + } else if ( Keyboard.isKeyDown(Keyboard.KEY_LMENU) || Keyboard.isKeyDown(Keyboard.KEY_RMENU) ) + mult = 100; + else if ( Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) || Keyboard.isKeyDown(Keyboard.KEY_RCONTROL) ) + mult = 10; + else + mult = 1; + if ( Keyboard.getEventKey() == Keyboard.KEY_SUBTRACT ) + mult = -mult; + ballCount += mult * 100; + if ( ballCount <= 0 ) + ballCount = 1; + updateBalls(ballCount); + break; + case Keyboard.KEY_ESCAPE: + run = false; + break; + case Keyboard.KEY_A: + animate = !animate; + System.out.println("Animation is now " + (animate ? "on" : "off") + "."); + break; + case Keyboard.KEY_C: + colorMask = !colorMask; + glColorMask(colorMask, colorMask, colorMask, false); + System.out.println("Color mask is now " + (colorMask ? "on" : "off") + "."); + // Disable alpha test when color mask is off, else we get no benefit. + if ( colorMask ) { + glEnable(GL_BLEND); + glEnable(GL_ALPHA_TEST); + } else { + glDisable(GL_BLEND); + glDisable(GL_ALPHA_TEST); + } + break; + case Keyboard.KEY_R: + render = !render; + System.out.println("Rendering is now " + (render ? "on" : "off") + "."); + break; + case Keyboard.KEY_S: + smooth = !smooth; + System.out.println("Smooth animation is now " + (smooth ? "on" : "off") + "."); + break; + case Keyboard.KEY_T: + if ( texID == texBigID ) { + texID = texSmallID; + ballSize = 16; + } else { + texID = texBigID; + ballSize = 42; + } + renderer.updateBallSize(); + glBindTexture(GL_TEXTURE_2D, texID); + System.out.println("Now using the " + (texID == texBigID ? "big" : "small") + " texture."); + break; + case Keyboard.KEY_V: + vsync = !vsync; + Display.setVSyncEnabled(vsync); + System.out.println("VSYNC is now " + (vsync ? "enabled" : "disabled") + "."); + break; + } + } + + while ( Mouse.next() ) ; + } + + private void destroy() { + Display.destroy(); + } + + private abstract class SpriteRenderer { + + protected int progID; + + protected void createPrograms(final int vshID) { + // Opaque pass + + final int fshID = glCreateShader(GL_FRAGMENT_SHADER); + glShaderSource(fshID, "uniform sampler2D COLOR_MAP;\n" + + "void main(void) {\n" + + " gl_FragColor = texture2D(COLOR_MAP, gl_PointCoord);\n" + + "}"); + glCompileShader(fshID); + if ( glGetShaderi(fshID, GL_COMPILE_STATUS) == GL_FALSE ) { + System.out.println(glGetShaderInfoLog(fshID, glGetShaderi(fshID, GL_INFO_LOG_LENGTH))); + throw new RuntimeException("Failed to compile fragment shader."); + } + + progID = glCreateProgram(); + glAttachShader(progID, vshID); + glAttachShader(progID, fshID); + glLinkProgram(progID); + if ( glGetProgrami(progID, GL_LINK_STATUS) == GL_FALSE ) { + System.out.println(glGetProgramInfoLog(progID, glGetProgrami(progID, GL_INFO_LOG_LENGTH))); + throw new RuntimeException("Failed to link shader program."); + } + + glUseProgram(progID); + glUniform1i(glGetUniformLocation(progID, "COLOR_MAP"), 0); + + updateBallSize(); + + glEnableClientState(GL_VERTEX_ARRAY); + } + + public void updateBallSize() { + glPointSize(ballSize); + } + + protected abstract void updateBalls(final int count); + + protected abstract void render(boolean render, boolean animate, int delta); + + } + + private class SpriteRendererTF extends SpriteRenderer { + + private int progIDTF; + private int ballSizeLoc; + private int deltaLoc; + + private int[] tfVBO = new int[2]; + private int currVBO; + + private int depthVBO; + private int depthLoc; + + SpriteRendererTF() { + System.out.println("Shootout Implementation: TF GPU animation & 2-pass rendering"); + + // Transform-feedback program + + int vshID = glCreateShader(GL_VERTEX_SHADER); + glShaderSource(vshID, "#version 130\n" + + "const float WIDTH = " + SCREEN_WIDTH + ";\n" + + "const float HEIGHT = " + SCREEN_HEIGHT + ";\n" + + "uniform float ballSize;\n" + // ballSize / 2 + "uniform float delta;\n" + + "void main(void) {\n" + + " vec4 anim = gl_Vertex;\n" + + " anim.xy = anim.xy + anim.zw * delta;\n" + + " vec2 animC = clamp(anim.xy, vec2(ballSize), vec2(WIDTH - ballSize, HEIGHT - ballSize));\n" + + " if ( anim.x != animC.x ) anim.z = -anim.z;\n" + + " if ( anim.y != animC.y ) anim.w = -anim.w;\n" + + " gl_Position = vec4(animC, anim.zw);\n" + + "}"); + glCompileShader(vshID); + if ( glGetShaderi(vshID, GL_COMPILE_STATUS) == GL_FALSE ) { + System.out.println(glGetShaderInfoLog(vshID, glGetShaderi(vshID, GL_INFO_LOG_LENGTH))); + throw new RuntimeException("Failed to compile vertex shader."); + } + + progIDTF = glCreateProgram(); + glAttachShader(progIDTF, vshID); + glTransformFeedbackVaryings(progIDTF, new CharSequence[] { "gl_Position" }, GL_SEPARATE_ATTRIBS); + glLinkProgram(progIDTF); + if ( glGetProgrami(progIDTF, GL_LINK_STATUS) == GL_FALSE ) { + System.out.println(glGetProgramInfoLog(progIDTF, glGetProgrami(progIDTF, GL_INFO_LOG_LENGTH))); + throw new RuntimeException("Failed to link shader program."); + } + + glUseProgram(progIDTF); + + ballSizeLoc = glGetUniformLocation(progIDTF, "ballSize"); + deltaLoc = glGetUniformLocation(progIDTF, "delta"); + + glUniform1f(ballSizeLoc, ballSize * 0.5f); + + // ----------------- + + vshID = glCreateShader(GL_VERTEX_SHADER); + glShaderSource(vshID, "#version 130\n" + + "in float depth;\n" + + "void main(void) {\n" + + " gl_Position = gl_ModelViewProjectionMatrix * vec4(gl_Vertex.xy, depth, gl_Vertex.w);\n" + + "}"); + glCompileShader(vshID); + if ( glGetShaderi(vshID, GL_COMPILE_STATUS) == GL_FALSE ) { + System.out.println(glGetShaderInfoLog(vshID, glGetShaderi(vshID, GL_INFO_LOG_LENGTH))); + throw new RuntimeException("Failed to compile vertex shader."); + } + + createPrograms(vshID); + + depthLoc = glGetAttribLocation(progID, "depth"); + + // ----------------- + } + + public void updateBallSize() { + glUseProgram(progIDTF); + glUniform1f(ballSizeLoc, ballSize * 0.5f); + + super.updateBallSize(); + } + + public void updateBalls(final int count) { + // Depth data + + final FloatBuffer depths = BufferUtils.createFloatBuffer(count * 2); + final float depthStep = 1.9f / count; + float depth = Float.parseFloat("0x1.fffffep-1"); + // Front-to-back + for ( int i = 0; i < count; i++ ) { + depths.put(depth); + depth -= depthStep; + } + // Back-to-front + for ( int i = 0; i < count; i++ ) + depths.put(depths.get(count - 1 - i)); + depths.flip(); + + if ( depthVBO != 0 ) + glDeleteBuffers(depthVBO); + + depthVBO = glGenBuffers(); + glBindBuffer(GL_ARRAY_BUFFER, depthVBO); + glBufferData(GL_ARRAY_BUFFER, depths, GL_STATIC_DRAW); + + glEnableVertexAttribArray(depthLoc); + glVertexAttribPointer(depthLoc, 1, GL_FLOAT, false, 0, 0); + + // Animation data + + final FloatBuffer transform = BufferUtils.createFloatBuffer(count * 2 * 4); + // Front-to-back + final Random random = new Random(); + for ( int i = 0; i < count; i++ ) { + transform.put((int)(random.nextFloat() * (SCREEN_WIDTH - ballSize) + ballSize * 0.5f)); + transform.put((int)(random.nextFloat() * (SCREEN_HEIGHT - ballSize) + ballSize * 0.5f)); + transform.put(random.nextFloat() * 0.4f - 0.2f); + transform.put(random.nextFloat() * 0.4f - 0.2f); + } + // Back-to-front + for ( int i = 0; i < count; i++ ) { + final int offset = (count - 1 - i) * 4; + transform.put(transform.get(offset + 0)); + transform.put(transform.get(offset + 1)); + transform.put(transform.get(offset + 2)); + transform.put(transform.get(offset + 3)); + } + transform.flip(); + + if ( tfVBO[0] != 0 ) { + for ( int i = 0; i < tfVBO.length; i++ ) + glDeleteBuffers(tfVBO[i]); + } + + for ( int i = 0; i < tfVBO.length; i++ ) { + tfVBO[i] = glGenBuffers(); + glBindBuffer(GL_TRANSFORM_FEEDBACK_BUFFER, tfVBO[i]); + glBufferData(GL_TRANSFORM_FEEDBACK_BUFFER, transform, GL_STATIC_DRAW); + } + + glBindBuffer(GL_ARRAY_BUFFER, tfVBO[0]); + glVertexPointer(2, GL_FLOAT, (4 * 4), 0); + } + + public void render(final boolean render, final boolean animate, final int delta) { + if ( animate ) { + glDisableVertexAttribArray(depthLoc); + + final int vbo = currVBO; + currVBO = 1 - currVBO; + + glUseProgram(progIDTF); + glUniform1f(deltaLoc, delta); + + glBindBuffer(GL_ARRAY_BUFFER, tfVBO[vbo]); + glVertexPointer(4, GL_FLOAT, 0, 0); + + glEnable(GL_RASTERIZER_DISCARD); + if ( GLContext.getCapabilities().OpenGL30 ) { + glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 0, tfVBO[1 - vbo]); + + glBeginTransformFeedback(GL_POINTS); + glDrawArrays(GL_POINTS, 0, ballCount * 2); + glEndTransformFeedback(); + } else { + glBindBufferBaseEXT(GL_TRANSFORM_FEEDBACK_BUFFER_EXT, 0, tfVBO[1 - vbo]); + + glBeginTransformFeedbackEXT(GL_POINTS); + glDrawArrays(GL_POINTS, 0, ballCount * 2); + glEndTransformFeedbackEXT(); + } + glDisable(GL_RASTERIZER_DISCARD); + + glUseProgram(progID); + glVertexPointer(2, GL_FLOAT, (4 * 4), 0); + + glEnableVertexAttribArray(depthLoc); + } + + if ( render ) { + // Render front-to-back opaque pass + glAlphaFunc(GL_EQUAL, 1.0f); + glDisable(GL_BLEND); + glDrawArrays(GL_POINTS, 0, ballCount); + glEnable(GL_BLEND); + + // Render back-to-front transparent pass + glAlphaFunc(GL_GREATER, 0.0f); // Fragments with alpha == 1.0 are early-depth-rejected. + glDepthMask(false); + glDrawArrays(GL_POINTS, ballCount, ballCount); + glDepthMask(true); + } + } + + } + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opengl/sprites/SpriteShootoutCL.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opengl/sprites/SpriteShootoutCL.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opengl/sprites/SpriteShootoutCL.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opengl/sprites/SpriteShootoutCL.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,598 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.test.opengl.sprites; + +import org.lwjgl.BufferUtils; +import org.lwjgl.LWJGLException; +import org.lwjgl.PointerBuffer; +import org.lwjgl.Sys; +import org.lwjgl.input.Keyboard; +import org.lwjgl.input.Mouse; +import org.lwjgl.opencl.*; +import org.lwjgl.opencl.api.Filter; +import org.lwjgl.opengl.ContextCapabilities; +import org.lwjgl.opengl.Display; +import org.lwjgl.opengl.DisplayMode; +import org.lwjgl.opengl.GLContext; + +import java.awt.image.BufferedImage; +import java.awt.image.Raster; +import java.io.IOException; +import java.nio.ByteBuffer; +import java.nio.FloatBuffer; +import java.nio.IntBuffer; +import java.util.List; +import java.util.Random; +import javax.imageio.ImageIO; + +import static org.lwjgl.opencl.CL10.*; +import static org.lwjgl.opencl.CL10GL.*; +import static org.lwjgl.opengl.GL11.*; +import static org.lwjgl.opengl.GL12.*; +import static org.lwjgl.opengl.GL15.*; +import static org.lwjgl.opengl.GL20.*; + +/** + * Sprite rendering demo. In this version OpenCL is used for the animation + * computations. CL_KHR_gl_sharing is required for sharing the animation + * data with OpenGL for rendering. + * + * @author Spasi + * @since 18/3/2011 + */ +public final class SpriteShootoutCL { + + private static final int SCREEN_WIDTH = 800; + private static final int SCREEN_HEIGHT = 600; + + private static final int ANIMATION_TICKS = 60; + + private boolean run = true; + private boolean render = true; + private boolean colorMask = true; + private boolean animate = true; + private boolean smooth; + private boolean vsync; + + private int ballSize = 42; + private int ballCount = 100 * 1000; + + private SpriteRenderer renderer; + + // OpenGL stuff + private int texID; + private int texBigID; + private int texSmallID; + + // OpenCL stuff + + private IntBuffer errorCode = BufferUtils.createIntBuffer(1); + + private CLDevice clDevice; + private CLContext clContext; + private CLCommandQueue queue; + private CLProgram program; + private CLKernel kernel; + private CLMem clTransform; + + private PointerBuffer kernelGlobalWorkSize; + + private SpriteShootoutCL() { + } + + public static void main(String[] args) { + try { + new SpriteShootoutCL().start(); + } catch (LWJGLException e) { + e.printStackTrace(); + } + } + + private void start() throws LWJGLException { + try { + initGL(); + initCL(); + + renderer = new SpriteRendererDefault(); + + updateBalls(ballCount); + run(); + } catch (Throwable t) { + t.printStackTrace(); + } finally { + destroy(); + } + } + + private void initCL() throws LWJGLException { + CL.create(); + + final List platforms = CLPlatform.getPlatforms(); + if ( platforms == null ) + throw new RuntimeException("No OpenCL platforms found."); + + final Filter glSharingFilter = new Filter() { + public boolean accept(final CLDevice device) { + final CLDeviceCapabilities caps = CLCapabilities.getDeviceCapabilities(device); + return caps.CL_KHR_gl_sharing; + } + }; + + CLPlatform platform = null; + List devices = null; + for ( CLPlatform p : platforms ) { + // Find devices with GL sharing support + devices = p.getDevices(CL_DEVICE_TYPE_GPU, glSharingFilter); + if ( devices != null ) { + platform = p; + break; + } + } + + if ( devices == null ) + throw new RuntimeException("No OpenCL GPU device found."); + + clDevice = devices.get(0); + // Make sure we use only 1 device + devices.clear(); + devices.add(clDevice); + + clContext = CLContext.create(platform, devices, new CLContextCallback() { + protected void handleMessage(final String errinfo, final ByteBuffer private_info) { + System.out.println("[CONTEXT MESSAGE] " + errinfo); + } + }, Display.getDrawable(), errorCode); + checkCLError(errorCode); + + queue = clCreateCommandQueue(clContext, clDevice, 0, errorCode); + checkCLError(errorCode); + } + + private void initGL() throws LWJGLException { + Display.setLocation((Display.getDisplayMode().getWidth() - SCREEN_WIDTH) / 2, + (Display.getDisplayMode().getHeight() - SCREEN_HEIGHT) / 2); + Display.setDisplayMode(new DisplayMode(SCREEN_WIDTH, SCREEN_HEIGHT)); + Display.setTitle("Sprite Shootout - CL"); + Display.create(); + + final ContextCapabilities caps = GLContext.getCapabilities(); + if ( !caps.OpenGL20 ) + throw new RuntimeException("OpenGL 2.0 is required for this demo."); + + // Setup viewport + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glOrtho(0, SCREEN_WIDTH, 0, SCREEN_HEIGHT, -1.0, 1.0); + + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + glViewport(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); + + glClearColor(1.0f, 1.0f, 1.0f, 0.0f); + + // Create textures + + try { + texSmallID = createTexture("res/ball_sm.png"); + texBigID = createTexture("res/ball.png"); + } catch (IOException e) { + e.printStackTrace(); + System.exit(-1); + } + texID = texBigID; + + // Setup rendering state + + glEnable(GL_BLEND); + glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); + + glEnable(GL_ALPHA_TEST); + glAlphaFunc(GL_GREATER, 0.0f); + + glColorMask(colorMask, colorMask, colorMask, false); + glDepthMask(false); + glDisable(GL_DEPTH_TEST); + + if ( caps.GL_ARB_compatibility || !caps.OpenGL31 ) + glEnable(GL_POINT_SPRITE); + + // Setup geometry + + org.lwjgl.opengl.Util.checkGLError(); + } + + private static int createTexture(final String path) throws IOException { + final BufferedImage img = ImageIO.read(SpriteShootoutCL.class.getClassLoader().getResource(path)); + + final int w = img.getWidth(); + final int h = img.getHeight(); + + final ByteBuffer buffer = readImage(img); + + final int texID = glGenTextures(); + + glBindTexture(GL_TEXTURE_2D, texID); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_BGRA, GL_UNSIGNED_BYTE, buffer); + + return texID; + } + + private static ByteBuffer readImage(final BufferedImage img) throws IOException { + final Raster raster = img.getRaster(); + + final int bands = raster.getNumBands(); + + final int w = img.getWidth(); + final int h = img.getHeight(); + + final int size = w * h * bands; + + final byte[] pixels = new byte[size]; + raster.getDataElements(0, 0, w, h, pixels); + + final ByteBuffer pbuffer = BufferUtils.createByteBuffer(size); + + if ( bands == 4 ) { + for ( int i = 0; i < (w * h * 4); i += 4 ) { + // Pre-multiply alpha + final float a = unpackUByte01(pixels[i + 3]); + pbuffer.put(packUByte01(unpackUByte01(pixels[i + 2]) * a)); + pbuffer.put(packUByte01(unpackUByte01(pixels[i + 1]) * a)); + pbuffer.put(packUByte01(unpackUByte01(pixels[i + 0]) * a)); + pbuffer.put(pixels[i + 3]); + } + } else if ( bands == 3 ) { + for ( int i = 0; i < (w * h * 3); i += 3 ) { + pbuffer.put(pixels[i + 2]); + pbuffer.put(pixels[i + 1]); + pbuffer.put(pixels[i + 0]); + } + } else + pbuffer.put(pixels, 0, size); + + pbuffer.flip(); + + return pbuffer; + } + + private static float unpackUByte01(final byte x) { + return (x & 0xFF) / 255.0f; + } + + private static byte packUByte01(final float x) { + return (byte)(x * 255.0f); + } + + private void updateBalls(final int count) { + System.out.println("NUMBER OF BALLS: " + count); + renderer.updateBalls(ballCount); + } + + private void run() { + long startTime = System.currentTimeMillis() + 5000; + long fps = 0; + + long time = Sys.getTime(); + final int ticksPerUpdate = (int)(Sys.getTimerResolution() / ANIMATION_TICKS); + + renderer.render(false, true, 0); + + while ( run ) { + Display.processMessages(); + handleInput(); + + glClear(GL_COLOR_BUFFER_BIT); + + final long currTime = Sys.getTime(); + final int delta = (int)(currTime - time); + if ( smooth || delta >= ticksPerUpdate ) { + renderer.render(render, animate, delta); + time = currTime; + } else + renderer.render(render, false, 0); + + Display.update(false); + + if ( startTime > System.currentTimeMillis() ) { + fps++; + } else { + long timeUsed = 5000 + (startTime - System.currentTimeMillis()); + startTime = System.currentTimeMillis() + 5000; + System.out.println("FPS: " + (Math.round(fps / (timeUsed / 1000.0) * 10) / 10.0) + ", Balls: " + ballCount); + fps = 0; + } + } + } + + private void handleInput() { + if ( Display.isCloseRequested() ) + run = false; + + while ( Keyboard.next() ) { + if ( Keyboard.getEventKeyState() ) + continue; + + switch ( Keyboard.getEventKey() ) { + case Keyboard.KEY_1: + case Keyboard.KEY_2: + case Keyboard.KEY_3: + case Keyboard.KEY_4: + case Keyboard.KEY_5: + case Keyboard.KEY_6: + case Keyboard.KEY_7: + case Keyboard.KEY_8: + case Keyboard.KEY_9: + case Keyboard.KEY_0: + ballCount = 1 << (Keyboard.getEventKey() - Keyboard.KEY_1); + updateBalls(ballCount); + break; + case Keyboard.KEY_ADD: + case Keyboard.KEY_SUBTRACT: + int mult; + if ( Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) ) + mult = 1000; + else if ( Keyboard.isKeyDown(Keyboard.KEY_LMENU) || Keyboard.isKeyDown(Keyboard.KEY_RMENU) ) + mult = 100; + else if ( Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) || Keyboard.isKeyDown(Keyboard.KEY_RCONTROL) ) + mult = 10; + else + mult = 1; + if ( Keyboard.getEventKey() == Keyboard.KEY_SUBTRACT ) + mult = -mult; + ballCount += mult * 100; + if ( ballCount <= 0 ) + ballCount = 1; + updateBalls(ballCount); + break; + case Keyboard.KEY_ESCAPE: + run = false; + break; + case Keyboard.KEY_A: + animate = !animate; + System.out.println("Animation is now " + (animate ? "on" : "off") + "."); + break; + case Keyboard.KEY_C: + colorMask = !colorMask; + glColorMask(colorMask, colorMask, colorMask, false); + System.out.println("Color mask is now " + (colorMask ? "on" : "off") + "."); + // Disable alpha test when color mask is off, else we get no benefit. + if ( colorMask ) { + glEnable(GL_BLEND); + glEnable(GL_ALPHA_TEST); + } else { + glDisable(GL_BLEND); + glDisable(GL_ALPHA_TEST); + } + break; + case Keyboard.KEY_R: + render = !render; + System.out.println("Rendering is now " + (render ? "on" : "off") + "."); + break; + case Keyboard.KEY_S: + smooth = !smooth; + System.out.println("Smooth animation is now " + (smooth ? "on" : "off") + "."); + break; + case Keyboard.KEY_T: + if ( texID == texBigID ) { + texID = texSmallID; + ballSize = 16; + } else { + texID = texBigID; + ballSize = 42; + } + renderer.updateBallSize(); + glBindTexture(GL_TEXTURE_2D, texID); + System.out.println("Now using the " + (texID == texBigID ? "big" : "small") + " texture."); + break; + case Keyboard.KEY_V: + vsync = !vsync; + Display.setVSyncEnabled(vsync); + System.out.println("VSYNC is now " + (vsync ? "enabled" : "disabled") + "."); + break; + } + } + + while ( Mouse.next() ) ; + } + + private static void checkCLError(IntBuffer buffer) { + org.lwjgl.opencl.Util.checkCLError(buffer.get(0)); + } + + private void destroy() { + if ( clContext != null ) + clReleaseContext(clContext); + Display.destroy(); + System.exit(0); + } + + private abstract class SpriteRenderer { + + protected int progID; + protected int animVBO; + + protected void createKernel(final String source) { + program = clCreateProgramWithSource(clContext, source, errorCode); + checkCLError(errorCode); + final int build = clBuildProgram(program, clDevice, "", null); + if ( build != CL_SUCCESS ) { + System.out.println("BUILD LOG: " + program.getBuildInfoString(clDevice, CL_PROGRAM_BUILD_LOG)); + throw new RuntimeException("Failed to build CL program, status: " + build); + } + + kernel = clCreateKernel(program, "animate", errorCode); + checkCLError(errorCode); + + kernelGlobalWorkSize = BufferUtils.createPointerBuffer(1); + kernelGlobalWorkSize.put(0, ballCount); + + kernel.setArg(0, SCREEN_WIDTH); + kernel.setArg(1, SCREEN_HEIGHT); + } + + protected void createProgram(final int vshID) { + final int fshID = glCreateShader(GL_FRAGMENT_SHADER); + glShaderSource(fshID, "#version 110\n" + + "uniform sampler2D COLOR_MAP;" + + "void main(void) {\n" + + " gl_FragColor = texture2D(COLOR_MAP, gl_PointCoord);\n" + + "}"); + glCompileShader(fshID); + if ( glGetShaderi(fshID, GL_COMPILE_STATUS) == GL_FALSE ) { + System.out.println(glGetShaderInfoLog(fshID, glGetShaderi(fshID, GL_INFO_LOG_LENGTH))); + throw new RuntimeException("Failed to compile fragment shader."); + } + + progID = glCreateProgram(); + glAttachShader(progID, vshID); + glAttachShader(progID, fshID); + glLinkProgram(progID); + if ( glGetProgrami(progID, GL_LINK_STATUS) == GL_FALSE ) { + System.out.println(glGetProgramInfoLog(progID, glGetProgrami(progID, GL_INFO_LOG_LENGTH))); + throw new RuntimeException("Failed to link shader program."); + } + + glUseProgram(progID); + glUniform1i(glGetUniformLocation(progID, "COLOR_MAP"), 0); + + glEnableClientState(GL_VERTEX_ARRAY); + } + + public void updateBallSize() { + glPointSize(ballSize); + kernel.setArg(2, ballSize * 0.5f); + } + + public void updateBalls(final int count) { + kernelGlobalWorkSize.put(0, ballCount); + + final FloatBuffer transform = BufferUtils.createFloatBuffer(count * 4); + + final Random random = new Random(); + for ( int i = 0; i < count; i++ ) { + transform.put((int)(random.nextFloat() * (SCREEN_WIDTH - ballSize)) + ballSize * 0.5f); + transform.put((int)(random.nextFloat() * (SCREEN_HEIGHT - ballSize)) + ballSize * 0.5f); + transform.put(random.nextFloat() * 0.4f - 0.2f); + transform.put(random.nextFloat() * 0.4f - 0.2f); + } + transform.flip(); + + if ( animVBO != 0 ) { + clReleaseMemObject(clTransform); + glDeleteBuffers(animVBO); + } + + animVBO = glGenBuffers(); + + glBindBuffer(GL_ARRAY_BUFFER, animVBO); + glBufferData(GL_ARRAY_BUFFER, transform, GL_STATIC_DRAW); + glVertexPointer(2, GL_FLOAT, (4 * 4), 0); + + clTransform = clCreateFromGLBuffer(clContext, CL_MEM_READ_WRITE, animVBO, errorCode); + checkCLError(errorCode); + kernel.setArg(4, clTransform); + } + + protected abstract void render(boolean render, boolean animate, int delta); + + } + + private class SpriteRendererDefault extends SpriteRenderer { + + SpriteRendererDefault() { + System.out.println("Shootout Implementation: OpenCL GPU animation"); + + final int vshID = glCreateShader(GL_VERTEX_SHADER); + glShaderSource(vshID, "#version 150\n" + + "void main(void) {\n" + + " gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n" + + "}"); + glCompileShader(vshID); + if ( glGetShaderi(vshID, GL_COMPILE_STATUS) == GL_FALSE ) { + System.out.println(glGetShaderInfoLog(vshID, glGetShaderi(vshID, GL_INFO_LOG_LENGTH))); + throw new RuntimeException("Failed to compile vertex shader."); + } + + createProgram(vshID); + + org.lwjgl.opengl.Util.checkGLError(); + + createKernel("kernel void animate(\n" + + " const int WIDTH,\n" + + " const int HEIGHT,\n" + + " const float radius,\n" + + " const int delta,\n" + + " global float4 *balls\n" + + ") {\n" + + " unsigned int b = get_global_id(0);\n" + + "\n" + + " float4 anim = balls[b];\n" + + " anim.xy = anim.xy + anim.zw * delta;\n" + + " float2 animC = clamp(anim.xy, (float2)radius, (float2)(WIDTH - radius, HEIGHT - radius));\n" + + " if ( anim.x != animC.x ) anim.z = -anim.z;\n" + + " if ( anim.y != animC.y ) anim.w = -anim.w;\n" + + "\n" + + " balls[b] = (float4)(animC, anim.zw);\n" + + "}"); + + updateBallSize(); + } + + public void updateBalls(final int count) { + super.updateBalls(count); + } + + public void render(final boolean render, final boolean animate, final int delta) { + if ( animate ) { + //glFinish(); + + kernel.setArg(3, delta); + + clEnqueueAcquireGLObjects(queue, clTransform, null, null); + clEnqueueNDRangeKernel(queue, kernel, 1, null, kernelGlobalWorkSize, null, null, null); + clEnqueueReleaseGLObjects(queue, clTransform, null, null); + + clFinish(queue); + } + + if ( render ) + glDrawArrays(GL_POINTS, 0, ballCount); + } + + } + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opengl/sprites/SpriteShootout.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opengl/sprites/SpriteShootout.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opengl/sprites/SpriteShootout.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opengl/sprites/SpriteShootout.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,749 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.test.opengl.sprites; + +import org.lwjgl.BufferUtils; +import org.lwjgl.LWJGLException; +import org.lwjgl.Sys; +import org.lwjgl.input.Keyboard; +import org.lwjgl.input.Mouse; +import org.lwjgl.opengl.*; + +import java.awt.image.BufferedImage; +import java.awt.image.Raster; +import java.io.IOException; +import java.nio.ByteBuffer; +import java.nio.FloatBuffer; +import java.util.Random; +import javax.imageio.ImageIO; + +import static org.lwjgl.opengl.EXTTransformFeedback.*; +import static org.lwjgl.opengl.GL11.*; +import static org.lwjgl.opengl.GL12.*; +import static org.lwjgl.opengl.GL15.*; +import static org.lwjgl.opengl.GL20.*; +import static org.lwjgl.opengl.GL30.*; + +/** + * Sprite rendering demo. Three implementations are supported: + * a) CPU animation + BufferData VBO update. + * b) CPU animation + MapBufferRange VBO update. + * c) GPU animation using transform feedback with a vertex shader. + * + * @author Spasi + * @since 18/3/2011 + */ +public final class SpriteShootout { + + static final int SCREEN_WIDTH = 800; + static final int SCREEN_HEIGHT = 600; + + private static final int ANIMATION_TICKS = 60; + + private boolean run = true; + private boolean render = true; + private boolean colorMask = true; + private boolean animate = true; + private boolean smooth; + private boolean vsync; + + int ballSize = 42; + int ballCount = 100 * 1000; + + private SpriteRenderer renderer; + + // OpenGL stuff + private int texID; + private int texBigID; + private int texSmallID; + + long animateTime; + + private SpriteShootout() { + } + + public static void main(String[] args) { + try { + new SpriteShootout().start(); + } catch (LWJGLException e) { + e.printStackTrace(); + } + } + + private void start() throws LWJGLException { + try { + initGL(); + + final ContextCapabilities caps = GLContext.getCapabilities(); + if ( caps.OpenGL30 || caps.GL_EXT_transform_feedback ) + renderer = new SpriteRendererTF(); + else if ( caps.GL_ARB_map_buffer_range ) + renderer = new SpriteRendererMapped(); + else + renderer = new SpriteRendererPlain(); + + updateBalls(ballCount); + run(); + } catch (Throwable t) { + t.printStackTrace(); + } finally { + destroy(); + } + } + + private void initGL() throws LWJGLException { + Display.setLocation((Display.getDisplayMode().getWidth() - SCREEN_WIDTH) / 2, + (Display.getDisplayMode().getHeight() - SCREEN_HEIGHT) / 2); + Display.setDisplayMode(new DisplayMode(SCREEN_WIDTH, SCREEN_HEIGHT)); + Display.setTitle("Sprite Shootout"); + Display.create(); + //Display.create(new PixelFormat(), new ContextAttribs(4, 1).withProfileCompatibility(true).withDebug(true)); + //AMDDebugOutput.glDebugMessageCallbackAMD(new AMDDebugOutputCallback()); + + final ContextCapabilities caps = GLContext.getCapabilities(); + if ( !GLContext.getCapabilities().OpenGL20 ) + throw new RuntimeException("OpenGL 2.0 is required for this demo."); + + // Setup viewport + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glOrtho(0, SCREEN_WIDTH, 0, SCREEN_HEIGHT, -1.0, 1.0); + + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + glViewport(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); + + glClearColor(1.0f, 1.0f, 1.0f, 0.0f); + + // Create textures + + try { + texSmallID = createTexture("res/ball_sm.png"); + texBigID = createTexture("res/ball.png"); + } catch (IOException e) { + e.printStackTrace(); + System.exit(-1); + } + texID = texBigID; + + // Setup rendering state + + glEnable(GL_BLEND); + glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); + + glEnable(GL_ALPHA_TEST); + glAlphaFunc(GL_GREATER, 0.0f); + + glColorMask(colorMask, colorMask, colorMask, false); + glDepthMask(false); + glDisable(GL_DEPTH_TEST); + + if ( caps.GL_ARB_compatibility || !caps.OpenGL31 ) + glEnable(GL_POINT_SPRITE); + + // Setup geometry + + glEnableClientState(GL_VERTEX_ARRAY); + + Util.checkGLError(); + } + + private static int createTexture(final String path) throws IOException { + final BufferedImage img = ImageIO.read(SpriteShootout.class.getClassLoader().getResource(path)); + + final int w = img.getWidth(); + final int h = img.getHeight(); + + final ByteBuffer buffer = readImage(img); + + final int texID = glGenTextures(); + + glBindTexture(GL_TEXTURE_2D, texID); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_BGRA, GL_UNSIGNED_BYTE, buffer); + + return texID; + } + + private static ByteBuffer readImage(final BufferedImage img) throws IOException { + final Raster raster = img.getRaster(); + + final int bands = raster.getNumBands(); + + final int w = img.getWidth(); + final int h = img.getHeight(); + + final int size = w * h * bands; + + final byte[] pixels = new byte[size]; + raster.getDataElements(0, 0, w, h, pixels); + + final ByteBuffer pbuffer = BufferUtils.createByteBuffer(size); + + if ( bands == 4 ) { + for ( int i = 0; i < (w * h * 4); i += 4 ) { + // Pre-multiply alpha + final float a = unpackUByte01(pixels[i + 3]); + pbuffer.put(packUByte01(unpackUByte01(pixels[i + 2]) * a)); + pbuffer.put(packUByte01(unpackUByte01(pixels[i + 1]) * a)); + pbuffer.put(packUByte01(unpackUByte01(pixels[i + 0]) * a)); + pbuffer.put(pixels[i + 3]); + } + } else if ( bands == 3 ) { + for ( int i = 0; i < (w * h * 3); i += 3 ) { + pbuffer.put(pixels[i + 2]); + pbuffer.put(pixels[i + 1]); + pbuffer.put(pixels[i + 0]); + } + } else + pbuffer.put(pixels, 0, size); + + pbuffer.flip(); + + return pbuffer; + } + + private static float unpackUByte01(final byte x) { + return (x & 0xFF) / 255.0f; + } + + private static byte packUByte01(final float x) { + return (byte)(x * 255.0f); + } + + private void updateBalls(final int count) { + System.out.println("NUMBER OF BALLS: " + count); + renderer.updateBalls(ballCount); + } + + private void run() { + long startTime = System.currentTimeMillis() + 5000; + long fps = 0; + + long time = Sys.getTime(); + final int ticksPerUpdate = (int)(Sys.getTimerResolution() / ANIMATION_TICKS); + + renderer.render(false, true, 0); + + while ( run ) { + Display.processMessages(); + handleInput(); + + glClear(GL_COLOR_BUFFER_BIT); + + final long currTime = Sys.getTime(); + final int delta = (int)(currTime - time); + if ( smooth || delta >= ticksPerUpdate ) { + renderer.render(render, animate, delta); + time = currTime; + } else + renderer.render(render, false, 0); + + Display.update(false); + //Display.sync(60); + + if ( startTime > System.currentTimeMillis() ) { + fps++; + } else { + long timeUsed = 5000 + (startTime - System.currentTimeMillis()); + startTime = System.currentTimeMillis() + 5000; + System.out.println("FPS: " + (Math.round(fps / (timeUsed / 1000.0) * 10) / 10.0) + ", Balls: " + ballCount); + System.out.println("\tAnimation: " + (animateTime / fps / 1000) + "us"); + animateTime = 0; + fps = 0; + } + } + } + + private void handleInput() { + if ( Display.isCloseRequested() ) + run = false; + + while ( Keyboard.next() ) { + if ( Keyboard.getEventKeyState() ) + continue; + + switch ( Keyboard.getEventKey() ) { + case Keyboard.KEY_1: + case Keyboard.KEY_2: + case Keyboard.KEY_3: + case Keyboard.KEY_4: + case Keyboard.KEY_5: + case Keyboard.KEY_6: + case Keyboard.KEY_7: + case Keyboard.KEY_8: + case Keyboard.KEY_9: + case Keyboard.KEY_0: + ballCount = 1 << (Keyboard.getEventKey() - Keyboard.KEY_1); + updateBalls(ballCount); + break; + case Keyboard.KEY_ADD: + case Keyboard.KEY_SUBTRACT: + int mult; + if ( Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) ) + mult = 1000; + else if ( Keyboard.isKeyDown(Keyboard.KEY_LMENU) || Keyboard.isKeyDown(Keyboard.KEY_RMENU) ) + mult = 100; + else if ( Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) || Keyboard.isKeyDown(Keyboard.KEY_RCONTROL) ) + mult = 10; + else + mult = 1; + if ( Keyboard.getEventKey() == Keyboard.KEY_SUBTRACT ) + mult = -mult; + ballCount += mult * 100; + if ( ballCount <= 0 ) + ballCount = 1; + updateBalls(ballCount); + break; + case Keyboard.KEY_ESCAPE: + run = false; + break; + case Keyboard.KEY_A: + animate = !animate; + System.out.println("Animation is now " + (animate ? "on" : "off") + "."); + break; + case Keyboard.KEY_C: + colorMask = !colorMask; + glColorMask(colorMask, colorMask, colorMask, false); + System.out.println("Color mask is now " + (colorMask ? "on" : "off") + "."); + // Disable alpha test when color mask is off, else we get no benefit. + if ( colorMask ) { + glEnable(GL_BLEND); + glEnable(GL_ALPHA_TEST); + } else { + glDisable(GL_BLEND); + glDisable(GL_ALPHA_TEST); + } + break; + case Keyboard.KEY_R: + render = !render; + System.out.println("Rendering is now " + (render ? "on" : "off") + "."); + break; + case Keyboard.KEY_S: + smooth = !smooth; + System.out.println("Smooth animation is now " + (smooth ? "on" : "off") + "."); + break; + case Keyboard.KEY_T: + if ( texID == texBigID ) { + texID = texSmallID; + ballSize = 16; + } else { + texID = texBigID; + ballSize = 42; + } + renderer.updateBallSize(); + glBindTexture(GL_TEXTURE_2D, texID); + System.out.println("Now using the " + (texID == texBigID ? "big" : "small") + " texture."); + break; + case Keyboard.KEY_V: + vsync = !vsync; + Display.setVSyncEnabled(vsync); + System.out.println("VSYNC is now " + (vsync ? "enabled" : "disabled") + "."); + break; + } + } + + while ( Mouse.next() ) ; + } + + private void destroy() { + Display.destroy(); + } + + private abstract class SpriteRenderer { + + protected float[] transform = { }; + + protected int vshID; + protected int progID; + + protected void createProgram() { + final int fshID = glCreateShader(GL_FRAGMENT_SHADER); + glShaderSource(fshID, "uniform sampler2D COLOR_MAP;\n" + + "void main(void) {\n" + + " gl_FragColor = texture2D(COLOR_MAP, gl_PointCoord);\n" + + "}"); + glCompileShader(fshID); + if ( glGetShaderi(fshID, GL_COMPILE_STATUS) == GL_FALSE ) { + System.out.println(glGetShaderInfoLog(fshID, glGetShaderi(fshID, GL_INFO_LOG_LENGTH))); + throw new RuntimeException("Failed to compile fragment shader."); + } + + progID = glCreateProgram(); + glAttachShader(progID, vshID); + glAttachShader(progID, fshID); + glLinkProgram(progID); + if ( glGetProgrami(progID, GL_LINK_STATUS) == GL_FALSE ) { + System.out.println(glGetProgramInfoLog(progID, glGetProgrami(progID, GL_INFO_LOG_LENGTH))); + throw new RuntimeException("Failed to link shader program."); + } + + glUseProgram(progID); + glUniform1i(glGetUniformLocation(progID, "COLOR_MAP"), 0); + + updateBallSize(); + } + + public void updateBallSize() { + glPointSize(ballSize); + } + + public void updateBalls(final int count) { + final Random random = new Random(); + + final float[] newTransform = new float[count * 4]; + System.arraycopy(transform, 0, newTransform, 0, Math.min(transform.length, newTransform.length)); + if ( newTransform.length > transform.length ) { + for ( int i = transform.length; i < newTransform.length; ) { + newTransform[i++] = (int)(random.nextFloat() * (SCREEN_WIDTH - ballSize) + ballSize * 0.5f); + newTransform[i++] = (int)(random.nextFloat() * (SCREEN_HEIGHT - ballSize) + ballSize * 0.5f); + newTransform[i++] = random.nextFloat() * 0.4f - 0.2f; + newTransform[i++] = random.nextFloat() * 0.4f - 0.2f; + } + } + transform = newTransform; + } + + protected void animate( + final float[] sprites, + final FloatBuffer spritesRender, + final int ballSize, final int ballIndex, final int batchSize, final int delta + ) { + final float ballRadius = ballSize * 0.5f; + final float boundW = SCREEN_WIDTH - ballRadius; + final float boundH = SCREEN_HEIGHT - ballRadius; + + for ( int b = ballIndex * 4, len = (ballIndex + batchSize) * 4; b < len; b += 4 ) { + float x = sprites[b + 0]; + float dx = sprites[b + 2]; + + x += dx * delta; + if ( x < ballRadius ) { + x = ballRadius; + sprites[b + 2] = -dx; + } else if ( x > boundW ) { + x = boundW; + sprites[b + 2] = -dx; + } + sprites[b + 0] = x; + + float y = sprites[b + 1]; + float dy = sprites[b + 3]; + + y += dy * delta; + if ( y < ballRadius ) { + y = ballRadius; + sprites[b + 3] = -dy; + } else if ( y > boundH ) { + y = boundH; + sprites[b + 3] = -dy; + } + sprites[b + 1] = y; + + spritesRender.put(x).put(y); + } + spritesRender.clear(); + } + + protected abstract void render(boolean render, boolean animate, int delta); + + } + + private abstract class SpriteRendererBatched extends SpriteRenderer { + + protected static final int BALLS_PER_BATCH = 10 * 1000; + + SpriteRendererBatched() { + vshID = glCreateShader(GL_VERTEX_SHADER); + glShaderSource(vshID, "void main(void) {\n" + + " gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n" + + "}"); + glCompileShader(vshID); + if ( glGetShaderi(vshID, GL_COMPILE_STATUS) == GL_FALSE ) { + System.out.println(glGetShaderInfoLog(vshID, glGetShaderi(vshID, GL_INFO_LOG_LENGTH))); + throw new RuntimeException("Failed to compile vertex shader."); + } + + createProgram(); + } + + } + + private class SpriteRendererPlain extends SpriteRendererBatched { + + private final FloatBuffer geom; + + protected int[] animVBO; + + SpriteRendererPlain() { + System.out.println("Shootout Implementation: CPU animation & BufferData"); + geom = BufferUtils.createFloatBuffer(BALLS_PER_BATCH * 4 * 2); + } + + public void updateBalls(final int count) { + super.updateBalls(count); + + final int batchCount = count / BALLS_PER_BATCH + (count % BALLS_PER_BATCH == 0 ? 0 : 1); + if ( animVBO != null && batchCount == animVBO.length ) + return; + + final int[] newAnimVBO = new int[batchCount]; + if ( animVBO != null ) { + System.arraycopy(animVBO, 0, newAnimVBO, 0, Math.min(animVBO.length, newAnimVBO.length)); + for ( int i = newAnimVBO.length; i < animVBO.length; i++ ) + glDeleteBuffers(animVBO[i]); + } + for ( int i = animVBO == null ? 0 : animVBO.length; i < newAnimVBO.length; i++ ) { + newAnimVBO[i] = glGenBuffers(); + glBindBuffer(GL_ARRAY_BUFFER, newAnimVBO[i]); + } + + animVBO = newAnimVBO; + } + + public void render(final boolean render, final boolean animate, final int delta) { + int batchSize = Math.min(ballCount, BALLS_PER_BATCH); + int ballIndex = 0; + int vboIndex = 0; + while ( ballIndex < ballCount ) { + glBindBuffer(GL_ARRAY_BUFFER, animVBO[vboIndex++]); + + if ( animate ) + animate(ballIndex, batchSize, delta); + + if ( render ) { + glVertexPointer(2, GL_FLOAT, 0, 0); + glDrawArrays(GL_POINTS, 0, batchSize); + } + + ballIndex += batchSize; + batchSize = Math.min(ballCount - ballIndex, BALLS_PER_BATCH); + } + } + + private void animate(final int ballIndex, final int batchSize, final int delta) { + animate(transform, geom, ballSize, ballIndex, batchSize, delta); + + // Orphan current buffer and allocate a new one + glBufferData(GL_ARRAY_BUFFER, geom.capacity() * 4, GL_STREAM_DRAW); + glBufferSubData(GL_ARRAY_BUFFER, 0, geom); + } + } + + private class SpriteRendererMapped extends SpriteRendererBatched { + + private StreamVBO animVBO; + + SpriteRendererMapped() { + System.out.println("Shootout Implementation: CPU animation & MapBufferRange"); + } + + public void updateBalls(final int count) { + super.updateBalls(count); + + if ( animVBO != null ) + animVBO.destroy(); + + animVBO = new StreamVBO(GL_ARRAY_BUFFER, ballCount * (2 * 4)); + } + + public void render(final boolean render, final boolean animate, final int delta) { + int batchSize = Math.min(ballCount, BALLS_PER_BATCH); + int ballIndex = 0; + while ( ballIndex < ballCount ) { + if ( animate ) { + final ByteBuffer buffer = animVBO.map(batchSize * (2 * 4)); + + long t0 = System.nanoTime(); + animate(transform, buffer.asFloatBuffer(), ballSize, ballIndex, batchSize, delta); + long t1 = System.nanoTime(); + + animateTime += t1 - t0; + + animVBO.unmap(); + } + + if ( render ) { + glVertexPointer(2, GL_FLOAT, 0, ballIndex * (2 * 4)); + glDrawArrays(GL_POINTS, 0, batchSize); + } + + ballIndex += batchSize; + batchSize = Math.min(ballCount - ballIndex, BALLS_PER_BATCH); + } + } + } + + private class SpriteRendererTF extends SpriteRenderer { + + private int progIDTF; + private int ballSizeLoc; + private int deltaLoc; + + private int[] tfVBO = new int[2]; + private int currVBO; + + SpriteRendererTF() { + System.out.println("Shootout Implementation: TF GPU animation"); + + // Transform-feedback program + + final int vshID = glCreateShader(GL_VERTEX_SHADER); + glShaderSource(vshID, "#version 130\n" + + "const float WIDTH = " + SCREEN_WIDTH + ";\n" + + "const float HEIGHT = " + SCREEN_HEIGHT + ";\n" + + "uniform float ballSize;\n" + // ballSize / 2 + "uniform float delta;\n" + + "void main(void) {\n" + + " vec4 anim = gl_Vertex;\n" + + " anim.xy = anim.xy + anim.zw * delta;\n" + + " vec2 animC = clamp(anim.xy, vec2(ballSize), vec2(WIDTH - ballSize, HEIGHT - ballSize));\n" + + " if ( anim.x != animC.x ) anim.z = -anim.z;\n" + + " if ( anim.y != animC.y ) anim.w = -anim.w;\n" + + " gl_Position = vec4(animC, anim.zw);\n" + + "}"); + glCompileShader(vshID); + if ( glGetShaderi(vshID, GL_COMPILE_STATUS) == GL_FALSE ) { + System.out.println(glGetShaderInfoLog(vshID, glGetShaderi(vshID, GL_INFO_LOG_LENGTH))); + throw new RuntimeException("Failed to compile vertex shader."); + } + + progIDTF = glCreateProgram(); + glAttachShader(progIDTF, vshID); + glTransformFeedbackVaryings(progIDTF, new CharSequence[] { "gl_Position" }, GL_SEPARATE_ATTRIBS); + glLinkProgram(progIDTF); + if ( glGetProgrami(progIDTF, GL_LINK_STATUS) == GL_FALSE ) { + System.out.println(glGetProgramInfoLog(progIDTF, glGetProgrami(progIDTF, GL_INFO_LOG_LENGTH))); + throw new RuntimeException("Failed to link shader program."); + } + + glUseProgram(progIDTF); + + ballSizeLoc = glGetUniformLocation(progIDTF, "ballSize"); + deltaLoc = glGetUniformLocation(progIDTF, "delta"); + + glUniform1f(ballSizeLoc, ballSize * 0.5f); + + // ----------------- + + this.vshID = glCreateShader(GL_VERTEX_SHADER); + glShaderSource(this.vshID, "void main(void) {\n" + + " gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n" + + "}"); + glCompileShader(this.vshID); + if ( glGetShaderi(this.vshID, GL_COMPILE_STATUS) == GL_FALSE ) { + System.out.println(glGetShaderInfoLog(this.vshID, glGetShaderi(this.vshID, GL_INFO_LOG_LENGTH))); + throw new RuntimeException("Failed to compile vertex shader."); + } + + createProgram(); + } + + public void updateBallSize() { + glUseProgram(progIDTF); + glUniform1f(ballSizeLoc, ballSize * 0.5f); + + glUseProgram(progID); + super.updateBallSize(); + } + + public void updateBalls(final int count) { + if ( tfVBO[0] != 0 ) { + // Fetch current animation state + final FloatBuffer state = BufferUtils.createFloatBuffer(transform.length); + glGetBufferSubData(GL_TRANSFORM_FEEDBACK_BUFFER, 0, state); + state.get(transform); + } + + super.updateBalls(count); + + if ( tfVBO[0] != 0 ) { + for ( int i = 0; i < tfVBO.length; i++ ) + glDeleteBuffers(tfVBO[i]); + } + + final FloatBuffer state = BufferUtils.createFloatBuffer(count * 4); + state.put(transform); + state.flip(); + + for ( int i = 0; i < tfVBO.length; i++ ) { + tfVBO[i] = glGenBuffers(); + glBindBuffer(GL_TRANSFORM_FEEDBACK_BUFFER, tfVBO[i]); + glBufferData(GL_TRANSFORM_FEEDBACK_BUFFER, state, GL_STATIC_DRAW); + } + + glBindBuffer(GL_ARRAY_BUFFER, tfVBO[0]); + glVertexPointer(2, GL_FLOAT, (4 * 4), 0); + } + + public void render(final boolean render, final boolean animate, final int delta) { + if ( animate ) { + glUseProgram(progIDTF); + glUniform1f(deltaLoc, delta); + + final int vbo = currVBO; + currVBO = 1 - currVBO; + + glBindBuffer(GL_ARRAY_BUFFER, tfVBO[vbo]); + glVertexPointer(4, GL_FLOAT, 0, 0); + + glEnable(GL_RASTERIZER_DISCARD); + if ( GLContext.getCapabilities().OpenGL30 ) { + glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 0, tfVBO[1 - vbo]); + + glBeginTransformFeedback(GL_POINTS); + glDrawArrays(GL_POINTS, 0, ballCount); + glEndTransformFeedback(); + } else { + glBindBufferBaseEXT(GL_TRANSFORM_FEEDBACK_BUFFER_EXT, 0, tfVBO[1 - vbo]); + + glBeginTransformFeedbackEXT(GL_POINTS); + glDrawArrays(GL_POINTS, 0, ballCount); + glEndTransformFeedbackEXT(); + } + glDisable(GL_RASTERIZER_DISCARD); + + glUseProgram(progID); + glVertexPointer(2, GL_FLOAT, (4 * 4), 0); + } + + if ( render ) + glDrawArrays(GL_POINTS, 0, ballCount); + } + + } + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opengl/sprites/SpriteShootoutMapped.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opengl/sprites/SpriteShootoutMapped.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opengl/sprites/SpriteShootoutMapped.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opengl/sprites/SpriteShootoutMapped.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,838 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.test.opengl.sprites; + +import org.lwjgl.BufferUtils; +import org.lwjgl.LWJGLException; +import org.lwjgl.Sys; +import org.lwjgl.input.Keyboard; +import org.lwjgl.input.Mouse; +import org.lwjgl.opengl.*; +import org.lwjgl.util.mapped.MappedObject; +import org.lwjgl.util.mapped.MappedObjectClassLoader; +import org.lwjgl.util.mapped.MappedObjectTransformer; +import org.lwjgl.util.mapped.MappedType; + +import java.awt.image.BufferedImage; +import java.awt.image.Raster; +import java.io.IOException; +import java.nio.ByteBuffer; +import java.util.Random; +import javax.imageio.ImageIO; + +import static org.lwjgl.opengl.EXTTransformFeedback.*; +import static org.lwjgl.opengl.GL11.*; +import static org.lwjgl.opengl.GL12.*; +import static org.lwjgl.opengl.GL15.*; +import static org.lwjgl.opengl.GL20.*; +import static org.lwjgl.opengl.GL30.*; + +/** + * Sprite rendering demo. Three implementations are supported: + * a) CPU animation + BufferData VBO update. + * b) CPU animation + MapBufferRange VBO update. + * c) GPU animation using transform feedback with a vertex shader. + * + * @author Spasi + * @since 18/3/2011 + */ +public final class SpriteShootoutMapped { + + static final int SCREEN_WIDTH = 800; + static final int SCREEN_HEIGHT = 600; + + private static final int ANIMATION_TICKS = 60; + + private boolean run = true; + private boolean render = true; + private boolean colorMask = true; + private boolean animate = true; + private boolean smooth; + private boolean vsync; + + int ballSize = 42; + int ballCount = 100 * 1000; + + private SpriteRenderer renderer; + + // OpenGL stuff + private int texID; + private int texBigID; + private int texSmallID; + + long animateTime; + + private SpriteShootoutMapped() { + } + + public static void main(String[] args) { + MappedObjectTransformer.register(Pixel4b.class); + MappedObjectTransformer.register(Pixel3b.class); + MappedObjectTransformer.register(Sprite.class); + MappedObjectTransformer.register(SpriteRender.class); + + if ( MappedObjectClassLoader.fork(SpriteShootoutMapped.class, args) ) + return; + + try { + new SpriteShootoutMapped().start(); + } catch (LWJGLException e) { + e.printStackTrace(); + } + } + + private void start() throws LWJGLException { + try { + initGL(); + + final ContextCapabilities caps = GLContext.getCapabilities(); + if ( !true && (caps.OpenGL30 || caps.GL_EXT_transform_feedback) ) + renderer = new SpriteRendererTF(); + else if ( true && caps.GL_ARB_map_buffer_range ) + renderer = new SpriteRendererMapped(); + else + renderer = new SpriteRendererPlain(); + + updateBalls(ballCount); + run(); + } catch (Throwable t) { + t.printStackTrace(); + } finally { + destroy(); + } + } + + private void initGL() throws LWJGLException { + Display.setLocation((Display.getDisplayMode().getWidth() - SCREEN_WIDTH) / 2, + (Display.getDisplayMode().getHeight() - SCREEN_HEIGHT) / 2); + Display.setDisplayMode(new DisplayMode(SCREEN_WIDTH, SCREEN_HEIGHT)); + Display.setTitle("Sprite Shootout"); + Display.create(); + //Display.create(new PixelFormat(), new ContextAttribs(4, 1).withProfileCompatibility(true).withDebug(true)); + //AMDDebugOutput.glDebugMessageCallbackAMD(new AMDDebugOutputCallback()); + + if ( !GLContext.getCapabilities().OpenGL20 ) + throw new RuntimeException("OpenGL 2.0 is required for this demo."); + + // Setup viewport + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glOrtho(0, SCREEN_WIDTH, 0, SCREEN_HEIGHT, -1.0, 1.0); + + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + glViewport(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); + + glClearColor(1.0f, 1.0f, 1.0f, 0.0f); + + // Create textures + + try { + texSmallID = createTexture("res/ball_sm.png"); + texBigID = createTexture("res/ball.png"); + } catch (IOException e) { + e.printStackTrace(); + System.exit(-1); + } + texID = texBigID; + + // Setup rendering state + + glEnable(GL_BLEND); + glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); + + glEnable(GL_ALPHA_TEST); + glAlphaFunc(GL_GREATER, 0.0f); + + glColorMask(colorMask, colorMask, colorMask, false); + glDepthMask(false); + glDisable(GL_DEPTH_TEST); + + // Setup geometry + + glEnableClientState(GL_VERTEX_ARRAY); + + Util.checkGLError(); + } + + private static int createTexture(final String path) throws IOException { + final BufferedImage img = ImageIO.read(SpriteShootoutMapped.class.getClassLoader().getResource(path)); + + final int w = img.getWidth(); + final int h = img.getHeight(); + + final ByteBuffer buffer = readImage(img); + + final int texID = glGenTextures(); + + glBindTexture(GL_TEXTURE_2D, texID); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_BGRA, GL_UNSIGNED_BYTE, buffer); + + return texID; + } + + public static class Pixel4b extends MappedObject { + + public byte r, g, b, a; + + } + + @MappedType(align = 3) + public static class Pixel3b extends MappedObject { + + public byte r, g, b; + + } + + private static ByteBuffer readImage(final BufferedImage img) throws IOException { + final Raster raster = img.getRaster(); + + final int bands = raster.getNumBands(); + + final int w = img.getWidth(); + final int h = img.getHeight(); + + final int count = w * h; + + final byte[] pixels = new byte[count * bands]; + raster.getDataElements(0, 0, w, h, pixels); + + if ( bands == 4 ) { + Pixel4b p = Pixel4b.malloc(count); + + int b = 0; + for ( int i = 0; i < count; i++, b += 4 ) { + // Pre-multiply alpha + final float a = unpackUByte01(pixels[b + 3]); + + p.view = i; + p.r = packUByte01(unpackUByte01(pixels[b + 2]) * a); + p.g = packUByte01(unpackUByte01(pixels[b + 1]) * a); + p.b = packUByte01(unpackUByte01(pixels[b + 0]) * a); + p.a = pixels[b + 3]; + } + + return p.backingByteBuffer(); + } else if ( bands == 3 ) { + Pixel3b p = Pixel3b.malloc(count); + + int b = 0; + for ( int i = 0; i < count; i++, b += 3 ) { + p.view = i; + p.r = pixels[b + 2]; + p.g = pixels[b + 1]; + p.b = pixels[b + 0]; + } + + return p.backingByteBuffer(); + } else { + ByteBuffer p = BufferUtils.createByteBuffer(count * bands); + p.put(pixels, 0, p.capacity()); + p.flip(); + return p; + } + + } + + private static float unpackUByte01(final byte x) { + return (x & 0xFF) / 255.0f; + } + + private static byte packUByte01(final float x) { + return (byte)(x * 255.0f); + } + + private void updateBalls(final int count) { + System.out.println("NUMBER OF BALLS: " + count); + renderer.updateBalls(ballCount); + } + + private void run() { + long startTime = System.currentTimeMillis() + 5000; + long fps = 0; + + long time = Sys.getTime(); + final int ticksPerUpdate = (int)(Sys.getTimerResolution() / ANIMATION_TICKS); + + renderer.render(false, true, 0); + + while ( run ) { + Display.processMessages(); + handleInput(); + + glClear(GL_COLOR_BUFFER_BIT); + + final long currTime = Sys.getTime(); + final int delta = (int)(currTime - time); + if ( smooth || delta >= ticksPerUpdate ) { + renderer.render(render, animate, delta); + time = currTime; + } else + renderer.render(render, false, 0); + + Display.update(false); + //Display.sync(60); + + if ( startTime > System.currentTimeMillis() ) { + fps++; + } else { + long timeUsed = 5000 + (startTime - System.currentTimeMillis()); + startTime = System.currentTimeMillis() + 5000; + System.out.println("FPS: " + (Math.round(fps / (timeUsed / 1000.0) * 10) / 10.0) + ", Balls: " + ballCount); + System.out.println("Animation: " + animateTime / fps); + animateTime = 0; + fps = 0; + } + } + } + + private void handleInput() { + if ( Display.isCloseRequested() ) + run = false; + + while ( Keyboard.next() ) { + if ( Keyboard.getEventKeyState() ) + continue; + + switch ( Keyboard.getEventKey() ) { + case Keyboard.KEY_1: + case Keyboard.KEY_2: + case Keyboard.KEY_3: + case Keyboard.KEY_4: + case Keyboard.KEY_5: + case Keyboard.KEY_6: + case Keyboard.KEY_7: + case Keyboard.KEY_8: + case Keyboard.KEY_9: + case Keyboard.KEY_0: + ballCount = 1 << (Keyboard.getEventKey() - Keyboard.KEY_1); + updateBalls(ballCount); + break; + case Keyboard.KEY_ADD: + case Keyboard.KEY_SUBTRACT: + int mult; + if ( Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) ) + mult = 1000; + else if ( Keyboard.isKeyDown(Keyboard.KEY_LMENU) || Keyboard.isKeyDown(Keyboard.KEY_RMENU) ) + mult = 100; + else if ( Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) || Keyboard.isKeyDown(Keyboard.KEY_RCONTROL) ) + mult = 10; + else + mult = 1; + if ( Keyboard.getEventKey() == Keyboard.KEY_SUBTRACT ) + mult = -mult; + ballCount += mult * 100; + if ( ballCount <= 0 ) + ballCount = 1; + updateBalls(ballCount); + break; + case Keyboard.KEY_ESCAPE: + run = false; + break; + case Keyboard.KEY_A: + animate = !animate; + System.out.println("Animation is now " + (animate ? "on" : "off") + "."); + break; + case Keyboard.KEY_C: + colorMask = !colorMask; + glColorMask(colorMask, colorMask, colorMask, false); + System.out.println("Color mask is now " + (colorMask ? "on" : "off") + "."); + // Disable alpha test when color mask is off, else we get no benefit. + if ( colorMask ) { + glEnable(GL_BLEND); + glEnable(GL_ALPHA_TEST); + } else { + glDisable(GL_BLEND); + glDisable(GL_ALPHA_TEST); + } + break; + case Keyboard.KEY_R: + render = !render; + System.out.println("Rendering is now " + (render ? "on" : "off") + "."); + break; + case Keyboard.KEY_S: + smooth = !smooth; + System.out.println("Smooth animation is now " + (smooth ? "on" : "off") + "."); + break; + case Keyboard.KEY_T: + if ( texID == texBigID ) { + texID = texSmallID; + ballSize = 16; + } else { + texID = texBigID; + ballSize = 42; + } + renderer.updateBallSize(); + glBindTexture(GL_TEXTURE_2D, texID); + System.out.println("Now using the " + (texID == texBigID ? "big" : "small") + " texture."); + break; + case Keyboard.KEY_V: + vsync = !vsync; + Display.setVSyncEnabled(vsync); + System.out.println("VSYNC is now " + (vsync ? "enabled" : "disabled") + "."); + break; + } + } + + while ( Mouse.next() ) ; + } + + private void destroy() { + Display.destroy(); + } + + public static class Sprite extends MappedObject { + + public float dx, x; + public float dy, y; + + } + + public static class SpriteRender extends MappedObject { + + public float x, y; + + } + + private abstract class SpriteRenderer { + + protected Sprite sprites; + + protected int spriteCount; + + protected int vshID; + protected int progID; + + protected void createProgram() { + final int fshID = glCreateShader(GL_FRAGMENT_SHADER); + glShaderSource(fshID, "uniform sampler2D COLOR_MAP;\n" + + "void main(void) {\n" + + " gl_FragColor = texture2D(COLOR_MAP, gl_PointCoord);\n" + + "}"); + glCompileShader(fshID); + if ( glGetShaderi(fshID, GL_COMPILE_STATUS) == GL_FALSE ) { + System.out.println(glGetShaderInfoLog(fshID, glGetShaderi(fshID, GL_INFO_LOG_LENGTH))); + throw new RuntimeException("Failed to compile fragment shader."); + } + + progID = glCreateProgram(); + glAttachShader(progID, vshID); + glAttachShader(progID, fshID); + glLinkProgram(progID); + if ( glGetProgrami(progID, GL_LINK_STATUS) == GL_FALSE ) { + System.out.println(glGetProgramInfoLog(progID, glGetProgrami(progID, GL_INFO_LOG_LENGTH))); + throw new RuntimeException("Failed to link shader program."); + } + + glUseProgram(progID); + glUniform1i(glGetUniformLocation(progID, "COLOR_MAP"), 0); + + updateBallSize(); + + glEnableClientState(GL_VERTEX_ARRAY); + } + + public void updateBallSize() { + glPointSize(ballSize); + } + + public abstract void updateBalls(int count); + + protected abstract void render(boolean render, boolean animate, int delta); + + } + + private abstract class SpriteRendererBatched extends SpriteRenderer { + + protected static final int BALLS_PER_BATCH = 10 * 1000; + + SpriteRendererBatched() { + vshID = glCreateShader(GL_VERTEX_SHADER); + glShaderSource(vshID, "void main(void) {\n" + + " gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n" + + "}"); + glCompileShader(vshID); + if ( glGetShaderi(vshID, GL_COMPILE_STATUS) == GL_FALSE ) { + System.out.println(glGetShaderInfoLog(vshID, glGetShaderi(vshID, GL_INFO_LOG_LENGTH))); + throw new RuntimeException("Failed to compile vertex shader."); + } + + createProgram(); + } + + public void updateBalls(final int count) { + final Random random = new Random(); + + final Sprite newSprites = Sprite.malloc(count); + if ( sprites != null ) { + sprites.view = 0; + sprites.copyRange(newSprites, Math.min(count, spriteCount)); + } + + if ( count > spriteCount ) { + for ( int i = spriteCount; i < count; i++ ) { + newSprites.view = i; + + newSprites.x = (int)(random.nextFloat() * (SCREEN_WIDTH - ballSize) + ballSize * 0.5f); + newSprites.y = (int)(random.nextFloat() * (SCREEN_HEIGHT - ballSize) + ballSize * 0.5f); + newSprites.dx = random.nextFloat() * 0.4f - 0.2f; + newSprites.dy = random.nextFloat() * 0.4f - 0.2f; + } + } + + sprites = newSprites; + spriteCount = count; + } + + protected void animate( + final Sprite sprite, + final SpriteRender spriteRender, + final int ballSize, final int ballIndex, final int batchSize, final int delta + ) { + final float ballRadius = ballSize * 0.5f; + final float boundW = SCREEN_WIDTH - ballRadius; + final float boundH = SCREEN_HEIGHT - ballRadius; + + final Sprite[] sprites = sprite.asArray(); + final SpriteRender[] spritesRender = spriteRender.asArray(); + for ( int b = ballIndex, r = 0, len = (ballIndex + batchSize); b < len; b++, r++ ) { + float dx = sprites[b].dx; + float x = sprites[b].x; + + x += dx * delta; + if ( x < ballRadius ) { + x = ballRadius; + dx = -dx; + } else if ( x > boundW ) { + x = boundW; + dx = -dx; + } + + sprites[b].dx = dx; + sprites[b].x = x; + spritesRender[r].x = x; + + float dy = sprites[b].dy; + float y = sprites[b].y; + + y += dy * delta; + if ( y < ballRadius ) { + y = ballRadius; + dy = -dy; + } else if ( y > boundH ) { + y = boundH; + dy = -dy; + } + + sprites[b].dy = dy; + sprites[b].y = y; + spritesRender[r].y = y; + } + } + + } + + private class SpriteRendererPlain extends SpriteRendererBatched { + + private final int DATA_PER_BATCH = BALLS_PER_BATCH * 2 * 4; // balls * 2 floats * 4 bytes + + protected int[] animVBO; + + private SpriteRender spritesRender; + + SpriteRendererPlain() { + System.out.println("Shootout Implementation: CPU animation & BufferData"); + spritesRender = SpriteRender.malloc(BALLS_PER_BATCH); + } + + public void updateBalls(final int count) { + super.updateBalls(count); + + final int batchCount = count / BALLS_PER_BATCH + (count % BALLS_PER_BATCH == 0 ? 0 : 1); + if ( animVBO != null && batchCount == animVBO.length ) + return; + + final int[] newAnimVBO = new int[batchCount]; + if ( animVBO != null ) { + System.arraycopy(animVBO, 0, newAnimVBO, 0, Math.min(animVBO.length, newAnimVBO.length)); + for ( int i = newAnimVBO.length; i < animVBO.length; i++ ) + glDeleteBuffers(animVBO[i]); + } + for ( int i = animVBO == null ? 0 : animVBO.length; i < newAnimVBO.length; i++ ) { + newAnimVBO[i] = glGenBuffers(); + glBindBuffer(GL_ARRAY_BUFFER, newAnimVBO[i]); + } + + animVBO = newAnimVBO; + } + + public void render(final boolean render, final boolean animate, final int delta) { + int batchSize = Math.min(ballCount, BALLS_PER_BATCH); + int ballIndex = 0; + int batchIndex = 0; + while ( ballIndex < ballCount ) { + glBindBuffer(GL_ARRAY_BUFFER, animVBO[batchIndex]); + + if ( animate ) + animate(ballIndex, batchSize, delta); + + if ( render ) { + glVertexPointer(2, GL_FLOAT, 0, 0); + glDrawArrays(GL_POINTS, 0, batchSize); + } + + ballIndex += batchSize; + batchSize = Math.min(ballCount - ballIndex, BALLS_PER_BATCH); + batchIndex++; + } + } + + private void animate(final int ballIndex, final int batchSize, final int delta) { + animate( + sprites, spritesRender, + ballSize, ballIndex, batchSize, delta + ); + + glBufferData(GL_ARRAY_BUFFER, DATA_PER_BATCH, GL_STREAM_DRAW); + glBufferSubData(GL_ARRAY_BUFFER, 0, spritesRender.backingByteBuffer()); + } + + } + + private class SpriteRendererMapped extends SpriteRendererBatched { + + private StreamVBO animVBO; + + SpriteRendererMapped() { + System.out.println("Shootout Implementation: CPU animation & MapBufferRange"); + } + + public void updateBalls(final int count) { + super.updateBalls(count); + + if ( animVBO != null ) + animVBO.destroy(); + + animVBO = new StreamVBO(GL_ARRAY_BUFFER, ballCount * (2 * 4)); + } + + public void render(final boolean render, final boolean animate, final int delta) { + int batchSize = Math.min(ballCount, BALLS_PER_BATCH); + int ballIndex = 0; + while ( ballIndex < ballCount ) { + if ( animate ) { + final ByteBuffer buffer = animVBO.map(batchSize * (2 * 4)); + + long t0 = System.nanoTime(); + animate(sprites, SpriteRender.map(buffer), ballSize, ballIndex, batchSize, delta); + long t1 = System.nanoTime(); + + animateTime += t1 - t0; + + animVBO.unmap(); + } + + if ( render ) { + glVertexPointer(2, GL_FLOAT, 0, ballIndex * (2 * 4)); + glDrawArrays(GL_POINTS, 0, batchSize); + } + + ballIndex += batchSize; + batchSize = Math.min(ballCount - ballIndex, BALLS_PER_BATCH); + } + } + + } + + private class SpriteRendererTF extends SpriteRenderer { + + private int progIDTF; + private int ballSizeLoc; + private int deltaLoc; + + private int[] tfVBO = new int[2]; + private int currVBO; + + SpriteRendererTF() { + System.out.println("Shootout Implementation: TF GPU animation"); + + // Transform-feedback program + + final int vshID = glCreateShader(GL_VERTEX_SHADER); + glShaderSource(vshID, "#version 130\n" + + "const float WIDTH = " + SCREEN_WIDTH + ";\n" + + "const float HEIGHT = " + SCREEN_HEIGHT + ";\n" + + "uniform float ballSize;\n" + // ballSize / 2 + "uniform float delta;\n" + + "void main(void) {\n" + + " vec4 anim = gl_Vertex;\n" + + " anim.xy = anim.xy + anim.zw * delta;\n" + + " vec2 animC = clamp(anim.xy, vec2(ballSize), vec2(WIDTH - ballSize, HEIGHT - ballSize));\n" + + " if ( anim.x != animC.x ) anim.z = -anim.z;\n" + + " if ( anim.y != animC.y ) anim.w = -anim.w;\n" + + " gl_Position = vec4(animC, anim.zw);\n" + + "}"); + glCompileShader(vshID); + if ( glGetShaderi(vshID, GL_COMPILE_STATUS) == GL_FALSE ) { + System.out.println(glGetShaderInfoLog(vshID, glGetShaderi(vshID, GL_INFO_LOG_LENGTH))); + throw new RuntimeException("Failed to compile vertex shader."); + } + + progIDTF = glCreateProgram(); + glAttachShader(progIDTF, vshID); + glTransformFeedbackVaryings(progIDTF, new CharSequence[] { "gl_Position" }, GL_SEPARATE_ATTRIBS); + glLinkProgram(progIDTF); + if ( glGetProgrami(progIDTF, GL_LINK_STATUS) == GL_FALSE ) { + System.out.println(glGetProgramInfoLog(progIDTF, glGetProgrami(progIDTF, GL_INFO_LOG_LENGTH))); + throw new RuntimeException("Failed to link shader program."); + } + + glUseProgram(progIDTF); + + ballSizeLoc = glGetUniformLocation(progIDTF, "ballSize"); + deltaLoc = glGetUniformLocation(progIDTF, "delta"); + + glUniform1f(ballSizeLoc, ballSize * 0.5f); + + // ----------------- + + this.vshID = glCreateShader(GL_VERTEX_SHADER); + glShaderSource(this.vshID, "void main(void) {\n" + + " gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n" + + "}"); + glCompileShader(this.vshID); + if ( glGetShaderi(this.vshID, GL_COMPILE_STATUS) == GL_FALSE ) { + System.out.println(glGetShaderInfoLog(this.vshID, glGetShaderi(this.vshID, GL_INFO_LOG_LENGTH))); + throw new RuntimeException("Failed to compile vertex shader."); + } + + createProgram(); + } + + public void updateBallSize() { + glUseProgram(progIDTF); + glUniform1f(ballSizeLoc, ballSize * 0.5f); + + glUseProgram(progID); + super.updateBallSize(); + } + + private void doUpdateBalls(final int count) { + final Random random = new Random(); + + final Sprite newSprites = Sprite.malloc(count); + if ( sprites != null ) { + sprites.view = 0; + sprites.copyRange(newSprites, Math.min(count, spriteCount)); + } + + if ( count > spriteCount ) { + for ( int i = spriteCount; i < count; i++ ) { + newSprites.view = i; + + newSprites.x = (int)(random.nextFloat() * (SCREEN_WIDTH - ballSize) + ballSize * 0.5f); + newSprites.y = (int)(random.nextFloat() * (SCREEN_HEIGHT - ballSize) + ballSize * 0.5f); + newSprites.dx = random.nextFloat() * 0.4f - 0.2f; + newSprites.dy = random.nextFloat() * 0.4f - 0.2f; + } + } + + sprites = newSprites; + spriteCount = count; + } + + public void updateBalls(final int count) { + if ( tfVBO[0] != 0 ) { + // Fetch current animation state + glGetBufferSubData(GL_TRANSFORM_FEEDBACK_BUFFER, 0, sprites.backingByteBuffer()); + } + + doUpdateBalls(count); + + if ( tfVBO[0] != 0 ) { + for ( int i = 0; i < tfVBO.length; i++ ) + glDeleteBuffers(tfVBO[i]); + } + + for ( int i = 0; i < tfVBO.length; i++ ) { + tfVBO[i] = glGenBuffers(); + glBindBuffer(GL_TRANSFORM_FEEDBACK_BUFFER, tfVBO[i]); + glBufferData(GL_TRANSFORM_FEEDBACK_BUFFER, sprites.backingByteBuffer(), GL_STATIC_DRAW); + } + + glBindBuffer(GL_ARRAY_BUFFER, tfVBO[0]); + glVertexPointer(2, GL_FLOAT, (4 * 4), 0); + } + + public void render(final boolean render, final boolean animate, final int delta) { + if ( animate ) { + glUseProgram(progIDTF); + glUniform1f(deltaLoc, delta); + + final int vbo = currVBO; + currVBO = 1 - currVBO; + + glBindBuffer(GL_ARRAY_BUFFER, tfVBO[vbo]); + glVertexPointer(4, GL_FLOAT, 0, 0); + + glEnable(GL_RASTERIZER_DISCARD); + if ( GLContext.getCapabilities().OpenGL30 ) { + glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 0, tfVBO[1 - vbo]); + + glBeginTransformFeedback(GL_POINTS); + glDrawArrays(GL_POINTS, 0, ballCount); + glEndTransformFeedback(); + } else { + glBindBufferBaseEXT(GL_TRANSFORM_FEEDBACK_BUFFER_EXT, 0, tfVBO[1 - vbo]); + + glBeginTransformFeedbackEXT(GL_POINTS); + glDrawArrays(GL_POINTS, 0, ballCount); + glEndTransformFeedbackEXT(); + } + glDisable(GL_RASTERIZER_DISCARD); + + glUseProgram(progID); + glVertexPointer(2, GL_FLOAT, (4 * 4), 0); + } + + if ( render ) + glDrawArrays(GL_POINTS, 0, ballCount); + } + + } + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opengl/sprites/StreamVBO.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opengl/sprites/StreamVBO.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opengl/sprites/StreamVBO.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opengl/sprites/StreamVBO.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,144 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.test.opengl.sprites; + +import org.lwjgl.LWJGLUtil; + +import java.nio.ByteBuffer; + +import static java.lang.Math.*; +import static org.lwjgl.opengl.GL15.*; +import static org.lwjgl.opengl.GL30.*; + +/** + * This class implements VBO orphaning, useful for streaming + * dynamically generated geometry to the GPU. OpenGL 3.0 or + * higher is required. See + * {@url http://www.opengl.org/wiki/Buffer_Object_Streaming} + * under "Buffer update" for details. + * + * @author Spasi + */ +public class StreamVBO { + + private final int target; + private final long size; + private final int padding; + + private int ID; + + private long cursor; + + public StreamVBO(final int target, final int size) { + this(target, size, 64); + } + + public StreamVBO(final int target, final int size, final int padding) { + this.target = target; + this.padding = padding; + this.size = max(pad(size), padding); + + ID = glGenBuffers(); + + glBindBuffer(target, ID); + glBufferData(target, this.size, GL_STREAM_DRAW); + } + + public int getTarget() { + return target; + } + + public int getID() { + return ID; + } + + public long getSize() { + return size; + } + + public int getPadding() { + return padding; + } + + public void bind() { + glBindBuffer(target, ID); + } + + public void init(final int offset, final ByteBuffer data) { + glBufferSubData(target, offset, data); + } + + public void unmap() { + glUnmapBuffer(target); + } + + public void destroy() { + glBindBuffer(target, 0); + glDeleteBuffers(ID); + } + + public void reset() { + // Orphan current buffer and allocate a new one + glBufferData(target, size, GL_STREAM_DRAW); + // Flush + cursor = 0; + } + + public ByteBuffer map(final int bytes) { + return map(bytes, null); + } + + public ByteBuffer map(final int bytes, final ByteBuffer old_buffer) { + return doMap(pad(bytes), old_buffer); + } + + private int pad(int size) { + final int mod = size % padding; + if ( mod == 0 ) + return size; + + return size + padding - mod; + } + + private ByteBuffer doMap(final int bytes, final ByteBuffer old_buffer) { + if ( LWJGLUtil.CHECKS && size < bytes ) + throw new IllegalArgumentException(Integer.toString(bytes)); + + if ( size < cursor + bytes ) + reset(); + + final ByteBuffer map = glMapBufferRange(target, cursor, bytes, GL_MAP_WRITE_BIT | GL_MAP_UNSYNCHRONIZED_BIT, old_buffer); + cursor += bytes; + return map; + } + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opengl/SwingFocusTest.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opengl/SwingFocusTest.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opengl/SwingFocusTest.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opengl/SwingFocusTest.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,195 @@ +package org.lwjgl.test.opengl; + +import static org.lwjgl.opengl.GL11.GL_COLOR_BUFFER_BIT; +import static org.lwjgl.opengl.GL11.glClear; +import static org.lwjgl.opengl.GL11.glClearColor; + +import java.awt.*; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; + +import javax.swing.*; + +import org.lwjgl.LWJGLException; +import org.lwjgl.input.Keyboard; +import org.lwjgl.opengl.Display; + +/** + *

    + *

    + * + * @author Brian Matzon + */ +public class SwingFocusTest { + + private JFrame frame; + private final JPanel panel1 = new JPanel(); + private final JPanel panel2 = new JPanel(); + private final JTextPane textPane = new JTextPane(); + + /** The Canvas where the LWJGL Display is added */ + Canvas display_parent; + + /** Thread which runs the main game loop */ + Thread gameThread; + + /** is the game loop running */ + boolean running; + + public SwingFocusTest() { + } + + /** + * Once the Canvas is created its add notify method will call this method to + * start the LWJGL Display and game loop in another thread. + */ + public void startLWJGL() { + gameThread = new Thread() { + public void run() { + running = true; + try { + Display.setParent(display_parent); + Display.setVSyncEnabled(true); + Display.create(); + initGL(); + } catch (LWJGLException e) { + e.printStackTrace(); + } + gameLoop(); + } + }; + gameThread.start(); + } + + protected void gameLoop() { + while ( running ) { + //System.out.println("--GAMELOOP--"); + + Display.processMessages(); + + if ( Display.isDirty() ) { + if ( Keyboard.isKeyDown(Keyboard.KEY_SPACE) ) { + glClearColor(1f, 0, 0, 0); + System.out.println("Pigs in space!"); + } else { + glClearColor(0f, 0f, 1f, 0f); + } + glClear(GL_COLOR_BUFFER_BIT); + + Display.update(false); + } + } + Display.destroy(); + } + + protected void initGL() { + } + + /** + * Tell game loop to stop running, after which the LWJGL Display will be destoryed. + * The main thread will wait for the Display.destroy() to complete + */ + private void stopLWJGL() { + running = false; + try { + gameThread.join(); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + private void execute() { + frame.setVisible(true); + + try { + Display.setParent(display_parent); + Display.setVSyncEnabled(true); + Display.create(); + } catch (LWJGLException e) { + e.printStackTrace(); + } + initGL(); + + running = true; + + while ( running ) { + //System.out.println("--GAMELOOP--"); + + Display.processMessages(); + + if ( true ) { + if ( Keyboard.isKeyDown(Keyboard.KEY_SPACE) ) { + glClearColor(1f, 0, 0, 0); + System.out.println("Pigs in space!"); + } else { + glClearColor(0f, 0f, 1f, 0f); + } + glClear(GL_COLOR_BUFFER_BIT); + + Display.update(false); + } + } + Display.destroy(); + } + + private void initialize() { + frame = new JFrame(); + frame.addWindowListener(new WindowAdapter() { + public void windowClosing(WindowEvent e) { + frame.remove(display_parent); + frame.dispose(); + } + }); + frame.setBounds(100, 100, 450, 300); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + + JMenuBar menuBar = new JMenuBar(); + + for ( int i = 0; i < 10; i++ ) { + JMenu menu = new JMenu("Menu " + i); + for ( int j = 0; j < 10; j++ ) { + menu.add(new JMenuItem("Item " + j)); + } + menuBar.add(menu); + } + frame.setJMenuBar(menuBar); + + frame.getContentPane().setLayout(new GridLayout(0, 2, 0, 0)); + frame.getContentPane().add(panel1); + panel1.setLayout(null); + textPane.setBounds(10, 5, 124, 20); + + JPopupMenu contextMenu = new JPopupMenu("Edit"); + contextMenu.add(new JMenuItem("Save")); + contextMenu.add(new JMenuItem("Save As")); + contextMenu.add(new JMenuItem("Close")); + + textPane.setComponentPopupMenu(contextMenu); + + panel1.add(textPane); + frame.getContentPane().add(panel2); + panel2.setLayout(new BorderLayout(0, 0)); + + display_parent = new Canvas() { + /*public void addNotify() { + super.addNotify(); + startLWJGL(); + } + + public void removeNotify() { + stopLWJGL(); + super.removeNotify(); + }*/ + }; + display_parent.setFocusable(true); + display_parent.requestFocus(); + display_parent.setIgnoreRepaint(true); + panel2.add(display_parent); + } + + public static void main(String[] args) { + SwingFocusTest sit = new SwingFocusTest(); + sit.initialize(); + sit.execute(); + } +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opengl/SyncTest.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opengl/SyncTest.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opengl/SyncTest.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opengl/SyncTest.java 2016-04-09 16:26:56.000000000 +0000 @@ -130,7 +130,7 @@ System.out.println("Unexpected wait status: 0x" + Integer.toHexString(status)); } - System.out.println("Sync Status: " + (glGetSync(sync, GL_SYNC_STATUS) == GL_UNSIGNALED ? "UNSIGNALED" : "SIGNALED")); + System.out.println("Sync Status: " + (glGetSynci(sync, GL_SYNC_STATUS) == GL_UNSIGNALED ? "UNSIGNALED" : "SIGNALED")); glDeleteSync(sync); diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opengl/VBOIndexTest.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opengl/VBOIndexTest.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opengl/VBOIndexTest.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opengl/VBOIndexTest.java 2016-04-09 16:26:56.000000000 +0000 @@ -31,12 +31,12 @@ */ /** - * $Id: VBOIndexTest.java 3418 2010-09-28 21:11:35Z spasi $ + * $Id$ * * Simple java test program. * * @author elias_naur - * @version $Revision: 3418 $ + * @version $Revision$ */ package org.lwjgl.test.opengl; diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opengl/VBOTest.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opengl/VBOTest.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opengl/VBOTest.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opengl/VBOTest.java 2016-04-09 16:26:56.000000000 +0000 @@ -31,12 +31,12 @@ */ /** - * $Id: VBOTest.java 3418 2010-09-28 21:11:35Z spasi $ + * $Id$ * * Simple java test program. * * @author elias_naur - * @version $Revision: 3418 $ + * @version $Revision$ */ package org.lwjgl.test.opengl; diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opengl/VersionTest.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opengl/VersionTest.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opengl/VersionTest.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opengl/VersionTest.java 2016-04-09 16:26:56.000000000 +0000 @@ -74,18 +74,26 @@ if ( 2 < args.length ) { for ( int i = 2; i < args.length; i++ ) { - if ( Pattern.matches("[0-9]+", args[i]) ) - ca = ca.withLayer(Integer.parseInt(args[i])); - else if ( "debug".equalsIgnoreCase(args[i]) ) - ca = ca.withDebug(true); - else if ( "fc".equalsIgnoreCase(args[i]) ) - ca = ca.withForwardCompatible(true); - else if ( "core".equalsIgnoreCase(args[i]) ) + if ( "core".equalsIgnoreCase(args[i]) ) ca = ca.withProfileCore(true); else if ( "compatibility".equalsIgnoreCase(args[i]) ) ca = ca.withProfileCompatibility(true); else if ( "es".equalsIgnoreCase(args[i]) ) ca = ca.withProfileES(true); + else if ( "debug".equalsIgnoreCase(args[i]) ) + ca = ca.withDebug(true); + else if ( "fc".equalsIgnoreCase(args[i]) ) + ca = ca.withForwardCompatible(true); + else if ( "robust".equalsIgnoreCase(args[i]) ) + ca = ca.withRobustAccess(true); + else if ( "reset_isolation".equalsIgnoreCase(args[i]) ) + ca = ca.withContextResetIsolation(true); + else if ( "reset_lose".equalsIgnoreCase(args[i]) ) + ca = ca.withResetNotificationStrategy(ContextAttribs.LOSE_CONTEXT_ON_RESET_ARB); + else if ( "release_none".equalsIgnoreCase(args[i]) ) + ca = ca.withContextReleaseBehavior(ContextAttribs.CONTEXT_RELEASE_BEHAVIOR_NONE_ARB); + else if ( Pattern.matches("[0-9]+", args[i]) ) + ca = ca.withLayer(Integer.parseInt(args[i])); else argsError("Unknown argument: \'" + args[i] + "\'"); } @@ -120,6 +128,7 @@ boolean deprecated = false; try { glVertex3f(0.0f, 0.0f, 0.0f); + Util.checkGLError(); deprecated = true; } catch (Throwable t) {} @@ -235,15 +244,19 @@ private static void argsError(final String msg) { System.out.println("\nInvalid arguments error: " + msg); - System.out.println("\nUsage: VersionTest {'core'|'compatibility', , 'debug', 'fc'}:\n"); - System.out.println("majorVersion\t- Major OpenGL version."); - System.out.println("majorVersion\t- Minor OpenGL version."); + System.out.println("\nUsage: VersionTest {'core'|'compatibility'|'es', 'debug', 'fc', 'robust', 'reset_isolation', 'reset_lose', 'release_none', }:\n"); + System.out.println("\t- Major OpenGL version."); + System.out.println("\t- Minor OpenGL version."); System.out.println("core\t- Sets the Core Profile bit (optional, requires 3.2+)."); System.out.println("compatibility\t- Sets the Compatibility Profile bit (optional, requires 3.2+)."); - System.out.println("ws\t- Sets the OpenGL ES Profile bit (optional, requires 2.0)."); - System.out.println("layer\t- Layer plane (optional)."); + System.out.println("es\t- Sets the OpenGL ES Profile bit (optional, requires 2.0)."); System.out.println("debug\t- Enables debug mode (optional)."); System.out.println("fc\t- Enables forward compatibility mode (optional, requires 3.0+)."); + System.out.println("robust\t- Enables robust access (optional)."); + System.out.println("reset_isolation\t- Enables reset isolation (optional)."); + System.out.println("reset_lose\t- Enables lose context on reset (optional)."); + System.out.println("release_none\t- Enables release behavior = none (optional)."); + System.out.println("\t- Layer plane (optional)."); cleanup(); System.exit(-1); diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opengl/WindowLocationTest.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opengl/WindowLocationTest.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opengl/WindowLocationTest.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opengl/WindowLocationTest.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,33 @@ +package org.lwjgl.test.opengl; + +import org.lwjgl.opengl.*; + +public class WindowLocationTest { + public static void main(String[] args) { + try { + Display.setDisplayMode(new DisplayMode(640, 480)); + Display.setLocation(0, 0); + Display.create(); + Display.setLocation(0, 0); + + for ( int i = 0; i < 5; i++ ) { + int x = Display.getX(); + int y = Display.getY(); + + System.out.println("x=" + x + ", y=" + y); + + Display.setLocation(x, y); + } + + try { + Thread.sleep(2000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + + Display.destroy(); + } catch (Exception ex) { + ex.printStackTrace(); + } + } +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opengles/FullScreenWindowedTest.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opengles/FullScreenWindowedTest.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opengles/FullScreenWindowedTest.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opengles/FullScreenWindowedTest.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,330 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.test.opengles; + +import org.lwjgl.BufferUtils; +import org.lwjgl.LWJGLException; +import org.lwjgl.input.Keyboard; +import org.lwjgl.opengl.Display; +import org.lwjgl.opengl.DisplayMode; +import org.lwjgl.opengles.PixelFormat; +import org.lwjgl.opengles.PowerManagementEventException; +import org.lwjgl.util.vector.Vector2f; + +import java.nio.FloatBuffer; +import java.nio.IntBuffer; + +import static org.lwjgl.opengles.GLES20.*; +import static org.lwjgl.test.opengles.util.GLMatrix.*; + +/** + * Tests switching between windowed and fullscreen + * + * @author Brian Matzon + * @version $Revision: 3172 $ + * $Id: FullScreenWindowedTest.java 3172 2008-12-28 19:30:43Z elias_naur $ + */ +public class FullScreenWindowedTest { + + /** Intended deiplay mode */ + private DisplayMode mode; + /** our quad moving around */ + private Vector2f quadPosition; + /** our quadVelocity */ + private Vector2f quadVelocity; + /** angle of quad */ + private float angle; + /** degrees to rotate per frame */ + private float angleRotation = 1.0f; + /** Max speed of all changable attributes */ + private static final float MAX_SPEED = 20.0f; + + private static int buffer_id; + private static int indices_buffer_id; + + private QuadRenderer renderer; + + /** Creates a FullScreenWindowedTest */ + public FullScreenWindowedTest() { + } + + /** Executes the test */ + public void execute() { + initialize(); + mainLoop(); + cleanup(); + } + + private void switchMode() throws LWJGLException { + mode = findDisplayMode(1024, 600, Display.getDisplayMode().getBitsPerPixel()); + try { + Display.setDisplayModeAndFullscreen(mode); + } catch (PowerManagementEventException e) { + e.printStackTrace(); + } + } + + /** Initializes the test */ + private void initialize() { + try { + //find displaymode + switchMode(); + + quadPosition = new Vector2f(100f, 100f); + quadVelocity = new Vector2f(1.0f, 1.0f); + + reinit(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + private void reinit() throws LWJGLException { + Display.create(new PixelFormat()); + glInit(); + renderer = new QuadRenderer(); + } + + /** Runs the main loop of the "test" */ + private void mainLoop() { + while ( !Keyboard.isKeyDown(Keyboard.KEY_ESCAPE) && !Display.isCloseRequested() ) { + if ( Display.isVisible() ) { + // check keyboard input + processKeyboard(); + // do "game" logic, and render it + logic(); + render(); + } else { + // no need to render/paint if nothing has changed (ie. window + // dragged over) + if ( Display.isDirty() ) { + render(); + } + // don't waste cpu time, sleep more + try { + Thread.sleep(100); + } catch (InterruptedException inte) { + } + } + // Update window + try { + Display.update(); + Display.sync(60); + } catch (PowerManagementEventException e) { + e.printStackTrace(); + } + } + } + + /** Performs the logic */ + private void logic() { + angle += angleRotation; + if ( angle > 90.0f ) { + angle = 0.0f; + } + quadPosition.x += quadVelocity.x; + quadPosition.y += quadVelocity.y; + //check colision with vertical border border + if ( quadPosition.x + 50 >= mode.getWidth() || quadPosition.x - 50 <= 0 ) { + quadVelocity.x *= -1; + } + //check collision with horizontal border + if ( quadPosition.y + 50 >= mode.getHeight() || quadPosition.y - 50 <= 0 ) { + quadVelocity.y *= -1; + } + } + + private void render() { + //clear background + glClear(GL_COLOR_BUFFER_BIT); + // draw white quad + glPushMatrix(); + { + glTranslatef(quadPosition.x, quadPosition.y, 0); + glRotatef(angle, 0.0f, 0.0f, 1.0f); + + renderer.setMVPUniform(); + + glDrawElements(GL_TRIANGLE_STRIP, 4, GL_UNSIGNED_INT, 0); + } + glPopMatrix(); + } + + /** Processes keyboard input */ + private void processKeyboard() { + //check for fullscreen key + if ( Keyboard.isKeyDown(Keyboard.KEY_F) ) { + try { + cleanup(); + + switchMode(); + + reinit(); + } catch (Exception e) { + e.printStackTrace(); + } + } + //check for window key + if ( Keyboard.isKeyDown(Keyboard.KEY_W) ) { + try { + cleanup(); + + mode = new DisplayMode(800, 480); + Display.setDisplayModeAndFullscreen(mode); + + reinit(); + } catch (Exception e) { + e.printStackTrace(); + } + } + //check for speed changes + if ( Keyboard.isKeyDown(Keyboard.KEY_UP) ) { + quadVelocity.y += 0.1f; + } + if ( Keyboard.isKeyDown(Keyboard.KEY_DOWN) ) { + quadVelocity.y -= 0.1f; + } + if ( Keyboard.isKeyDown(Keyboard.KEY_RIGHT) ) { + quadVelocity.x += 0.1f; + } + if ( Keyboard.isKeyDown(Keyboard.KEY_LEFT) ) { + quadVelocity.x -= 0.1f; + } + if ( Keyboard.isKeyDown(Keyboard.KEY_ADD) ) { + angleRotation += 0.1f; + } + if ( Keyboard.isKeyDown(Keyboard.KEY_SUBTRACT) ) { + angleRotation -= 0.1f; + } + //throttle + if ( quadVelocity.x < -MAX_SPEED ) { + quadVelocity.x = -MAX_SPEED; + } + if ( quadVelocity.x > MAX_SPEED ) { + quadVelocity.x = MAX_SPEED; + } + if ( quadVelocity.y < -MAX_SPEED ) { + quadVelocity.y = -MAX_SPEED; + } + if ( quadVelocity.y > MAX_SPEED ) { + quadVelocity.y = MAX_SPEED; + } + if ( angleRotation < 0.0f ) { + angleRotation = 0.0f; + } + if ( angleRotation > MAX_SPEED ) { + angleRotation = MAX_SPEED; + } + } + + /** Cleans up the test */ + private void cleanup() { + renderer.cleanup(); + + IntBuffer int_buffer = BufferUtils.createIntBuffer(2); + int_buffer.put(0, buffer_id); + int_buffer.put(1, indices_buffer_id); + + glDeleteBuffers(int_buffer); + + Display.destroy(); + } + + /** + * Retrieves a displaymode, if one such is available + * + * @param width Required width + * @param height Required height + * @param bpp Minimum required bits per pixel + * + * @return + */ + private static DisplayMode findDisplayMode(int width, int height, int bpp) throws LWJGLException { + DisplayMode[] modes = Display.getAvailableDisplayModes(); + for ( int i = 0; i < modes.length; i++ ) { + if ( modes[i].getWidth() == width && modes[i].getHeight() == height && modes[i].getBitsPerPixel() >= bpp && modes[i].getFrequency() <= 60 ) { + return modes[i]; + } + } + return Display.getDesktopDisplayMode(); + } + + /** Initializes OGL */ + private void glInit() { + // Go into orthographic projection mode. + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glOrtho(0, mode.getWidth(), 0, mode.getHeight(), -1.0f, 1.0f); + + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + + glViewport(0, 0, mode.getWidth(), mode.getHeight()); + //set clear color to black + glClearColor(0.0f, 0.0f, 0.0f, 0.0f); + + //sync frame (only works on windows) + Display.setVSyncEnabled(true); + + final IntBuffer int_buffer = BufferUtils.createIntBuffer(2); + glGenBuffers(int_buffer); + buffer_id = int_buffer.get(0); + indices_buffer_id = int_buffer.get(1); + + glBindBuffer(GL_ARRAY_BUFFER, buffer_id); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, indices_buffer_id); + + final FloatBuffer vertices = BufferUtils.createFloatBuffer(2 * 4); + vertices + .put(-50).put(-50) + .put(50).put(-50) + .put(-50).put(50) + .put(50).put(50); + vertices.rewind(); + + final IntBuffer indices = BufferUtils.createIntBuffer(4); + indices.put(0).put(1).put(2).put(3); + indices.rewind(); + + glBufferData(GL_ARRAY_BUFFER, vertices, GL_STATIC_DRAW); + glBufferData(GL_ELEMENT_ARRAY_BUFFER, indices, GL_STATIC_DRAW); + } + + /** Test entry point */ + public static void main(String[] args) { + System.out.println("Change between fullscreen and windowed mode, by pressing F and W respectively"); + System.out.println("Move quad using arrowkeys, and change rotation using +/-"); + FullScreenWindowedTest fswTest = new FullScreenWindowedTest(); + fswTest.execute(); + System.exit(0); + } +} diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opengles/Gears.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opengles/Gears.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opengles/Gears.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opengles/Gears.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,580 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * 3-D gear wheels. Originally by Brian Paul + */ +package org.lwjgl.test.opengles; + +import org.lwjgl.BufferUtils; +import org.lwjgl.LWJGLException; +import org.lwjgl.Sys; +import org.lwjgl.input.Keyboard; +import org.lwjgl.input.Mouse; +import org.lwjgl.opengl.Display; +import org.lwjgl.opengl.DisplayMode; +import org.lwjgl.opengles.*; +import org.lwjgl.test.opengles.util.Geometry; +import org.lwjgl.test.opengles.util.ImmediateModeBuffer; +import org.lwjgl.test.opengles.util.Shader; +import org.lwjgl.test.opengles.util.ShaderProgram; +import org.lwjgl.util.vector.Matrix4f; +import org.lwjgl.util.vector.Vector3f; + +import java.lang.reflect.Field; +import java.nio.FloatBuffer; +import java.util.StringTokenizer; + +import static org.lwjgl.opengles.GLES20.*; +import static org.lwjgl.test.opengles.util.GLLight.*; +import static org.lwjgl.test.opengles.util.GLMatrix.*; +import static org.lwjgl.test.opengles.util.Geometry.*; + +/** + *

    + * This is the OpenGL "standard" Gears demo, originally by Brian Paul + *

    + * + * @author Brian Matzon + * @version $Revision: 3276 $ + * $Id: Gears.java 3276 2010-02-21 21:18:17Z matzon $ + */ +public class Gears { + + private boolean run = true; + + private float view_rotx = 20.0f; + + private float view_roty = 30.0f; + + private float view_rotz = 0.0f; + + private Gear gear1; + + private Gear gear2; + + private Gear gear3; + + private float angle = 0.0f; + + private Shader vsh; + private Shader fsh; + + private ShaderProgram program; + + private int LIGHT_POS; + + private int MVP; + private int NM; + + private int GEAR_COLOR; + + private int vPosition; + private int vNormal; + + private final Matrix4f p = new Matrix4f(); + private final Matrix4f mv = new Matrix4f(); + private final Matrix4f mvp = new Matrix4f(); + + private final FloatBuffer m4fBuffer = BufferUtils.createFloatBuffer(4 * 4); + private final FloatBuffer m3fBuffer = BufferUtils.createFloatBuffer(3 * 3); + + public static void main(String[] args) { + new Gears().execute(); + System.exit(0); + } + + /** + * + */ + private void execute() { + try { + init(); + } catch (LWJGLException e) { + e.printStackTrace(); + System.out.println("Failed to initialize Gears."); + return; + } + + System.out.println("\nGL RENDERER: " + glGetString(GL_RENDERER)); + System.out.println("GL VENDOR: " + glGetString(GL_VENDOR)); + System.out.println("GL VERSION: " + glGetString(GL_VERSION)); + System.out.println("GL_SHADING_LANGUAGE_VERSION: " + glGetString(GL_SHADING_LANGUAGE_VERSION)); + System.out.println("GL_EXTENSIONS = " + glGetString(GL_EXTENSIONS)); + + ContextCapabilities caps = GLContext.getCapabilities(); + + System.out.println(); + + // Check extension support + Field[] field = ContextCapabilities.class.getFields(); + for ( Field f : field ) { + if ( f.getName().startsWith("GL_") ) { + try { + System.out.println(f.getName() + " - " + f.getBoolean(caps)); + } catch (IllegalAccessException e) { + e.printStackTrace(); + } + } + } + + System.out.println(); + + // Check for extensions that LWJGL does not support + final String extensions = glGetString(GL_EXTENSIONS); + + final StringTokenizer tokenizer = new StringTokenizer(extensions); + while ( tokenizer.hasMoreTokens() ) { + final String ext = tokenizer.nextToken(); + try { + if ( !caps.getClass().getField(ext).getBoolean(caps) ) + System.out.println("-- Extension exposed but functions are missing: " + ext); + } catch (NoSuchFieldException e) { + System.out.println("-- No LWJGL support for extension: " + ext); + } catch (Exception e) { + e.printStackTrace(); + } + } + + loop(); + + destroy(); + } + + /** + * + */ + private void destroy() { + program.destroy(); + + fsh.destroy(); + vsh.destroy(); + + gear3.destroy(); + gear2.destroy(); + gear1.destroy(); + + Display.destroy(); + } + + /** + * + */ + private void loop() { + long lastFrameTime = Sys.getTime(); + long startTime = System.currentTimeMillis() + 5000; + long fps = 0; + + while ( run ) { + if ( !Display.isVisible() ) + Thread.yield(); + else { + // This is the current frame time. + long frameStart = Sys.getTime(); + + // How many seconds passed since last frame. + final float frameTime = (float)((frameStart - lastFrameTime) / (double)Sys.getTimerResolution()); + lastFrameTime = frameStart; + + angle += frameTime * 120.0f; + + handleInput(); + + //glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_COVERAGE_BUFFER_BIT_NV); + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + + glPushMatrix(); + glRotatef(view_rotx, 1.0f, 0.0f, 0.0f); + glRotatef(view_roty, 0.0f, 1.0f, 0.0f); + glRotatef(view_rotz, 0.0f, 0.0f, 1.0f); + + glPushMatrix(); + glTranslatef(-3.0f, -2.0f, 0.0f); + glRotatef(angle, 0.0f, 0.0f, 1.0f); + gear1.render(); + glPopMatrix(); + + glPushMatrix(); + glTranslatef(3.1f, -2.0f, 0.0f); + glRotatef(-2.0f * angle - 9.0f, 0.0f, 0.0f, 1.0f); + gear2.render(); + glPopMatrix(); + + glPushMatrix(); + glTranslatef(-3.1f, 4.2f, 0.0f); + glRotatef(-2.0f * angle - 25.0f, 0.0f, 0.0f, 1.0f); + gear3.render(); + glPopMatrix(); + + glPopMatrix(); + + try { + Display.update(); + //Display.sync(60); + } catch (PowerManagementEventException e) { + e.printStackTrace(); + } + if ( startTime > System.currentTimeMillis() ) { + fps++; + } else { + long timeUsed = 5000 + (startTime - System.currentTimeMillis()); + startTime = System.currentTimeMillis() + 5000; + System.out.println(fps + " frames in " + (timeUsed / 1000f) + " seconds = " + (fps / (timeUsed / 1000f))); + fps = 0; + } + + if ( Display.isCloseRequested() ) + break; + } + } + } + + private void handleInput() { + if ( Keyboard.getNumKeyboardEvents() != 0 ) { + while ( Keyboard.next() ) { + if ( Keyboard.getEventKeyState() ) + continue; + + final int key = Keyboard.getEventKey(); + switch ( key ) { + case Keyboard.KEY_ESCAPE: + run = false; + break; + } + } + } + + while ( Mouse.next() ) ; + } + + /** + * + */ + private void init() throws LWJGLException { + final int WIDTH = 640; + final int HEIGHT = 480; + + Display.setLocation((Display.getDisplayMode().getWidth() - WIDTH) / 2, + (Display.getDisplayMode().getHeight() - HEIGHT) / 2); + try { + Display.setDisplayMode(new DisplayMode(WIDTH, HEIGHT)); + } catch (PowerManagementEventException e) { + e.printStackTrace(); + } + Display.setTitle("Gears"); + Display.create(new PixelFormat()); + + //glCoverageMaskNV(true); + + // setup ogl + glViewport(0, 0, WIDTH, HEIGHT); + glFrontFace(GL_CCW); + glCullFace(GL_BACK); + glEnable(GL_CULL_FACE); + glEnable(GL_DEPTH_TEST); + + final Vector3f lp = new Vector3f(5.0f, 5.0f, 10.0f); + lp.normalise(); + glLight(GL_LIGHT0, GL_POSITION, lp.getX(), lp.getY(), lp.getZ(), 0.0f); + + /* make the gears */ + gear1 = new Gear(gear(1.0f, 4.0f, 1.0f, 20, 0.7f), new float[] { 0.8f, 0.1f, 0.0f, 1.0f }); + gear2 = new Gear(gear(0.5f, 2.0f, 2.0f, 10, 0.7f), new float[] { 0.0f, 0.8f, 0.2f, 1.0f }); + gear3 = new Gear(gear(1.3f, 2.0f, 0.5f, 10, 0.7f), new float[] { 0.2f, 0.2f, 1.0f, 1.0f }); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + + final float h = (float)300 / (float)300; + glFrustum(-1.0f, 1.0f, -h, h, 5.0f, 60.0f); + + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + glTranslatef(0.0f, 0.0f, -40.0f); + + vsh = new Shader(GL_VERTEX_SHADER, "uniform highp vec4 LIGHT_POS;\n" + + "uniform highp mat4 MODEL_VIEW_PROJECTION_MATRIX;\n" + + "uniform mediump mat3 NORMAL_MATRIX;\n" + + "uniform lowp vec3 GEAR_COLOR;\n" + + "attribute highp vec3 vPosition;\n" + + "attribute mediump vec3 vNormal;\n" + + "varying lowp vec3 color;\n" + + "void main(void) {\n" + + "\tgl_Position = MODEL_VIEW_PROJECTION_MATRIX * vec4(vPosition, 1.0);\n" + + "\tvec3 normal = NORMAL_MATRIX * vNormal;\n" + + "\tcolor = max(dot(normal, vec3(LIGHT_POS)), 0.0) * GEAR_COLOR + vec3(0.05);\n" + + "}"); + + fsh = new Shader(GL_FRAGMENT_SHADER, "varying lowp vec3 color;\n" + + "void main(void) {\n" + + "\tgl_FragColor = vec4(color, 1.0);\n" + + "}"); + + program = new ShaderProgram(vsh, fsh); + program.enable(); + + LIGHT_POS = program.getUniformLocation("LIGHT_POS"); + + MVP = program.getUniformLocation("MODEL_VIEW_PROJECTION_MATRIX"); + NM = program.getUniformLocation("NORMAL_MATRIX"); + + GEAR_COLOR = program.getUniformLocation("GEAR_COLOR"); + + vPosition = program.getAttributeLocation("vPosition"); + vNormal = program.getAttributeLocation("vNormal"); + + glEnableVertexAttribArray(vNormal); + glEnableVertexAttribArray(vPosition); + } + + /** + * Draw a gear wheel. You'll probably want to call this function when + * building a display list since we do a lot of trig here. + * + * @param inner_radius radius of hole at center + * @param outer_radius radius at center of teeth + * @param width width of gear + * @param teeth number of teeth + * @param tooth_depth depth of tooth + */ + private static Geometry gear(float inner_radius, float outer_radius, float width, int teeth, float tooth_depth) { + int i; + float r0, r1, r2; + float angle, da; + float u, v, len; + + r0 = inner_radius; + r1 = outer_radius - tooth_depth / 2.0f; + r2 = outer_radius + tooth_depth / 2.0f; + + da = 2.0f * (float)Math.PI / teeth / 4.0f; + + final Geometry gear = new Geometry(); + final ImmediateModeBuffer imb = new ImmediateModeBuffer(1024); + int lastDrawIndex = 0; + + //glShadeModel(GL_FLAT); + + // draw front face + lastDrawIndex += gear.addDrawCommand(GL_TRIANGLE_STRIP, lastDrawIndex, teeth * 4 + 2); + for ( i = 0; i <= teeth; i++ ) { + angle = i * 2.0f * (float)Math.PI / teeth; + + imb.glNormal3f(0.0f, 0.0f, 1.0f); + imb.glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5f); + + imb.glNormal3f(0.0f, 0.0f, 1.0f); + imb.glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5f); + + if ( i < teeth ) { + imb.glNormal3f(0.0f, 0.0f, 1.0f); + imb.glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5f); + + imb.glNormal3f(0.0f, 0.0f, 1.0f); + imb.glVertex3f(r1 * cos(angle + 3.0f * da), r1 * sin(angle + 3.0f * da), width * 0.5f); + } + } + + // draw front sides of teeth + for ( i = 0; i < teeth; i++ ) { + lastDrawIndex += gear.addDrawCommand(GL_TRIANGLE_STRIP, lastDrawIndex, 4); + + angle = i * 2.0f * (float)Math.PI / teeth; + + imb.glNormal3f(0.0f, 0.0f, 1.0f); + imb.glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5f); + + imb.glNormal3f(0.0f, 0.0f, 1.0f); + imb.glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), width * 0.5f); + + imb.glNormal3f(0.0f, 0.0f, 1.0f); + imb.glVertex3f(r1 * cos(angle + 3.0f * da), r1 * sin(angle + 3.0f * da), width * 0.5f); + + imb.glNormal3f(0.0f, 0.0f, 1.0f); + imb.glVertex3f(r2 * cos(angle + 2.0f * da), r2 * sin(angle + 2.0f * da), width * 0.5f); + } + + // draw back face + lastDrawIndex += gear.addDrawCommand(GL_TRIANGLE_STRIP, lastDrawIndex, (teeth + 1) * 4); + for ( i = 0; i <= teeth; i++ ) { + angle = i * 2.0f * (float)Math.PI / teeth; + + imb.glNormal3f(0.0f, 0.0f, 1.0f); + imb.glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5f); + + imb.glNormal3f(0.0f, 0.0f, 1.0f); + imb.glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5f); + + imb.glNormal3f(0.0f, 0.0f, 1.0f); + imb.glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), -width * 0.5f); + + imb.glNormal3f(0.0f, 0.0f, 1.0f); + imb.glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5f); + } + + // draw back sides of teeth + for ( i = 0; i < teeth; i++ ) { + lastDrawIndex += gear.addDrawCommand(GL_TRIANGLE_STRIP, lastDrawIndex, 4); + + angle = i * 2.0f * (float)Math.PI / teeth; + + imb.glNormal3f(0.0f, 0.0f, 1.0f); + imb.glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), -width * 0.5f); + + imb.glNormal3f(0.0f, 0.0f, 1.0f); + imb.glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da), -width * 0.5f); + + imb.glNormal3f(0.0f, 0.0f, 1.0f); + imb.glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5f); + + imb.glNormal3f(0.0f, 0.0f, 1.0f); + imb.glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), -width * 0.5f); + } + + // draw outward faces of teeth + // OpenGL ES 2.0 note: This needs to be converted to a triangle + // list with face normals to get the flat look of the original. + lastDrawIndex += gear.addDrawCommand(GL_TRIANGLE_STRIP, lastDrawIndex, teeth * 8 + 2); + for ( i = 0; i < teeth; i++ ) { + angle = i * 2.0f * (float)Math.PI / teeth; + + imb.glNormal3f(cos(angle), sin(angle), 0.0f); + imb.glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5f); + + imb.glNormal3f(cos(angle), sin(angle), 0.0f); + imb.glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5f); + + u = r2 * cos(angle + da) - r1 * cos(angle); + v = r2 * sin(angle + da) - r1 * sin(angle); + len = (float)Math.sqrt(u * u + v * v); + u /= len; + v /= len; + + imb.glNormal3f(v, -u, 0.0f); + imb.glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), width * 0.5f); + + imb.glNormal3f(v, -u, 0.0f); + imb.glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), -width * 0.5f); + + imb.glNormal3f(cos(angle), sin(angle), 0.0f); + imb.glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da), width * 0.5f); + + imb.glNormal3f(cos(angle), sin(angle), 0.0f); + imb.glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da), -width * 0.5f); + + u = r1 * cos(angle + 3 * da) - r2 * cos(angle + 2 * da); + v = r1 * sin(angle + 3 * da) - r2 * sin(angle + 2 * da); + + imb.glNormal3f(v, -u, 0.0f); + imb.glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), width * 0.5f); + + imb.glNormal3f(v, -u, 0.0f); + imb.glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), -width * 0.5f); + } + imb.glNormal3f(cos(0), sin(0), 0.0f); + imb.glVertex3f(r1 * cos(0), r1 * sin(0), width * 0.5f); + + imb.glNormal3f(cos(0), sin(0), 0.0f); + imb.glVertex3f(r1 * cos(0), r1 * sin(0), -width * 0.5f); + + //glShadeModel(GL_SMOOTH); + + // draw inside radius cylinder + lastDrawIndex += gear.addDrawCommand(GL_TRIANGLE_STRIP, lastDrawIndex, (teeth + 1) * 2); + for ( i = 0; i <= teeth; i++ ) { + angle = i * 2.0f * (float)Math.PI / teeth; + + imb.glNormal3f(-cos(angle), -sin(angle), 0.0f); + imb.glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5f); + + imb.glNormal3f(-cos(angle), -sin(angle), 0.0f); + imb.glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5f); + } + + gear.update(imb.getBuffer()); + return gear; + } + + private class Gear { + + private final Geometry geom; + + private final float[] color; + + Gear(final Geometry geom, final float[] color) { + this.geom = geom; + this.color = color; + } + + void render() { + // Set gear color + glUniform3f(GEAR_COLOR, color[0], color[1], color[2]); + + // Set Light position + setUniform4f(LIGHT_POS, GL_LIGHT0, GL_POSITION); + + // Get Projection and Modelview matrices + glMatrixMode(GL_PROJECTION); + glGetMatrix(p); + + glMatrixMode(GL_MODELVIEW); + glGetMatrix(mv); + + // Set MVP uniform + Matrix4f.mul(p, mv, mvp); + mvp.store(m4fBuffer); + m4fBuffer.flip(); + glUniformMatrix4(MVP, false, m4fBuffer); + + // Set normal matrix (upper-left 3x3 of the inverse transpose MV matrix) + mv.invert(); + mv.transpose(); + mv.store3f(m3fBuffer); + m3fBuffer.flip(); + glUniformMatrix3(NM, false, m3fBuffer); + + geom.bind(); + + final int stride = (3 + 3) * 4; + glVertexAttribPointer(vNormal, 3, GL_FLOAT, false, stride, 0); + glVertexAttribPointer(vPosition, 3, GL_FLOAT, false, stride, 3 * 4); + + geom.draw(); + } + + void destroy() { + geom.destroy(); + } + + } + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opengles/MappedIndexedVBOTest.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opengles/MappedIndexedVBOTest.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opengles/MappedIndexedVBOTest.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opengles/MappedIndexedVBOTest.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,252 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * $Id: VBOIndexTest.java 2983 2008-04-07 18:36:09Z matzon $ + * + * Simple java test program. + * + * @author elias_naur + * @version $Revision: 2983 $ + */ + +package org.lwjgl.test.opengles; + +import org.lwjgl.BufferUtils; +import org.lwjgl.Sys; +import org.lwjgl.input.Keyboard; +import org.lwjgl.input.Mouse; +import org.lwjgl.opengl.Display; +import org.lwjgl.opengl.DisplayMode; +import org.lwjgl.opengles.GLContext; +import org.lwjgl.opengles.PixelFormat; + +import java.nio.ByteBuffer; +import java.nio.FloatBuffer; +import java.nio.IntBuffer; + +import static org.lwjgl.opengles.GLES20.*; +import static org.lwjgl.opengles.OESMapbuffer.*; +import static org.lwjgl.test.opengles.util.GLMatrix.*; + +public final class MappedIndexedVBOTest { + + static { + try { + //find first display mode that allows us 640*480*16 + int mode = -1; + DisplayMode[] modes = Display.getAvailableDisplayModes(); + for ( int i = 0; i < modes.length; i++ ) { + if ( modes[i].getWidth() == 640 + && modes[i].getHeight() == 480 + && modes[i].getBitsPerPixel() >= 16 ) { + mode = i; + break; + } + } + if ( mode != -1 ) { + //select above found displaymode + System.out.println("Setting display mode to " + modes[mode]); + Display.setDisplayMode(modes[mode]); + System.out.println("Created display."); + } + } catch (Exception e) { + System.err.println("Failed to create display due to " + e); + } + } + + static { + try { + Display.create(new PixelFormat()); + System.out.println("Created OpenGL."); + + if ( !GLContext.getCapabilities().GL_OES_mapbuffer ) { + System.out.println("GL_OES_mapbuffer is not supported, quitting!"); + System.exit(0); + } + } catch (Exception e) { + System.err.println("Failed to create OpenGL due to " + e); + System.exit(1); + } + } + + /** Is the game finished? */ + private static boolean finished; + + /** A rotating square! */ + private static float angle; + private static int buffer_id; + private static int indices_buffer_id; + private static FloatBuffer vertices; + private static ByteBuffer mapped_buffer; + private static FloatBuffer mapped_float_buffer; + private static IntBuffer indices; + private static ByteBuffer mapped_indices_buffer; + private static IntBuffer mapped_indices_int_buffer; + + private static QuadRenderer renderer; + + public static void main(String[] arguments) { + try { + init(); + while ( !finished ) { + Display.update(); + Display.sync(30); + + if ( !Display.isVisible() ) + Thread.sleep(200); + else if ( Display.isCloseRequested() ) + System.exit(0); + + mainLoop(); + render(); + } + } catch (Throwable t) { + t.printStackTrace(); + } finally { + cleanup(); + } + System.exit(0); + } + + /** All calculations are done in here */ + private static void mainLoop() { + angle += 1f; + if ( angle > 360.0f ) + angle = 0.0f; + + if ( Mouse.getDX() != 0 || Mouse.getDY() != 0 || Mouse.getDWheel() != 0 ) + System.out.println("Mouse moved " + Mouse.getDX() + " " + Mouse.getDY() + " " + Mouse.getDWheel()); + for ( int i = 0; i < Mouse.getButtonCount(); i++ ) + if ( Mouse.isButtonDown(i) ) + System.out.println("Button " + i + " down"); + if ( Keyboard.isKeyDown(Keyboard.KEY_ESCAPE) ) + finished = true; + for ( int i = 0; i < Keyboard.getNumKeyboardEvents(); i++ ) { + Keyboard.next(); + if ( Keyboard.getEventKey() == Keyboard.KEY_ESCAPE && Keyboard.getEventKeyState() ) + finished = true; + if ( Keyboard.getEventKey() == Keyboard.KEY_T && Keyboard.getEventKeyState() ) + System.out.println("Current time: " + Sys.getTime()); + } + } + + /** All rendering is done in here */ + private static void render() { + glClear(GL_COLOR_BUFFER_BIT); + + glPushMatrix(); + glTranslatef(Display.getDisplayMode().getWidth() / 2, Display.getDisplayMode().getHeight() / 2, 0.0f); + glRotatef(angle, 0, 0, 1.0f); + + renderer.setMVPUniform(); + + ByteBuffer new_mapped_buffer = glMapBufferOES(GL_ARRAY_BUFFER, GL_WRITE_ONLY_OES, mapped_buffer); + if ( new_mapped_buffer != mapped_buffer ) { + mapped_buffer = new_mapped_buffer; + mapped_float_buffer = new_mapped_buffer.asFloatBuffer(); + } + + new_mapped_buffer = glMapBufferOES(GL_ELEMENT_ARRAY_BUFFER, GL_WRITE_ONLY_OES, mapped_indices_buffer); + if ( new_mapped_buffer != mapped_indices_buffer ) { + mapped_indices_buffer = new_mapped_buffer; + mapped_indices_int_buffer = new_mapped_buffer.asIntBuffer(); + } + + mapped_float_buffer.rewind(); + vertices.rewind(); + mapped_float_buffer.put(vertices); + + mapped_indices_int_buffer.rewind(); + indices.rewind(); + mapped_indices_int_buffer.put(indices); + if ( glUnmapBufferOES(GL_ARRAY_BUFFER) && + glUnmapBufferOES(GL_ELEMENT_ARRAY_BUFFER) ) { + glDrawElements(GL_TRIANGLE_STRIP, 4, GL_UNSIGNED_INT, 0); + } + + glPopMatrix(); + } + + /** Initialize */ + private static void init() throws Exception { + System.out.println("Timer resolution: " + Sys.getTimerResolution()); + + // Go into orthographic projection mode. + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glOrtho(0, Display.getDisplayMode().getWidth(), 0, Display.getDisplayMode().getHeight(), -1.0f, 1.0f); + + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + glViewport(0, 0, Display.getDisplayMode().getWidth(), Display.getDisplayMode().getHeight()); + + final IntBuffer int_buffer = BufferUtils.createIntBuffer(2); + glGenBuffers(int_buffer); + buffer_id = int_buffer.get(0); + indices_buffer_id = int_buffer.get(1); + + glBindBuffer(GL_ARRAY_BUFFER, buffer_id); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, indices_buffer_id); + + vertices = BufferUtils.createFloatBuffer(2 * 4); + vertices + .put(-50).put(-50) + .put(50).put(-50) + .put(-50).put(50) + .put(50).put(50); + vertices.rewind(); + + indices = BufferUtils.createIntBuffer(4); + indices.put(0).put(1).put(2).put(3); + indices.rewind(); + + glBufferData(GL_ARRAY_BUFFER, 2 * 4 * 4, GL_STREAM_DRAW); + glBufferData(GL_ELEMENT_ARRAY_BUFFER, 4 * 4, GL_STREAM_DRAW); + + renderer = new QuadRenderer(); + } + + /** Cleanup */ + private static void cleanup() { + renderer.cleanup(); + + IntBuffer int_buffer = BufferUtils.createIntBuffer(2); + int_buffer.put(0, buffer_id); + int_buffer.put(1, indices_buffer_id); + + glDeleteBuffers(int_buffer); + + Display.destroy(); + } + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opengles/QuadRenderer.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opengles/QuadRenderer.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opengles/QuadRenderer.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opengles/QuadRenderer.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,70 @@ +package org.lwjgl.test.opengles; + +import org.lwjgl.BufferUtils; +import org.lwjgl.test.opengles.util.Shader; +import org.lwjgl.test.opengles.util.ShaderProgram; +import org.lwjgl.util.vector.Matrix4f; + +import java.nio.FloatBuffer; + +import static org.lwjgl.opengles.GLES20.*; +import static org.lwjgl.test.opengles.util.GLMatrix.*; + +final class QuadRenderer { + + private final Shader vsh; + private final Shader fsh; + private final ShaderProgram program; + + private final int uniMVP; + + private final Matrix4f p = new Matrix4f(); + private final Matrix4f mv = new Matrix4f(); + private final Matrix4f mvp = new Matrix4f(); + + private final FloatBuffer m4fBuffer = BufferUtils.createFloatBuffer(4 * 4); + + QuadRenderer() { + vsh = new Shader(GL_VERTEX_SHADER, "uniform highp mat4 MODEL_VIEW_PROJECTION_MATRIX;\n" + + "attribute highp vec2 vPosition;\n" + + "void main(void) {\n" + + "\tgl_Position = MODEL_VIEW_PROJECTION_MATRIX * vec4(vPosition, 0.0, 1.0);\n" + + "}"); + + fsh = new Shader(GL_FRAGMENT_SHADER, "void main(void) {\n" + + "\tgl_FragColor = vec4(1.0);\n" + + "}"); + + program = new ShaderProgram(vsh, fsh); + program.enable(); + + uniMVP = program.getUniformLocation("MODEL_VIEW_PROJECTION_MATRIX"); + + final int vPosition = program.getAttributeLocation("vPosition"); + glVertexAttribPointer(vPosition, 2, GL_FLOAT, false, 0, 0); + glEnableVertexAttribArray(vPosition); + } + + void setMVPUniform() { + // Get Projection and Modelview matrices + glMatrixMode(GL_PROJECTION); + glGetMatrix(p); + + glMatrixMode(GL_MODELVIEW); + glGetMatrix(mv); + + // Set MVP uniform + Matrix4f.mul(p, mv, mvp); + mvp.store(m4fBuffer); + m4fBuffer.flip(); + glUniformMatrix4(uniMVP, false, m4fBuffer); + } + + void cleanup() { + program.destroy(); + + fsh.destroy(); + vsh.destroy(); + } + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opengles/util/BufferObjectArray.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opengles/util/BufferObjectArray.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opengles/util/BufferObjectArray.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opengles/util/BufferObjectArray.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,41 @@ +package org.lwjgl.test.opengles.util; + +import java.nio.Buffer; + +import static org.lwjgl.opengles.GLES20.*; + +public final class BufferObjectArray extends BufferObject { + + private static int boundBOArray; + + public BufferObjectArray(final int usage) { + super(GL_ARRAY_BUFFER, usage); + } + + public BufferObjectArray(final int usage, final Buffer buffer) { + super(GL_ARRAY_BUFFER, usage, buffer); + } + + public BufferObjectArray(final int usage, final int dataSize) { + super(GL_ARRAY_BUFFER, usage, dataSize); + } + + public void enable() { + if ( boundBOArray != ID ) { + glBindBuffer(GL_ARRAY_BUFFER, ID); + boundBOArray = ID; + } + } + + public void disable() { + boArrayDisable(); + } + + public static void boArrayDisable() { + if ( boundBOArray != 0 ) { + glBindBuffer(GL_ARRAY_BUFFER, 0); + boundBOArray = 0; + } + } + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opengles/util/BufferObjectElement.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opengles/util/BufferObjectElement.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opengles/util/BufferObjectElement.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opengles/util/BufferObjectElement.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,41 @@ +package org.lwjgl.test.opengles.util; + +import java.nio.Buffer; + +import static org.lwjgl.opengles.GLES20.*; + +public final class BufferObjectElement extends BufferObject { + + private static int boundBOElementArray; + + public BufferObjectElement(final int usage) { + super(GL_ELEMENT_ARRAY_BUFFER, usage); + } + + public BufferObjectElement(final int usage, final Buffer buffer) { + super(GL_ELEMENT_ARRAY_BUFFER, usage, buffer); + } + + public BufferObjectElement(final int usage, final int dataSize) { + super(GL_ELEMENT_ARRAY_BUFFER, usage, dataSize); + } + + public void enable() { + if ( boundBOElementArray != ID ) { + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ID); + boundBOElementArray = ID; + } + } + + public void disable() { + boElementArrayDisable(); + } + + public static void boElementArrayDisable() { + if ( boundBOElementArray != 0 ) { + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); + boundBOElementArray = 0; + } + } + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opengles/util/BufferObject.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opengles/util/BufferObject.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opengles/util/BufferObject.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opengles/util/BufferObject.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,99 @@ +package org.lwjgl.test.opengles.util; + +import java.nio.*; + +import static org.lwjgl.opengles.GLES20.*; +import static org.lwjgl.opengles.OESMapbuffer.*; + +abstract class BufferObject implements GLObject { + + protected final int ID; + + protected int target; + protected int usage; + + /** The BufferObject data size in bytes. */ + private int size; + + protected BufferObject(final int type, final int usage) { + this.ID = glGenBuffers(); + this.target = type; + this.usage = usage; + } + + protected BufferObject(final int type, final int usage, final Buffer buffer) { + this(type, usage); + setData(buffer); + } + + protected BufferObject(final int type, final int usage, final int dataSize) { + this(type, usage); + setData(dataSize); + } + + public final int getID() { + return ID; + } + + public void destroy() { + glDeleteBuffers(ID); + } + + public final int getTarget() { + return target; + } + + public final int getUsage() { + return usage; + } + + public final int getSize() { + return size; + } + + public abstract void enable(); + + public abstract void disable(); + + public final void setData(final Buffer buffer) { + enable(); + + if ( buffer instanceof ByteBuffer ) { + glBufferData(target, (ByteBuffer)buffer, usage); + size = buffer.remaining(); + } else if ( buffer instanceof ShortBuffer ) { + glBufferData(target, (ShortBuffer)buffer, usage); + size = buffer.remaining() << 1; + } else if ( buffer instanceof IntBuffer ) { + glBufferData(target, (IntBuffer)buffer, usage); + size = buffer.remaining() << 2; + } else if ( buffer instanceof FloatBuffer ) { + glBufferData(target, (FloatBuffer)buffer, usage); + size = buffer.remaining() << 2; + } + + disable(); + } + + public final void setData(final int dataSize) { + enable(); + + glBufferData(target, dataSize, usage); + size = dataSize; + + disable(); + } + + public final ByteBuffer map(final int access, final ByteBuffer oldBuffer) { + return glMapBufferOES(target, access, oldBuffer); + } + + public final ByteBuffer map(final int access, final int length, final ByteBuffer oldBuffer) { + return glMapBufferOES(target, access, length, oldBuffer); + } + + public final boolean unmap() { + return glUnmapBufferOES(target); + } + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opengles/util/Geometry.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opengles/util/Geometry.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opengles/util/Geometry.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opengles/util/Geometry.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,78 @@ +package org.lwjgl.test.opengles.util; + +import org.lwjgl.test.opengles.util.BufferObjectArray; + +import java.nio.FloatBuffer; +import java.util.ArrayList; +import java.util.List; + +import static org.lwjgl.opengles.GLES20.*; + +public class Geometry { + + protected BufferObjectArray bo; + + protected final List drawCommands = new ArrayList(4); + + public Geometry() { + } + + public Geometry(final FloatBuffer buffer) { + update(buffer); + } + + public void update(final FloatBuffer buffer) { + if ( bo != null ) + destroy(); + + bo = new BufferObjectArray(GL_STATIC_DRAW, buffer); + } + + public void bind() { + bo.enable(); + } + + public void draw() { + for ( DrawCommand command : drawCommands ) + command.draw(); + } + + public void destroy() { + bo.destroy(); + bo = null; + + drawCommands.clear(); + } + + public int addDrawCommand(final int mode, final int first, final int count) { + drawCommands.add(new DrawCommand(mode, first, count)); + return count; + } + + public static float sin(final float r) { + return (float)Math.sin(r); + } + + public static float cos(final float r) { + return (float)Math.cos(r); + } + + protected static class DrawCommand { + + private int mode; + private int first; + private int count; + + private DrawCommand(final int mode, final int first, final int count) { + this.mode = mode; + this.first = first; + this.count = count; + } + + void draw() { + glDrawArrays(mode, first, count); + } + + } + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opengles/util/GLLight.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opengles/util/GLLight.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opengles/util/GLLight.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opengles/util/GLLight.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,165 @@ +package org.lwjgl.test.opengles.util; + +import static org.lwjgl.opengles.GLES20.*; + +/** Emulates the light state in fixed-function OpenGL. */ +public class GLLight { + + public static final int GL_LIGHT0 = 0x4000; + public static final int GL_LIGHT1 = 0x4001; + public static final int GL_LIGHT2 = 0x4002; + public static final int GL_LIGHT3 = 0x4003; + public static final int GL_LIGHT4 = 0x4004; + public static final int GL_LIGHT5 = 0x4005; + public static final int GL_LIGHT6 = 0x4006; + public static final int GL_LIGHT7 = 0x4007; + + public static final int GL_AMBIENT = 0x1200; + public static final int GL_DIFFUSE = 0x1201; + public static final int GL_SPECULAR = 0x1202; + public static final int GL_POSITION = 0x1203; + public static final int GL_SPOT_DIRECTION = 0x1204; + public static final int GL_SPOT_EXPONENT = 0x1205; + public static final int GL_SPOT_CUTOFF = 0x1206; + public static final int GL_CONSTANT_ATTENUATION = 0x1207; + public static final int GL_LINEAR_ATTENUATION = 0x1208; + public static final int GL_QUADRATIC_ATTENUATION = 0x1209; + + private static final Light[] lights = new Light[8]; + + static { + for ( int i = 0; i < lights.length; i++ ) + lights[i] = new Light(); + + System.arraycopy(new float[] { 1.0f, 1.0f, 1.0f, 1.0f }, 0, lights[0].diffuse, 0, 4); + System.arraycopy(new float[] { 1.0f, 1.0f, 1.0f, 1.0f }, 0, lights[0].specular, 0, 4); + } + + private GLLight() { + } + + public static void glLight(final int light, final int pname, final float v) { + if ( light < GL_LIGHT0 || GL_LIGHT7 < light ) + throw new IllegalArgumentException("Invalid light specified: " + light); + + final Light l = lights[light - GL_LIGHT0]; + + switch ( pname ) { + case GL_SPOT_EXPONENT: + l.s = v; + break; + case GL_SPOT_CUTOFF: + l.c = v; + break; + case GL_CONSTANT_ATTENUATION: + l.k0 = v; + break; + case GL_LINEAR_ATTENUATION: + l.k1 = v; + break; + case GL_QUADRATIC_ATTENUATION: + l.k2 = v; + break; + default: + throw new IllegalArgumentException("Invalid light parameter specified: " + pname); + } + } + + public static void glLight(final int light, final int pname, + final float x, final float y, final float z) { + if ( light < GL_LIGHT0 || GL_LIGHT7 < light ) + throw new IllegalArgumentException("Invalid light specified: " + light); + + if ( pname != GL_SPOT_DIRECTION ) + throw new IllegalArgumentException("Invalid light parameter specified: " + pname); + + final float[] param = lights[light - GL_LIGHT0].direction; + + param[0] = x; + param[1] = y; + param[2] = z; + } + + private static float[] getParam4f(final int light, final int pname) { + if ( light < GL_LIGHT0 || GL_LIGHT7 < light ) + throw new IllegalArgumentException("Invalid light specified: " + light); + + final Light l = lights[light - GL_LIGHT0]; + switch ( pname ) { + case GL_AMBIENT: + return l.ambient; + case GL_DIFFUSE: + return l.diffuse; + case GL_SPECULAR: + return l.specular; + case GL_POSITION: + return l.position; + default: + throw new IllegalArgumentException("Invalid light parameter specified: " + pname); + } + } + + public static void glLight(final int light, final int pname, + final float x, final float y, final float z, final float w) { + final float[] param = getParam4f(light, pname); + param[0] = x; + param[1] = y; + param[2] = z; + param[3] = w; + } + + public static void setUniform1f(final int location, final int light, final int pname) { + if ( light < GL_LIGHT0 || GL_LIGHT7 < light ) + throw new IllegalArgumentException("Invalid light specified: " + light); + + final Light l = lights[light - GL_LIGHT0]; + + switch ( pname ) { + case GL_SPOT_EXPONENT: + glUniform1f(location, l.s); + break; + case GL_SPOT_CUTOFF: + glUniform1f(location, l.c); + break; + case GL_CONSTANT_ATTENUATION: + glUniform1f(location, l.k0); + break; + case GL_LINEAR_ATTENUATION: + glUniform1f(location, l.k1); + break; + case GL_QUADRATIC_ATTENUATION: + glUniform1f(location, l.k2); + break; + default: + throw new IllegalArgumentException("Invalid light parameter specified: " + pname); + } + } + + public static void setUniform3f(final int location, final int light, final int pname) { + if ( pname != GL_SPOT_DIRECTION ) + throw new IllegalArgumentException("Invalid light parameter specified: " + pname); + + final float[] param = lights[light - GL_LIGHT0].direction; + glUniform3f(location, param[0], param[1], param[2]); + } + + public static void setUniform4f(final int location, final int light, final int pname) { + final float[] param = getParam4f(light, pname); + glUniform4f(location, param[0], param[1], param[2], param[3]); + } + + private static class Light { + + float[] ambient = { 0.0f, 0.0f, 0.0f, 1.0f }; + float[] diffuse = { 0.0f, 0.0f, 0.0f, 1.0f }; + float[] specular = { 0.0f, 0.0f, 0.0f, 1.0f }; + + float[] position = { 0.0f, 0.0f, 1.0f, 0.0f }; + float[] direction = { 0.0f, 0.0f, -1.0f }; + + float s, c = 180.0f; + float k0 = 1.0f, k1, k2; + + } + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opengles/util/GLMatrix.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opengles/util/GLMatrix.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opengles/util/GLMatrix.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opengles/util/GLMatrix.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,163 @@ +package org.lwjgl.test.opengles.util; + +import org.lwjgl.util.vector.Matrix4f; +import org.lwjgl.util.vector.Vector3f; + +import java.util.Stack; + +import static java.lang.Math.*; + +/** Emulates the matrix stack in fixed-function OpenGL. */ +public final class GLMatrix { + + public static final int GL_MODELVIEW = 0x1700; + public static final int GL_PROJECTION = 0x1701; + + private static final float PI = (float)Math.PI; + + /** The model/view matrix stack. */ + private static final Stack mvMatrixStack = new Stack(); + + /** The projection matrix stack. */ + private static final Stack pMatrixStack = new Stack(); + + private static final Matrix4f m4f = new Matrix4f(); + private static final Vector3f v3f = new Vector3f(); + + private static int mode = GL_MODELVIEW; + + static { + mvMatrixStack.push(new Matrix4f()); + pMatrixStack.push(new Matrix4f()); + } + + private GLMatrix() { + } + + private static Stack getCurrentStack() { + switch ( mode ) { + case GL_MODELVIEW: + return mvMatrixStack; + case GL_PROJECTION: + return pMatrixStack; + default: + return null; // Cannot happen + } + } + + private static Matrix4f getCurrentMatrix() { + return getCurrentStack().peek(); + } + + public static void glMatrixMode(final int mode) { + if ( mode != GL_MODELVIEW && mode != GL_PROJECTION ) + throw new IllegalArgumentException("Invalid matrix mode specified: " + mode); + + GLMatrix.mode = mode; + } + + public static void glPushMatrix() { + final Stack stack = getCurrentStack(); + stack.push(new Matrix4f(stack.peek())); + } + + public static void glPopMatrix() { + final Stack stack = getCurrentStack(); + + if ( stack.size() == 1 ) + throw new IllegalStateException("The last matrix in the stack cannot be popped."); + + getCurrentStack().pop(); + } + + public static void glLoadIdentity() { + final Matrix4f m = getCurrentMatrix(); + m.setIdentity(); + } + + public static void glLoadMatrix(final Matrix4f s) { + getCurrentMatrix().load(s); + } + + public static void glMultMatrix(final Matrix4f m) { + final Matrix4f c = getCurrentMatrix(); + Matrix4f.mul(c, m, c); + } + + public static void glTranslatef(final float x, final float y, final float z) { + final Matrix4f m = getCurrentMatrix(); + v3f.set(x, y, z); + m.translate(v3f); + } + + public static void glRotatef(final float angle, final float x, final float y, final float z) { + final Matrix4f m = getCurrentMatrix(); + v3f.set(x, y, z); + m.rotate((float)toRadians(angle), v3f); + } + + public static void glOrtho(final float l, final float r, final float b, final float t, final float n, final float f) { + final Matrix4f m = m4f; + m.setIdentity(); + + m.m00 = 2.0f / (r - l); + m.m30 = -(r + l) / (r - l); + + m.m11 = 2.0f / (t - b); + m.m31 = -(t + b) / (t - b); + + m.m22 = -2.0f / (f - n); + m.m32 = -(f + n) / (f - n); + + glMultMatrix(m); + } + + public static void glFrustum(final float l, final float r, final float b, final float t, final float n, final float f) { + final Matrix4f m = m4f; + m.setIdentity(); + + m.m00 = 2.0f * n / (r - l); + m.m20 = (r + l) / (r - l); + + m.m11 = 2.0f * n / (t - b); + m.m21 = (t + b) / (t - b); + + m.m22 = -(f + n) / (f - n); + m.m32 = -(2.0f * f * n) / (f - n); + + m.m23 = -1.0f; + m.m33 = 0.0f; + + glMultMatrix(m); + } + + public static void gluPerspective(final float fovy, final float aspect, final float zNear, final float zFar) { + final float radians = fovy / 2.0f * PI / 180.0f; + + final float deltaZ = zFar - zNear; + final float sine = (float)sin(radians); + + if ( (deltaZ == 0) || (sine == 0) || (aspect == 0) ) { + return; + } + + final float cotangent = (float)cos(radians) / sine; + + final Matrix4f m = m4f; + m.setIdentity(); + + m.m00 = cotangent / aspect; + m.m11 = cotangent; + m.m22 = -(zFar + zNear) / deltaZ; + m.m23 = -1.0f; + m.m32 = -2 * zNear * zFar / deltaZ; + m.m33 = 0.0f; + + glMultMatrix(m); + } + + public static void glGetMatrix(final Matrix4f d) { + d.load(getCurrentMatrix()); + } + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opengles/util/GLObject.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opengles/util/GLObject.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opengles/util/GLObject.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opengles/util/GLObject.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,9 @@ +package org.lwjgl.test.opengles.util; + +public interface GLObject { + + int getID(); + + void destroy(); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opengles/util/ImmediateModeBuffer.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opengles/util/ImmediateModeBuffer.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opengles/util/ImmediateModeBuffer.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opengles/util/ImmediateModeBuffer.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,58 @@ +package org.lwjgl.test.opengles.util; + +import org.lwjgl.BufferUtils; + +import java.nio.FloatBuffer; + +/** + * Utility class that emulates immediate mode vertex data submission. + * Can be used to create VBO data. + */ +public final class ImmediateModeBuffer { + + private FloatBuffer buffer; + + public ImmediateModeBuffer(final int startSize) { + this.buffer = BufferUtils.createFloatBuffer(startSize); + } + + private void checkSize(final int count) { + while ( buffer.remaining() < count ) { + final FloatBuffer newBuffer = BufferUtils.createFloatBuffer(buffer.capacity() << 1); + buffer.flip(); + newBuffer.put(buffer); + buffer = newBuffer; + } + } + + public FloatBuffer getBuffer() { + buffer.flip(); + return buffer; + } + + public void glVertex2f(final float x, final float y) { + checkSize(2); + buffer.put(x).put(y); + } + + public void glVertex3f(final float x, final float y, final float z) { + checkSize(3); + buffer.put(x).put(y).put(z); + } + + public void glVertex4f(final float x, final float y, final float z, final float w) { + checkSize(4); + buffer.put(x).put(y).put(z).put(w); + } + + public void glNormal3f(final float x, final float y, final float z) { + checkSize(3); + buffer.put(x).put(y).put(z); + } + + public void glTexCoord2f(final float s, final float t) { + checkSize(2); + buffer.put(s).put(t); + } + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opengles/util/Shader.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opengles/util/Shader.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opengles/util/Shader.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opengles/util/Shader.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,98 @@ +package org.lwjgl.test.opengles.util; + +import org.lwjgl.BufferUtils; + +import java.io.BufferedInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.nio.ByteBuffer; + +import static org.lwjgl.opengles.GLES20.*; + +public class Shader implements GLObject { + + protected static ByteBuffer fileBuffer = BufferUtils.createByteBuffer(1024 * 10); + + private int type; + private int ID; + + public Shader() { + } + + public Shader(final int type, final CharSequence source) { + createFromSource(type, source); + } + + public int getID() { + return ID; + } + + public int getType() { + return type; + } + + public void destroy() { + if ( ID == 0 ) + throw new IllegalStateException("The shader has not been created"); + + glDeleteShader(ID); + ID = 0; + } + + public void createFromFile(final int type, final ClassLoader loader, final String file) throws IOException { + final InputStream inputStream = loader.getResourceAsStream(file); + + if ( inputStream == null ) + throw new IllegalArgumentException("A shader source file could not be found: " + file); + + final BufferedInputStream stream = new BufferedInputStream(inputStream); + + byte character; + while ( (character = (byte)stream.read()) != -1 ) + fileBuffer.put(character); + fileBuffer.flip(); + + stream.close(); + + final byte[] array = new byte[fileBuffer.remaining()]; + fileBuffer.get(array); + + final String source = new String(array); + + fileBuffer.clear(); + + createFromSource(type, source); + } + + public void createFromSource(final int type, final CharSequence source) { + if ( ID != 0 ) + throw new IllegalStateException("The shader has already been created"); + + this.type = type; + this.ID = glCreateShader(type); + + glShaderSource(ID, source); + + glCompileShader(ID); + + if ( glGetShaderi(ID, GL_COMPILE_STATUS) == GL_FALSE ) { + printInfoLog(); + destroy(); + throw new RuntimeException("A compilation error occured in a shader."); + } + } + + public void printInfoLog() { + if ( ID == 0 ) + throw new IllegalStateException("The shader has not been created"); + + final int logLength = glGetShaderi(ID, GL_INFO_LOG_LENGTH); + if ( logLength <= 1 ) + return; + + System.out.println("\nInfo Log of Shader Object: " + ID); + System.out.println("--------------------------"); + System.out.println(glGetShaderInfoLog(ID, logLength)); + } + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opengles/util/ShaderProgram.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opengles/util/ShaderProgram.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opengles/util/ShaderProgram.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opengles/util/ShaderProgram.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,82 @@ +package org.lwjgl.test.opengles.util; + +import static org.lwjgl.opengles.GLES20.*; + +public class ShaderProgram implements GLObject { + + private final int ID; + + public ShaderProgram(final Shader... shaders) { + this.ID = glCreateProgram(); + + for ( Shader shader : shaders ) + glAttachShader(ID, shader.getID()); + + glLinkProgram(ID); + + if ( glGetProgrami(ID, GL_LINK_STATUS) == GL_FALSE ) { + printInfoLog(); + destroy(); + throw new RuntimeException("Failed to link a Shader Program: " + ID); + } + } + + public void validate() { + glValidateProgram(ID); + + final boolean error = glGetProgrami(ID, GL_VALIDATE_STATUS) == GL_FALSE; + + if ( error ) { + printInfoLog(); + throw new RuntimeException("Failed to validate a Shader Program."); + } + } + + public int getID() { + return ID; + } + + public void destroy() { + glDeleteProgram(ID); + } + + public void enable() { + glUseProgram(ID); + } + + public static void disable() { + glUseProgram(0); + } + + public int getUniformLocation(final String uniform) { + final int location = glGetUniformLocation(ID, uniform); + + if ( location == -1 ) + throw new IllegalArgumentException("Invalid uniform name specified: " + uniform); + + return location; + } + + public int getAttributeLocation(final String attrib) { + final int location = glGetAttribLocation(ID, attrib); + + if ( location == -1 ) + throw new IllegalArgumentException("Invalid attribute name specified: " + attrib); + + return location; + } + + private void printInfoLog() { + final int logLength = glGetProgrami(ID, GL_INFO_LOG_LENGTH); + + System.out.println(logLength); + if ( logLength <= 1 ) + return; + + System.out.println("\nInfo Log of Shader Program: " + ID); + System.out.println("-------------------"); + System.out.println(glGetProgramInfoLog(ID, logLength)); + System.out.println("-------------------"); + } + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opengles/util/Sphere.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opengles/util/Sphere.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/opengles/util/Sphere.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/opengles/util/Sphere.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,414 @@ +package org.lwjgl.test.opengles.util; + +import java.nio.FloatBuffer; +import java.util.ArrayList; +import java.util.List; + +import static org.lwjgl.opengles.GLES20.*; + +/** VBO implementation of GLU Sphere. */ +public final class Sphere { + + /* QuadricNormal */ + public static final int GLU_SMOOTH = 100000; + public static final int GLU_FLAT = 100001; + public static final int GLU_NONE = 100002; + + /* QuadricDrawStyle */ + public static final int GLU_POINT = 100010; + public static final int GLU_LINE = 100011; + public static final int GLU_FILL = 100012; + public static final int GLU_SILHOUETTE = 100013; + + /* QuadricOrientation */ + public static final int GLU_OUTSIDE = 100020; + public static final int GLU_INSIDE = 100021; + + static final float PI = (float)Math.PI; + + private int drawStyle; + private int orientation; + private boolean textureFlag; + private int normals; + + private BufferObjectArray bo; + + private final List drawCommands = new ArrayList(4); + + public Sphere() { + this(GLU_FILL, GLU_OUTSIDE, false, GLU_SMOOTH); + } + + public Sphere(final int drawStyle, final int orientation, final boolean textureFlag, final int normals) { + setDrawStyle(drawStyle); + setOrientation(orientation); + setTextureFlag(textureFlag); + setNormals(normals); + } + + public Sphere(final float radius, final int slices, final int stacks) { + this(); + updateGeometry(radius, slices, stacks); + } + + public Sphere(final float radius, final int slices, final int stacks, + final int drawStyle, final int orientation, final boolean textureFlag, final int normals) { + this(drawStyle, orientation, textureFlag, normals); + updateGeometry(radius, slices, stacks); + } + + public void updateGeometry(final float radius, final int slices, final int stacks) { + if ( bo != null ) + destroy(); + + bo = new BufferObjectArray(GL_STATIC_DRAW, createBuffer(radius, slices, stacks)); + } + + public void bind() { + bo.enable(); + } + + public void draw() { + for ( DrawCommand command : drawCommands ) + command.draw(); + } + + public void destroy() { + bo.destroy(); + bo = null; + + drawCommands.clear(); + } + + /** + * specifies the draw style for quadrics. + *

    + * The legal values are as follows: + *

    + * GLU.FILL: Quadrics are rendered with polygon primitives. The polygons + * are drawn in a counterclockwise fashion with respect to + * their normals (as defined with glu.quadricOrientation). + *

    + * GLU.LINE: Quadrics are rendered as a set of lines. + *

    + * GLU.SILHOUETTE: Quadrics are rendered as a set of lines, except that edges + * separating coplanar faces will not be drawn. + *

    + * GLU.POINT: Quadrics are rendered as a set of points. + * + * @param drawStyle The drawStyle to set + */ + public void setDrawStyle(int drawStyle) { + switch ( drawStyle ) { + case GLU_FILL: + case GLU_LINE: + case GLU_SILHOUETTE: + case GLU_POINT: + break; + default: + throw new IllegalArgumentException("Invalid draw style specified: " + drawStyle); + } + + this.drawStyle = drawStyle; + } + + /** + * specifies what kind of normals are desired for quadrics. + * The legal values are as follows: + *

    + * GLU.NONE: No normals are generated. + *

    + * GLU.FLAT: One normal is generated for every facet of a quadric. + *

    + * GLU.SMOOTH: One normal is generated for every vertex of a quadric. This + * is the default. + * + * @param normals The normals to set + */ + public void setNormals(int normals) { + switch ( normals ) { + case GLU_NONE: + case GLU_FLAT: + case GLU_SMOOTH: + break; + default: + throw new IllegalArgumentException("Invalid normal kind specified: " + normals); + } + + this.normals = normals; + } + + /** + * specifies what kind of orientation is desired for. + * The orientation values are as follows: + *

    + * GLU.OUTSIDE: Quadrics are drawn with normals pointing outward. + *

    + * GLU.INSIDE: Normals point inward. The default is GLU.OUTSIDE. + *

    + * Note that the interpretation of outward and inward depends on the quadric + * being drawn. + * + * @param orientation The orientation to set + */ + public void setOrientation(int orientation) { + if ( orientation != GLU_OUTSIDE && orientation != GLU_INSIDE ) + throw new IllegalArgumentException("Invalid orientation specified: " + orientation); + + this.orientation = orientation; + } + + /** + * specifies if texture coordinates should be generated for + * quadrics rendered with qobj. If the value of textureCoords is true, + * then texture coordinates are generated, and if textureCoords is false, + * they are not.. The default is false. + *

    + * The manner in which texture coordinates are generated depends upon the + * specific quadric rendered. + * + * @param textureFlag The textureFlag to set + */ + public void setTextureFlag(boolean textureFlag) { + this.textureFlag = textureFlag; + } + + /** + * Returns the drawStyle. + * + * @return int + */ + public int getDrawStyle() { + return drawStyle; + } + + /** + * Returns the normals. + * + * @return int + */ + public int getNormals() { + return normals; + } + + /** + * Returns the orientation. + * + * @return int + */ + public int getOrientation() { + return orientation; + } + + /** + * Returns the textureFlag. + * + * @return boolean + */ + public boolean getTextureFlag() { + return textureFlag; + } + + private static float sin(final float r) { + return (float)Math.sin(r); + } + + private static float cos(final float r) { + return (float)Math.cos(r); + } + + private int addDrawCommand(final int mode, final int first, final int count) { + drawCommands.add(new DrawCommand(mode, first, count)); + return count; + } + + /** + * draws a sphere of the given radius centered around the origin. + * The sphere is subdivided around the z axis into slices and along the z axis + * into stacks (similar to lines of longitude and latitude). + *

    + * If the orientation is set to GLU.OUTSIDE (with glu.quadricOrientation), then + * any normals generated point away from the center of the sphere. Otherwise, + * they point toward the center of the sphere. + *

    + * If texturing is turned on (with glu.quadricTexture), then texture + * coordinates are generated so that t ranges from 0.0 at z=-radius to 1.0 at + * z=radius (t increases linearly along longitudinal lines), and s ranges from + * 0.0 at the +y axis, to 0.25 at the +x axis, to 0.5 at the -y axis, to 0.75 + * at the -x axis, and back to 1.0 at the +y axis. + */ + public FloatBuffer createBuffer(float radius, int slices, int stacks) { + float rho, theta; + float x, y, z; + float s, t, ds, dt; + int i, j; + + final boolean normals = this.normals != GLU_NONE; + final float nsign = this.orientation == GLU_INSIDE ? -1.0f : 1.0f; + + final float drho = PI / stacks; + final float dtheta = 2.0f * PI / slices; + + final ImmediateModeBuffer imb = new ImmediateModeBuffer(16 * 1024); // TODO: We can calculate this to avoid re-allocs + int lastDrawIndex = 0; + + if ( this.drawStyle == GLU_FILL ) { + if ( !this.textureFlag ) { + lastDrawIndex += addDrawCommand(GL_TRIANGLE_FAN, lastDrawIndex, slices + 2); + + // draw +Z end as a triangle fan + imb.glNormal3f(0.0f, 0.0f, 1.0f); + imb.glVertex3f(0.0f, 0.0f, nsign * radius); + for ( j = 0; j <= slices; j++ ) { + theta = (j == slices) ? 0.0f : j * dtheta; + x = -sin(theta) * sin(drho); + y = cos(theta) * sin(drho); + z = nsign * cos(drho); + if ( normals ) + imb.glNormal3f(x * nsign, y * nsign, z * nsign); + imb.glVertex3f(x * radius, y * radius, z * radius); + } + } + + ds = 1.0f / slices; + dt = 1.0f / stacks; + t = 1.0f; // because loop now runs from 0 + + final int imin, imax; + if ( this.textureFlag ) { + imin = 0; + imax = stacks; + } else { + imin = 1; + imax = stacks - 1; + } + + // draw intermediate stacks as quad strips + for ( i = imin; i < imax; i++ ) { + lastDrawIndex += addDrawCommand(GL_TRIANGLE_STRIP, lastDrawIndex, (slices + 1) * 2); + + rho = i * drho; + s = 0.0f; + for ( j = 0; j <= slices; j++ ) { + theta = (j == slices) ? 0.0f : j * dtheta; + + x = -sin(theta) * sin(rho); + y = cos(theta) * sin(rho); + z = nsign * cos(rho); + if ( normals ) + imb.glNormal3f(x * nsign, y * nsign, z * nsign); + if ( textureFlag ) + imb.glTexCoord2f(s, t); + imb.glVertex3f(x * radius, y * radius, z * radius); + + x = -sin(theta) * sin(rho + drho); + y = cos(theta) * sin(rho + drho); + z = nsign * cos(rho + drho); + if ( normals ) + imb.glNormal3f(x * nsign, y * nsign, z * nsign); + if ( textureFlag ) + imb.glTexCoord2f(s, t - dt); + s += ds; + imb.glVertex3f(x * radius, y * radius, z * radius); + } + t -= dt; + } + + if ( !this.textureFlag ) { + lastDrawIndex += addDrawCommand(GL_TRIANGLE_FAN, lastDrawIndex, slices + 2); + + // draw -Z end as a triangle fan + imb.glNormal3f(0.0f, 0.0f, -1.0f); + imb.glVertex3f(0.0f, 0.0f, -radius * nsign); + rho = PI - drho; + s = 1.0f; + for ( j = slices; j >= 0; j-- ) { + theta = (j == slices) ? 0.0f : j * dtheta; + x = -sin(theta) * sin(rho); + y = cos(theta) * sin(rho); + z = nsign * cos(rho); + if ( normals ) + imb.glNormal3f(x * nsign, y * nsign, z * nsign); + s -= ds; + imb.glVertex3f(x * radius, y * radius, z * radius); + } + } + } else if ( this.drawStyle == GLU_LINE || this.drawStyle == GLU_SILHOUETTE ) { + // draw stack lines + for ( i = 1; i < stacks; i++ ) { // stack line at i==stacks-1 was missing here + lastDrawIndex += addDrawCommand(GL_LINE_LOOP, lastDrawIndex, slices); + + rho = i * drho; + for ( j = 0; j < slices; j++ ) { + theta = j * dtheta; + x = cos(theta) * sin(rho); + y = sin(theta) * sin(rho); + z = cos(rho); + if ( normals ) + imb.glNormal3f(x * nsign, y * nsign, z * nsign); + imb.glVertex3f(x * radius, y * radius, z * radius); + } + } + // draw slice lines + for ( j = 0; j < slices; j++ ) { + lastDrawIndex += addDrawCommand(GL_LINE_STRIP, lastDrawIndex, stacks + 1); + + theta = j * dtheta; + for ( i = 0; i <= stacks; i++ ) { + rho = i * drho; + x = cos(theta) * sin(rho); + y = sin(theta) * sin(rho); + z = cos(rho); + if ( normals ) + imb.glNormal3f(x * nsign, y * nsign, z * nsign); + imb.glVertex3f(x * radius, y * radius, z * radius); + } + } + } else if ( this.drawStyle == GLU_POINT ) { + lastDrawIndex += addDrawCommand(GL_POINTS, lastDrawIndex, 2 + (stacks - 2) * slices); + + // top and bottom-most points + if ( normals ) + imb.glNormal3f(0.0f, 0.0f, nsign); + imb.glVertex3f(0.0f, 0.0f, radius); + if ( normals ) + imb.glNormal3f(0.0f, 0.0f, -nsign); + imb.glVertex3f(0.0f, 0.0f, -radius); + + // loop over stacks + for ( i = 1; i < stacks - 1; i++ ) { + rho = i * drho; + for ( j = 0; j < slices; j++ ) { + theta = j * dtheta; + x = cos(theta) * sin(rho); + y = sin(theta) * sin(rho); + z = cos(rho); + if ( normals ) + imb.glNormal3f(x * nsign, y * nsign, z * nsign); + imb.glVertex3f(x * radius, y * radius, z * radius); + } + } + } + + return imb.getBuffer(); + } + + private static class DrawCommand { + + private int mode; + private int first; + private int count; + + private DrawCommand(final int mode, final int first, final int count) { + this.mode = mode; + this.first = first; + this.count = count; + } + + void draw() { + glDrawArrays(mode, first, count); + } + + } + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/QuadExample.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/QuadExample.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/QuadExample.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/QuadExample.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,90 @@ +package org.lwjgl.test; + +import org.lwjgl.LWJGLException; +import org.lwjgl.input.Keyboard; +import org.lwjgl.input.Mouse; +import org.lwjgl.opengl.Display; +import org.lwjgl.opengl.DisplayMode; +import org.lwjgl.opengl.GL11; + +import static org.lwjgl.opengl.GL11.*; + +public class QuadExample { + + public void start() { + try { + Display.setDisplayMode(new DisplayMode(800,600)); + Display.setResizable(true); + Display.setVSyncEnabled(true); + Display.create(); + } catch (LWJGLException e) { + e.printStackTrace(); + System.exit(0); + } + + // init OpenGL + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glOrtho(0, 800, 0, 600, 1, -1); + glMatrixMode(GL_MODELVIEW); + + Mouse.setGrabbed(true); + + while (!Display.isCloseRequested()) { + + Display.sync(30); + + this.updateMouseVars(); + + while ( Keyboard.next() ) { + if ( Keyboard.getEventKeyState() == false && Keyboard.getEventKey() == Keyboard.KEY_G ) + Mouse.setGrabbed(!Mouse.isGrabbed()); + } + + // Clear the screen and depth buffer + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + + // set the color of the quad (R,G,B,A) + glColor3f(0.5f, 0.5f, 1.0f); + + // draw quad + glBegin(GL_QUADS); + glVertex2f(mouseDx, mouseDy); + glVertex2f(200 + mouseDx, mouseDy); + glVertex2f(200 + mouseDx, 200 + mouseDy); + glVertex2f(mouseDx, 200 + mouseDy); + glEnd(); + + Display.update(); + } + + Display.destroy(); + } + + int mouseDx = 0; + int mouseDy = 0; + + public void updateMouseVars(){ + + int localMouseDx = 0; + int localMouseDy = 0; + + int c= 0; + while(Mouse.next()){ + + localMouseDx += Mouse.getEventDX(); + localMouseDy += Mouse.getEventDY(); + c++; + + } + + mouseDx += localMouseDx; + mouseDy += localMouseDy; + + } + + public static void main(String[] argv) { + QuadExample quadExample = new QuadExample(); + quadExample.start(); + } +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/ShiftTest.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/ShiftTest.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/ShiftTest.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/ShiftTest.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,52 @@ +package org.lwjgl.test; + +import org.lwjgl.input.Keyboard; +import org.lwjgl.input.Mouse; +import org.lwjgl.opengl.Display; +import org.lwjgl.opengl.DisplayMode; +import org.lwjgl.opengl.PixelFormat; + +public class ShiftTest { + + public static final int SCREEN_WIDTH = 640; + public static final int SCREEN_HEIGHT = 480; + + public static void main(String[] args) throws Exception { + setDisplayMode(); + Display.setTitle("Shift Test"); + Display.setFullscreen(false); + Display.setVSyncEnabled(true); + Display.create(new PixelFormat(32, 0, 24, 8, 0)); + Mouse.setGrabbed(false); + + boolean lcurr = false; + boolean rcurr = false; + while ( true ) { + + boolean lShiftDown = Keyboard.isKeyDown(Keyboard.KEY_LSHIFT); + boolean rShiftDown = Keyboard.isKeyDown(Keyboard.KEY_RSHIFT); + + if ( lcurr != lShiftDown || rcurr != rShiftDown ) { + System.out.println(String.format("LShift: %b\tRShift: %b", lShiftDown, rShiftDown)); + lcurr = lShiftDown; + rcurr = rShiftDown; + } + + if ( Display.isCloseRequested() || Keyboard.isKeyDown(Keyboard.KEY_ESCAPE) ) { + break; + } + Display.processMessages(); + Display.sync(60); + } + } + + private static void setDisplayMode() throws Exception { + DisplayMode[] dm = org.lwjgl.util.Display.getAvailableDisplayModes(SCREEN_WIDTH, SCREEN_HEIGHT, -1, -1, -1, -1, 60, 60); + org.lwjgl.util.Display.setDisplayMode(dm, new String[] { + "width=" + SCREEN_WIDTH, + "height=" + SCREEN_HEIGHT, + "freq=" + 60, + "bpp=" + org.lwjgl.opengl.Display.getDisplayMode().getBitsPerPixel() + }); + } +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/SignatureList.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/SignatureList.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/SignatureList.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/SignatureList.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,67 @@ +package org.lwjgl.test; + +import org.lwjgl.opengl.GL11; + +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; + +public class SignatureList { + + public SignatureList() { + } + + public static void main(String[] args) { + Class clazz = GL11.class; + + final Method[] methods = clazz.getMethods(); + + List sortedMethods = new ArrayList(methods.length); + for ( final Method m : methods ) { + sortedMethods.add(m); + } + + Collections.sort(sortedMethods, new Comparator() { + public int compare(final Method o1, final Method o2) { + int cmp = o1.getName().compareTo(o2.getName()); + if ( cmp != 0 ) + return cmp; + + final Class[] params1 = o1.getParameterTypes(); + final Class[] params2 = o2.getParameterTypes(); + + cmp = Integer.compare(params1.length, params2.length); + if ( cmp != 0 ) return cmp; + + for ( int i = 0; i < params1.length; i++ ) { + if ( params1[i] != params2[i] ) + return params1[i].getSimpleName().compareTo(params2[i].getSimpleName()); + } + + return 0; + } + }); + + for ( final Method m : sortedMethods ) { + if ( !m.getName().startsWith("gl") ) + continue; + + Class[] params = m.getParameterTypes(); + + System.out.print(m.getName() + "("); + + boolean first = true; + for ( final Class p : params ) { + if ( first ) + first = false; + else + System.out.print(", "); + System.out.print(p.getSimpleName()); + } + System.out.println(")"); + } + } + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/SysTest.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/SysTest.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/SysTest.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/SysTest.java 2016-04-09 16:26:56.000000000 +0000 @@ -41,8 +41,8 @@ * Test class for Sys * * @author Brian Matzon - * @version $Revision: 2983 $ - * $Id: SysTest.java 2983 2008-04-07 18:36:09Z matzon $ + * @version $Revision$ + * $Id$ */ public class SysTest { diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/Test_glGetVertexAttribPointer_API_bug.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/Test_glGetVertexAttribPointer_API_bug.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/Test_glGetVertexAttribPointer_API_bug.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/Test_glGetVertexAttribPointer_API_bug.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,186 @@ +package org.lwjgl.test; + +import org.lwjgl.BufferUtils; +import org.lwjgl.LWJGLException; +import org.lwjgl.PointerBuffer; +import org.lwjgl.opengl.Display; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL15; +import org.lwjgl.opengl.GL20; + +import static org.lwjgl.opengl.GL11.*; +import static org.lwjgl.opengl.GL43.*; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.nio.Buffer; +import java.nio.ByteBuffer; +import java.security.PrivilegedActionException; + +/** + * glGetVertexAttribPointer() is coded incorrectly. Any use of the buffer + * returned by glGetVertexAttribPointer() results in a JVM crash (SIGSEGV), + * because LWJGL is returning an offset as a DirectByteBuffer whose address is + * typically in the first page of memory. glGetVertexAttribPointer() should + * return a long, not a ByteBuffer. + *

    + *

    + * The spec for glVertexAttribPointer says: + *

    + * pointer + *

      + *
    • + * Specifies a offset of the first component of the first generic vertex + * attribute in the array in the data store of the buffer currently bound to the + * GL_ARRAY_BUFFER target. The initial value is 0.
    • + *
    + * Emphasis mine. This is an offset into the VBO, not a native pointer. + *

    + *

    + * Now look at glGetVertexAttribPointerv, which says: + *

      + *
    • The pointer returned is a byte offset into the data store of the + * buffer object that was bound to the GL_ARRAY_BUFFER target (see glBindBuffer) + * when the desired pointer was previously specified.
    • + *
    + * Emphasis mine again. The spec clearly intends this to be an offset, not a + * pointer. + */ +public class Test_glGetVertexAttribPointer_API_bug { + + static boolean crashJvm = "true".equals(System.getProperty("crashJvm", + "false")); + + static final int FLOAT_BYTES = 4; + + static class Attr { + + final String name; + final int index; + final int size; + final int offset; + + Attr(String name, int index, int size, + int offset) { + this.name = name; + this.index = index; + this.size = size; + this.offset = offset; + } + + long getByteOffset() { + return offset * FLOAT_BYTES; + } + } + + static class AttrGen { + + int offset = 0; + + Attr allocAttr(String name, int index, int size) { + Attr result = new Attr(name, index, size, offset); + offset += size; + return result; + } + } + + static AttrGen gen = new AttrGen(); + static final Attr position = gen.allocAttr("position", 1, 3); + static final Attr normal = gen.allocAttr("normal", 2, 3); + static final Attr textureCoordinates = gen.allocAttr("textureCoordinates", + 3, 2); + static final int stride = gen.offset; + static final int strideBytes = stride * FLOAT_BYTES; + + static final Attr[] attributes = { position, normal, textureCoordinates }; + + /** Hack to call BufferUtils.getBufferAddress() */ + static long getBufferAddress(ByteBuffer buf) + throws SecurityException, NoSuchMethodException, + IllegalArgumentException, IllegalAccessException, + InvocationTargetException { + Method m = BufferUtils.class.getDeclaredMethod( + "getBufferAddress", Buffer.class); + if ( !m.isAccessible() ) + m.setAccessible(true); + return (Long)m.invoke(null, buf); + } + + static long glGetVertexAttribPointer(int index) + throws NoSuchMethodException, IllegalAccessException, + InvocationTargetException { + int result_size = PointerBuffer.getPointerSize(); + //ByteBuffer buf = GL20.glGetVertexAttribPointer(index, GL20.GL_VERTEX_ATTRIB_ARRAY_POINTER, result_size); + + ByteBuffer buf = BufferUtils.createByteBuffer(PointerBuffer.getPointerSize()); + + GL20.glGetVertexAttribPointer(index, GL20.GL_VERTEX_ATTRIB_ARRAY_POINTER, buf); + + /*if ( buf == null ) + return 0; + + long bufferAddress = getBufferAddress(buf); + if ( crashJvm ) { + *//* + * This crashes the JVM with a SIGSEGV because it tries to + * dereference something that was never intended to be a pointer. + * It's an offset (e.g. 12). + *//* + System.out + .println("Dereferencing " + + bufferAddress + + " (this will probably crash the JVM with a SIGSEGV) ... "); + buf.get(0); + } +*/ + + long bufferAddress = buf.getLong(0); + System.out.println(index + " bufferAddress = " + bufferAddress); + + return bufferAddress; + } + + public static void main(String[] args) throws LWJGLException, + SecurityException, NoSuchMethodException, IllegalArgumentException, + IllegalAccessException, InvocationTargetException, + PrivilegedActionException { + Display.create(); + + /* + * Note: it's not necessary to call glBufferData(); the functions + * involved are only concerned with data layout. + */ + + int vbo = GL15.glGenBuffers(); + GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, vbo); + + for ( Attr attr : attributes ) { + GL20.glEnableVertexAttribArray(attr.index); + long posPointer = glGetVertexAttribPointer(attr.index); + if ( posPointer != 0 ) + throw new AssertionError(); + GL20.glVertexAttribPointer(attr.index, attr.size, GL11.GL_FLOAT, + false, strideBytes, attr.getByteOffset()); + } + + for ( Attr attr : attributes ) { + long posPointer = glGetVertexAttribPointer(attr.index); + /* this proves that value returned is the offset */ + if ( posPointer != attr.getByteOffset() ) + throw new AssertionError("this will never happen"); + System.out.println(attr.name + ": offset = " + posPointer); + } + + if ( !crashJvm ) { + System.out + .println("Test passed, but try running again with -DcrashJvm=true."); + } else { + System.out + .println("You won't ever get this far with LWJGL 2.8.5 or 2.9.0"); + } + } +} diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/Test.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/Test.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/test/Test.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/test/Test.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,36 @@ +package org.lwjgl.test; + +import java.awt.Canvas; +import java.awt.Dimension; + +import javax.swing.JFrame; + +import org.lwjgl.input.Keyboard; +import org.lwjgl.input.Mouse; +import org.lwjgl.opengl.Display; +import org.lwjgl.opengl.GL11; + +public class Test { + public static void main(String[] args) throws Exception { + Canvas canvas = new Canvas(); + JFrame frame = new JFrame("Test"); + frame.add(canvas); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + frame.setSize(new Dimension(640, 480)); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + + Display.setParent(canvas); + Display.setVSyncEnabled(true); + Display.create(); + while ( !Display.isCloseRequested() ) { + GL11.glClear(GL11.GL_COLOR_BUFFER_BIT); + Display.update(); + // Press and release ALT on Windows, the printing stops until you press a key or click. + //System.out.println(Mouse.getX() + ", " + Mouse.getY() + " - " +System.currentTimeMillis()); + while ( Keyboard.next() ) { + System.out.println(Keyboard.getKeyName(Keyboard.getEventKey()) + " - " +Keyboard.getEventKeyState()); + } + } + } +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/applet/AppletLoader.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/applet/AppletLoader.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/applet/AppletLoader.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/applet/AppletLoader.java 2016-04-09 16:26:56.000000000 +0000 @@ -31,6 +31,8 @@ */ package org.lwjgl.util.applet; +import org.lwjgl.LWJGLUtil; + import java.applet.Applet; import java.applet.AppletStub; import java.awt.BorderLayout; @@ -41,8 +43,7 @@ import java.awt.Image; import java.awt.MediaTracker; import java.awt.image.ImageObserver; -import java.io.DataInputStream; -import java.io.DataOutputStream; +import java.io.BufferedInputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; @@ -57,7 +58,6 @@ import java.io.Writer; import java.lang.reflect.Constructor; import java.lang.reflect.Field; -import java.lang.reflect.Method; import java.net.HttpURLConnection; import java.net.JarURLConnection; import java.net.SocketPermission; @@ -66,22 +66,31 @@ import java.net.URLConnection; import java.security.AccessControlException; import java.security.AccessController; +import java.security.AllPermission; import java.security.CodeSource; import java.security.PermissionCollection; +import java.security.Permissions; import java.security.PrivilegedExceptionAction; -import java.security.SecureClassLoader; import java.security.cert.Certificate; import java.util.Enumeration; import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.Queue; import java.util.StringTokenizer; import java.util.Vector; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; import java.util.jar.JarEntry; import java.util.jar.JarFile; import java.util.jar.JarOutputStream; import java.util.jar.Pack200; +import java.util.zip.CRC32; +import java.util.zip.CheckedInputStream; import java.util.zip.GZIPInputStream; - -import sun.security.util.SecurityConstants; +import java.util.zip.ZipEntry; +import java.util.zip.ZipFile; /** *

    @@ -97,79 +106,114 @@ * The following applet parameters are required: *

      *
    • al_main - [String] Full package and class the applet to instantiate and display when loaded.
    • - *
    • al_logo - [String Path of of the logo resource to paint while loading.
    • - *
    • al_progressbar - [String] Path of the progressbar resource to paint on top of the logo, width clipped by percentage.
    • - *
    • al_jars - [String] Comma seperated list of jars to download.
    • + *
    • al_jars - [String] Comma separated list of jars to download.
    • + *

      *

    • al_windows - [String] Jar containing native files for windows.
    • *
    • al_linux - [String] Jar containing native files for linux.
    • *
    • al_mac - [String] Jar containing native files for mac.
    • *
    • al_solaris - [String] Jar containing native files for solaris.
    • *
    • al_freebsd - [String] Jar containing native files for freebsd.
    • + *
    • al_openbsd - [String] Jar containing native files for openbsd.
    • *
    *

    *

    * Additionally the following parameters can be supplied to tweak the behaviour of the AppletLoader. *

      + *
    • al_cache - [boolean] Whether to use cache system. Default: true.
    • *
    • al_version - [int or float] Version of deployment. If this is specified, the jars will be cached and * reused if the version matches. If version doesn't match all of the files are reloaded.
    • - *
    • al_cache - [boolean] Whether to use cache system. Default: true.
    • + * *
    • al_debug - [boolean] Whether to enable debug mode. Default: false.
    • - *
    • al_prepend_host - [boolean] Whether to limit caching to this domain, disable if your applet is hosted on multple domains and needs to share the cache. Default: true.
    • - *
        + *
      • al_min_jre - [String] Specify the minimum jre version that the applet requires, should be in format like 1.6.0_24 or a subset like 1.6 Default: 1.5.
      • + *
      • al_prepend_host - [boolean] Whether to limit caching to this domain, disable if your applet is hosted on multiple domains and needs to share the cache. Default: true.
      • + *
      • al_lookup_threads - [int] Specify the number of concurrent threads to use to get file information before downloading. Default: 1.
      • + *

        *

      • al_windows64 - [String] If specified it will be used instead of al_windows on 64bit windows systems.
      • - *
      • al_windows32 - [String] If specifed it will be used instead of al_windows on 32bit windows systems.
      • - *
      • al_linux64 - [String] If specifed it will be used instead of al_linux on 64bit linux systems.
      • - *
      • al_linux32 - [String] If specifed it will be used instead of al_linux on 32bit linux systems.
      • - *
          + *
        • al_windows32 - [String] If specified it will be used instead of al_windows on 32bit windows systems.
        • + *
        • al_linux64 - [String] If specified it will be used instead of al_linux on 64bit linux systems.
        • + *
        • al_linux32 - [String] If specified it will be used instead of al_linux on 32bit linux systems.
        • + *
        • al_mac32 - [String] If specified it will be used instead of al_mac on 64bit mac systems.
        • + *
        • al_mac64 - [String] If specified it will be used instead of al_mac on 32bit mac systems.
        • + *
        • al_macppc - [String] If specified it will be used instead of al_mac on PPC mac systems.
        • + *

          *

        • boxbgcolor - [String] any String AWT color ("red", "blue", etc), RGB (0-255) or hex formated color (#RRGGBB) to use as background. Default: #ffffff.
        • *
        • boxfgcolor - [String] any String AWT color ("red", "blue", etc), RGB (0-255) or hex formated color (#RRGGBB) to use as foreground. Default: #000000.
        • + *

          + *

        • al_logo - [String Path of of the logo resource to paint while loading.Default: "appletlogo.gif".
        • + *
        • al_progressbar - [String] Path of the progressbar resource to paint on top of the logo, width clipped by percentage.Default: "appletprogress.gif".
        • + *

          + *

        • lwjgl_arguments -
        • [String] used to pass LWJGL parameters to LWJGL e.g. ("-Dorg.lwjgl.input.Mouse.allowNegativeMouseCoords=true -Dorg.lwjgl.util.Debug=true"). *
        *

        - * @author kappaOne + * @author kappaOne * @author Brian Matzon * @version $Revision$ * $Id$ + * + * Contributors: + *
          + *
        • Arielsan
        • + *
        • Bobjob
        • + *
        • Dashiva
        • + *
        • Dr_evil
        • + *
        • Elias Naur
        • + *
        • Kevin Glass
        • + *
        • Matthias Mann
        • + *
        • Mickelukas
        • + *
        • NateS
        • + *
        • Pelle Johnsen
        • + *
        • Riven
        • + *
        • Ruben01
        • + *
        • Shannon Smith
        • + *
        + * */ public class AppletLoader extends Applet implements Runnable, AppletStub { /** initializing */ public static final int STATE_INIT = 1; + + /** checking version of jre */ + public static final int STATE_CHECK_JRE_VERSION = 2; /** determining which packages that are required */ - public static final int STATE_DETERMINING_PACKAGES = 2; + public static final int STATE_DETERMINING_PACKAGES = 3; /** checking for already downloaded files */ - public static final int STATE_CHECKING_CACHE = 3; + public static final int STATE_CHECKING_CACHE = 4; + + /** checking if any updates are available for cache files */ + public static final int STATE_CHECKING_FOR_UPDATES = 5; /** downloading packages */ - public static final int STATE_DOWNLOADING = 4; + public static final int STATE_DOWNLOADING = 6; /** extracting packages */ - public static final int STATE_EXTRACTING_PACKAGES = 5; + public static final int STATE_EXTRACTING_PACKAGES = 7; + + /** validating packages */ + public static final int STATE_VALIDATING_PACKAGES = 8; /** updating the classpath */ - public static final int STATE_UPDATING_CLASSPATH = 6; + public static final int STATE_UPDATING_CLASSPATH = 9; /** switching to real applet */ - public static final int STATE_SWITCHING_APPLET = 7; + public static final int STATE_SWITCHING_APPLET = 10; /** initializing real applet */ - public static final int STATE_INITIALIZE_REAL_APPLET = 8; + public static final int STATE_INITIALIZE_REAL_APPLET = 11; /** stating real applet */ - public static final int STATE_START_REAL_APPLET = 9; + public static final int STATE_START_REAL_APPLET = 12; /** done */ - public static final int STATE_DONE = 10; + public static final int STATE_DONE = 13; /** used to calculate length of progress bar */ - protected int percentage; - - /** current size of download in bytes */ - protected int currentSizeDownload; + protected volatile int percentage; /** total size of download in bytes */ - protected int totalSizeDownload; + protected int totalDownloadSize; /** current size of extracted in bytes */ protected int currentSizeExtract; @@ -210,9 +254,6 @@ /** applet to load after all downloads are complete */ protected Applet lwjglApplet; - /** whether a fatal error occured */ - protected boolean fatalError; - /** whether we're running in debug mode */ protected boolean debugMode; @@ -242,23 +283,49 @@ /** whether pack200 is supported */ protected boolean pack200Supported; + + /** whether to run in headless mode */ + protected boolean headless = false; + + /** whether to switch applets in headless mode or wait longer */ + protected boolean headlessWaiting = true; + + /** messages to be passed via liveconnect in headless mode */ + protected String[] headlessMessage; + + /** threads to use when fetching information of files to be downloaded */ + protected int concurrentLookupThreads; + + /** whether a fatal error occurred */ + protected boolean fatalError; + + /** whether a certificate refused error occurred */ + protected boolean certificateRefused; + + /** whether the minimum required JRE version is not found */ + protected boolean minimumJreNotFound; /** generic error message to display on error */ protected String[] genericErrorMessage = { "An error occured while loading the applet.", "Please contact support to resolve this issue.", ""}; - /** whether a certificate refused error occured */ - protected boolean certificateRefused; - - /** error message to display if user refuses to accept certicate*/ + /** error message to display if user refuses to accept certificate*/ protected String[] certificateRefusedMessage = { "Permissions for Applet Refused.", "Please accept the permissions dialog to allow", "the applet to continue the loading process."}; - + + /** error message to display if minimum JRE version is not met */ + protected String[] minimumJREMessage = { "Your version of Java is out of date.", + "Visit java.com to get the latest version.", + "Java or greater is required."}; + + /** fatal error message to display */ + protected String[] errorMessage; + /** have natives been loaded by another instance of this applet */ protected static boolean natives_loaded; - + /* * @see java.applet.Applet#init() */ @@ -266,14 +333,14 @@ setState(STATE_INIT); // sanity check - String[] requiredArgs = {"al_main", "al_logo", "al_progressbar", "al_jars"}; + String[] requiredArgs = {"al_main", "al_jars"}; for ( String requiredArg : requiredArgs ) { if ( getParameter(requiredArg) == null ) { fatalErrorOccured("missing required applet parameter: " + requiredArg, null); return; } } - + // whether to use cache system cacheEnabled = getBooleanParameter("al_cache", true); @@ -283,17 +350,21 @@ // whether to prepend host to cache path prependHost = getBooleanParameter("al_prepend_host", true); + // whether to run in headless mode + headless = getBooleanParameter("al_headless", false); + + // obtain the number of concurrent lookup threads to use + concurrentLookupThreads = getIntParameter("al_lookup_threads", 1); // defaults to 1 + // get colors of applet bgColor = getColor("boxbgcolor", Color.white); setBackground(bgColor); fgColor = getColor("boxfgcolor", Color.black); - // load logos, if value is "" then skip - if (getParameter("al_logo").length() > 0) { - logo = getImage(getParameter("al_logo")); - } - if (getParameter("al_progressbar").length() > 0) { - progressbar = getImage(getParameter("al_progressbar")); + if (!headless) { + // load logos + logo = getImage(getStringParameter("al_logo", "appletlogo.gif")); + progressbar = getImage(getStringParameter("al_progressbar", "appletprogress.gif")); } // check for lzma support @@ -338,17 +409,19 @@ loaderThread.setName("AppletLoader.loaderThread"); loaderThread.start(); - animationThread = new Thread() { - public void run() { - while(loaderThread != null) { - repaint(); - AppletLoader.this.sleep(100); + if (!headless) { + animationThread = new Thread() { + public void run() { + while(loaderThread != null) { + repaint(); + AppletLoader.this.sleep(100); + } + animationThread = null; } - animationThread = null; - } - }; - animationThread.setName("AppletLoader.animationthread"); - animationThread.start(); + }; + animationThread.setName("AppletLoader.animationthread"); + animationThread.start(); + } } } } @@ -392,6 +465,51 @@ } /** + * Retrieves the current status of the AppletLoader and is + * used by liveconnect when running in headless mode. + * + * This method will return the current progress of the AppletLoader + * as a value from 0-100. In the case of a fatal error it will + * return -1. If the certificate is refused it will return -2. + * If the minimum jre requirement is not met will return -3. + * + * When method returns 100 the AppletLoader will sleep until the + * method is called again. When called again it will switch to the + * LWJGL Applet. This is a useful trigger to start the LWJGL applet + * when needed. + */ + public int getStatus() { + if (fatalError) { + headlessMessage = errorMessage; + + if (certificateRefused) return -2; + if (minimumJreNotFound) return -3; + return -1; + } + + if (percentage == 100 && headlessWaiting) { + headlessWaiting = false; + } + + if (percentage == 95) { + percentage = 100; // ready to switch applet + } + + String[] message = {getDescriptionForState(), subtaskMessage}; + headlessMessage = message; + + return percentage; + } + + /** + * Retrieves the current message for the current status. + * Used by liveconnect when running in headless mode. + */ + public String[] getMessages() { + return headlessMessage; + } + + /** * Transfers the call of AppletResize from the stub to the lwjglApplet. */ public void appletResize(int width, int height) { @@ -414,6 +532,9 @@ cleanUp(); // clean up resources return; } + + // no drawing in headless mode + if (headless) return; // create offscreen if missing if (offscreen == null) { @@ -446,12 +567,9 @@ og.fillRect(0, 0, offscreen.getWidth(null), offscreen.getHeight(null)); og.setColor(fgColor); - String message = getDescriptionForState(); - + // if we had a failure of some sort, notify the user if (fatalError) { - String[] errorMessage = (certificateRefused) ? certificateRefusedMessage : genericErrorMessage; - for(int i=0; i() { - public String run() throws Exception { - - // we append the code base to avoid naming collisions with al_title - String codebase = ""; - if(prependHost) { - codebase = getCodeBase().getHost(); - if(codebase == null || codebase.length() == 0) { - codebase = "localhost"; - } - codebase += File.separator; - } - return getCacheDir() + File.separator + codebase + getParameter("al_title") + File.separator; - } - }); + // get path where applet files will be stored + String path = getCacheDirectory(); File dir = new File(path); @@ -720,28 +857,12 @@ // if specified applet version already available don't download anything boolean versionAvailable = false; - // version of applet + // version string of applet String version = getParameter("al_version"); - float latestVersion = 0; - // if applet version specifed, check if you have latest version of applet + // if applet version specifed, compare with version in the cache if (version != null) { - - latestVersion = Float.parseFloat(version); - - // if version file exists - if (versionFile.exists()) { - // compare to new version - if (latestVersion != readVersionFile(versionFile)) { - versionAvailable = true; - percentage = 90; - - if(debugMode) { - System.out.println("Loading Cached Applet Version " + latestVersion); - } - debug_sleep(2000); - } - } + versionAvailable = compareVersion(versionFile, version.toLowerCase()); } // if jars not available or need updating download them @@ -756,16 +877,19 @@ extractJars(path); // 55-65% // Extracts Native Files - extractNatives(path); // 65-85% + extractNatives(path); // 65-80% + + // Validate Jars // 80-90% + validateJars(path); // save version information once jars downloaded successfully if (version != null) { percentage = 90; - writeVersionFile(versionFile, latestVersion); + writeObjectFile(versionFile, version.toLowerCase()); } // save file names with last modified info once downloaded successfully - writeCacheFile(new File(dir, "cache"), filesLastModified); + writeObjectFile(new File(dir, "timestamps"), filesLastModified); } // add the downloaded jars and natives to classpath @@ -774,7 +898,14 @@ // set lwjgl properties setLWJGLProperties(); - // make applet switch on EDT as an AWT/Swing permission dialog could be called + // if headless mode then sleep, until told to continue + if (headless) { + while(headlessWaiting) { + Thread.sleep(100); + } + } + + // make applet switch on the EDT as an AWT/Swing permission dialog could be called EventQueue.invokeAndWait(new Runnable() { public void run() { try { @@ -787,10 +918,8 @@ } }); - } catch (AccessControlException ace) { - fatalErrorOccured(ace.getMessage(), ace); - certificateRefused = true; } catch (Exception e) { + certificateRefused = e instanceof AccessControlException; fatalErrorOccured("This occurred while '" + getDescriptionForState() + "'", e); } finally { loaderThread = null; @@ -798,6 +927,86 @@ } /** + * When this method is supplied with a JRE version it will compare it to the + * current JRE version. + * + * minimum requried JRE version is set using al_min_jre parameter, if not + * this is not set then the value will default to version 1.5 + * + * The minimumVersion should follow a structure such as x.x.x_x + * Example values would include 1.6.0_10 or a subset like 1.6.0 or 1.6 + * + * @return returns true if the available version is greater or equal to the + * minimum version required + * + * @throws Exception a NumberFormatException is thrown if the string is not valid + */ + public boolean isMinJREVersionAvailable() throws Exception { + setState(STATE_CHECK_JRE_VERSION); + + String minimumVersion = getStringParameter("al_min_jre", "1.5"); + String javaVersion = System.getProperty("java.version"); + + // remove dash and anything after it (letters) from version string e.g. 1.5.0_01-ea + minimumVersion = javaVersion.split("-")[0]; + javaVersion = minimumVersion.split("-")[0]; + + // split version string into a string arrays + String[] jvmVersionData = javaVersion.split("[_\\.]"); + String[] minVersionData = minimumVersion.split("[_\\.]"); + + int maxLength = Math.max(jvmVersionData.length, minVersionData.length); + + // convert string arrays into int arrays + int[] jvmVersion = new int[maxLength]; + int[] minVersion = new int[maxLength]; + + for (int i = 0; i < jvmVersionData.length; i++) { + jvmVersion[i] = Integer.parseInt(jvmVersionData[i]); + } + + for (int i = 0; i < minVersionData.length; i++) { + minVersion[i] = Integer.parseInt(minVersionData[i]); + } + + // compare versions + for (int i = 0; i < maxLength; i++) { + if (jvmVersion[i] < minVersion[i]) return false; // minVersion is greater then jvmVersion + } + + return true; + } + + /** + * This method will return true if the version stored in the file + * matches the supplied String version. + * + * @param versionFile - location to file containing version information + * @param version - String version that needs to be compared + * @return returns true if the version in file matches specified version + */ + protected boolean compareVersion(File versionFile, String version) { + // if version file exists + if (versionFile.exists()) { + String s = readStringFile(versionFile); + + // compare to version with file + if (s != null && s.equals(version)) { + percentage = 90; // not need to download cache files again + + if(debugMode) { + System.out.println("Loading Cached Applet Version: " + version); + } + debug_sleep(2000); + + return true; // version matches file + } + } + + return false; + } + + /** * Parses the java_arguments list and sets lwjgl specific * properties accordingly, before the launch. */ @@ -822,11 +1031,43 @@ } /** - * get path to the lwjgl cache directory + * This method will return the location of the cache directory. All the + * applet files will be downloaded and stored here. A folder will be + * created inside the LWJGL cache directory from the al_title parameter. + * This folder will also be prepended by the host name of the codebase + * to avoid conflict with same named applets on other hosts. + * + * @return path to applets cache directory + * @throws Exception if access is denied + */ + protected String getCacheDirectory() throws Exception { + + String path = AccessController.doPrivileged(new PrivilegedExceptionAction() { + public String run() throws Exception { + + // we append the code base to avoid naming collisions with al_title + String codebase = ""; + if(prependHost) { + codebase = getCodeBase().getHost(); + if(codebase == null || codebase.length() == 0) { + codebase = "localhost"; + } + codebase += File.separator; + } + return getLWJGLCacheDir() + File.separator + codebase + getParameter("al_title") + File.separator; + } + }); + + return path; + } + + /** + * Get path to the lwjgl cache directory. This location will be where + * the OS keeps temporary files. * * @return path to the lwjgl cache directory */ - protected String getCacheDir() { + protected String getLWJGLCacheDir() { String cacheDir = System.getProperty("deployment.user.cachedir"); if (cacheDir == null || System.getProperty("os.name").startsWith("Win")) { @@ -837,58 +1078,82 @@ } /** - * read the current version file + * read String object from File * - * @param file the file to read - * @return the version value of saved file - * @throws Exception if it fails to read value + * @param file to be read + * @return the String stored in the file or null if it fails */ - protected float readVersionFile(File file) throws Exception { - DataInputStream dis = new DataInputStream(new FileInputStream(file)); - float version = dis.readFloat(); - dis.close(); - return version; + protected String readStringFile(File file) { + try { + return (String)readObjectFile(file); + } catch (Exception e) { + // failed to read version file + e.printStackTrace(); + } + + // return null if failed to read file + return null; } - + /** - * write out version file of applet + * read the HashMap from File * - * @param file the file to write out to - * @param version the version of the applet as a float - * @throws Exception if it fails to write file + * @param file the file to read + * @return the hashmap stored in the file or an empty hashmap if it fails */ - protected void writeVersionFile(File file, float version) throws Exception { - DataOutputStream dos = new DataOutputStream(new FileOutputStream(file)); - dos.writeFloat(version); - dos.close(); + @SuppressWarnings("unchecked") + protected HashMap readHashMapFile(File file) { + + try { + return (HashMap) readObjectFile(file); + } catch (Exception e) { + // failed to read hashmap from file + e.printStackTrace(); + } + + // return an empty map if failed to read file + return new HashMap(); } - + /** - * read the current cache file - * + * read the object from the File + * * @param file the file to read - * @return the hashmap containing the files names and lastModified times - * @throws Exception if it fails to read hashmap + * @return the object contained in the file or null if it fails + * @throws Exception if it fails to read object from file */ - @SuppressWarnings("unchecked") - protected HashMap readCacheFile(File file) throws Exception { - ObjectInputStream dis = new ObjectInputStream(new FileInputStream(file)); - HashMap hashMap = (HashMap)dis.readObject(); - dis.close(); - return hashMap; + protected Object readObjectFile(File file) throws Exception { + FileInputStream fis = new FileInputStream(file); + + try { + ObjectInputStream dis = new ObjectInputStream(fis); + Object object = dis.readObject(); + dis.close(); + return object; + } catch (Exception e) { + // failed to read file + throw e; + } finally { + fis.close(); + } } - + /** - * write out cache file of applet + * write object to specified File * * @param file the file to write out to - * @param filesLastModified the hashmap containing files names and lastModified times + * @param object the contents of the file * @throws Exception if it fails to write file */ - protected void writeCacheFile(File file, HashMap filesLastModified) throws Exception { - ObjectOutputStream dos = new ObjectOutputStream(new FileOutputStream(file)); - dos.writeObject(filesLastModified); - dos.close(); + protected void writeObjectFile(File file, Object object) throws Exception { + FileOutputStream fos = new FileOutputStream(file); + try { + ObjectOutputStream dos = new ObjectOutputStream(fos); + dos.writeObject(object); + dos.close(); + } finally { + fos.close(); + } } /** @@ -908,30 +1173,43 @@ URL[] urls = new URL[urlList.length]; for (int i = 0; i < urlList.length; i++) { - urls[i] = new URL("file:" + path + getJarName(urlList[i])); + String file = new File(path, getJarName(urlList[i])).toURI().toString(); + // fix JVM bug where ! is not escaped + file = file.replace("!", "%21"); + urls[i] = new URL(file); } - + + // get AppletLoader certificates + final Certificate[] certs = getCurrentCertificates(); + + // detect if we are running on a mac and save result as boolean + String osName = System.getProperty("os.name"); + final boolean isMacOS = (osName.startsWith("Mac") || osName.startsWith("Darwin")); + // add downloaded jars to the classpath with required permissions classLoader = new URLClassLoader(urls) { protected PermissionCollection getPermissions (CodeSource codesource) { PermissionCollection perms = null; try { - // getPermissions from original classloader is important as it checks for signed jars and shows any security dialogs needed - Method method = SecureClassLoader.class.getDeclaredMethod("getPermissions", new Class[] { CodeSource.class }); - method.setAccessible(true); - perms = (PermissionCollection)method.invoke(getClass().getClassLoader(), new Object[] {codesource}); + // no permissions + perms = new Permissions(); - String host = getCodeBase().getHost(); + // if certificates match the AppletLoader certificates then we should be all set + if (certificatesMatch(certs, codesource.getCertificates())) { + perms.add(new AllPermission()); + return perms; + } + String host = getCodeBase().getHost(); if (host != null && (host.length() > 0)) { // add permission for downloaded jars to access host they were from - perms.add(new SocketPermission(host, SecurityConstants.SOCKET_CONNECT_ACCEPT_ACTION)); + perms.add(new SocketPermission(host, "connect,accept")); } else if ( "file".equals(codesource.getLocation().getProtocol()) ) { // if running locally add file permission String path = codesource.getLocation().getFile().replace('/', File.separatorChar); - perms.add(new FilePermission(path, SecurityConstants.FILE_READ_ACTION)); + perms.add(new FilePermission(path, "read")); } } catch (Exception e) { @@ -943,7 +1221,13 @@ // allow non lwjgl native to be found from cache directory protected String findLibrary (String libname) { - return path + "natives" + File.separator + System.mapLibraryName(libname); + String libPath = path + "natives" + File.separator + LWJGLUtil.mapLibraryName(libname); + + if (new File(libPath).exists()) { + return libPath; + } + + return super.findLibrary(libname); } }; @@ -1023,7 +1307,10 @@ percentage = 100; debug_sleep(2000); - + + // set correct context classloader for lwjgl applet + Thread.currentThread().setContextClassLoader(classLoader); + Class appletClass = classLoader.loadClass(getParameter("al_main")); lwjglApplet = (Applet) appletClass.newInstance(); @@ -1052,55 +1339,92 @@ * @throws Exception - if fails to get infomation */ protected void getJarInfo(File dir) throws Exception { - + setState(STATE_CHECKING_CACHE); + filesLastModified = new HashMap(); // store file sizes and mark which files not to download fileSizes = new int[urlList.length]; - URLConnection urlconnection; - - File cacheFile = new File(dir, "cache"); + File timestampsFile = new File(dir, "timestamps"); - // if cache file exists, load it - if (cacheFile.exists()) { - filesLastModified = readCacheFile(cacheFile); + // if timestamps file exists, load it + if (timestampsFile.exists()) { + setState(STATE_CHECKING_FOR_UPDATES); + filesLastModified = readHashMapFile(timestampsFile); } // calculate total size of jars to download - for (int i = 0; i < urlList.length; i++) { - urlconnection = urlList[i].openConnection(); - urlconnection.setDefaultUseCaches(false); - if (urlconnection instanceof HttpURLConnection) { - ((HttpURLConnection) urlconnection).setRequestMethod("HEAD"); - } - - fileSizes[i] = urlconnection.getContentLength(); - - long lastModified = urlconnection.getLastModified(); - String fileName = getFileName(urlList[i]); + + ExecutorService executorService = Executors.newFixedThreadPool(concurrentLookupThreads); + Queue requests = new LinkedList(); + + // create unique object to sync code in requests + final Object sync = new Integer(1); + + for (int j = 0; j < urlList.length; j++) { + final int i = j; + + Future request = executorService.submit(new Runnable() { + + public void run() { + + try { + + URLConnection urlconnection = urlList[i].openConnection(); + urlconnection.setDefaultUseCaches(false); + if (urlconnection instanceof HttpURLConnection) { + ((HttpURLConnection) urlconnection).setRequestMethod("HEAD"); + } + + fileSizes[i] = urlconnection.getContentLength(); + long lastModified = urlconnection.getLastModified(); + String fileName = getFileName(urlList[i]); - if (cacheEnabled && lastModified != 0 && - filesLastModified.containsKey(fileName)) { - long savedLastModified = filesLastModified.get(fileName); + if (cacheEnabled && lastModified != 0 && filesLastModified.containsKey(fileName)) { + long savedLastModified = filesLastModified.get(fileName); - // if lastModifed time is the same, don't redownload - if (savedLastModified == lastModified) { - fileSizes[i] = -2; // mark it to not redownload - } - } + // if lastModifed time is the same, don't redownload + if (savedLastModified == lastModified) { + fileSizes[i] = -2; // mark it to not redownload + } + } + + if (fileSizes[i] >= 0) { + synchronized (sync) { + totalDownloadSize += fileSizes[i]; + } + } - if (fileSizes[i] >= 0) { - totalSizeDownload += fileSizes[i]; + // put key and value in the hashmap + filesLastModified.put(fileName, lastModified); + + } catch (Exception e) { + throw new RuntimeException("Failed to fetch information for " + urlList[i], e); + } + }}); + + requests.add(request); + } + + while (!requests.isEmpty()) { + Iterator iterator = requests.iterator(); + while (iterator.hasNext()) { + Future request = iterator.next(); + if (request.isDone()) { + request.get(); // will throw an exception if request thrown an exception. + iterator.remove(); + + // update progress bar + percentage = 5 + (int) (10 * (urlList.length - requests.size()) / (float) urlList.length); + } } - - // put key and value in the hashmap - filesLastModified.put(fileName, lastModified); - - // update progress bar - percentage = 5 + (int)(10 * i/(float)urlList.length); + + Thread.sleep(10); } + + executorService.shutdown(); } /** @@ -1111,12 +1435,12 @@ * @throws Exception if download fails */ protected void downloadJars(String path) throws Exception { - setState(STATE_DOWNLOADING); URLConnection urlconnection; int initialPercentage = percentage = 15; + int amountDownloaded = 0; // download each jar byte buffer[] = new byte[65536]; @@ -1128,83 +1452,105 @@ int unsuccessfulAttempts = 0; int maxUnsuccessfulAttempts = 3; boolean downloadFile = true; + + String currentFile = getFileName(urlList[i]); // download the jar a max of 3 times while(downloadFile) { downloadFile = false; debug_sleep(2000); - - urlconnection = urlList[i].openConnection(); - - if (urlconnection instanceof HttpURLConnection) { - urlconnection.setRequestProperty("Cache-Control", "no-cache"); - urlconnection.connect(); - } - - String currentFile = getFileName(urlList[i]); - InputStream inputstream = getJarInputStream(currentFile, urlconnection); - FileOutputStream fos = new FileOutputStream(path + currentFile); - - - int bufferSize; - long downloadStartTime = System.currentTimeMillis(); - int downloadedAmount = 0; - int fileSize = 0; - String downloadSpeedMessage = ""; - - while ((bufferSize = inputstream.read(buffer, 0, buffer.length)) != -1) { - debug_sleep(10); - fos.write(buffer, 0, bufferSize); - currentSizeDownload += bufferSize; - fileSize += bufferSize; - percentage = initialPercentage + ((currentSizeDownload * 45) / totalSizeDownload); - subtaskMessage = "Retrieving: " + currentFile + " " + ((currentSizeDownload * 100) / totalSizeDownload) + "%"; - - downloadedAmount += bufferSize; - long timeLapse = System.currentTimeMillis() - downloadStartTime; - // update only if a second or more has passed - if (timeLapse >= 1000) { - // get kb/s, nice that bytes/millis is same as kilobytes/seconds - float downloadSpeed = (float) downloadedAmount / timeLapse; - // round to two decimal places - downloadSpeed = ((int)(downloadSpeed*100))/100f; - // set current speed message - downloadSpeedMessage = " - " + downloadSpeed + " KB/sec"; - // reset downloaded amount - downloadedAmount = 0; - // reset start time - downloadStartTime = System.currentTimeMillis(); + + try { + urlconnection = urlList[i].openConnection(); + urlconnection.setUseCaches(false); + + if (urlconnection instanceof HttpURLConnection) { + urlconnection.setRequestProperty("Cache-Control", "no-store,max-age=0,no-cache"); + urlconnection.connect(); + } + + + InputStream inputstream = getJarInputStream(currentFile, urlconnection); + FileOutputStream fos = new FileOutputStream(path + currentFile); + + + int bufferSize; + int currentDownload = 0; + + long downloadStartTime = System.currentTimeMillis(); + int downloadedAmount = 0; + String downloadSpeedMessage = ""; + + try { + while ((bufferSize = inputstream.read(buffer, 0, buffer.length)) != -1) { + debug_sleep(10); + fos.write(buffer, 0, bufferSize); + currentDownload += bufferSize; + + int totalDownloaded = amountDownloaded + currentDownload; + percentage = initialPercentage + ((totalDownloaded * 45) / totalDownloadSize); + subtaskMessage = "Retrieving: " + currentFile + " " + ((totalDownloaded * 100) / totalDownloadSize) + "%"; + + downloadedAmount += bufferSize; + long timeLapse = System.currentTimeMillis() - downloadStartTime; + // update only if a second or more has passed + if (timeLapse >= 1000) { + // get kb/s, nice that bytes/millis is same as kilobytes/seconds + float downloadSpeed = (float) downloadedAmount / timeLapse; + // round to two decimal places + downloadSpeed = ((int)(downloadSpeed*100))/100f; + // set current speed message + downloadSpeedMessage = " - " + downloadSpeed + " KB/sec"; + // reset downloaded amount + downloadedAmount = 0; + // reset start time + downloadStartTime = System.currentTimeMillis(); + } + + subtaskMessage += downloadSpeedMessage; + } + + } finally { + inputstream.close(); + fos.close(); } - - subtaskMessage += downloadSpeedMessage; + + // download complete, verify if it was successful + if (urlconnection instanceof HttpURLConnection) { + if (currentDownload == fileSizes[i]) { + // successful download + } + else if (fileSizes[i] <= 0 && currentDownload != 0) { + // If contentLength for fileSizes[i] <= 0, we don't know if the download + // is complete. We're going to guess the download is complete. + } + else { + throw new Exception("size mismatch on download of " + currentFile + + " expected " + fileSizes[i] + " got " + currentDownload); + } + } + + // successful file download, update total amount downloaded + amountDownloaded += fileSizes[i]; + + } catch (Exception e) { + e.printStackTrace(); // output exception to console + + // Failed to download the file + unsuccessfulAttempts++; + + // download failed try again + if (unsuccessfulAttempts < maxUnsuccessfulAttempts) { + downloadFile = true; + Thread.sleep(100); // wait a bit before retrying + } + else { + // retry attempts exhasted, download failed + throw new Exception("failed to download " + currentFile + + " after " + maxUnsuccessfulAttempts + " attempts"); + } } - - inputstream.close(); - fos.close(); - - // download complete, verify if it was successful - if (urlconnection instanceof HttpURLConnection) { - if (fileSize == fileSizes[i]) { - // successful download - } - else if (fileSizes[i] <= 0) { - // If contentLength for fileSizes[i] <= 0, we don't know if the download - // is complete. We're going to guess the download is complete. - } - else { - unsuccessfulAttempts++; - // download failed try again - if (unsuccessfulAttempts < maxUnsuccessfulAttempts) { - downloadFile = true; - currentSizeDownload -= fileSize; // reset progress bar - } - else { - // retry attempts exhasted, download failed - throw new Exception("failed to download " + currentFile); - } - } - } } } subtaskMessage = ""; @@ -1276,23 +1622,21 @@ Constructor constructor = clazz.getDeclaredConstructor(InputStream.class); InputStream inputHandle = (InputStream) constructor.newInstance(fileInputHandle); - OutputStream outputHandle; - outputHandle = new FileOutputStream(out); + OutputStream outputHandle = new FileOutputStream(out); byte [] buffer = new byte [1<<14]; - int ret = inputHandle.read(buffer); - while (ret >= 1) { - outputHandle.write(buffer,0,ret); - ret = inputHandle.read(buffer); + try { + int ret = inputHandle.read(buffer); + while (ret >= 1) { + outputHandle.write(buffer,0,ret); + ret = inputHandle.read(buffer); + } + } finally { + inputHandle.close(); + outputHandle.close(); } - inputHandle.close(); - outputHandle.close(); - - outputHandle = null; - inputHandle = null; - // delete LZMA file, as it is no longer needed f.delete(); } @@ -1310,23 +1654,21 @@ InputStream inputHandle = new GZIPInputStream(fileInputHandle); - OutputStream outputHandle; - outputHandle = new FileOutputStream(out); - - byte [] buffer = new byte [1<<14]; + OutputStream outputHandle = new FileOutputStream(out); - int ret = inputHandle.read(buffer); - while (ret >= 1) { - outputHandle.write(buffer,0,ret); - ret = inputHandle.read(buffer); + try { + byte [] buffer = new byte [1<<14]; + + int ret = inputHandle.read(buffer); + while (ret >= 1) { + outputHandle.write(buffer,0,ret); + ret = inputHandle.read(buffer); + } + } finally { + inputHandle.close(); + outputHandle.close(); } - inputHandle.close(); - outputHandle.close(); - - outputHandle = null; - inputHandle = null; - // delete GZip file, as it is no longer needed f.delete(); } @@ -1341,10 +1683,14 @@ File f = new File(in); FileOutputStream fostream = new FileOutputStream(out); JarOutputStream jostream = new JarOutputStream(fostream); - - Pack200.Unpacker unpacker = Pack200.newUnpacker(); - unpacker.unpack(f, jostream); - jostream.close(); + + try { + Pack200.Unpacker unpacker = Pack200.newUnpacker(); + unpacker.unpack(f, jostream); + } finally { + jostream.close(); + fostream.close(); + } // delete pack file as its no longer needed f.delete(); @@ -1370,37 +1716,37 @@ String filename = getFileName(urlList[i]); if (filename.endsWith(".pack.lzma")) { - subtaskMessage = "Extracting: " + filename + " to " + filename.replaceAll(".lzma", ""); + subtaskMessage = "Extracting: " + filename + " to " + replaceLast(filename, ".lzma", ""); debug_sleep(1000); - extractLZMA(path + filename, path + filename.replaceAll(".lzma", "")); + extractLZMA(path + filename, path + replaceLast(filename, ".lzma", "")); - subtaskMessage = "Extracting: " + filename.replaceAll(".lzma", "") + " to " + filename.replaceAll(".pack.lzma", ""); + subtaskMessage = "Extracting: " + replaceLast(filename, ".lzma", "") + " to " + replaceLast(filename, ".pack.lzma", ""); debug_sleep(1000); - extractPack(path + filename.replaceAll(".lzma", ""), path + filename.replaceAll(".pack.lzma", "")); + extractPack(path + replaceLast(filename, ".lzma", ""), path + replaceLast(filename, ".pack.lzma", "")); } else if (filename.endsWith(".pack.gz")) { - subtaskMessage = "Extracting: " + filename + " to " + filename.replaceAll(".gz", ""); + subtaskMessage = "Extracting: " + filename + " to " + replaceLast(filename, ".gz", ""); debug_sleep(1000); - extractGZip(path + filename, path + filename.replaceAll(".gz", "")); + extractGZip(path + filename, path + replaceLast(filename, ".gz", "")); - subtaskMessage = "Extracting: " + filename.replaceAll(".gz", "") + " to " + filename.replaceAll(".pack.gz", ""); + subtaskMessage = "Extracting: " + replaceLast(filename, ".gz", "") + " to " + replaceLast(filename, ".pack.gz", ""); debug_sleep(1000); - extractPack(path + filename.replaceAll(".gz", ""), path + filename.replaceAll(".pack.gz", "")); + extractPack(path + replaceLast(filename, ".gz", ""), path + replaceLast(filename, ".pack.gz", "")); } else if (filename.endsWith(".pack")) { - subtaskMessage = "Extracting: " + filename + " to " + filename.replace(".pack", ""); + subtaskMessage = "Extracting: " + filename + " to " + replaceLast(filename, ".pack", ""); debug_sleep(1000); - extractPack(path + filename, path + filename.replace(".pack", "")); + extractPack(path + filename, path + replaceLast(filename, ".pack", "")); } else if (filename.endsWith(".lzma")) { - subtaskMessage = "Extracting: " + filename + " to " + filename.replace(".lzma", ""); + subtaskMessage = "Extracting: " + filename + " to " + replaceLast(filename, ".lzma", ""); debug_sleep(1000); - extractLZMA(path + filename, path + filename.replace(".lzma", "")); + extractLZMA(path + filename, path + replaceLast(filename, ".lzma", "")); } else if (filename.endsWith(".gz")) { - subtaskMessage = "Extracting: " + filename + " to " + filename.replace(".gz", ""); + subtaskMessage = "Extracting: " + filename + " to " + replaceLast(filename, ".gz", ""); debug_sleep(1000); - extractGZip(path + filename, path + filename.replace(".gz", "")); + extractGZip(path + filename, path + replaceLast(filename, ".gz", "")); } } } @@ -1417,7 +1763,7 @@ setState(STATE_EXTRACTING_PACKAGES); - float percentageParts = 20f/nativeJarCount; // parts for each native jar from 20% + float percentageParts = 15f/nativeJarCount; // parts for each native jar from 15% // create native folder File nativeFolder = new File(path + "natives"); @@ -1425,18 +1771,8 @@ nativeFolder.mkdir(); } - // get the current certificate to compare against native files - Certificate[] certificate = AppletLoader.class.getProtectionDomain().getCodeSource().getCertificates(); - - // workaround for bug where cached applet loader does not have certificates!? - if (certificate == null) { - URL location = AppletLoader.class.getProtectionDomain().getCodeSource().getLocation(); - - // manually load the certificate - JarURLConnection jurl = (JarURLConnection) (new URL("jar:" + location.toString() + "!/org/lwjgl/util/applet/AppletLoader.class").openConnection()); - jurl.setDefaultUseCaches(true); - certificate = jurl.getCertificates(); - } + // get the current AppletLoader certificates to compare against certificates of the native files + Certificate[] certificate = getCurrentCertificates(); for (int i = urlList.length - nativeJarCount; i < urlList.length; i++) { @@ -1498,24 +1834,29 @@ InputStream in = jarFile.getInputStream(jarFile.getEntry(entry.getName())); OutputStream out = new FileOutputStream(path + "natives" + File.separator + entry.getName()); - int bufferSize; - byte buffer[] = new byte[65536]; - - while ((bufferSize = in.read(buffer, 0, buffer.length)) != -1) { - debug_sleep(10); - out.write(buffer, 0, bufferSize); - currentSizeExtract += bufferSize; - - // update progress bar - percentage = 65 + (int)(percentageParts * (jarNum + currentSizeExtract/(float)totalSizeExtract)); - subtaskMessage = "Extracting: " + entry.getName() + " " + ((currentSizeExtract * 100) / totalSizeExtract) + "%"; + try { + int bufferSize; + byte buffer[] = new byte[65536]; + + while ((bufferSize = in.read(buffer, 0, buffer.length)) != -1) { + debug_sleep(10); + out.write(buffer, 0, bufferSize); + currentSizeExtract += bufferSize; + + // update progress bar + percentage = 65 + (int)(percentageParts * (jarNum + currentSizeExtract/(float)totalSizeExtract)); + subtaskMessage = "Extracting: " + entry.getName() + " " + ((currentSizeExtract * 100) / totalSizeExtract) + "%"; + } + } finally { + in.close(); + out.close(); + } + + // validate the certificate for the native file being extracted + if (!certificatesMatch(certificate, entry.getCertificates())) { + f.delete(); // delete extracted native as its certificates doesn't match + throw new Exception("The certificate(s) in " + nativeJar + " do not match the AppletLoader!"); } - - // validate if the certificate for native file is correct - validateCertificateChain(certificate, entry.getCertificates()); - - in.close(); - out.close(); } subtaskMessage = ""; @@ -1529,22 +1870,133 @@ } /** - * Validates the certificate chain for a single file + * Compare two certificate chains to see if they match * - * @param ownCerts Chain of certificates to check against - * @param native_certs Chain of certificates to check + * @param certs1 first chain of certificates + * @param certs2 second chain of certificates + * + * @return true if the certificate chains are the same */ - protected static void validateCertificateChain(Certificate[] ownCerts, Certificate[] native_certs) throws Exception { - if (native_certs == null) - throw new Exception("Unable to validate certificate chain. Native entry did not have a certificate chain at all"); - - if (ownCerts.length != native_certs.length) - throw new Exception("Unable to validate certificate chain. Chain differs in length [" + ownCerts.length + " vs " + native_certs.length + "]"); + protected static boolean certificatesMatch(Certificate[] certs1, Certificate[] certs2) throws Exception { + if (certs1 == null || certs2 == null) { + return false; + } + + if (certs1.length != certs2.length) { + System.out.println("Certificate chain differs in length [" + certs1.length + " vs " + certs2.length + "]!"); + return false; + } + + for (int i = 0; i < certs1.length; i++) { + if (!certs1[i].equals(certs2[i])) { + System.out.println("Certificate mismatch found!"); + return false; + } + } + + return true; + } + + /** + * Returns the current certificate chain of the AppletLoader + * + * @return - certificate chain of AppletLoader + */ + protected static Certificate[] getCurrentCertificates() throws Exception { + // get the current certificate to compare against native files + Certificate[] certificate = AppletLoader.class.getProtectionDomain().getCodeSource().getCertificates(); + + // workaround for bug where cached applet loader does not have certificates!? + if (certificate == null) { + URL location = AppletLoader.class.getProtectionDomain().getCodeSource().getLocation(); - for (int i = 0; i < ownCerts.length; i++) { - if (!ownCerts[i].equals(native_certs[i])) { - throw new Exception("Certificate mismatch: " + ownCerts[i] + " != " + native_certs[i]); + // manually load the certificate + JarURLConnection jurl = (JarURLConnection) (new URL("jar:" + location.toString() + "!/org/lwjgl/util/applet/AppletLoader.class").openConnection()); + jurl.setDefaultUseCaches(true); + certificate = jurl.getCertificates(); + jurl.setDefaultUseCaches(false); + } + + return certificate; + } + + /** + * Check and validate jars which will be loaded into the classloader to make + * sure that they are not corrupt. This ensures corrupt files are never marked + * as successful downloadeds by the cache system. + * + * @param path - where the jars are stored + * @throws Exception if a corrupt jar is found + */ + protected void validateJars(String path) throws Exception { + + setState(STATE_VALIDATING_PACKAGES); + + percentage = 80; + + float percentageParts = 10f / urlList.length; // percentage for each file out of 10% + + for (int i = 0; i < urlList.length - nativeJarCount; i++) { + + debug_sleep(1000); + + // if file not downloaded, no need to validate again + if (fileSizes[i] == -2) continue; + + subtaskMessage = "Validating: " + getJarName(urlList[i]); + + File file = new File(path, getJarName(urlList[i])); + if (!isZipValid(file)) { + throw new Exception("The file " + getJarName(urlList[i]) + " is corrupt!"); } + + percentage = 80 + (int)(percentageParts * i); + } + + subtaskMessage = ""; + } + + /** + * This method will check if a zip file is valid by running through it + * and checking for any corruption and CRC failures + * + * @param file - zip file to test + * @return boolean - runs false if the file is corrupt + */ + protected boolean isZipValid(File file) { + + try { + ZipFile zipFile = new ZipFile(file); + + try { + Enumeration e = zipFile.entries(); + + byte[] buffer = new byte[4096]; + + while(e.hasMoreElements()) { + ZipEntry zipEntry = (ZipEntry) e.nextElement(); + + CRC32 crc = new CRC32(); + + BufferedInputStream bis = new BufferedInputStream(zipFile.getInputStream(zipEntry)); + CheckedInputStream cis = new CheckedInputStream(bis, crc); + + while(cis.read(buffer, 0, buffer.length) != -1) { + // scroll through zip entry + } + + if (crc.getValue() != zipEntry.getCrc()) { + return false; // CRC match failed, corrupt zip + } + } + + return true; // valid zip file + } finally { + zipFile.close(); + } + } catch (IOException e) { + e.printStackTrace(); + return false; } } @@ -1556,6 +2008,9 @@ */ protected Image getImage(String s) { + // if s is "" then don't load an image + if (s.length() == 0) return null; + Image image = null; try { @@ -1575,7 +2030,7 @@ } // show error as image could not be loaded - fatalErrorOccured("Unable to load logo and progressbar images", null); + fatalErrorOccured("Unable to load the logo/progressbar image: " + s, null); return null; } @@ -1587,11 +2042,12 @@ */ public Image getImage(URL url) { try { + MediaTracker tracker = new MediaTracker(this); + Image image = super.getImage(url); // wait for image to load - MediaTracker tracker = new MediaTracker(this); - tracker.addImage(image, 0); + tracker.addImage(image, 0); tracker.waitForAll(); // if no errors return image @@ -1615,15 +2071,15 @@ String fileName = url.getFile(); if (fileName.endsWith(".pack.lzma")) { - fileName = fileName.replaceAll(".pack.lzma", ""); + fileName = replaceLast(fileName, ".pack.lzma", ""); } else if (fileName.endsWith(".pack.gz")) { - fileName = fileName.replaceAll(".pack.gz", ""); + fileName = replaceLast(fileName, ".pack.gz", ""); } else if (fileName.endsWith(".pack")) { - fileName = fileName.replaceAll(".pack", ""); + fileName = replaceLast(fileName, ".pack", ""); } else if (fileName.endsWith(".lzma")) { - fileName = fileName.replaceAll(".lzma", ""); + fileName = replaceLast(fileName, ".lzma", ""); } else if (fileName.endsWith(".gz")) { - fileName = fileName.replaceAll(".gz", ""); + fileName = replaceLast(fileName, ".gz", ""); } return fileName.substring(fileName.lastIndexOf('/') + 1); @@ -1681,29 +2137,88 @@ return defaultColor; } } + + /** + * Replaces the last occurrence of the specified target substring with + * the specified replacement string in a string. + * + * @param original - String to search + * @param target - substring to find + * @param replacement - what to replace target substring with + * @return - return the modified string, if target substring not found return original string + */ + public String replaceLast(String original, String target, String replacement) { + int index = original.lastIndexOf(target); + + if(index == -1) { + return original; + } + + return original.substring(0, index) + replacement + original.substring(index + target.length()); + } + + /** + * Retrieves the String value for the parameter + * @param name Name of parameter + * @param defaultValue default value to return if no such parameter + * @return value of parameter or defaultValue + */ + protected String getStringParameter(String name, String defaultValue) { + String parameter = getParameter(name); + if (parameter != null) { + return parameter; + } + return defaultValue; + } /** - * Retrieves the boolean value for the applet + * Retrieves the boolean value for the parameter * @param name Name of parameter * @param defaultValue default value to return if no such parameter * @return value of parameter or defaultValue */ protected boolean getBooleanParameter(String name, boolean defaultValue) { String parameter = getParameter(name); - if(parameter != null) { + if (parameter != null) { return Boolean.parseBoolean(parameter); } return defaultValue; } + + /** + * Retrieves the int value for the applet + * @param name Name of parameter + * @param defaultValue default value to return if no such parameter + * @return value of parameter or defaultValue + */ + protected int getIntParameter(String name, int defaultValue) { + String parameter = getParameter(name); + if (parameter != null) { + return Integer.parseInt(parameter); + } + return defaultValue; + } /** - * Sets the state of the loaded and prints some debug information + * Sets the error message and print debug information * * @param error Error message to print */ protected void fatalErrorOccured(String error, Exception e) { fatalError = true; - genericErrorMessage[genericErrorMessage.length-1] = error; + + if (minimumJreNotFound) { + errorMessage = minimumJREMessage; + errorMessage[errorMessage.length-1] = error; + } + else if (certificateRefused) { + errorMessage = certificateRefusedMessage; + } + else { + errorMessage = genericErrorMessage; + errorMessage[errorMessage.length-1] = error; + } + System.out.println(error); if(e != null) { System.out.println(e.getMessage()); @@ -1714,7 +2229,7 @@ /** * set the state of applet loader - * @param new state of applet loader + * @param state new state of applet loader * */ protected void setState(int state) { this.state = state; @@ -1746,4 +2261,4 @@ } } -} \ No newline at end of file +} diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/Color.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/Color.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/Color.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/Color.java 2016-04-09 16:26:56.000000000 +0000 @@ -35,9 +35,9 @@ /** * A mutable Color class - * @author $Author: matzon $ - * @version $Revision: 2983 $ - * $Id: Color.java 2983 2008-04-07 18:36:09Z matzon $ + * @author $Author$ + * @version $Revision$ + * $Id$ */ public final class Color implements ReadableColor, Serializable, WritableColor { diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/Dimension.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/Dimension.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/Dimension.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/Dimension.java 2016-04-09 16:26:56.000000000 +0000 @@ -35,9 +35,9 @@ /** * A 2D integer Dimension class, which looks remarkably like an AWT one. - * @author $Author: matzon $ - * @version $Revision: 2983 $ - * $Id: Dimension.java 2983 2008-04-07 18:36:09Z matzon $ + * @author $Author$ + * @version $Revision$ + * $Id$ */ public final class Dimension implements Serializable, ReadableDimension, WritableDimension { diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/Display.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/Display.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/Display.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/Display.java 2016-04-09 16:26:56.000000000 +0000 @@ -42,9 +42,9 @@ /** * Display initialization utility, that can be used to find display modes and pick * one for you based on your criteria. - * @author $Author: spasi $ - * @version $Revision: 3418 $ - * $Id: Display.java 3418 2010-09-28 21:11:35Z spasi $ + * @author $Author$ + * @version $Revision$ + * $Id$ */ public final class Display { diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/Auto.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/Auto.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/Auto.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/Auto.java 2016-04-09 16:26:56.000000000 +0000 @@ -36,8 +36,8 @@ * AutoType and AutoSize is annotated with @Auto. * * @author elias_naur - * @version $Revision: 2983 $ - * $Id: Auto.java 2983 2008-04-07 18:36:09Z matzon $ + * @version $Revision$ + * $Id$ */ import java.lang.annotation.Target; diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/AutoSize.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/AutoSize.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/AutoSize.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/AutoSize.java 2016-04-09 16:26:56.000000000 +0000 @@ -37,8 +37,8 @@ * according to the remaining() of a Buffer parameter. * * @author elias_naur - * @version $Revision: 3412 $ - * $Id: AutoSize.java 3412 2010-09-26 23:43:24Z spasi $ + * @version $Revision$ + * $Id$ */ import java.lang.annotation.Target; @@ -49,6 +49,7 @@ public @interface AutoSize { String value(); // The name of the Buffer parameter String expression() default ""; // This value is added after the argument + boolean useExpression() default false; // When this is true, the expression result will be used directly. boolean canBeNull() default false; // When this is true and the Buffer parameter is null, 0 will be used. boolean isNative() default false; // When this is true, auto-sizing will be performed in native code. } diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/AutoType.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/AutoType.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/AutoType.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/AutoType.java 2016-04-09 16:26:56.000000000 +0000 @@ -37,8 +37,8 @@ * to the type of a Buffer parameter. * * @author elias_naur - * @version $Revision: 2983 $ - * $Id: AutoType.java 2983 2008-04-07 18:36:09Z matzon $ + * @version $Revision$ + * $Id$ */ import java.lang.annotation.Target; diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/BufferKind.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/BufferKind.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/BufferKind.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/BufferKind.java 2016-04-09 16:26:56.000000000 +0000 @@ -34,8 +34,8 @@ /** * * @author elias_naur - * @version $Revision: 3279 $ - * $Id: BufferKind.java 3279 2010-03-11 21:06:49Z spasi $ + * @version $Revision$ + * $Id$ */ public enum BufferKind { diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/BufferObject.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/BufferObject.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/BufferObject.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/BufferObject.java 2016-04-09 16:26:56.000000000 +0000 @@ -37,8 +37,8 @@ * integer VBO/PBO offset. * * @author elias_naur - * @version $Revision: 2983 $ - * $Id: BufferObject.java 2983 2008-04-07 18:36:09Z matzon $ + * @version $Revision$ + * $Id$ */ import java.lang.annotation.Target; diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/CachedReference.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/CachedReference.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/CachedReference.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/CachedReference.java 2016-04-09 16:26:56.000000000 +0000 @@ -37,8 +37,8 @@ * OpenGL. * * @author elias_naur - * @version $Revision: 2983 $ - * $Id: CachedReference.java 2983 2008-04-07 18:36:09Z matzon $ + * @version $Revision$ + * $Id$ */ import java.lang.annotation.Target; diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/CachedResult.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/CachedResult.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/CachedResult.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/CachedResult.java 2016-04-09 16:26:56.000000000 +0000 @@ -34,8 +34,8 @@ /** * * @author elias_naur - * @version $Revision: 3262 $ - * $Id: CachedResult.java 3262 2010-01-04 18:47:49Z spasi $ + * @version $Revision$ + * $Id$ */ import java.lang.annotation.Target; diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/Check.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/Check.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/Check.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/Check.java 2016-04-09 16:26:56.000000000 +0000 @@ -34,8 +34,8 @@ /** * * @author elias_naur - * @version $Revision: 3412 $ - * $Id: Check.java 3412 2010-09-26 23:43:24Z spasi $ + * @version $Revision$ + * $Id$ */ import java.lang.annotation.Target; diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/Code.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/Code.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/Code.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/Code.java 2016-04-09 16:26:56.000000000 +0000 @@ -34,8 +34,8 @@ /** * * @author elias_naur - * @version $Revision: 3412 $ - * $Id: Code.java 3412 2010-09-26 23:43:24Z spasi $ + * @version $Revision$ + * $Id$ */ import java.lang.annotation.ElementType; diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/Constant.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/Constant.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/Constant.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/Constant.java 2016-04-09 16:26:56.000000000 +0000 @@ -34,8 +34,8 @@ /** * * @author elias_naur - * @version $Revision: 3412 $ - * $Id: Constant.java 3412 2010-09-26 23:43:24Z spasi $ + * @version $Revision$ + * $Id$ */ import java.lang.annotation.Target; diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/Const.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/Const.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/Const.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/Const.java 2016-04-09 16:26:56.000000000 +0000 @@ -34,8 +34,8 @@ /** * * @author elias_naur - * @version $Revision: 2983 $ - * $Id: Const.java 2983 2008-04-07 18:36:09Z matzon $ + * @version $Revision$ + * $Id$ */ import java.lang.annotation.Target; diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/Extension.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/Extension.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/Extension.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/Extension.java 2016-04-09 16:26:56.000000000 +0000 @@ -34,8 +34,8 @@ /** * * @author elias_naur - * @version $Revision: 2983 $ - * $Id: Extension.java 2983 2008-04-07 18:36:09Z matzon $ + * @version $Revision$ + * $Id$ */ import java.lang.annotation.Target; @@ -46,4 +46,7 @@ String className() default ""; boolean isFinal() default true; String postfix(); + + /** The extension name as it appears in the extension string. The default is the API prefix followed by the interface name, converted to lower-case. */ + String nativeName() default ""; } diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/FieldsGenerator.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/FieldsGenerator.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/FieldsGenerator.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/FieldsGenerator.java 2016-04-09 16:26:56.000000000 +0000 @@ -29,22 +29,23 @@ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - package org.lwjgl.util.generator; import java.io.PrintWriter; import java.util.Collection; - -import com.sun.mirror.declaration.FieldDeclaration; -import com.sun.mirror.declaration.Modifier; -import com.sun.mirror.type.PrimitiveType; -import com.sun.mirror.type.TypeMirror; +import java.util.Set; +import javax.annotation.processing.ProcessingEnvironment; +import javax.lang.model.element.Modifier; +import javax.lang.model.element.VariableElement; +import javax.lang.model.type.PrimitiveType; +import javax.lang.model.type.TypeKind; +import javax.lang.model.type.TypeMirror; public class FieldsGenerator { - private static void validateField(FieldDeclaration field) { + private static void validateField(VariableElement field) { // Check if field is "public static final" - Collection modifiers = field.getModifiers(); + Set modifiers = field.getModifiers(); if ( modifiers.size() != 3 || !modifiers.contains(Modifier.PUBLIC) || !modifiers.contains(Modifier.STATIC) @@ -53,16 +54,17 @@ } // Check suported types (int, long, float, String) - TypeMirror field_type = field.getType(); - if ( field_type instanceof PrimitiveType ) { + TypeMirror field_type = field.asType(); + if ( "java.lang.String".equals(field_type.toString()) ) { + } else if ( field_type instanceof PrimitiveType ) { PrimitiveType field_type_prim = (PrimitiveType)field_type; - PrimitiveType.Kind field_kind = field_type_prim.getKind(); - if ( field_kind != PrimitiveType.Kind.INT - && field_kind != PrimitiveType.Kind.LONG - && field_kind != PrimitiveType.Kind.FLOAT ) { - throw new RuntimeException("Field " + field.getSimpleName() + " is not of type 'int', 'long' or 'float'"); + TypeKind field_kind = field_type_prim.getKind(); + if ( field_kind != TypeKind.INT + && field_kind != TypeKind.LONG + && field_kind != TypeKind.FLOAT + && field_kind != TypeKind.BYTE ) { + throw new RuntimeException("Field " + field.getSimpleName() + " is not of type 'int', 'long', 'float' or 'byte' " + field_kind.toString()); } - } else if ( "java.lang.String".equals(field_type.toString()) ) { } else { throw new RuntimeException("Field " + field.getSimpleName() + " is not a primitive type or String"); } @@ -73,7 +75,7 @@ } } - private static void generateField(PrintWriter writer, FieldDeclaration field, FieldDeclaration prev_field) { + private static void generateField(PrintWriter writer, VariableElement field, VariableElement prev_field, ProcessingEnvironment env) { validateField(field); Object value = field.getConstantValue(); @@ -85,37 +87,41 @@ field_value_string = "0x" + Long.toHexString((Long)field.getConstantValue()).toUpperCase() + 'L'; } else if ( field_value_class.equals(Float.class) ) { field_value_string = field.getConstantValue() + "f"; + } else if ( value.getClass().equals(Byte.class) ) { + field_value_string = "0x" + Integer.toHexString((Byte)field.getConstantValue()).toUpperCase(); } else if ( field_value_class.equals(String.class) ) { field_value_string = "\"" + field.getConstantValue() + "\""; } else { throw new RuntimeException("Field is of unexpected type. This means there is a bug in validateField()."); } - boolean hadDoc = prev_field != null && prev_field.getDocComment() != null; - boolean hasDoc = field.getDocComment() != null; - boolean newBatch = prev_field == null || !prev_field.getType().equals(field.getType()) || (!hadDoc && field.getDocComment() != null) || (hadDoc && hasDoc && !prev_field.getDocComment().equals(field.getDocComment())); + boolean hadDoc = prev_field != null && env.getElementUtils().getDocComment(prev_field) != null; + boolean hasDoc = env.getElementUtils().getDocComment(field) != null; + boolean newBatch = prev_field == null || !prev_field.asType().equals(field.asType()) || (!hadDoc && env.getElementUtils().getDocComment(field) != null) || (hadDoc && hasDoc && !env.getElementUtils().getDocComment(prev_field).equals(env.getElementUtils().getDocComment(field))); // Print field declaration if ( newBatch ) { - if ( prev_field != null ) + if ( prev_field != null ) { writer.println(";\n"); + } - Utils.printDocComment(writer, field); - writer.print("\tpublic static final " + field.getType().toString() + " " + field.getSimpleName() + " = " + field_value_string); - } else + Utils.printDocComment(writer, field, env); + writer.print("\tpublic static final " + field.asType().toString() + " " + field.getSimpleName() + " = " + field_value_string); + } else { writer.print(",\n\t\t" + field.getSimpleName() + " = " + field_value_string); + } } - public static void generateFields(PrintWriter writer, Collection fields) { + public static void generateFields(ProcessingEnvironment env, PrintWriter writer, Collection fields) { if ( 0 < fields.size() ) { writer.println(); - FieldDeclaration prev_field = null; - for ( FieldDeclaration field : fields ) { - generateField(writer, field, prev_field); + VariableElement prev_field = null; + for ( VariableElement field : fields ) { + generateField(writer, field, prev_field, env); prev_field = field; } writer.println(";"); } } -} +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/GenerateAutos.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/GenerateAutos.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/GenerateAutos.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/GenerateAutos.java 2016-04-09 16:26:56.000000000 +0000 @@ -34,8 +34,8 @@ /** * * @author elias_naur - * @version $Revision: 3412 $ - * $Id: GenerateAutos.java 3412 2010-09-26 23:43:24Z spasi $ + * @version $Revision$ + * $Id$ */ import java.lang.annotation.Target; diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/GeneratorProcessorFactory.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/GeneratorProcessorFactory.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/GeneratorProcessorFactory.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/GeneratorProcessorFactory.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,168 +0,0 @@ -/* - * Copyright (c) 2002-2008 LWJGL Project - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of 'LWJGL' nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -package org.lwjgl.util.generator; - -import java.io.File; -import java.io.FileFilter; -import java.util.Arrays; -import java.util.Collection; -import java.util.Map; -import java.util.Set; - -import com.sun.mirror.apt.*; -import com.sun.mirror.declaration.AnnotationTypeDeclaration; -import com.sun.mirror.declaration.TypeDeclaration; - -import static com.sun.mirror.util.DeclarationVisitors.*; -import static java.util.Collections.*; - -/** - * Generator tool for creating the java classes and native code - * from an annotated template java interface. - * - * @author elias_naur - * @version $Revision: 3430 $ - * $Id: GeneratorProcessorFactory.java 3430 2010-10-04 17:04:46Z spasi $ - */ -public class GeneratorProcessorFactory implements AnnotationProcessorFactory, RoundCompleteListener { - - private static boolean first_round = true; - - // Process any set of annotations - private static final Collection supportedAnnotations = - unmodifiableCollection(Arrays.asList("*")); - - private static final Collection supportedOptions = - unmodifiableCollection(Arrays.asList("-Atypemap", "-Ageneratechecks", "-Acontextspecific")); - - public Collection supportedAnnotationTypes() { - return supportedAnnotations; - } - - public Collection supportedOptions() { - return supportedOptions; - } - - public void roundComplete(RoundCompleteEvent event) { - first_round = false; - } - - public AnnotationProcessor getProcessorFor(Set atds, AnnotationProcessorEnvironment env) { - // Only process the initial types, not the generated ones - if ( first_round ) { - env.addListener(this); - return new GeneratorProcessor(env); - } else - return AnnotationProcessors.NO_OP; - } - - private static class GeneratorProcessor implements AnnotationProcessor { - - private final AnnotationProcessorEnvironment env; - - GeneratorProcessor(AnnotationProcessorEnvironment env) { - this.env = env; - } - - public void process() { - Map options = env.getOptions(); - String typemap_classname = null; - boolean generate_error_checks = options.containsKey("-Ageneratechecks"); - boolean context_specific = options.containsKey("-Acontextspecific"); - for ( String k : options.keySet() ) { - int delimiter = k.indexOf('='); - if ( delimiter != -1 ) { - if ( k.startsWith("-Atypemap") ) { - typemap_classname = k.substring(delimiter + 1); - } - } - } - if ( typemap_classname == null ) - throw new RuntimeException("No TypeMap class name specified with -Atypemap="); - - TypeDeclaration lastFile = null; - try { - long generatorLM = getGeneratorLastModified(); - TypeMap type_map = (TypeMap)(Class.forName(typemap_classname).newInstance()); - for ( TypeDeclaration typedecl : env.getSpecifiedTypeDeclarations() ) { - lastFile = typedecl; - typedecl.accept(getDeclarationScanner(new GeneratorVisitor(env, type_map, generate_error_checks, context_specific, generatorLM), NO_OP)); - } - } catch (Exception e) { - if ( lastFile == null ) - throw new RuntimeException(e); - else - throw new RuntimeException("\n-- Failed to process template: " + lastFile.getQualifiedName() + " --", e); - } - } - - /** - * Gets the time of the latest change on the Generator classes. - * - * @return time of the latest change - */ - private static long getGeneratorLastModified() { - long lastModified = getDirectoryLastModified("/bin/org/lwjgl/util/generator"); - lastModified = Math.max(lastModified, getDirectoryLastModified("/bin/org/lwjgl/util/generator/openal")); - lastModified = Math.max(lastModified, getDirectoryLastModified("/bin/org/lwjgl/util/generator/opengl")); - lastModified = Math.max(lastModified, getDirectoryLastModified("/bin/org/lwjgl/util/generator/opencl")); - - return lastModified; - } - - private static long getDirectoryLastModified(final String path) { - final File pck = new File(System.getProperty("user.dir") + path); - if ( !pck.exists() || !pck.isDirectory() ) - return Long.MAX_VALUE; - - final File[] classes = pck.listFiles(new FileFilter() { - public boolean accept(final File pathname) { - return pathname.isFile() && pathname.getName().endsWith(".class"); - } - }); - - if ( classes == null || classes.length == 0 ) - return Long.MAX_VALUE; - - long lastModified = 0; - - for ( File clazz : classes ) { - long lm = clazz.lastModified(); - if ( lastModified < lm ) - lastModified = lm; - } - - return lastModified; - } - } -} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/GeneratorProcessor.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/GeneratorProcessor.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/GeneratorProcessor.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/GeneratorProcessor.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,140 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.util.generator; + +import java.io.File; +import java.io.FileFilter; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; +import javax.annotation.processing.*; +import javax.lang.model.SourceVersion; +import javax.lang.model.element.Element; +import javax.lang.model.element.TypeElement; +import javax.lang.model.util.ElementFilter; +import javax.tools.Diagnostic; + +/** + * Generator tool for creating the java classes and native code from an + * annotated template java interface. + * + * @author elias_naur + * @version $Revision$ $Id$ + */ +@SupportedAnnotationTypes({ "*" }) +@SupportedSourceVersion(SourceVersion.RELEASE_6) +@SupportedOptions({ "binpath", "typemap", "generatechecks", "contextspecific" }) +public class GeneratorProcessor extends AbstractProcessor { + + private static boolean first_round = true; + + @Override + public boolean process(Set annotations, RoundEnvironment roundEnv) { + if ( roundEnv.processingOver() || !first_round ) { + System.exit(0); + return true; + } + Map options = processingEnv.getOptions(); + String typemap_classname = options.get("typemap"); + String bin_path = options.get("binpath"); + boolean generate_error_checks = options.containsKey("generatechecks"); + boolean context_specific = options.containsKey("contextspecific"); + if ( bin_path == null ) { + throw new RuntimeException("No path specified for the bin directory with -Abinpath="); + } + + if ( typemap_classname == null ) { + throw new RuntimeException("No TypeMap class name specified with -Atypemap="); + } + + Element lastFile = null; + try { + long generatorLM = getGeneratorLastModified(bin_path); + TypeMap type_map = (TypeMap)(Class.forName(typemap_classname).newInstance()); + for ( Iterator it = ElementFilter.typesIn(roundEnv.getRootElements()).iterator(); it.hasNext(); ) { + lastFile = it.next(); + lastFile.accept(new GeneratorVisitor(processingEnv, type_map, generate_error_checks, context_specific, generatorLM), null); + } + first_round = false; + return true; + } catch (Exception e) { + if ( lastFile == null ) { + throw new RuntimeException(e); + } else { + throw new RuntimeException("\n-- Failed to process template: " + lastFile.asType().toString() + " --", e); + } + } + } + + /** + * Gets the time of the latest change on the Generator classes. + * + * @return time of the latest change + */ + private static long getGeneratorLastModified(final String bin_path) { + long lastModified = getDirectoryLastModified(bin_path, "/org/lwjgl/util/generator"); + lastModified = Math.max(lastModified, getDirectoryLastModified(bin_path, "/org/lwjgl/util/generator/openal")); + lastModified = Math.max(lastModified, getDirectoryLastModified(bin_path, "/org/lwjgl/util/generator/opengl")); + lastModified = Math.max(lastModified, getDirectoryLastModified(bin_path, "/org/lwjgl/util/generator/opencl")); + + return lastModified; + } + + private static long getDirectoryLastModified(final String bin_path, final String path) { + final File pck = new File(bin_path + path); + if ( !pck.exists() || !pck.isDirectory() ) { + return Long.MAX_VALUE; + } + + final File[] classes = pck.listFiles(new FileFilter() { + public boolean accept(final File pathname) { + return pathname.isFile() && pathname.getName().endsWith(".class"); + } + }); + + if ( classes == null || classes.length == 0 ) { + return Long.MAX_VALUE; + } + + long lastModified = 0; + + for ( File clazz : classes ) { + long lm = clazz.lastModified(); + if ( lastModified < lm ) { + lastModified = lm; + } + } + + return lastModified; + } + +} diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/GeneratorVisitor.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/GeneratorVisitor.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/GeneratorVisitor.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/GeneratorVisitor.java 2016-04-09 16:26:56.000000000 +0000 @@ -29,37 +29,43 @@ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - package org.lwjgl.util.generator; -import com.sun.mirror.apt.*; -import com.sun.mirror.declaration.*; -import com.sun.mirror.type.*; -import com.sun.mirror.util.*; - -import java.io.*; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.PrintWriter; import java.lang.annotation.Annotation; +import java.nio.Buffer; +import java.nio.ByteBuffer; import java.nio.channels.FileChannel; -import java.util.*; - -import java.nio.*; +import java.util.Collection; +import java.util.List; +import javax.annotation.processing.ProcessingEnvironment; +import javax.lang.model.element.*; +import javax.lang.model.type.TypeKind; +import javax.lang.model.type.TypeMirror; +import javax.lang.model.util.ElementKindVisitor6; +import javax.tools.Diagnostic; +import javax.tools.Diagnostic.Kind; +import javax.tools.FileObject; +import javax.tools.StandardLocation; /** - * * Generator visitor for the generator tool * * @author elias_naur - * @version $Revision: 3430 $ - * $Id: GeneratorVisitor.java 3430 2010-10-04 17:04:46Z spasi $ + * @version $Revision$ $Id$ */ -public class GeneratorVisitor extends SimpleDeclarationVisitor { - private final AnnotationProcessorEnvironment env; - private final TypeMap type_map; - private final boolean generate_error_checks; - private final boolean context_specific; - private final long generatorLM; +public class GeneratorVisitor extends ElementKindVisitor6 { + + private final ProcessingEnvironment env; + private final TypeMap type_map; + private final boolean generate_error_checks; + private final boolean context_specific; + private final long generatorLM; - public GeneratorVisitor(AnnotationProcessorEnvironment env, TypeMap type_map, boolean generate_error_checks, boolean context_specific, long generatorLM) { + public GeneratorVisitor(ProcessingEnvironment env, TypeMap type_map, boolean generate_error_checks, boolean context_specific, long generatorLM) { this.env = env; this.type_map = type_map; this.generate_error_checks = generate_error_checks; @@ -67,145 +73,166 @@ this.generatorLM = generatorLM; } - private void validateMethod(MethodDeclaration method) { - if (method.isVarArgs()) + private void validateMethod(ExecutableElement method) { + if ( method.isVarArgs() ) { throw new RuntimeException("Method " + method.getSimpleName() + " is variadic"); + } Collection modifiers = method.getModifiers(); - if (!modifiers.contains(Modifier.PUBLIC)) + if ( !modifiers.contains(Modifier.PUBLIC) ) { throw new RuntimeException("Method " + method.getSimpleName() + " is not public"); - if (method.getThrownTypes().size() > 0) + } + if ( method.getThrownTypes().size() > 0 ) { throw new RuntimeException("Method " + method.getSimpleName() + " throws checked exceptions"); + } validateParameters(method); StripPostfix strip_annotation = method.getAnnotation(StripPostfix.class); - if (strip_annotation != null && method.getAnnotation(Alternate.class) == null) { + if ( strip_annotation != null && method.getAnnotation(Alternate.class) == null ) { String postfix_param_name = strip_annotation.value(); - ParameterDeclaration postfix_param = Utils.findParameter(method, postfix_param_name); - if (Utils.isParameterMultiTyped(postfix_param)) + VariableElement postfix_param = Utils.findParameter(method, postfix_param_name); + if ( Utils.isParameterMultiTyped(postfix_param) ) { throw new RuntimeException("Postfix parameter can't be the same as a multityped parameter in method " + method); - if (Utils.getNIOBufferType(postfix_param.getType()) == null) + } + if ( Utils.getNIOBufferType(postfix_param.asType()) == null ) { throw new RuntimeException("Postfix parameter type must be a nio Buffer"); + } } - if (Utils.getResultParameter(method) != null && !method.getReturnType().equals(env.getTypeUtils().getVoidType())) + if ( Utils.getResultParameter(method) != null && !method.getReturnType().equals(env.getTypeUtils().getNoType(TypeKind.VOID)) ) { throw new RuntimeException(method + " return type is not void but a parameter is annotated with Result"); - if (method.getAnnotation(CachedResult.class) != null) { - if (Utils.getNIOBufferType(Utils.getMethodReturnType(method)) == null) + } + if ( method.getAnnotation(CachedResult.class) != null ) { + if ( Utils.getNIOBufferType(Utils.getMethodReturnType(method)) == null ) { throw new RuntimeException(method + " return type is not a Buffer, but is annotated with CachedResult"); - if (method.getAnnotation(AutoSize.class) == null) + } + if ( method.getAnnotation(AutoSize.class) == null ) { throw new RuntimeException(method + " is annotated with CachedResult but misses an AutoSize annotation"); + } } validateTypes(method, method.getAnnotationMirrors(), method.getReturnType()); } - private void validateType(MethodDeclaration method, Class annotation_type, Class type) { + private void validateType(ExecutableElement method, Class annotation_type, Class type) { Class[] valid_types = type_map.getValidAnnotationTypes(type); - for ( Class valid_type : valid_types ) - if ( valid_type.equals(annotation_type) ) + for ( Class valid_type : valid_types ) { + if ( valid_type.equals(annotation_type) ) { return; - throw new RuntimeException(type + " is annotated with invalid native type " + annotation_type + - " in method " + method); + } + } + throw new RuntimeException(type + " is annotated with invalid native type " + annotation_type + + " in method " + method); } - private void validateTypes(MethodDeclaration method, Collection annotations, TypeMirror type_mirror) { - for (AnnotationMirror annotation : annotations) { + private void validateTypes(ExecutableElement method, List annotations, TypeMirror type_mirror) { + for ( AnnotationMirror annotation : annotations ) { NativeType native_type_annotation = NativeTypeTranslator.getAnnotation(annotation, NativeType.class); - if (native_type_annotation != null) { + if ( native_type_annotation != null ) { Class annotation_type = NativeTypeTranslator.getClassFromType(annotation.getAnnotationType()); Class type = Utils.getJavaType(type_mirror); - if (Buffer.class.equals(type)) + if ( Buffer.class.equals(type) ) { continue; + } validateType(method, annotation_type, type); } } } - private void validateParameters(MethodDeclaration method) { - for (ParameterDeclaration param : method.getParameters()) { - validateTypes(method, param.getAnnotationMirrors(), param.getType()); - Class param_type = Utils.getJavaType(param.getType()); - if (Utils.getNIOBufferType(param.getType()) != null && param_type != CharSequence.class && param_type != CharSequence[].class) { + private void validateParameters(ExecutableElement method) { + for ( VariableElement param : method.getParameters() ) { + validateTypes(method, param.getAnnotationMirrors(), param.asType()); + Class param_type = Utils.getJavaType(param.asType()); + if ( Utils.getNIOBufferType(param.asType()) != null && param_type != CharSequence.class && param_type != CharSequence[].class ) { Check parameter_check_annotation = param.getAnnotation(Check.class); NullTerminated null_terminated_annotation = param.getAnnotation(NullTerminated.class); - if (parameter_check_annotation == null && null_terminated_annotation == null) { + if ( parameter_check_annotation == null && null_terminated_annotation == null ) { boolean found_auto_size_param = false; - for (ParameterDeclaration inner_param : method.getParameters()) { + for ( VariableElement inner_param : method.getParameters() ) { AutoSize auto_size_annotation = inner_param.getAnnotation(AutoSize.class); - if (auto_size_annotation != null && - auto_size_annotation.value().equals(param.getSimpleName())) { + if ( auto_size_annotation != null + && auto_size_annotation.value().equals(param.getSimpleName().toString()) ) { found_auto_size_param = true; break; } } - if (!found_auto_size_param - && param.getAnnotation(Result.class) == null - && param.getAnnotation(Constant.class) == null - && !Utils.isReturnParameter(method, param) - ) - throw new RuntimeException(param + " has no Check, Result nor Constant annotation, is not the return parameter and no other parameter has" + - " an @AutoSize annotation on it in method " + method); + if ( !found_auto_size_param + && param.getAnnotation(Result.class) == null + && param.getAnnotation(Constant.class) == null + && !Utils.isReturnParameter(method, param) ) { + throw new RuntimeException(param + " has no Check, Result nor Constant annotation, is not the return parameter and no other parameter has" + + " an @AutoSize annotation on it in method " + method); + } } - if (param.getAnnotation(CachedReference.class) != null && param.getAnnotation(Result.class) != null) + if ( param.getAnnotation(CachedReference.class) != null && param.getAnnotation(Result.class) != null ) { throw new RuntimeException(param + " can't be annotated with both CachedReference and Result"); - if (param.getAnnotation(BufferObject.class) != null && param.getAnnotation(Result.class) != null) + } + if ( param.getAnnotation(BufferObject.class) != null && param.getAnnotation(Result.class) != null ) { throw new RuntimeException(param + " can't be annotated with both BufferObject and Result"); + } //if (param.getAnnotation(Constant.class) != null) - //throw new RuntimeException("Buffer parameter " + param + " cannot be Constant"); + //throw new RuntimeException("Buffer parameter " + param + " cannot be Constant"); } else { - if (param.getAnnotation(BufferObject.class) != null) + if ( param.getAnnotation(BufferObject.class) != null ) { throw new RuntimeException(param + " type is not a buffer, but annotated as a BufferObject"); - if (param.getAnnotation(CachedReference.class) != null) + } + if ( param.getAnnotation(CachedReference.class) != null ) { throw new RuntimeException(param + " type is not a buffer, but annotated as a CachedReference"); + } } } } - private static void generateMethodsNativePointers(PrintWriter writer, Collection methods) { - for (MethodDeclaration method : methods) { - if ( method.getAnnotation(Alternate.class) == null ) + private static void generateMethodsNativePointers(PrintWriter writer, Collection methods) { + for ( ExecutableElement method : methods ) { + if ( method.getAnnotation(Alternate.class) == null ) { generateMethodNativePointers(writer, method); + } } } - private static void generateMethodNativePointers(PrintWriter writer, MethodDeclaration method) { - if ( method.getAnnotation(Extern.class) == null ) + private static void generateMethodNativePointers(PrintWriter writer, ExecutableElement method) { + if ( method.getAnnotation(Extern.class) == null ) { writer.print("static "); + } writer.println(Utils.getTypedefName(method) + " " + method.getSimpleName() + ";"); } - private void generateJavaSource(InterfaceDeclaration d, PrintWriter java_writer) throws IOException { + private void generateJavaSource(TypeElement d, PrintWriter java_writer) throws IOException { java_writer.println("/* MACHINE GENERATED FILE, DO NOT EDIT */"); java_writer.println(); - java_writer.println("package " + d.getPackage().getQualifiedName() + ";"); + java_writer.println("package " + env.getElementUtils().getPackageOf(d).getQualifiedName().toString() + ";"); java_writer.println(); java_writer.println("import org.lwjgl.*;"); java_writer.println("import java.nio.*;"); Imports imports = d.getAnnotation(Imports.class); if ( imports != null ) { - for ( String i : imports.value() ) + for ( String i : imports.value() ) { java_writer.println("import " + i + ";"); + } } java_writer.println(); - Utils.printDocComment(java_writer, d); - if ( d.getAnnotation(Private.class) == null ) + Utils.printDocComment(java_writer, d, env); + if ( d.getAnnotation(Private.class) == null ) { java_writer.print("public "); + } boolean is_final = Utils.isFinal(d); - if (is_final) + if ( is_final ) { java_writer.write("final "); + } java_writer.print("class " + Utils.getSimpleClassName(d)); - Collection super_interfaces = d.getSuperinterfaces(); - if (super_interfaces.size() > 1) + List super_interfaces = d.getInterfaces(); + if ( super_interfaces.size() > 1 ) { throw new RuntimeException(d + " extends more than one interface"); - if (super_interfaces.size() == 1) { - InterfaceDeclaration super_interface = super_interfaces.iterator().next().getDeclaration(); - java_writer.print(" extends " + Utils.getSimpleClassName(super_interface)); + } + if ( super_interfaces.size() == 1 ) { + TypeMirror super_interface = super_interfaces.iterator().next(); + java_writer.print(" extends " + Utils.getSimpleClassName(env.getElementUtils().getTypeElement(super_interface.toString()))); } java_writer.println(" {"); - FieldsGenerator.generateFields(java_writer, d.getFields()); + FieldsGenerator.generateFields(env, java_writer, Utils.getFields(d)); java_writer.println(); - if (is_final) { + if ( is_final ) { // Write private constructor to avoid instantiation java_writer.println("\tprivate " + Utils.getSimpleClassName(d) + "() {}"); } - if (d.getMethods().size() > 0 && !context_specific) { + if ( Utils.getMethods(d).size() > 0 && !context_specific ) { java_writer.println(); java_writer.println("\tstatic native void " + Utils.STUB_INITIALIZER_NAME + "() throws LWJGLException;"); } @@ -213,26 +240,29 @@ java_writer.println("}"); java_writer.close(); String qualified_interface_name = Utils.getQualifiedClassName(d); - env.getMessager().printNotice("Generated class " + qualified_interface_name); + env.getMessager().printMessage(Diagnostic.Kind.NOTE, "Generated class " + qualified_interface_name); } - private void generateNativeSource(InterfaceDeclaration d) throws IOException { + private void generateNativeSource(TypeElement d) throws IOException { + if ( d.getKind().equals(ElementKind.ANNOTATION_TYPE) ) { + return; + } String qualified_interface_name = Utils.getQualifiedClassName(d); - String qualified_native_name = Utils.getNativeQualifiedName(qualified_interface_name)+ ".c"; - PrintWriter native_writer = env.getFiler().createTextFile(Filer.Location.CLASS_TREE, "", new File(qualified_native_name), "UTF-8"); + String qualified_native_name = Utils.getNativeQualifiedName(qualified_interface_name) + ".c"; + PrintWriter native_writer = new PrintWriter(env.getFiler().createResource(StandardLocation.CLASS_OUTPUT, "", qualified_native_name).openWriter()); native_writer.println("/* MACHINE GENERATED FILE, DO NOT EDIT */"); native_writer.println(); native_writer.println("#include "); type_map.printNativeIncludes(native_writer); native_writer.println(); - TypedefsGenerator.generateNativeTypedefs(type_map, native_writer, d.getMethods()); + TypedefsGenerator.generateNativeTypedefs(type_map, native_writer, Utils.getMethods(d)); native_writer.println(); - if (!context_specific) { - generateMethodsNativePointers(native_writer, d.getMethods()); + if ( !context_specific ) { + generateMethodsNativePointers(native_writer, Utils.getMethods(d)); native_writer.println(); } NativeMethodStubsGenerator.generateNativeMethodStubs(env, type_map, native_writer, d, generate_error_checks, context_specific); - if (!context_specific) { + if ( !context_specific ) { native_writer.print("JNIEXPORT void JNICALL " + Utils.getQualifiedNativeMethodName(qualified_interface_name, Utils.STUB_INITIALIZER_NAME)); native_writer.println("(JNIEnv *env, jclass clazz) {"); native_writer.println("\tJavaMethodAndExtFunction functions[] = {"); @@ -245,84 +275,60 @@ native_writer.println("}"); } native_writer.close(); - env.getMessager().printNotice("Generated C source " + qualified_interface_name); + env.getMessager().printMessage(Kind.NOTE, "Generated C source " + qualified_interface_name); } - public void visitInterfaceDeclaration(InterfaceDeclaration d) { - final File input = d.getPosition().file(); - final File outputJava = new File(env.getOptions().get("-s") + '/' + d.getPackage().getQualifiedName().replace('.', '/'), Utils.getSimpleClassName(d) + ".java"); + @Override + public Void visitTypeAsInterface(TypeElement e, Void p) { + final File input = new File("src/templates/" + e.getQualifiedName().toString().replace('.', '/') + ".java"); + final File outputJava = new File("src/generated/" + env.getElementUtils().getPackageOf(e).getQualifiedName().toString().replace('.', '/'), Utils.getSimpleClassName(e) + ".java"); PrintWriter java_writer = null; - try { - final Collection methods = d.getMethods(); - if ( methods.size() == 0 && d.getFields().size() == 0 ) - return; + final Collection methods = Utils.getMethods(e); + if ( methods.isEmpty() && Utils.getFields(e).isEmpty() ) { + return DEFAULT_VALUE; + } // Skip this class if the output exists and the input has not been modified. if ( outputJava.exists() && Math.max(input.lastModified(), generatorLM) < outputJava.lastModified() ) - return; + return DEFAULT_VALUE; - for ( final MethodDeclaration method : methods ) + //env.getMessager().printMessage(Kind.NOTE, "methods count : " + Utils.getMethods(e).size() + " fields count : " + Utils.getFields(e).size(), e); + for ( final ExecutableElement method : methods ) { validateMethod(method); - java_writer = env.getFiler().createTextFile(Filer.Location.SOURCE_TREE, d.getPackage().getQualifiedName(), new File(Utils.getSimpleClassName(d) + ".java"), null); - generateJavaSource(d, java_writer); + } + + // TODO: Back-port LWJGL 3's generation file handling (generate in-memory and avoid touching files if nothing has changed) + java_writer = new PrintWriter(env.getFiler().createSourceFile(Utils.getQualifiedClassName(e), env.getElementUtils().getPackageOf(e)).openWriter()); + generateJavaSource(e, java_writer); if ( methods.size() > 0 ) { - boolean hasNative = false; - for ( final MethodDeclaration method : methods ) { + boolean noNative = true; + for ( final ExecutableElement method : methods ) { Alternate alt_annotation = method.getAnnotation(Alternate.class); if ( (alt_annotation == null || alt_annotation.nativeAlt()) && method.getAnnotation(Reuse.class) == null ) { - hasNative = true; + noNative = false; break; } } - if ( !hasNative ) - return; - - final String outputPath = env.getOptions().get("-d") + '/' + Utils.getNativeQualifiedName(Utils.getQualifiedClassName(d)); - final File outputNative = new File(outputPath + ".c"); - final File outputBackup = new File(outputPath + "_backup.c"); - - // If the native file exists, rename. - final ByteBuffer nativeBefore; - if ( outputNative.exists() ) { - nativeBefore = readFile(outputNative); - outputNative.renameTo(outputBackup); - } else - nativeBefore = null; + if ( noNative ) { + return DEFAULT_VALUE; + } try { - generateNativeSource(d); - - // If the native file did exist, compare with the new file. If they're the same, - // reset the last modified time to avoid ridiculous C compilation times. - if ( nativeBefore != null && outputNative.length() == nativeBefore.capacity() ) { - final ByteBuffer nativeAfter = readFile(outputNative); - boolean same = true; - for ( int i = nativeBefore.position(); i < nativeBefore.limit(); i++ ) { - if ( nativeBefore.get(i) != nativeAfter.get(i) ) { - same = false; - break; - } - } - - if ( same ) { - outputNative.delete(); - outputBackup.renameTo(outputNative); - } - } - } finally { - if ( outputBackup.exists() ) - outputBackup.delete(); + generateNativeSource(e); + } catch (IOException ex) { + throw new RuntimeException(ex); } } - } catch (Exception e) { + return DEFAULT_VALUE; + } catch (Exception ex) { // If anything goes wrong mid-gen, delete output to allow regen next time we run. if ( java_writer != null ) java_writer.close(); if ( outputJava.exists() ) outputJava.delete(); - throw new RuntimeException(e); + throw new RuntimeException(ex); } } diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/Indirect.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/Indirect.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/Indirect.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/Indirect.java 2016-04-09 16:26:56.000000000 +0000 @@ -37,8 +37,8 @@ * stub to use the indirection operator '&' on it. * * @author elias_naur - * @version $Revision: 2983 $ - * $Id: Indirect.java 2983 2008-04-07 18:36:09Z matzon $ + * @version $Revision$ + * $Id$ */ import java.lang.annotation.Target; diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java 2016-04-09 16:26:56.000000000 +0000 @@ -29,7 +29,6 @@ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - package org.lwjgl.util.generator; /** @@ -37,37 +36,45 @@ * This class generates the methods in the generated java source files. * * @author elias_naur - * @version $Revision: 3460 $ - * $Id: JavaMethodsGenerator.java 3460 2010-11-29 18:25:28Z spasi $ + * @version $Revision$ $Id$ */ - import org.lwjgl.PointerBuffer; import org.lwjgl.util.generator.opengl.GLreturn; -import com.sun.mirror.apt.*; -import com.sun.mirror.declaration.*; -import com.sun.mirror.type.*; - -import java.io.*; -import java.util.*; +import java.io.PrintWriter; import java.nio.*; +import java.util.*; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import javax.annotation.processing.ProcessingEnvironment; +import javax.lang.model.element.AnnotationMirror; +import javax.lang.model.element.ExecutableElement; +import javax.lang.model.element.TypeElement; +import javax.lang.model.element.VariableElement; +import javax.lang.model.type.TypeKind; +import javax.lang.model.type.TypeMirror; public class JavaMethodsGenerator { + private static final String SAVED_PARAMETER_POSTFIX = "_saved"; - public static void generateMethodsJava(AnnotationProcessorEnvironment env, TypeMap type_map, PrintWriter writer, InterfaceDeclaration interface_decl, boolean generate_error_checks, boolean context_specific) { - for (MethodDeclaration method : interface_decl.getMethods()) + public static void generateMethodsJava(ProcessingEnvironment env, TypeMap type_map, PrintWriter writer, TypeElement interface_decl, boolean generate_error_checks, boolean context_specific) { + for ( ExecutableElement method : Utils.getMethods(interface_decl) ) { generateMethodJava(env, type_map, writer, interface_decl, method, generate_error_checks, context_specific); + } } - private static void generateMethodJava(AnnotationProcessorEnvironment env, TypeMap type_map, PrintWriter writer, InterfaceDeclaration interface_decl, MethodDeclaration method, boolean generate_error_checks, boolean context_specific) { + /** + * TODO : fix info multi-type methods print. + */ + private static void generateMethodJava(ProcessingEnvironment env, TypeMap type_map, PrintWriter writer, TypeElement interface_decl, ExecutableElement method, boolean generate_error_checks, boolean context_specific) { writer.println(); - if (Utils.isMethodIndirect(generate_error_checks, context_specific, method)) { - if (method.getAnnotation(GenerateAutos.class) != null) { + if ( Utils.isMethodIndirect(generate_error_checks, context_specific, method) ) { + if ( method.getAnnotation(GenerateAutos.class) != null ) { printMethodWithMultiType(env, type_map, writer, interface_decl, method, TypeInfo.getDefaultTypeInfoMap(method), Mode.AUTOS, generate_error_checks, context_specific); } - Collection> cross_product = TypeInfo.getTypeInfoCrossProduct(type_map, method); - for (Map typeinfos_instance : cross_product) { + Collection> cross_product = TypeInfo.getTypeInfoCrossProduct(type_map, method); + for ( Map typeinfos_instance : cross_product ) { printMethodWithMultiType(env, type_map, writer, interface_decl, method, typeinfos_instance, Mode.NORMAL, generate_error_checks, context_specific); } } @@ -78,191 +85,220 @@ Reuse reuse_annotation = method.getAnnotation(Reuse.class); Alternate alt_annotation = method.getAnnotation(Alternate.class); if ( alt_annotation == null || (alt_annotation.nativeAlt() && !alt_annotation.skipNative()) ) { - if ( alt_annotation != null && method.getSimpleName().equals(alt_annotation.value()) ) + if ( alt_annotation != null && method.getSimpleName().toString().equals(alt_annotation.value()) ) { throw new RuntimeException("An alternate function with native code should have a different name than the main function."); + } - if ( reuse_annotation == null ) - printJavaNativeStub(writer, method, Mode.NORMAL, generate_error_checks, context_specific); + if ( reuse_annotation == null ) { + printJavaNativeStub(env, writer, method, Mode.NORMAL, generate_error_checks, context_specific); + } - if (Utils.hasMethodBufferObjectParameter(method)) { + if ( Utils.hasMethodBufferObjectParameter(method) ) { printMethodWithMultiType(env, type_map, writer, interface_decl, method, TypeInfo.getDefaultTypeInfoMap(method), Mode.BUFFEROBJECT, generate_error_checks, context_specific); - if ( reuse_annotation == null ) - printJavaNativeStub(writer, method, Mode.BUFFEROBJECT, generate_error_checks, context_specific); + if ( reuse_annotation == null ) { + printJavaNativeStub(env, writer, method, Mode.BUFFEROBJECT, generate_error_checks, context_specific); + } } } } - private static void printJavaNativeStub(PrintWriter writer, MethodDeclaration method, Mode mode, boolean generate_error_checks, boolean context_specific) { - if (Utils.isMethodIndirect(generate_error_checks, context_specific, method)) { + private static void printJavaNativeStub(ProcessingEnvironment env, PrintWriter writer, ExecutableElement method, Mode mode, boolean generate_error_checks, boolean context_specific) { + if ( Utils.isMethodIndirect(generate_error_checks, context_specific, method) ) { writer.print("\tstatic native "); } else { - Utils.printDocComment(writer, method); + Utils.printDocComment(writer, method, env); writer.print("\tpublic static native "); } writer.print(getResultType(method, true)); writer.print(" " + Utils.getSimpleNativeMethodName(method, generate_error_checks, context_specific)); - if (mode == Mode.BUFFEROBJECT) + if ( mode == Mode.BUFFEROBJECT ) { writer.print(Utils.BUFFER_OBJECT_METHOD_POSTFIX); + } writer.print("("); boolean first_parameter = generateParametersJava(writer, method, TypeInfo.getDefaultTypeInfoMap(method), true, true, mode); - if (context_specific) { - if (!first_parameter) + if ( context_specific ) { + if ( !first_parameter ) { writer.print(", "); + } writer.print("long " + Utils.FUNCTION_POINTER_VAR_NAME); } writer.println(");"); } - private static boolean generateParametersJava(PrintWriter writer, MethodDeclaration method, Map typeinfos_instance, boolean native_stub, final boolean printTypes, Mode mode) { + private static boolean generateParametersJava(PrintWriter writer, ExecutableElement method, Map typeinfos_instance, boolean native_stub, final boolean printTypes, Mode mode) { boolean first_parameter = true; - for (ParameterDeclaration param : method.getParameters()) { - if ( native_stub && (param.getAnnotation(Helper.class) != null && !param.getAnnotation(Helper.class).passToNative()) ) + for ( VariableElement param : method.getParameters() ) { + if ( native_stub && (param.getAnnotation(Helper.class) != null && !param.getAnnotation(Helper.class).passToNative()) ) { continue; + } final Constant constant_annotation = param.getAnnotation(Constant.class); - if ( constant_annotation != null && constant_annotation.isNative() ) + if ( constant_annotation != null && constant_annotation.isNative() ) { continue; + } AnnotationMirror auto_annotation_mirror = Utils.getParameterAutoAnnotation(param); boolean hide_auto_parameter = mode == Mode.NORMAL && !native_stub && auto_annotation_mirror != null; - if (hide_auto_parameter) { + if ( hide_auto_parameter ) { AutoType auto_type_annotation = param.getAnnotation(AutoType.class); - if (auto_type_annotation != null) { - ParameterDeclaration auto_parameter = Utils.findParameter(method, auto_type_annotation.value()); + if ( auto_type_annotation != null ) { + VariableElement auto_parameter = Utils.findParameter(method, auto_type_annotation.value()); TypeInfo auto_param_type_info = typeinfos_instance.get(auto_parameter); - if (auto_param_type_info.getSignedness() == Signedness.BOTH) { - if (!first_parameter) + if ( auto_param_type_info.getSignedness() == Signedness.BOTH ) { + if ( !first_parameter ) { writer.print(", "); + } first_parameter = false; - if ( printTypes ) + if ( printTypes ) { writer.print("boolean "); + } writer.print(TypeInfo.UNSIGNED_PARAMETER_NAME); } } - } else if ( - param.getAnnotation(Result.class) == null + } else if ( param.getAnnotation(Result.class) == null && (native_stub || ((param.getAnnotation(Constant.class) == null || param.getAnnotation(Constant.class).keepParam()) && !Utils.isReturnParameter(method, param))) - && (mode != Mode.AUTOS || getAutoTypeParameter(method, param) == null) - ) { + && (mode != Mode.AUTOS || getAutoTypeParameter(method, param) == null) ) { first_parameter = generateParameterJava(writer, param, typeinfos_instance.get(param), native_stub, printTypes, first_parameter, mode); } } CachedResult cached_result_annotation = method.getAnnotation(CachedResult.class); TypeMirror result_type = Utils.getMethodReturnType(method); - if ((native_stub && Utils.getNIOBufferType(result_type) != null) || Utils.needResultSize(method)) { + if ( (native_stub && Utils.getNIOBufferType(result_type) != null) || Utils.needResultSize(method) ) { AutoSize auto_size_annotation = method.getAnnotation(AutoSize.class); if ( auto_size_annotation == null || !auto_size_annotation.isNative() ) { - if (cached_result_annotation == null || !cached_result_annotation.isRange()) { - if (!first_parameter) + if ( cached_result_annotation == null || !cached_result_annotation.isRange() ) { + if ( !first_parameter ) { writer.print(", "); + } first_parameter = false; - if ( printTypes ) + if ( printTypes ) { writer.print("long "); + } writer.print(Utils.RESULT_SIZE_NAME); } } } - if (cached_result_annotation != null) { - if (!first_parameter) + if ( cached_result_annotation != null ) { + if ( !first_parameter ) { writer.print(", "); + } if ( mode == Mode.CACHEDRESULT ) { - if ( printTypes ) + if ( printTypes ) { writer.print("long "); + } writer.print(Utils.CACHED_BUFFER_LENGTH_NAME + ", "); } first_parameter = false; - if ( printTypes ) + if ( printTypes ) { writer.print(getResultType(method, native_stub)); + } writer.print(" " + Utils.CACHED_BUFFER_NAME); } return first_parameter; } - private static boolean generateParameterJava(PrintWriter writer, ParameterDeclaration param, TypeInfo type_info, boolean native_stub, final boolean printTypes, boolean first_parameter, Mode mode) { - Class buffer_type = Utils.getNIOBufferType(param.getType()); - if (!first_parameter) + private static boolean generateParameterJava(PrintWriter writer, VariableElement param, TypeInfo type_info, boolean native_stub, final boolean printTypes, boolean first_parameter, Mode mode) { + Class buffer_type = Utils.getNIOBufferType(param.asType()); + if ( !first_parameter ) { writer.print(", "); + } BufferObject bo_annotation = param.getAnnotation(BufferObject.class); - if (bo_annotation != null && mode == Mode.BUFFEROBJECT) { - if (buffer_type == null) + if ( bo_annotation != null && mode == Mode.BUFFEROBJECT ) { + if ( buffer_type == null ) { throw new RuntimeException("type of " + param + " is not a nio Buffer parameter but is annotated as buffer object"); - if ( printTypes ) + } + if ( printTypes ) { writer.print("long "); + } writer.print(param.getSimpleName() + Utils.BUFFER_OBJECT_PARAMETER_POSTFIX); } else { - if ( native_stub && param.getAnnotation(PointerWrapper.class) != null ) + if ( native_stub && param.getAnnotation(PointerWrapper.class) != null ) { writer.print("long "); - else { + } else { Class type = type_info.getType(); - if ( native_stub && (type == CharSequence.class || type == CharSequence[].class || type == PointerBuffer.class) ) - writer.print("ByteBuffer "); - else if ( printTypes ) - writer.print(type_info.getType().getSimpleName() + " "); + if ( native_stub && (type == CharSequence.class || type == CharSequence[].class || type == PointerBuffer.class || Buffer.class.isAssignableFrom(type)) ) { + writer.print("long "); + } else if ( printTypes ) { + writer.print(type.getSimpleName() + " "); + } } AutoSize auto_size_annotation = param.getAnnotation(AutoSize.class); - if ( auto_size_annotation != null ) + if ( auto_size_annotation != null ) { writer.print(auto_size_annotation.value() + "_"); + } writer.print(param.getSimpleName()); - if ( native_stub && buffer_type != null ) - writer.print(", int " + param.getSimpleName() + NativeMethodStubsGenerator.BUFFER_POSITION_POSTFIX); } return false; } - private static void printBufferObjectCheck(PrintWriter writer, BufferKind kind, Mode mode) { + private static void printBufferObjectCheck(PrintWriter writer, BufferKind kind, Mode mode, boolean context_specific) { String bo_check_method_name = kind.toString(); writer.print("\t\t" + Utils.CHECKS_CLASS_NAME + ".ensure" + bo_check_method_name); - if (mode == Mode.BUFFEROBJECT) + if ( mode == Mode.BUFFEROBJECT ) { writer.print("enabled"); - else + } else { writer.print("disabled"); - writer.println("(caps);"); + } + + if ( context_specific ) { + writer.println("(caps);"); + } else { + writer.println("();"); + } } - private static void printBufferObjectChecks(PrintWriter writer, MethodDeclaration method, Mode mode) { + private static void printBufferObjectChecks(PrintWriter writer, ExecutableElement method, Mode mode, boolean context_specific) { EnumSet check_set = EnumSet.noneOf(BufferKind.class); - for (ParameterDeclaration param : method.getParameters()) { + for ( VariableElement param : method.getParameters() ) { BufferObject bo_annotation = param.getAnnotation(BufferObject.class); - if (bo_annotation != null) + if ( bo_annotation != null ) { check_set.add(bo_annotation.value()); + } + } + for ( BufferKind kind : check_set ) { + printBufferObjectCheck(writer, kind, mode, context_specific); } - for (BufferKind kind : check_set) - printBufferObjectCheck(writer, kind, mode); } - private static void printMethodWithMultiType(AnnotationProcessorEnvironment env, TypeMap type_map, PrintWriter writer, InterfaceDeclaration interface_decl, MethodDeclaration method, Map typeinfos_instance, Mode mode, boolean generate_error_checks, boolean context_specific) { - Utils.printDocComment(writer, method); - if ( interface_decl.getAnnotation(Private.class) == null && method.getAnnotation(Private.class) == null ) + private static void printMethodWithMultiType(ProcessingEnvironment env, TypeMap type_map, PrintWriter writer, TypeElement interface_decl, ExecutableElement method, Map typeinfos_instance, Mode mode, boolean generate_error_checks, boolean context_specific) { + Utils.printDocComment(writer, method, env); + if ( method.getAnnotation(Deprecated.class) != null ) { + writer.println("\t@Deprecated"); + } + if ( interface_decl.getAnnotation(Private.class) == null && method.getAnnotation(Private.class) == null ) { writer.print("\tpublic static "); - else + } else { writer.print("\tstatic "); + } writer.print(getResultType(method, false)); StripPostfix strip_annotation = method.getAnnotation(StripPostfix.class); String method_name; Alternate alt_annotation = method.getAnnotation(Alternate.class); - method_name = alt_annotation == null || alt_annotation.javaAlt() ? method.getSimpleName() : alt_annotation.value(); - if (strip_annotation != null && mode == Mode.NORMAL) + method_name = alt_annotation == null || alt_annotation.javaAlt() ? method.getSimpleName().toString() : alt_annotation.value(); + if ( strip_annotation != null && mode == Mode.NORMAL ) { method_name = getPostfixStrippedName(type_map, interface_decl, method); + } writer.print(" " + method_name + "("); generateParametersJava(writer, method, typeinfos_instance, false, true, mode); writer.println(") {"); final TypeMirror result_type = Utils.getMethodReturnType(method); - boolean has_result = !result_type.equals(env.getTypeUtils().getVoidType()); + boolean has_result = !result_type.equals(env.getTypeUtils().getNoType(TypeKind.VOID)); final Reuse reuse_annotation = method.getAnnotation(Reuse.class); if ( reuse_annotation != null ) { writer.print("\t\t"); - if ( has_result || method.getAnnotation(GLreturn.class) != null ) + if ( has_result || method.getAnnotation(GLreturn.class) != null ) { writer.print("return "); + } - writer.print(reuse_annotation.value() + "." + method_name + "("); + writer.print(reuse_annotation.value() + "." + (reuse_annotation.method().length() > 0 ? reuse_annotation.method() : method_name) + "("); generateParametersJava(writer, method, typeinfos_instance, false, false, mode); writer.println(");\n\t}"); return; } - if (context_specific) { + if ( context_specific ) { type_map.printCapabilitiesInit(writer); writer.print("\t\tlong " + Utils.FUNCTION_POINTER_VAR_NAME + " = " + type_map.getCapabilities() + "."); writer.println(Utils.getFunctionAddressName(interface_decl, method, true) + ";"); @@ -270,18 +306,20 @@ writer.println(Utils.FUNCTION_POINTER_VAR_NAME + ");"); } final Code code_annotation = method.getAnnotation(Code.class); - if (code_annotation != null && code_annotation.value().length() > 0) + if ( code_annotation != null && code_annotation.value().length() > 0 ) { writer.println(code_annotation.value()); - printBufferObjectChecks(writer, method, mode); + } + printBufferObjectChecks(writer, method, mode, context_specific); printParameterChecks(writer, method, typeinfos_instance, mode, generate_error_checks); - printParameterCaching(writer, interface_decl, method, mode); + printParameterCaching(writer, interface_decl, method, mode, context_specific); - if ( code_annotation != null && code_annotation.javaBeforeNative().length() > 0 ) + if ( code_annotation != null && code_annotation.javaBeforeNative().length() > 0 ) { writer.println(code_annotation.javaBeforeNative()); + } writer.print("\t\t"); final PointerWrapper pointer_wrapper_annotation = method.getAnnotation(PointerWrapper.class); - if (has_result) { + if ( has_result ) { writer.print(getResultType(method, false) + " " + Utils.RESULT_VAR_NAME); if ( code_annotation != null && code_annotation.tryBlock() ) { @@ -292,48 +330,56 @@ writer.print(" = "); if ( pointer_wrapper_annotation != null ) { - if ( pointer_wrapper_annotation.factory().length() > 0 ) + if ( pointer_wrapper_annotation.factory().length() > 0 ) { writer.print(pointer_wrapper_annotation.factory() + "("); - else + } else { writer.print("new " + getResultType(method, false) + "("); + } } } else if ( method.getAnnotation(GLreturn.class) != null ) { has_result = true; - Utils.printGLReturnPre(writer, method, method.getAnnotation(GLreturn.class)); + Utils.printGLReturnPre(writer, method, method.getAnnotation(GLreturn.class), type_map); } writer.print(Utils.getSimpleNativeMethodName(method, generate_error_checks, context_specific)); - if (mode == Mode.BUFFEROBJECT) + if ( mode == Mode.BUFFEROBJECT ) { writer.print(Utils.BUFFER_OBJECT_METHOD_POSTFIX); + } writer.print("("); - boolean first_parameter = printMethodCallArguments(writer, method, typeinfos_instance, mode); - if (context_specific) { - if (!first_parameter) + boolean first_parameter = printMethodCallArguments(writer, method, typeinfos_instance, mode, type_map); + if ( context_specific ) { + if ( !first_parameter ) { writer.print(", "); + } writer.print(Utils.FUNCTION_POINTER_VAR_NAME); } if ( has_result && pointer_wrapper_annotation != null ) { writer.print(")"); - if ( pointer_wrapper_annotation.params().length() > 0 ) + if ( pointer_wrapper_annotation.params().length() > 0 ) { writer.print(", " + pointer_wrapper_annotation.params()); + } } writer.println(");"); - if ( code_annotation != null && code_annotation.javaAfterNative().length() > 0 ) + if ( code_annotation != null && code_annotation.javaAfterNative().length() > 0 ) { writer.println(code_annotation.javaAfterNative()); + } final String tabs = code_annotation != null && code_annotation.tryBlock() ? "\t\t\t" : "\t\t"; - if (generate_error_checks && method.getAnnotation(NoErrorCheck.class) == null) + if ( generate_error_checks && method.getAnnotation(NoErrorCheck.class) == null ) { type_map.printErrorCheckMethod(writer, method, tabs); + } // DISABLED: indirect buffer support //printNondirectParameterCopies(writer, method, mode); - if (has_result) { + if ( has_result ) { if ( method.getAnnotation(GLreturn.class) == null ) { - if ( ByteBuffer.class.equals(Utils.getJavaType(result_type)) ) + if ( ByteBuffer.class.equals(Utils.getJavaType(result_type)) ) { writer.println(tabs + "return LWJGLUtil.CHECKS && " + Utils.RESULT_VAR_NAME + " == null ? null : " + Utils.RESULT_VAR_NAME + ".order(ByteOrder.nativeOrder());"); // safeNewBuffer returns a direct ByteBuffer with BIG_ENDIAN order. - else + } else { writer.println(tabs + "return " + Utils.RESULT_VAR_NAME + ";"); - } else - Utils.printGLReturnPost(writer, method, method.getAnnotation(GLreturn.class)); + } + } else { + Utils.printGLReturnPost(writer, method, method.getAnnotation(GLreturn.class), type_map); + } } if ( code_annotation != null && code_annotation.tryBlock() ) { @@ -344,206 +390,213 @@ writer.println("\t}"); } - private static String getExtensionPostfix(InterfaceDeclaration interface_decl) { - String interface_simple_name = interface_decl.getSimpleName(); + private static String getExtensionPostfix(TypeElement interface_decl) { + String interface_simple_name = interface_decl.getSimpleName().toString(); Extension extension_annotation = interface_decl.getAnnotation(Extension.class); - if (extension_annotation == null) { + if ( extension_annotation == null ) { int underscore_index = interface_simple_name.indexOf("_"); - if (underscore_index != -1) + if ( underscore_index != -1 ) { return interface_simple_name.substring(0, underscore_index); - else + } else { return ""; - } else + } + } else { return extension_annotation.postfix(); + } } - private static ParameterDeclaration getAutoTypeParameter(MethodDeclaration method, ParameterDeclaration target_parameter) { - for (ParameterDeclaration param : method.getParameters()) { + private static VariableElement getAutoTypeParameter(ExecutableElement method, VariableElement target_parameter) { + for ( VariableElement param : method.getParameters() ) { AnnotationMirror auto_annotation = Utils.getParameterAutoAnnotation(param); - if (auto_annotation != null) { + if ( auto_annotation != null ) { Class annotation_type = NativeTypeTranslator.getClassFromType(auto_annotation.getAnnotationType()); String parameter_name; - if (annotation_type.equals(AutoType.class)) + if ( annotation_type.equals(AutoType.class) ) { parameter_name = param.getAnnotation(AutoType.class).value(); - else if (annotation_type.equals(AutoSize.class)) + } else if ( annotation_type.equals(AutoSize.class) ) { parameter_name = param.getAnnotation(AutoSize.class).value(); - else + } else { throw new RuntimeException("Unknown annotation type " + annotation_type); - if (target_parameter.getSimpleName().equals(parameter_name)) + } + if ( target_parameter.getSimpleName().toString().equals(parameter_name) ) { return param; + } } } return null; } - private static boolean hasAnyParameterAutoTypeAnnotation(MethodDeclaration method, ParameterDeclaration target_param) { - for (ParameterDeclaration param : method.getParameters()) { + private static boolean hasAnyParameterAutoTypeAnnotation(ExecutableElement method, VariableElement target_param) { + for ( VariableElement param : method.getParameters() ) { AutoType auto_type_annotation = param.getAnnotation(AutoType.class); - if (auto_type_annotation != null) { - ParameterDeclaration type_target_param = Utils.findParameter(method, auto_type_annotation.value()); - if (target_param.equals(type_target_param)) + if ( auto_type_annotation != null ) { + VariableElement type_target_param = Utils.findParameter(method, auto_type_annotation.value()); + if ( target_param.equals(type_target_param) ) { return true; + } } } return false; } - private static String getPostfixStrippedName(TypeMap type_map, InterfaceDeclaration interface_decl, MethodDeclaration method) { + private static final Map postfixPatterns = new HashMap(); + + private static Pattern getPostfixPattern(String regex) { + Pattern pattern = postfixPatterns.get(regex); + if ( pattern == null ) { + postfixPatterns.put(regex, pattern = Pattern.compile(regex)); + } + return pattern; + } + + private static String getPostfixStrippedName(TypeMap type_map, TypeElement interface_decl, ExecutableElement method) { StripPostfix strip_annotation = method.getAnnotation(StripPostfix.class); - ParameterDeclaration postfix_parameter = Utils.findParameter(method, strip_annotation.value()); + VariableElement postfix_parameter = Utils.findParameter(method, strip_annotation.value()); String postfix = strip_annotation.postfix(); - if ( "NULL".equals(postfix) ) { + boolean postfixOverride = !("NULL".equals(postfix) && strip_annotation.hasPostfix()); + if ( !postfixOverride ) { PostfixTranslator translator = new PostfixTranslator(type_map, postfix_parameter); - postfix_parameter.getType().accept(translator); + postfix_parameter.asType().accept(translator, null); postfix = translator.getSignature(); + } else if ( !strip_annotation.hasPostfix() ) { + postfix = ""; } + String method_name; Alternate alt_annotation = method.getAnnotation(Alternate.class); - method_name = alt_annotation == null || alt_annotation.javaAlt() ? method.getSimpleName() : alt_annotation.value(); + method_name = alt_annotation == null || alt_annotation.javaAlt() ? method.getSimpleName().toString() : alt_annotation.value(); String extension_postfix = "NULL".equals(strip_annotation.extension()) ? getExtensionPostfix(interface_decl) : strip_annotation.extension(); - String result; - if ( strip_annotation.hasPostfix() && method_name.endsWith(postfix + "v" + extension_postfix)) - result = method_name.substring(0, method_name.length() - (postfix.length() + 1 + extension_postfix.length())); - else if ( strip_annotation.hasPostfix() && method_name.endsWith(postfix + extension_postfix)) - result = method_name.substring(0, method_name.length() - (postfix.length() + extension_postfix.length())); - else if ( strip_annotation.hasPostfix() && method_name.endsWith(postfix + "i_v" + extension_postfix) ) - result = method_name.substring(0, method_name.length() - (postfix.length() + 3 + extension_postfix.length())); - else if ( method_name.endsWith("i_v" + extension_postfix) ) - result = method_name.substring(0, method_name.length() - (3 + extension_postfix.length())); - else if (method_name.endsWith("v" + extension_postfix)) - result = method_name.substring(0, method_name.length() - (1 + extension_postfix.length())); - else - throw new RuntimeException(method + " is specified as being postfix stripped on parameter " + postfix_parameter + ", but it's postfix is not '" + postfix + "' nor 'v'"); + Matcher matcher = getPostfixPattern( + postfixOverride + ? (postfix + "(?:v)?" + extension_postfix + "$") + : ("(?:" + postfix + "(?:v)?|i(?:64)?_v|v)" + extension_postfix + "$") + ).matcher(method_name); + + if ( !matcher.find() ) { + throw new RuntimeException(method_name + " is specified as being postfix stripped on parameter " + postfix_parameter + ", but it's postfix is neither '" + postfix + "' nor 'v'"); + } - return result + extension_postfix; + return method_name.substring(0, matcher.start()) + extension_postfix; } private static int getBufferElementSizeExponent(Class c) { - if (IntBuffer.class.equals(c)) + if ( IntBuffer.class.equals(c) ) { return 2; - else if (LongBuffer.class.equals(c)) + } else if ( LongBuffer.class.equals(c) ) { return 3; - else if (DoubleBuffer.class.equals(c)) + } else if ( DoubleBuffer.class.equals(c) ) { return 3; - else if (ShortBuffer.class.equals(c)) + } else if ( ShortBuffer.class.equals(c) ) { return 1; - else if (ByteBuffer.class.equals(c)) + } else if ( ByteBuffer.class.equals(c) ) { return 0; - else if (FloatBuffer.class.equals(c)) + } else if ( FloatBuffer.class.equals(c) ) { return 2; - else + } else { throw new RuntimeException(c + " is not allowed"); + } } - private static boolean printMethodCallArgument(PrintWriter writer, MethodDeclaration method, ParameterDeclaration param, Map typeinfos_instance, Mode mode, boolean first_parameter) { - if (!first_parameter) + private static boolean printMethodCallArgument(PrintWriter writer, ExecutableElement method, VariableElement param, Map typeinfos_instance, Mode mode, boolean first_parameter, TypeMap type_map) { + if ( !first_parameter ) { writer.print(", "); + } AnnotationMirror auto_annotation = Utils.getParameterAutoAnnotation(param); Constant constant_annotation = param.getAnnotation(Constant.class); - if (constant_annotation != null) { + if ( constant_annotation != null ) { writer.print(constant_annotation.value()); - } else if (auto_annotation != null && mode == Mode.NORMAL) { + } else if ( auto_annotation != null && mode == Mode.NORMAL ) { Class param_type = NativeTypeTranslator.getClassFromType(auto_annotation.getAnnotationType()); - if (AutoType.class.equals(param_type)) { + if ( AutoType.class.equals(param_type) ) { final AutoType auto_type_annotation = param.getAnnotation(AutoType.class); - final ParameterDeclaration auto_parameter = Utils.findParameter(method, auto_type_annotation.value()); + final VariableElement auto_parameter = Utils.findParameter(method, auto_type_annotation.value()); final String auto_type = typeinfos_instance.get(auto_parameter).getAutoType(); - if ( auto_type == null ) + if ( auto_type == null ) { throw new RuntimeException("No auto type for parameter " + param.getSimpleName() + " in method " + method); + } writer.print(auto_type); - } else if (AutoSize.class.equals(param_type)) { + } else if ( AutoSize.class.equals(param_type) ) { final AutoSize auto_size_annotation = param.getAnnotation(AutoSize.class); - final String auto_parameter_name = auto_size_annotation.value(); - final ParameterDeclaration auto_target_param = Utils.findParameter(method, auto_parameter_name); - final TypeInfo auto_target_type_info = typeinfos_instance.get(auto_target_param); - final boolean shift_remaining = !hasAnyParameterAutoTypeAnnotation(method, auto_target_param) && Utils.isParameterMultiTyped(auto_target_param); - int shifting = 0; - if ( shift_remaining ) { - shifting = getBufferElementSizeExponent(auto_target_type_info.getType()); - if ( shifting > 0 ) - writer.print("("); - } - if ( auto_size_annotation.canBeNull() ) - writer.print("(" + auto_parameter_name + " == null ? 0 : " + auto_parameter_name + ".remaining())"); - else - writer.print(auto_parameter_name + ".remaining()"); - // Shift the remaining if the target parameter is multityped and there's no AutoType to track type - if (shift_remaining && shifting > 0) { - writer.print(" << " + shifting); - writer.print(")"); + if ( !auto_size_annotation.useExpression() ) { + final String auto_parameter_name = auto_size_annotation.value(); + final VariableElement auto_target_param = Utils.findParameter(method, auto_parameter_name); + final TypeInfo auto_target_type_info = typeinfos_instance.get(auto_target_param); + final boolean shift_remaining = !hasAnyParameterAutoTypeAnnotation(method, auto_target_param) && Utils.isParameterMultiTyped(auto_target_param); + int shifting = 0; + if ( shift_remaining ) { + shifting = getBufferElementSizeExponent(auto_target_type_info.getType()); + if ( shifting > 0 ) { + writer.print("("); + } + } + if ( auto_size_annotation.canBeNull() ) { + writer.print("(" + auto_parameter_name + " == null ? 0 : " + auto_parameter_name + ".remaining())"); + } else { + writer.print(auto_parameter_name + ".remaining()"); + } + // Shift the remaining if the target parameter is multityped and there's no AutoType to track type + if ( shift_remaining && shifting > 0 ) { + writer.print(" << " + shifting); + writer.print(")"); + } } writer.print(auto_size_annotation.expression()); - } else + } else { throw new RuntimeException("Unknown auto annotation " + param_type); + } } else { - if (mode == Mode.BUFFEROBJECT && param.getAnnotation(BufferObject.class) != null) { + if ( mode == Mode.BUFFEROBJECT && param.getAnnotation(BufferObject.class) != null ) { writer.print(param.getSimpleName() + Utils.BUFFER_OBJECT_PARAMETER_POSTFIX); } else { Class type = typeinfos_instance.get(param).getType(); Check check_annotation = param.getAnnotation(Check.class); boolean hide_buffer = mode == Mode.AUTOS && getAutoTypeParameter(method, param) != null; - if (hide_buffer) { - writer.print("null"); + if ( hide_buffer ) { + writer.print("0L"); } else { if ( type == CharSequence.class || type == CharSequence[].class ) { final String offset = Utils.getStringOffset(method, param); writer.print("APIUtil.getBuffer"); - if ( param.getAnnotation(NullTerminated.class) != null ) + if ( param.getAnnotation(NullTerminated.class) != null ) { writer.print("NT"); - writer.print("(" + param.getSimpleName()); - if ( offset != null ) + } + writer.print('('); + writer.print(type_map.getAPIUtilParam(true)); + writer.print(param.getSimpleName()); + if ( offset != null ) { writer.print(", " + offset); + } writer.print(")"); - hide_buffer = true; } else { final AutoSize auto_size_annotation = param.getAnnotation(AutoSize.class); - if ( auto_size_annotation != null ) + if ( auto_size_annotation != null ) { writer.print(auto_size_annotation.value() + "_"); - writer.print(param.getSimpleName()); - if ( PointerBuffer.class.isAssignableFrom(type) ) { - if ( check_annotation != null && check_annotation.canBeNull() ) - writer.print(" != null ? " + param.getSimpleName()); - writer.print(".getBuffer()"); - if ( check_annotation != null && check_annotation.canBeNull() ) - writer.print(" : null"); + } + + final Class buffer_type = Utils.getNIOBufferType(param.asType()); + if ( buffer_type == null ) { + writer.print(param.getSimpleName()); + } else { + writer.print("MemoryUtil.getAddress"); + if ( check_annotation != null && check_annotation.canBeNull() ) { + writer.print("Safe"); + } + writer.print("("); + writer.print(param.getSimpleName()); + writer.print(")"); } } } - Class buffer_type = Utils.getNIOBufferType(param.getType()); - if (buffer_type != null) { - writer.print(", "); - if (!hide_buffer) { - int shifting; - if (Utils.getNIOBufferType(param.getType()).equals(Buffer.class)) { - shifting = getBufferElementSizeExponent(type == Buffer.class ? ByteBuffer.class : type); // TODO: This will always throw an exception - //shifting = 0; - } else - shifting = 0; - writer.print(param.getSimpleName()); - if (check_annotation != null && check_annotation.canBeNull()) - writer.print(" != null ? " + param.getSimpleName()); - if ( type == PointerBuffer.class ) - writer.print(".positionByte()"); - else - writer.print(".position()"); - if (shifting > 0) - writer.print(" << " + shifting); - if (check_annotation != null && check_annotation.canBeNull()) - writer.print(" : 0"); - } else if ( type == CharSequence.class || type == CharSequence[].class ) { - final String offset = Utils.getStringOffset(method, param); - writer.print(offset == null ? "0" : offset); - } else - writer.print("0"); - } else if ( type != long.class ) { + if ( type != long.class ) { PointerWrapper pointer_annotation = param.getAnnotation(PointerWrapper.class); if ( pointer_annotation != null ) { - if ( pointer_annotation.canBeNull() ) + if ( pointer_annotation.canBeNull() ) { writer.print(" == null ? 0 : " + param.getSimpleName()); + } writer.print(".getPointer()"); } } @@ -552,34 +605,38 @@ return false; } - private static boolean printMethodCallArguments(PrintWriter writer, MethodDeclaration method, Map typeinfos_instance, Mode mode) { + private static boolean printMethodCallArguments(PrintWriter writer, ExecutableElement method, Map typeinfos_instance, Mode mode, TypeMap type_map) { boolean first_parameter = true; - for ( ParameterDeclaration param : method.getParameters() ) { - if ( param.getAnnotation(Result.class) != null || (param.getAnnotation(Helper.class) != null && !param.getAnnotation(Helper.class).passToNative()) ) + for ( VariableElement param : method.getParameters() ) { + if ( param.getAnnotation(Result.class) != null || (param.getAnnotation(Helper.class) != null && !param.getAnnotation(Helper.class).passToNative()) ) { continue; + } final Constant constant_annotation = param.getAnnotation(Constant.class); - if ( constant_annotation== null || !constant_annotation.isNative() ) - first_parameter = printMethodCallArgument(writer, method, param, typeinfos_instance, mode, first_parameter); + if ( constant_annotation == null || !constant_annotation.isNative() ) { + first_parameter = printMethodCallArgument(writer, method, param, typeinfos_instance, mode, first_parameter, type_map); + } } - if (Utils.getNIOBufferType(Utils.getMethodReturnType(method)) != null) { - if (method.getAnnotation(CachedResult.class) != null && method.getAnnotation(CachedResult.class).isRange()) { + if ( Utils.getNIOBufferType(Utils.getMethodReturnType(method)) != null ) { + if ( method.getAnnotation(CachedResult.class) != null && method.getAnnotation(CachedResult.class).isRange() ) { first_parameter = false; Utils.printExtraCallArguments(writer, method, ""); } else { AutoSize auto_size_annotation = method.getAnnotation(AutoSize.class); if ( auto_size_annotation == null || !auto_size_annotation.isNative() ) { - if (!first_parameter) + if ( !first_parameter ) { writer.print(", "); + } first_parameter = false; String result_size_expression; - if ( mode == Mode.CACHEDRESULT ) + if ( mode == Mode.CACHEDRESULT ) { result_size_expression = Utils.CACHED_BUFFER_LENGTH_NAME; - else if ( auto_size_annotation == null ) + } else if ( auto_size_annotation == null ) { result_size_expression = Utils.RESULT_SIZE_NAME; - else + } else { result_size_expression = auto_size_annotation.value(); + } Utils.printExtraCallArguments(writer, method, result_size_expression); } @@ -588,120 +645,104 @@ return first_parameter; } - private static void printParameterCaching(PrintWriter writer, InterfaceDeclaration interface_decl, MethodDeclaration method, Mode mode) { - for (ParameterDeclaration param : method.getParameters()) { - Class java_type = Utils.getJavaType(param.getType()); - CachedReference cachedReference = param.getAnnotation(CachedReference.class); - if (Buffer.class.isAssignableFrom(java_type) && - cachedReference != null && - (mode != Mode.BUFFEROBJECT || param.getAnnotation(BufferObject.class) == null) && - param.getAnnotation(Result.class) == null) { - writer.print("\t\tif ( LWJGLUtil.CHECKS ) " + "StateTracker.getReferences(caps)."); - if(cachedReference.name().length() > 0) { - writer.print(cachedReference.name()); - } else { - writer.print(Utils.getReferenceName(interface_decl, method, param)); - } - if(cachedReference.index().length() > 0) { - writer.print("[" + cachedReference.index() + "]"); - } - writer.println(" = " + param.getSimpleName() + ";"); - } - } - } - - private static void printNondirectParameterCopies(PrintWriter writer, MethodDeclaration method, Mode mode) { - for (ParameterDeclaration param : method.getParameters()) { - Class java_type = Utils.getJavaType(param.getType()); - if (Utils.isAddressableType(java_type) && - (mode != Mode.BUFFEROBJECT || param.getAnnotation(BufferObject.class) == null) && - (mode != Mode.AUTOS || getAutoTypeParameter(method, param) == null) && - param.getAnnotation(Result.class) == null) { - if (Buffer.class.isAssignableFrom(java_type)) { - boolean out_parameter = param.getAnnotation(OutParameter.class) != null; - if (out_parameter) - writer.println("\t\tNondirectBufferWrapper.copy(" + param.getSimpleName() + ", " + param.getSimpleName() + SAVED_PARAMETER_POSTFIX + ");"); + private static void printParameterCaching(PrintWriter writer, TypeElement interface_decl, ExecutableElement method, Mode mode, boolean context_specific) { + for ( VariableElement param : method.getParameters() ) { + Class java_type = Utils.getJavaType(param.asType()); + CachedReference cachedReference = param.getAnnotation(CachedReference.class); + if ( Buffer.class.isAssignableFrom(java_type) + && cachedReference != null + && (mode != Mode.BUFFEROBJECT || param.getAnnotation(BufferObject.class) == null) + && param.getAnnotation(Result.class) == null ) { + writer.print("\t\tif ( LWJGLUtil.CHECKS ) StateTracker."); + if ( context_specific ) { + writer.print("getReferences(caps)."); + } else { + writer.print("getTracker()."); + } + if ( cachedReference.name().length() > 0 ) { + writer.print(cachedReference.name()); + } else { + writer.print(Utils.getReferenceName(interface_decl, method, param)); + } + if ( cachedReference.index().length() > 0 ) { + writer.print("[" + cachedReference.index() + "]"); } + writer.println(" = " + param.getSimpleName() + ";"); } } } - private static void printParameterChecks(PrintWriter writer, MethodDeclaration method, Map typeinfos, Mode mode, final boolean generate_error_checks) { + private static void printParameterChecks(PrintWriter writer, ExecutableElement method, Map typeinfos, Mode mode, final boolean generate_error_checks) { if ( mode == Mode.NORMAL ) { final GenerateAutos gen_autos_annotation = method.getAnnotation(GenerateAutos.class); if ( gen_autos_annotation != null && gen_autos_annotation.sizeVariables().length > 0 ) { // For the auto-generated parameters, declare and init a size variable (that can be reused by @Code) - for ( final ParameterDeclaration param : method.getParameters() ) { - if ( Arrays.binarySearch(gen_autos_annotation.sizeVariables(), param.getSimpleName()) >= 0 ) { + for ( final VariableElement param : method.getParameters() ) { + if ( Arrays.binarySearch(gen_autos_annotation.sizeVariables(), param.getSimpleName().toString()) >= 0 ) { final int shifting = getBufferElementSizeExponent(typeinfos.get(param).getType()); final Check check_annotation = param.getAnnotation(Check.class); writer.print("\t\tlong " + param.getSimpleName() + "_size = "); - if ( check_annotation == null || !check_annotation.canBeNull() ) + if ( check_annotation == null || !check_annotation.canBeNull() ) { writer.println(param.getSimpleName() + ".remaining() << " + shifting + ";"); - else + } else { writer.println(param.getSimpleName() + " == null ? 0 : " + param.getSimpleName() + ".remaining() << " + shifting + ";"); + } } } } } - for (ParameterDeclaration param : method.getParameters()) { - Class java_type = Utils.getJavaType(param.getType()); - if ( java_type.isArray() || (Utils.isAddressableType(java_type) && - (mode != Mode.BUFFEROBJECT || param.getAnnotation(BufferObject.class) == null) && - (mode != Mode.AUTOS || getAutoTypeParameter(method, param) == null) && - param.getAnnotation(Result.class) == null && - !Utils.isReturnParameter(method, param)) ) { + for ( VariableElement param : method.getParameters() ) { + Class java_type = Utils.getJavaType(param.asType()); + if ( java_type.isArray() || (Utils.isAddressableType(java_type) + && (mode != Mode.BUFFEROBJECT || param.getAnnotation(BufferObject.class) == null) + && (mode != Mode.AUTOS || getAutoTypeParameter(method, param) == null) + && param.getAnnotation(Result.class) == null + && !Utils.isReturnParameter(method, param)) ) { String check_value = null; boolean can_be_null = false; Check check_annotation = param.getAnnotation(Check.class); - if (check_annotation != null) { + if ( check_annotation != null ) { check_value = check_annotation.value(); can_be_null = check_annotation.canBeNull(); } - if ((Buffer.class.isAssignableFrom(java_type) || PointerBuffer.class.isAssignableFrom(java_type)) && param.getAnnotation(Constant.class) == null) { - boolean indirect_buffer_allowed = false && param.getAnnotation(CachedReference.class) == null; // DISABLED: indirect buffer support - boolean out_parameter = param.getAnnotation(OutParameter.class) != null; + if ( (Buffer.class.isAssignableFrom(java_type) || PointerBuffer.class.isAssignableFrom(java_type)) && param.getAnnotation(Constant.class) == null ) { TypeInfo typeinfo = typeinfos.get(param); - printParameterCheck(writer, method, param.getSimpleName(), typeinfo.getType().getSimpleName(), check_value, can_be_null, param.getAnnotation(NullTerminated.class), indirect_buffer_allowed, out_parameter, generate_error_checks); - } else if ( String.class.equals(java_type)) { - if (!can_be_null) + printParameterCheck(writer, method, param.getSimpleName().toString(), typeinfo.getType().getSimpleName(), check_value, can_be_null, param.getAnnotation(NullTerminated.class), generate_error_checks); + } else if ( String.class.equals(java_type) ) { + if ( !can_be_null ) { writer.println("\t\tBufferChecks.checkNotNull(" + param.getSimpleName() + ");"); + } } else if ( java_type.isArray() ) { - final TypeInfo typeinfo = typeinfos.get(param); - printArrayParameterCheck(writer, param.getSimpleName(), typeinfo.getType().getSimpleName(), check_value, can_be_null); + printArrayParameterCheck(writer, param.getSimpleName().toString(), check_value, can_be_null); } } } - if (method.getAnnotation(CachedResult.class) != null) - printParameterCheck(writer, method, Utils.CACHED_BUFFER_NAME, null, null, true, null, false, false, generate_error_checks); + if ( method.getAnnotation(CachedResult.class) != null ) { + printParameterCheck(writer, method, Utils.CACHED_BUFFER_NAME, null, null, true, null, generate_error_checks); + } } - private static void printParameterCheck(PrintWriter writer, MethodDeclaration method, String name, String type, String check_value, boolean can_be_null, NullTerminated null_terminated, boolean indirect_buffer_allowed, boolean out_parameter, final boolean generate_error_checks) { - if (indirect_buffer_allowed && out_parameter) { - writer.println("\t\t" + type + " " + name + SAVED_PARAMETER_POSTFIX + " = " + name + ";"); - } + private static void printParameterCheck(PrintWriter writer, ExecutableElement method, String name, String type, String check_value, boolean can_be_null, NullTerminated null_terminated, boolean generate_error_checks) { String tabs; - if (can_be_null) { + if ( can_be_null ) { writer.print("\t\tif (" + name + " != null)"); - if ( null_terminated != null ) + if ( null_terminated != null ) { writer.println(" {"); - else + } else { writer.println(); + } tabs = "\t\t\t"; - } else + } else { tabs = "\t\t"; - if (indirect_buffer_allowed) { - writer.print(tabs + name + " = NondirectBufferWrapper.wrap"); - if (out_parameter) - writer.print("NoCopy"); - } else - writer.print(tabs + "BufferChecks.check"); - if (check_value != null && check_value.length() > 0) { + } + writer.print(tabs + "BufferChecks.check"); + if ( check_value != null && check_value.length() > 0 ) { writer.print("Buffer"); - if ( "Buffer".equals(type) ) + if ( "Buffer".equals(type) ) { writer.print("Size"); // Check size only, Buffer.isDirect() was added in 1.6, cannot use yet. TODO: Remove? + } writer.print("(" + name + ", " + check_value); } else { writer.print("Direct(" + name); @@ -714,7 +755,7 @@ writer.println("\t\t\t" + name + " = APIUtil.getBufferIntDebug();"); // Use an exclusive buffer here } } - if (null_terminated != null) { + if ( null_terminated != null ) { writer.print(tabs + "BufferChecks.checkNullTerminated("); writer.print(name); if ( null_terminated.value().length() > 0 ) { @@ -722,52 +763,59 @@ writer.print(null_terminated.value()); } writer.println(");"); - if ( can_be_null ) + if ( can_be_null ) { writer.println("\t\t}"); + } } } - private static void printArrayParameterCheck(PrintWriter writer, String name, String type, String check_value, boolean can_be_null) { + private static void printArrayParameterCheck(PrintWriter writer, String name, String check_value, boolean can_be_null) { String tabs; if ( can_be_null ) { writer.println("\t\tif (" + name + " != null)"); tabs = "\t\t\t"; - } else + } else { tabs = "\t\t"; + } writer.print(tabs + "BufferChecks.checkArray(" + name); - if ( check_value != null && check_value.length() > 0) + if ( check_value != null && check_value.length() > 0 ) { writer.print(", " + check_value); + } writer.println(");"); } - private static String getResultType(MethodDeclaration method, boolean native_stub) { - if ( native_stub && method.getAnnotation(PointerWrapper.class) != null ) + private static String getResultType(ExecutableElement method, boolean native_stub) { + if ( native_stub && method.getAnnotation(PointerWrapper.class) != null ) { return "long"; - else if ( !native_stub && method.getAnnotation(GLreturn.class) != null ) + } else if ( !native_stub && method.getAnnotation(GLreturn.class) != null ) { return Utils.getMethodReturnType(method, method.getAnnotation(GLreturn.class), false); - else + } else { return Utils.getJavaType(Utils.getMethodReturnType(method)).getSimpleName(); + } } - private static String getDefaultResultValue(MethodDeclaration method) { + private static String getDefaultResultValue(ExecutableElement method) { if ( method.getAnnotation(GLreturn.class) != null ) { final String type = Utils.getMethodReturnType(method, method.getAnnotation(GLreturn.class), false); - if ( "boolean".equals(type) ) + if ( "boolean".equals(type) ) { return "false"; - else if ( Character.isLowerCase(type.charAt(0)) ) + } else if ( Character.isLowerCase(type.charAt(0)) ) { return "0"; - else + } else { return "null"; + } } else { final Class type = Utils.getJavaType(Utils.getMethodReturnType(method)); if ( type.isPrimitive() ) { - if ( type == boolean.class ) + if ( type == boolean.class ) { return "false"; - else + } else { return "0"; - } else + } + } else { return "null"; + } } } diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/JavaTypeTranslator.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/JavaTypeTranslator.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/JavaTypeTranslator.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/JavaTypeTranslator.java 2016-04-09 16:26:56.000000000 +0000 @@ -29,54 +29,50 @@ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - package org.lwjgl.util.generator; -import org.lwjgl.opencl.CLMem; - import java.nio.ByteBuffer; - -import com.sun.mirror.type.*; -import com.sun.mirror.util.*; +import javax.lang.model.type.*; +import javax.lang.model.util.SimpleTypeVisitor6; /** - * A TypeVisitor that translates (annotated) TypeMirrors to - * java types (represented by a Class) + * A TypeVisitor that translates (annotated) TypeMirrors to java types + * (represented by a Class) * * @author elias_naur - * @version $Revision: 3430 $ - * $Id: JavaTypeTranslator.java 3430 2010-10-04 17:04:46Z spasi $ + * @version $Revision$ $Id$ */ -public class JavaTypeTranslator implements TypeVisitor { +public class JavaTypeTranslator extends SimpleTypeVisitor6 { + private Class type; public Class getType() { return type; } - public void visitAnnotationType(AnnotationType t) { - throw new RuntimeException(t + " is not allowed"); - } - - public void visitArrayType(ArrayType t) { + @Override + public Void visitArray(ArrayType t, Void o) { final TypeMirror componentType = t.getComponentType(); - if ( componentType instanceof PrimitiveType ) { - type = getPrimitiveArrayClassFromKind(((PrimitiveType)componentType).getKind()); - } else { - try { - final Class c = Class.forName(t.getComponentType().toString()); - if ( CharSequence.class.isAssignableFrom(c) || ByteBuffer.class.isAssignableFrom(c) || org.lwjgl.PointerWrapper.class.isAssignableFrom(c) ) - type = Class.forName("[L" + t.getComponentType() + ";"); - else { + try { + final Class c = Class.forName(t.getComponentType().toString()); + if ( CharSequence.class.isAssignableFrom(c) || ByteBuffer.class.isAssignableFrom(c) || org.lwjgl.PointerWrapper.class.isAssignableFrom(c) ) { + type = Class.forName("[L" + t.getComponentType() + ";"); + } + } catch (ClassNotFoundException ex) { + type = null; + } finally { + if ( type == null ) { + if ( componentType instanceof PrimitiveType ) { + type = getPrimitiveArrayClassFromKind(componentType.getKind()); + } else { throw new RuntimeException(t + " is not allowed"); } - } catch (ClassNotFoundException e) { - throw new RuntimeException(e); } + return DEFAULT_VALUE; } } - public static Class getPrimitiveClassFromKind(PrimitiveType.Kind kind) { + public static Class getPrimitiveClassFromKind(TypeKind kind) { switch ( kind ) { case LONG: return long.class; @@ -97,7 +93,7 @@ } } - private static Class getPrimitiveArrayClassFromKind(PrimitiveType.Kind kind) { + private static Class getPrimitiveArrayClassFromKind(TypeKind kind) { switch ( kind ) { case LONG: return long[].class; @@ -118,43 +114,36 @@ } } - public void visitPrimitiveType(PrimitiveType t) { + @Override + public Void visitPrimitive(PrimitiveType t, Void p) { type = getPrimitiveClassFromKind(t.getKind()); + return DEFAULT_VALUE; } - public void visitDeclaredType(DeclaredType t) { - throw new RuntimeException(t + " is not allowed"); - } - - public void visitEnumType(EnumType t) { - throw new RuntimeException(t + " is not allowed"); + @Override + public Void visitDeclared(DeclaredType t, Void o) { + if ( t.asElement().getKind().isClass() ) { + visitClassType(t); + } else if ( t.asElement().getKind().isInterface() ) { + visitInterfaceType(t); + } else { + throw new RuntimeException(t.asElement().getKind() + " is not allowed"); + } + return DEFAULT_VALUE; } - public void visitClassType(ClassType t) { + private void visitClassType(DeclaredType t) { type = NativeTypeTranslator.getClassFromType(t); } - public void visitInterfaceType(InterfaceType t) { + private void visitInterfaceType(DeclaredType t) { type = NativeTypeTranslator.getClassFromType(t); } - public void visitReferenceType(ReferenceType t) { - throw new RuntimeException(t + " is not allowed"); - } - - public void visitTypeMirror(TypeMirror t) { - throw new RuntimeException(t + " is not allowed"); - } - - public void visitTypeVariable(TypeVariable t) { - throw new RuntimeException(t + " is not allowed"); - } - - public void visitVoidType(VoidType t) { + @Override + public Void visitNoType(NoType t, Void p) { type = void.class; + return DEFAULT_VALUE; } - public void visitWildcardType(WildcardType t) { - throw new RuntimeException(t + " is not allowed"); - } } diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/JNITypeTranslator.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/JNITypeTranslator.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/JNITypeTranslator.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/JNITypeTranslator.java 2016-04-09 16:26:56.000000000 +0000 @@ -32,60 +32,71 @@ package org.lwjgl.util.generator; -import com.sun.mirror.type.*; -import com.sun.mirror.util.*; +import org.lwjgl.PointerBuffer; + +import java.nio.Buffer; +import javax.lang.model.type.ArrayType; +import javax.lang.model.type.DeclaredType; +import javax.lang.model.type.NoType; +import javax.lang.model.type.PrimitiveType; +import javax.lang.model.util.SimpleTypeVisitor6; /** - * * A TypeVisitor that translates TypeMirrors to JNI * type strings. * * @author elias_naur - * @version $Revision: 3412 $ - * $Id: JNITypeTranslator.java 3412 2010-09-26 23:43:24Z spasi $ + * @version $Revision$ + * $Id$ */ -public class JNITypeTranslator implements TypeVisitor { +public class JNITypeTranslator extends SimpleTypeVisitor6 { + private final StringBuilder signature = new StringBuilder(); + private boolean objectReturn; + public String getSignature() { return signature.toString(); } - public void visitAnnotationType(AnnotationType t) { - throw new RuntimeException(t + " is not allowed"); + public String getReturnSignature() { + return objectReturn ? "jobject" : signature.toString(); } - public void visitArrayType(ArrayType t) { + @Override + public Void visitArray(ArrayType t, Void o) { final String className = t.getComponentType().toString(); if ( "java.lang.CharSequence".equals(className) ) - signature.append("jobject"); + signature.append("jlong"); else if ( "java.nio.ByteBuffer".equals(className) ) signature.append("jobjectArray"); else if ( "org.lwjgl.opencl.CLMem".equals(className) ) signature.append("jobjectArray"); else throw new RuntimeException(t + " is not allowed"); + return DEFAULT_VALUE; } - public void visitClassType(ClassType t) { - signature.append("jobject"); - } - - public void visitDeclaredType(DeclaredType t) { - throw new RuntimeException(t + " is not allowed"); - } - - public void visitEnumType(EnumType t) { - throw new RuntimeException(t + " is not allowed"); + private void visitClassType(DeclaredType t) { + final Class type = Utils.getJavaType(t); + if ( Buffer.class.isAssignableFrom(type) || PointerBuffer.class.isAssignableFrom(type) ) { + signature.append("jlong"); + objectReturn = true; + } else + signature.append("jobject"); } - public void visitInterfaceType(InterfaceType t) { - throw new RuntimeException(t + " is not allowed"); + @Override + public Void visitDeclared(DeclaredType t, Void o) { + if ( t.asElement().getKind().isClass() ) + visitClassType(t); + return DEFAULT_VALUE; } - public void visitPrimitiveType(PrimitiveType t) { + @Override + public Void visitPrimitive(PrimitiveType t, Void o) { String type; - switch (t.getKind()) { + switch ( t.getKind() ) { case LONG: type = "jlong"; break; @@ -111,25 +122,13 @@ throw new RuntimeException(t + " is not allowed"); } signature.append(type); + return DEFAULT_VALUE; } - public void visitReferenceType(ReferenceType t) { - throw new RuntimeException(t + " is not allowed"); - } - - public void visitTypeMirror(TypeMirror t) { - throw new RuntimeException(t + " is not allowed"); - } - - public void visitTypeVariable(TypeVariable t) { - throw new RuntimeException(t + " is not allowed"); - } - - public void visitVoidType(VoidType t) { + @Override + public Void visitNoType(NoType t, Void o) { signature.append(t.toString()); + return DEFAULT_VALUE; } - public void visitWildcardType(WildcardType t) { - throw new RuntimeException(t + " is not allowed"); - } } diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/NativeMethodStubsGenerator.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/NativeMethodStubsGenerator.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/NativeMethodStubsGenerator.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/NativeMethodStubsGenerator.java 2016-04-09 16:26:56.000000000 +0000 @@ -37,39 +37,42 @@ * This class generates the functions in the native source files. * * @author elias_naur - * @version $Revision: 3418 $ - * $Id: NativeMethodStubsGenerator.java 3418 2010-09-28 21:11:35Z spasi $ + * @version $Revision$ + * $Id$ */ import org.lwjgl.PointerBuffer; -import com.sun.mirror.apt.*; -import com.sun.mirror.declaration.*; -import com.sun.mirror.type.*; - -import java.io.*; -import java.util.*; -import java.nio.*; +import java.io.PrintWriter; +import java.nio.Buffer; +import java.util.List; +import javax.annotation.processing.ProcessingEnvironment; +import javax.lang.model.element.Element; +import javax.lang.model.element.ExecutableElement; +import javax.lang.model.element.TypeElement; +import javax.lang.model.element.VariableElement; +import javax.lang.model.type.TypeKind; +import javax.lang.model.type.TypeMirror; public class NativeMethodStubsGenerator { - private static final String BUFFER_ADDRESS_POSTFIX = "_address"; - public static final String BUFFER_POSITION_POSTFIX = "_position"; - private static final String STRING_LIST_NAME = "_str"; - private static final String POINTER_LIST_NAME = "_ptr"; + private static final String BUFFER_ADDRESS_POSTFIX = "_address"; + public static final String BUFFER_POSITION_POSTFIX = "_position"; + private static final String STRING_LIST_NAME = "_str"; + private static final String POINTER_LIST_NAME = "_ptr"; - public static void generateNativeMethodStubs(AnnotationProcessorEnvironment env, TypeMap type_map, PrintWriter writer, InterfaceDeclaration d, boolean generate_error_checks, boolean context_specific) { - for (MethodDeclaration method : d.getMethods()) { + public static void generateNativeMethodStubs(ProcessingEnvironment env, TypeMap type_map, PrintWriter writer, TypeElement d, boolean generate_error_checks, boolean context_specific) { + for ( ExecutableElement method : Utils.getMethods(d) ) { Alternate alt_annotation = method.getAnnotation(Alternate.class); if ( (alt_annotation != null && (!alt_annotation.nativeAlt() || alt_annotation.skipNative())) || method.getAnnotation(Reuse.class) != null ) continue; generateMethodStub(env, type_map, writer, Utils.getQualifiedClassName(d), method, Mode.NORMAL, generate_error_checks, context_specific); - if (Utils.hasMethodBufferObjectParameter(method)) + if ( Utils.hasMethodBufferObjectParameter(method) ) generateMethodStub(env, type_map, writer, Utils.getQualifiedClassName(d), method, Mode.BUFFEROBJECT, generate_error_checks, context_specific); } } - private static void generateParameters(PrintWriter writer, Collection params, Mode mode) { - for (ParameterDeclaration param : params) { + private static void generateParameters(PrintWriter writer, List params, Mode mode) { + for ( VariableElement param : params ) { if ( param.getAnnotation(Result.class) != null || (param.getAnnotation(Helper.class) != null && !param.getAnnotation(Helper.class).passToNative()) ) continue; final Constant constant_annotation = param.getAnnotation(Constant.class); @@ -78,22 +81,20 @@ } } - private static void generateParameter(PrintWriter writer, ParameterDeclaration param, Mode mode) { + private static void generateParameter(PrintWriter writer, VariableElement param, Mode mode) { writer.print(", "); - if (mode == Mode.BUFFEROBJECT && param.getAnnotation(BufferObject.class) != null) { + if ( mode == Mode.BUFFEROBJECT && param.getAnnotation(BufferObject.class) != null ) { writer.print("jlong " + param.getSimpleName() + Utils.BUFFER_OBJECT_PARAMETER_POSTFIX); } else if ( param.getAnnotation(PointerWrapper.class) != null ) { writer.print("jlong " + param.getSimpleName()); } else { JNITypeTranslator translator = new JNITypeTranslator(); - param.getType().accept(translator); + param.asType().accept(translator, null); writer.print(translator.getSignature() + " " + param.getSimpleName()); - if (Utils.getNIOBufferType(param.getType()) != null) - writer.print(", jint " + param.getSimpleName() + BUFFER_POSITION_POSTFIX); } } - private static void generateMethodStub(AnnotationProcessorEnvironment env, TypeMap type_map, PrintWriter writer, String interface_name, MethodDeclaration method, Mode mode, boolean generate_error_checks, boolean context_specific) { + private static void generateMethodStub(ProcessingEnvironment env, TypeMap type_map, PrintWriter writer, String interface_name, ExecutableElement method, Mode mode, boolean generate_error_checks, boolean context_specific) { if ( !context_specific && method.getAnnotation(Alternate.class) == null ) writer.print("static "); else @@ -107,30 +108,30 @@ writer.print("jlong"); } else { JNITypeTranslator translator = new JNITypeTranslator(); - result_type.accept(translator); - writer.print(translator.getSignature()); + result_type.accept(translator, null); + writer.print(translator.getReturnSignature()); } writer.print(" JNICALL "); writer.print(Utils.getQualifiedNativeMethodName(interface_name, method, generate_error_checks, context_specific)); - if (mode == Mode.BUFFEROBJECT) + if ( mode == Mode.BUFFEROBJECT ) writer.print(Utils.BUFFER_OBJECT_METHOD_POSTFIX); writer.print("(JNIEnv *env, jclass clazz"); generateParameters(writer, method.getParameters(), mode); - if (Utils.getNIOBufferType(result_type) != null) { + if ( Utils.getNIOBufferType(result_type) != null ) { if ( (cached_result_annotation == null || !cached_result_annotation.isRange()) && (auto_size_annotation == null || !auto_size_annotation.isNative()) ) writer.print(", jlong " + Utils.RESULT_SIZE_NAME); - if (cached_result_annotation != null) + if ( cached_result_annotation != null ) writer.print(", jobject " + Utils.CACHED_BUFFER_NAME); } - if (context_specific) { + if ( context_specific ) { writer.print(", jlong " + Utils.FUNCTION_POINTER_VAR_NAME); } writer.println(") {"); generateBufferParameterAddresses(type_map, writer, method, mode); Alternate alt_annotation = method.getAnnotation(Alternate.class); - if (context_specific) { + if ( context_specific ) { String typedef_name = Utils.getTypedefName(method); writer.print("\t" + typedef_name + " " + (alt_annotation == null ? method.getSimpleName() : alt_annotation.value())); writer.print(" = (" + typedef_name + ")((intptr_t)"); @@ -139,7 +140,7 @@ final Code code_annotation = method.getAnnotation(Code.class); - final boolean hasResult = !result_type.equals(env.getTypeUtils().getVoidType()); + final boolean hasResult = !result_type.equals(env.getTypeUtils().getNoType(TypeKind.VOID)); final boolean resultPreDeclare = hasResult && (hasPointerArrayInits(method.getParameters()) || (code_annotation != null && (code_annotation.nativeAfterVars().length() > 0 || code_annotation.nativeBeforeCall().length() > 0))); if ( resultPreDeclare ) printResultParam(type_map, writer, method, result_type, true); @@ -166,21 +167,21 @@ writer.println(code_annotation.nativeAfterCall()); generateStringDeallocations(writer, method.getParameters()); - if (!result_type.equals(env.getTypeUtils().getVoidType())) { + if ( !result_type.equals(env.getTypeUtils().getNoType(TypeKind.VOID)) ) { writer.print("\treturn "); Class java_result_type = Utils.getJavaType(result_type); - if (Buffer.class.isAssignableFrom(java_result_type)) { - if (cached_result_annotation != null) + if ( Buffer.class.isAssignableFrom(java_result_type) ) { + if ( cached_result_annotation != null ) writer.print("safeNewBufferCached(env, "); else writer.print("safeNewBuffer(env, "); - } else if (String.class.equals(java_result_type)) { + } else if ( String.class.equals(java_result_type) ) { writer.print("NewStringNativeUnsigned(env, "); } else if ( method.getAnnotation(PointerWrapper.class) != null ) { writer.print("(intptr_t)"); } writer.print(Utils.RESULT_VAR_NAME); - if (Buffer.class.isAssignableFrom(java_result_type)) { + if ( Buffer.class.isAssignableFrom(java_result_type) ) { final String size_parameter_name; if ( auto_size_annotation != null && (auto_size_annotation.isNative() || (cached_result_annotation != null && cached_result_annotation.isRange())) ) size_parameter_name = auto_size_annotation.value(); @@ -190,8 +191,8 @@ writer.print(", "); Utils.printExtraCallArguments(writer, method, size_parameter_name); } - if (Buffer.class.isAssignableFrom(java_result_type) || - String.class.equals(java_result_type)) + if ( Buffer.class.isAssignableFrom(java_result_type) || + String.class.equals(java_result_type) ) writer.print(")"); writer.println(";"); } @@ -199,24 +200,24 @@ writer.println(); } - private static void printResultParam(final TypeMap type_map, final PrintWriter writer, final MethodDeclaration method, final TypeMirror result_type, final boolean preDeclare) { - final ParameterDeclaration result_param = Utils.getResultParameter(method); - final Declaration return_declaration = result_param == null ? method : result_param; + private static void printResultParam(final TypeMap type_map, final PrintWriter writer, final ExecutableElement method, final TypeMirror result_type, final boolean preDeclare) { + final VariableElement result_param = Utils.getResultParameter(method); + final Element return_declaration = result_param == null ? method : result_param; final NativeTypeTranslator result_translator = new NativeTypeTranslator(type_map, return_declaration); - result_type.accept(result_translator); + result_type.accept(result_translator, null); if ( preDeclare ) writer.print("\t"); writer.print(result_translator.getSignature() + " " + Utils.RESULT_VAR_NAME); - if ( preDeclare) + if ( preDeclare ) writer.println(";"); else writer.print(result_param == null ? " = " : ";\n\t"); } - private static void generateCallParameters(PrintWriter writer, TypeMap type_map, Collection params) { - if (params.size() > 0) { + private static void generateCallParameters(PrintWriter writer, TypeMap type_map, List params) { + if ( params.size() > 0 ) { boolean first = true; - for ( ParameterDeclaration param : params ) { + for ( VariableElement param : params ) { if ( param.getAnnotation(Helper.class) != null ) continue; @@ -230,7 +231,7 @@ } } - private static void generateCallParameter(PrintWriter writer, TypeMap type_map, ParameterDeclaration param) { + private static void generateCallParameter(PrintWriter writer, TypeMap type_map, VariableElement param) { if ( param.getAnnotation(Helper.class) != null ) return; @@ -241,16 +242,16 @@ } boolean is_indirect = param.getAnnotation(Indirect.class) != null; - if (is_indirect || param.getAnnotation(PointerArray.class) != null) { + if ( is_indirect || param.getAnnotation(PointerArray.class) != null ) { writer.print("("); final NativeTypeTranslator translator = new NativeTypeTranslator(type_map, param); - param.getType().accept(translator); + param.asType().accept(translator, null); writer.print(translator.getSignature()); writer.print("*)"); } if ( param.getAnnotation(PointerWrapper.class) != null ) writer.print("(" + param.getAnnotation(PointerWrapper.class).value() + ")(intptr_t)"); - if (param.getAnnotation(Result.class) != null || is_indirect) + if ( param.getAnnotation(Result.class) != null || is_indirect ) writer.print("&"); if ( param.getAnnotation(Result.class) != null ) { @@ -258,70 +259,57 @@ } else { writer.print(param.getSimpleName()); if ( param.getAnnotation(PointerArray.class) != null ) - writer.print(getPointerArrayName(Utils.getJavaType(param.getType()))); - else if ( Utils.isAddressableType(param.getType()) ) + writer.print(getPointerArrayName(Utils.getJavaType(param.asType()))); + else if ( Utils.isAddressableType(param.asType()) ) writer.print(BUFFER_ADDRESS_POSTFIX); } } - private static void generateStringDeallocations(PrintWriter writer, Collection params) { - for (ParameterDeclaration param : params) { - final Class java_type = Utils.getJavaType(param.getType()); + private static void generateStringDeallocations(PrintWriter writer, List params) { + for ( VariableElement param : params ) { + final Class java_type = Utils.getJavaType(param.asType()); if ( java_type.equals(String.class) && param.getAnnotation(Result.class) == null ) writer.println("\tfree(" + param.getSimpleName() + BUFFER_ADDRESS_POSTFIX + ");"); - else if (param.getAnnotation(PointerArray.class) != null ) // Free the string array mem + else if ( param.getAnnotation(PointerArray.class) != null ) // Free the string array mem writer.println("\tfree(" + param.getSimpleName() + getPointerArrayName(java_type) + ");"); } } - private static void generateBufferParameterAddresses(TypeMap type_map, PrintWriter writer, MethodDeclaration method, Mode mode) { + private static void generateBufferParameterAddresses(TypeMap type_map, PrintWriter writer, ExecutableElement method, Mode mode) { strLoopDeclared = false; ptrLoopDeclared = false; - for ( ParameterDeclaration param : method.getParameters() ) { + for ( VariableElement param : method.getParameters() ) { final Constant constant_annotation = param.getAnnotation(Constant.class); - if ( param.getAnnotation(Result.class) == null && (constant_annotation == null || !constant_annotation.isNative()) && Utils.isAddressableType(param.getType())) - generateBufferParameterAddress(type_map, writer, method, param, mode); + if ( param.getAnnotation(Result.class) == null && (constant_annotation == null || !constant_annotation.isNative()) && Utils.isAddressableType(param.asType()) ) + generateBufferParameterAddress(type_map, writer, param, mode); } } private static boolean strLoopDeclared; private static boolean ptrLoopDeclared; - private static void generateBufferParameterAddress(TypeMap type_map, PrintWriter writer, MethodDeclaration method, ParameterDeclaration param, Mode mode) { + private static void generateBufferParameterAddress(TypeMap type_map, PrintWriter writer, VariableElement param, Mode mode) { final Check check_annotation = param.getAnnotation(Check.class); final PointerArray array_annotation = param.getAnnotation(PointerArray.class); - final Class java_type = Utils.getJavaType(param.getType()); + final Class java_type = Utils.getJavaType(param.asType()); final NativeTypeTranslator translator = new NativeTypeTranslator(type_map, param); - param.getType().accept(translator); + param.asType().accept(translator, null); final String native_type = translator.getSignature(); if ( !java_type.isArray() || CharSequence.class.isAssignableFrom(java_type.getComponentType()) ) { writer.print("\t" + native_type + param.getSimpleName()); - writer.print(BUFFER_ADDRESS_POSTFIX + " = (("); + writer.print(BUFFER_ADDRESS_POSTFIX + " = ("); writer.print(native_type); - writer.print(")"); + writer.print(")(intptr_t)"); - if (mode == Mode.BUFFEROBJECT && param.getAnnotation(BufferObject.class) != null) { - writer.print("offsetToPointer(" + param.getSimpleName() + Utils.BUFFER_OBJECT_PARAMETER_POSTFIX + "))"); + if ( mode == Mode.BUFFEROBJECT && param.getAnnotation(BufferObject.class) != null ) { + writer.print("offsetToPointer(" + param.getSimpleName() + Utils.BUFFER_OBJECT_PARAMETER_POSTFIX + ")"); } else { - if (Buffer.class.isAssignableFrom(java_type) || java_type.equals(CharSequence.class) || java_type.equals(CharSequence[].class) || PointerBuffer.class.isAssignableFrom(java_type) ) { - boolean explicitly_byte_sized = java_type.equals(Buffer.class) || - translator.getAnnotationType().equals(type_map.getVoidType()) || - param.getAnnotation(NativeType.class) != null; - if (explicitly_byte_sized) - writer.print("(((char *)"); - if (method.getAnnotation(GenerateAutos.class) != null || (check_annotation != null && check_annotation.canBeNull())) { - writer.print("safeGetBufferAddress(env, " + param.getSimpleName()); - } else { - writer.print("(*env)->GetDirectBufferAddress(env, " + param.getSimpleName()); - } - writer.print("))"); - writer.print(" + " + param.getSimpleName() + BUFFER_POSITION_POSTFIX); - if (explicitly_byte_sized) - writer.print("))"); - } else if (java_type.equals(String.class)) { - writer.print("GetStringNativeChars(env, " + param.getSimpleName() + "))"); + if ( Buffer.class.isAssignableFrom(java_type) || java_type.equals(CharSequence.class) || java_type.equals(CharSequence[].class) || PointerBuffer.class.isAssignableFrom(java_type) ) { + writer.print(param.getSimpleName()); + } else if ( java_type.equals(String.class) ) { + writer.print("GetStringNativeChars(env, " + param.getSimpleName() + ")"); } else if ( array_annotation == null ) throw new RuntimeException("Illegal type " + java_type); } @@ -332,26 +320,26 @@ final String n = getPointerArrayName(java_type); final String arrayType; if ( POINTER_LIST_NAME.equals(n) ) { - if ( n.equals(param.getSimpleName()) ) + if ( n.equals(param.getSimpleName().toString()) ) throw new RuntimeException("The name '" + n + "' is not valid for object array arguments annotated with PointerArray"); arrayType = translator.getSignature(true) + (org.lwjgl.PointerWrapper.class.isAssignableFrom(java_type.getComponentType()) ? " " : ""); // Declare loop counters and allocate object array if ( !ptrLoopDeclared ) { - writer.println("\tunsigned int " + n + "_i;"); + writer.println("\tint " + n + "_i;"); writer.println("\tjobject " + n + "_object;"); ptrLoopDeclared = true; } } else { - if ( n.equals(param.getSimpleName()) ) + if ( n.equals(param.getSimpleName().toString()) ) throw new RuntimeException("The name '" + n + "' is not valid for arguments annotated with PointerArray"); arrayType = translator.getSignature(true); // Declare loop counters and allocate string array if ( !strLoopDeclared ) { - writer.println("\tunsigned int " + n + "_i;"); + writer.println("\tint " + n + "_i;"); writer.println("\t" + arrayType + n + "_address;"); strLoopDeclared = true; } @@ -372,8 +360,8 @@ return STRING_LIST_NAME; } - private static boolean hasPointerArrayInits(Collection params) { - for ( ParameterDeclaration param : params ) { + private static boolean hasPointerArrayInits(List params) { + for ( VariableElement param : params ) { PointerArray pointerArray_annotation = param.getAnnotation(PointerArray.class); if ( pointerArray_annotation != null ) return true; @@ -381,14 +369,14 @@ return false; } - private static void generatePointerArrayInits(TypeMap type_map, PrintWriter writer, Collection params) { - for ( ParameterDeclaration param : params ) { + private static void generatePointerArrayInits(TypeMap type_map, PrintWriter writer, List params) { + for ( VariableElement param : params ) { PointerArray pointerArray_annotation = param.getAnnotation(PointerArray.class); if ( pointerArray_annotation != null ) { - final Class java_type = Utils.getJavaType(param.getType()); + final Class java_type = Utils.getJavaType(param.asType()); final Class component_type = java_type.isArray() ? java_type.getComponentType() : null; final NativeTypeTranslator translator = new NativeTypeTranslator(type_map, param); - param.getType().accept(translator); + param.asType().accept(translator, null); final String n = getPointerArrayName(java_type); if ( POINTER_LIST_NAME.equals(n) ) { @@ -396,11 +384,12 @@ writer.println("\t" + n + "_i = 0;"); // Fill pointer array with the buffer pointers writer.println("\twhile ( " + n + "_i < " + pointerArray_annotation.value() + " ) {"); - if ( component_type.isAssignableFrom(Buffer.class) ) - writer.println("\t\t" + n + "_object = (*env)->GetObjectArrayElement(env, " + param.getSimpleName() + ", " + n + "_i);"); + writer.println("\t\t" + n + "_object = (*env)->GetObjectArrayElement(env, " + param.getSimpleName() + ", " + n + "_i);"); + writer.print("\t\t" + param.getSimpleName() + n + "[" + n + "_i++] = (" + translator.getSignature(true) + ")"); + if ( Buffer.class.isAssignableFrom(component_type) ) + writer.println("(*env)->GetDirectBufferAddress(env, " + n + "_object);"); else - writer.println("\t\t" + n + "_object = (*env)->GetObjectArrayElement(env, " + param.getSimpleName() + ", " + n + "_i);"); - writer.println("\t\t" + param.getSimpleName() + n + "[" + n + "_i++] = (" + translator.getSignature(true) + ")(intptr_t)getPointerWrapperAddress(env, " + n + "_object);"); + writer.println("(intptr_t)getPointerWrapperAddress(env, " + n + "_object);"); writer.println("\t}"); } else { final String lengths = pointerArray_annotation.lengths(); @@ -412,7 +401,7 @@ writer.println("\twhile ( " + n + "_i < " + pointerArray_annotation.value() + " ) {"); if ( lengths.length() == 0 ) { writer.println("\t\t" + param.getSimpleName() + n + "[" + n + "_i++] = " + n + "_address;"); - writer.println("\t\t" + n + "_address += strlen(" + n + "_address) + 1;"); + writer.println("\t\t" + n + "_address += strlen((const char *)" + n + "_address) + 1;"); } else { writer.println("\t\t" + param.getSimpleName() + n + "[" + n + "_i] = " + n + "_address;"); writer.println("\t\t" + n + "_address += " + lengths + BUFFER_ADDRESS_POSTFIX + "[" + n + "_i++];"); diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/NativeType.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/NativeType.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/NativeType.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/NativeType.java 2016-04-09 16:26:56.000000000 +0000 @@ -37,8 +37,8 @@ * a native type. * * @author elias_naur - * @version $Revision: 3412 $ - * $Id: NativeType.java 3412 2010-09-26 23:43:24Z spasi $ + * @version $Revision$ + * $Id$ */ import java.lang.annotation.Target; diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/NativeTypeTranslator.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/NativeTypeTranslator.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/NativeTypeTranslator.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/NativeTypeTranslator.java 2016-04-09 16:26:56.000000000 +0000 @@ -29,48 +29,44 @@ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - package org.lwjgl.util.generator; /** * - * A TypeVisitor that translates types (and optional native type - * annotations) to the native type string. + * A TypeVisitor that translates types (and optional native type annotations) to + * the native type string. * * @author elias_naur - * @version $Revision: 3412 $ - * $Id: NativeTypeTranslator.java 3412 2010-09-26 23:43:24Z spasi $ + * @version $Revision$ $Id$ */ - import org.lwjgl.PointerBuffer; import java.lang.annotation.Annotation; import java.nio.*; import java.util.ArrayList; import java.util.Collection; - -import com.sun.mirror.declaration.AnnotationMirror; -import com.sun.mirror.declaration.Declaration; -import com.sun.mirror.type.*; -import com.sun.mirror.util.TypeVisitor; +import java.util.List; +import javax.lang.model.element.AnnotationMirror; +import javax.lang.model.element.Element; +import javax.lang.model.type.*; +import javax.lang.model.util.SimpleTypeVisitor6; /** - * $Id: NativeTypeTranslator.java 3412 2010-09-26 23:43:24Z spasi $ + * $Id$ *

        - * A TypeVisitor that translates (annotated) TypeMirrors to - * native types + * A TypeVisitor that translates (annotated) TypeMirrors to native types * * @author elias_naur - * @version $Revision: 3412 $ + * @version $Revision$ */ -public class NativeTypeTranslator implements TypeVisitor { +public class NativeTypeTranslator extends SimpleTypeVisitor6 { - private Collection native_types; - private boolean is_indirect; - private final Declaration declaration; - private final TypeMap type_map; + private Collection native_types; + private boolean is_indirect; + private final Element declaration; + private final TypeMap type_map; - public NativeTypeTranslator(TypeMap type_map, Declaration declaration) { + public NativeTypeTranslator(TypeMap type_map, Element declaration) { this.declaration = declaration; this.type_map = type_map; } @@ -81,8 +77,9 @@ public String getSignature(final boolean skipConst) { StringBuilder signature = new StringBuilder(); - if ( !skipConst && declaration.getAnnotation(Const.class) != null ) + if ( !skipConst && declaration.getAnnotation(Const.class) != null ) { signature.append("const "); + } if ( declaration.getAnnotation(PointerWrapper.class) != null ) { signature.append(declaration.getAnnotation(PointerWrapper.class).value()); @@ -93,23 +90,22 @@ signature.append(getAnnotationType().getSimpleName()); } - if ( is_indirect ) + if ( is_indirect ) { signature.append(" *"); + } return signature.toString(); } public Class getAnnotationType() { - if ( native_types.size() != 1 ) - throw new RuntimeException("Expected only one native type for declaration " + declaration + - ", but got " + native_types.size()); + if ( native_types.size() != 1 ) { + throw new RuntimeException("Expected only one native type for declaration " + declaration + + ", but got " + native_types.size()); + } return native_types.iterator().next(); } - public void visitAnnotationType(AnnotationType t) { - throw new RuntimeException(t + " is not allowed"); - } - - public void visitArrayType(ArrayType t) { + @Override + public Void visitArray(ArrayType t, Void o) { final Class type = Utils.getJavaType(t).getComponentType(); if ( CharSequence.class.isAssignableFrom(type) ) { @@ -122,43 +118,47 @@ native_types.add(type_map.getByteBufferArrayType()); } else if ( org.lwjgl.PointerWrapper.class.isAssignableFrom(type) ) { is_indirect = false; - } else + } else { throw new RuntimeException(t + " is not allowed"); + } + return DEFAULT_VALUE; } - public static PrimitiveType.Kind getPrimitiveKindFromBufferClass(Class c) { - if ( IntBuffer.class.equals(c) ) - return PrimitiveType.Kind.INT; - else if ( DoubleBuffer.class.equals(c) ) - return PrimitiveType.Kind.DOUBLE; - else if ( ShortBuffer.class.equals(c) ) - return PrimitiveType.Kind.SHORT; - else if ( ByteBuffer.class.equals(c) || PointerBuffer.class.equals(c) ) - return PrimitiveType.Kind.BYTE; - else if ( FloatBuffer.class.equals(c) ) - return PrimitiveType.Kind.FLOAT; - else if ( LongBuffer.class.equals(c) ) - return PrimitiveType.Kind.LONG; - else + public static TypeKind getPrimitiveKindFromBufferClass(Class c) { + if ( IntBuffer.class.equals(c) ) { + return TypeKind.INT; + } else if ( DoubleBuffer.class.equals(c) ) { + return TypeKind.DOUBLE; + } else if ( ShortBuffer.class.equals(c) ) { + return TypeKind.SHORT; + } else if ( ByteBuffer.class.equals(c) || PointerBuffer.class.equals(c) ) { + return TypeKind.BYTE; + } else if ( FloatBuffer.class.equals(c) ) { + return TypeKind.FLOAT; + } else if ( LongBuffer.class.equals(c) ) { + return TypeKind.LONG; + } else { throw new RuntimeException(c + " is not allowed"); + } } @SuppressWarnings("unchecked") public static Class getClassFromType(DeclaredType t) { try { - return (Class)Class.forName(t.getDeclaration().getQualifiedName()); + return (Class)Class.forName(t.toString()); } catch (ClassNotFoundException e) { throw new RuntimeException(e); } } - private void getNativeTypeFromAnnotatedPrimitiveType(PrimitiveType.Kind kind) { + private void getNativeTypeFromAnnotatedPrimitiveType(TypeKind kind) { native_types = translateAnnotations(); - if ( native_types.size() == 0 ) + if ( native_types.isEmpty() ) { native_types.add(type_map.getNativeTypeFromPrimitiveType(kind)); + } } - public void visitClassType(ClassType t) { + private void visitClassType(DeclaredType t) { is_indirect = true; Class c = getClassFromType(t); @@ -168,53 +168,66 @@ } else if ( Buffer.class.equals(c) ) { native_types = new ArrayList(); native_types.add(type_map.getVoidType()); - } else if ( Buffer.class.isAssignableFrom(c) ) { - PrimitiveType.Kind kind = getPrimitiveKindFromBufferClass(c); + } else if ( Buffer.class.isAssignableFrom(c) || PointerBuffer.class.isAssignableFrom(c) ) { + TypeKind kind = getPrimitiveKindFromBufferClass(c); getNativeTypeFromAnnotatedPrimitiveType(kind); - } else if ( PointerBuffer.class.isAssignableFrom(c) ) { - native_types = new ArrayList(); - native_types.add(PointerBuffer.class); } else if ( org.lwjgl.PointerWrapper.class.isAssignableFrom(c) ) { native_types = new ArrayList(); native_types.add(PointerWrapper.class); is_indirect = false; - } else + } else { throw new RuntimeException(t + " is not allowed"); + } } - public void visitPrimitiveType(PrimitiveType t) { + @Override + public Void visitPrimitive(PrimitiveType t, Void p) { getNativeTypeFromAnnotatedPrimitiveType(t.getKind()); + return DEFAULT_VALUE; } - public void visitDeclaredType(DeclaredType t) { - throw new RuntimeException(t + " is not allowed"); - } + private void visitInterfaceType(DeclaredType t) { + // See ARB_debug_label.glObjectPtrLabel + Class c = getClassFromType(t); + if ( org.lwjgl.PointerWrapper.class.isAssignableFrom(c) ) { + native_types = new ArrayList(); + native_types.add(PointerWrapper.class); - public void visitEnumType(EnumType t) { - throw new RuntimeException(t + " is not allowed"); + is_indirect = false; + } else { + throw new RuntimeException(t + " is not allowed"); + } } - public void visitInterfaceType(InterfaceType t) { - throw new RuntimeException(t + " is not allowed"); + @Override + public Void visitDeclared(DeclaredType t, Void p) { + if ( t.asElement().getKind().isInterface() ) { + visitInterfaceType(t); + } else if ( t.asElement().getKind().isClass() ) { + visitClassType(t); + } + return DEFAULT_VALUE; } - // Check if the annotation is itself annotated with a certain annotation type - + /* Check if the annotation is itself annotated with a certain annotation type + * @discuss compare (DeclaredType).getAnnotation(Class) and (Element).getAnnotation(Class), they mean different Annotation's. + */ public static T getAnnotation(AnnotationMirror annotation, Class type) { - return annotation.getAnnotationType().getDeclaration().getAnnotation(type); + return annotation.getAnnotationType().asElement().getAnnotation(type); } private static Class translateAnnotation(AnnotationMirror annotation) { NativeType native_type = getAnnotation(annotation, NativeType.class); if ( native_type != null ) { return getClassFromType(annotation.getAnnotationType()); - } else + } else { return null; + } } - private Collection translateAnnotations() { - Collection result = new ArrayList(); + private List translateAnnotations() { + List result = new ArrayList(); for ( AnnotationMirror annotation : Utils.getSortedAnnotations(declaration.getAnnotationMirrors()) ) { Class translated_result = translateAnnotation(annotation); if ( translated_result != null ) { @@ -224,25 +237,13 @@ return result; } - public void visitReferenceType(ReferenceType t) { - throw new RuntimeException(t + " is not allowed"); - } - - public void visitTypeMirror(TypeMirror t) { - throw new RuntimeException(t + " is not allowed"); - } - - public void visitTypeVariable(TypeVariable t) { - throw new RuntimeException(t + " is not allowed"); - } - - public void visitVoidType(VoidType t) { + @Override + public Void visitNoType(NoType t, Void p) { native_types = translateAnnotations(); - if ( native_types.size() == 0 ) + if ( native_types.isEmpty() ) { native_types.add(void.class); + } + return DEFAULT_VALUE; } - public void visitWildcardType(WildcardType t) { - throw new RuntimeException(t + " is not allowed"); - } } diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/NoErrorCheck.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/NoErrorCheck.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/NoErrorCheck.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/NoErrorCheck.java 2016-04-09 16:26:56.000000000 +0000 @@ -37,8 +37,8 @@ * error checking even if it is enabled. * * @author elias_naur - * @version $Revision: 2983 $ - * $Id: NoErrorCheck.java 2983 2008-04-07 18:36:09Z matzon $ + * @version $Revision$ + * $Id$ */ import java.lang.annotation.Target; diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/NullTerminated.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/NullTerminated.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/NullTerminated.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/NullTerminated.java 2016-04-09 16:26:56.000000000 +0000 @@ -37,8 +37,8 @@ * checked for a trailing '\0' * * @author elias_naur - * @version $Revision: 3260 $ - * $Id: NullTerminated.java 3260 2009-12-04 04:49:19Z spasi $ + * @version $Revision$ + * $Id$ */ import java.lang.annotation.Target; diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/openal/ALTypeMap.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/openal/ALTypeMap.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/openal/ALTypeMap.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/openal/ALTypeMap.java 2016-04-09 16:26:56.000000000 +0000 @@ -44,74 +44,79 @@ import org.lwjgl.util.generator.Signedness; import org.lwjgl.util.generator.TypeMap; -import com.sun.mirror.declaration.*; -import com.sun.mirror.type.*; - -import java.io.*; +import java.io.PrintWriter; import java.lang.annotation.Annotation; -import java.util.*; import java.nio.*; +import java.util.HashMap; +import java.util.Map; +import javax.lang.model.element.AnnotationMirror; +import javax.lang.model.element.ExecutableElement; +import javax.lang.model.type.TypeKind; public class ALTypeMap implements TypeMap { - private static final Map native_types_to_primitive; + private static final Map native_types_to_primitive; static { - native_types_to_primitive = new HashMap(); - native_types_to_primitive.put(ALboolean.class, PrimitiveType.Kind.BOOLEAN); - native_types_to_primitive.put(ALbyte.class, PrimitiveType.Kind.BYTE); - native_types_to_primitive.put(ALenum.class, PrimitiveType.Kind.INT); - native_types_to_primitive.put(ALfloat.class, PrimitiveType.Kind.FLOAT); - native_types_to_primitive.put(ALdouble.class, PrimitiveType.Kind.DOUBLE); - native_types_to_primitive.put(ALint.class, PrimitiveType.Kind.INT); - native_types_to_primitive.put(ALshort.class, PrimitiveType.Kind.SHORT); - native_types_to_primitive.put(ALsizei.class, PrimitiveType.Kind.INT); - native_types_to_primitive.put(ALubyte.class, PrimitiveType.Kind.BYTE); - native_types_to_primitive.put(ALuint.class, PrimitiveType.Kind.INT); - native_types_to_primitive.put(ALvoid.class, PrimitiveType.Kind.BYTE); - } - - public PrimitiveType.Kind getPrimitiveTypeFromNativeType(Class native_type) { - PrimitiveType.Kind kind = native_types_to_primitive.get(native_type); - if (kind == null) + native_types_to_primitive = new HashMap(); + native_types_to_primitive.put(ALboolean.class, TypeKind.BOOLEAN); + native_types_to_primitive.put(ALbyte.class, TypeKind.BYTE); + native_types_to_primitive.put(ALenum.class, TypeKind.INT); + native_types_to_primitive.put(ALfloat.class, TypeKind.FLOAT); + native_types_to_primitive.put(ALdouble.class, TypeKind.DOUBLE); + native_types_to_primitive.put(ALint.class, TypeKind.INT); + native_types_to_primitive.put(ALshort.class, TypeKind.SHORT); + native_types_to_primitive.put(ALsizei.class, TypeKind.INT); + native_types_to_primitive.put(ALubyte.class, TypeKind.BYTE); + native_types_to_primitive.put(ALuint.class, TypeKind.INT); + native_types_to_primitive.put(ALvoid.class, TypeKind.BYTE); + } + + @Override + public TypeKind getPrimitiveTypeFromNativeType(Class native_type) { + TypeKind kind = native_types_to_primitive.get(native_type); + if ( kind == null ) throw new RuntimeException("Unsupported type " + native_type); return kind; } + @Override public Signedness getSignednessFromType(Class type) { - if (ALuint.class.equals(type)) + if ( ALuint.class.equals(type) ) return Signedness.UNSIGNED; - else if (ALint.class.equals(type)) + else if ( ALint.class.equals(type) ) return Signedness.SIGNED; - else if (ALshort.class.equals(type)) + else if ( ALshort.class.equals(type) ) return Signedness.SIGNED; - else if (ALbyte.class.equals(type)) + else if ( ALbyte.class.equals(type) ) return Signedness.SIGNED; else return Signedness.NONE; } + @Override public String translateAnnotation(Class annotation_type) { - if (annotation_type.equals(ALuint.class)) + if ( annotation_type.equals(ALuint.class) ) return "i"; - else if (annotation_type.equals(ALint.class)) + else if ( annotation_type.equals(ALint.class) ) return "i"; - else if (annotation_type.equals(ALshort.class)) + else if ( annotation_type.equals(ALshort.class) ) return "s"; - else if (annotation_type.equals(ALbyte.class)) + else if ( annotation_type.equals(ALbyte.class) ) return "b"; - else if (annotation_type.equals(ALfloat.class)) + else if ( annotation_type.equals(ALfloat.class) ) return "f"; - else if (annotation_type.equals(ALdouble.class)) + else if ( annotation_type.equals(ALdouble.class) ) return "d"; - else if (annotation_type.equals(ALboolean.class) || annotation_type.equals(ALvoid.class)) + else if ( annotation_type.equals(ALboolean.class) || annotation_type.equals(ALvoid.class) ) return ""; else throw new RuntimeException(annotation_type + " is not allowed"); } - public Class getNativeTypeFromPrimitiveType(PrimitiveType.Kind kind) { + @Override + public Class getNativeTypeFromPrimitiveType(TypeKind kind) { Class type; - switch (kind) { + switch ( kind ) { case INT: type = ALint.class; break; @@ -137,105 +142,124 @@ } private static Class[] getValidBufferTypes(Class type) { - if (type.equals(IntBuffer.class)) - return new Class[]{ALenum.class, ALint.class, ALsizei.class, ALuint.class}; - else if (type.equals(FloatBuffer.class)) - return new Class[]{ALfloat.class}; - else if (type.equals(ByteBuffer.class)) - return new Class[]{ALboolean.class, ALbyte.class, ALvoid.class}; - else if (type.equals(ShortBuffer.class)) - return new Class[]{ALshort.class}; - else if (type.equals(DoubleBuffer.class)) - return new Class[]{ALdouble.class}; + if ( type.equals(IntBuffer.class) ) + return new Class[] { ALenum.class, ALint.class, ALsizei.class, ALuint.class }; + else if ( type.equals(FloatBuffer.class) ) + return new Class[] { ALfloat.class }; + else if ( type.equals(ByteBuffer.class) ) + return new Class[] { ALboolean.class, ALbyte.class, ALvoid.class }; + else if ( type.equals(ShortBuffer.class) ) + return new Class[] { ALshort.class }; + else if ( type.equals(DoubleBuffer.class) ) + return new Class[] { ALdouble.class }; else - return new Class[]{}; + return new Class[] { }; } private static Class[] getValidPrimitiveTypes(Class type) { - if (type.equals(int.class)) - return new Class[]{ALenum.class, ALint.class, ALsizei.class, ALuint.class}; - else if (type.equals(double.class)) - return new Class[]{ALdouble.class}; - else if (type.equals(float.class)) - return new Class[]{ALfloat.class}; - else if (type.equals(short.class)) - return new Class[]{ALshort.class}; - else if (type.equals(byte.class)) - return new Class[]{ALbyte.class}; - else if (type.equals(boolean.class)) - return new Class[]{ALboolean.class}; - else if (type.equals(void.class)) - return new Class[]{ALvoid.class}; + if ( type.equals(int.class) ) + return new Class[] { ALenum.class, ALint.class, ALsizei.class, ALuint.class }; + else if ( type.equals(double.class) ) + return new Class[] { ALdouble.class }; + else if ( type.equals(float.class) ) + return new Class[] { ALfloat.class }; + else if ( type.equals(short.class) ) + return new Class[] { ALshort.class }; + else if ( type.equals(byte.class) ) + return new Class[] { ALbyte.class }; + else if ( type.equals(boolean.class) ) + return new Class[] { ALboolean.class }; + else if ( type.equals(void.class) ) + return new Class[] { ALvoid.class }; else - return new Class[]{}; + return new Class[] { }; } + @Override public void printCapabilitiesInit(final PrintWriter writer) { throw new UnsupportedOperationException(); } + @Override public String getCapabilities() { throw new UnsupportedOperationException(); } - public void printErrorCheckMethod(final PrintWriter writer, final MethodDeclaration method, final String tabs) { + @Override + public String getAPIUtilParam(boolean comma) { + return ""; + } + + @Override + public void printErrorCheckMethod(final PrintWriter writer, final ExecutableElement method, final String tabs) { writer.println(tabs + "Util.checkALError();"); } + @Override public String getRegisterNativesFunctionName() { return "extal_InitializeClass"; } + @Override public String getTypedefPostfix() { return ""; } + @Override public String getFunctionPrefix() { return "ALAPIENTRY"; } + @Override public void printNativeIncludes(PrintWriter writer) { writer.println("#include \"extal.h\""); } - public Class getStringElementType() { + @Override + public Class getStringElementType() { return ALubyte.class; } + @Override public Class getStringArrayType() { return ALubyte.class; } + @Override public Class getByteBufferArrayType() { return ALubyte.class; } + @Override public Class[] getValidAnnotationTypes(Class type) { Class[] valid_types; - if (Buffer.class.isAssignableFrom(type)) + if ( Buffer.class.isAssignableFrom(type) ) valid_types = getValidBufferTypes(type); - else if (type.isPrimitive()) + else if ( type.isPrimitive() ) valid_types = getValidPrimitiveTypes(type); - else if (type.equals(String.class)) - valid_types = new Class[]{ALubyte.class}; + else if ( type.equals(String.class) ) + valid_types = new Class[] { ALubyte.class }; else - valid_types = new Class[]{}; + valid_types = new Class[] { }; return valid_types; } + @Override public Class getVoidType() { return ALvoid.class; } + @Override public Class getInverseType(Class type) { - if (ALuint.class.equals(type)) + if ( ALuint.class.equals(type) ) return ALint.class; - else if (ALint.class.equals(type)) + else if ( ALint.class.equals(type) ) return ALuint.class; else return null; } + @Override public String getAutoTypeFromAnnotation(AnnotationMirror annotation) { return null; } diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/opencl/CLCapabilitiesGenerator.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/opencl/CLCapabilitiesGenerator.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/opencl/CLCapabilitiesGenerator.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/opencl/CLCapabilitiesGenerator.java 2016-04-09 16:26:56.000000000 +0000 @@ -29,18 +29,16 @@ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - package org.lwjgl.util.generator.opencl; import org.lwjgl.util.generator.*; import java.io.PrintWriter; -import java.util.Collection; import java.util.Iterator; - -import com.sun.mirror.declaration.InterfaceDeclaration; -import com.sun.mirror.declaration.MethodDeclaration; -import com.sun.mirror.declaration.TypeDeclaration; +import java.util.Set; +import javax.annotation.processing.ProcessingEnvironment; +import javax.lang.model.element.ExecutableElement; +import javax.lang.model.element.TypeElement; /** * CLCapabilities generator. @@ -50,80 +48,94 @@ public class CLCapabilitiesGenerator { static void generateClassPrologue(final PrintWriter writer) { - writer.println("public final class " + CLGeneratorProcessorFactory.CLCAPS_CLASS_NAME + " {"); + writer.println("public final class " + CLGeneratorProcessor.CLCAPS_CLASS_NAME + " {"); writer.println(); } - static void generateSymbolAddresses(final PrintWriter writer, final InterfaceDeclaration d) { + static void generateSymbolAddresses(ProcessingEnvironment env, final PrintWriter writer, final TypeElement d) { + if ( d.getAnnotation(CLPlatformExtension.class) == null && d.getAnnotation(CLDeviceExtension.class) == null && !d.getSimpleName().toString().startsWith("CL") ) { + throw new RuntimeException("An OpenCL extension is missing an extension type annotation: " + d.getSimpleName()); + } final Alias alias_annotation = d.getAnnotation(Alias.class); final boolean aliased = alias_annotation != null && alias_annotation.postfix().length() > 0; boolean foundNative = false; - for ( final MethodDeclaration method : d.getMethods() ) { - if ( method.getAnnotation(Alternate.class) != null || method.getAnnotation(Reuse.class) != null ) + for ( final ExecutableElement method : Utils.getMethods(d) ) { + if ( method.getAnnotation(Alternate.class) != null || method.getAnnotation(Reuse.class) != null ) { continue; + } if ( !foundNative ) { //writer.println("\t// " + d.getSimpleName()); - writer.println("\tstatic final boolean " + CLGeneratorProcessorFactory.getExtensionName(d.getSimpleName()) + ";"); + writer.println("\tstatic final boolean " + CLGeneratorProcessor.getExtensionName(d.getSimpleName().toString() + ";")); foundNative = true; } writer.print("\tstatic final long " + Utils.getFunctionAddressName(d, method) + " = CL.getFunctionAddress("); - if ( aliased ) + if ( aliased ) { writer.println("new String [] {\"" + Utils.getFunctionAddressName(d, method) + "\",\"" + method.getSimpleName() + alias_annotation.postfix() + "\"});"); - else + } else { writer.println("\"" + Utils.getFunctionAddressName(d, method) + "\");"); + } } - if ( foundNative ) + if ( foundNative ) { writer.println(); + } } - static void generateConstructor(final PrintWriter writer, final Collection interface_decls) { - writer.println("\tprivate " + CLGeneratorProcessorFactory.CLCAPS_CLASS_NAME + "() {}"); + static void generateConstructor(ProcessingEnvironment env, final PrintWriter writer, final Set interface_decls) { + writer.println("\tprivate " + CLGeneratorProcessor.CLCAPS_CLASS_NAME + "() {}"); writer.println(); writer.println("\tstatic {"); - for ( final TypeDeclaration d : interface_decls ) { - if ( d.getMethods().isEmpty() ) - continue; - - //writer.println("\t\tif ( " + getExtensionSupportedName(d.getSimpleName()) + "() )"); - //writer.println("\t\t\t" + SUPPORTED_EXTS + ".add(\"" + CLGeneratorProcessorFactory.getExtensionName(d.getSimpleName()) + "\");"); - writer.println("\t\t" + CLGeneratorProcessorFactory.getExtensionName(d.getSimpleName()) + " = " + getExtensionSupportedName(d.getSimpleName()) + "();"); + for ( final TypeElement d : interface_decls ) { + if ( d.getKind().isInterface() ) { + if ( Utils.getMethods(d).isEmpty() ) { + continue; + } + + //writer.println("\t\tif ( " + getExtensionSupportedName(d.getSimpleName()) + "() )"); + //writer.println("\t\t\t" + SUPPORTED_EXTS + ".add(\"" + CLGeneratorProcessor.getExtensionName(d.getSimpleName()) + "\");"); + writer.println("\t\t" + CLGeneratorProcessor.getExtensionName(d.getSimpleName().toString()) + " = " + getExtensionSupportedName(d.getSimpleName().toString()) + "();"); + } } writer.println("\t}\n"); } - static void generateExtensionChecks(final PrintWriter writer, final InterfaceDeclaration d) { - Iterator methods = d.getMethods().iterator(); - if ( !methods.hasNext() ) + static void generateExtensionChecks(ProcessingEnvironment env, final PrintWriter writer, TypeElement d) { + Iterator methods = Utils.getMethods(d).iterator(); + if ( !methods.hasNext() ) { return; + } - writer.println("\tprivate static boolean " + getExtensionSupportedName(d.getSimpleName()) + "() {"); + writer.println("\tprivate static boolean " + getExtensionSupportedName(d.getSimpleName().toString()) + "() {"); writer.println("\t\treturn "); boolean first = true; while ( methods.hasNext() ) { - MethodDeclaration method = methods.next(); - if ( method.getAnnotation(Alternate.class) != null ) + ExecutableElement method = methods.next(); + if ( method.getAnnotation(Alternate.class) != null ) { continue; + } - if ( !first ) + if ( !first ) { writer.println(" &"); - else + } else { first = false; + } final boolean optional = method.getAnnotation(Optional.class) != null; writer.print("\t\t\t"); - if ( optional ) + if ( optional ) { writer.print('('); + } writer.print(Utils.getFunctionAddressName(d, method) + " != 0"); - if ( optional ) + if ( optional ) { writer.print(" || true)"); + } } writer.println(";"); writer.println("\t}"); @@ -135,25 +147,25 @@ } public static void generateCapabilitiesGetters(final PrintWriter writer) { - writer.println("\tpublic static CLPlatformCapabilities getPlatformCapabilities(final CLPlatform platform) {\n" + - "\t\tplatform.checkValid();\n" + - "\n" + - "\t\tCLPlatformCapabilities caps = (CLPlatformCapabilities)platform.getCapabilities();\n" + - "\t\tif ( caps == null )\n" + - "\t\t\tplatform.setCapabilities(caps = new CLPlatformCapabilities(platform));\n" + - "\n" + - "\t\treturn caps;\n" + - "\t}\n"); - - writer.println("\tpublic static CLDeviceCapabilities getDeviceCapabilities(final CLDevice device) {\n" + - "\t\tdevice.checkValid();\n" + - "\n" + - "\t\tCLDeviceCapabilities caps = (CLDeviceCapabilities)device.getCapabilities();\n" + - "\t\tif ( caps == null )\n" + - "\t\t\tdevice.setCapabilities(caps = new CLDeviceCapabilities(device));\n" + - "\n" + - "\t\treturn caps;\n" + - "\t}\n"); + writer.println("\tpublic static CLPlatformCapabilities getPlatformCapabilities(final CLPlatform platform) {\n" + + "\t\tplatform.checkValid();\n" + + "\n" + + "\t\tCLPlatformCapabilities caps = (CLPlatformCapabilities)platform.getCapabilities();\n" + + "\t\tif ( caps == null )\n" + + "\t\t\tplatform.setCapabilities(caps = new CLPlatformCapabilities(platform));\n" + + "\n" + + "\t\treturn caps;\n" + + "\t}\n"); + + writer.println("\tpublic static CLDeviceCapabilities getDeviceCapabilities(final CLDevice device) {\n" + + "\t\tdevice.checkValid();\n" + + "\n" + + "\t\tCLDeviceCapabilities caps = (CLDeviceCapabilities)device.getCapabilities();\n" + + "\t\tif ( caps == null )\n" + + "\t\t\tdevice.setCapabilities(caps = new CLDeviceCapabilities(device));\n" + + "\n" + + "\t\treturn caps;\n" + + "\t}\n"); } -} \ No newline at end of file +} diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/opencl/CLGeneratorProcessorFactory.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/opencl/CLGeneratorProcessorFactory.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/opencl/CLGeneratorProcessorFactory.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/opencl/CLGeneratorProcessorFactory.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,181 +0,0 @@ -/* - * Copyright (c) 2002-2008 LWJGL Project - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of 'LWJGL' nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -package org.lwjgl.util.generator.opencl; - -import org.lwjgl.PointerWrapper; -import org.lwjgl.opencl.CLDevice; -import org.lwjgl.opencl.CLPlatform; - -import java.io.File; -import java.io.IOException; -import java.io.PrintWriter; -import java.lang.annotation.Annotation; -import java.util.Arrays; -import java.util.Collection; -import java.util.Set; - -import com.sun.mirror.apt.*; -import com.sun.mirror.declaration.AnnotationTypeDeclaration; -import com.sun.mirror.declaration.InterfaceDeclaration; -import com.sun.mirror.declaration.TypeDeclaration; -import com.sun.mirror.util.DeclarationFilter; - -import static java.util.Collections.*; - -/** - * Generator tool for creating the OpenCL capabilities classes - * - * @author Spasi - */ -public class CLGeneratorProcessorFactory implements AnnotationProcessorFactory, RoundCompleteListener { - - public static final String CLCAPS_CLASS_NAME = "CLCapabilities"; - public static final String PLATFORM_CAPS_CLASS_NAME = "CLPlatformCapabilities"; - public static final String DEVICE_CAPS_CLASS_NAME = "CLDeviceCapabilities"; - - private static final String EXTENSION_PREFIX = "CL_"; - private static final String CORE_PREFIX = "Open"; - - private static boolean first_round = true; - - // Process any set of annotations - private static final Collection supportedAnnotations = unmodifiableCollection(Arrays.asList("*")); - - public Collection supportedAnnotationTypes() { - return supportedAnnotations; - } - - public Collection supportedOptions() { - return unmodifiableCollection(Arrays.asList("-Acontextspecific")); - } - - public void roundComplete(RoundCompleteEvent event) { - first_round = false; - } - - public AnnotationProcessor getProcessorFor(Set atds, AnnotationProcessorEnvironment env) { - // Only process the initial types, not the generated ones - if ( first_round ) { - env.addListener(this); - return new GeneratorProcessor(env); - } else - return AnnotationProcessors.NO_OP; - } - - static String getExtensionName(String interface_name) { - if ( interface_name.startsWith("CL") ) - return CORE_PREFIX + interface_name; - else - return EXTENSION_PREFIX + interface_name; - } - - private static class GeneratorProcessor implements AnnotationProcessor { - - private final AnnotationProcessorEnvironment env; - - GeneratorProcessor(AnnotationProcessorEnvironment env) { - this.env = env; - } - - public void process() { - try { - generateCLCapabilitiesSource(); - generateCLPDCapabilitiesSource(CLPlatformExtension.class, PLATFORM_CAPS_CLASS_NAME, CLPlatform.class, "platform"); - generateCLPDCapabilitiesSource(CLDeviceExtension.class, DEVICE_CAPS_CLASS_NAME, CLDevice.class, "device"); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - private static void printHeader(final PrintWriter writer) { - writer.println("/* MACHINE GENERATED FILE, DO NOT EDIT */"); - writer.println(); - writer.println("package org.lwjgl.opencl;"); - writer.println(); - } - - private void generateCLCapabilitiesSource() throws IOException { - final PrintWriter writer = env.getFiler().createTextFile(Filer.Location.SOURCE_TREE, "org.lwjgl.opencl", new File(CLCAPS_CLASS_NAME + ".java"), null); - printHeader(writer); - - CLCapabilitiesGenerator.generateClassPrologue(writer); - - final Collection templates = DeclarationFilter.getFilter(InterfaceDeclaration.class).filter(env.getSpecifiedTypeDeclarations()); - - for ( final TypeDeclaration t : templates ) { - if ( t.getAnnotation(CLPlatformExtension.class) == null && t.getAnnotation(CLDeviceExtension.class) == null && !t.getSimpleName().startsWith("CL") ) - throw new RuntimeException("An OpenCL extension is missing an extension type annotation: " + t.getSimpleName()); - - CLCapabilitiesGenerator.generateSymbolAddresses(writer, (InterfaceDeclaration)t); - } - writer.println(); - - CLCapabilitiesGenerator.generateConstructor(writer, templates); - - CLCapabilitiesGenerator.generateCapabilitiesGetters(writer); - - for ( final TypeDeclaration template : templates ) - CLCapabilitiesGenerator.generateExtensionChecks(writer, (InterfaceDeclaration)template); - - writer.println("}"); - writer.close(); - } - - private void generateCLPDCapabilitiesSource(final Class capsType, final String capsName, final Class objectType, final String objectName) throws IOException { - final PrintWriter writer = env.getFiler().createTextFile(Filer.Location.SOURCE_TREE, "org.lwjgl.opencl", new File(capsName + ".java"), null); - printHeader(writer); - writer.println("import java.util.*;"); - writer.println(); - - CLPDCapabilitiesGenerator.generateClassPrologue(writer, capsName); - - final Collection templates = DeclarationFilter.getFilter(InterfaceDeclaration.class).filter(env.getSpecifiedTypeDeclarations()); - - for ( final TypeDeclaration t : templates ) { - if ( t.getAnnotation(capsType) != null ) - CLPDCapabilitiesGenerator.generateExtensions(writer, (InterfaceDeclaration)t); - } - writer.println(); - - CLPDCapabilitiesGenerator.generateConstructor(writer, templates, capsType, capsName, objectType, objectName); - - CLPDCapabilitiesGenerator.generateGetters(writer); - - CLPDCapabilitiesGenerator.generateToString(writer, templates, capsType); - - writer.println("}"); - writer.close(); - } - - } -} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/opencl/CLGeneratorProcessor.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/opencl/CLGeneratorProcessor.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/opencl/CLGeneratorProcessor.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/opencl/CLGeneratorProcessor.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,152 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.util.generator.opencl; + +import org.lwjgl.PointerWrapper; +import org.lwjgl.opencl.CLDevice; +import org.lwjgl.opencl.CLPlatform; + +import java.io.IOException; +import java.io.PrintWriter; +import java.lang.annotation.Annotation; +import java.util.Set; +import javax.annotation.processing.*; +import javax.lang.model.SourceVersion; +import javax.lang.model.element.TypeElement; +import javax.lang.model.util.ElementFilter; + +/** + * Generator tool for creating the OpenCL capabilities classes + * + * @author Spasi + */ +@SupportedAnnotationTypes({ "*" }) +@SupportedSourceVersion(SourceVersion.RELEASE_6) +@SupportedOptions({ "generatechecks", "contextspecific" }) +public class CLGeneratorProcessor extends AbstractProcessor { + + public static final String CLCAPS_CLASS_NAME = "CLCapabilities"; + public static final String PLATFORM_CAPS_CLASS_NAME = "CLPlatformCapabilities"; + public static final String DEVICE_CAPS_CLASS_NAME = "CLDeviceCapabilities"; + + private static final String EXTENSION_PREFIX = "CL_"; + private static final String CORE_PREFIX = "Open"; + + private static boolean first_round = true; + + static String getExtensionName(String interface_name) { + if ( interface_name.startsWith("CL") ) { + return CORE_PREFIX + interface_name; + } else { + return EXTENSION_PREFIX + interface_name; + } + } + + @Override + public boolean process(Set annotations, RoundEnvironment roundEnv) { + if ( roundEnv.processingOver() || !first_round ) { + System.exit(0); + return true; + } + try { + Set templates = ElementFilter.typesIn(roundEnv.getRootElements()); + /** + * provide the full set of ex-InterfaceDeclaration + * annotated templates elements + */ + generateCLCapabilitiesSource(templates); + generateCLPDCapabilitiesSource(templates, CLPlatformExtension.class, PLATFORM_CAPS_CLASS_NAME, CLPlatform.class, "platform"); + generateCLPDCapabilitiesSource(templates, CLDeviceExtension.class, DEVICE_CAPS_CLASS_NAME, CLDevice.class, "device"); + first_round = false; + return true; + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + private static void printHeader(final PrintWriter writer) { + writer.println("/* MACHINE GENERATED FILE, DO NOT EDIT */"); + writer.println(); + writer.println("package org.lwjgl.opencl;"); + writer.println(); + } + + private void generateCLCapabilitiesSource(Set templates) throws IOException { + final PrintWriter writer = new PrintWriter(processingEnv.getFiler().createSourceFile("org.lwjgl.opencl." + CLCAPS_CLASS_NAME, processingEnv.getElementUtils().getPackageElement("org.lwjgl.opencl")).openWriter()); + printHeader(writer); + + CLCapabilitiesGenerator.generateClassPrologue(writer); + for ( TypeElement d : templates ) { + if ( d.getKind().isInterface() ) { + CLCapabilitiesGenerator.generateSymbolAddresses(processingEnv, writer, d); + } + } + writer.println(); + + CLCapabilitiesGenerator.generateConstructor(processingEnv, writer, templates); + + CLCapabilitiesGenerator.generateCapabilitiesGetters(writer); + for ( TypeElement d : templates ) { + if ( d.getKind().isInterface() ) { + CLCapabilitiesGenerator.generateExtensionChecks(processingEnv, writer, d); + } + } + + writer.println("}"); + writer.close(); + } + + private void generateCLPDCapabilitiesSource(Set templates, final Class capsType, final String capsName, final Class objectType, final String objectName) throws IOException { + final PrintWriter writer = new PrintWriter(processingEnv.getFiler().createSourceFile("org.lwjgl.opencl." + capsName, processingEnv.getElementUtils().getPackageElement("org.lwjgl.opencl")).openWriter()); + printHeader(writer); + writer.println("import java.util.*;"); + writer.println(); + + CLPDCapabilitiesGenerator.generateClassPrologue(writer, capsName); + + for ( TypeElement t : templates ) { + if ( t.getKind().isInterface() && t.getAnnotation(capsType) != null ) { + CLPDCapabilitiesGenerator.generateExtensions(writer, (TypeElement)t); + } + } + writer.println(); + + CLPDCapabilitiesGenerator.generateConstructor(processingEnv, writer, templates, capsType, capsName, objectType, objectName); + + CLPDCapabilitiesGenerator.generateGetters(writer); + + CLPDCapabilitiesGenerator.generateToString(writer, templates, capsType); + + writer.println("}"); + writer.close(); + } +} diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/opencl/CLPDCapabilitiesGenerator.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/opencl/CLPDCapabilitiesGenerator.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/opencl/CLPDCapabilitiesGenerator.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/opencl/CLPDCapabilitiesGenerator.java 2016-04-09 16:26:56.000000000 +0000 @@ -33,14 +33,15 @@ package org.lwjgl.util.generator.opencl; import org.lwjgl.PointerWrapper; +import org.lwjgl.util.generator.Extension; import org.lwjgl.util.generator.Private; +import org.lwjgl.util.generator.Utils; import java.io.PrintWriter; import java.lang.annotation.Annotation; -import java.util.Collection; - -import com.sun.mirror.declaration.InterfaceDeclaration; -import com.sun.mirror.declaration.TypeDeclaration; +import java.util.Set; +import javax.annotation.processing.ProcessingEnvironment; +import javax.lang.model.element.TypeElement; /** * CL platform/device capabilities generator. @@ -51,7 +52,7 @@ // TODO: Add future versions here private static final int[][] CL_VERSIONS = { - { 1 }, // OpenCL 1 + { 1, 2 }, // OpenCL 1 }; static void generateClassPrologue(final PrintWriter writer, final String name) { @@ -67,18 +68,18 @@ writer.println(); } - static void generateExtensions(final PrintWriter writer, final InterfaceDeclaration d) { + static void generateExtensions(final PrintWriter writer, final TypeElement d) { writer.print("\t"); if ( d.getAnnotation(Private.class) == null ) writer.print("public "); - writer.println("final boolean " + CLGeneratorProcessorFactory.getExtensionName(d.getSimpleName()) + ";"); + writer.println("final boolean " + CLGeneratorProcessor.getExtensionName(d.getSimpleName().toString()) + ";"); } - static void generateConstructor(final PrintWriter writer, final Collection templates, - final Class capsType, final String capsName, - final Class objectType, final String objectName) { + static void generateConstructor(ProcessingEnvironment env, final PrintWriter writer, final Set templates, + final Class capsType, final String capsName, + final Class objectType, final String objectName) { writer.println("\tpublic " + capsName + "(final " + objectType.getSimpleName() + ' ' + objectName + ") {"); writer.println("\t\tfinal String extensionList = " + objectName + ".getInfoString(CL10.CL_" + objectName.toUpperCase() + "_EXTENSIONS);\n" + @@ -102,14 +103,19 @@ writer.println("\t\tfinal Set extensions = APIUtil.getExtensions(extensionList);"); - for ( final TypeDeclaration t : templates ) { + for ( final TypeElement t : templates ) { if ( t.getAnnotation(capsType) == null ) continue; - final String extName = CLGeneratorProcessorFactory.getExtensionName(t.getSimpleName()); + final String extName = CLGeneratorProcessor.getExtensionName(t.getSimpleName().toString()); + + String nativeName = extName.toLowerCase(); + Extension ext = t.getAnnotation(Extension.class); + if ( ext != null && !ext.nativeName().isEmpty() ) + nativeName = ext.nativeName(); - writer.print("\t\t" + extName + " = extensions.contains(\"" + extName.toLowerCase() + "\")"); - if ( !t.getMethods().isEmpty() ) + writer.print("\t\t" + extName + " = extensions.contains(\"" + nativeName + "\")"); + if ( !Utils.getMethods(t).isEmpty() ) writer.print(" && CLCapabilities." + extName); writer.println(";"); } @@ -127,18 +133,18 @@ writer.println("\t}\n"); } - public static void generateToString(final PrintWriter writer, final Collection templates, final Class capsType) { + public static void generateToString(final PrintWriter writer, final Set templates, final Class capsType) { writer.println("\tpublic String toString() {"); writer.println("\t\tfinal StringBuilder buf = new StringBuilder();\n"); writer.println("\t\tbuf.append(\"OpenCL \").append(majorVersion).append('.').append(minorVersion);"); writer.println(); writer.println("\t\tbuf.append(\" - Extensions: \");"); - for ( final TypeDeclaration t : templates ) { + for ( final TypeElement t : templates ) { if ( t.getAnnotation(capsType) == null ) continue; - writer.println("\t\tif ( " + CLGeneratorProcessorFactory.getExtensionName(t.getSimpleName()) + " ) buf.append(\"" + CLGeneratorProcessorFactory.getExtensionName(t.getSimpleName()).toLowerCase() + " \");"); + writer.println("\t\tif ( " + CLGeneratorProcessor.getExtensionName(t.getSimpleName().toString()) + " ) buf.append(\"" + CLGeneratorProcessor.getExtensionName(t.getSimpleName().toString()).toLowerCase() + " \");"); } writer.println("\n\t\treturn buf.toString();"); diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/opencl/CLTypeMap.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/opencl/CLTypeMap.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/opencl/CLTypeMap.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/opencl/CLTypeMap.java 2016-04-09 16:26:56.000000000 +0000 @@ -48,48 +48,56 @@ import java.nio.*; import java.util.HashMap; import java.util.Map; - -import com.sun.mirror.declaration.AnnotationMirror; -import com.sun.mirror.declaration.MethodDeclaration; -import com.sun.mirror.declaration.ParameterDeclaration; -import com.sun.mirror.type.PrimitiveType; +import javax.lang.model.element.AnnotationMirror; +import javax.lang.model.element.ExecutableElement; +import javax.lang.model.element.VariableElement; +import javax.lang.model.type.TypeKind; public class CLTypeMap implements TypeMap { - private static final Map native_types_to_primitive; + private static final Map native_types_to_primitive; static { - native_types_to_primitive = new HashMap(); - native_types_to_primitive.put(cl_void.class, PrimitiveType.Kind.BYTE); - native_types_to_primitive.put(cl_byte.class, PrimitiveType.Kind.BYTE); - native_types_to_primitive.put(cl_char.class, PrimitiveType.Kind.BYTE); - native_types_to_primitive.put(cl_uchar.class, PrimitiveType.Kind.BYTE); - native_types_to_primitive.put(cl_short.class, PrimitiveType.Kind.SHORT); - native_types_to_primitive.put(cl_bool.class, PrimitiveType.Kind.INT); - native_types_to_primitive.put(cl_int.class, PrimitiveType.Kind.INT); - native_types_to_primitive.put(cl_uint.class, PrimitiveType.Kind.INT); - native_types_to_primitive.put(cl_long.class, PrimitiveType.Kind.LONG); - native_types_to_primitive.put(size_t.class, PrimitiveType.Kind.LONG); - native_types_to_primitive.put(cl_bitfield.class, PrimitiveType.Kind.LONG); - native_types_to_primitive.put(cl_float.class, PrimitiveType.Kind.FLOAT); - native_types_to_primitive.put(cl_double.class, PrimitiveType.Kind.DOUBLE); - } - - public PrimitiveType.Kind getPrimitiveTypeFromNativeType(Class native_type) { - PrimitiveType.Kind kind = native_types_to_primitive.get(native_type); + native_types_to_primitive = new HashMap(); + native_types_to_primitive.put(cl_void.class, TypeKind.BYTE); + native_types_to_primitive.put(cl_byte.class, TypeKind.BYTE); + native_types_to_primitive.put(cl_char.class, TypeKind.BYTE); + native_types_to_primitive.put(cl_uchar.class, TypeKind.BYTE); + native_types_to_primitive.put(cl_short.class, TypeKind.SHORT); + native_types_to_primitive.put(cl_bool.class, TypeKind.INT); + native_types_to_primitive.put(cl_int.class, TypeKind.INT); + native_types_to_primitive.put(cl_uint.class, TypeKind.INT); + native_types_to_primitive.put(cl_long.class, TypeKind.LONG); + native_types_to_primitive.put(size_t.class, TypeKind.LONG); + native_types_to_primitive.put(cl_bitfield.class, TypeKind.LONG); + native_types_to_primitive.put(cl_float.class, TypeKind.FLOAT); + native_types_to_primitive.put(cl_double.class, TypeKind.DOUBLE); + } + + @Override + public TypeKind getPrimitiveTypeFromNativeType(Class native_type) { + TypeKind kind = native_types_to_primitive.get(native_type); if ( kind == null ) throw new RuntimeException("Unsupported type " + native_type); return kind; } + @Override public void printCapabilitiesInit(final PrintWriter writer) { } + @Override public String getCapabilities() { return "CLCapabilities"; } - public void printErrorCheckMethod(final PrintWriter writer, final MethodDeclaration method, final String tabs) { + @Override + public String getAPIUtilParam(boolean comma) { + return ""; + } + + @Override + public void printErrorCheckMethod(final PrintWriter writer, final ExecutableElement method, final String tabs) { final Check check = method.getAnnotation(Check.class); if ( check != null ) // Get the error code from an IntBuffer output parameter writer.println(tabs + "Util.checkCLError(" + check.value() + ".get(" + check.value() + ".position()));"); @@ -99,8 +107,8 @@ writer.println(tabs + "Util.checkCLError(__result);"); else { boolean hasErrCodeParam = false; - for ( final ParameterDeclaration param : method.getParameters() ) { - if ( "errcode_ret".equals(param.getSimpleName()) && Utils.getJavaType(param.getType()) == IntBuffer.class ) { + for ( final VariableElement param : method.getParameters() ) { + if ( "errcode_ret".equals(param.getSimpleName().toString()) && Utils.getJavaType(param.asType()) == IntBuffer.class ) { hasErrCodeParam = true; break; } @@ -111,10 +119,12 @@ } } + @Override public String getRegisterNativesFunctionName() { return "extcl_InitializeClass"; } + @Override public Signedness getSignednessFromType(Class type) { if ( cl_uint.class.equals(type) ) return Signedness.UNSIGNED; @@ -124,6 +134,7 @@ return Signedness.NONE; } + @Override public String translateAnnotation(Class annotation_type) { if ( annotation_type.equals(cl_uint.class) || annotation_type.equals(cl_int.class) ) return "i"; @@ -139,7 +150,8 @@ throw new RuntimeException(annotation_type + " is not allowed"); } - public Class getNativeTypeFromPrimitiveType(PrimitiveType.Kind kind) { + @Override + public Class getNativeTypeFromPrimitiveType(TypeKind kind) { Class type; switch ( kind ) { case INT: @@ -169,18 +181,22 @@ return type; } + @Override public Class getVoidType() { return cl_void.class; } + @Override public Class getStringElementType() { return cl_char.class; } + @Override public Class getStringArrayType() { return cl_char.class; } + @Override public Class getByteBufferArrayType() { return cl_uchar.class; } @@ -225,18 +241,22 @@ return new Class[] { }; } + @Override public String getTypedefPostfix() { return "CL_API_ENTRY "; } + @Override public String getFunctionPrefix() { return "CL_API_CALL"; } + @Override public void printNativeIncludes(PrintWriter writer) { writer.println("#include \"extcl.h\""); } + @Override public Class[] getValidAnnotationTypes(Class type) { Class[] valid_types; if ( Buffer.class.isAssignableFrom(type) || PointerBuffer.class.isAssignableFrom(type) ) @@ -256,10 +276,12 @@ return valid_types; } + @Override public Class getInverseType(Class type) { return null; } + @Override public String getAutoTypeFromAnnotation(AnnotationMirror annotation) { return null; } diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/opencl/cl_ulong.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/opencl/cl_ulong.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/opencl/cl_ulong.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/opencl/cl_ulong.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2002-2010 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.util.generator.opencl; + +import org.lwjgl.util.generator.NativeType; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Target; + +@NativeType +@Target({ ElementType.PARAMETER }) +public @interface cl_ulong { + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/opencl/cl_void.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/opencl/cl_void.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/opencl/cl_void.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/opencl/cl_void.java 2016-04-09 16:26:56.000000000 +0000 @@ -35,11 +35,10 @@ import java.lang.annotation.ElementType; import java.lang.annotation.Target; - -import com.sun.mirror.type.PrimitiveType; +import javax.lang.model.type.TypeKind; @NativeType @Target({ ElementType.PARAMETER, ElementType.METHOD }) public @interface cl_void { - PrimitiveType.Kind value() default PrimitiveType.Kind.BYTE; + TypeKind value() default TypeKind.BYTE; } \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/opengl/EGLint64NV.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/opengl/EGLint64NV.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/opengl/EGLint64NV.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/opengl/EGLint64NV.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,12 @@ +package org.lwjgl.util.generator.opengl; + +import org.lwjgl.util.generator.NativeType; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Target; + +@NativeType +@Target({ ElementType.PARAMETER, ElementType.METHOD }) +public @interface EGLint64NV { + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/opengl/EGLuint64NV.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/opengl/EGLuint64NV.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/opengl/EGLuint64NV.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/opengl/EGLuint64NV.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,12 @@ +package org.lwjgl.util.generator.opengl; + +import org.lwjgl.util.generator.NativeType; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Target; + +@NativeType +@Target({ ElementType.PARAMETER, ElementType.METHOD }) +public @interface EGLuint64NV { + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/opengl/GLCapabilitiesGenerator.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/opengl/GLCapabilitiesGenerator.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/opengl/GLCapabilitiesGenerator.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/opengl/GLCapabilitiesGenerator.java 2016-04-09 16:26:56.000000000 +0000 @@ -36,13 +36,13 @@ import java.io.PrintWriter; import java.util.Arrays; -import java.util.Collection; import java.util.EnumSet; import java.util.Iterator; - -import com.sun.mirror.declaration.InterfaceDeclaration; -import com.sun.mirror.declaration.MethodDeclaration; -import com.sun.mirror.type.InterfaceType; +import java.util.List; +import javax.annotation.processing.ProcessingEnvironment; +import javax.lang.model.element.ExecutableElement; +import javax.lang.model.element.TypeElement; +import javax.lang.model.type.TypeMirror; /** * Generator visitor for the context capabilities generator tool @@ -53,17 +53,18 @@ */ public class GLCapabilitiesGenerator { - private static final String STUBS_LOADED_NAME = "loaded_stubs"; - private static final String ALL_INIT_METHOD_NAME = "initAllStubs"; + private static final String STUBS_LOADED_NAME = "loaded_stubs"; + private static final String ALL_INIT_METHOD_NAME = "initAllStubs"; private static final String POINTER_INITIALIZER_POSTFIX = "_initNativeFunctionAddresses"; - private static final String CACHED_EXTS_VAR_NAME = "supported_extensions"; - private static final String PROFILE_MASK_VAR_NAME = "profileMask"; - private static final String EXTENSION_PREFIX = "GL_"; - private static final String CORE_PREFIX = "Open"; + private static final String CACHED_EXTS_VAR_NAME = "supported_extensions"; + private static final String PROFILE_MASK_VAR_NAME = "profileMask"; + private static final String EXTENSION_PREFIX = "GL_"; + private static final String CORE_PREFIX = "Open"; public static void generateClassPrologue(PrintWriter writer, boolean context_specific, boolean generate_error_checks) { writer.println("public class " + Utils.CONTEXT_CAPS_CLASS_NAME + " {"); writer.println("\tstatic final boolean DEBUG = " + Boolean.toString(generate_error_checks) + ";"); + writer.println("\tfinal APIUtil util = new APIUtil();"); writer.println("\tfinal StateTracker tracker = new StateTracker();"); writer.println(); if ( !context_specific ) { @@ -83,32 +84,32 @@ return EXTENSION_PREFIX + interface_name; } - public static void generateSuperClassAdds(PrintWriter writer, InterfaceDeclaration d) { - Collection super_interfaces = d.getSuperinterfaces(); + public static void generateSuperClassAdds(PrintWriter writer, TypeElement d, ProcessingEnvironment env) { + List super_interfaces = d.getInterfaces(); if ( super_interfaces.size() > 1 ) throw new RuntimeException(d + " extends more than one other interface"); if ( super_interfaces.size() == 1 ) { - InterfaceType super_interface = super_interfaces.iterator().next(); + TypeMirror super_interface = super_interfaces.iterator().next(); writer.print("\t\tif (" + CACHED_EXTS_VAR_NAME + ".contains(\""); - writer.println(translateFieldName(d.getSimpleName()) + "\"))"); + writer.println(translateFieldName(d.getSimpleName().toString()) + "\"))"); writer.print("\t\t\t"); - generateAddExtension(writer, super_interface.getDeclaration()); + generateAddExtension(writer, env.getElementUtils().getTypeElement(super_interface.toString())); } } - public static void generateInitializer(PrintWriter writer, InterfaceDeclaration d) { - String translated_field_name = translateFieldName(d.getSimpleName()); + public static void generateInitializer(PrintWriter writer, TypeElement d, ProcessingEnvironment env) { + String translated_field_name = translateFieldName(d.getSimpleName().toString()); writer.print("\t\tthis." + translated_field_name + " = "); writer.print(CACHED_EXTS_VAR_NAME + ".contains(\""); writer.print(translated_field_name + "\")"); - Collection super_interfaces = d.getSuperinterfaces(); + List super_interfaces = d.getInterfaces(); if ( super_interfaces.size() > 1 ) throw new RuntimeException(d + " extends more than one other interface"); if ( super_interfaces.size() == 1 ) { - InterfaceType super_interface = super_interfaces.iterator().next(); + TypeMirror super_interface = super_interfaces.iterator().next(); writer.println(); writer.print("\t\t\t&& " + CACHED_EXTS_VAR_NAME + ".contains(\""); - writer.print(translateFieldName(super_interface.getDeclaration().getSimpleName()) + "\")"); + writer.print(translateFieldName(env.getElementUtils().getTypeElement(super_interface.toString()).getSimpleName().toString()) + "\")"); } Alias alias_annotation = d.getAnnotation(Alias.class); if ( alias_annotation != null ) { @@ -162,30 +163,30 @@ writer.println("\t}"); } - public static void generateUnloadStubs(PrintWriter writer, InterfaceDeclaration d) { - if ( d.getMethods().size() > 0 ) { + public static void generateUnloadStubs(ProcessingEnvironment env, PrintWriter writer, TypeElement d) { + if ( Utils.getMethods(d).size() > 0 ) { writer.print("\t\tGLContext.resetNativeStubs(" + Utils.getSimpleClassName(d)); writer.println(".class);"); } } - public static void generateInitStubs(PrintWriter writer, InterfaceDeclaration d, boolean context_specific) { - if ( d.getMethods().size() > 0 ) { + public static void generateInitStubs(ProcessingEnvironment env, PrintWriter writer, TypeElement d, boolean context_specific) { + if ( Utils.getMethods(d).size() > 0 ) { if ( context_specific ) { final Alias alias_annotation = d.getAnnotation(Alias.class); if ( d.getAnnotation(ForceInit.class) != null ) - writer.println("\t\t" + CACHED_EXTS_VAR_NAME + ".add(\"" + translateFieldName(d.getSimpleName()) + "\");"); + writer.println("\t\t" + CACHED_EXTS_VAR_NAME + ".add(\"" + translateFieldName(d.getSimpleName().toString()) + "\");"); writer.print("\t\tif ("); if ( alias_annotation != null ) writer.print("("); writer.print(CACHED_EXTS_VAR_NAME + ".contains(\""); - writer.print(translateFieldName(d.getSimpleName()) + "\")"); + writer.print(translateFieldName(d.getSimpleName().toString()) + "\")"); if ( alias_annotation != null ) { writer.print(" || " + CACHED_EXTS_VAR_NAME + ".contains(\""); writer.print(translateFieldName(alias_annotation.value()) + "\"))"); } - writer.print(" && !" + getAddressesInitializerName(d.getSimpleName()) + "("); + writer.print(" && !" + getAddressesInitializerName(d.getSimpleName().toString()) + "("); if ( d.getAnnotation(DeprecatedGL.class) != null ) writer.print("forwardCompatible"); if ( d.getAnnotation(Dependent.class) != null ) { @@ -200,27 +201,27 @@ } else writer.println("))"); writer.print("\t\t\tremove(" + CACHED_EXTS_VAR_NAME + ", \""); - writer.println(translateFieldName(d.getSimpleName()) + "\");"); + writer.println(translateFieldName(d.getSimpleName().toString()) + "\");"); if ( alias_annotation != null ) writer.println("\t\t}"); } else { writer.print("\t\tGLContext." + Utils.STUB_INITIALIZER_NAME + "(" + Utils.getSimpleClassName(d)); - writer.println(".class, " + CACHED_EXTS_VAR_NAME + ", \"" + translateFieldName(d.getSimpleName()) + "\");"); + writer.println(".class, " + CACHED_EXTS_VAR_NAME + ", \"" + translateFieldName(d.getSimpleName().toString()) + "\");"); } } } - private static void generateAddExtension(PrintWriter writer, InterfaceDeclaration d) { + private static void generateAddExtension(PrintWriter writer, TypeElement d) { writer.print(CACHED_EXTS_VAR_NAME + ".add(\""); - writer.println(translateFieldName(d.getSimpleName()) + "\");"); + writer.println(translateFieldName(d.getSimpleName().toString()) + "\");"); } - public static void generateAddressesInitializers(PrintWriter writer, InterfaceDeclaration d) { - Iterator methods = d.getMethods().iterator(); + public static void generateAddressesInitializers(ProcessingEnvironment env, PrintWriter writer, TypeElement d) { + Iterator methods = Utils.getMethods(d).iterator(); if ( !methods.hasNext() ) return; - writer.print("\tprivate boolean " + getAddressesInitializerName(d.getSimpleName()) + "("); + writer.print("\tprivate boolean " + getAddressesInitializerName(d.getSimpleName().toString()) + "("); boolean optional; boolean deprecated = d.getAnnotation(DeprecatedGL.class) != null; @@ -241,7 +242,7 @@ boolean first = true; while ( methods.hasNext() ) { - MethodDeclaration method = methods.next(); + ExecutableElement method = methods.next(); if ( method.getAnnotation(Alternate.class) != null ) continue; @@ -308,9 +309,9 @@ writer.println(); } - public static void generateSymbolAddresses(PrintWriter writer, InterfaceDeclaration d) { + public static void generateSymbolAddresses(ProcessingEnvironment env, PrintWriter writer, TypeElement d) { boolean first = true; - for ( final MethodDeclaration method : d.getMethods() ) { + for ( final ExecutableElement method : Utils.getMethods(d) ) { if ( method.getAnnotation(Alternate.class) != null || method.getAnnotation(Reuse.class) != null ) continue; @@ -322,7 +323,7 @@ } } - public static void generateField(PrintWriter writer, InterfaceDeclaration d) { - writer.println("\tpublic final boolean " + translateFieldName(d.getSimpleName()) + ";"); + public static void generateField(PrintWriter writer, TypeElement d) { + writer.println("\tpublic final boolean " + translateFieldName(d.getSimpleName().toString()) + ";"); } } \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/opengl/GLESCapabilitiesGenerator.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/opengl/GLESCapabilitiesGenerator.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/opengl/GLESCapabilitiesGenerator.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/opengl/GLESCapabilitiesGenerator.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,308 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package org.lwjgl.util.generator.opengl; + +import org.lwjgl.util.generator.*; + +import java.io.PrintWriter; +import java.util.Arrays; +import java.util.EnumSet; +import java.util.Iterator; +import java.util.List; +import javax.annotation.processing.ProcessingEnvironment; +import javax.lang.model.element.ExecutableElement; +import javax.lang.model.element.TypeElement; +import javax.lang.model.type.TypeMirror; + +/** + * Generator visitor for the context capabilities generator tool + * + * @author elias_naur + * @version $Revision: 3334 $ + * $Id: ContextCapabilitiesGenerator.java 3334 2010-04-22 23:21:48Z spasi $ + */ +public class GLESCapabilitiesGenerator { + + private static final String STUBS_LOADED_NAME = "loaded_stubs"; + private static final String ALL_INIT_METHOD_NAME = "initAllStubs"; + private static final String POINTER_INITIALIZER_POSTFIX = "_initNativeFunctionAddresses"; + private static final String CACHED_EXTS_VAR_NAME = "supported_extensions"; + private static final String EXTENSION_PREFIX = "GL_"; + private static final String CORE_PREFIX = "Open"; + + public static void generateClassPrologue(PrintWriter writer, boolean context_specific, boolean generate_error_checks) { + writer.println("public class " + Utils.CONTEXT_CAPS_CLASS_NAME + " {"); + writer.println("\tstatic final boolean DEBUG = " + Boolean.toString(generate_error_checks) + ";"); + writer.println(); + if ( !context_specific ) { + writer.println("\tprivate static boolean " + STUBS_LOADED_NAME + ";"); + } + } + + public static void generateInitializerPrologue(PrintWriter writer) { + writer.println("\t" + Utils.CONTEXT_CAPS_CLASS_NAME + "() throws LWJGLException {"); + writer.println("\t\tSet " + CACHED_EXTS_VAR_NAME + " = " + ALL_INIT_METHOD_NAME + "();"); + } + + private static String translateFieldName(String interface_name) { + if ( interface_name.startsWith("GL") ) + return CORE_PREFIX + interface_name; + else + return EXTENSION_PREFIX + interface_name; + } + + public static void generateSuperClassAdds(PrintWriter writer, TypeElement d, ProcessingEnvironment env) { + List super_interfaces = d.getInterfaces(); + if ( super_interfaces.size() > 1 ) + throw new RuntimeException(d + " extends more than one other interface"); + if ( super_interfaces.size() == 1 ) { + TypeMirror super_interface = super_interfaces.iterator().next(); + writer.print("\t\tif (" + CACHED_EXTS_VAR_NAME + ".contains(\""); + writer.println(translateFieldName(d.getSimpleName().toString() + "\"))")); + writer.print("\t\t\t"); + generateAddExtension(writer, env.getElementUtils().getTypeElement(super_interface.toString())); + } + } + + public static void generateInitializer(PrintWriter writer, TypeElement d, ProcessingEnvironment env) { + String translated_field_name = translateFieldName(d.getSimpleName().toString()); + writer.print("\t\tthis." + translated_field_name + " = "); + writer.print(CACHED_EXTS_VAR_NAME + ".contains(\""); + writer.print(translated_field_name + "\")"); + List super_interfaces = d.getInterfaces(); + if ( super_interfaces.size() > 1 ) + throw new RuntimeException(d + " extends more than one other interface"); + if ( super_interfaces.size() == 1 ) { + TypeMirror super_interface = super_interfaces.iterator().next(); + writer.println(); + writer.print("\t\t\t&& " + CACHED_EXTS_VAR_NAME + ".contains(\""); + writer.print(translateFieldName(env.getElementUtils().getTypeElement(super_interface.toString()).getSimpleName() + "\")")); + } + Alias alias_annotation = d.getAnnotation(Alias.class); + if ( alias_annotation != null ) { + writer.println(); + writer.print("\t\t\t|| " + CACHED_EXTS_VAR_NAME + ".contains(\""); + writer.print(translateFieldName(alias_annotation.value()) + "\")"); + } + writer.println(";"); + } + + private static String getAddressesInitializerName(String class_name) { + return class_name + POINTER_INITIALIZER_POSTFIX; + } + + public static void generateInitStubsPrologue(PrintWriter writer, boolean context_specific) { + writer.println("\tprivate Set " + ALL_INIT_METHOD_NAME + "() throws LWJGLException {"); + + if ( context_specific ) { + // Load the basic pointers we need to detect OpenGL version and supported extensions. + writer.println("\t\tglGetError = GLContext.getFunctionAddress(\"glGetError\");"); + writer.println("\t\tglGetString = GLContext.getFunctionAddress(\"glGetString\");"); + } + + // Get the supported extensions set. + writer.println("\t\tGLContext.setCapabilities(this);"); + writer.println("\t\tSet " + CACHED_EXTS_VAR_NAME + " = new HashSet(256);"); + if ( !context_specific ) + writer.println("\t\tGLContext.doInitNativeStubs(GLES20.class);"); + writer.println("\t\tGLContext.getSupportedExtensions(" + CACHED_EXTS_VAR_NAME + ");"); + + if ( !context_specific ) { + writer.println("\t\tif (" + STUBS_LOADED_NAME + ")"); + writer.println("\t\t\treturn " + CACHED_EXTS_VAR_NAME + ";"); + } else { + writer.println("\t\tif (!" + getAddressesInitializerName("GLES20") + "())"); + writer.println("\t\t\tthrow new LWJGLException(\"GL ES 2.0 not supported\");"); + } + } + + public static void generateInitStubsEpilogue(PrintWriter writer, boolean context_specific) { + if ( !context_specific ) + writer.println("\t\t" + STUBS_LOADED_NAME + " = true;"); + writer.println("\t\treturn " + CACHED_EXTS_VAR_NAME + ";"); + writer.println("\t}"); + } + + public static void generateUnloadStubs(ProcessingEnvironment env, PrintWriter writer, TypeElement d) { + // TODO: Remove GLES + if ( Utils.getMethods(d).size() > 0 && !d.getSimpleName().toString().startsWith("GLES") ) { + writer.print("\t\tGLContext.resetNativeStubs(" + Utils.getSimpleClassName(d)); + writer.println(".class);"); + } + } + + public static void generateInitStubs(ProcessingEnvironment env, PrintWriter writer, TypeElement d, boolean context_specific) { + if ( Utils.getMethods(d).size() > 0 ) { + if ( context_specific ) { + final Alias alias_annotation = d.getAnnotation(Alias.class); + + if ( d.getAnnotation(ForceInit.class) != null ) + writer.println("\t\t" + CACHED_EXTS_VAR_NAME + ".add(\"" + translateFieldName(d.getSimpleName().toString()) + "\");"); + writer.print("\t\tif ("); + if ( alias_annotation != null ) + writer.print("("); + writer.print(CACHED_EXTS_VAR_NAME + ".contains(\""); + writer.print(translateFieldName(d.getSimpleName().toString()) + "\")"); + if ( alias_annotation != null ) { + writer.print(" || " + CACHED_EXTS_VAR_NAME + ".contains(\""); + writer.print(translateFieldName(alias_annotation.value()) + "\"))"); + } + writer.print(" && !" + getAddressesInitializerName(d.getSimpleName().toString()) + "("); + if ( d.getAnnotation(Dependent.class) != null ) + writer.print("supported_extensions"); + if ( alias_annotation != null ) { + writer.println(")) {"); + writer.print("\t\t\tremove(" + CACHED_EXTS_VAR_NAME + ", \""); + writer.println(translateFieldName(alias_annotation.value()) + "\");"); + } else + writer.println("))"); + writer.print("\t\t\tremove(" + CACHED_EXTS_VAR_NAME + ", \""); + writer.println(translateFieldName(d.getSimpleName().toString()) + "\");"); + if ( alias_annotation != null ) + writer.println("\t\t}"); + } else { + writer.print("\t\tGLContext." + Utils.STUB_INITIALIZER_NAME + "(" + Utils.getSimpleClassName(d)); + writer.println(".class, " + CACHED_EXTS_VAR_NAME + ", \"" + translateFieldName(d.getSimpleName().toString()) + "\");"); + } + } + } + + private static void generateAddExtension(PrintWriter writer, TypeElement d) { + writer.print(CACHED_EXTS_VAR_NAME + ".add(\""); + writer.println(translateFieldName(d.getSimpleName().toString()) + "\");"); + } + + public static void generateAddressesInitializers(ProcessingEnvironment env, PrintWriter writer, TypeElement d) { + Iterator methods = Utils.getMethods(d).iterator(); + if ( !methods.hasNext() ) + return; + + writer.print("\tprivate boolean " + getAddressesInitializerName(d.getSimpleName().toString()) + "("); + + boolean optional; + Dependent dependent = d.getAnnotation(Dependent.class); + if ( dependent != null ) { + writer.print("Set supported_extensions"); + } + + Alias alias_annotation = d.getAnnotation(Alias.class); + boolean aliased = alias_annotation != null && alias_annotation.postfix().length() > 0; + + writer.println(") {"); + writer.println("\t\treturn "); + + boolean first = true; + while ( methods.hasNext() ) { + ExecutableElement method = methods.next(); + if ( method.getAnnotation(Alternate.class) != null ) + continue; + + if ( !first ) + writer.println(" &"); + else + first = false; + + optional = method.getAnnotation(Optional.class) != null; + dependent = method.getAnnotation(Dependent.class); + + writer.print("\t\t\t("); + if ( optional ) + writer.print('('); + if ( dependent != null ) { + if ( dependent.value().indexOf(',') == -1 ) + writer.print("!supported_extensions.contains(\"" + dependent.value() + "\") || "); + else { + writer.print("!(false"); + for ( String extension : dependent.value().split(",") ) + writer.print(" || supported_extensions.contains(\"" + extension + "\")"); + writer.print(") || "); + } + } + if ( dependent != null ) + writer.print('('); + writer.print(Utils.getFunctionAddressName(d, method) + " = "); + PlatformDependent platform_dependent = method.getAnnotation(PlatformDependent.class); + if ( platform_dependent != null ) { + EnumSet platform_set = EnumSet.copyOf(Arrays.asList(platform_dependent.value())); + writer.print("GLContext.getPlatformSpecificFunctionAddress(\""); + writer.print(Platform.ALL.getPrefix() + "\", "); + writer.print("new String[]{"); + Iterator platforms = platform_set.iterator(); + while ( platforms.hasNext() ) { + writer.print("\"" + platforms.next().getOSPrefix() + "\""); + if ( platforms.hasNext() ) + writer.print(", "); + } + writer.print("}, new String[]{"); + platforms = platform_set.iterator(); + while ( platforms.hasNext() ) { + writer.print("\"" + platforms.next().getPrefix() + "\""); + if ( platforms.hasNext() ) + writer.print(", "); + } + writer.print("}, "); + } else if ( aliased ) { + writer.print("GLContext.getFunctionAddress(new String[] {\"" + method.getSimpleName() + "\",\"" + method.getSimpleName() + alias_annotation.postfix() + "\"})) != 0"); + } else + writer.print("GLContext.getFunctionAddress("); + if ( !aliased ) + writer.print("\"" + method.getSimpleName() + "\")) != 0"); + if ( dependent != null ) + writer.print(')'); + if ( optional ) + writer.print(" || true)"); + } + writer.println(";"); + writer.println("\t}"); + writer.println(); + } + + public static void generateSymbolAddresses(ProcessingEnvironment env, PrintWriter writer, TypeElement d) { + boolean first = true; + for ( final ExecutableElement method : Utils.getMethods(d) ) { + if ( method.getAnnotation(Alternate.class) != null || method.getAnnotation(Reuse.class) != null ) + continue; + + if ( first ) { + writer.println("\t// " + d.getSimpleName()); + first = false; + } + writer.println("\tint " + Utils.getFunctionAddressName(d, method) + ";"); + } + } + + public static void generateField(PrintWriter writer, TypeElement d) { + writer.println("\tpublic final boolean " + translateFieldName(d.getSimpleName().toString()) + ";"); + } + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/opengl/GLESGeneratorProcessor.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/opengl/GLESGeneratorProcessor.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/opengl/GLESGeneratorProcessor.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/opengl/GLESGeneratorProcessor.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,161 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.util.generator.opengl; + +import org.lwjgl.util.generator.Utils; + +import java.io.IOException; +import java.io.PrintWriter; +import java.util.Map; +import java.util.Set; +import javax.annotation.processing.*; +import javax.lang.model.SourceVersion; +import javax.lang.model.element.TypeElement; +import javax.lang.model.util.ElementFilter; + +/** + * Generator tool for creating the ContexCapabilities class + * + * @author elias_naur + * @version $Revision: 3316 $ $Id: ContextGeneratorProcessorFactory.java 3316 + * 2010-04-09 23:57:40Z spasi $ + */ +@SupportedAnnotationTypes({ "*" }) +@SupportedSourceVersion(SourceVersion.RELEASE_6) +@SupportedOptions({ "contextspecific", "generatechecks" }) +public class GLESGeneratorProcessor extends AbstractProcessor { + + private static boolean first_round = true; + + @Override + public boolean process(Set annotations, RoundEnvironment roundEnv) { + if ( roundEnv.processingOver() || !first_round ) { + System.exit(0); + return true; + } + Map options = processingEnv.getOptions(); + boolean generate_error_checks = options.containsKey("generatechecks"); + boolean context_specific = options.containsKey("contextspecific"); + try { + generateContextCapabilitiesSource(ElementFilter.typesIn(roundEnv.getRootElements()), context_specific, generate_error_checks); + first_round = false; + return true; + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + private void generateContextCapabilitiesSource(Set templates, boolean context_specific, boolean generate_error_checks) throws IOException { + PrintWriter writer = new PrintWriter(processingEnv.getFiler().createSourceFile("org.lwjgl.opengles." + Utils.CONTEXT_CAPS_CLASS_NAME, processingEnv.getElementUtils().getPackageElement("org.lwjgl.opengles")).openWriter()); + writer.println("/* MACHINE GENERATED FILE, DO NOT EDIT */"); + writer.println(); + writer.println("package org.lwjgl.opengles;"); + writer.println(); + writer.println("import org.lwjgl.LWJGLException;"); + writer.println("import org.lwjgl.LWJGLUtil;"); + writer.println("import java.util.Set;"); + writer.println("import java.util.HashSet;"); + writer.println(); + GLESCapabilitiesGenerator.generateClassPrologue(writer, context_specific, generate_error_checks); + for ( TypeElement interface_decl : templates ) { + if ( interface_decl.getKind().isInterface() ) { + if ( Utils.isFinal(interface_decl) ) { + GLESCapabilitiesGenerator.generateField(writer, interface_decl); + } + } + } + writer.println(); + if ( context_specific ) { + for ( TypeElement interface_decl : templates ) { + if ( interface_decl.getKind().isInterface() ) { + GLESCapabilitiesGenerator.generateSymbolAddresses(processingEnv, writer, interface_decl); + } + } + writer.println(); + for ( TypeElement interface_decl : templates ) { + if ( interface_decl.getKind().isInterface() ) { + GLESCapabilitiesGenerator.generateAddressesInitializers(processingEnv, writer, interface_decl); + } + } + writer.println(); + } + + if ( context_specific ) { + writer.println("\tprivate static void remove(Set supported_extensions, String extension) {"); + writer.println("\t\tLWJGLUtil.log(extension + \" was reported as available but an entry point is missing\");"); + writer.println("\t\tsupported_extensions.remove(extension);"); + writer.println("\t}\n"); + } + + GLESCapabilitiesGenerator.generateInitStubsPrologue(writer, context_specific); + for ( TypeElement interface_decl : templates ) { + if ( interface_decl.getKind().isInterface() ) { + GLESCapabilitiesGenerator.generateSuperClassAdds(writer, interface_decl, processingEnv); + } + } + for ( TypeElement interface_decl : templates ) { + if ( interface_decl.getKind().isInterface() ) { + if ( "GLES20".equals(interface_decl.getSimpleName().toString()) ) { + continue; + } + GLESCapabilitiesGenerator.generateInitStubs(processingEnv, writer, interface_decl, context_specific); + } + } + GLESCapabilitiesGenerator.generateInitStubsEpilogue(writer, context_specific); + writer.println(); + writer.println("\tstatic void unloadAllStubs() {"); + if ( !context_specific ) { + writer.println("\t\tif (!loaded_stubs)"); + writer.println("\t\t\treturn;"); + for ( TypeElement interface_decl : templates ) { + if ( interface_decl.getKind().isInterface() ) { + GLESCapabilitiesGenerator.generateUnloadStubs(processingEnv, writer, interface_decl); + } + } + writer.println("\t\tloaded_stubs = false;"); + } + writer.println("\t}"); + writer.println(); + GLESCapabilitiesGenerator.generateInitializerPrologue(writer); + for ( TypeElement interface_decl : templates ) { + if ( interface_decl.getKind().isInterface() ) { + if ( Utils.isFinal(interface_decl) ) { + GLESCapabilitiesGenerator.generateInitializer(writer, interface_decl, processingEnv); + } + } + } + writer.println("\t}"); + writer.println("}"); + writer.close(); + } + +} diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/opengl/GLESTypeMap.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/opengl/GLESTypeMap.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/opengl/GLESTypeMap.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/opengl/GLESTypeMap.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,319 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package org.lwjgl.util.generator.opengl; + +/** + * + * OpenGL sepcific generator behaviour + * + * @author elias_naur + * @version $Revision: 3287 $ + * $Id: GLTypeMap.java 3287 2010-03-14 23:24:40Z spasi $ + */ + +import org.lwjgl.util.generator.NativeTypeTranslator; +import org.lwjgl.util.generator.PointerWrapper; +import org.lwjgl.util.generator.Signedness; +import org.lwjgl.util.generator.TypeMap; + +import java.io.PrintWriter; +import java.lang.annotation.Annotation; +import java.nio.*; +import java.util.HashMap; +import java.util.Map; +import javax.lang.model.element.AnnotationMirror; +import javax.lang.model.element.ExecutableElement; +import javax.lang.model.type.TypeKind; + +public class GLESTypeMap implements TypeMap { + + private static final Map, TypeKind> native_types_to_primitive; + + static { + native_types_to_primitive = new HashMap, TypeKind>(); + native_types_to_primitive.put(GLbitfield.class, TypeKind.INT); + native_types_to_primitive.put(GLclampf.class, TypeKind.FLOAT); + native_types_to_primitive.put(GLfloat.class, TypeKind.FLOAT); + native_types_to_primitive.put(GLint.class, TypeKind.INT); + native_types_to_primitive.put(GLshort.class, TypeKind.SHORT); + native_types_to_primitive.put(GLsizeiptr.class, TypeKind.LONG); + native_types_to_primitive.put(GLuint.class, TypeKind.INT); + native_types_to_primitive.put(GLboolean.class, TypeKind.BOOLEAN); + native_types_to_primitive.put(GLchar.class, TypeKind.BYTE); + native_types_to_primitive.put(GLhalf.class, TypeKind.SHORT); + native_types_to_primitive.put(GLsizei.class, TypeKind.INT); + native_types_to_primitive.put(GLushort.class, TypeKind.SHORT); + native_types_to_primitive.put(GLbyte.class, TypeKind.BYTE); + native_types_to_primitive.put(GLenum.class, TypeKind.INT); + native_types_to_primitive.put(GLintptr.class, TypeKind.LONG); + native_types_to_primitive.put(GLubyte.class, TypeKind.BYTE); + native_types_to_primitive.put(GLvoid.class, TypeKind.BYTE); + native_types_to_primitive.put(EGLint64NV.class, TypeKind.LONG); + native_types_to_primitive.put(EGLuint64NV.class, TypeKind.LONG); + native_types_to_primitive.put(GLint64.class, TypeKind.LONG); + native_types_to_primitive.put(GLuint64.class, TypeKind.LONG); + } + + @Override + public TypeKind getPrimitiveTypeFromNativeType(Class native_type) { + TypeKind kind = native_types_to_primitive.get(native_type); + if ( kind == null ) + throw new RuntimeException("Unsupported type " + native_type); + return kind; + } + + @Override + public void printCapabilitiesInit(final PrintWriter writer) { + writer.println("\t\tContextCapabilities caps = GLContext.getCapabilities();"); + } + + @Override + public String getCapabilities() { + return "caps"; + } + + @Override + public String getAPIUtilParam(boolean comma) { + return ""; + } + + @Override + public void printErrorCheckMethod(final PrintWriter writer, final ExecutableElement method, final String tabs) { + writer.println(tabs + "Util.checkGLError();"); + } + + @Override + public String getRegisterNativesFunctionName() { + return "extgl_InitializeClass"; + } + + @Override + public Signedness getSignednessFromType(Class type) { + if ( GLuint.class.equals(type) ) + return Signedness.UNSIGNED; + else if ( GLint.class.equals(type) ) + return Signedness.SIGNED; + else if ( GLushort.class.equals(type) ) + return Signedness.UNSIGNED; + else if ( GLshort.class.equals(type) ) + return Signedness.SIGNED; + else if ( GLubyte.class.equals(type) ) + return Signedness.UNSIGNED; + else if ( GLbyte.class.equals(type) ) + return Signedness.SIGNED; + else if ( EGLuint64NV.class.equals(type) ) + return Signedness.UNSIGNED; + else if ( EGLint64NV.class.equals(type) ) + return Signedness.SIGNED; + else + return Signedness.NONE; + } + + @Override + public String translateAnnotation(Class annotation_type) { + if ( annotation_type.equals(GLuint64.class) || annotation_type.equals(GLint64.class) ) + return "i64"; + else if ( annotation_type.equals(GLuint.class) || annotation_type.equals(GLint.class) ) + return "i"; + else if ( annotation_type.equals(GLushort.class) || annotation_type.equals(GLshort.class) ) + return "s"; + else if ( annotation_type.equals(GLubyte.class) || annotation_type.equals(GLbyte.class) ) + return "b"; + else if ( annotation_type.equals(GLfloat.class) ) + return "f"; + else if ( annotation_type.equals(GLhalf.class) ) + return "h"; + else if ( annotation_type.equals(GLboolean.class) || annotation_type.equals(GLvoid.class) ) + return ""; + else if ( annotation_type.equals(EGLuint64NV.class) || annotation_type.equals(EGLint64NV.class) ) + return "l"; + else + throw new RuntimeException(annotation_type + " is not allowed"); + } + + @Override + public Class getNativeTypeFromPrimitiveType(TypeKind kind) { + Class type; + switch ( kind ) { + case INT: + type = GLint.class; + break; + case FLOAT: + type = GLfloat.class; + break; + case SHORT: + type = GLshort.class; + break; + case BYTE: + type = GLbyte.class; + break; + case BOOLEAN: + type = GLboolean.class; + break; + case LONG: + type = GLint64.class; + break; + default: + throw new RuntimeException(kind + " is not allowed"); + } + return type; + } + + @Override + public Class getVoidType() { + return GLvoid.class; + } + + @Override + public Class getStringElementType() { + return GLubyte.class; + } + + @Override + public Class getStringArrayType() { + return GLchar.class; + } + + @Override + public Class getByteBufferArrayType() { + return GLubyte.class; + } + + private static Class[] getValidBufferTypes(Class type) { + if ( type.equals(IntBuffer.class) ) + return new Class[] { GLbitfield.class, GLenum.class, GLint.class, GLsizei.class, GLuint.class, GLvoid.class }; + else if ( type.equals(FloatBuffer.class) ) + return new Class[] { GLclampf.class, GLfloat.class }; + else if ( type.equals(ByteBuffer.class) ) + return new Class[] { GLboolean.class, GLbyte.class, GLchar.class, GLubyte.class, GLvoid.class }; + else if ( type.equals(ShortBuffer.class) ) + return new Class[] { GLhalf.class, GLshort.class, GLushort.class }; + else if ( type.equals(LongBuffer.class) ) + return new Class[] { GLint64.class, GLuint64.class, EGLint64NV.class, EGLuint64NV.class }; + else + return new Class[] { }; + } + + private static Class[] getValidPrimitiveTypes(Class type) { + if ( type.equals(long.class) ) + return new Class[] { GLintptr.class, GLsizeiptr.class, GLint64.class, GLuint64.class, EGLuint64NV.class, EGLint64NV.class }; + else if ( type.equals(int.class) ) + return new Class[] { GLbitfield.class, GLenum.class, GLint.class, GLuint.class, GLsizei.class }; + else if ( type.equals(float.class) ) + return new Class[] { GLclampf.class, GLfloat.class }; + else if ( type.equals(short.class) ) + return new Class[] { GLhalf.class, GLshort.class, GLushort.class }; + else if ( type.equals(byte.class) ) + return new Class[] { GLbyte.class, GLchar.class, GLubyte.class }; + else if ( type.equals(boolean.class) ) + return new Class[] { GLboolean.class }; + else if ( type.equals(void.class) ) + return new Class[] { GLvoid.class, GLreturn.class }; + else + return new Class[] { }; + } + + @Override + public String getTypedefPostfix() { + return "GL_APICALL "; + } + + @Override + public String getFunctionPrefix() { + return "GL_APIENTRY"; + } + + @Override + public void printNativeIncludes(PrintWriter writer) { + writer.println("#include \"extgl.h\""); + } + + @Override + public Class[] getValidAnnotationTypes(Class type) { + Class[] valid_types; + if ( Buffer.class.isAssignableFrom(type) ) + valid_types = getValidBufferTypes(type); + else if ( type.isPrimitive() ) + valid_types = getValidPrimitiveTypes(type); + else if ( String.class.equals(type) ) + valid_types = new Class[] { GLubyte.class }; + else if ( org.lwjgl.PointerWrapper.class.isAssignableFrom(type) ) + valid_types = new Class[] { PointerWrapper.class }; + else if ( void.class.equals(type) ) + valid_types = new Class[] { GLreturn.class }; + else + valid_types = new Class[] { }; + return valid_types; + } + + @Override + public Class getInverseType(Class type) { + if ( GLuint64.class.equals(type) ) + return GLint64.class; + if ( GLuint.class.equals(type) ) + return GLint.class; + else if ( GLint.class.equals(type) ) + return GLuint.class; + else if ( GLushort.class.equals(type) ) + return GLshort.class; + else if ( GLshort.class.equals(type) ) + return GLushort.class; + else if ( GLubyte.class.equals(type) ) + return GLbyte.class; + else if ( GLbyte.class.equals(type) ) + return GLubyte.class; + else + return null; + } + + @Override + public String getAutoTypeFromAnnotation(AnnotationMirror annotation) { + Class annotation_class = NativeTypeTranslator.getClassFromType(annotation.getAnnotationType()); + if ( annotation_class.equals(GLint.class) ) + return "GLES20.GL_INT"; + else if ( annotation_class.equals(GLbyte.class) ) + return "GLES20.GL_BYTE"; + else if ( annotation_class.equals(GLshort.class) ) + return "GLES20.GL_SHORT"; + if ( annotation_class.equals(GLuint.class) ) + return "GLES20.GL_UNSIGNED_INT"; + else if ( annotation_class.equals(GLubyte.class) ) + return "GLES20.GL_UNSIGNED_BYTE"; + else if ( annotation_class.equals(GLushort.class) ) + return "GLES20.GL_UNSIGNED_SHORT"; + else if ( annotation_class.equals(GLfloat.class) ) + return "GLES20.GL_FLOAT"; + else + return null; + } +} diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/opengl/GLGeneratorProcessorFactory.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/opengl/GLGeneratorProcessorFactory.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/opengl/GLGeneratorProcessorFactory.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/opengl/GLGeneratorProcessorFactory.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,189 +0,0 @@ -/* - * Copyright (c) 2002-2008 LWJGL Project - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of 'LWJGL' nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -package org.lwjgl.util.generator.opengl; - -import org.lwjgl.util.generator.Utils; - -import static java.util.Collections.unmodifiableCollection; - -import java.io.File; -import java.io.IOException; -import java.io.PrintWriter; -import java.util.Arrays; -import java.util.Collection; -import java.util.Map; -import java.util.Set; - -import com.sun.mirror.apt.AnnotationProcessor; -import com.sun.mirror.apt.AnnotationProcessorEnvironment; -import com.sun.mirror.apt.AnnotationProcessorFactory; -import com.sun.mirror.apt.AnnotationProcessors; -import com.sun.mirror.apt.Filer; -import com.sun.mirror.apt.RoundCompleteEvent; -import com.sun.mirror.apt.RoundCompleteListener; -import com.sun.mirror.declaration.AnnotationTypeDeclaration; -import com.sun.mirror.declaration.InterfaceDeclaration; -import com.sun.mirror.declaration.TypeDeclaration; -import com.sun.mirror.util.DeclarationFilter; - -/** - * - * Generator tool for creating the ContexCapabilities class - * - * @author elias_naur - * @version $Revision: 3316 $ - * $Id: ContextGeneratorProcessorFactory.java 3316 2010-04-09 23:57:40Z spasi $ - */ -public class GLGeneratorProcessorFactory implements AnnotationProcessorFactory, RoundCompleteListener { - private static boolean first_round = true; - - // Process any set of annotations - private static final Collection supportedAnnotations = - unmodifiableCollection(Arrays.asList("*")); - - public Collection supportedAnnotationTypes() { - return supportedAnnotations; - } - - public Collection supportedOptions() { - return unmodifiableCollection(Arrays.asList("-Acontextspecific", "-Ageneratechecks")); - } - - public void roundComplete(RoundCompleteEvent event) { - first_round = false; - } - - public AnnotationProcessor getProcessorFor(Set atds, AnnotationProcessorEnvironment env) { - // Only process the initial types, not the generated ones - if (first_round) { - env.addListener(this); - return new GeneratorProcessor(env); - } else - return AnnotationProcessors.NO_OP; - } - - private static class GeneratorProcessor implements AnnotationProcessor { - private final AnnotationProcessorEnvironment env; - - GeneratorProcessor(AnnotationProcessorEnvironment env) { - this.env = env; - } - - public void process() { - Map options = env.getOptions(); - boolean generate_error_checks = options.containsKey("-Ageneratechecks"); - boolean context_specific = options.containsKey("-Acontextspecific"); - try { - generateContextCapabilitiesSource(context_specific, generate_error_checks); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - private void generateContextCapabilitiesSource(boolean context_specific, boolean generate_error_checks) throws IOException { - PrintWriter writer = env.getFiler().createTextFile(Filer.Location.SOURCE_TREE, "org.lwjgl.opengl", new File(Utils.CONTEXT_CAPS_CLASS_NAME + ".java"), null); - writer.println("/* MACHINE GENERATED FILE, DO NOT EDIT */"); - writer.println(); - writer.println("package org.lwjgl.opengl;"); - writer.println(); - writer.println("import org.lwjgl.LWJGLException;"); - writer.println("import org.lwjgl.LWJGLUtil;"); - writer.println("import java.util.Set;"); - writer.println("import java.util.HashSet;"); - writer.println(); - GLCapabilitiesGenerator.generateClassPrologue(writer, context_specific, generate_error_checks); - DeclarationFilter filter = DeclarationFilter.getFilter(InterfaceDeclaration.class); - Collection interface_decls = filter.filter(env.getSpecifiedTypeDeclarations()); - for (TypeDeclaration typedecl : interface_decls) { - InterfaceDeclaration interface_decl = (InterfaceDeclaration)typedecl; - if (Utils.isFinal(interface_decl)) - GLCapabilitiesGenerator.generateField(writer, interface_decl); - } - writer.println(); - for (TypeDeclaration typedecl : interface_decls) { - InterfaceDeclaration interface_decl = (InterfaceDeclaration)typedecl; - GLCapabilitiesGenerator.generateSymbolAddresses(writer, interface_decl); - } - writer.println(); - if (context_specific) { - for (TypeDeclaration typedecl : interface_decls) { - InterfaceDeclaration interface_decl = (InterfaceDeclaration)typedecl; - GLCapabilitiesGenerator.generateAddressesInitializers(writer, interface_decl); - } - writer.println(); - } - - writer.println("\tprivate static void remove(Set supported_extensions, String extension) {"); - writer.println("\t\tLWJGLUtil.log(extension + \" was reported as available but an entry point is missing\");"); - writer.println("\t\tsupported_extensions.remove(extension);"); - writer.println("\t}\n"); - - GLCapabilitiesGenerator.generateInitStubsPrologue(writer, context_specific); - for (TypeDeclaration typedecl : interface_decls) { - InterfaceDeclaration interface_decl = (InterfaceDeclaration)typedecl; - GLCapabilitiesGenerator.generateSuperClassAdds(writer, interface_decl); - } - for (TypeDeclaration typedecl : interface_decls) { - InterfaceDeclaration interface_decl = (InterfaceDeclaration)typedecl; - String simple_name = interface_decl.getSimpleName(); - if ( "GL11".equals(simple_name) ) - continue; - GLCapabilitiesGenerator.generateInitStubs(writer, interface_decl, context_specific); - } - GLCapabilitiesGenerator.generateInitStubsEpilogue(writer, context_specific); - writer.println(); - writer.println("\tstatic void unloadAllStubs() {"); - if (!context_specific) { - writer.println("\t\tif (!loaded_stubs)"); - writer.println("\t\t\treturn;"); - for (TypeDeclaration typedecl : interface_decls) { - InterfaceDeclaration interface_decl = (InterfaceDeclaration)typedecl; - GLCapabilitiesGenerator.generateUnloadStubs(writer, interface_decl); - } - writer.println("\t\tloaded_stubs = false;"); - } - writer.println("\t}"); - writer.println(); - GLCapabilitiesGenerator.generateInitializerPrologue(writer); - for (TypeDeclaration typedecl : interface_decls) { - InterfaceDeclaration interface_decl = (InterfaceDeclaration)typedecl; - if (Utils.isFinal(interface_decl)) - GLCapabilitiesGenerator.generateInitializer(writer, interface_decl); - } - writer.println("\t\ttracker.init();"); - writer.println("\t}"); - writer.println("}"); - writer.close(); - } - } -} diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/opengl/GLGeneratorProcessor.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/opengl/GLGeneratorProcessor.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/opengl/GLGeneratorProcessor.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/opengl/GLGeneratorProcessor.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,160 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.util.generator.opengl; + +import org.lwjgl.util.generator.Utils; + +import java.io.IOException; +import java.io.PrintWriter; +import java.util.Map; +import java.util.Set; +import javax.annotation.processing.*; +import javax.lang.model.SourceVersion; +import javax.lang.model.element.TypeElement; +import javax.lang.model.util.ElementFilter; + +/** + * Generator tool for creating the ContexCapabilities class + * + * @author elias_naur + * @version $Revision: 3316 $ $Id: ContextGeneratorProcessorFactory.java 3316 + * 2010-04-09 23:57:40Z spasi $ + */ +@SupportedAnnotationTypes({ "*" }) +@SupportedSourceVersion(SourceVersion.RELEASE_6) +@SupportedOptions({ "generatechecks", "contextspecific" }) +public class GLGeneratorProcessor extends AbstractProcessor { + + private static boolean first_round = true; + + @Override + public boolean process(Set annotations, RoundEnvironment roundEnv) { + if ( roundEnv.processingOver() || !first_round ) { + System.exit(0); + return true; + } + Map options = processingEnv.getOptions(); + boolean generate_error_checks = options.containsKey("generatechecks"); + boolean context_specific = options.containsKey("contextspecific"); + try { + generateContextCapabilitiesSource(ElementFilter.typesIn(roundEnv.getRootElements()), context_specific, generate_error_checks); + first_round = false; + return true; + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + private void generateContextCapabilitiesSource(Set templates, boolean context_specific, boolean generate_error_checks) throws IOException { + PrintWriter writer = new PrintWriter(processingEnv.getFiler().createSourceFile("org.lwjgl.opengl." + Utils.CONTEXT_CAPS_CLASS_NAME, processingEnv.getElementUtils().getPackageElement("org.lwjgl.opengl")).openWriter()); + writer.println("/* MACHINE GENERATED FILE, DO NOT EDIT */"); + writer.println(); + writer.println("package org.lwjgl.opengl;"); + writer.println(); + writer.println("import org.lwjgl.LWJGLException;"); + writer.println("import org.lwjgl.LWJGLUtil;"); + writer.println("import java.util.Set;"); + writer.println("import java.util.HashSet;"); + writer.println(); + GLCapabilitiesGenerator.generateClassPrologue(writer, context_specific, generate_error_checks); + for ( TypeElement interface_decl : templates ) { + if ( interface_decl.getKind().isInterface() ) { + if ( Utils.isFinal(interface_decl) ) { + GLCapabilitiesGenerator.generateField(writer, interface_decl); + } + } + } + writer.println(); + for ( TypeElement interface_decl : templates ) { + if ( interface_decl.getKind().isInterface() ) { + GLCapabilitiesGenerator.generateSymbolAddresses(processingEnv, writer, interface_decl); + } + } + writer.println(); + if ( context_specific ) { + for ( TypeElement interface_decl : templates ) { + if ( interface_decl.getKind().isInterface() ) { + GLCapabilitiesGenerator.generateAddressesInitializers(processingEnv, writer, interface_decl); + } + } + writer.println(); + } + + writer.println("\tprivate static void remove(Set supported_extensions, String extension) {"); + writer.println("\t\tLWJGLUtil.log(extension + \" was reported as available but an entry point is missing\");"); + writer.println("\t\tsupported_extensions.remove(extension);"); + writer.println("\t}\n"); + + GLCapabilitiesGenerator.generateInitStubsPrologue(writer, context_specific); + for ( TypeElement interface_decl : templates ) { + if ( interface_decl.getKind().isInterface() ) { + GLCapabilitiesGenerator.generateSuperClassAdds(writer, interface_decl, processingEnv); + } + } + for ( TypeElement interface_decl : templates ) { + if ( interface_decl.getKind().isInterface() ) { + String simple_name = interface_decl.getSimpleName().toString(); + if ( "GL11".equals(simple_name) ) { + continue; + } + GLCapabilitiesGenerator.generateInitStubs(processingEnv, writer, interface_decl, context_specific); + } + } + GLCapabilitiesGenerator.generateInitStubsEpilogue(writer, context_specific); + writer.println(); + writer.println("\tstatic void unloadAllStubs() {"); + if ( !context_specific ) { + writer.println("\t\tif (!loaded_stubs)"); + writer.println("\t\t\treturn;"); + for ( TypeElement interface_decl : templates ) { + if ( interface_decl.getKind().isInterface() ) { + GLCapabilitiesGenerator.generateUnloadStubs(processingEnv, writer, interface_decl); + } + } + writer.println("\t\tloaded_stubs = false;"); + } + writer.println("\t}"); + writer.println(); + GLCapabilitiesGenerator.generateInitializerPrologue(writer); + for ( TypeElement interface_decl : templates ) { + if ( interface_decl.getKind().isInterface() ) { + if ( Utils.isFinal(interface_decl) ) { + GLCapabilitiesGenerator.generateInitializer(writer, interface_decl, processingEnv); + } + } + } + writer.println("\t\ttracker.init();"); + writer.println("\t}"); + writer.println("}"); + writer.close(); + } +} diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/opengl/GLintptrARB.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/opengl/GLintptrARB.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/opengl/GLintptrARB.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/opengl/GLintptrARB.java 2016-04-09 16:26:56.000000000 +0000 @@ -39,11 +39,13 @@ */ import org.lwjgl.util.generator.NativeType; +import org.lwjgl.util.generator.PointerType; import java.lang.annotation.Target; import java.lang.annotation.ElementType; @NativeType +@PointerType @Target({ElementType.PARAMETER, ElementType.METHOD}) public @interface GLintptrARB { } diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/opengl/GLintptr.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/opengl/GLintptr.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/opengl/GLintptr.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/opengl/GLintptr.java 2016-04-09 16:26:56.000000000 +0000 @@ -39,11 +39,13 @@ */ import org.lwjgl.util.generator.NativeType; +import org.lwjgl.util.generator.PointerType; import java.lang.annotation.Target; import java.lang.annotation.ElementType; @NativeType +@PointerType @Target({ElementType.PARAMETER, ElementType.METHOD}) public @interface GLintptr { } diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/opengl/GLReferencesGeneratorProcessorFactory.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/opengl/GLReferencesGeneratorProcessorFactory.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/opengl/GLReferencesGeneratorProcessorFactory.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/opengl/GLReferencesGeneratorProcessorFactory.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,208 +0,0 @@ -/* - * Copyright (c) 2002-2008 LWJGL Project - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of 'LWJGL' nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -package org.lwjgl.util.generator.opengl; - -import org.lwjgl.util.generator.CachedReference; -import org.lwjgl.util.generator.Utils; - -import static java.util.Collections.emptyList; -import static java.util.Collections.unmodifiableCollection; - -import java.io.File; -import java.io.IOException; -import java.io.PrintWriter; -import java.util.Arrays; -import java.util.Collection; -import java.util.Set; - -import com.sun.mirror.apt.AnnotationProcessor; -import com.sun.mirror.apt.AnnotationProcessorEnvironment; -import com.sun.mirror.apt.AnnotationProcessorFactory; -import com.sun.mirror.apt.AnnotationProcessors; -import com.sun.mirror.apt.Filer; -import com.sun.mirror.apt.RoundCompleteEvent; -import com.sun.mirror.apt.RoundCompleteListener; -import com.sun.mirror.declaration.AnnotationTypeDeclaration; -import com.sun.mirror.declaration.InterfaceDeclaration; -import com.sun.mirror.declaration.MethodDeclaration; -import com.sun.mirror.declaration.ParameterDeclaration; -import com.sun.mirror.declaration.TypeDeclaration; -import com.sun.mirror.util.DeclarationFilter; - -/** - * - * Generator tool for creating the References class - * - * @author elias_naur - * @version $Revision: 3237 $ - * $Id: ReferencesGeneratorProcessorFactory.java 3237 2009-09-08 15:07:15Z spasi $ - */ -public class GLReferencesGeneratorProcessorFactory implements AnnotationProcessorFactory, RoundCompleteListener { - private static final String REFERENCES_CLASS_NAME = "References"; - private static final String REFERENCES_PARAMETER_NAME = "references"; - - private static boolean first_round = true; - - // Process any set of annotations - private static final Collection supportedAnnotations = - unmodifiableCollection(Arrays.asList("*")); - - public Collection supportedAnnotationTypes() { - return supportedAnnotations; - } - - public Collection supportedOptions() { - return emptyList(); - } - - public void roundComplete(RoundCompleteEvent event) { - first_round = false; - } - - public AnnotationProcessor getProcessorFor(Set atds, AnnotationProcessorEnvironment env) { - // Only process the initial types, not the generated ones - if (first_round) { - env.addListener(this); - return new GeneratorProcessor(env); - } else - return AnnotationProcessors.NO_OP; - } - - private static class GeneratorProcessor implements AnnotationProcessor { - private final AnnotationProcessorEnvironment env; - - GeneratorProcessor(AnnotationProcessorEnvironment env) { - this.env = env; - } - - public void process() { - try { - generateReferencesSource(); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - private static void generateClearsFromParameters(PrintWriter writer, InterfaceDeclaration interface_decl, MethodDeclaration method) { - for (ParameterDeclaration param : method.getParameters()) { - CachedReference cached_reference_annotation = param.getAnnotation(CachedReference.class); - if (cached_reference_annotation != null && cached_reference_annotation.name().length() == 0) { - Class nio_type = Utils.getNIOBufferType(param.getType()); - String reference_name = Utils.getReferenceName(interface_decl, method, param); - writer.println("\t\tthis." + reference_name + " = null;"); - } - } - } - - private static void generateCopiesFromParameters(PrintWriter writer, InterfaceDeclaration interface_decl, MethodDeclaration method) { - for (ParameterDeclaration param : method.getParameters()) { - CachedReference cached_reference_annotation = param.getAnnotation(CachedReference.class); - if (cached_reference_annotation != null && cached_reference_annotation.name().length() == 0) { - Class nio_type = Utils.getNIOBufferType(param.getType()); - String reference_name = Utils.getReferenceName(interface_decl, method, param); - writer.print("\t\t\tthis." + reference_name + " = "); - writer.println(REFERENCES_PARAMETER_NAME + "." + reference_name + ";"); - } - } - } - - private static void generateClearsFromMethods(PrintWriter writer, InterfaceDeclaration interface_decl) { - for (MethodDeclaration method : interface_decl.getMethods()) { - generateClearsFromParameters(writer, interface_decl, method); - } - } - - private static void generateCopiesFromMethods(PrintWriter writer, InterfaceDeclaration interface_decl) { - for (MethodDeclaration method : interface_decl.getMethods()) { - generateCopiesFromParameters(writer, interface_decl, method); - } - } - - private static void generateReferencesFromParameters(PrintWriter writer, InterfaceDeclaration interface_decl, MethodDeclaration method) { - for (ParameterDeclaration param : method.getParameters()) { - CachedReference cached_reference_annotation = param.getAnnotation(CachedReference.class); - if (cached_reference_annotation != null && cached_reference_annotation.name().length() == 0) { - Class nio_type = Utils.getNIOBufferType(param.getType()); - if (nio_type == null) - throw new RuntimeException(param + " in method " + method + " in " + interface_decl + " is annotated with " - + cached_reference_annotation.annotationType().getSimpleName() + " but the parameter is not a NIO buffer"); - writer.print("\t" + nio_type.getName() + " " + Utils.getReferenceName(interface_decl, method, param)); - writer.println(";"); - } - } - } - - private static void generateReferencesFromMethods(PrintWriter writer, InterfaceDeclaration interface_decl) { - for (MethodDeclaration method : interface_decl.getMethods()) { - generateReferencesFromParameters(writer, interface_decl, method); - } - } - - private void generateReferencesSource() throws IOException { - PrintWriter writer = env.getFiler().createTextFile(Filer.Location.SOURCE_TREE, "org.lwjgl.opengl", new File(REFERENCES_CLASS_NAME + ".java"), null); - writer.println("/* MACHINE GENERATED FILE, DO NOT EDIT */"); - writer.println(); - writer.println("package org.lwjgl.opengl;"); - writer.println(); - writer.println("class " + REFERENCES_CLASS_NAME + " extends BaseReferences {"); - writer.println("\t" + REFERENCES_CLASS_NAME + "(ContextCapabilities caps) {"); - writer.println("\t\tsuper(caps);"); - writer.println("\t}"); - DeclarationFilter filter = DeclarationFilter.getFilter(InterfaceDeclaration.class); - Collection interface_decls = filter.filter(env.getSpecifiedTypeDeclarations()); - for (TypeDeclaration typedecl : interface_decls) { - InterfaceDeclaration interface_decl = (InterfaceDeclaration)typedecl; - generateReferencesFromMethods(writer, interface_decl); - } - writer.println(); - writer.println("\tvoid copy(" + REFERENCES_CLASS_NAME + " " + REFERENCES_PARAMETER_NAME + ", int mask) {"); - writer.println("\t\tsuper.copy(" + REFERENCES_PARAMETER_NAME + ", mask);"); - writer.println("\t\tif ( (mask & GL11.GL_CLIENT_VERTEX_ARRAY_BIT) != 0 ) {"); - for (TypeDeclaration typedecl : interface_decls) { - InterfaceDeclaration interface_decl = (InterfaceDeclaration)typedecl; - generateCopiesFromMethods(writer, interface_decl); - } - writer.println("\t\t}"); - writer.println("\t}"); - writer.println("\tvoid clear() {"); - writer.println("\t\tsuper.clear();"); - for (TypeDeclaration typedecl : interface_decls) { - InterfaceDeclaration interface_decl = (InterfaceDeclaration)typedecl; - generateClearsFromMethods(writer, interface_decl); - } - writer.println("\t}"); - writer.println("}"); - writer.close(); - } - } -} diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/opengl/GLReferencesGeneratorProcessor.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/opengl/GLReferencesGeneratorProcessor.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/opengl/GLReferencesGeneratorProcessor.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/opengl/GLReferencesGeneratorProcessor.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,186 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.util.generator.opengl; + +import org.lwjgl.util.generator.Alternate; +import org.lwjgl.util.generator.CachedReference; +import org.lwjgl.util.generator.Utils; + +import java.io.IOException; +import java.io.PrintWriter; +import java.util.Set; +import javax.annotation.processing.*; +import javax.lang.model.SourceVersion; +import javax.lang.model.element.ExecutableElement; +import javax.lang.model.element.TypeElement; +import javax.lang.model.element.VariableElement; +import javax.lang.model.util.ElementFilter; + +/** + * Generator tool for creating the References class + * + * @author elias_naur + * @version $Revision: 3237 $ $Id: ReferencesGeneratorProcessorFactory.java 3237 + * 2009-09-08 15:07:15Z spasi $ + */ +@SupportedAnnotationTypes({ "*" }) +@SupportedSourceVersion(SourceVersion.RELEASE_6) +@SupportedOptions({ "generatechecks", "contextspecific" }) +public class GLReferencesGeneratorProcessor extends AbstractProcessor { + + private static final String REFERENCES_CLASS_NAME = "References"; + private static final String REFERENCES_PARAMETER_NAME = "references"; + + private static boolean first_round = true; + + @Override + public boolean process(Set annotations, RoundEnvironment roundEnv) { + if ( roundEnv.processingOver() || !first_round ) { + System.exit(0); + return true; + } + try { + generateReferencesSource(processingEnv, ElementFilter.typesIn(roundEnv.getRootElements())); + first_round = false; + return true; + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + private static void generateClearsFromParameters(PrintWriter writer, TypeElement interface_decl, ExecutableElement method) { + for ( VariableElement param : method.getParameters() ) { + CachedReference cached_reference_annotation = param.getAnnotation(CachedReference.class); + if ( cached_reference_annotation != null && cached_reference_annotation.name().length() == 0 ) { + Class nio_type = Utils.getNIOBufferType(param.asType()); + String reference_name = Utils.getReferenceName(interface_decl, method, param); + writer.println("\t\tthis." + reference_name + " = null;"); + } + } + } + + private static void generateCopiesFromParameters(PrintWriter writer, TypeElement interface_decl, ExecutableElement method) { + for ( VariableElement param : method.getParameters() ) { + CachedReference cached_reference_annotation = param.getAnnotation(CachedReference.class); + if ( cached_reference_annotation != null && cached_reference_annotation.name().length() == 0 ) { + Class nio_type = Utils.getNIOBufferType(param.asType()); + String reference_name = Utils.getReferenceName(interface_decl, method, param); + writer.print("\t\t\tthis." + reference_name + " = "); + writer.println(REFERENCES_PARAMETER_NAME + "." + reference_name + ";"); + } + } + } + + private static void generateClearsFromMethods(ProcessingEnvironment env, PrintWriter writer, TypeElement interface_decl) { + for ( ExecutableElement method : Utils.getMethods(interface_decl) ) { + if ( method.getAnnotation(Alternate.class) != null ) { + continue; + } + + generateClearsFromParameters(writer, interface_decl, method); + } + } + + private static void generateCopiesFromMethods(ProcessingEnvironment env, PrintWriter writer, TypeElement interface_decl) { + for ( ExecutableElement method : Utils.getMethods(interface_decl) ) { + if ( method.getAnnotation(Alternate.class) != null ) { + continue; + } + + generateCopiesFromParameters(writer, interface_decl, method); + } + } + + private static void generateReferencesFromParameters(PrintWriter writer, TypeElement interface_decl, ExecutableElement method) { + for ( VariableElement param : method.getParameters() ) { + CachedReference cached_reference_annotation = param.getAnnotation(CachedReference.class); + if ( cached_reference_annotation != null && cached_reference_annotation.name().length() == 0 ) { + Class nio_type = Utils.getNIOBufferType(param.asType()); + if ( nio_type == null ) { + throw new RuntimeException(param + " in method " + method + " in " + interface_decl + " is annotated with " + + cached_reference_annotation.annotationType().getSimpleName() + " but the parameter is not a NIO buffer"); + } + writer.print("\t" + nio_type.getName() + " " + Utils.getReferenceName(interface_decl, method, param)); + writer.println(";"); + } + } + } + + private static void generateReferencesFromMethods(ProcessingEnvironment env, PrintWriter writer, TypeElement interface_decl) { + for ( ExecutableElement method : Utils.getMethods(interface_decl) ) { + if ( method.getAnnotation(Alternate.class) != null ) { + continue; + } + + generateReferencesFromParameters(writer, interface_decl, method); + } + } + + private void generateReferencesSource(ProcessingEnvironment env, Set templates) throws IOException { + PrintWriter writer = new PrintWriter(processingEnv.getFiler().createSourceFile("org.lwjgl.opengl." + REFERENCES_CLASS_NAME, processingEnv.getElementUtils().getPackageElement("org.lwjgl.opengl")).openWriter()); + writer.println("/* MACHINE GENERATED FILE, DO NOT EDIT */"); + writer.println(); + writer.println("package org.lwjgl.opengl;"); + writer.println(); + writer.println("class " + REFERENCES_CLASS_NAME + " extends BaseReferences {"); + writer.println("\t" + REFERENCES_CLASS_NAME + "(ContextCapabilities caps) {"); + writer.println("\t\tsuper(caps);"); + writer.println("\t}"); + for ( TypeElement interface_decl : templates ) { + if ( interface_decl.getKind().isInterface() ) { + generateReferencesFromMethods(env, writer, interface_decl); + } + } + writer.println(); + writer.println("\tvoid copy(" + REFERENCES_CLASS_NAME + " " + REFERENCES_PARAMETER_NAME + ", int mask) {"); + writer.println("\t\tsuper.copy(" + REFERENCES_PARAMETER_NAME + ", mask);"); + writer.println("\t\tif ( (mask & GL11.GL_CLIENT_VERTEX_ARRAY_BIT) != 0 ) {"); + for ( TypeElement interface_decl : templates ) { + if ( interface_decl.getKind().isInterface() ) { + generateCopiesFromMethods(processingEnv, writer, interface_decl); + } + } + writer.println("\t\t}"); + writer.println("\t}"); + writer.println("\tvoid clear() {"); + writer.println("\t\tsuper.clear();"); + for ( TypeElement interface_decl : templates ) { + if ( interface_decl.getKind().isInterface() ) { + generateClearsFromMethods(processingEnv, writer, interface_decl); + } + } + writer.println("\t}"); + writer.println("}"); + writer.close(); + } + +} diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/opengl/GLsizeiptrARB.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/opengl/GLsizeiptrARB.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/opengl/GLsizeiptrARB.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/opengl/GLsizeiptrARB.java 2016-04-09 16:26:56.000000000 +0000 @@ -39,11 +39,13 @@ */ import org.lwjgl.util.generator.NativeType; +import org.lwjgl.util.generator.PointerType; import java.lang.annotation.Target; import java.lang.annotation.ElementType; @NativeType +@PointerType @Target({ElementType.PARAMETER, ElementType.METHOD}) public @interface GLsizeiptrARB { } diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/opengl/GLsizeiptr.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/opengl/GLsizeiptr.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/opengl/GLsizeiptr.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/opengl/GLsizeiptr.java 2016-04-09 16:26:56.000000000 +0000 @@ -39,11 +39,13 @@ */ import org.lwjgl.util.generator.NativeType; +import org.lwjgl.util.generator.PointerType; import java.lang.annotation.Target; import java.lang.annotation.ElementType; @NativeType +@PointerType @Target({ElementType.PARAMETER, ElementType.METHOD}) public @interface GLsizeiptr { } diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/opengl/GLTypeMap.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/opengl/GLTypeMap.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/opengl/GLTypeMap.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/opengl/GLTypeMap.java 2016-04-09 16:26:56.000000000 +0000 @@ -29,7 +29,6 @@ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - package org.lwjgl.util.generator.opengl; /** @@ -37,10 +36,10 @@ * OpenGL sepcific generator behaviour * * @author elias_naur - * @version $Revision: 3392 $ - * $Id: GLTypeMap.java 3392 2010-07-27 15:33:22Z spasi $ + * @version $Revision: 3392 $ $Id: GLTypeMap.java 3392 2010-07-27 15:33:22Z + * spasi $ */ - +import org.lwjgl.PointerBuffer; import org.lwjgl.util.generator.NativeTypeTranslator; import org.lwjgl.util.generator.PointerWrapper; import org.lwjgl.util.generator.Signedness; @@ -51,116 +50,131 @@ import java.nio.*; import java.util.HashMap; import java.util.Map; - -import com.sun.mirror.declaration.AnnotationMirror; -import com.sun.mirror.declaration.MethodDeclaration; -import com.sun.mirror.type.PrimitiveType; +import javax.lang.model.element.AnnotationMirror; +import javax.lang.model.element.ExecutableElement; +import javax.lang.model.type.TypeKind; public class GLTypeMap implements TypeMap { - private static final Map native_types_to_primitive; + private static final Map native_types_to_primitive; static { - native_types_to_primitive = new HashMap(); - native_types_to_primitive.put(GLbitfield.class, PrimitiveType.Kind.INT); - native_types_to_primitive.put(GLcharARB.class, PrimitiveType.Kind.BYTE); - native_types_to_primitive.put(GLclampf.class, PrimitiveType.Kind.FLOAT); - native_types_to_primitive.put(GLfloat.class, PrimitiveType.Kind.FLOAT); - native_types_to_primitive.put(GLint.class, PrimitiveType.Kind.INT); - native_types_to_primitive.put(GLshort.class, PrimitiveType.Kind.SHORT); - native_types_to_primitive.put(GLsizeiptr.class, PrimitiveType.Kind.LONG); - native_types_to_primitive.put(GLuint.class, PrimitiveType.Kind.INT); - native_types_to_primitive.put(GLboolean.class, PrimitiveType.Kind.BOOLEAN); - native_types_to_primitive.put(GLchar.class, PrimitiveType.Kind.BYTE); - native_types_to_primitive.put(GLdouble.class, PrimitiveType.Kind.DOUBLE); - native_types_to_primitive.put(GLhalf.class, PrimitiveType.Kind.SHORT); - native_types_to_primitive.put(GLintptrARB.class, PrimitiveType.Kind.LONG); - native_types_to_primitive.put(GLsizei.class, PrimitiveType.Kind.INT); - native_types_to_primitive.put(GLushort.class, PrimitiveType.Kind.SHORT); - native_types_to_primitive.put(GLbyte.class, PrimitiveType.Kind.BYTE); - native_types_to_primitive.put(GLclampd.class, PrimitiveType.Kind.DOUBLE); - native_types_to_primitive.put(GLenum.class, PrimitiveType.Kind.INT); - native_types_to_primitive.put(GLhandleARB.class, PrimitiveType.Kind.INT); - native_types_to_primitive.put(GLintptr.class, PrimitiveType.Kind.LONG); - native_types_to_primitive.put(GLsizeiptrARB.class, PrimitiveType.Kind.LONG); - native_types_to_primitive.put(GLubyte.class, PrimitiveType.Kind.BYTE); - native_types_to_primitive.put(GLvoid.class, PrimitiveType.Kind.BYTE); - native_types_to_primitive.put(GLint64EXT.class, PrimitiveType.Kind.LONG); - native_types_to_primitive.put(GLuint64EXT.class, PrimitiveType.Kind.LONG); - native_types_to_primitive.put(GLint64.class, PrimitiveType.Kind.LONG); - native_types_to_primitive.put(GLuint64.class, PrimitiveType.Kind.LONG); - } - - public PrimitiveType.Kind getPrimitiveTypeFromNativeType(Class native_type) { - PrimitiveType.Kind kind = native_types_to_primitive.get(native_type); - if ( kind == null ) + native_types_to_primitive = new HashMap(); + native_types_to_primitive.put(GLbitfield.class, TypeKind.INT); + native_types_to_primitive.put(GLcharARB.class, TypeKind.BYTE); + native_types_to_primitive.put(GLclampf.class, TypeKind.FLOAT); + native_types_to_primitive.put(GLfloat.class, TypeKind.FLOAT); + native_types_to_primitive.put(GLint.class, TypeKind.INT); + native_types_to_primitive.put(GLshort.class, TypeKind.SHORT); + native_types_to_primitive.put(GLsizeiptr.class, TypeKind.LONG); + native_types_to_primitive.put(GLuint.class, TypeKind.INT); + native_types_to_primitive.put(GLboolean.class, TypeKind.BOOLEAN); + native_types_to_primitive.put(GLchar.class, TypeKind.BYTE); + native_types_to_primitive.put(GLdouble.class, TypeKind.DOUBLE); + native_types_to_primitive.put(GLhalf.class, TypeKind.SHORT); + native_types_to_primitive.put(GLintptrARB.class, TypeKind.LONG); + native_types_to_primitive.put(GLsizei.class, TypeKind.INT); + native_types_to_primitive.put(GLushort.class, TypeKind.SHORT); + native_types_to_primitive.put(GLbyte.class, TypeKind.BYTE); + native_types_to_primitive.put(GLclampd.class, TypeKind.DOUBLE); + native_types_to_primitive.put(GLenum.class, TypeKind.INT); + native_types_to_primitive.put(GLhandleARB.class, TypeKind.INT); + native_types_to_primitive.put(GLintptr.class, TypeKind.LONG); + native_types_to_primitive.put(GLsizeiptrARB.class, TypeKind.LONG); + native_types_to_primitive.put(GLubyte.class, TypeKind.BYTE); + native_types_to_primitive.put(GLvoid.class, TypeKind.BYTE); + native_types_to_primitive.put(GLint64EXT.class, TypeKind.LONG); + native_types_to_primitive.put(GLuint64EXT.class, TypeKind.LONG); + native_types_to_primitive.put(GLint64.class, TypeKind.LONG); + native_types_to_primitive.put(GLuint64.class, TypeKind.LONG); + } + + @Override + public TypeKind getPrimitiveTypeFromNativeType(Class native_type) { + TypeKind kind = native_types_to_primitive.get(native_type); + if ( kind == null ) { throw new RuntimeException("Unsupported type " + native_type); + } return kind; } + @Override public void printCapabilitiesInit(final PrintWriter writer) { writer.println("\t\tContextCapabilities caps = GLContext.getCapabilities();"); } + @Override public String getCapabilities() { return "caps"; } - public void printErrorCheckMethod(final PrintWriter writer, final MethodDeclaration method, final String tabs) { + @Override + public String getAPIUtilParam(boolean comma) { + return comma ? "caps, " : "caps"; + } + + @Override + public void printErrorCheckMethod(final PrintWriter writer, final ExecutableElement method, final String tabs) { writer.println(tabs + "Util.checkGLError();"); } + @Override public String getRegisterNativesFunctionName() { return "extgl_InitializeClass"; } + @Override public Signedness getSignednessFromType(Class type) { - if ( GLuint.class.equals(type) ) + if ( GLuint.class.equals(type) ) { return Signedness.UNSIGNED; - else if ( GLint.class.equals(type) ) + } else if ( GLint.class.equals(type) ) { return Signedness.SIGNED; - else if ( GLushort.class.equals(type) ) + } else if ( GLushort.class.equals(type) ) { return Signedness.UNSIGNED; - else if ( GLshort.class.equals(type) ) + } else if ( GLshort.class.equals(type) ) { return Signedness.SIGNED; - else if ( GLubyte.class.equals(type) ) + } else if ( GLubyte.class.equals(type) ) { return Signedness.UNSIGNED; - else if ( GLbyte.class.equals(type) ) + } else if ( GLbyte.class.equals(type) ) { return Signedness.SIGNED; - else if ( GLuint64EXT.class.equals(type) ) + } else if ( GLuint64EXT.class.equals(type) ) { return Signedness.UNSIGNED; - else if ( GLint64EXT.class.equals(type) ) + } else if ( GLint64EXT.class.equals(type) ) { return Signedness.SIGNED; - else if ( GLuint64.class.equals(type) ) + } else if ( GLuint64.class.equals(type) ) { return Signedness.UNSIGNED; - else if ( GLint64.class.equals(type) ) + } else if ( GLint64.class.equals(type) ) { return Signedness.SIGNED; - else + } else { return Signedness.NONE; + } } + @Override public String translateAnnotation(Class annotation_type) { - if ( annotation_type.equals(GLuint.class) || annotation_type.equals(GLint.class) ) + if ( annotation_type.equals(GLuint.class) || annotation_type.equals(GLint.class) ) { return "i"; - else if ( annotation_type.equals(GLushort.class) || annotation_type.equals(GLshort.class) ) + } else if ( annotation_type.equals(GLushort.class) || annotation_type.equals(GLshort.class) ) { return "s"; - else if ( annotation_type.equals(GLubyte.class) || annotation_type.equals(GLbyte.class) ) + } else if ( annotation_type.equals(GLubyte.class) || annotation_type.equals(GLbyte.class) ) { return "b"; - else if ( annotation_type.equals(GLfloat.class) || annotation_type.equals(GLclampf.class) ) + } else if ( annotation_type.equals(GLfloat.class) || annotation_type.equals(GLclampf.class) ) { return "f"; - else if ( annotation_type.equals(GLdouble.class) || annotation_type.equals(GLclampd.class) ) + } else if ( annotation_type.equals(GLdouble.class) || annotation_type.equals(GLclampd.class) ) { return "d"; - else if ( annotation_type.equals(GLhalf.class) ) + } else if ( annotation_type.equals(GLhalf.class) ) { return "h"; - else if ( annotation_type.equals(GLuint64EXT.class) || annotation_type.equals(GLint64EXT.class) || annotation_type.equals(GLuint64.class) || annotation_type.equals(GLint64.class) ) + } else if ( annotation_type.equals(GLuint64EXT.class) || annotation_type.equals(GLint64EXT.class) || annotation_type.equals(GLuint64.class) || annotation_type.equals(GLint64.class) ) { return "i64"; - else if ( annotation_type.equals(GLboolean.class) || annotation_type.equals(GLvoid.class) ) + } else if ( annotation_type.equals(GLboolean.class) || annotation_type.equals(GLvoid.class) ) { return ""; - else + } else { throw new RuntimeException(annotation_type + " is not allowed"); + } } - public Class getNativeTypeFromPrimitiveType(PrimitiveType.Kind kind) { + @Override + public Class getNativeTypeFromPrimitiveType(TypeKind kind) { Class type; switch ( kind ) { case INT: @@ -190,135 +204,153 @@ return type; } + @Override public Class getVoidType() { return GLvoid.class; } + @Override public Class getStringElementType() { return GLubyte.class; } + @Override public Class getStringArrayType() { return GLchar.class; } + @Override public Class getByteBufferArrayType() { return GLchar.class; } private static Class[] getValidBufferTypes(Class type) { - if ( type.equals(IntBuffer.class) ) + if ( type.equals(IntBuffer.class) ) { return new Class[] { GLbitfield.class, GLenum.class, GLhandleARB.class, GLint.class, GLsizei.class, GLuint.class, GLvoid.class }; - else if ( type.equals(FloatBuffer.class) ) + } else if ( type.equals(FloatBuffer.class) ) { return new Class[] { GLclampf.class, GLfloat.class }; - else if ( type.equals(ByteBuffer.class) ) + } else if ( type.equals(ByteBuffer.class) ) { return new Class[] { GLboolean.class, GLbyte.class, GLcharARB.class, GLchar.class, GLubyte.class, GLvoid.class }; - else if ( type.equals(ShortBuffer.class) ) + } else if ( type.equals(ShortBuffer.class) ) { return new Class[] { GLhalf.class, GLshort.class, GLushort.class }; - else if ( type.equals(DoubleBuffer.class) ) + } else if ( type.equals(DoubleBuffer.class) ) { return new Class[] { GLclampd.class, GLdouble.class }; - else if ( type.equals(LongBuffer.class) ) + } else if ( type.equals(LongBuffer.class) ) { return new Class[] { GLint64EXT.class, GLuint64EXT.class, GLint64.class, GLuint64.class }; - else + } else { return new Class[] { }; + } } private static Class[] getValidPrimitiveTypes(Class type) { - if ( type.equals(long.class) ) + if ( type.equals(long.class) ) { return new Class[] { GLintptrARB.class, GLuint.class, GLintptr.class, GLsizeiptrARB.class, GLsizeiptr.class, GLint64EXT.class, GLuint64EXT.class, GLint64.class, GLuint64.class }; - else if ( type.equals(int.class) ) + } else if ( type.equals(int.class) ) { return new Class[] { GLbitfield.class, GLenum.class, GLhandleARB.class, GLint.class, GLuint.class, GLsizei.class }; - else if ( type.equals(double.class) ) + } else if ( type.equals(double.class) ) { return new Class[] { GLclampd.class, GLdouble.class }; - else if ( type.equals(float.class) ) + } else if ( type.equals(float.class) ) { return new Class[] { GLclampf.class, GLfloat.class }; - else if ( type.equals(short.class) ) + } else if ( type.equals(short.class) ) { return new Class[] { GLhalf.class, GLshort.class, GLushort.class }; - else if ( type.equals(byte.class) ) + } else if ( type.equals(byte.class) ) { return new Class[] { GLbyte.class, GLcharARB.class, GLchar.class, GLubyte.class }; - else if ( type.equals(boolean.class) ) + } else if ( type.equals(boolean.class) ) { return new Class[] { GLboolean.class }; - else if ( type.equals(void.class) ) + } else if ( type.equals(void.class) ) { return new Class[] { GLvoid.class, GLreturn.class }; - else + } else { return new Class[] { }; + } } + @Override public String getTypedefPostfix() { return ""; } + @Override public String getFunctionPrefix() { return "APIENTRY"; } + @Override public void printNativeIncludes(PrintWriter writer) { writer.println("#include \"extgl.h\""); } + @Override public Class[] getValidAnnotationTypes(Class type) { Class[] valid_types; - if ( Buffer.class.isAssignableFrom(type) ) + if ( Buffer.class.isAssignableFrom(type) ) { valid_types = getValidBufferTypes(type); - else if ( type.isPrimitive() ) + } else if ( type.isPrimitive() ) { valid_types = getValidPrimitiveTypes(type); - else if ( String.class.equals(type) ) + } else if ( String.class.equals(type) ) { valid_types = new Class[] { GLubyte.class }; - else if ( org.lwjgl.PointerWrapper.class.isAssignableFrom(type) ) + } else if ( org.lwjgl.PointerWrapper.class.isAssignableFrom(type) ) { valid_types = new Class[] { PointerWrapper.class }; - else if (void.class.equals(type) ) + } else if ( void.class.equals(type) ) { valid_types = new Class[] { GLreturn.class }; - else + } else if ( PointerBuffer.class.equals(type) ) { + valid_types = new Class[] { GLintptr.class, GLintptrARB.class, GLsizeiptr.class, GLsizeiptrARB.class }; + } else { valid_types = new Class[] { }; + } return valid_types; } + @Override public Class getInverseType(Class type) { - if ( GLuint.class.equals(type) ) + if ( GLuint.class.equals(type) ) { return GLint.class; - else if ( GLint.class.equals(type) ) + } else if ( GLint.class.equals(type) ) { return GLuint.class; - else if ( GLushort.class.equals(type) ) + } else if ( GLushort.class.equals(type) ) { return GLshort.class; - else if ( GLshort.class.equals(type) ) + } else if ( GLshort.class.equals(type) ) { return GLushort.class; - else if ( GLubyte.class.equals(type) ) + } else if ( GLubyte.class.equals(type) ) { return GLbyte.class; - else if ( GLbyte.class.equals(type) ) + } else if ( GLbyte.class.equals(type) ) { return GLubyte.class; - else if ( GLuint64EXT.class.equals(type) ) + } else if ( GLuint64EXT.class.equals(type) ) { return GLint64EXT.class; - else if ( GLint64EXT.class.equals(type) ) + } else if ( GLint64EXT.class.equals(type) ) { return GLuint64EXT.class; - else if ( GLuint64.class.equals(type) ) + } else if ( GLuint64.class.equals(type) ) { return GLint64.class; - else if ( GLint64.class.equals(type) ) + } else if ( GLint64.class.equals(type) ) { return GLuint64.class; - else + } else { return null; + } } + @Override public String getAutoTypeFromAnnotation(AnnotationMirror annotation) { Class annotation_class = NativeTypeTranslator.getClassFromType(annotation.getAnnotationType()); - if ( annotation_class.equals(GLint.class) ) + if ( annotation_class.equals(GLint.class) ) { return "GL11.GL_INT"; - else if ( annotation_class.equals(GLbyte.class) ) + } else if ( annotation_class.equals(GLbyte.class) ) { return "GL11.GL_BYTE"; - else if ( annotation_class.equals(GLshort.class) ) + } else if ( annotation_class.equals(GLshort.class) ) { return "GL11.GL_SHORT"; - if ( annotation_class.equals(GLuint.class) ) + } + if ( annotation_class.equals(GLuint.class) ) { return "GL11.GL_UNSIGNED_INT"; - else if ( annotation_class.equals(GLubyte.class) ) + } else if ( annotation_class.equals(GLubyte.class) ) { return "GL11.GL_UNSIGNED_BYTE"; - else if ( annotation_class.equals(GLushort.class) ) + } else if ( annotation_class.equals(GLushort.class) ) { return "GL11.GL_UNSIGNED_SHORT"; - else if ( annotation_class.equals(GLfloat.class) ) + } else if ( annotation_class.equals(GLfloat.class) ) { return "GL11.GL_FLOAT"; - else if ( annotation_class.equals(GLdouble.class) ) + } else if ( annotation_class.equals(GLdouble.class) ) { return "GL11.GL_DOUBLE"; - else + } else { return null; + } } } diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/opengl/GLvoid.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/opengl/GLvoid.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/opengl/GLvoid.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/opengl/GLvoid.java 2016-04-09 16:26:56.000000000 +0000 @@ -40,13 +40,12 @@ import org.lwjgl.util.generator.NativeType; -import java.lang.annotation.Target; import java.lang.annotation.ElementType; - -import com.sun.mirror.type.PrimitiveType; +import java.lang.annotation.Target; +import javax.lang.model.type.TypeKind; @NativeType -@Target({ElementType.PARAMETER, ElementType.METHOD}) +@Target({ ElementType.PARAMETER, ElementType.METHOD }) public @interface GLvoid { - PrimitiveType.Kind value() default PrimitiveType.Kind.BYTE; + TypeKind value() default TypeKind.BYTE; } diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/PlatformDependent.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/PlatformDependent.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/PlatformDependent.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/PlatformDependent.java 2016-04-09 16:26:56.000000000 +0000 @@ -38,8 +38,8 @@ * window system (glX, wgl, ...) * * @author elias_naur - * @version $Revision: 2983 $ - * $Id: PlatformDependent.java 2983 2008-04-07 18:36:09Z matzon $ + * @version $Revision$ + * $Id$ */ import java.lang.annotation.Target; diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/Platform.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/Platform.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/Platform.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/Platform.java 2016-04-09 16:26:56.000000000 +0000 @@ -34,8 +34,8 @@ /** * * @author elias_naur - * @version $Revision: 2983 $ - * $Id: Platform.java 2983 2008-04-07 18:36:09Z matzon $ + * @version $Revision$ + * $Id$ */ import java.io.PrintWriter; diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/PointerType.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/PointerType.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/PointerType.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/PointerType.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2002-2013 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.util.generator; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Target; + +/** Marker interface for pointer types. */ +@Target(ElementType.ANNOTATION_TYPE) +public @interface PointerType { + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/PostfixTranslator.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/PostfixTranslator.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/PostfixTranslator.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/PostfixTranslator.java 2016-04-09 16:26:56.000000000 +0000 @@ -38,23 +38,25 @@ * postfixes. * * @author elias_naur - * @version $Revision: 3412 $ - * $Id: PostfixTranslator.java 3412 2010-09-26 23:43:24Z spasi $ + * @version $Revision$ + * $Id$ */ -import com.sun.mirror.declaration.*; -import com.sun.mirror.type.*; -import com.sun.mirror.util.*; - import java.lang.annotation.Annotation; import java.nio.*; +import javax.lang.model.element.AnnotationMirror; +import javax.lang.model.element.Element; +import javax.lang.model.type.DeclaredType; +import javax.lang.model.type.PrimitiveType; +import javax.lang.model.type.TypeKind; +import javax.lang.model.util.SimpleTypeVisitor6; -public class PostfixTranslator implements TypeVisitor { +public class PostfixTranslator extends SimpleTypeVisitor6 { private final StringBuilder signature = new StringBuilder(); - private final Declaration declaration; + private final Element declaration; private final TypeMap type_map; - public PostfixTranslator(TypeMap type_map, Declaration declaration) { + public PostfixTranslator(TypeMap type_map, Element declaration) { this.declaration = declaration; this.type_map = type_map; } @@ -63,52 +65,39 @@ return signature.toString(); } - public void visitAnnotationType(AnnotationType t) { - throw new RuntimeException(t + " is not allowed"); - } - - public void visitArrayType(ArrayType t) { - throw new RuntimeException(t + " is not allowed"); - } - - private static PrimitiveType.Kind getPrimitiveKindFromBufferClass(Class c) { - if (IntBuffer.class.equals(c) || int.class.equals(c) ) - return PrimitiveType.Kind.INT; - else if (DoubleBuffer.class.equals(c) || double.class.equals(c) ) - return PrimitiveType.Kind.DOUBLE; - else if (ShortBuffer.class.equals(c) || short.class.equals(c) ) - return PrimitiveType.Kind.SHORT; - else if (ByteBuffer.class.equals(c) || byte.class.equals(c) ) - return PrimitiveType.Kind.BYTE; - else if (FloatBuffer.class.equals(c) || float.class.equals(c)) - return PrimitiveType.Kind.FLOAT; - else if (LongBuffer.class.equals(c) || long.class.equals(c) ) - return PrimitiveType.Kind.LONG; + private static TypeKind getPrimitiveKindFromBufferClass(Class c) { + if ( IntBuffer.class.equals(c) || int.class.equals(c) ) + return TypeKind.INT; + else if ( DoubleBuffer.class.equals(c) || double.class.equals(c) ) + return TypeKind.DOUBLE; + else if ( ShortBuffer.class.equals(c) || short.class.equals(c) ) + return TypeKind.SHORT; + else if ( ByteBuffer.class.equals(c) || byte.class.equals(c) ) + return TypeKind.BYTE; + else if ( FloatBuffer.class.equals(c) || float.class.equals(c) ) + return TypeKind.FLOAT; + else if ( LongBuffer.class.equals(c) || long.class.equals(c) ) + return TypeKind.LONG; else throw new RuntimeException(c + " is not allowed"); } - public void visitClassType(ClassType t) { + private void visitClassType(DeclaredType t) { Class c = NativeTypeTranslator.getClassFromType(t); - PrimitiveType.Kind kind = getPrimitiveKindFromBufferClass(c); + TypeKind kind = getPrimitiveKindFromBufferClass(c); visitPrimitiveTypeKind(kind); } - public void visitDeclaredType(DeclaredType t) { - throw new RuntimeException(t + " is not allowed"); - } - - public void visitEnumType(EnumType t) { - throw new RuntimeException(t + " is not allowed"); - } - - public void visitInterfaceType(InterfaceType t) { - throw new RuntimeException(t + " is not allowed"); + @Override + public Void visitDeclared(DeclaredType t, Void o) { + if ( t.asElement().getKind().isClass() ) + visitClassType(t); + return DEFAULT_VALUE; } private boolean translateAnnotation(AnnotationMirror annotation) { NativeType native_type = NativeTypeTranslator.getAnnotation(annotation, NativeType.class); - if (native_type != null) { + if ( native_type != null ) { Class annotation_class = NativeTypeTranslator.getClassFromType(annotation.getAnnotationType()); signature.append(type_map.translateAnnotation(annotation_class)); return true; @@ -118,26 +107,28 @@ private boolean translateAnnotations() { boolean result = false; - for (AnnotationMirror annotation : Utils.getSortedAnnotations(declaration.getAnnotationMirrors())) - if (translateAnnotation(annotation)) { - if (result) + for ( AnnotationMirror annotation : Utils.getSortedAnnotations(declaration.getAnnotationMirrors()) ) + if ( translateAnnotation(annotation) ) { + if ( result ) throw new RuntimeException("Multiple native types"); result = true; } return result; } - public void visitPrimitiveType(PrimitiveType t) { + @Override + public Void visitPrimitive(PrimitiveType t, Void o) { visitPrimitiveTypeKind(t.getKind()); + return DEFAULT_VALUE; } - private void visitPrimitiveTypeKind(PrimitiveType.Kind kind) { + private void visitPrimitiveTypeKind(TypeKind kind) { boolean annotated_translation = translateAnnotations(); - if (annotated_translation) + if ( annotated_translation ) return; // No annotation type was specified, fall back to default String type; - switch (kind) { + switch ( kind ) { case INT: type = "i"; break; @@ -161,23 +152,4 @@ } signature.append(type); } - - public void visitReferenceType(ReferenceType t) { - throw new RuntimeException(t + " is not allowed"); - } - - public void visitTypeMirror(TypeMirror t) { - throw new RuntimeException(t + " is not allowed"); - } - - public void visitTypeVariable(TypeVariable t) { - throw new RuntimeException(t + " is not allowed"); - } - - public void visitVoidType(VoidType t) { - } - - public void visitWildcardType(WildcardType t) { - throw new RuntimeException(t + " is not allowed"); - } } \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/RegisterStubsGenerator.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/RegisterStubsGenerator.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/RegisterStubsGenerator.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/RegisterStubsGenerator.java 2016-04-09 16:26:56.000000000 +0000 @@ -29,7 +29,6 @@ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - package org.lwjgl.util.generator; /** @@ -37,37 +36,41 @@ * This class generates the initNatives native function. * * @author elias_naur - * @version $Revision: 3418 $ - * $Id: RegisterStubsGenerator.java 3418 2010-09-28 21:11:35Z spasi $ + * @version $Revision$ $Id$ */ - -import org.lwjgl.opencl.CLMem; - -import com.sun.mirror.declaration.*; -import com.sun.mirror.type.*; - -import java.io.*; -import java.util.*; +import java.io.PrintWriter; +import java.util.Arrays; +import java.util.EnumSet; +import java.util.Iterator; +import java.util.List; +import java.util.regex.Pattern; +import javax.lang.model.element.ExecutableElement; +import javax.lang.model.element.TypeElement; +import javax.lang.model.element.VariableElement; +import javax.lang.model.type.TypeMirror; public class RegisterStubsGenerator { - public static void generateMethodsNativeStubBind(PrintWriter writer, InterfaceDeclaration d, boolean generate_error_checks, boolean context_specific) { - Iterator it = d.getMethods().iterator(); - while (it.hasNext()) { - MethodDeclaration method = it.next(); + + public static void generateMethodsNativeStubBind(PrintWriter writer, TypeElement d, boolean generate_error_checks, boolean context_specific) { + Iterator it = Utils.getMethods(d).iterator(); + while ( it.hasNext() ) { + ExecutableElement method = it.next(); Alternate alt_annotation = method.getAnnotation(Alternate.class); - if ( (alt_annotation != null && (!alt_annotation.nativeAlt() || alt_annotation.skipNative())) || method.getAnnotation(Reuse.class) != null ) + if ( (alt_annotation != null && (!alt_annotation.nativeAlt() || alt_annotation.skipNative())) || method.getAnnotation(Reuse.class) != null ) { continue; + } EnumSet platforms; PlatformDependent platform_annotation = method.getAnnotation(PlatformDependent.class); - if (platform_annotation != null) + if ( platform_annotation != null ) { platforms = EnumSet.copyOf(Arrays.asList(platform_annotation.value())); - else + } else { platforms = EnumSet.of(Platform.ALL); - for (Platform platform : platforms) { + } + for ( Platform platform : platforms ) { platform.printPrologue(writer); boolean has_buffer_parameter = Utils.hasMethodBufferObjectParameter(method); printMethodNativeStubBind(writer, d, method, platform, Mode.NORMAL, it.hasNext() || has_buffer_parameter, generate_error_checks, context_specific); - if (has_buffer_parameter) { + if ( has_buffer_parameter ) { printMethodNativeStubBind(writer, d, method, platform, Mode.BUFFEROBJECT, it.hasNext(), generate_error_checks, context_specific); } platform.printEpilogue(writer); @@ -76,60 +79,71 @@ writer.println(); } - private static String getTypeSignature(TypeMirror type, boolean add_position_signature) { - SignatureTranslator v = new SignatureTranslator(add_position_signature); - type.accept(v); + private static String getTypeSignature(TypeMirror type) { + SignatureTranslator v = new SignatureTranslator(); + type.accept(v, null); return v.getSignature(); } - private static String getMethodSignature(MethodDeclaration method, Mode mode) { - Collection params = method.getParameters(); + private static String getMethodSignature(ExecutableElement method, Mode mode) { + List params = method.getParameters(); String signature = "("; - for (ParameterDeclaration param : params) { - if ( param.getAnnotation(Result.class) != null || (param.getAnnotation(Helper.class) != null && !param.getAnnotation(Helper.class).passToNative()) ) + for ( VariableElement param : params ) { + if ( param.getAnnotation(Result.class) != null || (param.getAnnotation(Helper.class) != null && !param.getAnnotation(Helper.class).passToNative()) ) { continue; + } final Constant constant_annotation = param.getAnnotation(Constant.class); - if ( constant_annotation != null && constant_annotation.isNative() ) + if ( constant_annotation != null && constant_annotation.isNative() ) { continue; + } - if (mode == Mode.BUFFEROBJECT && param.getAnnotation(BufferObject.class) != null) - signature += "I"; - else - signature += getTypeSignature(param.getType(), true); + if ( mode == Mode.BUFFEROBJECT && param.getAnnotation(BufferObject.class) != null ) { + signature += "J"; + } else { + signature += getTypeSignature(param.asType()); + } } final TypeMirror result_type = Utils.getMethodReturnType(method); final CachedResult cached_result_annotation = method.getAnnotation(CachedResult.class); final AutoSize auto_size_annotation = method.getAnnotation(AutoSize.class); - if ( Utils.getNIOBufferType(result_type) != null && (auto_size_annotation == null || !auto_size_annotation.isNative()) ) + final boolean isNIOBuffer = Utils.getNIOBufferType(result_type) != null; + if ( isNIOBuffer && (auto_size_annotation == null || !auto_size_annotation.isNative()) ) { signature += "J"; + } - String result_type_signature = getTypeSignature(result_type, false); - if ( cached_result_annotation != null ) + final String result_type_signature = isNIOBuffer ? "Ljava/nio/ByteBuffer;" : getTypeSignature(result_type); + if ( cached_result_annotation != null ) { signature += result_type_signature; + } signature += ")"; signature += result_type_signature; return signature; } - private static void printMethodNativeStubBind(PrintWriter writer, InterfaceDeclaration d, MethodDeclaration method, Platform platform, Mode mode, boolean has_more, boolean generate_error_checks, boolean context_specific) { + private static final Pattern GL_PATTERN = Pattern.compile("gl"); + + private static void printMethodNativeStubBind(PrintWriter writer, TypeElement d, ExecutableElement method, Platform platform, Mode mode, boolean has_more, boolean generate_error_checks, boolean context_specific) { writer.print("\t\t{\"" + Utils.getSimpleNativeMethodName(method, generate_error_checks, context_specific)); - if (mode == Mode.BUFFEROBJECT) + if ( mode == Mode.BUFFEROBJECT ) { writer.print(Utils.BUFFER_OBJECT_METHOD_POSTFIX); + } writer.print("\", \"" + getMethodSignature(method, mode) + "\", (void *)&"); writer.print(Utils.getQualifiedNativeMethodName(Utils.getQualifiedClassName(d), method, generate_error_checks, context_specific)); - if (mode == Mode.BUFFEROBJECT) + if ( mode == Mode.BUFFEROBJECT ) { writer.print(Utils.BUFFER_OBJECT_METHOD_POSTFIX); + } final Alternate alt_annotation = method.getAnnotation(Alternate.class); - final String methodName = alt_annotation == null ? method.getSimpleName() : alt_annotation.value(); - String opengl_handle_name = methodName.replaceFirst("gl", platform.getPrefix()); - writer.print(", \"" + opengl_handle_name + "\", (void *)&" + methodName + "}"); - if (has_more) + final String methodName = alt_annotation == null ? method.getSimpleName().toString() : alt_annotation.value(); + String opengl_handle_name = GL_PATTERN.matcher(methodName).replaceFirst(platform.getPrefix()); + writer.print(", \"" + opengl_handle_name + "\", (void *)&" + methodName + ", " + (method.getAnnotation(Optional.class) == null ? "false" : "true") + "}"); + if ( has_more ) { writer.println(","); + } } } diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/Result.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/Result.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/Result.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/Result.java 2016-04-09 16:26:56.000000000 +0000 @@ -37,8 +37,8 @@ * specified parameter. * * @author elias_naur - * @version $Revision: 2983 $ - * $Id: Result.java 2983 2008-04-07 18:36:09Z matzon $ + * @version $Revision$ + * $Id$ */ import java.lang.annotation.Target; diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/Reuse.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/Reuse.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/Reuse.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/Reuse.java 2016-04-09 16:26:56.000000000 +0000 @@ -45,5 +45,5 @@ public @interface Reuse { /** The extension Class that defines the method. */ String value(); - + String method() default ""; } \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/SignatureTranslator.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/SignatureTranslator.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/SignatureTranslator.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/SignatureTranslator.java 2016-04-09 16:26:56.000000000 +0000 @@ -37,81 +37,89 @@ * A TypeVisitor that translates types to JNI signatures. * * @author elias_naur - * @version $Revision: 3443 $ - * $Id: SignatureTranslator.java 3443 2010-10-12 21:13:03Z spasi $ + * @version $Revision$ + * $Id$ */ import org.lwjgl.PointerBuffer; +import org.lwjgl.PointerWrapper; -import com.sun.mirror.type.*; -import com.sun.mirror.util.*; +import java.nio.Buffer; +import java.nio.ByteBuffer; +import java.util.regex.Pattern; +import javax.lang.model.type.ArrayType; +import javax.lang.model.type.DeclaredType; +import javax.lang.model.type.NoType; +import javax.lang.model.type.PrimitiveType; +import javax.lang.model.util.SimpleTypeVisitor6; -import java.nio.*; - -class SignatureTranslator implements TypeVisitor { - private final boolean add_position_signature; +class SignatureTranslator extends SimpleTypeVisitor6 { private final StringBuilder signature = new StringBuilder(); - SignatureTranslator(boolean add_position_signature) { - this.add_position_signature = add_position_signature; - } + SignatureTranslator() {} + + private static final Pattern DOT_PATTERN = Pattern.compile("\\."); private static String getNativeNameFromClassName(String class_name) { - return class_name.replaceAll("\\.", "/"); + return DOT_PATTERN.matcher(class_name).replaceAll("/"); } public String getSignature() { return signature.toString(); } - public void visitAnnotationType(AnnotationType t) { - throw new RuntimeException(t + " is not allowed"); - } - - public void visitArrayType(ArrayType t) { + @Override + public Void visitArray(ArrayType t, Void o) { final Class type = Utils.getJavaType(t.getComponentType()); if ( CharSequence.class.isAssignableFrom(type) ) - signature.append("Ljava/nio/ByteBuffer;I"); + signature.append("J"); else if ( Buffer.class.isAssignableFrom(type) ) signature.append("[Ljava/nio/ByteBuffer;"); - else if ( org.lwjgl.PointerWrapper.class.isAssignableFrom(type) ) + else if ( PointerWrapper.class.isAssignableFrom(type) ) signature.append("[L" + getNativeNameFromClassName(type.getName()) + ";"); else throw new RuntimeException(t + " is not allowed"); + return DEFAULT_VALUE; } - public void visitClassType(ClassType t) { + private void visitClassType(DeclaredType t) { Class type = NativeTypeTranslator.getClassFromType(t); - String type_name; - if ( (CharSequence.class.isAssignableFrom(type) && !String.class.equals(type)) || CharSequence[].class.isAssignableFrom(type) || PointerBuffer.class.isAssignableFrom(type) ) - type_name = ByteBuffer.class.getName(); - else if ( org.lwjgl.PointerWrapper.class.isAssignableFrom(type) ) { - signature.append("J"); - return; - } else - type_name = t.getDeclaration().getQualifiedName(); - - signature.append("L"); - signature.append(getNativeNameFromClassName(type_name)); - signature.append(";"); - if ( add_position_signature && Utils.isAddressableType(type) && !String.class.equals(type) ) - signature.append("I"); - } - public void visitDeclaredType(DeclaredType t) { - throw new RuntimeException(t + " is not allowed"); + if ( PointerWrapper.class.isAssignableFrom(type) || (Utils.isAddressableType(type) && !String.class.equals(type)) ) + signature.append("J"); + else { + String type_name; + if ( (CharSequence.class.isAssignableFrom(type) && !String.class.equals(type)) || CharSequence[].class.isAssignableFrom(type) || PointerBuffer.class.isAssignableFrom(type) ) + type_name = ByteBuffer.class.getName(); + else + type_name = t.toString(); + + signature.append("L"); + signature.append(getNativeNameFromClassName(type_name)); + signature.append(";"); + } } - public void visitEnumType(EnumType t) { - throw new RuntimeException(t + " is not allowed"); + @Override + public Void visitDeclared(DeclaredType t, Void o) { + if ( t.asElement().getKind().isClass() ) + visitClassType(t); + else if ( t.asElement().getKind().isInterface() ) + visitInterfaceType(t); + return DEFAULT_VALUE; } - public void visitInterfaceType(InterfaceType t) { - throw new RuntimeException(t + " is not allowed"); + private void visitInterfaceType(DeclaredType t) { + Class type = NativeTypeTranslator.getClassFromType(t); + if ( PointerWrapper.class.isAssignableFrom(type) ) + signature.append("J"); + else + throw new RuntimeException(t + " is not allowed"); } - public void visitPrimitiveType(PrimitiveType t) { - switch (t.getKind()) { + @Override + public Void visitPrimitive(PrimitiveType t, Void o) { + switch ( t.getKind() ) { case BOOLEAN: signature.append("Z"); break; @@ -136,25 +144,13 @@ default: throw new RuntimeException("Unsupported type " + t); } + return DEFAULT_VALUE; } - public void visitReferenceType(ReferenceType t) { - throw new RuntimeException(t + " is not allowed"); - } - - public void visitTypeMirror(TypeMirror t) { - throw new RuntimeException(t + " is not allowed"); - } - - public void visitTypeVariable(TypeVariable t) { - throw new RuntimeException(t + " is not allowed"); - } - - public void visitVoidType(VoidType t) { + @Override + public Void visitNoType(NoType t, Void o) { signature.append("V"); + return DEFAULT_VALUE; } - public void visitWildcardType(WildcardType t) { - throw new RuntimeException(t + " is not allowed"); - } } diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/Signedness.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/Signedness.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/Signedness.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/Signedness.java 2016-04-09 16:26:56.000000000 +0000 @@ -34,8 +34,8 @@ /** * * @author elias_naur - * @version $Revision: 2983 $ - * $Id: Signedness.java 2983 2008-04-07 18:36:09Z matzon $ + * @version $Revision$ + * $Id$ */ public enum Signedness { diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/StripPostfix.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/StripPostfix.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/StripPostfix.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/StripPostfix.java 2016-04-09 16:26:56.000000000 +0000 @@ -37,8 +37,8 @@ * according to a specified Buffer parameter. * * @author elias_naur - * @version $Revision: 3256 $ - * $Id: StripPostfix.java 3256 2009-12-01 03:37:27Z spasi $ + * @version $Revision$ + * $Id$ */ import java.lang.annotation.Target; diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/TypedefsGenerator.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/TypedefsGenerator.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/TypedefsGenerator.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/TypedefsGenerator.java 2016-04-09 16:26:56.000000000 +0000 @@ -37,23 +37,23 @@ * A TypeVisitor that generates the native typedefs. * * @author elias_naur - * @version $Revision: 3412 $ - * $Id: TypedefsGenerator.java 3412 2010-09-26 23:43:24Z spasi $ + * @version $Revision$ + * $Id$ */ -import com.sun.mirror.declaration.*; -import com.sun.mirror.type.*; - -import java.io.*; -import java.util.*; +import java.io.PrintWriter; +import java.util.Collection; +import javax.lang.model.element.ExecutableElement; +import javax.lang.model.element.VariableElement; +import javax.lang.model.type.TypeMirror; public class TypedefsGenerator { - private static void generateNativeTypedefs(TypeMap type_map, PrintWriter writer, MethodDeclaration method) { + private static void generateNativeTypedefs(TypeMap type_map, PrintWriter writer, ExecutableElement method) { TypeMirror return_type = method.getReturnType(); writer.print("typedef "); writer.print(type_map.getTypedefPostfix()); NativeTypeTranslator translator = new NativeTypeTranslator(type_map, method); - return_type.accept(translator); + return_type.accept(translator, null); writer.print(translator.getSignature()); writer.print(" ("); writer.print(type_map.getFunctionPrefix()); @@ -62,10 +62,10 @@ writer.println(");"); } - private static void generateNativeTypedefsParameters(TypeMap type_map, PrintWriter writer, Collection params) { - if (params.size() > 0) { + private static void generateNativeTypedefsParameters(TypeMap type_map, PrintWriter writer, Collection params) { + if ( params.size() > 0 ) { boolean first = true; - for ( ParameterDeclaration param : params ) { + for ( VariableElement param : params ) { if ( param.getAnnotation(Helper.class) != null ) continue; @@ -79,17 +79,17 @@ } } - private static void generateNativeTypedefsParameter(TypeMap type_map, PrintWriter writer, ParameterDeclaration param) { + private static void generateNativeTypedefsParameter(TypeMap type_map, PrintWriter writer, VariableElement param) { NativeTypeTranslator translator = new NativeTypeTranslator(type_map, param); - param.getType().accept(translator); + param.asType().accept(translator, null); writer.print(translator.getSignature()); - if (param.getAnnotation(Result.class) != null || param.getAnnotation(Indirect.class) != null || param.getAnnotation(PointerArray.class) != null) + if ( param.getAnnotation(Result.class) != null || param.getAnnotation(Indirect.class) != null || param.getAnnotation(PointerArray.class) != null ) writer.print("*"); writer.print(" " + param.getSimpleName()); } - public static void generateNativeTypedefs(TypeMap type_map, PrintWriter writer, Collection methods) { - for (MethodDeclaration method : methods) { + public static void generateNativeTypedefs(TypeMap type_map, PrintWriter writer, Collection methods) { + for ( ExecutableElement method : methods ) { if ( method.getAnnotation(Alternate.class) == null && method.getAnnotation(Reuse.class) == null ) generateNativeTypedefs(type_map, writer, method); } diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/TypeInfo.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/TypeInfo.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/TypeInfo.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/TypeInfo.java 2016-04-09 16:26:56.000000000 +0000 @@ -33,29 +33,31 @@ /** * - * This class represent a parameter configuration. There are multiple - * TypeInfos in case of multityped parameters. + * This class represent a parameter configuration. There are multiple TypeInfos + * in case of multityped parameters. * * @author elias_naur - * @version $Revision: 3412 $ - * $Id: TypeInfo.java 3412 2010-09-26 23:43:24Z spasi $ + * @version $Revision$ $Id$ */ - +import org.lwjgl.PointerBuffer; import org.lwjgl.util.generator.opengl.GLvoid; -import com.sun.mirror.declaration.*; -import com.sun.mirror.type.*; - import java.lang.annotation.Annotation; -import java.util.*; import java.nio.*; +import java.util.*; +import javax.lang.model.element.AnnotationMirror; +import javax.lang.model.element.ExecutableElement; +import javax.lang.model.element.VariableElement; +import javax.lang.model.type.TypeKind; +import javax.lang.model.type.TypeMirror; public class TypeInfo { + public static final String UNSIGNED_PARAMETER_NAME = "unsigned"; private final Signedness signedness; - private final Class type; - private final String auto_type; + private final Class type; + private final String auto_type; private TypeInfo(Class type, Signedness signedness, String auto_type) { this.type = type; @@ -72,14 +74,15 @@ } public String getAutoType() { - if (auto_type == null) + if ( auto_type == null ) { throw new RuntimeException("No auto type assigned"); + } return auto_type; } - private static Class getTypeFromPrimitiveKind(PrimitiveType.Kind kind) { + private static Class getTypeFromPrimitiveKind(TypeKind kind) { Class type; - switch (kind) { + switch ( kind ) { case LONG: type = long.class; break; @@ -107,9 +110,9 @@ return type; } - private static Class getBufferTypeFromPrimitiveKind(PrimitiveType.Kind kind) { + private static Class getBufferTypeFromPrimitiveKind(TypeKind kind, AnnotationMirror annotation) { Class type; - switch (kind) { + switch ( kind ) { case INT: type = IntBuffer.class; break; @@ -123,9 +126,14 @@ type = ShortBuffer.class; break; case LONG: - type = LongBuffer.class; + if ( annotation.getAnnotationType().asElement().getAnnotation(PointerType.class) != null ) { + type = PointerBuffer.class; + } else { + type = LongBuffer.class; + } break; case BYTE: /* fall through */ + case BOOLEAN: type = ByteBuffer.class; break; @@ -140,33 +148,34 @@ return new TypeInfo(java_type, Signedness.NONE, null); } - public static Map getDefaultTypeInfoMap(MethodDeclaration method) { - Map map = new HashMap(); - for (ParameterDeclaration param : method.getParameters()) { - TypeInfo type_info = getDefaultTypeInfo(param.getType()); + public static Map getDefaultTypeInfoMap(ExecutableElement method) { + Map map = new HashMap(); + for ( VariableElement param : method.getParameters() ) { + TypeInfo type_info = getDefaultTypeInfo(param.asType()); map.put(param, type_info); } return map; } - private static Collection getTypeInfos(TypeMap type_map, Declaration param, TypeMirror decl_type) { - Collection annotations = Utils.getSortedAnnotations(param.getAnnotationMirrors()); + private static Collection getTypeInfos(TypeMap type_map, VariableElement param) { + List annotations = Utils.getSortedAnnotations(param.getAnnotationMirrors()); + GLvoid void_annotation = param.getAnnotation(GLvoid.class); + Map types = new HashMap(); Collection multityped_result = new ArrayList(); boolean add_default_type = true; - for (AnnotationMirror annotation : annotations) { + for ( AnnotationMirror annotation : annotations ) { NativeType native_type_annotation = NativeTypeTranslator.getAnnotation(annotation, NativeType.class); - if (native_type_annotation != null) { + if ( native_type_annotation != null ) { Class annotation_type = NativeTypeTranslator.getClassFromType(annotation.getAnnotationType()); Signedness signedness = type_map.getSignednessFromType(annotation_type); Class inverse_type = type_map.getInverseType(annotation_type); String auto_type = type_map.getAutoTypeFromAnnotation(annotation); - if (inverse_type != null) { - if (types.containsKey(inverse_type)) { + if ( inverse_type != null ) { + if ( types.containsKey(inverse_type) ) { TypeInfo inverse_type_info = types.get(inverse_type); String inverse_auto_type = inverse_type_info.getAutoType(); - auto_type = signedness == Signedness.UNSIGNED ? auto_type + " : " + inverse_auto_type : - inverse_auto_type + " : " + auto_type; + auto_type = signedness == Signedness.UNSIGNED ? auto_type + " : " + inverse_auto_type : inverse_auto_type + " : " + auto_type; auto_type = UNSIGNED_PARAMETER_NAME + " ? " + auto_type; signedness = Signedness.BOTH; types.remove(inverse_type); @@ -174,59 +183,59 @@ } } Class type; - PrimitiveType.Kind kind; - GLvoid void_annotation = param.getAnnotation(GLvoid.class); + TypeKind kind; kind = void_annotation == null ? type_map.getPrimitiveTypeFromNativeType(annotation_type) : void_annotation.value(); - if (Utils.getNIOBufferType(decl_type) != null) - type = getBufferTypeFromPrimitiveKind(kind); - else + if ( Utils.getNIOBufferType(param.asType()) != null ) { + type = getBufferTypeFromPrimitiveKind(kind, annotation); + } else { type = getTypeFromPrimitiveKind(kind); + } TypeInfo type_info = new TypeInfo(type, signedness, auto_type); types.put(annotation_type, type_info); multityped_result.add(type_info); add_default_type = false; } } - if (add_default_type) { - TypeInfo default_type_info = getDefaultTypeInfo(decl_type); + if ( add_default_type ) { + TypeInfo default_type_info = getDefaultTypeInfo(param.asType()); Collection result = new ArrayList(); result.add(default_type_info); return result; - } else + } else { return multityped_result; + } } - private static Map> getTypeInfoMap(TypeMap type_map, MethodDeclaration method) { - Map> map = new HashMap>(); - for (ParameterDeclaration param : method.getParameters()) { - Collection types = getTypeInfos(type_map, param, param.getType()); + private static Map> getTypeInfoMap(TypeMap type_map, ExecutableElement method) { + Map> map = new HashMap>(); + for ( VariableElement param : method.getParameters() ) { + Collection types = getTypeInfos(type_map, param); map.put(param, types); } return map; } - public static Collection> getTypeInfoCrossProduct(TypeMap type_map, MethodDeclaration method) { - Collection parameter_collection = method.getParameters(); - ParameterDeclaration[] parameters = new ParameterDeclaration[parameter_collection.size()]; - parameter_collection.toArray(parameters); - Collection> cross_product = new ArrayList>(); - getCrossProductRecursive(0, parameters, getTypeInfoMap(type_map, method), - new HashMap(), cross_product); + public static Collection> getTypeInfoCrossProduct(TypeMap type_map, ExecutableElement method) { + List parameter_collection = method.getParameters(); + Collection> cross_product = new ArrayList>(); + getCrossProductRecursive(0, parameter_collection, getTypeInfoMap(type_map, method), + new HashMap(), cross_product); return cross_product; } - private static void getCrossProductRecursive(int index, ParameterDeclaration[] parameters, Map> typeinfos_map, Map current_instance, - Collection> cross_product) { - if (index == parameters.length) { + private static void getCrossProductRecursive(int index, List parameters, Map> typeinfos_map, Map current_instance, Collection> cross_product) { + if ( index == parameters.size() ) { + /** + * the last parameter is treated as multi-type only + */ cross_product.add(current_instance); return; } - ParameterDeclaration param = parameters[index]; + VariableElement param = parameters.get(index); Collection typeinfos = typeinfos_map.get(param); - if (typeinfos != null) { - for (TypeInfo typeinfo : typeinfos) { - Map instance = new HashMap(current_instance); + if ( typeinfos != null ) { + for ( TypeInfo typeinfo : typeinfos ) { + Map instance = new HashMap(current_instance); instance.put(param, typeinfo); getCrossProductRecursive(index + 1, parameters, typeinfos_map, instance, cross_product); } diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/TypeMap.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/TypeMap.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/TypeMap.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/TypeMap.java 2016-04-09 16:26:56.000000000 +0000 @@ -37,22 +37,23 @@ * The interface to the OpenAL/OpenGL specific generator behaviour * * @author elias_naur - * @version $Revision: 3412 $ - * $Id: TypeMap.java 3412 2010-09-26 23:43:24Z spasi $ + * @version $Revision$ + * $Id$ */ -import com.sun.mirror.declaration.*; -import com.sun.mirror.type.*; - -import java.io.*; +import java.io.PrintWriter; import java.lang.annotation.Annotation; +import javax.lang.model.element.AnnotationMirror; +import javax.lang.model.element.ExecutableElement; +import javax.lang.model.type.TypeKind; public interface TypeMap { void printCapabilitiesInit(PrintWriter writer); String getCapabilities(); - void printErrorCheckMethod(PrintWriter writer, MethodDeclaration method, String tabs); + String getAPIUtilParam(boolean comma); + void printErrorCheckMethod(PrintWriter writer, ExecutableElement method, String tabs); String getRegisterNativesFunctionName(); - PrimitiveType.Kind getPrimitiveTypeFromNativeType(Class native_type); + TypeKind getPrimitiveTypeFromNativeType(Class native_type); String getTypedefPostfix(); String getFunctionPrefix(); void printNativeIncludes(PrintWriter writer); @@ -62,7 +63,7 @@ Class[] getValidAnnotationTypes(Class type); Class getVoidType(); String translateAnnotation(Class annotation_type); - Class getNativeTypeFromPrimitiveType(PrimitiveType.Kind kind); + Class getNativeTypeFromPrimitiveType(TypeKind kind); String getAutoTypeFromAnnotation(AnnotationMirror annotation); Class getInverseType(Class type); Signedness getSignednessFromType(Class type); diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/Utils.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/Utils.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/generator/Utils.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/generator/Utils.java 2016-04-09 16:26:56.000000000 +0000 @@ -36,11 +36,10 @@ * Various utility methods to the generator. * * @author elias_naur - * @version $Revision: 3443 $ - * $Id: Utils.java 3443 2010-10-12 21:13:03Z spasi $ + * @version $Revision$ $Id$ */ - import org.lwjgl.PointerBuffer; +import org.lwjgl.PointerWrapper; import org.lwjgl.util.generator.opengl.GLboolean; import org.lwjgl.util.generator.opengl.GLchar; import org.lwjgl.util.generator.opengl.GLcharARB; @@ -50,63 +49,71 @@ import java.nio.Buffer; import java.nio.ByteBuffer; import java.util.*; - -import com.sun.mirror.declaration.*; -import com.sun.mirror.type.PrimitiveType; -import com.sun.mirror.type.TypeMirror; +import java.util.regex.Pattern; +import javax.annotation.processing.ProcessingEnvironment; +import javax.lang.model.element.*; +import javax.lang.model.type.TypeKind; +import javax.lang.model.type.TypeMirror; +import javax.lang.model.type.TypeVisitor; +import javax.lang.model.util.ElementFilter; public class Utils { - public static final String TYPEDEF_POSTFIX = "PROC"; - public static final String FUNCTION_POINTER_VAR_NAME = "function_pointer"; - public static final String FUNCTION_POINTER_POSTFIX = "_pointer"; - public static final String CHECKS_CLASS_NAME = "GLChecks"; - public static final String CONTEXT_CAPS_CLASS_NAME = "ContextCapabilities"; - public static final String STUB_INITIALIZER_NAME = "initNativeStubs"; - public static final String BUFFER_OBJECT_METHOD_POSTFIX = "BO"; - public static final String BUFFER_OBJECT_PARAMETER_POSTFIX = "_buffer_offset"; - public static final String RESULT_SIZE_NAME = "result_size"; - public static final String RESULT_VAR_NAME = "__result"; - public static final String CACHED_BUFFER_LENGTH_NAME = "length"; - public static final String CACHED_BUFFER_NAME = "old_buffer"; - private static final String OVERLOADED_METHOD_PREFIX = "n"; + public static final String TYPEDEF_POSTFIX = "PROC"; + public static final String FUNCTION_POINTER_VAR_NAME = "function_pointer"; + public static final String FUNCTION_POINTER_POSTFIX = "_pointer"; + public static final String CHECKS_CLASS_NAME = "GLChecks"; + public static final String CONTEXT_CAPS_CLASS_NAME = "ContextCapabilities"; + public static final String STUB_INITIALIZER_NAME = "initNativeStubs"; + public static final String BUFFER_OBJECT_METHOD_POSTFIX = "BO"; + public static final String BUFFER_OBJECT_PARAMETER_POSTFIX = "_buffer_offset"; + public static final String RESULT_SIZE_NAME = "result_size"; + public static final String RESULT_VAR_NAME = "__result"; + public static final String CACHED_BUFFER_LENGTH_NAME = "length"; + public static final String CACHED_BUFFER_NAME = "old_buffer"; + private static final String OVERLOADED_METHOD_PREFIX = "n"; - public static String getTypedefName(MethodDeclaration method) { + public static String getTypedefName(ExecutableElement method) { Alternate alt_annotation = method.getAnnotation(Alternate.class); return (alt_annotation == null ? method.getSimpleName() : alt_annotation.value()) + TYPEDEF_POSTFIX; } - public static String getFunctionAddressName(InterfaceDeclaration interface_decl, MethodDeclaration method) { + public static String getFunctionAddressName(TypeElement interface_decl, ExecutableElement method) { return getFunctionAddressName(interface_decl, method, false); } - public static String getFunctionAddressName(InterfaceDeclaration interface_decl, MethodDeclaration method, boolean forceAlt) { + public static String getFunctionAddressName(TypeElement interface_decl, ExecutableElement method, boolean forceAlt) { final Alternate alt_annotation = method.getAnnotation(Alternate.class); - /* Removed prefix so that we can identify reusable entry points, removed postfix because it's not needed and looks nicer. - String interfaceName = interface_decl.getSimpleName(); // If we add this back, we need to fix @Reuse (add a param for the template name) - if ( alt_annotation == null || (alt_annotation.nativeAlt() && !forceAlt) ) - return interfaceName + "_" + method.getSimpleName() + FUNCTION_POINTER_POSTFIX; - else - return interfaceName + "_" + alt_annotation.value() + FUNCTION_POINTER_POSTFIX; - */ - if ( alt_annotation == null || (alt_annotation.nativeAlt() && !forceAlt) ) - return method.getSimpleName(); - else + /* Removed prefix so that we can identify reusable entry points, removed postfix because it's not needed and looks nicer. + String interfaceName = interface_decl.getSimpleName(); // If we add this back, we need to fix @Reuse (add a param for the template name) + if ( alt_annotation == null || (alt_annotation.nativeAlt() && !forceAlt) ) + return interfaceName + "_" + method.getSimpleName() + FUNCTION_POINTER_POSTFIX; + else + return interfaceName + "_" + alt_annotation.value() + FUNCTION_POINTER_POSTFIX; + */ + if ( alt_annotation == null || (alt_annotation.nativeAlt() && !forceAlt) ) { + return method.getSimpleName().toString(); + } else { return alt_annotation.value(); + } } - public static boolean isFinal(InterfaceDeclaration d) { + public static boolean isFinal(Element d) { Extension extension_annotation = d.getAnnotation(Extension.class); return extension_annotation == null || extension_annotation.isFinal(); } private static class AnnotationMirrorComparator implements Comparator { + + /** + * Sort annotations. + */ + @Override public int compare(AnnotationMirror a1, AnnotationMirror a2) { - String n1 = a1.getAnnotationType().getDeclaration().getQualifiedName(); - String n2 = a2.getAnnotationType().getDeclaration().getQualifiedName(); - int result = n1.compareTo(n2); - return result; + String n1 = a1.getAnnotationType().toString(); + String n2 = a2.getAnnotationType().toString(); + return n1.compareTo(n2); } public boolean equals(AnnotationMirror a1, AnnotationMirror a2) { @@ -114,13 +121,13 @@ } } - public static Collection getSortedAnnotations(Collection annotations) { + public static List getSortedAnnotations(List annotations) { List annotation_list = new ArrayList(annotations); Collections.sort(annotation_list, new AnnotationMirrorComparator()); return annotation_list; } - public static String getReferenceName(InterfaceDeclaration interface_decl, MethodDeclaration method, ParameterDeclaration param) { + public static String getReferenceName(TypeElement interface_decl, ExecutableElement method, VariableElement param) { return interface_decl.getSimpleName() + "_" + method.getSimpleName() + "_" + param.getSimpleName(); } @@ -131,7 +138,7 @@ public static boolean isAddressableType(Class type) { if ( type.isArray() ) { final Class component_type = type.getComponentType(); - return isAddressableTypeImpl(component_type) || org.lwjgl.PointerWrapper.class.isAssignableFrom(component_type); + return isAddressableTypeImpl(component_type) || PointerWrapper.class.isAssignableFrom(component_type); } return isAddressableTypeImpl(type); } @@ -142,42 +149,48 @@ public static Class getJavaType(TypeMirror type_mirror) { JavaTypeTranslator translator = new JavaTypeTranslator(); - type_mirror.accept(translator); + type_mirror.accept((TypeVisitor)translator, null); return translator.getType(); } - private static boolean hasParameterMultipleTypes(ParameterDeclaration param) { + private static boolean hasParameterMultipleTypes(VariableElement param) { int num_native_annotations = 0; - for (AnnotationMirror annotation : param.getAnnotationMirrors()) - if (NativeTypeTranslator.getAnnotation(annotation, NativeType.class) != null) + for ( AnnotationMirror annotation : param.getAnnotationMirrors() ) { + if ( NativeTypeTranslator.getAnnotation(annotation, NativeType.class) != null ) { num_native_annotations++; + } + } return num_native_annotations > 1; } - public static boolean isParameterMultiTyped(ParameterDeclaration param) { - boolean result = Buffer.class.equals(Utils.getJavaType(param.getType())); - if (!result && hasParameterMultipleTypes(param)) + public static boolean isParameterMultiTyped(VariableElement param) { + boolean result = Buffer.class.equals(Utils.getJavaType(param.asType())); + if ( !result && hasParameterMultipleTypes(param) ) { throw new RuntimeException(param + " not defined as java.nio.Buffer but has multiple types"); + } return result; } - public static ParameterDeclaration findParameter(MethodDeclaration method, String name) { - for (ParameterDeclaration param : method.getParameters()) - if (param.getSimpleName().equals(name)) + public static VariableElement findParameter(ExecutableElement method, String name) { + for ( VariableElement param : method.getParameters() ) { + if ( param.getSimpleName().toString().equals(name) ) { return param; + } + } throw new RuntimeException("Parameter " + name + " not found"); } - public static void printDocComment(PrintWriter writer, Declaration decl) { + public static void printDocComment(PrintWriter writer, Element decl, ProcessingEnvironment pe) { final String overloadsComment; - if ( (decl instanceof MethodDeclaration) && decl.getAnnotation(Alternate.class) != null ) + if ( (decl instanceof ExecutableElement) && decl.getAnnotation(Alternate.class) != null ) { overloadsComment = "Overloads " + decl.getAnnotation(Alternate.class).value() + "."; - else + } else { overloadsComment = null; + } - String doc_comment = decl.getDocComment(); - if (doc_comment != null) { - final String tab = decl instanceof InterfaceDeclaration ? "" : "\t"; + String doc_comment = pe.getElementUtils().getDocComment(decl); + if ( doc_comment != null ) { + final String tab = (decl instanceof TypeElement) ? "" : "\t"; writer.println(tab + "/**"); if ( overloadsComment != null ) { @@ -187,11 +200,12 @@ final StringTokenizer doc_lines = new StringTokenizer(doc_comment, "\n", true); boolean lastWasNL = false; - while (doc_lines.hasMoreTokens()) { + while ( doc_lines.hasMoreTokens() ) { final String t = doc_lines.nextToken(); if ( "\n".equals(t) ) { - if ( lastWasNL ) + if ( lastWasNL ) { writer.println(tab + " *

        "); + } lastWasNL = true; } else { writer.println(tab + " * " + t); @@ -200,221 +214,250 @@ } writer.println(tab + " */"); - } else if ( overloadsComment != null ) + } else if ( overloadsComment != null ) { writer.println("\t/** " + overloadsComment + " */"); + } } - public static AnnotationMirror getParameterAutoAnnotation(ParameterDeclaration param) { - for (AnnotationMirror annotation : param.getAnnotationMirrors()) - if (NativeTypeTranslator.getAnnotation(annotation, Auto.class) != null) + public static AnnotationMirror getParameterAutoAnnotation(VariableElement param) { + for ( AnnotationMirror annotation : param.getAnnotationMirrors() ) { + if ( NativeTypeTranslator.getAnnotation(annotation, Auto.class) != null ) { return annotation; + } + } return null; } // DISABLED: We always generate indirect methods. (affects OpenAL only at the time of this change) - public static boolean isMethodIndirect(boolean generate_error_checks, boolean context_specific, MethodDeclaration method) { - /* - for (ParameterDeclaration param : method.getParameters()) { - if (isAddressableType(param.getType()) || getParameterAutoAnnotation(param) != null || - param.getAnnotation(Constant.class) != null) - return true; - } - return hasMethodBufferObjectParameter(method) || method.getAnnotation(Code.class) != null || - method.getAnnotation(CachedResult.class) != null || - (generate_error_checks && method.getAnnotation(NoErrorCheck.class) == null) || - context_specific; - */ + public static boolean isMethodIndirect(boolean generate_error_checks, boolean context_specific, ExecutableElement method) { + /* + for (VariableElement param : method.getParameters()) { + if (isAddressableType(param.getType()) || getParameterAutoAnnotation(param) != null || + param.getAnnotation(Constant.class) != null) + return true; + } + return hasMethodBufferObjectParameter(method) || method.getAnnotation(Code.class) != null || + method.getAnnotation(CachedResult.class) != null || + (generate_error_checks && method.getAnnotation(NoErrorCheck.class) == null) || + context_specific; + */ return true; } + private static final Pattern DOT_PATTERN = Pattern.compile("\\."); + public static String getNativeQualifiedName(String qualified_name) { - return qualified_name.replaceAll("\\.", "_"); + return DOT_PATTERN.matcher(qualified_name).replaceAll("_"); } public static String getQualifiedNativeMethodName(String qualified_class_name, String method_name) { + // Escape '_' in method name + if ( method_name.indexOf('_') != -1 ) { + method_name = method_name.replace("_", "_1"); + } + return "Java_" + getNativeQualifiedName(qualified_class_name) + "_" + method_name; } - public static String getQualifiedNativeMethodName(String qualified_class_name, MethodDeclaration method, boolean generate_error_checks, boolean context_specific) { + public static String getQualifiedNativeMethodName(String qualified_class_name, ExecutableElement method, boolean generate_error_checks, boolean context_specific) { String method_name = getSimpleNativeMethodName(method, generate_error_checks, context_specific); return getQualifiedNativeMethodName(qualified_class_name, method_name); } - public static ParameterDeclaration getResultParameter(MethodDeclaration method) { - ParameterDeclaration result_param = null; - for (ParameterDeclaration param : method.getParameters()) { - if (param.getAnnotation(Result.class) != null) { - if (result_param != null) + public static VariableElement getResultParameter(ExecutableElement method) { + VariableElement result_param = null; + for ( VariableElement param : method.getParameters() ) { + if ( param.getAnnotation(Result.class) != null ) { + if ( result_param != null ) { throw new RuntimeException("Multiple parameters annotated with Result in method " + method); + } result_param = param; } } return result_param; } - public static TypeMirror getMethodReturnType(MethodDeclaration method) { + public static TypeMirror getMethodReturnType(ExecutableElement method) { TypeMirror result_type; - ParameterDeclaration result_param = getResultParameter(method); - if (result_param != null) { - result_type = result_param.getType(); - } else + VariableElement result_param = getResultParameter(method); + if ( result_param != null ) { + result_type = result_param.asType(); + } else { result_type = method.getReturnType(); + } return result_type; } - public static String getMethodReturnType(MethodDeclaration method, GLreturn return_annotation, boolean buffer) { - ParameterDeclaration return_param = null; - for ( ParameterDeclaration param : method.getParameters() ) { - if ( param.getSimpleName().equals(return_annotation.value()) ) { + public static String getMethodReturnType(ExecutableElement method, GLreturn return_annotation, boolean buffer) { + VariableElement return_param = null; + for ( VariableElement param : method.getParameters() ) { + if ( param.getSimpleName().toString().equals(return_annotation.value()) ) { return_param = param; break; } } - if ( return_param == null ) + if ( return_param == null ) { throw new RuntimeException("The @GLreturn parameter \"" + return_annotation.value() + "\" could not be found in method: " + method); + } - PrimitiveType.Kind kind = NativeTypeTranslator.getPrimitiveKindFromBufferClass(Utils.getJavaType(return_param.getType())); - if ( return_param.getAnnotation(GLboolean.class) != null ) - kind = PrimitiveType.Kind.BOOLEAN; + TypeKind kind = NativeTypeTranslator.getPrimitiveKindFromBufferClass(Utils.getJavaType(return_param.asType())); + if ( return_param.getAnnotation(GLboolean.class) != null ) { + kind = TypeKind.BOOLEAN; + } - if ( kind == PrimitiveType.Kind.BYTE && (return_param.getAnnotation(GLchar.class) != null || return_param.getAnnotation(GLcharARB.class) != null) ) + if ( kind == TypeKind.BYTE && (return_param.getAnnotation(GLchar.class) != null || return_param.getAnnotation(GLcharARB.class) != null) ) { return "String"; - else { + } else { final String type = JavaTypeTranslator.getPrimitiveClassFromKind(kind).getName(); return buffer ? Character.toUpperCase(type.charAt(0)) + type.substring(1) : type; } } - public static boolean needResultSize(MethodDeclaration method) { + public static boolean needResultSize(ExecutableElement method) { return getNIOBufferType(getMethodReturnType(method)) != null && method.getAnnotation(AutoSize.class) == null; } - public static void printExtraCallArguments(PrintWriter writer, MethodDeclaration method, String size_parameter_name) { + public static void printExtraCallArguments(PrintWriter writer, ExecutableElement method, String size_parameter_name) { writer.print(size_parameter_name); - if (method.getAnnotation(CachedResult.class) != null) { + if ( method.getAnnotation(CachedResult.class) != null ) { writer.print(", " + CACHED_BUFFER_NAME); } } - private static String getClassName(InterfaceDeclaration interface_decl, String opengl_name) { + private static String getClassName(TypeElement interface_decl, String opengl_name) { Extension extension_annotation = interface_decl.getAnnotation(Extension.class); - if (extension_annotation != null && !"".equals(extension_annotation.className())) { + if ( extension_annotation != null && !"".equals(extension_annotation.className()) ) { return extension_annotation.className(); } StringBuilder result = new StringBuilder(); - for (int i = 0; i < opengl_name.length(); i++) { + for ( int i = 0; i < opengl_name.length(); i++ ) { int ch = opengl_name.codePointAt(i); - if (ch == '_') { + if ( ch == '_' ) { i++; result.appendCodePoint(Character.toUpperCase(opengl_name.codePointAt(i))); - } else + } else { result.appendCodePoint(ch); + } } return result.toString(); } - public static boolean hasMethodBufferObjectParameter(MethodDeclaration method) { - for (ParameterDeclaration param : method.getParameters()) { - if (param.getAnnotation(BufferObject.class) != null) { + public static boolean hasMethodBufferObjectParameter(ExecutableElement method) { + for ( VariableElement param : method.getParameters() ) { + if ( param.getAnnotation(BufferObject.class) != null ) { return true; } } return false; } - public static String getQualifiedClassName(InterfaceDeclaration interface_decl) { - return interface_decl.getPackage().getQualifiedName() + "." + getSimpleClassName(interface_decl); + public static String getQualifiedClassName(TypeElement interface_decl) { + return interface_decl.getEnclosingElement().asType().toString() + "." + getSimpleClassName(interface_decl); } - public static String getSimpleClassName(InterfaceDeclaration interface_decl) { - return getClassName(interface_decl, interface_decl.getSimpleName()); + public static String getSimpleClassName(TypeElement interface_decl) { + return getClassName(interface_decl, interface_decl.getSimpleName().toString()); } public static Class getNIOBufferType(TypeMirror t) { Class param_type = getJavaType(t); - if (Buffer.class.isAssignableFrom(param_type)) + if ( Buffer.class.isAssignableFrom(param_type) ) { return param_type; - else if ( param_type == CharSequence.class || param_type == CharSequence[].class || param_type == PointerBuffer.class ) + } else if ( param_type == CharSequence.class || param_type == CharSequence[].class || param_type == PointerBuffer.class ) { return ByteBuffer.class; - else + } else { return null; + } } - public static String getSimpleNativeMethodName(MethodDeclaration method, boolean generate_error_checks, boolean context_specific) { + public static String getSimpleNativeMethodName(ExecutableElement method, boolean generate_error_checks, boolean context_specific) { String method_name; Alternate alt_annotation = method.getAnnotation(Alternate.class); - method_name = alt_annotation == null || alt_annotation.nativeAlt() ? method.getSimpleName() : alt_annotation.value(); - if (isMethodIndirect(generate_error_checks, context_specific, method)) + method_name = alt_annotation == null || alt_annotation.nativeAlt() ? method.getSimpleName().toString() : alt_annotation.value(); + if ( isMethodIndirect(generate_error_checks, context_specific, method) ) { method_name = OVERLOADED_METHOD_PREFIX + method_name; + } return method_name; } - static boolean isReturnParameter(MethodDeclaration method, ParameterDeclaration param) { + static boolean isReturnParameter(ExecutableElement method, VariableElement param) { GLreturn string_annotation = method.getAnnotation(GLreturn.class); - if ( string_annotation == null || !string_annotation.value().equals(param.getSimpleName()) ) + if ( string_annotation == null || !string_annotation.value().equals(param.getSimpleName().toString()) ) { return false; + } - if ( param.getAnnotation(OutParameter.class) == null ) + if ( param.getAnnotation(OutParameter.class) == null ) { throw new RuntimeException("The parameter specified in @GLreturn is not annotated with @OutParameter in method: " + method); + } - if ( param.getAnnotation(Check.class) != null ) + if ( param.getAnnotation(Check.class) != null ) { throw new RuntimeException("The parameter specified in @GLreturn is annotated with @Check in method: " + method); + } - if ( param.getAnnotation(GLchar.class) != null && Utils.getJavaType(param.getType()).equals(ByteBuffer.class) && string_annotation.maxLength().length() == 0 ) + if ( param.getAnnotation(GLchar.class) != null && Utils.getJavaType(param.asType()).equals(ByteBuffer.class) && string_annotation.maxLength().length() == 0 ) { throw new RuntimeException("The @GLreturn annotation is missing a maxLength parameter in method: " + method); + } return true; } - static String getStringOffset(MethodDeclaration method, ParameterDeclaration param) { + static String getStringOffset(ExecutableElement method, VariableElement param) { String offset = null; - for ( ParameterDeclaration p : method.getParameters() ) { - if ( param != null && p.getSimpleName().equals(param.getSimpleName()) ) + for ( VariableElement p : method.getParameters() ) { + if ( param != null && p.getSimpleName().equals(param.getSimpleName()) ) { break; + } + + if ( p.getAnnotation(NullTerminated.class) != null ) { + continue; + } - final Class type = Utils.getJavaType(p.getType()); + final Class type = Utils.getJavaType(p.asType()); if ( type.equals(CharSequence.class) ) { - if ( offset == null ) + if ( offset == null ) { offset = p.getSimpleName() + ".length()"; - else + } else { offset += " + " + p.getSimpleName() + ".length()"; - if ( p.getAnnotation(NullTerminated.class) != null ) offset += " + 1"; - + } + //if ( p.getAnnotation(NullTerminated.class) != null ) offset += " + 1"; } else if ( type.equals(CharSequence[].class) ) { - if ( offset == null ) + if ( offset == null ) { offset = "APIUtil.getTotalLength(" + p.getSimpleName() + ")"; - else + } else { offset += " + APIUtil.getTotalLength(" + p.getSimpleName() + ")"; - if ( p.getAnnotation(NullTerminated.class) != null ) offset += " + " + p.getSimpleName() + ".length"; + } + //if ( p.getAnnotation(NullTerminated.class) != null ) offset += " + " + p.getSimpleName() + ".length"; } } return offset; } - static void printGLReturnPre(PrintWriter writer, MethodDeclaration method, GLreturn return_annotation) { + static void printGLReturnPre(PrintWriter writer, ExecutableElement method, GLreturn return_annotation, TypeMap type_map) { final String return_type = getMethodReturnType(method, return_annotation, true); if ( "String".equals(return_type) ) { if ( !return_annotation.forceMaxLength() ) { - writer.println("IntBuffer " + return_annotation.value() + "_length = APIUtil.getLengths();"); + writer.println("IntBuffer " + return_annotation.value() + "_length = APIUtil.getLengths(" + type_map.getAPIUtilParam(false) + ");"); writer.print("\t\t"); } - writer.print("ByteBuffer " + return_annotation.value() + " = APIUtil.getBufferByte(" + return_annotation.maxLength()); - /* - Params that use the return buffer will advance its position while filling it. When we return, the position will be - at the right spot for grabbing the returned string bytes. We only have to make sure that the original buffer was - large enough to hold everything, so that no re-allocations happen while filling. - */ + writer.print("ByteBuffer " + return_annotation.value() + " = APIUtil.getBufferByte(" + type_map.getAPIUtilParam(true) + return_annotation.maxLength()); + /* + Params that use the return buffer will advance its position while filling it. When we return, the position will be + at the right spot for grabbing the returned string bytes. We only have to make sure that the original buffer was + large enough to hold everything, so that no re-allocations happen while filling. + */ final String offset = getStringOffset(method, null); - if ( offset != null ) + if ( offset != null ) { writer.print(" + " + offset); + } writer.println(");"); } else { final String buffer_type = "Boolean".equals(return_type) ? "Byte" : return_type; - writer.print(buffer_type + "Buffer " + return_annotation.value() + " = APIUtil.getBuffer" + buffer_type + "("); - if ( "Byte".equals(buffer_type) ) - writer.print('1'); + writer.print(buffer_type + "Buffer " + return_annotation.value() + " = APIUtil.getBuffer" + buffer_type + "(" + type_map.getAPIUtilParam(false)); + if ( "Byte".equals(buffer_type) ) { + writer.print((type_map.getAPIUtilParam(false).length() > 0 ? ", " : "") + "1"); + } writer.println(");"); } @@ -422,30 +465,42 @@ if ( code_annotation != null && code_annotation.tryBlock() ) { writer.println("\t\ttry {"); writer.print("\t\t\t"); - } else + } else { writer.print("\t\t"); + } } - static void printGLReturnPost(PrintWriter writer, MethodDeclaration method, GLreturn return_annotation) { + static void printGLReturnPost(PrintWriter writer, ExecutableElement method, GLreturn return_annotation, TypeMap type_map) { final String return_type = getMethodReturnType(method, return_annotation, true); if ( "String".equals(return_type) ) { writer.print("\t\t" + return_annotation.value() + ".limit("); final String offset = getStringOffset(method, null); - if ( offset != null) + if ( offset != null ) { writer.print(offset + " + "); - if ( return_annotation.forceMaxLength() ) + } + if ( return_annotation.forceMaxLength() ) { writer.print(return_annotation.maxLength()); - else + } else { writer.print(return_annotation.value() + "_length.get(0)"); + } writer.println(");"); - writer.println("\t\treturn APIUtil.getString(" + return_annotation.value() + ");"); + writer.println("\t\treturn APIUtil.getString(" + type_map.getAPIUtilParam(true) + return_annotation.value() + ");"); } else { writer.print("\t\treturn " + return_annotation.value() + ".get(0)"); - if ( "Boolean".equals(return_type) ) + if ( "Boolean".equals(return_type) ) { writer.print(" == 1"); + } writer.println(";"); } } + public static Collection getFields(TypeElement d) { + return ElementFilter.fieldsIn(new LinkedHashSet(d.getEnclosedElements())); + } + + public static Collection getMethods(TypeElement d) { + return ElementFilter.methodsIn(new LinkedHashSet(d.getEnclosedElements())); + } + } diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/glu/Project.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/glu/Project.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/glu/Project.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/glu/Project.java 2016-04-09 16:26:56.000000000 +0000 @@ -98,7 +98,7 @@ * @param src * @param inverse * - * @return + * @return true if the matrix was succesfully inverted */ private static boolean __gluInvertMatrixf(FloatBuffer src, FloatBuffer inverse) { int i, j, k, swap; diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/input/ControllerAdapter.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/input/ControllerAdapter.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/input/ControllerAdapter.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/input/ControllerAdapter.java 2016-04-09 16:26:56.000000000 +0000 @@ -326,4 +326,15 @@ */ public void setRZAxisDeadZone(float zone) { } + + public int getRumblerCount() { + return 0; + } + + public String getRumblerName(int index) { + return "rumber n/a"; + } + + public void setRumblerStrength(int index, float strength) { + } } \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/mapped/CacheLinePad.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/mapped/CacheLinePad.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/mapped/CacheLinePad.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/mapped/CacheLinePad.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.util.mapped; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * When this annotation is used on a field, automatic cache-line-sized padding + * will be inserted around the field. This is useful in multi-threaded algorithms + * to avoid cache line false sharing. The annotation defaults to padding after + * the field, but can be changed to before or both before and after. It can be + * applied to both mapped object fields and POJO primitive fields. + * + * @author Spasi + */ +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.FIELD) +public @interface CacheLinePad { + + /** + * When true, cache-line padding will be inserted before the field. + * + * @return true if cache-line padding will be inserted before the field + */ + boolean before() default false; + + /** + * When true, cache-line padding will be inserted after the field. + * + * @return true if cache-line padding will be inserted after the field + */ + boolean after() default true; + +} diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/mapped/CacheLineSize.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/mapped/CacheLineSize.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/mapped/CacheLineSize.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/mapped/CacheLineSize.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,141 @@ +package org.lwjgl.util.mapped; + +import org.lwjgl.LWJGLUtil; +import org.lwjgl.MemoryUtil; + +import java.nio.ByteBuffer; +import java.nio.ByteOrder; +import java.nio.IntBuffer; +import java.util.concurrent.Callable; +import java.util.concurrent.ExecutorCompletionService; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; + +import static org.lwjgl.util.mapped.MappedHelper.*; + +/** + * This micro-benchmark tries to detect the CPU's cache line size. This is + * done by exploiting cache line false sharing in multi-threaded code: + * When 2 threads simultaneously access the same cache line (and at least + * 1 access is a write), performance drops considerably. We detect this + * performance drop while decreasing the memory padding in every test step. + * + * @author Spasi + */ +final class CacheLineSize { + + private CacheLineSize() { + } + + static int getCacheLineSize() { + final int THREADS = 2; + final int REPEATS = 100000 * THREADS; + final int LOCAL_REPEATS = REPEATS / THREADS; + + // Detection will start from CacheLineMaxSize bytes. + final int MAX_SIZE = LWJGLUtil.getPrivilegedInteger("org.lwjgl.util.mapped.CacheLineMaxSize", 1024) / 4; // in # of integers + // Detection will stop when the execution time increases by more than CacheLineTimeThreshold %. + final double TIME_THRESHOLD = 1.0 + LWJGLUtil.getPrivilegedInteger("org.lwjgl.util.mapped.CacheLineTimeThreshold", 50) / 100.0; + + final ExecutorService executorService = Executors.newFixedThreadPool(THREADS); + final ExecutorCompletionService completionService = new ExecutorCompletionService(executorService); + + try { + // We need to use a NIO buffer in order to guarantee memory alignment. + final IntBuffer memory = getMemory(MAX_SIZE); + + // -- WARMUP -- + + final int WARMUP = 10; + for ( int i = 0; i < WARMUP; i++ ) + doTest(THREADS, LOCAL_REPEATS, 0, memory, completionService); + + // -- CACHE LINE SIZE DETECTION -- + + long totalTime = 0; + int count = 0; + int cacheLineSize = 64; // fallback to the most common size these days + boolean found = false; + for ( int i = MAX_SIZE; i >= 1; i >>= 1 ) { + final long time = doTest(THREADS, LOCAL_REPEATS, i, memory, completionService); + if ( totalTime > 0 ) { // Ignore first run + final long avgTime = totalTime / count; + if ( (double)time / (double)avgTime > TIME_THRESHOLD ) { // Try to detect a noticeable jump in execution time + cacheLineSize = (i << 1) * 4; + found = true; + break; + } + } + totalTime += time; + count++; + } + + if ( LWJGLUtil.DEBUG ) { + if ( found ) + LWJGLUtil.log("Cache line size detected: " + cacheLineSize + " bytes"); + else + LWJGLUtil.log("Failed to detect cache line size, assuming " + cacheLineSize + " bytes"); + } + + return cacheLineSize; + } finally { + executorService.shutdown(); + } + } + + public static void main(String[] args) { + CacheUtil.getCacheLineSize(); + } + + static long memoryLoop(final int index, final int repeats, final IntBuffer memory, final int padding) { + final long address = MemoryUtil.getAddress(memory) + (index * padding * 4); + + final long time = System.nanoTime(); + for ( int i = 0; i < repeats; i++ ) { + // Use volatile access to avoid server VM optimizations. + ivput(ivget(address) + 1, address); + } + + return System.nanoTime() - time; + } + + private static IntBuffer getMemory(final int START_SIZE) { + final int PAGE_SIZE = MappedObjectUnsafe.INSTANCE.pageSize(); + + final ByteBuffer buffer = ByteBuffer.allocateDirect((START_SIZE * 4) + PAGE_SIZE).order(ByteOrder.nativeOrder()); + + // Align to page and, consequently, to cache line. Otherwise results will be inconsistent. + if ( MemoryUtil.getAddress(buffer) % PAGE_SIZE != 0 ) { + // Round up to page boundary + buffer.position(PAGE_SIZE - (int)(MemoryUtil.getAddress(buffer) & (PAGE_SIZE - 1))); + } + + return buffer.asIntBuffer(); + } + + private static long doTest(final int threads, final int repeats, final int padding, final IntBuffer memory, final ExecutorCompletionService completionService) { + for ( int i = 0; i < threads; i++ ) + submitTest(completionService, i, repeats, memory, padding); + return waitForResults(threads, completionService); + } + + private static void submitTest(final ExecutorCompletionService completionService, final int index, final int repeats, final IntBuffer memory, final int padding) { + completionService.submit(new Callable() { + public Long call() throws Exception { + return memoryLoop(index, repeats, memory, padding); + } + }); + } + + private static long waitForResults(final int count, final ExecutorCompletionService completionService) { + try { + long totalTime = 0; + for ( int i = 0; i < count; i++ ) + totalTime += completionService.take().get(); + return totalTime; + } catch (Exception e) { + throw new RuntimeException(e); + } + } + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/mapped/CacheUtil.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/mapped/CacheUtil.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/mapped/CacheUtil.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/mapped/CacheUtil.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,193 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.util.mapped; + +import org.lwjgl.LWJGLUtil; +import org.lwjgl.MemoryUtil; +import org.lwjgl.PointerBuffer; + +import java.nio.*; + +/** + * This class provides utility methods for allocating cache-line-aligned + * NIO buffers. The CPU cache line size is detected using a micro-benchmark + * that exploits the performation degredation that occurs when different + * threads write to different locations of the same cache line. The detection + * should be reasonably robust on both the server and client VM, but there + * are a few system properties that can be used to tune it. + * + * @author Spasi + */ +public final class CacheUtil { + + private static final int CACHE_LINE_SIZE; + + static { + final Integer size = LWJGLUtil.getPrivilegedInteger("org.lwjgl.util.mapped.CacheLineSize"); // forces a specific cache line size + + if ( size != null ) { + if ( size < 1 ) + throw new IllegalStateException("Invalid CacheLineSize specified: " + size); + CACHE_LINE_SIZE = size; + } else if ( Runtime.getRuntime().availableProcessors() == 1 ) { // We cannot use false sharing to detect it + /* + Spasi: + + I have implemented a single-threaded benchmark for this, but it requires + lots of memory allocations and could not tune it for both the client and + server VM. It's not a big deal anyway, 64 bytes should be ok for any + single-core CPU. + */ + if ( LWJGLUtil.DEBUG ) + LWJGLUtil.log("Cannot detect cache line size on single-core CPUs, assuming 64 bytes."); + CACHE_LINE_SIZE = 64; + } else + CACHE_LINE_SIZE = CacheLineSize.getCacheLineSize(); + } + + private CacheUtil() { + } + + /** + * Returns the CPU cache line size, in number of bytes. + * + * @return the cache line size + */ + public static int getCacheLineSize() { + return CACHE_LINE_SIZE; + } + + /** + * Construct a direct, native-ordered and cache-line-aligned bytebuffer with the specified size. + * + * @param size The size, in bytes + * + * @return a ByteBuffer + */ + public static ByteBuffer createByteBuffer(int size) { + ByteBuffer buffer = ByteBuffer.allocateDirect(size + CACHE_LINE_SIZE); + + // Align to cache line. + if ( MemoryUtil.getAddress(buffer) % CACHE_LINE_SIZE != 0 ) { + // Round up to cache line boundary + buffer.position(CACHE_LINE_SIZE - (int)(MemoryUtil.getAddress(buffer) & (CACHE_LINE_SIZE - 1))); + } + + buffer.limit(buffer.position() + size); + return buffer.slice().order(ByteOrder.nativeOrder()); + } + + /** + * Construct a direct, native-ordered and cache-line-aligned shortbuffer with the specified number + * of elements. + * + * @param size The size, in shorts + * + * @return a ShortBuffer + */ + public static ShortBuffer createShortBuffer(int size) { + return createByteBuffer(size << 1).asShortBuffer(); + } + + /** + * Construct a direct, native-ordered and cache-line-aligned charbuffer with the specified number + * of elements. + * + * @param size The size, in chars + * + * @return an CharBuffer + */ + public static CharBuffer createCharBuffer(int size) { + return createByteBuffer(size << 1).asCharBuffer(); + } + + /** + * Construct a direct, native-ordered and cache-line-aligned intbuffer with the specified number + * of elements. + * + * @param size The size, in ints + * + * @return an IntBuffer + */ + public static IntBuffer createIntBuffer(int size) { + return createByteBuffer(size << 2).asIntBuffer(); + } + + /** + * Construct a direct, native-ordered and cache-line-aligned longbuffer with the specified number + * of elements. + * + * @param size The size, in longs + * + * @return an LongBuffer + */ + public static LongBuffer createLongBuffer(int size) { + return createByteBuffer(size << 3).asLongBuffer(); + } + + /** + * Construct a direct, native-ordered and cache-line-aligned floatbuffer with the specified number + * of elements. + * + * @param size The size, in floats + * + * @return a FloatBuffer + */ + public static FloatBuffer createFloatBuffer(int size) { + return createByteBuffer(size << 2).asFloatBuffer(); + } + + /** + * Construct a direct, native-ordered and cache-line-aligned doublebuffer with the specified number + * of elements. + * + * @param size The size, in floats + * + * @return a FloatBuffer + */ + public static DoubleBuffer createDoubleBuffer(int size) { + return createByteBuffer(size << 3).asDoubleBuffer(); + } + + /** + * Construct a cache-line-aligned PointerBuffer with the specified number + * of elements. + * + * @param size The size, in memory addresses + * + * @return a PointerBuffer + */ + public static PointerBuffer createPointerBuffer(int size) { + return new PointerBuffer(createByteBuffer(size * PointerBuffer.getPointerSize())); + } + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/mapped/MappedField.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/mapped/MappedField.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/mapped/MappedField.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/mapped/MappedField.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.util.mapped; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * This annotation can be used on fields of {@link MappedObject} subclasses, + * to manually specify byte offsets and lengths. This is useful when the + * mapped fields require custom alignment. {@link java.nio.ByteBuffer} + * fields are required to have this annotation with a hardcoded byte length. + * + * @author Riven + */ +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.FIELD) +public @interface MappedField { + + /** + * Specifies the field byte offset within the mapped object. + * + * @return the field byte offset + */ + long byteOffset() default -1; + + /** + * Specifies the field byte length. Required for {@link java.nio.ByteBuffer} fields. + * + * @return the field byte length + */ + long byteLength() default -1; + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/mapped/MappedForeach.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/mapped/MappedForeach.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/mapped/MappedForeach.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/mapped/MappedForeach.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.util.mapped; + +import java.util.Iterator; + +/** + * Iterable implementation for {@link MappedObject}. + * + * @author Riven + */ +final class MappedForeach implements Iterable { + + final T mapped; + final int elementCount; + + MappedForeach(T mapped, int elementCount) { + this.mapped = mapped; + this.elementCount = elementCount; + } + + public Iterator iterator() { + return new Iterator() { + + private int index; + + public boolean hasNext() { + return this.index < (MappedForeach.this.elementCount); + } + + public T next() { + mapped.setViewAddress(mapped.getViewAddress(this.index++)); + return mapped; + } + + public void remove() { + throw new UnsupportedOperationException(); + } + }; + } + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/mapped/MappedHelper.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/mapped/MappedHelper.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/mapped/MappedHelper.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/mapped/MappedHelper.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,392 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.util.mapped; + +import org.lwjgl.LWJGLUtil; +import org.lwjgl.MemoryUtil; + +import java.nio.ByteBuffer; + +import static org.lwjgl.util.mapped.MappedObjectUnsafe.*; + +/** + * [INTERNAL USE ONLY] + *

        + * Helper class used by the bytecode transformer. + * + * @author Riven + */ +public class MappedHelper { + + public static void setup(MappedObject mo, ByteBuffer buffer, int align, int sizeof) { + if ( LWJGLUtil.CHECKS && mo.baseAddress != 0L ) + throw new IllegalStateException("this method should not be called by user-code"); + + if ( LWJGLUtil.CHECKS && !buffer.isDirect() ) + throw new IllegalArgumentException("bytebuffer must be direct"); + mo.preventGC = buffer; + + if ( LWJGLUtil.CHECKS && align <= 0 ) + throw new IllegalArgumentException("invalid alignment"); + + if ( LWJGLUtil.CHECKS && (sizeof <= 0 || sizeof % align != 0) ) + throw new IllegalStateException("sizeof not a multiple of alignment"); + + long addr = MemoryUtil.getAddress(buffer); + if ( LWJGLUtil.CHECKS && addr % align != 0 ) + throw new IllegalStateException("buffer address not aligned on " + align + " bytes"); + + mo.baseAddress = mo.viewAddress = addr; + } + + public static void checkAddress(long viewAddress, MappedObject mapped) { + mapped.checkAddress(viewAddress); + } + + public static void put_views(MappedSet2 set, int view) { + set.view(view); + } + + public static void put_views(MappedSet3 set, int view) { + set.view(view); + } + + public static void put_views(MappedSet4 set, int view) { + set.view(view); + } + + public static void put_view(MappedObject mapped, int view, int sizeof) { + mapped.setViewAddress(mapped.baseAddress + view * sizeof); + } + + public static int get_view(MappedObject mapped, int sizeof) { + return (int)(mapped.viewAddress - mapped.baseAddress) / sizeof; + } + + public static void put_view_shift(MappedObject mapped, int view, int sizeof_shift) { + mapped.setViewAddress(mapped.baseAddress + (view << sizeof_shift)); + } + + public static int get_view_shift(MappedObject mapped, int sizeof_shift) { + return ((int)(mapped.viewAddress - mapped.baseAddress)) >> sizeof_shift; + } + + public static void put_view_next(MappedObject mapped, int sizeof) { + mapped.setViewAddress(mapped.viewAddress + sizeof); + } + + public static MappedObject dup(MappedObject src, MappedObject dst) { + dst.baseAddress = src.baseAddress; + dst.viewAddress = src.viewAddress; + dst.preventGC = src.preventGC; + return dst; + } + + public static MappedObject slice(MappedObject src, MappedObject dst) { + dst.baseAddress = src.viewAddress; // ! + dst.viewAddress = src.viewAddress; + dst.preventGC = src.preventGC; + return dst; + } + + public static void copy(MappedObject src, MappedObject dst, int bytes) { + if ( MappedObject.CHECKS ) { + src.checkRange(bytes); + dst.checkRange(bytes); + } + + INSTANCE.copyMemory(src.viewAddress, dst.viewAddress, bytes); + } + + public static ByteBuffer newBuffer(long address, int capacity) { + return MappedObjectUnsafe.newBuffer(address, capacity); + } + + // ---- primitive fields read/write + + // byte + + public static void bput(byte value, long addr) { + INSTANCE.putByte(addr, value); + } + + public static void bput(MappedObject mapped, byte value, int fieldOffset) { + INSTANCE.putByte(mapped.viewAddress + fieldOffset, value); + } + + public static byte bget(long addr) { + return INSTANCE.getByte(addr); + } + + public static byte bget(MappedObject mapped, int fieldOffset) { + return INSTANCE.getByte(mapped.viewAddress + fieldOffset); + } + + public static void bvput(byte value, long addr) { + INSTANCE.putByteVolatile(null, addr, value); + } + + public static void bvput(MappedObject mapped, byte value, int fieldOffset) { + INSTANCE.putByteVolatile(null, mapped.viewAddress + fieldOffset, value); + } + + public static byte bvget(long addr) { + return INSTANCE.getByteVolatile(null, addr); + } + + public static byte bvget(MappedObject mapped, int fieldOffset) { + return INSTANCE.getByteVolatile(null, mapped.viewAddress + fieldOffset); + } + + // short + + public static void sput(short value, long addr) { + INSTANCE.putShort(addr, value); + } + + public static void sput(MappedObject mapped, short value, int fieldOffset) { + INSTANCE.putShort(mapped.viewAddress + fieldOffset, value); + } + + public static short sget(long addr) { + return INSTANCE.getShort(addr); + } + + public static short sget(MappedObject mapped, int fieldOffset) { + return INSTANCE.getShort(mapped.viewAddress + fieldOffset); + } + + public static void svput(short value, long addr) { + INSTANCE.putShortVolatile(null, addr, value); + } + + public static void svput(MappedObject mapped, short value, int fieldOffset) { + INSTANCE.putShortVolatile(null, mapped.viewAddress + fieldOffset, value); + } + + public static short svget(long addr) { + return INSTANCE.getShortVolatile(null, addr); + } + + public static short svget(MappedObject mapped, int fieldOffset) { + return INSTANCE.getShortVolatile(null, mapped.viewAddress + fieldOffset); + } + + // char + + public static void cput(char value, long addr) { + INSTANCE.putChar(addr, value); + } + + public static void cput(MappedObject mapped, char value, int fieldOffset) { + INSTANCE.putChar(mapped.viewAddress + fieldOffset, value); + } + + public static char cget(long addr) { + return INSTANCE.getChar(addr); + } + + public static char cget(MappedObject mapped, int fieldOffset) { + return INSTANCE.getChar(mapped.viewAddress + fieldOffset); + } + + public static void cvput(char value, long addr) { + INSTANCE.putCharVolatile(null, addr, value); + } + + public static void cvput(MappedObject mapped, char value, int fieldOffset) { + INSTANCE.putCharVolatile(null, mapped.viewAddress + fieldOffset, value); + } + + public static char cvget(long addr) { + return INSTANCE.getCharVolatile(null, addr); + } + + public static char cvget(MappedObject mapped, int fieldOffset) { + return INSTANCE.getCharVolatile(null, mapped.viewAddress + fieldOffset); + } + + // int + + public static void iput(int value, long addr) { + INSTANCE.putInt(addr, value); + } + + public static void iput(MappedObject mapped, int value, int fieldOffset) { + INSTANCE.putInt(mapped.viewAddress + fieldOffset, value); + } + + public static int iget(long address) { + return INSTANCE.getInt(address); + } + + public static int iget(MappedObject mapped, int fieldOffset) { + return INSTANCE.getInt(mapped.viewAddress + fieldOffset); + } + + public static void ivput(int value, long addr) { + INSTANCE.putIntVolatile(null, addr, value); + } + + public static void ivput(MappedObject mapped, int value, int fieldOffset) { + INSTANCE.putIntVolatile(null, mapped.viewAddress + fieldOffset, value); + } + + public static int ivget(long address) { + return INSTANCE.getIntVolatile(null, address); + } + + public static int ivget(MappedObject mapped, int fieldOffset) { + return INSTANCE.getIntVolatile(null, mapped.viewAddress + fieldOffset); + } + + // float + + public static void fput(float value, long addr) { + INSTANCE.putFloat(addr, value); + } + + public static void fput(MappedObject mapped, float value, int fieldOffset) { + INSTANCE.putFloat(mapped.viewAddress + fieldOffset, value); + } + + public static float fget(long addr) { + return INSTANCE.getFloat(addr); + } + + public static float fget(MappedObject mapped, int fieldOffset) { + return INSTANCE.getFloat(mapped.viewAddress + fieldOffset); + } + + public static void fvput(float value, long addr) { + INSTANCE.putFloatVolatile(null, addr, value); + } + + public static void fvput(MappedObject mapped, float value, int fieldOffset) { + INSTANCE.putFloatVolatile(null, mapped.viewAddress + fieldOffset, value); + } + + public static float fvget(long addr) { + return INSTANCE.getFloatVolatile(null, addr); + } + + public static float fvget(MappedObject mapped, int fieldOffset) { + return INSTANCE.getFloatVolatile(null, mapped.viewAddress + fieldOffset); + } + + // long + + public static void jput(long value, long addr) { + INSTANCE.putLong(addr, value); + } + + public static void jput(MappedObject mapped, long value, int fieldOffset) { + INSTANCE.putLong(mapped.viewAddress + fieldOffset, value); + } + + public static long jget(long addr) { + return INSTANCE.getLong(addr); + } + + public static long jget(MappedObject mapped, int fieldOffset) { + return INSTANCE.getLong(mapped.viewAddress + fieldOffset); + } + + public static void jvput(long value, long addr) { + INSTANCE.putLongVolatile(null, addr, value); + } + + public static void jvput(MappedObject mapped, long value, int fieldOffset) { + INSTANCE.putLongVolatile(null, mapped.viewAddress + fieldOffset, value); + } + + public static long jvget(long addr) { + return INSTANCE.getLongVolatile(null, addr); + } + + public static long jvget(MappedObject mapped, int fieldOffset) { + return INSTANCE.getLongVolatile(null, mapped.viewAddress + fieldOffset); + } + + // address + + public static void aput(long value, long addr) { + INSTANCE.putAddress(addr, value); + } + + public static void aput(MappedObject mapped, long value, int fieldOffset) { + INSTANCE.putAddress(mapped.viewAddress + fieldOffset, value); + } + + public static long aget(long addr) { + return INSTANCE.getAddress(addr); + } + + public static long aget(MappedObject mapped, int fieldOffset) { + return INSTANCE.getAddress(mapped.viewAddress + fieldOffset); + } + + // double + + public static void dput(double value, long addr) { + INSTANCE.putDouble(addr, value); + } + + public static void dput(MappedObject mapped, double value, int fieldOffset) { + INSTANCE.putDouble(mapped.viewAddress + fieldOffset, value); + } + + public static double dget(long addr) { + return INSTANCE.getDouble(addr); + } + + public static double dget(MappedObject mapped, int fieldOffset) { + return INSTANCE.getDouble(mapped.viewAddress + fieldOffset); + } + + public static void dvput(double value, long addr) { + INSTANCE.putDoubleVolatile(null, addr, value); + } + + public static void dvput(MappedObject mapped, double value, int fieldOffset) { + INSTANCE.putDoubleVolatile(null, mapped.viewAddress + fieldOffset, value); + } + + public static double dvget(long addr) { + return INSTANCE.getDoubleVolatile(null, addr); + } + + public static double dvget(MappedObject mapped, int fieldOffset) { + return INSTANCE.getDoubleVolatile(null, mapped.viewAddress + fieldOffset); + } + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/mapped/MappedObjectClassLoader.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/mapped/MappedObjectClassLoader.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/mapped/MappedObjectClassLoader.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/mapped/MappedObjectClassLoader.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,193 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.util.mapped; + +import org.lwjgl.LWJGLUtil; + +import java.io.IOException; +import java.io.InputStream; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.net.URLClassLoader; + +/** + * This classloader is responsible for applying the bytecode transformation to mapped objects. + * The transformation can either be applied using a Java agent, or with the convenient {@link #fork} method. + * + * @author Riven + */ +public class MappedObjectClassLoader extends URLClassLoader { + + static final String MAPPEDOBJECT_PACKAGE_PREFIX = MappedObjectClassLoader.class.getPackage().getName() + "."; + + static boolean FORKED; + + /** + * Forks the specified class containing a main method, passing the specified arguments. See + * {@link org.lwjgl.test.mapped.TestMappedObject} for example usage. + * + * @param mainClass the class containing the main method + * @param args the arguments to pass + * + * @return true if the fork was successful. + */ + public static boolean fork(Class mainClass, String[] args) { + if ( FORKED ) { + return false; + } + + FORKED = true; + + try { + MappedObjectClassLoader loader = new MappedObjectClassLoader(mainClass); + loader.loadMappedObject(); + + Class replacedMainClass = loader.loadClass(mainClass.getName()); + Method mainMethod = replacedMainClass.getMethod("main", String[].class); + mainMethod.invoke(null, new Object[] { args }); + } catch (InvocationTargetException exc) { + Thread.currentThread().getUncaughtExceptionHandler().uncaughtException(Thread.currentThread(), exc.getCause()); + } catch (Throwable cause) { + throw new Error("failed to fork", cause); + } + + return true; + } + + private MappedObjectClassLoader(Class mainClass) { + super(((URLClassLoader)mainClass.getClassLoader()).getURLs()); + } + + protected synchronized Class loadMappedObject() throws ClassNotFoundException { + final String name = MappedObject.class.getName(); + String className = name.replace('.', '/'); + + byte[] bytecode = readStream(this.getResourceAsStream(className.concat(".class"))); + + long t0 = System.nanoTime(); + bytecode = MappedObjectTransformer.transformMappedObject(bytecode); + long t1 = System.nanoTime(); + total_time_transforming += (t1 - t0); + + if ( MappedObjectTransformer.PRINT_ACTIVITY ) + printActivity(className, t0, t1); + + Class clazz = super.defineClass(name, bytecode, 0, bytecode.length); + resolveClass(clazz); + return clazz; + } + + private static long total_time_transforming; + + @Override + protected synchronized Class loadClass(String name, boolean resolve) throws ClassNotFoundException { + if ( name.startsWith("java.") + || name.startsWith("javax.") + || name.startsWith("sun.") + || name.startsWith("sunw.") + || name.startsWith("org.objectweb.asm.") + ) + return super.loadClass(name, resolve); + + final String className = name.replace('.', '/'); + final boolean inThisPackage = name.startsWith(MAPPEDOBJECT_PACKAGE_PREFIX); + + if ( inThisPackage && ( + name.equals(MappedObjectClassLoader.class.getName()) + || name.equals((MappedObjectTransformer.class.getName())) + || name.equals((CacheUtil.class.getName())) + ) ) + return super.loadClass(name, resolve); + + byte[] bytecode = readStream(this.getResourceAsStream(className.concat(".class"))); + + // Classes in this package do not get transformed, but need to go through here because we have transformed MappedObject. + if ( !(inThisPackage && name.substring(MAPPEDOBJECT_PACKAGE_PREFIX.length()).indexOf('.') == -1) ) { + long t0 = System.nanoTime(); + final byte[] newBytecode = MappedObjectTransformer.transformMappedAPI(className, bytecode); + long t1 = System.nanoTime(); + + total_time_transforming += (t1 - t0); + + if ( bytecode != newBytecode ) { + bytecode = newBytecode; + if ( MappedObjectTransformer.PRINT_ACTIVITY ) + printActivity(className, t0, t1); + } + } + + Class clazz = super.defineClass(name, bytecode, 0, bytecode.length); + if ( resolve ) + resolveClass(clazz); + return clazz; + } + + private static void printActivity(final String className, final long t0, final long t1) { + final StringBuilder msg = new StringBuilder(MappedObjectClassLoader.class.getSimpleName() + ": " + className); + + if ( MappedObjectTransformer.PRINT_TIMING ) + msg.append("\n\ttransforming took " + (t1 - t0) / 1000 + " micros (total: " + (total_time_transforming / 1000 / 1000) + "ms)"); + + LWJGLUtil.log(msg); + } + + private static byte[] readStream(InputStream in) { + byte[] bytecode = new byte[256]; + int len = 0; + try { + while ( true ) { + if ( bytecode.length == len ) + bytecode = copyOf(bytecode, len * 2); + int got = in.read(bytecode, len, bytecode.length - len); + if ( got == -1 ) + break; + len += got; + } + } catch (IOException exc) { + // stop! + } finally { + try { + in.close(); + } catch (IOException exc) { + // ignore... + } + } + return copyOf(bytecode, len); + } + + private static byte[] copyOf(byte[] original, int newLength) { + byte[] copy = new byte[newLength]; + System.arraycopy(original, 0, copy, 0, Math.min(original.length, newLength)); + return copy; + } + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/mapped/MappedObject.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/mapped/MappedObject.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/mapped/MappedObject.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/mapped/MappedObject.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,287 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.util.mapped; + +import org.lwjgl.LWJGLUtil; +import org.lwjgl.MemoryUtil; + +import java.nio.BufferOverflowException; +import java.nio.ByteBuffer; + +/** + * Base superclass of all mapped objects. Classes that require + * data mapping should extend this class and registered with + * {@link MappedObjectTransformer#register(Class)}. + *

        + * Subclasses may only specify the default constructor. Any code + * inside that constructor is optional, but will not run when the + * view is instantiated, see {@link #runViewConstructor()}. + *

        + * Bounds checking may be enabled through a JVM system property: org.lwjgl.util.mapped.Checks=true + * + * @author Riven + */ +public abstract class MappedObject { + + static final boolean CHECKS = LWJGLUtil.getPrivilegedBoolean("org.lwjgl.util.mapped.Checks"); + + protected MappedObject() { + // + } + + /** The mapped object base memory address, in bytes. Read-only. */ + public long baseAddress; + + /** The mapped object view memory address, in bytes. Read-only. */ + public long viewAddress; + + /** The mapped buffer. */ + ByteBuffer preventGC; + + /** + * Holds the value of sizeof of the sub-type of this MappedObject
        + *
        + * The behavior of this (transformed) method does not follow the normal Java behavior.
        + * Vec2.SIZEOF will yield 8 (2 floats)
        + * Vec3.SIZEOF will yield 12 (3 floats)
        + * This (required) notation might cause compiler warnings, which can be suppressed with @SuppressWarnings("static-access").
        + * Using Java 5.0's static-import on this method will break functionality. + */ + public static int SIZEOF = -1; // any method that calls these field will have its call-site modified ('final' per subtype) + + /** + * The mapped object view offset, in elements. Read/write. + * This is a virtual field, used as a convenient getter/setter for {@see viewAddress}. + */ + public int view; + + protected final long getViewAddress(final int view) { + // No call-site modification for this, we override in every subclass instead, + // so that we can use it in MappedForeach. + throw new InternalError("type not registered"); + } + + public final void setViewAddress(final long address) { + if ( CHECKS ) + checkAddress(address); + this.viewAddress = address; + } + + final void checkAddress(final long address) { + final long base = MemoryUtil.getAddress0(preventGC); + final int offset = (int)(address - base); + if ( address < base || preventGC.capacity() < (offset + getSizeof()) ) + throw new IndexOutOfBoundsException(Integer.toString(offset / getSizeof())); + } + + final void checkRange(final int bytes) { + if ( bytes < 0 ) + throw new IllegalArgumentException(); + + if ( preventGC.capacity() < (viewAddress - MemoryUtil.getAddress0(preventGC) + bytes) ) + throw new BufferOverflowException(); + } + + /** The mapped object memory alignment, in bytes. Read-only. */ + /** + * Returns the mapped object memory alignment, in bytes. + * + * @return the memory alignment + */ + public final int getAlign() { + // No call-site modification for this, we override in every subclass instead. + throw new InternalError("type not registered"); + } + + /** + * Returns the mapped object memory sizeof, in bytes. + * + * @return the sizeof value + */ + public final int getSizeof() { + // No call-site modification for this, we override in every subclass instead. + throw new InternalError("type not registered"); + } + + /** + * Returns the number of mapped objects that fit in the mapped buffer. + * + * @return the mapped object capacity + */ + public final int capacity() { + // No call-site modification for this, we override in every subclass instead. + throw new InternalError("type not registered"); + } + + /** + * Creates a MappedObject instance, mapping the memory region of the specified direct ByteBuffer. + *

        + * The behavior of this (transformed) method does not follow the normal Java behavior.
        + * Vec2.map(buffer) will return a mapped Vec2 instance.
        + * Vec3.map(buffer) will return a mapped Vec3 instance.
        + * This (required) notation might cause compiler warnings, which can be suppressed with @SuppressWarnings("static-access").
        + * Using Java 5.0's static-import on this method will break functionality. + */ + @SuppressWarnings("unused") + public static T map(ByteBuffer bb) { + // any method that calls this method will have its call-site modified + throw new InternalError("type not registered"); + } + + /** + * Creates a MappedObject instance, mapping the memory region specified. This is useful for mapping + * arbitrary regions in memory, e.g. OpenCL CLMem objects, without creating a ByteBuffer first. + *

        + * The behavior of this (transformed) method does not follow the normal Java behavior.
        + * Vec2.map(buffer) will return a mapped Vec2 instance.
        + * Vec3.map(buffer) will return a mapped Vec3 instance.
        + * This (required) notation might cause compiler warnings, which can be suppressed with @SuppressWarnings("static-access").
        + * Using Java 5.0's static-import on this method will break functionality. + */ + @SuppressWarnings("unused") + public static T map(long address, int capacity) { + // any method that calls this method will have its call-site modified + throw new InternalError("type not registered"); + } + + /** + * Creates a MappedObject instance, mapping the memory region of an allocated direct ByteBuffer with a capacity of elementCount*SIZEOF + *

        + * The behavior of this (transformed) method does not follow the normal Java behavior.
        + * Vec2.malloc(int) will return a mapped Vec2 instance.
        + * Vec3.malloc(int) will return a mapped Vec3 instance.
        + * This (required) notation might cause compiler warnings, which can be suppressed with @SuppressWarnings("static-access").
        + * Using Java 5.0's static-import on this method will break functionality. + */ + @SuppressWarnings("unused") + public static T malloc(int elementCount) { + // any method that calls this method will have its call-site modified + throw new InternalError("type not registered"); + } + + /** + * Creates an identical new MappedObject instance, comparable to the + * contract of {@link java.nio.ByteBuffer#duplicate}. This is useful when more than one + * views of the mapped object are required at the same time, e.g. in + * multithreaded access. + */ + public final T dup() { + // any method that calls this method will have its call-site modified + throw new InternalError("type not registered"); + } + + /** + * Creates a new MappedObject instance, with a base offset equal to + * the offset of the current view, comparable to the contract of {@link java.nio.ByteBuffer#slice}. + */ + public final T slice() { + // any method that calls this method will have its call-site modified + throw new InternalError("type not registered"); + } + + /** + * Any code in the default constructor will not run automatically. This method + * can be used to execute that code on the current view. + */ + public final void runViewConstructor() { + // any method that calls this method will have its call-site modified + throw new InternalError("type not registered"); + } + + /** Moves the current view to the next element. */ + public final void next() { + // No call-site modification for this, we override in every subclass instead, + // so that we can use it in MappedSetX. + throw new InternalError("type not registered"); + } + + /** + * Copies and amount of SIZEOF - padding bytes, from the current + * mapped object, to the specified mapped object. + */ + @SuppressWarnings("unused") + public final void copyTo(T target) { + // any method that calls this method will have its call-site modified + throw new InternalError("type not registered"); + } + + /** + * Copies and amount of SIZEOF * instances bytes, from the + * current mapped object, to the specified mapped object. Note that + * this includes any padding bytes that are part of SIZEOF. + */ + @SuppressWarnings("unused") + public final void copyRange(T target, int instances) { + // any method that calls this method will have its call-site modified + throw new InternalError("type not registered"); + } + + /** + * Creates an {@link Iterable} that will step through + * capacity() views, leaving the view at + * the last valid value.
        + *

        + * For convenience you are encouraged to static-import this specific method: + * import static org.lwjgl.util.mapped.MappedObject.foreach; + */ + public static Iterable foreach(T mapped) { + return foreach(mapped, mapped.capacity()); + } + + /** + * Creates an {@link Iterable} that will step through + * elementCount views, leaving the view at + * the last valid value.
        + *

        + * For convenience you are encouraged to static-import this specific method: + * import static org.lwjgl.util.mapped.MappedObject.foreach; + */ + public static Iterable foreach(T mapped, int elementCount) { + return new MappedForeach(mapped, elementCount); + } + + @SuppressWarnings("unused") + public final T[] asArray() { + // any method that calls this method will have its call-site modified + throw new InternalError("type not registered"); + } + + /** + * Returns the {@link java.nio.ByteBuffer} that backs this mapped object. + * + * @return the backing buffer + */ + public final ByteBuffer backingByteBuffer() { + return this.preventGC; + } + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/mapped/MappedObjectTransformer.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/mapped/MappedObjectTransformer.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/mapped/MappedObjectTransformer.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/mapped/MappedObjectTransformer.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,1319 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.util.mapped; + +import org.lwjgl.BufferUtils; +import org.lwjgl.LWJGLUtil; +import org.lwjgl.MemoryUtil; +import org.objectweb.asm.*; +import org.objectweb.asm.tree.*; +import org.objectweb.asm.tree.analysis.*; +import org.objectweb.asm.tree.analysis.Frame; +import org.objectweb.asm.util.TraceClassVisitor; + +import java.io.PrintWriter; +import java.io.StringWriter; +import java.lang.reflect.Field; +import java.lang.reflect.Modifier; +import java.nio.Buffer; +import java.nio.ByteBuffer; +import java.util.HashMap; +import java.util.Map; + +import static org.objectweb.asm.ClassWriter.*; +import static org.objectweb.asm.Opcodes.*; + +/** + * This class implements the bytecode transformation that mapped object go through. + * Mapped object classes need to first be registered with the transformer, see {@link #register(Class)}. + *

        + * The transformer supports some debugging tools, enabled through JVM system properties:
        + * org.lwjgl.util.mapped.PrintTiming=true, prints timing information for the transformation step.
        + * org.lwjgl.util.mapped.PrintActivity=true, prints activity information.
        + * org.lwjgl.util.mapped.PrintBytecode=true, prints the transformed bytecode.
        + * org.lwjgl.util.Debug must also be set to true for the above to work. + * + * @author Riven + */ +public class MappedObjectTransformer { + + static final boolean PRINT_ACTIVITY = LWJGLUtil.DEBUG && LWJGLUtil.getPrivilegedBoolean("org.lwjgl.util.mapped.PrintActivity"); + static final boolean PRINT_TIMING = PRINT_ACTIVITY && LWJGLUtil.getPrivilegedBoolean("org.lwjgl.util.mapped.PrintTiming"); + static final boolean PRINT_BYTECODE = LWJGLUtil.DEBUG && LWJGLUtil.getPrivilegedBoolean("org.lwjgl.util.mapped.PrintBytecode"); + + static final Map className_to_subtype; + + static final String MAPPED_OBJECT_JVM = jvmClassName(MappedObject.class); + static final String MAPPED_HELPER_JVM = jvmClassName(MappedHelper.class); + + static final String MAPPEDSET_PREFIX = jvmClassName(MappedSet.class); + static final String MAPPED_SET2_JVM = jvmClassName(MappedSet2.class); + static final String MAPPED_SET3_JVM = jvmClassName(MappedSet3.class); + static final String MAPPED_SET4_JVM = jvmClassName(MappedSet4.class); + + static final String CACHE_LINE_PAD_JVM = "L" + jvmClassName(CacheLinePad.class) + ";"; + + // Public methods + static final String VIEWADDRESS_METHOD_NAME = "getViewAddress"; + static final String NEXT_METHOD_NAME = "next"; + static final String ALIGN_METHOD_NAME = "getAlign"; + static final String SIZEOF_METHOD_NAME = "getSizeof"; + static final String CAPACITY_METHOD_NAME = "capacity"; // Used for .asArray().length + + // Internal methods + static final String VIEW_CONSTRUCTOR_NAME = "constructView$LWJGL"; // Used by runViewConstructor + + static final Map OPCODE_TO_NAME = new HashMap(); + static final Map INSNTYPE_TO_NAME = new HashMap(); + + static boolean is_currently_computing_frames; + + static { + getClassEnums(Opcodes.class, OPCODE_TO_NAME, "V1_", "ACC_", "T_", "F_", "MH_"); + getClassEnums(AbstractInsnNode.class, INSNTYPE_TO_NAME); + + className_to_subtype = new HashMap(); + + { + // HACK: required for mapped.view++ + // + // because the compiler generates: + // => GETFIELD MappedObject.view + // => ICONST_1 + // => IADD + // => PUTFIELD MyMappedType.view + // + // instead of: + // => GETFIELD MyMappedType.view + // => ICONST_1 + // => IADD + // => PUTFIELD MyMappedType.view + // + className_to_subtype.put(MAPPED_OBJECT_JVM, new MappedSubtypeInfo(MAPPED_OBJECT_JVM, null, -1, -1, -1, false)); + } + + final String vmName = System.getProperty("java.vm.name"); + if ( vmName != null && !vmName.contains("Server") ) { + System.err.println("Warning: " + MappedObject.class.getSimpleName() + "s have inferiour performance on Client VMs, please consider switching to a Server VM."); + } + } + + /** + * Registers a class as a mapped object. + * The class must extend {@link org.lwjgl.util.mapped.MappedObject} and be annotated with {@link org.lwjgl.util.mapped.MappedField}. + * + * @param type the mapped object class. + */ + public static void register(Class type) { + if ( MappedObjectClassLoader.FORKED ) + return; + + final MappedType mapped = type.getAnnotation(MappedType.class); + + if ( mapped != null && mapped.padding() < 0 ) + throw new ClassFormatError("Invalid mapped type padding: " + mapped.padding()); + + if ( type.getEnclosingClass() != null && !Modifier.isStatic(type.getModifiers()) ) + throw new InternalError("only top-level or static inner classes are allowed"); + + final String className = jvmClassName(type); + final Map fields = new HashMap(); + + long sizeof = 0; + for ( Field field : type.getDeclaredFields() ) { + FieldInfo fieldInfo = registerField(mapped == null || mapped.autoGenerateOffsets(), className, sizeof, field); + if ( fieldInfo == null ) + continue; + + fields.put(field.getName(), fieldInfo); + + sizeof = Math.max(sizeof, fieldInfo.offset + fieldInfo.lengthPadded); + } + + int align = 4; + int padding = 0; + boolean cacheLinePadded = false; + + if ( mapped != null ) { + align = mapped.align(); + if ( mapped.cacheLinePadding() ) { + if ( mapped.padding() != 0 ) + throw new ClassFormatError("Mapped type padding cannot be specified together with cacheLinePadding."); + + final int cacheLineMod = (int)(sizeof % CacheUtil.getCacheLineSize()); + if ( cacheLineMod != 0 ) + padding = CacheUtil.getCacheLineSize() - cacheLineMod; + + cacheLinePadded = true; + } else + padding = mapped.padding(); + } + + sizeof += padding; + + final MappedSubtypeInfo mappedType = new MappedSubtypeInfo(className, fields, (int)sizeof, align, padding, cacheLinePadded); + if ( className_to_subtype.put(className, mappedType) != null ) + throw new InternalError("duplicate mapped type: " + mappedType.className); + } + + private static FieldInfo registerField(final boolean autoGenerateOffsets, final String className, long advancingOffset, final Field field) { + if ( Modifier.isStatic(field.getModifiers()) ) // static fields are never mapped + return null; + + // we only support primitives and ByteBuffers + if ( !field.getType().isPrimitive() && field.getType() != ByteBuffer.class ) + throw new ClassFormatError("field '" + className + "." + field.getName() + "' not supported: " + field.getType()); + + MappedField meta = field.getAnnotation(MappedField.class); + if ( meta == null && !autoGenerateOffsets ) + throw new ClassFormatError("field '" + className + "." + field.getName() + "' missing annotation " + MappedField.class.getName() + ": " + className); + + Pointer pointer = field.getAnnotation(Pointer.class); + if ( pointer != null && field.getType() != long.class ) + throw new ClassFormatError("The @Pointer annotation can only be used on long fields. @Pointer field found: " + className + "." + field.getName() + ": " + field.getType()); + + if ( Modifier.isVolatile(field.getModifiers()) && (pointer != null || field.getType() == ByteBuffer.class) ) + throw new ClassFormatError("The volatile keyword is not supported for @Pointer or ByteBuffer fields. Volatile field found: " + className + "." + field.getName() + ": " + field.getType()); + + // quick hack + long byteLength; + if ( field.getType() == long.class || field.getType() == double.class ) { + if ( pointer == null ) + byteLength = 8; + else + byteLength = MappedObjectUnsafe.INSTANCE.addressSize(); + } else if ( field.getType() == double.class ) + byteLength = 8; + else if ( field.getType() == int.class || field.getType() == float.class ) + byteLength = 4; + else if ( field.getType() == char.class || field.getType() == short.class ) + byteLength = 2; + else if ( field.getType() == byte.class ) + byteLength = 1; + else if ( field.getType() == ByteBuffer.class ) { + byteLength = meta.byteLength(); + if ( byteLength < 0 ) + throw new IllegalStateException("invalid byte length for mapped ByteBuffer field: " + className + "." + field.getName() + " [length=" + byteLength + "]"); + } else + throw new ClassFormatError(field.getType().getName()); + + if ( field.getType() != ByteBuffer.class && (advancingOffset % byteLength) != 0 ) + throw new IllegalStateException("misaligned mapped type: " + className + "." + field.getName()); + + CacheLinePad pad = field.getAnnotation(CacheLinePad.class); + + long byteOffset = advancingOffset; + if ( meta != null && meta.byteOffset() != -1 ) { + if ( meta.byteOffset() < 0 ) + throw new ClassFormatError("Invalid field byte offset: " + className + "." + field.getName() + " [byteOffset=" + meta.byteOffset() + "]"); + if ( pad != null ) + throw new ClassFormatError("A field byte offset cannot be specified together with cache-line padding: " + className + "." + field.getName()); + + byteOffset = meta.byteOffset(); + } + + long byteLengthPadded = byteLength; + if ( pad != null ) { + // Pad before + if ( pad.before() && byteOffset % CacheUtil.getCacheLineSize() != 0 ) + byteOffset += CacheUtil.getCacheLineSize() - (byteOffset & (CacheUtil.getCacheLineSize() - 1)); + + // Pad after + if ( pad.after() && (byteOffset + byteLength) % CacheUtil.getCacheLineSize() != 0 ) + byteLengthPadded += CacheUtil.getCacheLineSize() - (byteOffset + byteLength) % CacheUtil.getCacheLineSize(); + + assert !pad.before() || (byteOffset % CacheUtil.getCacheLineSize() == 0); + assert !pad.after() || ((byteOffset + byteLengthPadded) % CacheUtil.getCacheLineSize() == 0); + } + + if ( PRINT_ACTIVITY ) + LWJGLUtil.log(MappedObjectTransformer.class.getSimpleName() + ": " + className + "." + field.getName() + " [type=" + field.getType().getSimpleName() + ", offset=" + byteOffset + "]"); + + return new FieldInfo(byteOffset, byteLength, byteLengthPadded, Type.getType(field.getType()), Modifier.isVolatile(field.getModifiers()), pointer != null); + } + + /** Removes final from methods that will be overriden by subclasses. */ + static byte[] transformMappedObject(byte[] bytecode) { + final ClassWriter cw = new ClassWriter(0); + + ClassVisitor cv = new ClassAdapter(cw) { + + private final String[] DEFINALIZE_LIST = { + VIEWADDRESS_METHOD_NAME, + NEXT_METHOD_NAME, + ALIGN_METHOD_NAME, + SIZEOF_METHOD_NAME, + CAPACITY_METHOD_NAME, + }; + + public MethodVisitor visitMethod(int access, final String name, final String desc, final String signature, final String[] exceptions) { + for ( String method : DEFINALIZE_LIST ) { + if ( name.equals(method) ) { + access &= ~ACC_FINAL; + break; + } + } + return super.visitMethod(access, name, desc, signature, exceptions); + } + }; + + new ClassReader(bytecode).accept(cv, 0); + return cw.toByteArray(); + } + + static byte[] transformMappedAPI(final String className, byte[] bytecode) { + final ClassWriter cw = new ClassWriter(COMPUTE_FRAMES) { + + @Override + protected String getCommonSuperClass(String a, String b) { + // HACK: prevent user-code static-initialization-blocks to be executed + if ( is_currently_computing_frames && !a.startsWith("java/") || !b.startsWith("java/") ) + return "java/lang/Object"; + + return super.getCommonSuperClass(a, b); + } + + }; + + final TransformationAdapter ta = new TransformationAdapter(cw, className); + + ClassVisitor cv = ta; + if ( className_to_subtype.containsKey(className) ) // Do a first pass to generate address getters + cv = getMethodGenAdapter(className, cv); + + new ClassReader(bytecode).accept(cv, ClassReader.SKIP_FRAMES); + + if ( !ta.transformed ) + return bytecode; + + bytecode = cw.toByteArray(); + if ( PRINT_BYTECODE ) + printBytecode(bytecode); + + return bytecode; + } + + private static ClassAdapter getMethodGenAdapter(final String className, final ClassVisitor cv) { + return new ClassAdapter(cv) { + + @Override + public void visitEnd() { + final MappedSubtypeInfo mappedSubtype = className_to_subtype.get(className); + + generateViewAddressGetter(); + generateCapacity(); + generateAlignGetter(mappedSubtype); + generateSizeofGetter(); + generateNext(); + + for ( String fieldName : mappedSubtype.fields.keySet() ) { + final FieldInfo field = mappedSubtype.fields.get(fieldName); + + if ( field.type.getDescriptor().length() > 1 ) { // ByteBuffer, getter only + generateByteBufferGetter(fieldName, field); + } else { + generateFieldGetter(fieldName, field); + generateFieldSetter(fieldName, field); + } + } + + super.visitEnd(); + } + + private void generateViewAddressGetter() { + MethodVisitor mv = super.visitMethod(ACC_PUBLIC, VIEWADDRESS_METHOD_NAME, "(I)J", null, null); + mv.visitCode(); + mv.visitVarInsn(ALOAD, 0); + mv.visitFieldInsn(GETFIELD, MAPPED_OBJECT_JVM, "baseAddress", "J"); + mv.visitVarInsn(ILOAD, 1); + mv.visitFieldInsn(GETSTATIC, className, "SIZEOF", "I"); + mv.visitInsn(IMUL); + mv.visitInsn(I2L); + mv.visitInsn(LADD); + if ( MappedObject.CHECKS ) { + mv.visitInsn(DUP2); + mv.visitVarInsn(ALOAD, 0); + mv.visitMethodInsn(INVOKESTATIC, MAPPED_HELPER_JVM, "checkAddress", "(JL" + MAPPED_OBJECT_JVM + ";)V"); + } + mv.visitInsn(LRETURN); + mv.visitMaxs(3, 2); + mv.visitEnd(); + } + + private void generateCapacity() { + // return (backingByteBuffer().capacity() + (int)(MemoryUtil.getAddress0(backingByteBuffer()) - baseAddress)) / SIZEOF; + MethodVisitor mv = super.visitMethod(ACC_PUBLIC, CAPACITY_METHOD_NAME, "()I", null, null); + mv.visitCode(); + mv.visitVarInsn(ALOAD, 0); + mv.visitMethodInsn(INVOKEVIRTUAL, MAPPED_OBJECT_JVM, "backingByteBuffer", "()L" + jvmClassName(ByteBuffer.class) + ";"); + mv.visitInsn(DUP); + mv.visitMethodInsn(INVOKEVIRTUAL, jvmClassName(ByteBuffer.class), "capacity", "()I"); + mv.visitInsn(SWAP); + mv.visitMethodInsn(INVOKESTATIC, jvmClassName(MemoryUtil.class), "getAddress0", "(L" + jvmClassName(Buffer.class) + ";)J"); + mv.visitVarInsn(ALOAD, 0); + mv.visitFieldInsn(GETFIELD, MAPPED_OBJECT_JVM, "baseAddress", "J"); + mv.visitInsn(LSUB); + mv.visitInsn(L2I); + mv.visitInsn(IADD); + mv.visitFieldInsn(GETSTATIC, className, "SIZEOF", "I"); + mv.visitInsn(IDIV); + mv.visitInsn(IRETURN); + mv.visitMaxs(3, 1); + mv.visitEnd(); + } + + private void generateAlignGetter(final MappedSubtypeInfo mappedSubtype) { + MethodVisitor mv = super.visitMethod(ACC_PUBLIC, ALIGN_METHOD_NAME, "()I", null, null); + mv.visitCode(); + visitIntNode(mv, mappedSubtype.sizeof); + mv.visitInsn(IRETURN); + mv.visitMaxs(1, 1); + mv.visitEnd(); + } + + private void generateSizeofGetter() { + MethodVisitor mv = super.visitMethod(ACC_PUBLIC, SIZEOF_METHOD_NAME, "()I", null, null); + mv.visitCode(); + mv.visitFieldInsn(GETSTATIC, className, "SIZEOF", "I"); + mv.visitInsn(IRETURN); + mv.visitMaxs(1, 1); + mv.visitEnd(); + } + + private void generateNext() { + MethodVisitor mv = super.visitMethod(ACC_PUBLIC, NEXT_METHOD_NAME, "()V", null, null); + mv.visitCode(); + mv.visitVarInsn(ALOAD, 0); + mv.visitInsn(DUP); + mv.visitFieldInsn(GETFIELD, MAPPED_OBJECT_JVM, "viewAddress", "J"); + mv.visitFieldInsn(GETSTATIC, className, "SIZEOF", "I"); + mv.visitInsn(I2L); + mv.visitInsn(LADD); + mv.visitMethodInsn(INVOKEVIRTUAL, className, "setViewAddress", "(J)V"); + mv.visitInsn(RETURN); + mv.visitMaxs(3, 1); + mv.visitEnd(); + } + + private void generateByteBufferGetter(final String fieldName, final FieldInfo field) { + MethodVisitor mv = super.visitMethod(ACC_PUBLIC | ACC_STATIC, getterName(fieldName), "(L" + className + ";I)" + field.type.getDescriptor(), null, null); + mv.visitCode(); + mv.visitVarInsn(ALOAD, 0); + mv.visitVarInsn(ILOAD, 1); + mv.visitMethodInsn(INVOKEVIRTUAL, className, VIEWADDRESS_METHOD_NAME, "(I)J"); + visitIntNode(mv, (int)field.offset); + mv.visitInsn(I2L); + mv.visitInsn(LADD); + visitIntNode(mv, (int)field.length); + mv.visitMethodInsn(INVOKESTATIC, MAPPED_HELPER_JVM, "newBuffer", "(JI)L" + jvmClassName(ByteBuffer.class) + ";"); + mv.visitInsn(ARETURN); + mv.visitMaxs(3, 2); + mv.visitEnd(); + } + + private void generateFieldGetter(final String fieldName, final FieldInfo field) { + MethodVisitor mv = super.visitMethod(ACC_PUBLIC | ACC_STATIC, getterName(fieldName), "(L" + className + ";I)" + field.type.getDescriptor(), null, null); + mv.visitCode(); + mv.visitVarInsn(ALOAD, 0); + mv.visitVarInsn(ILOAD, 1); + mv.visitMethodInsn(INVOKEVIRTUAL, className, VIEWADDRESS_METHOD_NAME, "(I)J"); + visitIntNode(mv, (int)field.offset); + mv.visitInsn(I2L); + mv.visitInsn(LADD); + mv.visitMethodInsn(INVOKESTATIC, MAPPED_HELPER_JVM, field.getAccessType() + "get", "(J)" + field.type.getDescriptor()); + mv.visitInsn(field.type.getOpcode(IRETURN)); + mv.visitMaxs(3, 2); + mv.visitEnd(); + } + + private void generateFieldSetter(final String fieldName, final FieldInfo field) { + MethodVisitor mv = super.visitMethod(ACC_PUBLIC | ACC_STATIC, setterName(fieldName), "(L" + className + ";I" + field.type.getDescriptor() + ")V", null, null); + mv.visitCode(); + int load = 0; + switch ( field.type.getSort() ) { + case Type.BOOLEAN: + case Type.CHAR: + case Type.BYTE: + case Type.SHORT: + case Type.INT: + load = ILOAD; + break; + case Type.FLOAT: + load = FLOAD; + break; + case Type.LONG: + load = LLOAD; + break; + case Type.DOUBLE: + load = DLOAD; + break; + } + mv.visitVarInsn(load, 2); + mv.visitVarInsn(ALOAD, 0); + mv.visitVarInsn(ILOAD, 1); + mv.visitMethodInsn(INVOKEVIRTUAL, className, VIEWADDRESS_METHOD_NAME, "(I)J"); + visitIntNode(mv, (int)field.offset); + mv.visitInsn(I2L); + mv.visitInsn(LADD); + mv.visitMethodInsn(INVOKESTATIC, MAPPED_HELPER_JVM, field.getAccessType() + "put", "(" + field.type.getDescriptor() + "J)V"); + mv.visitInsn(RETURN); + mv.visitMaxs(4, 4); + mv.visitEnd(); + } + + }; + } + + private static class TransformationAdapter extends ClassAdapter { + + final String className; + + boolean transformed; + + TransformationAdapter(final ClassVisitor cv, final String className) { + super(cv); + this.className = className; + } + + @Override + public FieldVisitor visitField(final int access, final String name, final String desc, final String signature, final Object value) { + // remove redirected fields + final MappedSubtypeInfo mappedSubtype = className_to_subtype.get(className); + if ( mappedSubtype != null && mappedSubtype.fields.containsKey(name) ) { + if ( PRINT_ACTIVITY ) + LWJGLUtil.log(MappedObjectTransformer.class.getSimpleName() + ": discarding field: " + className + "." + name + ":" + desc); + return null; + } + + if ( (access & ACC_STATIC) == 0 ) { + return new FieldNode(access, name, desc, signature, value) { + public void visitEnd() { + if ( visibleAnnotations == null ) { // early-out + accept(cv); + return; + } + + boolean before = false; + boolean after = false; + int byteLength = 0; + for ( AnnotationNode pad : visibleAnnotations ) { + if ( CACHE_LINE_PAD_JVM.equals(pad.desc) ) { + if ( "J".equals(desc) || "D".equals(desc) ) + byteLength = 8; + else if ( "I".equals(desc) || "F".equals(desc) ) + byteLength = 4; + else if ( "S".equals(desc) || "C".equals(desc) ) + byteLength = 2; + else if ( "B".equals(desc) || "Z".equals(desc) ) + byteLength = 1; + else + throw new ClassFormatError("The @CacheLinePad annotation cannot be used on non-primitive fields: " + className + "." + name); + + transformed = true; + + after = true; + if ( pad.values != null ) { + for ( int i = 0; i < pad.values.size(); i += 2 ) { + final boolean value = pad.values.get(i + 1).equals(Boolean.TRUE); + if ( "before".equals(pad.values.get(i)) ) + before = value; + else + after = value; + } + } + break; + } + } + + /* + We make the fields public to force the JVM to keep the fields in the object. + Instead of using only longs or integers, we use the same type as the original + field. That's because modern JVMs usually reorder fields by type: + longs, then doubles, then integers, then booleans, etc. This way it's more + likely that the padding will work as expected. + */ + + if ( before ) { + final int count = CacheUtil.getCacheLineSize() / byteLength - 1; + for ( int i = count; i >= 1; i-- ) + cv.visitField(access | ACC_PUBLIC | ACC_SYNTHETIC, name + "$PAD_" + i, desc, signature, null); + } + + accept(cv); + + if ( after ) { + final int count = CacheUtil.getCacheLineSize() / byteLength - 1; + for ( int i = 1; i <= count; i++ ) + cv.visitField(access | ACC_PUBLIC | ACC_SYNTHETIC, name + "$PAD" + i, desc, signature, null); + } + } + }; + } else + return super.visitField(access, name, desc, signature, value); + } + + @Override + public MethodVisitor visitMethod(final int access, String name, final String desc, final String signature, final String[] exceptions) { + // Move MappedSubtype constructors to another method + if ( "".equals(name) ) { + final MappedSubtypeInfo mappedSubtype = className_to_subtype.get(className); + if ( mappedSubtype != null ) { + if ( !"()V".equals(desc) ) + throw new ClassFormatError(className + " can only have a default constructor, found: " + desc); + + final MethodVisitor mv = super.visitMethod(access, name, desc, signature, exceptions); + mv.visitVarInsn(ALOAD, 0); + mv.visitMethodInsn(INVOKESPECIAL, MAPPED_OBJECT_JVM, "", "()V"); + mv.visitInsn(RETURN); + mv.visitMaxs(0, 0); + + // put the method body in another method + name = VIEW_CONSTRUCTOR_NAME; + } + } + + final MethodVisitor mv = super.visitMethod(access, name, desc, signature, exceptions); + return new MethodNode(access, name, desc, signature, exceptions) { + + /** When true, the method has touched a mapped object and needs to be transformed. We track this + * so we can skip the expensive frame analysis and tree API usage. */ + boolean needsTransformation; + + @Override + public void visitMaxs(int a, int b) { + try { + is_currently_computing_frames = true; + super.visitMaxs(a, b); + } finally { + is_currently_computing_frames = false; + } + } + + @Override + public void visitFieldInsn(final int opcode, final String owner, final String name, final String desc) { + if ( className_to_subtype.containsKey(owner) || owner.startsWith(MAPPEDSET_PREFIX) ) + needsTransformation = true; + + super.visitFieldInsn(opcode, owner, name, desc); + } + + @Override + public void visitMethodInsn(final int opcode, final String owner, final String name, final String desc) { + if ( className_to_subtype.containsKey(owner) ) + needsTransformation = true; + + super.visitMethodInsn(opcode, owner, name, desc); + } + + @Override + public void visitEnd() { + if ( needsTransformation ) { // Early-out for methods that do not touch a mapped object. + //System.err.println("\nTRANSFORMING: " + className + "." + name + desc); + transformed = true; + try { + transformMethod(analyse()); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + // Pass the instruction stream to the adapter's MethodVisitor + accept(mv); + } + + private Frame[] analyse() throws AnalyzerException { + final Analyzer a = new Analyzer(new SimpleVerifier()); + a.analyze(className, this); + return a.getFrames(); + } + + private void transformMethod(final Frame[] frames) { + final InsnList instructions = this.instructions; + + final Map arrayVars = new HashMap(); + + /* + We need this map because we insert/remove instructions from the stream and we need a way + to match each original instruction with the corresponding frame. + TODO: Can we keep track of everything more efficiently without a map? + */ + final Map> frameMap = new HashMap>(); + for ( int i = 0; i < frames.length; i++ ) + frameMap.put(instructions.get(i), frames[i]); + + for ( int i = 0; i < instructions.size(); i++ ) { // f is a separate cursor for frames + final AbstractInsnNode instruction = instructions.get(i); + + //System.out.println("MAIN LOOP #" + i + " - " + getOpcodeName(instruction)); + + switch ( instruction.getType() ) { + case AbstractInsnNode.VAR_INSN: + if ( instruction.getOpcode() == ALOAD ) { + VarInsnNode varInsn = (VarInsnNode)instruction; + final MappedSubtypeInfo mappedSubtype = arrayVars.get(varInsn.var); + if ( mappedSubtype != null ) + i = transformArrayAccess(instructions, i, frameMap, varInsn, mappedSubtype, varInsn.var); + } + break; + case AbstractInsnNode.FIELD_INSN: + FieldInsnNode fieldInsn = (FieldInsnNode)instruction; + + final InsnList list = transformFieldAccess(fieldInsn); + if ( list != null ) + i = replace(instructions, i, instruction, list); + + break; + case AbstractInsnNode.METHOD_INSN: + MethodInsnNode methodInsn = (MethodInsnNode)instruction; + final MappedSubtypeInfo mappedType = className_to_subtype.get(methodInsn.owner); + if ( mappedType != null ) + i = transformMethodCall(instructions, i, frameMap, methodInsn, mappedType, arrayVars); + break; + } + } + } + }; + } + } + + static int transformMethodCall(final InsnList instructions, int i, final Map> frameMap, final MethodInsnNode methodInsn, final MappedSubtypeInfo mappedType, final Map arrayVars) { + switch ( methodInsn.getOpcode() ) { + case INVOKEVIRTUAL: + if ( "asArray".equals(methodInsn.name) && methodInsn.desc.equals("()[L" + MAPPED_OBJECT_JVM + ";") ) { + // Go forward and store the local variable index. + // We only allow this pattern: INVOKEVIRTUAL -> CHECKCAST -> ASTORE. + // We remove the first two and store the target MappedSubtype in the ASTORE variable + AbstractInsnNode nextInstruction; + checkInsnAfterIsArray(nextInstruction = methodInsn.getNext(), CHECKCAST); + checkInsnAfterIsArray(nextInstruction = nextInstruction.getNext(), ASTORE); + + final Frame frame = frameMap.get(nextInstruction); + final String targetType = frame.getStack(frame.getStackSize() - 1).getType().getElementType().getInternalName(); + if ( !methodInsn.owner.equals(targetType) ) { + /* + This may happen with the current API, like so: + MappedA foo = MappedA.malloc(...); + MappedB[] cursor = foo.asArray(); + We have to parameterize MappedObject to avoid this. + */ + throw new ClassCastException("Source: " + methodInsn.owner + " - Target: " + targetType); + } + + final VarInsnNode varInstruction = (VarInsnNode)nextInstruction; + + arrayVars.put(varInstruction.var, mappedType); + + instructions.remove(methodInsn.getNext()); // Remove CHECKCAST + instructions.remove(methodInsn); // Remove INVOKEVIRTUAL + } + + if ( "dup".equals(methodInsn.name) && methodInsn.desc.equals("()L" + MAPPED_OBJECT_JVM + ";") ) { + i = replace(instructions, i, methodInsn, generateDupInstructions(methodInsn)); + break; + } + + if ( "slice".equals(methodInsn.name) && methodInsn.desc.equals("()L" + MAPPED_OBJECT_JVM + ";") ) { + i = replace(instructions, i, methodInsn, generateSliceInstructions(methodInsn)); + break; + } + + if ( "runViewConstructor".equals(methodInsn.name) && "()V".equals(methodInsn.desc) ) { + i = replace(instructions, i, methodInsn, generateRunViewConstructorInstructions(methodInsn)); + break; + } + + if ( "copyTo".equals(methodInsn.name) && methodInsn.desc.equals("(L" + MAPPED_OBJECT_JVM + ";)V") ) { + i = replace(instructions, i, methodInsn, generateCopyToInstructions(mappedType)); + break; + } + + if ( "copyRange".equals(methodInsn.name) && methodInsn.desc.equals("(L" + MAPPED_OBJECT_JVM + ";I)V") ) { + i = replace(instructions, i, methodInsn, generateCopyRangeInstructions(mappedType)); + break; + } + + break; + case INVOKESPECIAL: + // super() in VIEW_CONSTRUCTOR_NAME, remove + if ( methodInsn.owner.equals(MAPPED_OBJECT_JVM) && "".equals(methodInsn.name) && "()V".equals(methodInsn.desc) ) { + instructions.remove(methodInsn.getPrevious()); // ALOAD + instructions.remove(methodInsn); // INVOKESPECIAL + + i -= 2; + } + break; + case INVOKESTATIC: + boolean isMapDirectMethod = "map".equals(methodInsn.name) && methodInsn.desc.equals("(JI)L" + MAPPED_OBJECT_JVM + ";"); + boolean isMapBufferMethod = "map".equals(methodInsn.name) && methodInsn.desc.equals("(Ljava/nio/ByteBuffer;)L" + MAPPED_OBJECT_JVM + ";"); + boolean isMallocMethod = "malloc".equals(methodInsn.name) && methodInsn.desc.equals("(I)L" + MAPPED_OBJECT_JVM + ";"); + + if ( (isMapDirectMethod || isMapBufferMethod) || isMallocMethod ) + i = replace(instructions, i, methodInsn, generateMapInstructions(mappedType, methodInsn.owner, isMapDirectMethod, isMallocMethod)); + break; + } + + return i; + } + + private static InsnList generateCopyRangeInstructions(final MappedSubtypeInfo mappedType) { + final InsnList list = new InsnList(); + + // stack: instances, target, this + list.add(getIntNode(mappedType.sizeof)); + // stack: sizeof, instances, target, this + list.add(new InsnNode(IMUL)); + // stack: bytes, target, this + list.add(new MethodInsnNode(INVOKESTATIC, MAPPED_HELPER_JVM, "copy", "(L" + MAPPED_OBJECT_JVM + ";L" + MAPPED_OBJECT_JVM + ";I)V")); + // stack: - + + return list; + } + + private static InsnList generateCopyToInstructions(final MappedSubtypeInfo mappedType) { + final InsnList list = new InsnList(); + + // stack: target, this + list.add(getIntNode(mappedType.sizeof - mappedType.padding)); + // stack: sizeof, target, this + list.add(new MethodInsnNode(INVOKESTATIC, MAPPED_HELPER_JVM, "copy", "(L" + MAPPED_OBJECT_JVM + ";L" + MAPPED_OBJECT_JVM + ";I)V")); + // stack: - + + return list; + } + + private static InsnList generateRunViewConstructorInstructions(final MethodInsnNode methodInsn) { + final InsnList list = new InsnList(); + + // stack: this + list.add(new InsnNode(DUP)); + // stack: this, this + list.add(new MethodInsnNode(INVOKEVIRTUAL, methodInsn.owner, VIEW_CONSTRUCTOR_NAME, "()V")); + // stack: this + + return list; + } + + private static InsnList generateSliceInstructions(final MethodInsnNode methodInsn) { + final InsnList list = new InsnList(); + + // stack: this + list.add(new TypeInsnNode(NEW, methodInsn.owner)); + // stack: new, this + list.add(new InsnNode(DUP)); + // stack: new, new, this + list.add(new MethodInsnNode(INVOKESPECIAL, methodInsn.owner, "", "()V")); + // stack: new, this + list.add(new MethodInsnNode(INVOKESTATIC, MAPPED_HELPER_JVM, "slice", "(L" + MAPPED_OBJECT_JVM + ";L" + MAPPED_OBJECT_JVM + ";)L" + MAPPED_OBJECT_JVM + ";")); + // stack: new + + return list; + } + + private static InsnList generateDupInstructions(final MethodInsnNode methodInsn) { + final InsnList list = new InsnList(); + + // stack: this + list.add(new TypeInsnNode(NEW, methodInsn.owner)); + // stack: new, this + list.add(new InsnNode(DUP)); + // stack: new, new, this + list.add(new MethodInsnNode(INVOKESPECIAL, methodInsn.owner, "", "()V")); + // stack: new, this + list.add(new MethodInsnNode(INVOKESTATIC, MAPPED_HELPER_JVM, "dup", "(L" + MAPPED_OBJECT_JVM + ";L" + MAPPED_OBJECT_JVM + ";)L" + MAPPED_OBJECT_JVM + ";")); + // stack: new + + return list; + } + + private static InsnList generateMapInstructions(final MappedSubtypeInfo mappedType, final String className, final boolean mapDirectMethod, final boolean mallocMethod) { + final InsnList trg = new InsnList(); + + if ( mallocMethod ) { + // stack: count + trg.add(getIntNode(mappedType.sizeof)); + // stack: sizeof, count + trg.add(new InsnNode(IMUL)); + // stack: bytes + trg.add(new MethodInsnNode(INVOKESTATIC, mappedType.cacheLinePadded ? jvmClassName(CacheUtil.class) : jvmClassName(BufferUtils.class), "createByteBuffer", "(I)L" + jvmClassName(ByteBuffer.class) + ";")); + // stack: buffer + } else if ( mapDirectMethod ) { + // stack: capacity, address + trg.add(new MethodInsnNode(INVOKESTATIC, MAPPED_HELPER_JVM, "newBuffer", "(JI)L" + jvmClassName(ByteBuffer.class) + ";")); + // stack: buffer + } + + // stack: buffer + trg.add(new TypeInsnNode(NEW, className)); + // stack: new, buffer + trg.add(new InsnNode(DUP)); + // stack: new, new, buffer + trg.add(new MethodInsnNode(INVOKESPECIAL, className, "", "()V")); + // stack: new, buffer + trg.add(new InsnNode(DUP_X1)); + // stack: new, buffer, new + trg.add(new InsnNode(SWAP)); + // stack: buffer, new, new + trg.add(getIntNode(mappedType.align)); + // stack: int, buffer, new, new + trg.add(getIntNode(mappedType.sizeof)); + // stack: int, int, buffer, new, new + trg.add(new MethodInsnNode(INVOKESTATIC, MAPPED_HELPER_JVM, "setup", "(L" + MAPPED_OBJECT_JVM + ";Ljava/nio/ByteBuffer;II)V")); + // stack: new + + return trg; + } + + static InsnList transformFieldAccess(final FieldInsnNode fieldInsn) { + final MappedSubtypeInfo mappedSubtype; + mappedSubtype = className_to_subtype.get(fieldInsn.owner); + if ( mappedSubtype == null ) { // early out + // MappedSet.view + outer: + if ( "view".equals(fieldInsn.name) && fieldInsn.owner.startsWith(MAPPEDSET_PREFIX) ) + return generateSetViewInstructions(fieldInsn); + + return null; // early out + } + + if ( "SIZEOF".equals(fieldInsn.name) ) + return generateSIZEOFInstructions(fieldInsn, mappedSubtype); + + if ( "view".equals(fieldInsn.name) ) + return generateViewInstructions(fieldInsn, mappedSubtype); + + if ( "baseAddress".equals(fieldInsn.name) || "viewAddress".equals(fieldInsn.name) ) { + return generateAddressInstructions(fieldInsn); + } + + final FieldInfo field = mappedSubtype.fields.get(fieldInsn.name); + if ( field == null ) // early out + return null; + + // now we're going to transform ByteBuffer-typed field access + if ( fieldInsn.desc.equals("L" + jvmClassName(ByteBuffer.class) + ";") ) + return generateByteBufferInstructions(fieldInsn, mappedSubtype, field.offset); + + // we're now going to transform the field access + return generateFieldInstructions(fieldInsn, field); + } + + private static InsnList generateSetViewInstructions(final FieldInsnNode fieldInsn) { + if ( fieldInsn.getOpcode() == GETFIELD ) + throwAccessErrorOnReadOnlyField(fieldInsn.owner, fieldInsn.name); + if ( fieldInsn.getOpcode() != PUTFIELD ) + throw new InternalError(); + + final InsnList list = new InsnList(); + + // stack: index, this + if ( MAPPED_SET2_JVM.equals(fieldInsn.owner) ) + list.add(new MethodInsnNode(INVOKESTATIC, MAPPED_HELPER_JVM, "put_views", "(L" + MAPPED_SET2_JVM + ";I)V")); + else if ( MAPPED_SET3_JVM.equals(fieldInsn.owner) ) + list.add(new MethodInsnNode(INVOKESTATIC, MAPPED_HELPER_JVM, "put_views", "(L" + MAPPED_SET3_JVM + ";I)V")); + else if ( MAPPED_SET4_JVM.equals(fieldInsn.owner) ) + list.add(new MethodInsnNode(INVOKESTATIC, MAPPED_HELPER_JVM, "put_views", "(L" + MAPPED_SET4_JVM + ";I)V")); + else + throw new InternalError(); + // stack: - + + return list; + } + + private static InsnList generateSIZEOFInstructions(final FieldInsnNode fieldInsn, final MappedSubtypeInfo mappedSubtype) { + if ( !"I".equals(fieldInsn.desc) ) + throw new InternalError(); + + final InsnList list = new InsnList(); + + if ( fieldInsn.getOpcode() == GETSTATIC ) { + list.add(getIntNode(mappedSubtype.sizeof)); + return list; + } + + if ( fieldInsn.getOpcode() == PUTSTATIC ) + throwAccessErrorOnReadOnlyField(fieldInsn.owner, fieldInsn.name); + + throw new InternalError(); + } + + private static InsnList generateViewInstructions(final FieldInsnNode fieldInsn, final MappedSubtypeInfo mappedSubtype) { + if ( !"I".equals(fieldInsn.desc) ) + throw new InternalError(); + + final InsnList list = new InsnList(); + + if ( fieldInsn.getOpcode() == GETFIELD ) { + if ( mappedSubtype.sizeof_shift != 0 ) { + // stack: instance + list.add(getIntNode(mappedSubtype.sizeof_shift)); + // stack: sizeof, instance + list.add(new MethodInsnNode(INVOKESTATIC, MAPPED_HELPER_JVM, "get_view_shift", "(L" + MAPPED_OBJECT_JVM + ";I)I")); + // stack: view + } else { + // stack: instance + list.add(getIntNode(mappedSubtype.sizeof)); + // stack: sizeof, instance + list.add(new MethodInsnNode(INVOKESTATIC, MAPPED_HELPER_JVM, "get_view", "(L" + MAPPED_OBJECT_JVM + ";I)I")); + // stack: view + } + return list; + } + + if ( fieldInsn.getOpcode() == PUTFIELD ) { + if ( mappedSubtype.sizeof_shift != 0 ) { + // stack: view, instance + list.add(getIntNode(mappedSubtype.sizeof_shift)); + // stack: sizeof, view, instance + list.add(new MethodInsnNode(INVOKESTATIC, MAPPED_HELPER_JVM, "put_view_shift", "(L" + MAPPED_OBJECT_JVM + ";II)V")); + // stack: - + } else { + // stack: view, instance + list.add(getIntNode(mappedSubtype.sizeof)); + // stack: sizeof, view, instance + list.add(new MethodInsnNode(INVOKESTATIC, MAPPED_HELPER_JVM, "put_view", "(L" + MAPPED_OBJECT_JVM + ";II)V")); + // stack: - + } + return list; + } + + throw new InternalError(); + } + + private static InsnList generateAddressInstructions(final FieldInsnNode fieldInsn) { + if ( !"J".equals(fieldInsn.desc) ) + throw new IllegalStateException(); + + if ( fieldInsn.getOpcode() == GETFIELD ) // do not change a thing + return null; + + if ( fieldInsn.getOpcode() == PUTFIELD ) + throwAccessErrorOnReadOnlyField(fieldInsn.owner, fieldInsn.name); + + throw new InternalError(); + } + + private static InsnList generateByteBufferInstructions(final FieldInsnNode fieldInsn, final MappedSubtypeInfo mappedSubtype, final long fieldOffset) { + if ( fieldInsn.getOpcode() == PUTFIELD ) + throwAccessErrorOnReadOnlyField(fieldInsn.owner, fieldInsn.name); + + if ( fieldInsn.getOpcode() == GETFIELD ) { + final InsnList list = new InsnList(); + + // stack: ref + list.add(new FieldInsnNode(GETFIELD, mappedSubtype.className, "viewAddress", "J")); + // stack: long + list.add(new LdcInsnNode(fieldOffset)); + // stack: long, long + list.add(new InsnNode(LADD)); + // stack: long + list.add(new LdcInsnNode(mappedSubtype.fields.get(fieldInsn.name).length)); + // stack: long, long + list.add(new InsnNode(L2I)); + // stack: int, long + list.add(new MethodInsnNode(INVOKESTATIC, MAPPED_HELPER_JVM, "newBuffer", "(JI)L" + jvmClassName(ByteBuffer.class) + ";")); + // stack: buffer + + return list; + } + + throw new InternalError(); + } + + private static InsnList generateFieldInstructions(final FieldInsnNode fieldInsn, final FieldInfo field) { + final InsnList list = new InsnList(); + + if ( fieldInsn.getOpcode() == PUTFIELD ) { + // stack: value, ref + list.add(getIntNode((int)field.offset)); + // stack: fieldOffset, value, ref + list.add(new MethodInsnNode(INVOKESTATIC, MAPPED_HELPER_JVM, field.getAccessType() + "put", "(L" + MAPPED_OBJECT_JVM + ";" + fieldInsn.desc + "I)V")); + // stack - + return list; + } + + if ( fieldInsn.getOpcode() == GETFIELD ) { + // stack: ref + list.add(getIntNode((int)field.offset)); + // stack: fieldOffset, ref + list.add(new MethodInsnNode(INVOKESTATIC, MAPPED_HELPER_JVM, field.getAccessType() + "get", "(L" + MAPPED_OBJECT_JVM + ";I)" + fieldInsn.desc)); + // stack: - + return list; + } + + throw new InternalError(); + } + + static int transformArrayAccess(final InsnList instructions, int i, final Map> frameMap, final VarInsnNode loadInsn, final MappedSubtypeInfo mappedSubtype, final int var) { + // We need to go forward in time to find how we use the array var + final int loadStackSize = frameMap.get(loadInsn).getStackSize() + 1; + + AbstractInsnNode nextInsn = loadInsn; + + while ( true ) { + nextInsn = nextInsn.getNext(); + if ( nextInsn == null ) + throw new InternalError(); + + Frame frame = frameMap.get(nextInsn); + if ( frame == null ) + continue; + + int stackSize = frame.getStackSize(); + + if ( stackSize == loadStackSize + 1 && nextInsn.getOpcode() == AALOAD ) { + final AbstractInsnNode aaLoadInsn = nextInsn; + + while ( true ) { + nextInsn = nextInsn.getNext(); + if ( nextInsn == null ) + break; + + frame = frameMap.get(nextInsn); + if ( frame == null ) + continue; + stackSize = frame.getStackSize(); + + if ( stackSize == loadStackSize + 1 && nextInsn.getOpcode() == PUTFIELD ) { + final FieldInsnNode fieldInsn = (FieldInsnNode)nextInsn; + + // stack: value, view, ref + instructions.insert(nextInsn, new MethodInsnNode(INVOKESTATIC, mappedSubtype.className, setterName(fieldInsn.name), "(L" + mappedSubtype.className + ";I" + fieldInsn.desc + ")V")); + // stack: - + instructions.remove(nextInsn); + + break; + } else if ( stackSize == loadStackSize && nextInsn.getOpcode() == GETFIELD ) { + final FieldInsnNode fieldInsn = (FieldInsnNode)nextInsn; + + // stack: view, ref + instructions.insert(nextInsn, new MethodInsnNode(INVOKESTATIC, mappedSubtype.className, getterName(fieldInsn.name), "(L" + mappedSubtype.className + ";I)" + fieldInsn.desc)); + // stack: value + instructions.remove(nextInsn); + + break; + } else if ( stackSize == loadStackSize && nextInsn.getOpcode() == DUP && nextInsn.getNext().getOpcode() == GETFIELD ) { + // May happen with operator+assignment (e.g. cursor[i].value += 10) + final FieldInsnNode fieldInsn = (FieldInsnNode)nextInsn.getNext(); + + final MethodInsnNode getter = new MethodInsnNode(INVOKESTATIC, mappedSubtype.className, getterName(fieldInsn.name), "(L" + mappedSubtype.className + ";I)" + fieldInsn.desc); + + // stack: view, ref + instructions.insert(nextInsn, new InsnNode(DUP2)); + // stack: view, ref, view, ref + instructions.insert(nextInsn.getNext(), getter); + // stack: value, view, ref + + instructions.remove(nextInsn); + instructions.remove(fieldInsn); + + nextInsn = getter; + continue; + } else if ( stackSize < loadStackSize ) + throw new ClassFormatError("Invalid " + mappedSubtype.className + " view array usage detected: " + getOpcodeName(nextInsn)); + } + + instructions.remove(aaLoadInsn); + + return i; + } else if ( stackSize == loadStackSize && nextInsn.getOpcode() == ARRAYLENGTH ) { + if ( LWJGLUtil.DEBUG && loadInsn.getNext() != nextInsn ) + throw new InternalError(); + + instructions.remove(nextInsn); + loadInsn.var = var; + instructions.insert(loadInsn, new MethodInsnNode(INVOKEVIRTUAL, mappedSubtype.className, CAPACITY_METHOD_NAME, "()I")); + + return i + 1; + } else if ( stackSize < loadStackSize ) // Consumed by something other than AALOAD or ARRAYLENGTH + throw new ClassFormatError("Invalid " + mappedSubtype.className + " view array usage detected: " + getOpcodeName(nextInsn)); + } + } + + private static class FieldInfo { + + final long offset; + final long length; + final long lengthPadded; + final Type type; + final boolean isVolatile; + final boolean isPointer; + + FieldInfo(final long offset, final long length, final long lengthPadded, final Type type, final boolean isVolatile, final boolean isPointer) { + this.offset = offset; + this.length = length; + this.lengthPadded = lengthPadded; + this.type = type; + this.isVolatile = isVolatile; + this.isPointer = isPointer; + } + + String getAccessType() { + return isPointer ? "a" : type.getDescriptor().toLowerCase() + (isVolatile ? "v" : ""); + } + + } + + private static class MappedSubtypeInfo { + + final String className; + + final int sizeof; + final int sizeof_shift; + final int align; + final int padding; + final boolean cacheLinePadded; + + final Map fields; + + MappedSubtypeInfo(String className, Map fields, int sizeof, int align, int padding, final boolean cacheLinePadded) { + this.className = className; + + this.sizeof = sizeof; + if ( ((sizeof - 1) & sizeof) == 0 ) + this.sizeof_shift = getPoT(sizeof); + else + this.sizeof_shift = 0; + this.align = align; + this.padding = padding; + this.cacheLinePadded = cacheLinePadded; + + this.fields = fields; + } + + private static int getPoT(int value) { + int pot = -1; + while ( value > 0 ) { + pot++; + value >>= 1; + } + return pot; + } + + } + + // ------------------------------------------------------- + // -------------------[ MACROS & UTILS ]------------------ + // ------------------------------------------------------- + + private static void getClassEnums(final Class clazz, final Map map, final String... prefixFilters) { + try { + OUTER: + for ( Field field : clazz.getFields() ) { + if ( !Modifier.isStatic(field.getModifiers()) || field.getType() != int.class ) + continue; + + for ( String filter : prefixFilters ) { + if ( field.getName().startsWith(filter) ) + continue OUTER; + } + + if ( map.put((Integer)field.get(null), field.getName()) != null ) + throw new IllegalStateException(); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + static String getOpcodeName(final AbstractInsnNode insn) { + final String op = OPCODE_TO_NAME.get(insn.getOpcode()); + return INSNTYPE_TO_NAME.get(insn.getType()) + ": " + insn.getOpcode() + (op == null ? "" : " [" + OPCODE_TO_NAME.get(insn.getOpcode()) + "]"); + } + + static String jvmClassName(Class type) { + return type.getName().replace('.', '/'); + } + + static String getterName(final String fieldName) { + return "get$" + Character.toUpperCase(fieldName.charAt(0)) + fieldName.substring(1) + "$LWJGL"; + } + + static String setterName(final String fieldName) { + return "set$" + Character.toUpperCase(fieldName.charAt(0)) + fieldName.substring(1) + "$LWJGL"; + } + + private static void checkInsnAfterIsArray(final AbstractInsnNode instruction, final int opcode) { + if ( instruction == null ) + throw new ClassFormatError("Unexpected end of instructions after .asArray() method."); + + if ( instruction.getOpcode() != opcode ) + throw new ClassFormatError("The result of .asArray() must be stored to a local variable. Found: " + getOpcodeName(instruction)); + } + + static AbstractInsnNode getIntNode(final int value) { + if ( value <= 5 && -1 <= value ) + return new InsnNode(ICONST_M1 + value + 1); + + if ( value >= Byte.MIN_VALUE && value <= Byte.MAX_VALUE ) + return new IntInsnNode(BIPUSH, value); + + if ( value >= Short.MIN_VALUE && value <= Short.MAX_VALUE ) + return new IntInsnNode(SIPUSH, value); + + return new LdcInsnNode(value); + } + + static void visitIntNode(final MethodVisitor mv, final int value) { + if ( value <= 5 && -1 <= value ) + mv.visitInsn(ICONST_M1 + value + 1); + else if ( value >= Byte.MIN_VALUE && value <= Byte.MAX_VALUE ) + mv.visitIntInsn(BIPUSH, value); + else if ( value >= Short.MIN_VALUE && value <= Short.MAX_VALUE ) + mv.visitIntInsn(SIPUSH, value); + else + mv.visitLdcInsn(value); + } + + /** Replace an instruction with a list of instructions. */ + static int replace(final InsnList instructions, final int i, final AbstractInsnNode location, final InsnList list) { + final int size = list.size(); + + instructions.insert(location, list); + instructions.remove(location); + + return i + (size - 1); + } + + private static void throwAccessErrorOnReadOnlyField(String className, String fieldName) { + throw new IllegalAccessError("The " + className + "." + fieldName + " field is final."); + } + + private static void printBytecode(byte[] bytecode) { + StringWriter sw = new StringWriter(); + ClassVisitor tracer = new TraceClassVisitor(new ClassWriter(0), new PrintWriter(sw)); + new ClassReader(bytecode).accept(tracer, 0); + String dump = sw.toString(); + + LWJGLUtil.log(dump); + } + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/mapped/MappedObjectUnsafe.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/mapped/MappedObjectUnsafe.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/mapped/MappedObjectUnsafe.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/mapped/MappedObjectUnsafe.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,110 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.util.mapped; + +import java.lang.reflect.Field; +import java.lang.reflect.Modifier; +import java.nio.ByteBuffer; +import java.nio.ByteOrder; + +import sun.misc.Unsafe; + +/** + * [INTERNAL USE ONLY] + * + * @author Riven + */ +final class MappedObjectUnsafe { + + static final Unsafe INSTANCE = getUnsafeInstance(); + + private static final long BUFFER_ADDRESS_OFFSET = getObjectFieldOffset(ByteBuffer.class, "address"); + private static final long BUFFER_CAPACITY_OFFSET = getObjectFieldOffset(ByteBuffer.class, "capacity"); + + private static final ByteBuffer global = ByteBuffer.allocateDirect(4 * 1024); + + static ByteBuffer newBuffer(long address, int capacity) { + if ( address <= 0L || capacity < 0 ) + throw new IllegalStateException("you almost crashed the jvm"); + + ByteBuffer buffer = global.duplicate().order(ByteOrder.nativeOrder()); + INSTANCE.putLong(buffer, BUFFER_ADDRESS_OFFSET, address); + INSTANCE.putInt(buffer, BUFFER_CAPACITY_OFFSET, capacity); + buffer.position(0); + buffer.limit(capacity); + return buffer; + } + + private static long getObjectFieldOffset(Class type, String fieldName) { + while ( type != null ) { + try { + return INSTANCE.objectFieldOffset(type.getDeclaredField(fieldName)); + } catch (Throwable t) { + type = type.getSuperclass(); + } + } + + throw new UnsupportedOperationException(); + } + + private static Unsafe getUnsafeInstance() { + final Field[] fields = Unsafe.class.getDeclaredFields(); + + /* + Different runtimes use different names for the Unsafe singleton, + so we cannot use .getDeclaredField and we scan instead. For example: + + Oracle: theUnsafe + PERC : m_unsafe_instance + Android: THE_ONE + */ + for ( Field field : fields ) { + if ( !field.getType().equals(Unsafe.class) ) + continue; + + final int modifiers = field.getModifiers(); + if ( !(Modifier.isStatic(modifiers) && Modifier.isFinal(modifiers)) ) + continue; + + field.setAccessible(true); + try { + return (Unsafe)field.get(null); + } catch (IllegalAccessException e) { + // ignore + } + break; + } + + throw new UnsupportedOperationException(); + } + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/mapped/MappedSet2.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/mapped/MappedSet2.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/mapped/MappedSet2.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/mapped/MappedSet2.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.util.mapped; + +/** MappedSet implementation for two MappedObjects. */ +public class MappedSet2 { + + private final MappedObject a, b; + + MappedSet2(MappedObject a, MappedObject b) { + this.a = a; + this.b = b; + } + + public int view; + + void view(int view) { + a.setViewAddress(a.getViewAddress(view)); + b.setViewAddress(b.getViewAddress(view)); + } + + public void next() { + this.a.next(); + this.b.next(); + } + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/mapped/MappedSet3.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/mapped/MappedSet3.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/mapped/MappedSet3.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/mapped/MappedSet3.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.util.mapped; + +/** MappedSet implementation for three MappedObjects. */ +public class MappedSet3 { + + private final MappedObject a, b, c; + + MappedSet3(MappedObject a, MappedObject b, MappedObject c) { + this.a = a; + this.b = b; + this.c = c; + } + + public int view; + + void view(int view) { + a.setViewAddress(a.getViewAddress(view)); + b.setViewAddress(b.getViewAddress(view)); + c.setViewAddress(c.getViewAddress(view)); + } + + public void next() { + this.a.next(); + this.b.next(); + this.c.next(); + } + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/mapped/MappedSet4.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/mapped/MappedSet4.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/mapped/MappedSet4.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/mapped/MappedSet4.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.util.mapped; + +/** MappedSet implementation for four MappedObjects. */ +public class MappedSet4 { + + private final MappedObject a, b, c, d; + + MappedSet4(MappedObject a, MappedObject b, MappedObject c, MappedObject d) { + this.a = a; + this.b = b; + this.c = c; + this.d = d; + } + + public int view; + + void view(int view) { + a.setViewAddress(a.getViewAddress(view)); + b.setViewAddress(b.getViewAddress(view)); + c.setViewAddress(c.getViewAddress(view)); + d.setViewAddress(d.getViewAddress(view)); + } + + public void next() { + this.a.next(); + this.b.next(); + this.c.next(); + this.d.next(); + } +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/mapped/MappedSet.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/mapped/MappedSet.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/mapped/MappedSet.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/mapped/MappedSet.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.util.mapped; + +/** + * Factory for mapped sets. A mapped set can be used as a Structure of Arrays by + * linking together the view of two or more mapped objects. Changing the view + * of the mapped set, changes the corresponding view of all the mapped objects in + * the set. + */ +public class MappedSet { + + /** + * Creates a MappedSet by linking the specified MappedObjects. + * + * @return the mapped set. + */ + public static MappedSet2 create(MappedObject a, MappedObject b) { + return new MappedSet2(a, b); + } + + /** + * Creates a MappedSet by linking the specified MappedObjects. + * + * @return the mapped set. + */ + public static MappedSet3 create(MappedObject a, MappedObject b, MappedObject c) { + return new MappedSet3(a, b, c); + } + + /** + * Creates a MappedSet by linking the specified MappedObjects. + * + * @return the mapped set. + */ + public static MappedSet4 create(MappedObject a, MappedObject b, MappedObject c, MappedObject d) { + return new MappedSet4(a, b, c, d); + } + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/mapped/MappedType.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/mapped/MappedType.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/mapped/MappedType.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/mapped/MappedType.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,102 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.util.mapped; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * This annotation marks a class as a mapped object, which will go under bytecode + * transformation at runtime. Mapped objects cannot be instantiated directly; a data + * buffer must be mapped first and the mapped object instance will then be used as a + * view on top of the buffer. Instead of a separate instance per "element" in the buffer, + * only a single instance is used to manage everything. See {@link MappedObject} + * for API details and {@link org.lwjgl.test.mapped.TestMappedObject} for examples. + *

        + * The instance fields of the annotated class should only be limited to primitive types or + * {@link java.nio.ByteBuffer}. Static fields are supported and they can have any type. + *

        + * The purpose of mapped objects is to reduce the memory requirements required for the type + * of data that are often used in OpenGL/OpenCL programming, while at the same time enabling + * clean Java code. There are also performance benefits related to not having to copy data + * between buffers and Java objects and the removal of bounds checking when accessing + * buffer data. + * + * @author Riven + */ +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.TYPE) +public @interface MappedType { + + /** + * The number of bytes to add to the total byte size. + * SIZEOF will be calculated as SIZEOF = max(field_offset + field_length) + padding. + *

        + * Cannot be used with {@link #cacheLinePadding()}. + * + * @return the padding amount + */ + int padding() default 0; + + /** + * When true, SIZEOF will be increased (if necessary) so that it's a multiple of the CPU cache line size. + * Additionally, {@link MappedObject#malloc(int)} on the mapped object type will automatically use + * {@link CacheUtil#createByteBuffer(int)} instead of the unaligned {@link org.lwjgl.BufferUtils#createByteBuffer(int)}. + *

        + * Cannot be used with {@link #padding()}. + * + * @return if cache-line padding should be applied + * + * @see CacheUtil + */ + boolean cacheLinePadding() default false; + + /** + * The mapped data memory alignment, in bytes. + * + * @return the memory alignment + */ + int align() default 4; + + /** + * When autoGenerateOffsets is true, byte offsets of the mapped fields will + * be generated automatically. This is convenient for packed data. For manually + * aligned data, autoGenerateOffsets must be set to false and the user needs + * to manually specify byte offsets using the {@link MappedField} annotation. + * + * @return true if automatic byte offset generation is required. + */ + boolean autoGenerateOffsets() default true; + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/mapped/Pointer.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/mapped/Pointer.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/mapped/Pointer.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/mapped/Pointer.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.util.mapped; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * This annotation can be used on long fields of {@link MappedObject} subclasses, + * to specify that the long value should be interpreted as a pointer. This + * will determine the actual byte size of the field at runtime (4 or 8 bytes). + * + * @author Spasi + */ +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.FIELD) +public @interface Pointer { + +} diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/Point.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/Point.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/Point.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/Point.java 2016-04-09 16:26:56.000000000 +0000 @@ -35,9 +35,9 @@ /** * A 2D integer point class, which looks remarkably like an AWT one. - * @author $Author: matzon $ - * @version $Revision: 2983 $ - * $Id: Point.java 2983 2008-04-07 18:36:09Z matzon $ + * @author $Author$ + * @version $Revision$ + * $Id$ */ public final class Point implements ReadablePoint, WritablePoint, Serializable { diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/ReadableColor.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/ReadableColor.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/ReadableColor.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/ReadableColor.java 2016-04-09 16:26:56.000000000 +0000 @@ -35,9 +35,9 @@ /** * Readonly interface for Colors - * @author $Author: spasi $ - * @version $Revision: 3418 $ - * $Id: ReadableColor.java 3418 2010-09-28 21:11:35Z spasi $ + * @author $Author$ + * @version $Revision$ + * $Id$ */ public interface ReadableColor { diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/ReadableDimension.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/ReadableDimension.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/ReadableDimension.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/ReadableDimension.java 2016-04-09 16:26:56.000000000 +0000 @@ -33,9 +33,9 @@ /** * Readonly interface for Dimensions - * @author $Author: spasi $ - * @version $Revision: 3418 $ - * $Id: ReadableDimension.java 3418 2010-09-28 21:11:35Z spasi $ + * @author $Author$ + * @version $Revision$ + * $Id$ */ public interface ReadableDimension { diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/ReadablePoint.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/ReadablePoint.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/ReadablePoint.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/ReadablePoint.java 2016-04-09 16:26:56.000000000 +0000 @@ -33,9 +33,9 @@ /** * Readonly interface for Points - * @author $Author: spasi $ - * @version $Revision: 3418 $ - * $Id: ReadablePoint.java 3418 2010-09-28 21:11:35Z spasi $ + * @author $Author$ + * @version $Revision$ + * $Id$ */ public interface ReadablePoint { diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/ReadableRectangle.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/ReadableRectangle.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/ReadableRectangle.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/ReadableRectangle.java 2016-04-09 16:26:56.000000000 +0000 @@ -33,9 +33,9 @@ /** * Readonly interface for Rectangles - * @author $Author: spasi $ - * @version $Revision: 3418 $ - * $Id: ReadableRectangle.java 3418 2010-09-28 21:11:35Z spasi $ + * @author $Author$ + * @version $Revision$ + * $Id$ */ public interface ReadableRectangle extends ReadableDimension, ReadablePoint { diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/Rectangle.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/Rectangle.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/Rectangle.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/Rectangle.java 2016-04-09 16:26:56.000000000 +0000 @@ -35,9 +35,9 @@ /** * A 2D integer Rectangle class which looks remarkably like an AWT one. - * @author $Author: matzon $ - * @version $Revision: 2983 $ - * $Id: Rectangle.java 2983 2008-04-07 18:36:09Z matzon $ + * @author $Author$ + * @version $Revision$ + * $Id$ */ public final class Rectangle implements ReadableRectangle, WritableRectangle, Serializable { diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/Renderable.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/Renderable.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/Renderable.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/Renderable.java 2016-04-09 16:26:56.000000000 +0000 @@ -35,9 +35,9 @@ * * Simple interface to things that can be Rendered. * - * @author $Author: spasi $ - * @version $Revision: 3418 $ - * $Id: Renderable.java 3418 2010-09-28 21:11:35Z spasi $ + * @author $Author$ + * @version $Revision$ + * $Id$ */ public interface Renderable { diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/Timer.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/Timer.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/Timer.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/Timer.java 2016-04-09 16:26:56.000000000 +0000 @@ -41,8 +41,8 @@ * all timers are updated consistently with each other. * * @author cix_foo - * @version $Revision: 3418 $ - * $Id: Timer.java 3418 2010-09-28 21:11:35Z spasi $ + * @version $Revision$ + * $Id$ */ public class Timer { diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/vector/Matrix2f.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/vector/Matrix2f.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/vector/Matrix2f.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/vector/Matrix2f.java 2016-04-09 16:26:56.000000000 +0000 @@ -39,8 +39,8 @@ * Holds a 2x2 matrix * * @author cix_foo - * @version $Revision: 3418 $ - * $Id: Matrix2f.java 3418 2010-09-28 21:11:35Z spasi $ + * @version $Revision$ + * $Id$ */ public class Matrix2f extends Matrix implements Serializable { @@ -333,7 +333,7 @@ * @return the negated matrix */ public Matrix2f negate(Matrix2f dest) { - return negate(this, this); + return negate(this, dest); } /** diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/vector/Matrix3f.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/vector/Matrix3f.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/vector/Matrix3f.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/vector/Matrix3f.java 2016-04-09 16:26:56.000000000 +0000 @@ -39,8 +39,8 @@ * Holds a 3x3 matrix. * * @author cix_foo - * @version $Revision: 3418 $ - * $Id: Matrix3f.java 3418 2010-09-28 21:11:35Z spasi $ + * @version $Revision$ + * $Id$ */ public class Matrix3f extends Matrix implements Serializable { @@ -431,7 +431,7 @@ * @return the negated matrix */ public Matrix3f negate(Matrix3f dest) { - return negate(this, this); + return negate(this, dest); } /** diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/vector/Matrix4f.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/vector/Matrix4f.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/vector/Matrix4f.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/vector/Matrix4f.java 2016-04-09 16:26:56.000000000 +0000 @@ -52,6 +52,11 @@ setIdentity(); } + public Matrix4f(final Matrix4f src) { + super(); + load(src); + } + /** * Returns a string representation of this matrix */ @@ -278,6 +283,23 @@ return this; } + /** + * Store the rotation portion of this matrix in a float buffer. The matrix is stored in column + * major (openGL) order. + * @param buf The buffer to store this matrix in + */ + public Matrix store3f(FloatBuffer buf) { + buf.put(m00); + buf.put(m01); + buf.put(m02); + buf.put(m10); + buf.put(m11); + buf.put(m12); + buf.put(m20); + buf.put(m21); + buf.put(m22); + return this; + } /** * Add two matrices together and place the result in a third matrix. @@ -792,7 +814,7 @@ * @return the negated matrix */ public Matrix4f negate(Matrix4f dest) { - return negate(this, this); + return negate(this, dest); } /** diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/vector/Matrix.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/vector/Matrix.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/vector/Matrix.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/vector/Matrix.java 2016-04-09 16:26:56.000000000 +0000 @@ -40,8 +40,8 @@ * matrix unless otherwise stated. * * @author cix_foo - * @version $Revision: 3418 $ - * $Id: Matrix.java 3418 2010-09-28 21:11:35Z spasi $ + * @version $Revision$ + * $Id$ */ public abstract class Matrix implements Serializable { diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/vector/Quaternion.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/vector/Quaternion.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/vector/Quaternion.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/vector/Quaternion.java 2016-04-09 16:26:56.000000000 +0000 @@ -36,8 +36,8 @@ * Quaternions for LWJGL! * * @author fbi - * @version $Revision: 3418 $ - * $Id: Quaternion.java 3418 2010-09-28 21:11:35Z spasi $ + * @version $Revision$ + * $Id$ */ import java.nio.FloatBuffer; diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/vector/Vector2f.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/vector/Vector2f.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/vector/Vector2f.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/vector/Vector2f.java 2016-04-09 16:26:56.000000000 +0000 @@ -34,13 +34,15 @@ import java.io.Serializable; import java.nio.FloatBuffer; +import org.lwjgl.util.vector.Vector2f; + /** * * Holds a 2-tuple vector. * * @author cix_foo - * @version $Revision: 3418 $ - * $Id: Vector2f.java 3418 2010-09-28 21:11:35Z spasi $ + * @version $Revision$ + * $Id$ */ public class Vector2f extends Vector implements Serializable, ReadableVector2f, WritableVector2f { @@ -285,6 +287,17 @@ */ public final void setY(float y) { this.y = y; + } + + public boolean equals(Object obj) { + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; + Vector2f other = (Vector2f)obj; + + if (x == other.x && y == other.y) return true; + + return false; } - + } diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/vector/Vector3f.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/vector/Vector3f.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/vector/Vector3f.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/vector/Vector3f.java 2016-04-09 16:26:56.000000000 +0000 @@ -34,13 +34,15 @@ import java.io.Serializable; import java.nio.FloatBuffer; +import org.lwjgl.util.vector.Vector3f; + /** * * Holds a 3-tuple vector. * * @author cix_foo - * @version $Revision: 3418 $ - * $Id: Vector3f.java 3418 2010-09-28 21:11:35Z spasi $ + * @version $Revision$ + * $Id$ */ public class Vector3f extends Vector implements Serializable, ReadableVector3f, WritableVector3f { @@ -344,4 +346,15 @@ public float getZ() { return z; } + + public boolean equals(Object obj) { + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; + Vector3f other = (Vector3f)obj; + + if (x == other.x && y == other.y && z == other.z) return true; + + return false; + } } diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/vector/Vector4f.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/vector/Vector4f.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/vector/Vector4f.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/vector/Vector4f.java 2016-04-09 16:26:56.000000000 +0000 @@ -34,13 +34,15 @@ import java.io.Serializable; import java.nio.FloatBuffer; +import org.lwjgl.util.vector.Vector4f; + /** * * Holds a 4-tuple vector. * * @author cix_foo - * @version $Revision: 2983 $ - * $Id: Vector4f.java 2983 2008-04-07 18:36:09Z matzon $ + * @version $Revision$ + * $Id$ */ public class Vector4f extends Vector implements Serializable, ReadableVector4f, WritableVector4f { @@ -336,5 +338,14 @@ return w; } - + public boolean equals(Object obj) { + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; + Vector4f other = (Vector4f)obj; + + if (x == other.x && y == other.y && z == other.z && w == other.w) return true; + + return false; + } } diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/vector/Vector.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/vector/Vector.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/vector/Vector.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/vector/Vector.java 2016-04-09 16:26:56.000000000 +0000 @@ -39,8 +39,8 @@ * Base class for vectors. * * @author cix_foo - * @version $Revision: 3418 $ - * $Id: Vector.java 3418 2010-09-28 21:11:35Z spasi $ + * @version $Revision$ + * $Id$ */ public abstract class Vector implements Serializable, ReadableVector { diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/vector/WritableVector2f.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/vector/WritableVector2f.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/vector/WritableVector2f.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/vector/WritableVector2f.java 2016-04-09 16:26:56.000000000 +0000 @@ -35,7 +35,7 @@ * Writable interface to Vector2fs * @author $author$ * @version $revision$ - * $Id: WritableVector2f.java 3418 2010-09-28 21:11:35Z spasi $ + * $Id$ */ public interface WritableVector2f { diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/vector/WritableVector3f.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/vector/WritableVector3f.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/vector/WritableVector3f.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/vector/WritableVector3f.java 2016-04-09 16:26:56.000000000 +0000 @@ -35,7 +35,7 @@ * Writable interface to Vector3fs * @author $author$ * @version $revision$ - * $Id: WritableVector3f.java 3418 2010-09-28 21:11:35Z spasi $ + * $Id$ */ public interface WritableVector3f extends WritableVector2f { diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/vector/WritableVector4f.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/vector/WritableVector4f.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/vector/WritableVector4f.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/vector/WritableVector4f.java 2016-04-09 16:26:56.000000000 +0000 @@ -35,7 +35,7 @@ * Writable interface to Vector4fs * @author $author$ * @version $revision$ - * $Id: WritableVector4f.java 3418 2010-09-28 21:11:35Z spasi $ + * $Id$ */ public interface WritableVector4f extends WritableVector3f { diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/WaveData.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/WaveData.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/WaveData.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/WaveData.java 2016-04-09 16:26:56.000000000 +0000 @@ -53,8 +53,8 @@ * Utitlity class for loading wavefiles. * * @author Brian Matzon - * @version $Revision: 3438 $ - * $Id: WaveData.java 3438 2010-10-12 15:34:26Z matzon $ + * @version $Revision$ + * $Id$ */ public class WaveData { /** actual wave data */ @@ -218,7 +218,7 @@ && total < buf.length) { total += read; } - buffer = convertAudioBytes(buf, audioformat.getSampleSizeInBits() == 16); + buffer = convertAudioBytes(buf, audioformat.getSampleSizeInBits() == 16, audioformat.isBigEndian() ? ByteOrder.BIG_ENDIAN : ByteOrder.LITTLE_ENDIAN); } catch (IOException ioe) { return null; } @@ -237,11 +237,11 @@ return wavedata; } - private static ByteBuffer convertAudioBytes(byte[] audio_bytes, boolean two_bytes_data) { + private static ByteBuffer convertAudioBytes(byte[] audio_bytes, boolean two_bytes_data, ByteOrder order) { ByteBuffer dest = ByteBuffer.allocateDirect(audio_bytes.length); dest.order(ByteOrder.nativeOrder()); ByteBuffer src = ByteBuffer.wrap(audio_bytes); - src.order(ByteOrder.LITTLE_ENDIAN); + src.order(order); if (two_bytes_data) { ShortBuffer dest_short = dest.asShortBuffer(); ShortBuffer src_short = src.asShortBuffer(); diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/WritableColor.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/WritableColor.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/WritableColor.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/WritableColor.java 2016-04-09 16:26:56.000000000 +0000 @@ -35,9 +35,9 @@ /** * Write interface for Colors - * @author $Author: spasi $ - * @version $Revision: 3418 $ - * $Id: WritableColor.java 3418 2010-09-28 21:11:35Z spasi $ + * @author $Author$ + * @version $Revision$ + * $Id$ */ public interface WritableColor { /** diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/WritableDimension.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/WritableDimension.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/WritableDimension.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/WritableDimension.java 2016-04-09 16:26:56.000000000 +0000 @@ -33,9 +33,9 @@ /** * Write interface for Dimensions - * @author $Author: spasi $ - * @version $Revision: 3418 $ - * $Id: WritableDimension.java 3418 2010-09-28 21:11:35Z spasi $ + * @author $Author$ + * @version $Revision$ + * $Id$ */ public interface WritableDimension { diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/WritablePoint.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/WritablePoint.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/WritablePoint.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/WritablePoint.java 2016-04-09 16:26:56.000000000 +0000 @@ -33,9 +33,9 @@ /** * Write interface for Points - * @author $Author: spasi $ - * @version $Revision: 3418 $ - * $Id: WritablePoint.java 3418 2010-09-28 21:11:35Z spasi $ + * @author $Author$ + * @version $Revision$ + * $Id$ */ public interface WritablePoint { void setLocation(int x, int y); diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/WritableRectangle.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/WritableRectangle.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/util/WritableRectangle.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/util/WritableRectangle.java 2016-04-09 16:26:56.000000000 +0000 @@ -33,9 +33,9 @@ /** * Write interface for Rectangles - * @author $Author: spasi $ - * @version $Revision: 3418 $ - * $Id: WritableRectangle.java 3418 2010-09-28 21:11:35Z spasi $ + * @author $Author$ + * @version $Revision$ + * $Id$ */ public interface WritableRectangle extends WritablePoint, WritableDimension { diff -Nru lwjgl-2.7.1+dfsg/src/java/org/lwjgl/WindowsSysImplementation.java lwjgl-2.9.3+dfsg/src/java/org/lwjgl/WindowsSysImplementation.java --- lwjgl-2.7.1+dfsg/src/java/org/lwjgl/WindowsSysImplementation.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/java/org/lwjgl/WindowsSysImplementation.java 2016-04-09 16:26:56.000000000 +0000 @@ -31,6 +31,7 @@ */ package org.lwjgl; +import java.nio.ByteBuffer; import java.security.PrivilegedExceptionAction; import java.security.PrivilegedActionException; import java.security.AccessController; @@ -40,12 +41,12 @@ /** *

        - * @author $Author: spasi $ - * @version $Revision: 3418 $ - * $Id: WindowsSysImplementation.java 3418 2010-09-28 21:11:35Z spasi $ + * @author $Author$ + * @version $Revision$ + * $Id$ */ final class WindowsSysImplementation extends DefaultSysImplementation { - private static final int JNI_VERSION = 23; + private static final int JNI_VERSION = 24; static { Sys.initialize(); @@ -95,9 +96,14 @@ if(!Display.isCreated()) { initCommonControls(); } - nAlert(getHwnd(), title, message); + + LWJGLUtil.log(String.format("*** Alert *** %s\n%s\n", title, message)); + + final ByteBuffer titleText = MemoryUtil.encodeUTF16(title); + final ByteBuffer messageText = MemoryUtil.encodeUTF16(message); + nAlert(getHwnd(), MemoryUtil.getAddress(titleText), MemoryUtil.getAddress(messageText)); } - private static native void nAlert(long parent_hwnd, String title, String message); + private static native void nAlert(long parent_hwnd, long title, long message); private static native void initCommonControls(); public boolean openURL(final String url) { diff -Nru lwjgl-2.7.1+dfsg/src/native/common/awt_tools.h lwjgl-2.9.3+dfsg/src/native/common/awt_tools.h --- lwjgl-2.7.1+dfsg/src/native/common/awt_tools.h 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/common/awt_tools.h 2016-04-09 16:26:57.000000000 +0000 @@ -31,10 +31,10 @@ */ /** - * $Id: awt_tools.h 2985 2008-04-07 18:42:36Z matzon $ + * $Id$ * * @author elias_naur - * @version $Revision: 2985 $ + * @version $Revision$ */ #ifndef __LWJGL_AWT_TOOLS_H diff -Nru lwjgl-2.7.1+dfsg/src/native/common/common_tools.c lwjgl-2.9.3+dfsg/src/native/common/common_tools.c --- lwjgl-2.7.1+dfsg/src/native/common/common_tools.c 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/common/common_tools.c 2016-04-09 16:26:57.000000000 +0000 @@ -31,10 +31,10 @@ */ /** - * $Id: common_tools.c 3449 2010-10-14 19:58:32Z matzon $ + * $Id$ * * @author elias_naur - * @version $Revision: 3449 $ + * @version $Revision$ */ #include @@ -120,7 +120,7 @@ org_lwjgl_LWJGLUtil_class = (*env)->FindClass(env, "org/lwjgl/LWJGLUtil"); if (org_lwjgl_LWJGLUtil_class == NULL) return; - log_method = (*env)->GetStaticMethodID(env, org_lwjgl_LWJGLUtil_class, "log", "(Ljava/lang/String;)V"); + log_method = (*env)->GetStaticMethodID(env, org_lwjgl_LWJGLUtil_class, "log", "(Ljava/lang/CharSequence;)V"); if (log_method == NULL) return; (*env)->CallStaticVoidMethod(env, org_lwjgl_LWJGLUtil_class, log_method, str); @@ -227,11 +227,11 @@ const char *str = (const char *)ustr; if (str == NULL) return NULL; - return NewStringNativeWithLength(env, str, strlen(str)); + return NewStringNativeWithLength(env, str, (jsize)strlen(str)); } // creates locale specific string -jstring NewStringNativeWithLength(JNIEnv *env, const char *str, int length) { +jstring NewStringNativeWithLength(JNIEnv *env, const char *str, jsize length) { jclass jcls_str; jmethodID jmethod_str; jstring result; @@ -297,7 +297,7 @@ void *ext_func_pointer; void **ext_function_pointer_pointer; JNINativeMethod *method; - int i; + int i, num_natives = 0; if (clazz == NULL) { throwException(env, "Null class"); return; @@ -308,6 +308,9 @@ if (function->ext_function_name != NULL) { ext_func_pointer = gpa(function->ext_function_name); if (ext_func_pointer == NULL) { + if ( function->optional ) + continue; + free(methods); throwException(env, "Missing driver symbols"); return; @@ -315,17 +318,19 @@ ext_function_pointer_pointer = function->ext_function_pointer; *ext_function_pointer_pointer = ext_func_pointer; } - method = methods + i; + method = methods + num_natives; method->name = function->method_name; method->signature = function->signature; method->fnPtr = function->method_pointer; + + num_natives++; } - (*env)->RegisterNatives(env, clazz, methods, num_functions); + (*env)->RegisterNatives(env, clazz, methods, num_natives); free(methods); } bool getBooleanProperty(JNIEnv *env, const char* propertyName) { - jstring property = NewStringNativeWithLength(env, propertyName, strlen(propertyName)); + jstring property = NewStringNativeWithLength(env, propertyName, (jsize)strlen(propertyName)); jclass org_lwjgl_LWJGLUtil_class; jmethodID getBoolean; if (property == NULL) diff -Nru lwjgl-2.7.1+dfsg/src/native/common/common_tools.h lwjgl-2.9.3+dfsg/src/native/common/common_tools.h --- lwjgl-2.7.1+dfsg/src/native/common/common_tools.h 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/common/common_tools.h 2016-04-09 16:26:57.000000000 +0000 @@ -31,10 +31,10 @@ */ /** - * $Id: common_tools.h 3412 2010-09-26 23:43:24Z spasi $ + * $Id$ * * @author elias_naur - * @version $Revision: 3412 $ + * @version $Revision$ */ #ifndef _COMMON_TOOLS_H @@ -75,18 +75,18 @@ return NULL; } -static inline jobject safeNewBuffer(JNIEnv *env, void *p, int size) { +static inline jobject safeNewBuffer(JNIEnv *env, void *p, jlong capacity) { if (p != NULL) { #ifdef __cplusplus - return env->NewDirectByteBuffer(p, size); + return env->NewDirectByteBuffer(p, capacity); #else - return (*env)->NewDirectByteBuffer(env, p, size); + return (*env)->NewDirectByteBuffer(env, p, capacity); #endif } else return NULL; } -static inline jobject safeNewBufferCached(JNIEnv *env, void *p, int size, jobject old_buffer) { +static inline jobject safeNewBufferCached(JNIEnv *env, void *p, jlong size, jobject old_buffer) { if (old_buffer != NULL) { void *old_buffer_address = (*env)->GetDirectBufferAddress(env, old_buffer); jlong capacity = (*env)->GetDirectBufferCapacity(env, old_buffer); @@ -109,6 +109,7 @@ char *ext_function_name; void **ext_function_pointer; + bool optional; } JavaMethodAndExtFunction; typedef struct { @@ -140,7 +141,7 @@ extern void printfDebug(const char *format, ...); extern bool getBooleanProperty(JNIEnv *env, const char* propertyName); extern char * GetStringNativeChars(JNIEnv *env, jstring jstr); -extern jstring NewStringNativeWithLength(JNIEnv *env, const char *str, int length); +extern jstring NewStringNativeWithLength(JNIEnv *env, const char *str, jsize length); extern jstring NewStringNativeUnsigned(JNIEnv *env, const unsigned char *str); extern jobject NewReadOnlyDirectByteBuffer(JNIEnv* env, const void* address, jlong capacity); extern jobject newJavaManagedByteBuffer(JNIEnv *env, const int size); diff -Nru lwjgl-2.7.1+dfsg/src/native/common/EGL/eglext.h lwjgl-2.9.3+dfsg/src/native/common/EGL/eglext.h --- lwjgl-2.7.1+dfsg/src/native/common/EGL/eglext.h 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/common/EGL/eglext.h 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,230 @@ +#ifndef __eglext_h_ +#define __eglext_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* +** Copyright (c) 2007-2010 The Khronos Group Inc. +** +** Permission is hereby granted, free of charge, to any person obtaining a +** copy of this software and/or associated documentation files (the +** "Materials"), to deal in the Materials without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Materials, and to +** permit persons to whom the Materials are furnished to do so, subject to +** the following conditions: +** +** The above copyright notice and this permission notice shall be included +** in all copies or substantial portions of the Materials. +** +** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. +*/ + +#include + +/*************************************************************/ + +/* Header file version number */ +/* Current version at http://www.khronos.org/registry/egl/ */ +/* $Revision: 11249 $ on $Date: 2010-05-05 09:54:28 -0700 (Wed, 05 May 2010) $ */ +#define EGL_EGLEXT_VERSION 5 + +#ifndef EGL_KHR_config_attribs +#define EGL_KHR_config_attribs 1 +#define EGL_CONFORMANT_KHR 0x3042 /* EGLConfig attribute */ +#define EGL_VG_COLORSPACE_LINEAR_BIT_KHR 0x0020 /* EGL_SURFACE_TYPE bitfield */ +#define EGL_VG_ALPHA_FORMAT_PRE_BIT_KHR 0x0040 /* EGL_SURFACE_TYPE bitfield */ +#endif + +#ifndef EGL_KHR_lock_surface +#define EGL_KHR_lock_surface 1 +#define EGL_READ_SURFACE_BIT_KHR 0x0001 /* EGL_LOCK_USAGE_HINT_KHR bitfield */ +#define EGL_WRITE_SURFACE_BIT_KHR 0x0002 /* EGL_LOCK_USAGE_HINT_KHR bitfield */ +#define EGL_LOCK_SURFACE_BIT_KHR 0x0080 /* EGL_SURFACE_TYPE bitfield */ +#define EGL_OPTIMAL_FORMAT_BIT_KHR 0x0100 /* EGL_SURFACE_TYPE bitfield */ +#define EGL_MATCH_FORMAT_KHR 0x3043 /* EGLConfig attribute */ +#define EGL_FORMAT_RGB_565_EXACT_KHR 0x30C0 /* EGL_MATCH_FORMAT_KHR value */ +#define EGL_FORMAT_RGB_565_KHR 0x30C1 /* EGL_MATCH_FORMAT_KHR value */ +#define EGL_FORMAT_RGBA_8888_EXACT_KHR 0x30C2 /* EGL_MATCH_FORMAT_KHR value */ +#define EGL_FORMAT_RGBA_8888_KHR 0x30C3 /* EGL_MATCH_FORMAT_KHR value */ +#define EGL_MAP_PRESERVE_PIXELS_KHR 0x30C4 /* eglLockSurfaceKHR attribute */ +#define EGL_LOCK_USAGE_HINT_KHR 0x30C5 /* eglLockSurfaceKHR attribute */ +#define EGL_BITMAP_POINTER_KHR 0x30C6 /* eglQuerySurface attribute */ +#define EGL_BITMAP_PITCH_KHR 0x30C7 /* eglQuerySurface attribute */ +#define EGL_BITMAP_ORIGIN_KHR 0x30C8 /* eglQuerySurface attribute */ +#define EGL_BITMAP_PIXEL_RED_OFFSET_KHR 0x30C9 /* eglQuerySurface attribute */ +#define EGL_BITMAP_PIXEL_GREEN_OFFSET_KHR 0x30CA /* eglQuerySurface attribute */ +#define EGL_BITMAP_PIXEL_BLUE_OFFSET_KHR 0x30CB /* eglQuerySurface attribute */ +#define EGL_BITMAP_PIXEL_ALPHA_OFFSET_KHR 0x30CC /* eglQuerySurface attribute */ +#define EGL_BITMAP_PIXEL_LUMINANCE_OFFSET_KHR 0x30CD /* eglQuerySurface attribute */ +#define EGL_LOWER_LEFT_KHR 0x30CE /* EGL_BITMAP_ORIGIN_KHR value */ +#define EGL_UPPER_LEFT_KHR 0x30CF /* EGL_BITMAP_ORIGIN_KHR value */ +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglLockSurfaceKHR (EGLDisplay display, EGLSurface surface, const EGLint *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglUnlockSurfaceKHR (EGLDisplay display, EGLSurface surface); +#endif /* EGL_EGLEXT_PROTOTYPES */ +typedef EGLBoolean (EGLAPIENTRYP PFNEGLLOCKSURFACEKHRPROC) (EGLDisplay display, EGLSurface surface, const EGLint *attrib_list); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLUNLOCKSURFACEKHRPROC) (EGLDisplay display, EGLSurface surface); +#endif + +#ifndef EGL_KHR_image +#define EGL_KHR_image 1 +#define EGL_NATIVE_PIXMAP_KHR 0x30B0 /* eglCreateImageKHR target */ +typedef void *EGLImageKHR; +#define EGL_NO_IMAGE_KHR ((EGLImageKHR)0) +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLImageKHR EGLAPIENTRY eglCreateImageKHR (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglDestroyImageKHR (EGLDisplay dpy, EGLImageKHR image); +#endif /* EGL_EGLEXT_PROTOTYPES */ +typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEIMAGEKHRPROC) (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYIMAGEKHRPROC) (EGLDisplay dpy, EGLImageKHR image); +#endif + +#ifndef EGL_KHR_vg_parent_image +#define EGL_KHR_vg_parent_image 1 +#define EGL_VG_PARENT_IMAGE_KHR 0x30BA /* eglCreateImageKHR target */ +#endif + +#ifndef EGL_KHR_gl_texture_2D_image +#define EGL_KHR_gl_texture_2D_image 1 +#define EGL_GL_TEXTURE_2D_KHR 0x30B1 /* eglCreateImageKHR target */ +#define EGL_GL_TEXTURE_LEVEL_KHR 0x30BC /* eglCreateImageKHR attribute */ +#endif + +#ifndef EGL_KHR_gl_texture_cubemap_image +#define EGL_KHR_gl_texture_cubemap_image 1 +#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR 0x30B3 /* eglCreateImageKHR target */ +#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X_KHR 0x30B4 /* eglCreateImageKHR target */ +#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y_KHR 0x30B5 /* eglCreateImageKHR target */ +#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_KHR 0x30B6 /* eglCreateImageKHR target */ +#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z_KHR 0x30B7 /* eglCreateImageKHR target */ +#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_KHR 0x30B8 /* eglCreateImageKHR target */ +#endif + +#ifndef EGL_KHR_gl_texture_3D_image +#define EGL_KHR_gl_texture_3D_image 1 +#define EGL_GL_TEXTURE_3D_KHR 0x30B2 /* eglCreateImageKHR target */ +#define EGL_GL_TEXTURE_ZOFFSET_KHR 0x30BD /* eglCreateImageKHR attribute */ +#endif + +#ifndef EGL_KHR_gl_renderbuffer_image +#define EGL_KHR_gl_renderbuffer_image 1 +#define EGL_GL_RENDERBUFFER_KHR 0x30B9 /* eglCreateImageKHR target */ +#endif + +#ifndef EGL_KHR_reusable_sync +#define EGL_KHR_reusable_sync 1 + +typedef void* EGLSyncKHR; +typedef khronos_utime_nanoseconds_t EGLTimeKHR; + +#define EGL_SYNC_STATUS_KHR 0x30F1 +#define EGL_SIGNALED_KHR 0x30F2 +#define EGL_UNSIGNALED_KHR 0x30F3 +#define EGL_TIMEOUT_EXPIRED_KHR 0x30F5 +#define EGL_CONDITION_SATISFIED_KHR 0x30F6 +#define EGL_SYNC_TYPE_KHR 0x30F7 +#define EGL_SYNC_REUSABLE_KHR 0x30FA +#define EGL_SYNC_FLUSH_COMMANDS_BIT_KHR 0x0001 /* eglClientWaitSyncKHR bitfield */ +#define EGL_FOREVER_KHR 0xFFFFFFFFFFFFFFFFull +#define EGL_NO_SYNC_KHR ((EGLSyncKHR)0) +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSyncKHR(EGLDisplay dpy, EGLenum type, const EGLint *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncKHR(EGLDisplay dpy, EGLSyncKHR sync); +EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout); +EGLAPI EGLBoolean EGLAPIENTRY eglSignalSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode); +EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value); +#endif /* EGL_EGLEXT_PROTOTYPES */ +typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESYNCKHRPROC) (EGLDisplay dpy, EGLenum type, const EGLint *attrib_list); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync); +typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value); +#endif + +#ifndef EGL_KHR_image_base +#define EGL_KHR_image_base 1 +/* Most interfaces defined by EGL_KHR_image_pixmap above */ +#define EGL_IMAGE_PRESERVED_KHR 0x30D2 /* eglCreateImageKHR attribute */ +#endif + +#ifndef EGL_KHR_image_pixmap +#define EGL_KHR_image_pixmap 1 +/* Interfaces defined by EGL_KHR_image above */ +#endif + +#ifndef EGL_IMG_context_priority +#define EGL_IMG_context_priority 1 +#define EGL_CONTEXT_PRIORITY_LEVEL_IMG 0x3100 +#define EGL_CONTEXT_PRIORITY_HIGH_IMG 0x3101 +#define EGL_CONTEXT_PRIORITY_MEDIUM_IMG 0x3102 +#define EGL_CONTEXT_PRIORITY_LOW_IMG 0x3103 +#endif + +#ifndef EGL_NV_coverage_sample +#define EGL_NV_coverage_sample 1 +#define EGL_COVERAGE_BUFFERS_NV 0x30E0 +#define EGL_COVERAGE_SAMPLES_NV 0x30E1 +#endif + +#ifndef EGL_NV_depth_nonlinear +#define EGL_NV_depth_nonlinear 1 +#define EGL_DEPTH_ENCODING_NV 0x30E2 +#define EGL_DEPTH_ENCODING_NONE_NV 0 +#define EGL_DEPTH_ENCODING_NONLINEAR_NV 0x30E3 +#endif + +#ifndef EGL_NV_sync +#define EGL_NV_sync 1 +#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_NV 0x30E6 +#define EGL_SYNC_STATUS_NV 0x30E7 +#define EGL_SIGNALED_NV 0x30E8 +#define EGL_UNSIGNALED_NV 0x30E9 +#define EGL_SYNC_FLUSH_COMMANDS_BIT_NV 0x0001 +#define EGL_FOREVER_NV 0xFFFFFFFFFFFFFFFFull +#define EGL_ALREADY_SIGNALED_NV 0x30EA +#define EGL_TIMEOUT_EXPIRED_NV 0x30EB +#define EGL_CONDITION_SATISFIED_NV 0x30EC +#define EGL_SYNC_TYPE_NV 0x30ED +#define EGL_SYNC_CONDITION_NV 0x30EE +#define EGL_SYNC_FENCE_NV 0x30EF +#define EGL_NO_SYNC_NV ((EGLSyncNV)0) +typedef void* EGLSyncNV; +typedef unsigned long long EGLTimeNV; +#ifdef EGL_EGLEXT_PROTOTYPES +EGLSyncNV eglCreateFenceSyncNV (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list); +EGLBoolean eglDestroySyncNV (EGLSyncNV sync); +EGLBoolean eglFenceNV (EGLSyncNV sync); +EGLint eglClientWaitSyncNV (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout); +EGLBoolean eglSignalSyncNV (EGLSyncNV sync, EGLenum mode); +EGLBoolean eglGetSyncAttribNV (EGLSyncNV sync, EGLint attribute, EGLint *value); +#endif /* EGL_EGLEXT_PROTOTYPES */ +typedef EGLSyncNV (EGLAPIENTRYP PFNEGLCREATEFENCESYNCNVPROC) (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCNVPROC) (EGLSyncNV sync); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLFENCENVPROC) (EGLSyncNV sync); +typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCNVPROC) (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCNVPROC) (EGLSyncNV sync, EGLenum mode); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBNVPROC) (EGLSyncNV sync, EGLint attribute, EGLint *value); +#endif + +#ifndef EGL_KHR_fence_sync +#define EGL_KHR_fence_sync 1 +/* Reuses most tokens and entry points from EGL_KHR_reusable_sync */ +#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR 0x30F0 +#define EGL_SYNC_CONDITION_KHR 0x30F8 +#define EGL_SYNC_FENCE_KHR 0x30F9 +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff -Nru lwjgl-2.7.1+dfsg/src/native/common/EGL/egl.h lwjgl-2.9.3+dfsg/src/native/common/EGL/egl.h --- lwjgl-2.7.1+dfsg/src/native/common/EGL/egl.h 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/common/EGL/egl.h 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,329 @@ +/* -*- mode: c; tab-width: 8; -*- */ +/* vi: set sw=4 ts=8: */ +/* Reference version of egl.h for EGL 1.4. + * $Revision: 9356 $ on $Date: 2009-10-21 02:52:25 -0700 (Wed, 21 Oct 2009) $ + */ + +/* +** Copyright (c) 2007-2009 The Khronos Group Inc. +** +** Permission is hereby granted, free of charge, to any person obtaining a +** copy of this software and/or associated documentation files (the +** "Materials"), to deal in the Materials without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Materials, and to +** permit persons to whom the Materials are furnished to do so, subject to +** the following conditions: +** +** The above copyright notice and this permission notice shall be included +** in all copies or substantial portions of the Materials. +** +** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. +*/ + +#ifndef __egl_h_ +#define __egl_h_ + +/* All platform-dependent types and macro boilerplate (such as EGLAPI + * and EGLAPIENTRY) should go in eglplatform.h. + */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* EGL Types */ +/* EGLint is defined in eglplatform.h */ +typedef unsigned int EGLBoolean; +typedef unsigned int EGLenum; +typedef void *EGLConfig; +typedef void *EGLContext; +typedef void *EGLDisplay; +typedef void *EGLSurface; +typedef void *EGLClientBuffer; + +/* EGL Versioning */ +#define EGL_VERSION_1_0 1 +#define EGL_VERSION_1_1 1 +#define EGL_VERSION_1_2 1 +#define EGL_VERSION_1_3 1 +#define EGL_VERSION_1_4 1 + +/* EGL Enumerants. Bitmasks and other exceptional cases aside, most + * enums are assigned unique values starting at 0x3000. + */ + +/* EGL aliases */ +#define EGL_FALSE 0 +#define EGL_TRUE 1 + +/* Out-of-band handle values */ +#define EGL_DEFAULT_DISPLAY ((EGLNativeDisplayType)0) +#define EGL_NO_CONTEXT ((EGLContext)0) +#define EGL_NO_DISPLAY ((EGLDisplay)0) +#define EGL_NO_SURFACE ((EGLSurface)0) + +/* Out-of-band attribute value */ +#define EGL_DONT_CARE ((EGLint)-1) + +/* Errors / GetError return values */ +#define EGL_SUCCESS 0x3000 +#define EGL_NOT_INITIALIZED 0x3001 +#define EGL_BAD_ACCESS 0x3002 +#define EGL_BAD_ALLOC 0x3003 +#define EGL_BAD_ATTRIBUTE 0x3004 +#define EGL_BAD_CONFIG 0x3005 +#define EGL_BAD_CONTEXT 0x3006 +#define EGL_BAD_CURRENT_SURFACE 0x3007 +#define EGL_BAD_DISPLAY 0x3008 +#define EGL_BAD_MATCH 0x3009 +#define EGL_BAD_NATIVE_PIXMAP 0x300A +#define EGL_BAD_NATIVE_WINDOW 0x300B +#define EGL_BAD_PARAMETER 0x300C +#define EGL_BAD_SURFACE 0x300D +#define EGL_CONTEXT_LOST 0x300E /* EGL 1.1 - IMG_power_management */ + +/* Reserved 0x300F-0x301F for additional errors */ + +/* Config attributes */ +#define EGL_BUFFER_SIZE 0x3020 +#define EGL_ALPHA_SIZE 0x3021 +#define EGL_BLUE_SIZE 0x3022 +#define EGL_GREEN_SIZE 0x3023 +#define EGL_RED_SIZE 0x3024 +#define EGL_DEPTH_SIZE 0x3025 +#define EGL_STENCIL_SIZE 0x3026 +#define EGL_CONFIG_CAVEAT 0x3027 +#define EGL_CONFIG_ID 0x3028 +#define EGL_LEVEL 0x3029 +#define EGL_MAX_PBUFFER_HEIGHT 0x302A +#define EGL_MAX_PBUFFER_PIXELS 0x302B +#define EGL_MAX_PBUFFER_WIDTH 0x302C +#define EGL_NATIVE_RENDERABLE 0x302D +#define EGL_NATIVE_VISUAL_ID 0x302E +#define EGL_NATIVE_VISUAL_TYPE 0x302F +#define EGL_SAMPLES 0x3031 +#define EGL_SAMPLE_BUFFERS 0x3032 +#define EGL_SURFACE_TYPE 0x3033 +#define EGL_TRANSPARENT_TYPE 0x3034 +#define EGL_TRANSPARENT_BLUE_VALUE 0x3035 +#define EGL_TRANSPARENT_GREEN_VALUE 0x3036 +#define EGL_TRANSPARENT_RED_VALUE 0x3037 +#define EGL_NONE 0x3038 /* Attrib list terminator */ +#define EGL_BIND_TO_TEXTURE_RGB 0x3039 +#define EGL_BIND_TO_TEXTURE_RGBA 0x303A +#define EGL_MIN_SWAP_INTERVAL 0x303B +#define EGL_MAX_SWAP_INTERVAL 0x303C +#define EGL_LUMINANCE_SIZE 0x303D +#define EGL_ALPHA_MASK_SIZE 0x303E +#define EGL_COLOR_BUFFER_TYPE 0x303F +#define EGL_RENDERABLE_TYPE 0x3040 +#define EGL_MATCH_NATIVE_PIXMAP 0x3041 /* Pseudo-attribute (not queryable) */ +#define EGL_CONFORMANT 0x3042 + +/* Reserved 0x3041-0x304F for additional config attributes */ + +/* Config attribute values */ +#define EGL_SLOW_CONFIG 0x3050 /* EGL_CONFIG_CAVEAT value */ +#define EGL_NON_CONFORMANT_CONFIG 0x3051 /* EGL_CONFIG_CAVEAT value */ +#define EGL_TRANSPARENT_RGB 0x3052 /* EGL_TRANSPARENT_TYPE value */ +#define EGL_RGB_BUFFER 0x308E /* EGL_COLOR_BUFFER_TYPE value */ +#define EGL_LUMINANCE_BUFFER 0x308F /* EGL_COLOR_BUFFER_TYPE value */ + +/* More config attribute values, for EGL_TEXTURE_FORMAT */ +#define EGL_NO_TEXTURE 0x305C +#define EGL_TEXTURE_RGB 0x305D +#define EGL_TEXTURE_RGBA 0x305E +#define EGL_TEXTURE_2D 0x305F + +/* Config attribute mask bits */ +#define EGL_PBUFFER_BIT 0x0001 /* EGL_SURFACE_TYPE mask bits */ +#define EGL_PIXMAP_BIT 0x0002 /* EGL_SURFACE_TYPE mask bits */ +#define EGL_WINDOW_BIT 0x0004 /* EGL_SURFACE_TYPE mask bits */ +#define EGL_VG_COLORSPACE_LINEAR_BIT 0x0020 /* EGL_SURFACE_TYPE mask bits */ +#define EGL_VG_ALPHA_FORMAT_PRE_BIT 0x0040 /* EGL_SURFACE_TYPE mask bits */ +#define EGL_MULTISAMPLE_RESOLVE_BOX_BIT 0x0200 /* EGL_SURFACE_TYPE mask bits */ +#define EGL_SWAP_BEHAVIOR_PRESERVED_BIT 0x0400 /* EGL_SURFACE_TYPE mask bits */ + +#define EGL_OPENGL_ES_BIT 0x0001 /* EGL_RENDERABLE_TYPE mask bits */ +#define EGL_OPENVG_BIT 0x0002 /* EGL_RENDERABLE_TYPE mask bits */ +#define EGL_OPENGL_ES2_BIT 0x0004 /* EGL_RENDERABLE_TYPE mask bits */ +#define EGL_OPENGL_BIT 0x0008 /* EGL_RENDERABLE_TYPE mask bits */ + +/* QueryString targets */ +#define EGL_VENDOR 0x3053 +#define EGL_VERSION 0x3054 +#define EGL_EXTENSIONS 0x3055 +#define EGL_CLIENT_APIS 0x308D + +/* QuerySurface / SurfaceAttrib / CreatePbufferSurface targets */ +#define EGL_HEIGHT 0x3056 +#define EGL_WIDTH 0x3057 +#define EGL_LARGEST_PBUFFER 0x3058 +#define EGL_TEXTURE_FORMAT 0x3080 +#define EGL_TEXTURE_TARGET 0x3081 +#define EGL_MIPMAP_TEXTURE 0x3082 +#define EGL_MIPMAP_LEVEL 0x3083 +#define EGL_RENDER_BUFFER 0x3086 +#define EGL_VG_COLORSPACE 0x3087 +#define EGL_VG_ALPHA_FORMAT 0x3088 +#define EGL_HORIZONTAL_RESOLUTION 0x3090 +#define EGL_VERTICAL_RESOLUTION 0x3091 +#define EGL_PIXEL_ASPECT_RATIO 0x3092 +#define EGL_SWAP_BEHAVIOR 0x3093 +#define EGL_MULTISAMPLE_RESOLVE 0x3099 + +/* EGL_RENDER_BUFFER values / BindTexImage / ReleaseTexImage buffer targets */ +#define EGL_BACK_BUFFER 0x3084 +#define EGL_SINGLE_BUFFER 0x3085 + +/* OpenVG color spaces */ +#define EGL_VG_COLORSPACE_sRGB 0x3089 /* EGL_VG_COLORSPACE value */ +#define EGL_VG_COLORSPACE_LINEAR 0x308A /* EGL_VG_COLORSPACE value */ + +/* OpenVG alpha formats */ +#define EGL_VG_ALPHA_FORMAT_NONPRE 0x308B /* EGL_ALPHA_FORMAT value */ +#define EGL_VG_ALPHA_FORMAT_PRE 0x308C /* EGL_ALPHA_FORMAT value */ + +/* Constant scale factor by which fractional display resolutions & + * aspect ratio are scaled when queried as integer values. + */ +#define EGL_DISPLAY_SCALING 10000 + +/* Unknown display resolution/aspect ratio */ +#define EGL_UNKNOWN ((EGLint)-1) + +/* Back buffer swap behaviors */ +#define EGL_BUFFER_PRESERVED 0x3094 /* EGL_SWAP_BEHAVIOR value */ +#define EGL_BUFFER_DESTROYED 0x3095 /* EGL_SWAP_BEHAVIOR value */ + +/* CreatePbufferFromClientBuffer buffer types */ +#define EGL_OPENVG_IMAGE 0x3096 + +/* QueryContext targets */ +#define EGL_CONTEXT_CLIENT_TYPE 0x3097 + +/* CreateContext attributes */ +#define EGL_CONTEXT_CLIENT_VERSION 0x3098 + +/* Multisample resolution behaviors */ +#define EGL_MULTISAMPLE_RESOLVE_DEFAULT 0x309A /* EGL_MULTISAMPLE_RESOLVE value */ +#define EGL_MULTISAMPLE_RESOLVE_BOX 0x309B /* EGL_MULTISAMPLE_RESOLVE value */ + +/* BindAPI/QueryAPI targets */ +#define EGL_OPENGL_ES_API 0x30A0 +#define EGL_OPENVG_API 0x30A1 +#define EGL_OPENGL_API 0x30A2 + +/* GetCurrentSurface targets */ +#define EGL_DRAW 0x3059 +#define EGL_READ 0x305A + +/* WaitNative engines */ +#define EGL_CORE_NATIVE_ENGINE 0x305B + +/* EGL 1.2 tokens renamed for consistency in EGL 1.3 */ +#define EGL_COLORSPACE EGL_VG_COLORSPACE +#define EGL_ALPHA_FORMAT EGL_VG_ALPHA_FORMAT +#define EGL_COLORSPACE_sRGB EGL_VG_COLORSPACE_sRGB +#define EGL_COLORSPACE_LINEAR EGL_VG_COLORSPACE_LINEAR +#define EGL_ALPHA_FORMAT_NONPRE EGL_VG_ALPHA_FORMAT_NONPRE +#define EGL_ALPHA_FORMAT_PRE EGL_VG_ALPHA_FORMAT_PRE + +/* EGL extensions must request enum blocks from the Khronos + * API Registrar, who maintains the enumerant registry. Submit + * a bug in Khronos Bugzilla against task "Registry". + */ + + + +/* EGL Functions */ + +EGLAPI EGLint EGLAPIENTRY eglGetError(void); + +EGLAPI EGLDisplay EGLAPIENTRY eglGetDisplay(EGLNativeDisplayType display_id); +EGLAPI EGLBoolean EGLAPIENTRY eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor); +EGLAPI EGLBoolean EGLAPIENTRY eglTerminate(EGLDisplay dpy); + +EGLAPI const char * EGLAPIENTRY eglQueryString(EGLDisplay dpy, EGLint name); + +EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigs(EGLDisplay dpy, EGLConfig *configs, + EGLint config_size, EGLint *num_config); +EGLAPI EGLBoolean EGLAPIENTRY eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list, + EGLConfig *configs, EGLint config_size, + EGLint *num_config); +EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config, + EGLint attribute, EGLint *value); + +EGLAPI EGLSurface EGLAPIENTRY eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config, + EGLNativeWindowType win, + const EGLint *attrib_list); +EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config, + const EGLint *attrib_list); +EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config, + EGLNativePixmapType pixmap, + const EGLint *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglDestroySurface(EGLDisplay dpy, EGLSurface surface); +EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurface(EGLDisplay dpy, EGLSurface surface, + EGLint attribute, EGLint *value); + +EGLAPI EGLBoolean EGLAPIENTRY eglBindAPI(EGLenum api); +EGLAPI EGLenum EGLAPIENTRY eglQueryAPI(void); + +EGLAPI EGLBoolean EGLAPIENTRY eglWaitClient(void); + +EGLAPI EGLBoolean EGLAPIENTRY eglReleaseThread(void); + +EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferFromClientBuffer( + EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, + EGLConfig config, const EGLint *attrib_list); + +EGLAPI EGLBoolean EGLAPIENTRY eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface, + EGLint attribute, EGLint value); +EGLAPI EGLBoolean EGLAPIENTRY eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer); +EGLAPI EGLBoolean EGLAPIENTRY eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer); + + +EGLAPI EGLBoolean EGLAPIENTRY eglSwapInterval(EGLDisplay dpy, EGLint interval); + + +EGLAPI EGLContext EGLAPIENTRY eglCreateContext(EGLDisplay dpy, EGLConfig config, + EGLContext share_context, + const EGLint *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglDestroyContext(EGLDisplay dpy, EGLContext ctx); +EGLAPI EGLBoolean EGLAPIENTRY eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, + EGLSurface read, EGLContext ctx); + +EGLAPI EGLContext EGLAPIENTRY eglGetCurrentContext(void); +EGLAPI EGLSurface EGLAPIENTRY eglGetCurrentSurface(EGLint readdraw); +EGLAPI EGLDisplay EGLAPIENTRY eglGetCurrentDisplay(void); +EGLAPI EGLBoolean EGLAPIENTRY eglQueryContext(EGLDisplay dpy, EGLContext ctx, + EGLint attribute, EGLint *value); + +EGLAPI EGLBoolean EGLAPIENTRY eglWaitGL(void); +EGLAPI EGLBoolean EGLAPIENTRY eglWaitNative(EGLint engine); +EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffers(EGLDisplay dpy, EGLSurface surface); +EGLAPI EGLBoolean EGLAPIENTRY eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, + EGLNativePixmapType target); + +/* This is a generic function pointer type, whose name indicates it must + * be cast to the proper type *and calling convention* before use. + */ +typedef void (*__eglMustCastToProperFunctionPointerType)(void); + +/* Now, define eglGetProcAddress using the generic function ptr. type */ +EGLAPI __eglMustCastToProperFunctionPointerType EGLAPIENTRY + eglGetProcAddress(const char *procname); + +#ifdef __cplusplus +} +#endif + +#endif /* __egl_h_ */ diff -Nru lwjgl-2.7.1+dfsg/src/native/common/EGL/eglplatform.h lwjgl-2.9.3+dfsg/src/native/common/EGL/eglplatform.h --- lwjgl-2.7.1+dfsg/src/native/common/EGL/eglplatform.h 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/common/EGL/eglplatform.h 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,110 @@ +#ifndef __eglplatform_h_ +#define __eglplatform_h_ + +/* +** Copyright (c) 2007-2009 The Khronos Group Inc. +** +** Permission is hereby granted, free of charge, to any person obtaining a +** copy of this software and/or associated documentation files (the +** "Materials"), to deal in the Materials without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Materials, and to +** permit persons to whom the Materials are furnished to do so, subject to +** the following conditions: +** +** The above copyright notice and this permission notice shall be included +** in all copies or substantial portions of the Materials. +** +** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. +*/ + +/* Platform-specific types and definitions for egl.h + * $Revision: 9724 $ on $Date: 2009-12-02 02:05:33 -0800 (Wed, 02 Dec 2009) $ + * + * Adopters may modify khrplatform.h and this file to suit their platform. + * You are encouraged to submit all modifications to the Khronos group so that + * they can be included in future versions of this file. Please submit changes + * by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla) + * by filing a bug against product "EGL" component "Registry". + */ + +#include + +/* Macros used in EGL function prototype declarations. + * + * EGL functions should be prototyped as: + * + * EGLAPI return-type EGLAPIENTRY eglFunction(arguments); + * typedef return-type (EXPAPIENTRYP PFNEGLFUNCTIONPROC) (arguments); + * + * KHRONOS_APICALL and KHRONOS_APIENTRY are defined in KHR/khrplatform.h + */ + +#ifndef EGLAPI +#define EGLAPI KHRONOS_APICALL +#endif + +#ifndef EGLAPIENTRY +#define EGLAPIENTRY KHRONOS_APIENTRY +#endif +#define EGLAPIENTRYP EGLAPIENTRY* + +/* The types NativeDisplayType, NativeWindowType, and NativePixmapType + * are aliases of window-system-dependent types, such as X Display * or + * Windows Device Context. They must be defined in platform-specific + * code below. The EGL-prefixed versions of Native*Type are the same + * types, renamed in EGL 1.3 so all types in the API start with "EGL". + */ + +#if defined(_WIN32) || defined(__VC32__) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) /* Win32 and WinCE */ +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN 1 +#endif +#include + +typedef HDC EGLNativeDisplayType; +typedef HBITMAP EGLNativePixmapType; +typedef HWND EGLNativeWindowType; + +#elif defined(__WINSCW__) || defined(__SYMBIAN32__) /* Symbian */ + +typedef int EGLNativeDisplayType; +typedef void *EGLNativeWindowType; +typedef void *EGLNativePixmapType; + +#elif defined(__unix__) + +/* X11 (tentative) */ +#include +#include + +typedef Display *EGLNativeDisplayType; +typedef Pixmap EGLNativePixmapType; +typedef Window EGLNativeWindowType; + +#else +#error "Platform not recognized" +#endif + +/* EGL 1.2 types, renamed for consistency in EGL 1.3 */ +typedef EGLNativeDisplayType NativeDisplayType; +typedef EGLNativePixmapType NativePixmapType; +typedef EGLNativeWindowType NativeWindowType; + + +/* Define EGLint. This must be a signed integral type large enough to contain + * all legal attribute names and values passed into and out of EGL, whether + * their type is boolean, bitmask, enumerant (symbolic constant), integer, + * handle, or other. While in general a 32-bit integer will suffice, if + * handles are 64 bit types, then EGLint should be defined as a signed 64-bit + * integer type. + */ +typedef khronos_int32_t EGLint; + +#endif /* __eglplatform_h */ diff -Nru lwjgl-2.7.1+dfsg/src/native/common/extcl.c lwjgl-2.9.3+dfsg/src/native/common/extcl.c --- lwjgl-2.7.1+dfsg/src/native/common/extcl.c 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/common/extcl.c 2016-04-09 16:26:57.000000000 +0000 @@ -59,7 +59,7 @@ ext_InitializeClass(env, clazz, &extcl_GetProcAddress, num_functions, functions); } -int extcl_CalculateImageSize(const size_t *region, size_t row_pitch, size_t slice_pitch) { +size_t extcl_CalculateImageSize(const size_t *region, size_t row_pitch, size_t slice_pitch) { if ( slice_pitch == 0 ) return region[1] * row_pitch; else diff -Nru lwjgl-2.7.1+dfsg/src/native/common/extcl.h lwjgl-2.9.3+dfsg/src/native/common/extcl.h --- lwjgl-2.7.1+dfsg/src/native/common/extcl.h 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/common/extcl.h 2016-04-09 16:26:57.000000000 +0000 @@ -59,24 +59,18 @@ #define CL_CALLBACK #endif -// TODO: This is a bug in current CL implementations (AMD's only?), remove when fixed. (used for cl_native_kernel_func) -#if defined(_WIN32) - #define CL_USER_FUNC_CALLBACK __cdecl -#else - #define CL_USER_FUNC_CALLBACK CL_CALLBACK -#endif - typedef void (CL_CALLBACK * cl_create_context_callback)(const char *errinfo, const void *private_info, size_t cb, void *user_data); typedef void (CL_CALLBACK * cl_mem_object_destructor_callback)(cl_mem memobj, void *user_data); -typedef void (CL_CALLBACK * cl_build_program_callback)(cl_program program, void *user_data); +typedef void (CL_CALLBACK * cl_program_callback)(cl_program program, void *user_data); typedef void (CL_CALLBACK * cl_event_callback)(cl_event event, cl_int event_command_exec_status, void *user_data); -typedef void (CL_USER_FUNC_CALLBACK * cl_native_kernel_func)(void *args); +typedef void (CL_CALLBACK * cl_native_kernel_func)(void *args); +typedef void (CL_CALLBACK * cl_printf_callback)(cl_context context, cl_uint printf_data_len, char *printf_data_ptr, void *user_data); // -----------------[ Cross-platform functions ]----------------- void* extcl_GetProcAddress(const char* function); void extcl_InitializeClass(JNIEnv *env, jclass clazz, int num_functions, JavaMethodAndExtFunction *functions); -int extcl_CalculateImageSize(const size_t *region, size_t row_pitch, size_t slice_pitch); +size_t extcl_CalculateImageSize(const size_t *region, size_t row_pitch, size_t slice_pitch); // -----------------[ Platform dependent functions ]----------------- diff -Nru lwjgl-2.7.1+dfsg/src/native/common/extcl_types.h lwjgl-2.9.3+dfsg/src/native/common/extcl_types.h --- lwjgl-2.7.1+dfsg/src/native/common/extcl_types.h 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/common/extcl_types.h 2016-04-09 16:26:57.000000000 +0000 @@ -20,8 +20,10 @@ typedef cl_uint cl_device_local_mem_type; typedef cl_bitfield cl_device_exec_capabilities; typedef cl_bitfield cl_command_queue_properties; +typedef intptr_t cl_device_partition_property; +typedef cl_bitfield cl_device_affinity_domain; -typedef intptr_t cl_context_properties; +typedef intptr_t cl_context_properties; typedef cl_uint cl_context_info; typedef cl_uint cl_command_queue_info; typedef cl_uint cl_channel_order; @@ -29,6 +31,7 @@ typedef cl_bitfield cl_mem_flags; typedef cl_uint cl_mem_object_type; typedef cl_uint cl_mem_info; +typedef cl_bitfield cl_mem_migration_flags; typedef cl_uint cl_image_info; typedef cl_uint cl_buffer_create_type; typedef cl_uint cl_addressing_mode; @@ -37,8 +40,12 @@ typedef cl_bitfield cl_map_flags; typedef cl_uint cl_program_info; typedef cl_uint cl_program_build_info; +typedef cl_uint cl_program_binary_type; typedef cl_int cl_build_status; typedef cl_uint cl_kernel_info; +typedef cl_uint cl_kernel_arg_info; +typedef cl_uint cl_kernel_arg_address_qualifier; +typedef cl_uint cl_kernel_arg_access_qualifier; typedef cl_uint cl_kernel_work_group_info; typedef cl_uint cl_event_info; typedef cl_uint cl_command_type; @@ -49,6 +56,19 @@ cl_channel_type image_channel_data_type; } cl_image_format; +typedef struct _cl_image_desc { + cl_mem_object_type image_type; + size_t image_width; + size_t image_height; + size_t image_depth; + size_t image_array_size; + size_t image_row_pitch; + size_t image_slice_pitch; + cl_uint num_mip_levels; + cl_uint num_samples; + cl_mem buffer; +} cl_image_desc; + typedef struct _cl_buffer_region { size_t origin; size_t size; @@ -63,10 +83,13 @@ // -----------------[ Extension typedefs ]----------------- // EXT_device_fission -typedef cl_bitfield cl_device_partition_property_ext; +typedef cl_ulong cl_device_partition_property_ext; // EXT_migrate_memobject typedef cl_bitfield cl_mem_migration_flags_ext; +// KHR_subgroups +typedef cl_uint cl_kernel_sub_group_info; + // -----------------[ Convenience typedefs ]----------------- typedef void cl_void; diff -Nru lwjgl-2.7.1+dfsg/src/native/common/extgl.c lwjgl-2.9.3+dfsg/src/native/common/extgl.c --- lwjgl-2.7.1+dfsg/src/native/common/extgl.c 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/common/extgl.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,83 +0,0 @@ -/* ---------------------------------------------------------------------------- -Copyright (c) 2001-2002, Lev Povalahev -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * The name of the author may be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, -INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, -OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF -THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------*/ -/* - Lev Povalahev - - levp@gmx.net - - http://www.uni-karlsruhe.de/~uli2/ - -*/ - -#include -#include -#include "extgl.h" -#include "common_tools.h" - -void extgl_InitializeClass(JNIEnv *env, jclass clazz, int num_functions, JavaMethodAndExtFunction *functions) { - ext_InitializeClass(env, clazz, &extgl_GetProcAddress, num_functions, functions); -} - -bool extgl_InitializeFunctions(int num_functions, ExtFunction *functions) { - return ext_InitializeFunctions(&extgl_GetProcAddress, num_functions, functions); -} - -bool extgl_QueryExtension(const GLubyte*extensions, const char *name) -{ - const GLubyte *start; - GLubyte *where, *terminator; - - if (extensions == NULL) { - printfDebug("NULL extension string\n"); - return false; - } - - /* Extension names should not have spaces. */ - where = (GLubyte *) strchr(name, ' '); - if (where || *name == '\0') - return false; - - /* It takes a bit of care to be fool-proof about parsing the - OpenGL extensions string. Don't be fooled by sub-strings, - etc. */ - start = extensions; - for (;;) - { - where = (GLubyte *) strstr((const char *) start, name); - if (!where) - break; - terminator = where + strlen(name); - if (where == start || *(where - 1) == ' ') - if (*terminator == ' ' || *terminator == '\0') { - return true; - } - start = terminator; - } - return false; - -} - diff -Nru lwjgl-2.7.1+dfsg/src/native/common/extgl.h lwjgl-2.9.3+dfsg/src/native/common/extgl.h --- lwjgl-2.7.1+dfsg/src/native/common/extgl.h 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/common/extgl.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,106 +0,0 @@ -/* Small parts were taken from Mesa's glext.h and gl.h, here's the license: */ - -/* - * Mesa 3-D graphics library - * Version: 6.5.1 - * - * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -/* Some parts derived from files copyright (c) 2001-2002 Lev Povalahev under this license: */ - -/* ---------------------------------------------------------------------------- -Copyright (c) 2002, Lev Povalahev -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * The name of the author may be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, -INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, -OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF -THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------*/ -/* - GL_draw_range_elements support added by Benjamin Karaban - - Lev Povalahev contact information: - - levp@gmx.net - - http://www.uni-karlsruhe.de/~uli2/ -*/ - -#ifndef __EXTGL_H__ -#define __EXTGL_H__ - -#include - -#include -#include - -#ifdef __APPLE__ - #include -#else - #include -#endif - -#include "common_tools.h" - -#if defined(_WIN32) || defined(_WIN64) - #include // fix APIENTRY macro redefinition -#endif - -#ifndef APIENTRY - #define APIENTRY -#endif - -#include "extcl_types.h" -#include "extgl_types.h" - -/* AMD_debug_output callback function pointer. */ -typedef void (APIENTRY *GLDEBUGPROCAMD)(GLuint id, GLenum category, GLenum severity, GLsizei length, const GLchar* message, GLvoid* userParam); - -/* ARB_debug_output callback function pointer. */ -typedef void (APIENTRY *GLDEBUGPROCARB)(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message, GLvoid* userParam); - -/* initializes everything, call this right after the rc is created. the function returns true if successful */ -extern bool extgl_Open(JNIEnv *env); -extern void extgl_Close(void); -extern void extgl_InitializeClass(JNIEnv *env, jclass clazz, int num_functions, JavaMethodAndExtFunction *functions); -extern bool extgl_InitializeFunctions(int num_functions, ExtFunction *functions); -extern bool extgl_QueryExtension(const GLubyte*extensions, const char *name); -extern void *extgl_GetProcAddress(const char *name); - -#endif /* __EXTGL_H__ */ diff -Nru lwjgl-2.7.1+dfsg/src/native/common/extgl_types.h lwjgl-2.9.3+dfsg/src/native/common/extgl_types.h --- lwjgl-2.7.1+dfsg/src/native/common/extgl_types.h 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/common/extgl_types.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,55 +0,0 @@ -#if defined(_WIN32) || defined(_WIN64) - #define int64_t __int64 - #define uint64_t unsigned __int64 -#endif - -#ifdef _MACOSX - typedef unsigned long GLenum; - typedef unsigned char GLboolean; - typedef unsigned long GLbitfield; - typedef signed char GLbyte; - typedef short GLshort; - typedef long GLint; - typedef long GLsizei; - typedef unsigned char GLubyte; - typedef unsigned short GLushort; - typedef unsigned long GLuint; - typedef float GLfloat; - typedef float GLclampf; - typedef double GLdouble; - typedef double GLclampd; - typedef void GLvoid; -#else - typedef unsigned int GLenum; - typedef unsigned char GLboolean; - typedef unsigned int GLbitfield; - typedef void GLvoid; - typedef signed char GLbyte; /* 1-byte signed */ - typedef short GLshort; /* 2-byte signed */ - typedef int GLint; /* 4-byte signed */ - typedef unsigned char GLubyte; /* 1-byte unsigned */ - typedef unsigned short GLushort; /* 2-byte unsigned */ - typedef unsigned int GLuint; /* 4-byte unsigned */ - typedef int GLsizei; /* 4-byte signed */ - typedef float GLfloat; /* single precision float */ - typedef float GLclampf; /* single precision float in [0,1] */ - typedef double GLdouble; /* double precision float */ - typedef double GLclampd; /* double precision float in [0,1] */ -#endif - -typedef char GLchar; /* native character */ - -typedef ptrdiff_t GLintptr; -typedef ptrdiff_t GLsizeiptr; -typedef ptrdiff_t GLintptrARB; -typedef ptrdiff_t GLsizeiptrARB; -typedef char GLcharARB; /* native character */ -typedef unsigned int GLhandleARB; /* shader object handle */ -typedef unsigned short GLhalfARB; -typedef unsigned short GLhalfNV; -typedef unsigned short GLhalf; -typedef int64_t GLint64EXT; -typedef uint64_t GLuint64EXT; -typedef int64_t GLint64; -typedef uint64_t GLuint64; -typedef struct __GLsync * GLsync; \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/native/common/GLES2/gl2ext.h lwjgl-2.9.3+dfsg/src/native/common/GLES2/gl2ext.h --- lwjgl-2.7.1+dfsg/src/native/common/GLES2/gl2ext.h 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/common/GLES2/gl2ext.h 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,803 @@ +#ifndef __gl2ext_h_ +#define __gl2ext_h_ + +/* $Revision: 10969 $ on $Date:: 2010-04-09 02:27:15 -0700 #$ */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * This document is licensed under the SGI Free Software B License Version + * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ . + */ + +#ifndef GL_APIENTRYP +# define GL_APIENTRYP GL_APIENTRY* +#endif + +/*------------------------------------------------------------------------* + * OES extension tokens + *------------------------------------------------------------------------*/ + +/* GL_OES_compressed_ETC1_RGB8_texture */ +#ifndef GL_OES_compressed_ETC1_RGB8_texture +#define GL_ETC1_RGB8_OES 0x8D64 +#endif + +/* GL_OES_compressed_paletted_texture */ +#ifndef GL_OES_compressed_paletted_texture +#define GL_PALETTE4_RGB8_OES 0x8B90 +#define GL_PALETTE4_RGBA8_OES 0x8B91 +#define GL_PALETTE4_R5_G6_B5_OES 0x8B92 +#define GL_PALETTE4_RGBA4_OES 0x8B93 +#define GL_PALETTE4_RGB5_A1_OES 0x8B94 +#define GL_PALETTE8_RGB8_OES 0x8B95 +#define GL_PALETTE8_RGBA8_OES 0x8B96 +#define GL_PALETTE8_R5_G6_B5_OES 0x8B97 +#define GL_PALETTE8_RGBA4_OES 0x8B98 +#define GL_PALETTE8_RGB5_A1_OES 0x8B99 +#endif + +/* GL_OES_depth24 */ +#ifndef GL_OES_depth24 +#define GL_DEPTH_COMPONENT24_OES 0x81A6 +#endif + +/* GL_OES_depth32 */ +#ifndef GL_OES_depth32 +#define GL_DEPTH_COMPONENT32_OES 0x81A7 +#endif + +/* GL_OES_depth_texture */ +/* No new tokens introduced by this extension. */ + +/* GL_OES_EGL_image */ +#ifndef GL_OES_EGL_image +typedef void* GLeglImageOES; +#endif + +/* GL_OES_element_index_uint */ +#ifndef GL_OES_element_index_uint +#define GL_UNSIGNED_INT 0x1405 +#endif + +/* GL_OES_get_program_binary */ +#ifndef GL_OES_get_program_binary +#define GL_PROGRAM_BINARY_LENGTH_OES 0x8741 +#define GL_NUM_PROGRAM_BINARY_FORMATS_OES 0x87FE +#define GL_PROGRAM_BINARY_FORMATS_OES 0x87FF +#endif + +/* GL_OES_mapbuffer */ +#ifndef GL_OES_mapbuffer +#define GL_WRITE_ONLY_OES 0x88B9 +#define GL_BUFFER_ACCESS_OES 0x88BB +#define GL_BUFFER_MAPPED_OES 0x88BC +#define GL_BUFFER_MAP_POINTER_OES 0x88BD +#endif + +/* GL_OES_packed_depth_stencil */ +#ifndef GL_OES_packed_depth_stencil +#define GL_DEPTH_STENCIL_OES 0x84F9 +#define GL_UNSIGNED_INT_24_8_OES 0x84FA +#define GL_DEPTH24_STENCIL8_OES 0x88F0 +#endif + +/* GL_OES_rgb8_rgba8 */ +#ifndef GL_OES_rgb8_rgba8 +#define GL_RGB8_OES 0x8051 +#define GL_RGBA8_OES 0x8058 +#endif + +/* GL_OES_standard_derivatives */ +#ifndef GL_OES_standard_derivatives +#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES 0x8B8B +#endif + +/* GL_OES_stencil1 */ +#ifndef GL_OES_stencil1 +#define GL_STENCIL_INDEX1_OES 0x8D46 +#endif + +/* GL_OES_stencil4 */ +#ifndef GL_OES_stencil4 +#define GL_STENCIL_INDEX4_OES 0x8D47 +#endif + +/* GL_OES_texture_3D */ +#ifndef GL_OES_texture_3D +#define GL_TEXTURE_WRAP_R_OES 0x8072 +#define GL_TEXTURE_3D_OES 0x806F +#define GL_TEXTURE_BINDING_3D_OES 0x806A +#define GL_MAX_3D_TEXTURE_SIZE_OES 0x8073 +#define GL_SAMPLER_3D_OES 0x8B5F +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_OES 0x8CD4 +#endif + +/* GL_OES_texture_float */ +/* No new tokens introduced by this extension. */ + +/* GL_OES_texture_float_linear */ +/* No new tokens introduced by this extension. */ + +/* GL_OES_texture_half_float */ +#ifndef GL_OES_texture_half_float +#define GL_HALF_FLOAT_OES 0x8D61 +#endif + +/* GL_OES_texture_half_float_linear */ +/* No new tokens introduced by this extension. */ + +/* GL_OES_texture_npot */ +/* No new tokens introduced by this extension. */ + +/* GL_OES_vertex_array_object */ +#ifndef GL_OES_vertex_array_object +#define GL_VERTEX_ARRAY_BINDING_OES 0x85B5 +#endif + +/* GL_OES_vertex_half_float */ +/* GL_HALF_FLOAT_OES defined in GL_OES_texture_half_float already. */ + +/* GL_OES_vertex_type_10_10_10_2 */ +#ifndef GL_OES_vertex_type_10_10_10_2 +#define GL_UNSIGNED_INT_10_10_10_2_OES 0x8DF6 +#define GL_INT_10_10_10_2_OES 0x8DF7 +#endif + +/*------------------------------------------------------------------------* + * AMD extension tokens + *------------------------------------------------------------------------*/ + +/* GL_AMD_compressed_3DC_texture */ +#ifndef GL_AMD_compressed_3DC_texture +#define GL_3DC_X_AMD 0x87F9 +#define GL_3DC_XY_AMD 0x87FA +#endif + +/* GL_AMD_compressed_ATC_texture */ +#ifndef GL_AMD_compressed_ATC_texture +#define GL_ATC_RGB_AMD 0x8C92 +#define GL_ATC_RGBA_EXPLICIT_ALPHA_AMD 0x8C93 +#define GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD 0x87EE +#endif + +/* GL_AMD_performance_monitor */ +#ifndef GL_AMD_performance_monitor +#define GL_COUNTER_TYPE_AMD 0x8BC0 +#define GL_COUNTER_RANGE_AMD 0x8BC1 +#define GL_UNSIGNED_INT64_AMD 0x8BC2 +#define GL_PERCENTAGE_AMD 0x8BC3 +#define GL_PERFMON_RESULT_AVAILABLE_AMD 0x8BC4 +#define GL_PERFMON_RESULT_SIZE_AMD 0x8BC5 +#define GL_PERFMON_RESULT_AMD 0x8BC6 +#endif + +/* GL_AMD_program_binary_Z400 */ +#ifndef GL_AMD_program_binary_Z400 +#define GL_Z400_BINARY_AMD 0x8740 +#endif + +/*------------------------------------------------------------------------* + * EXT extension tokens + *------------------------------------------------------------------------*/ + +/* GL_EXT_blend_minmax */ +#ifndef GL_EXT_blend_minmax +#define GL_MIN_EXT 0x8007 +#define GL_MAX_EXT 0x8008 +#endif + +/* GL_EXT_discard_framebuffer */ +#ifndef GL_EXT_discard_framebuffer +#define GL_COLOR_EXT 0x1800 +#define GL_DEPTH_EXT 0x1801 +#define GL_STENCIL_EXT 0x1802 +#endif + +/* GL_EXT_multi_draw_arrays */ +/* No new tokens introduced by this extension. */ + +/* GL_EXT_read_format_bgra */ +#ifndef GL_EXT_read_format_bgra +#define GL_BGRA_EXT 0x80E1 +#define GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT 0x8365 +#define GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT 0x8366 +#endif + +/* GL_EXT_texture_filter_anisotropic */ +#ifndef GL_EXT_texture_filter_anisotropic +#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE +#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF +#endif + +/* GL_EXT_texture_format_BGRA8888 */ +#ifndef GL_EXT_texture_format_BGRA8888 +#define GL_BGRA_EXT 0x80E1 +#endif + +/* GL_EXT_texture_type_2_10_10_10_REV */ +#ifndef GL_EXT_texture_type_2_10_10_10_REV +#define GL_UNSIGNED_INT_2_10_10_10_REV_EXT 0x8368 +#endif + +/* GL_EXT_texture_compression_dxt1 */ +#ifndef GL_EXT_texture_compression_dxt1 +#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0 +#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1 +#endif + +/*------------------------------------------------------------------------* + * IMG extension tokens + *------------------------------------------------------------------------*/ + +/* GL_IMG_program_binary */ +#ifndef GL_IMG_program_binary +#define GL_SGX_PROGRAM_BINARY_IMG 0x9130 +#endif + +/* GL_IMG_read_format */ +#ifndef GL_IMG_read_format +#define GL_BGRA_IMG 0x80E1 +#define GL_UNSIGNED_SHORT_4_4_4_4_REV_IMG 0x8365 +#endif + +/* GL_IMG_shader_binary */ +#ifndef GL_IMG_shader_binary +#define GL_SGX_BINARY_IMG 0x8C0A +#endif + +/* GL_IMG_texture_compression_pvrtc */ +#ifndef GL_IMG_texture_compression_pvrtc +#define GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG 0x8C00 +#define GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG 0x8C01 +#define GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG 0x8C02 +#define GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG 0x8C03 +#endif + +/* GL_IMG_multisampled_render_to_texture */ +#ifndef GL_IMG_multisampled_render_to_texture +#define GL_RENDERBUFFER_SAMPLES_IMG 0x9133 +#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_IMG 0x9134 +#define GL_MAX_SAMPLES_IMG 0x9135 +#define GL_TEXTURE_SAMPLES_IMG 0x9136 +#endif + +/*------------------------------------------------------------------------* + * NV extension tokens + *------------------------------------------------------------------------*/ + +/* GL_NV_fence */ +#ifndef GL_NV_fence +#define GL_ALL_COMPLETED_NV 0x84F2 +#define GL_FENCE_STATUS_NV 0x84F3 +#define GL_FENCE_CONDITION_NV 0x84F4 +#endif + +/* GL_NV_coverage_sample */ +#ifndef GL_NV_coverage_sample +#define GL_COVERAGE_COMPONENT_NV 0x8ED0 +#define GL_COVERAGE_COMPONENT4_NV 0x8ED1 +#define GL_COVERAGE_ATTACHMENT_NV 0x8ED2 +#define GL_COVERAGE_BUFFERS_NV 0x8ED3 +#define GL_COVERAGE_SAMPLES_NV 0x8ED4 +#define GL_COVERAGE_ALL_FRAGMENTS_NV 0x8ED5 +#define GL_COVERAGE_EDGE_FRAGMENTS_NV 0x8ED6 +#define GL_COVERAGE_AUTOMATIC_NV 0x8ED7 +#define GL_COVERAGE_BUFFER_BIT_NV 0x8000 +#endif + +/* GL_NV_depth_nonlinear */ +#ifndef GL_NV_depth_nonlinear +#define GL_DEPTH_COMPONENT16_NONLINEAR_NV 0x8E2C +#endif + +/*------------------------------------------------------------------------* + * QCOM extension tokens + *------------------------------------------------------------------------*/ + +/* GL_QCOM_driver_control */ +/* No new tokens introduced by this extension. */ + +/* GL_QCOM_extended_get */ +#ifndef GL_QCOM_extended_get +#define GL_TEXTURE_WIDTH_QCOM 0x8BD2 +#define GL_TEXTURE_HEIGHT_QCOM 0x8BD3 +#define GL_TEXTURE_DEPTH_QCOM 0x8BD4 +#define GL_TEXTURE_INTERNAL_FORMAT_QCOM 0x8BD5 +#define GL_TEXTURE_FORMAT_QCOM 0x8BD6 +#define GL_TEXTURE_TYPE_QCOM 0x8BD7 +#define GL_TEXTURE_IMAGE_VALID_QCOM 0x8BD8 +#define GL_TEXTURE_NUM_LEVELS_QCOM 0x8BD9 +#define GL_TEXTURE_TARGET_QCOM 0x8BDA +#define GL_TEXTURE_OBJECT_VALID_QCOM 0x8BDB +#define GL_STATE_RESTORE 0x8BDC +#endif + +/* GL_QCOM_extended_get2 */ +/* No new tokens introduced by this extension. */ + +/* GL_QCOM_perfmon_global_mode */ +#ifndef GL_QCOM_perfmon_global_mode +#define GL_PERFMON_GLOBAL_MODE_QCOM 0x8FA0 +#endif + +/* GL_QCOM_writeonly_rendering */ +#ifndef GL_QCOM_writeonly_rendering +#define GL_WRITEONLY_RENDERING_QCOM 0x8823 +#endif + +/* GL_QCOM_tiled_rendering */ +#ifndef GL_QCOM_tiled_rendering +#define GL_COLOR_BUFFER_BIT0_QCOM 0x00000001 +#define GL_COLOR_BUFFER_BIT1_QCOM 0x00000002 +#define GL_COLOR_BUFFER_BIT2_QCOM 0x00000004 +#define GL_COLOR_BUFFER_BIT3_QCOM 0x00000008 +#define GL_COLOR_BUFFER_BIT4_QCOM 0x00000010 +#define GL_COLOR_BUFFER_BIT5_QCOM 0x00000020 +#define GL_COLOR_BUFFER_BIT6_QCOM 0x00000040 +#define GL_COLOR_BUFFER_BIT7_QCOM 0x00000080 +#define GL_DEPTH_BUFFER_BIT0_QCOM 0x00000100 +#define GL_DEPTH_BUFFER_BIT1_QCOM 0x00000200 +#define GL_DEPTH_BUFFER_BIT2_QCOM 0x00000400 +#define GL_DEPTH_BUFFER_BIT3_QCOM 0x00000800 +#define GL_DEPTH_BUFFER_BIT4_QCOM 0x00001000 +#define GL_DEPTH_BUFFER_BIT5_QCOM 0x00002000 +#define GL_DEPTH_BUFFER_BIT6_QCOM 0x00004000 +#define GL_DEPTH_BUFFER_BIT7_QCOM 0x00008000 +#define GL_STENCIL_BUFFER_BIT0_QCOM 0x00010000 +#define GL_STENCIL_BUFFER_BIT1_QCOM 0x00020000 +#define GL_STENCIL_BUFFER_BIT2_QCOM 0x00040000 +#define GL_STENCIL_BUFFER_BIT3_QCOM 0x00080000 +#define GL_STENCIL_BUFFER_BIT4_QCOM 0x00100000 +#define GL_STENCIL_BUFFER_BIT5_QCOM 0x00200000 +#define GL_STENCIL_BUFFER_BIT6_QCOM 0x00400000 +#define GL_STENCIL_BUFFER_BIT7_QCOM 0x00800000 +#define GL_MULTISAMPLE_BUFFER_BIT0_QCOM 0x01000000 +#define GL_MULTISAMPLE_BUFFER_BIT1_QCOM 0x02000000 +#define GL_MULTISAMPLE_BUFFER_BIT2_QCOM 0x04000000 +#define GL_MULTISAMPLE_BUFFER_BIT3_QCOM 0x08000000 +#define GL_MULTISAMPLE_BUFFER_BIT4_QCOM 0x10000000 +#define GL_MULTISAMPLE_BUFFER_BIT5_QCOM 0x20000000 +#define GL_MULTISAMPLE_BUFFER_BIT6_QCOM 0x40000000 +#define GL_MULTISAMPLE_BUFFER_BIT7_QCOM 0x80000000 +#endif + +/*------------------------------------------------------------------------* + * End of extension tokens, start of corresponding extension functions + *------------------------------------------------------------------------*/ + +/*------------------------------------------------------------------------* + * OES extension functions + *------------------------------------------------------------------------*/ + +/* GL_OES_compressed_ETC1_RGB8_texture */ +#ifndef GL_OES_compressed_ETC1_RGB8_texture +#define GL_OES_compressed_ETC1_RGB8_texture 1 +#endif + +/* GL_OES_compressed_paletted_texture */ +#ifndef GL_OES_compressed_paletted_texture +#define GL_OES_compressed_paletted_texture 1 +#endif + +/* GL_OES_depth24 */ +#ifndef GL_OES_depth24 +#define GL_OES_depth24 1 +#endif + +/* GL_OES_depth32 */ +#ifndef GL_OES_depth32 +#define GL_OES_depth32 1 +#endif + +/* GL_OES_depth_texture */ +#ifndef GL_OES_depth_texture +#define GL_OES_depth_texture 1 +#endif + +/* GL_OES_EGL_image */ +#ifndef GL_OES_EGL_image +#define GL_OES_EGL_image 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glEGLImageTargetTexture2DOES (GLenum target, GLeglImageOES image); +GL_APICALL void GL_APIENTRY glEGLImageTargetRenderbufferStorageOES (GLenum target, GLeglImageOES image); +#endif +typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETTEXTURE2DOESPROC) (GLenum target, GLeglImageOES image); +typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC) (GLenum target, GLeglImageOES image); +#endif + +/* GL_OES_element_index_uint */ +#ifndef GL_OES_element_index_uint +#define GL_OES_element_index_uint 1 +#endif + +/* GL_OES_fbo_render_mipmap */ +#ifndef GL_OES_fbo_render_mipmap +#define GL_OES_fbo_render_mipmap 1 +#endif + +/* GL_OES_fragment_precision_high */ +#ifndef GL_OES_fragment_precision_high +#define GL_OES_fragment_precision_high 1 +#endif + +/* GL_OES_get_program_binary */ +#ifndef GL_OES_get_program_binary +#define GL_OES_get_program_binary 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glGetProgramBinaryOES (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary); +GL_APICALL void GL_APIENTRY glProgramBinaryOES (GLuint program, GLenum binaryFormat, const GLvoid *binary, GLint length); +#endif +typedef void (GL_APIENTRYP PFNGLGETPROGRAMBINARYOESPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary); +typedef void (GL_APIENTRYP PFNGLPROGRAMBINARYOESPROC) (GLuint program, GLenum binaryFormat, const GLvoid *binary, GLint length); +#endif + +/* GL_OES_mapbuffer */ +#ifndef GL_OES_mapbuffer +#define GL_OES_mapbuffer 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void* GL_APIENTRY glMapBufferOES (GLenum target, GLenum access); +GL_APICALL GLboolean GL_APIENTRY glUnmapBufferOES (GLenum target); +GL_APICALL void GL_APIENTRY glGetBufferPointervOES (GLenum target, GLenum pname, GLvoid** params); +#endif +typedef void* (GL_APIENTRYP PFNGLMAPBUFFEROESPROC) (GLenum target, GLenum access); +typedef GLboolean (GL_APIENTRYP PFNGLUNMAPBUFFEROESPROC) (GLenum target); +typedef void (GL_APIENTRYP PFNGLGETBUFFERPOINTERVOESPROC) (GLenum target, GLenum pname, GLvoid** params); +#endif + +/* GL_OES_packed_depth_stencil */ +#ifndef GL_OES_packed_depth_stencil +#define GL_OES_packed_depth_stencil 1 +#endif + +/* GL_OES_rgb8_rgba8 */ +#ifndef GL_OES_rgb8_rgba8 +#define GL_OES_rgb8_rgba8 1 +#endif + +/* GL_OES_standard_derivatives */ +#ifndef GL_OES_standard_derivatives +#define GL_OES_standard_derivatives 1 +#endif + +/* GL_OES_stencil1 */ +#ifndef GL_OES_stencil1 +#define GL_OES_stencil1 1 +#endif + +/* GL_OES_stencil4 */ +#ifndef GL_OES_stencil4 +#define GL_OES_stencil4 1 +#endif + +/* GL_OES_texture_3D */ +#ifndef GL_OES_texture_3D +#define GL_OES_texture_3D 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glTexImage3DOES (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels); +GL_APICALL void GL_APIENTRY glTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels); +GL_APICALL void GL_APIENTRY glCopyTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +GL_APICALL void GL_APIENTRY glCompressedTexImage3DOES (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data); +GL_APICALL void GL_APIENTRY glCompressedTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data); +GL_APICALL void GL_APIENTRY glFramebufferTexture3DOES (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); +#endif +typedef void (GL_APIENTRYP PFNGLTEXIMAGE3DOESPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels); +typedef void (GL_APIENTRYP PFNGLTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels); +typedef void (GL_APIENTRYP PFNGLCOPYTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DOESPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data); +typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data); +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE3DOES) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); +#endif + +/* GL_OES_texture_float */ +#ifndef GL_OES_texture_float +#define GL_OES_texture_float 1 +#endif + +/* GL_OES_texture_float_linear */ +#ifndef GL_OES_texture_float_linear +#define GL_OES_texture_float_linear 1 +#endif + +/* GL_OES_texture_half_float */ +#ifndef GL_OES_texture_half_float +#define GL_OES_texture_half_float 1 +#endif + +/* GL_OES_texture_half_float_linear */ +#ifndef GL_OES_texture_half_float_linear +#define GL_OES_texture_half_float_linear 1 +#endif + +/* GL_OES_texture_npot */ +#ifndef GL_OES_texture_npot +#define GL_OES_texture_npot 1 +#endif + +/* GL_OES_vertex_array_object */ +#ifndef GL_OES_vertex_array_object +#define GL_OES_vertex_array_object 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glBindVertexArrayOES (GLuint array); +GL_APICALL void GL_APIENTRY glDeleteVertexArraysOES (GLsizei n, const GLuint *arrays); +GL_APICALL void GL_APIENTRY glGenVertexArraysOES (GLsizei n, GLuint *arrays); +GL_APICALL GLboolean GL_APIENTRY glIsVertexArrayOES (GLuint array); +#endif +typedef void (GL_APIENTRYP PFNGLBINDVERTEXARRAYOESPROC) (GLuint array); +typedef void (GL_APIENTRYP PFNGLDELETEVERTEXARRAYSOESPROC) (GLsizei n, const GLuint *arrays); +typedef void (GL_APIENTRYP PFNGLGENVERTEXARRAYSOESPROC) (GLsizei n, GLuint *arrays); +typedef GLboolean (GL_APIENTRYP PFNGLISVERTEXARRAYOESPROC) (GLuint array); +#endif + +/* GL_OES_vertex_half_float */ +#ifndef GL_OES_vertex_half_float +#define GL_OES_vertex_half_float 1 +#endif + +/* GL_OES_vertex_type_10_10_10_2 */ +#ifndef GL_OES_vertex_type_10_10_10_2 +#define GL_OES_vertex_type_10_10_10_2 1 +#endif + +/*------------------------------------------------------------------------* + * AMD extension functions + *------------------------------------------------------------------------*/ + +/* GL_AMD_compressed_3DC_texture */ +#ifndef GL_AMD_compressed_3DC_texture +#define GL_AMD_compressed_3DC_texture 1 +#endif + +/* GL_AMD_compressed_ATC_texture */ +#ifndef GL_AMD_compressed_ATC_texture +#define GL_AMD_compressed_ATC_texture 1 +#endif + +/* AMD_performance_monitor */ +#ifndef GL_AMD_performance_monitor +#define GL_AMD_performance_monitor 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glGetPerfMonitorGroupsAMD (GLint *numGroups, GLsizei groupsSize, GLuint *groups); +GL_APICALL void GL_APIENTRY glGetPerfMonitorCountersAMD (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters); +GL_APICALL void GL_APIENTRY glGetPerfMonitorGroupStringAMD (GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString); +GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterStringAMD (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString); +GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterInfoAMD (GLuint group, GLuint counter, GLenum pname, GLvoid *data); +GL_APICALL void GL_APIENTRY glGenPerfMonitorsAMD (GLsizei n, GLuint *monitors); +GL_APICALL void GL_APIENTRY glDeletePerfMonitorsAMD (GLsizei n, GLuint *monitors); +GL_APICALL void GL_APIENTRY glSelectPerfMonitorCountersAMD (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *countersList); +GL_APICALL void GL_APIENTRY glBeginPerfMonitorAMD (GLuint monitor); +GL_APICALL void GL_APIENTRY glEndPerfMonitorAMD (GLuint monitor); +GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterDataAMD (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten); +#endif +typedef void (GL_APIENTRYP PFNGLGETPERFMONITORGROUPSAMDPROC) (GLint *numGroups, GLsizei groupsSize, GLuint *groups); +typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERSAMDPROC) (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters); +typedef void (GL_APIENTRYP PFNGLGETPERFMONITORGROUPSTRINGAMDPROC) (GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString); +typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERSTRINGAMDPROC) (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString); +typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERINFOAMDPROC) (GLuint group, GLuint counter, GLenum pname, GLvoid *data); +typedef void (GL_APIENTRYP PFNGLGENPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors); +typedef void (GL_APIENTRYP PFNGLDELETEPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors); +typedef void (GL_APIENTRYP PFNGLSELECTPERFMONITORCOUNTERSAMDPROC) (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *countersList); +typedef void (GL_APIENTRYP PFNGLBEGINPERFMONITORAMDPROC) (GLuint monitor); +typedef void (GL_APIENTRYP PFNGLENDPERFMONITORAMDPROC) (GLuint monitor); +typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERDATAAMDPROC) (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten); +#endif + +/* GL_AMD_program_binary_Z400 */ +#ifndef GL_AMD_program_binary_Z400 +#define GL_AMD_program_binary_Z400 1 +#endif + +/*------------------------------------------------------------------------* + * EXT extension functions + *------------------------------------------------------------------------*/ + +/* GL_EXT_blend_minmax */ +#ifndef GL_EXT_blend_minmax +#define GL_EXT_blend_minmax 1 +#endif + +/* GL_EXT_discard_framebuffer */ +#ifndef GL_EXT_discard_framebuffer +#define GL_EXT_discard_framebuffer 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glDiscardFramebufferEXT (GLenum target, GLsizei numAttachments, const GLenum *attachments); +#endif +typedef void (GL_APIENTRYP PFNGLDISCARDFRAMEBUFFEREXTPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments); +#endif + +#ifndef GL_EXT_multi_draw_arrays +#define GL_EXT_multi_draw_arrays 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glMultiDrawArraysEXT (GLenum, GLint *, GLsizei *, GLsizei); +GL_APICALL void GL_APIENTRY glMultiDrawElementsEXT (GLenum, const GLsizei *, GLenum, const GLvoid* *, GLsizei); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (GL_APIENTRYP PFNGLMULTIDRAWARRAYSEXTPROC) (GLenum mode, GLint *first, GLsizei *count, GLsizei primcount); +typedef void (GL_APIENTRYP PFNGLMULTIDRAWELEMENTSEXTPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount); +#endif + +/* GL_EXT_read_format_bgra */ +#ifndef GL_EXT_read_format_bgra +#define GL_EXT_read_format_bgra 1 +#endif + +/* GL_EXT_texture_filter_anisotropic */ +#ifndef GL_EXT_texture_filter_anisotropic +#define GL_EXT_texture_filter_anisotropic 1 +#endif + +/* GL_EXT_texture_format_BGRA8888 */ +#ifndef GL_EXT_texture_format_BGRA8888 +#define GL_EXT_texture_format_BGRA8888 1 +#endif + +/* GL_EXT_texture_type_2_10_10_10_REV */ +#ifndef GL_EXT_texture_type_2_10_10_10_REV +#define GL_EXT_texture_type_2_10_10_10_REV 1 +#endif + +/* GL_EXT_texture_compression_dxt1 */ +#ifndef GL_EXT_texture_compression_dxt1 +#define GL_EXT_texture_compression_dxt1 1 +#endif + +/*------------------------------------------------------------------------* + * IMG extension functions + *------------------------------------------------------------------------*/ + +/* GL_IMG_program_binary */ +#ifndef GL_IMG_program_binary +#define GL_IMG_program_binary 1 +#endif + +/* GL_IMG_read_format */ +#ifndef GL_IMG_read_format +#define GL_IMG_read_format 1 +#endif + +/* GL_IMG_shader_binary */ +#ifndef GL_IMG_shader_binary +#define GL_IMG_shader_binary 1 +#endif + +/* GL_IMG_texture_compression_pvrtc */ +#ifndef GL_IMG_texture_compression_pvrtc +#define GL_IMG_texture_compression_pvrtc 1 +#endif + +/* GL_IMG_multisampled_render_to_texture */ +#ifndef GL_IMG_multisampled_render_to_texture +#define GL_IMG_multisampled_render_to_texture 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleIMG (GLenum, GLsizei, GLenum, GLsizei, GLsizei); +GL_APICALL void GL_APIENTRY glFramebufferTexture2DMultisampleIMG (GLenum, GLenum, GLenum, GLuint, GLint, GLsizei); +#endif +typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEIMG) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP PFNGLCLIPPLANEXIMG) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples); +#endif + +/*------------------------------------------------------------------------* + * NV extension functions + *------------------------------------------------------------------------*/ + +/* GL_NV_fence */ +#ifndef GL_NV_fence +#define GL_NV_fence 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glDeleteFencesNV (GLsizei, const GLuint *); +GL_APICALL void GL_APIENTRY glGenFencesNV (GLsizei, GLuint *); +GL_APICALL GLboolean GL_APIENTRY glIsFenceNV (GLuint); +GL_APICALL GLboolean GL_APIENTRY glTestFenceNV (GLuint); +GL_APICALL void GL_APIENTRY glGetFenceivNV (GLuint, GLenum, GLint *); +GL_APICALL void GL_APIENTRY glFinishFenceNV (GLuint); +GL_APICALL void GL_APIENTRY glSetFenceNV (GLuint, GLenum); +#endif +typedef void (GL_APIENTRYP PFNGLDELETEFENCESNVPROC) (GLsizei n, const GLuint *fences); +typedef void (GL_APIENTRYP PFNGLGENFENCESNVPROC) (GLsizei n, GLuint *fences); +typedef GLboolean (GL_APIENTRYP PFNGLISFENCENVPROC) (GLuint fence); +typedef GLboolean (GL_APIENTRYP PFNGLTESTFENCENVPROC) (GLuint fence); +typedef void (GL_APIENTRYP PFNGLGETFENCEIVNVPROC) (GLuint fence, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLFINISHFENCENVPROC) (GLuint fence); +typedef void (GL_APIENTRYP PFNGLSETFENCENVPROC) (GLuint fence, GLenum condition); +#endif + +/* GL_NV_coverage_sample */ +#ifndef GL_NV_coverage_sample +#define GL_NV_coverage_sample 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glCoverageMaskNV (GLboolean mask); +GL_APICALL void GL_APIENTRY glCoverageOperationNV (GLenum operation); +#endif +typedef void (GL_APIENTRYP PFNGLCOVERAGEMASKNVPROC) (GLboolean mask); +typedef void (GL_APIENTRYP PFNGLCOVERAGEOPERATIONNVPROC) (GLenum operation); +#endif + +/* GL_NV_depth_nonlinear */ +#ifndef GL_NV_depth_nonlinear +#define GL_NV_depth_nonlinear 1 +#endif + +/*------------------------------------------------------------------------* + * QCOM extension functions + *------------------------------------------------------------------------*/ + +/* GL_QCOM_driver_control */ +#ifndef GL_QCOM_driver_control +#define GL_QCOM_driver_control 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glGetDriverControlsQCOM (GLint *num, GLsizei size, GLuint *driverControls); +GL_APICALL void GL_APIENTRY glGetDriverControlStringQCOM (GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString); +GL_APICALL void GL_APIENTRY glEnableDriverControlQCOM (GLuint driverControl); +GL_APICALL void GL_APIENTRY glDisableDriverControlQCOM (GLuint driverControl); +#endif +typedef void (GL_APIENTRYP PFNGLGETDRIVERCONTROLSQCOMPROC) (GLint *num, GLsizei size, GLuint *driverControls); +typedef void (GL_APIENTRYP PFNGLGETDRIVERCONTROLSTRINGQCOMPROC) (GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString); +typedef void (GL_APIENTRYP PFNGLENABLEDRIVERCONTROLQCOMPROC) (GLuint driverControl); +typedef void (GL_APIENTRYP PFNGLDISABLEDRIVERCONTROLQCOMPROC) (GLuint driverControl); +#endif + +/* GL_QCOM_extended_get */ +#ifndef GL_QCOM_extended_get +#define GL_QCOM_extended_get 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glExtGetTexturesQCOM (GLuint *textures, GLint maxTextures, GLint *numTextures); +GL_APICALL void GL_APIENTRY glExtGetBuffersQCOM (GLuint *buffers, GLint maxBuffers, GLint *numBuffers); +GL_APICALL void GL_APIENTRY glExtGetRenderbuffersQCOM (GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers); +GL_APICALL void GL_APIENTRY glExtGetFramebuffersQCOM (GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers); +GL_APICALL void GL_APIENTRY glExtGetTexLevelParameterivQCOM (GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glExtTexObjectStateOverrideiQCOM (GLenum target, GLenum pname, GLint param); +GL_APICALL void GL_APIENTRY glExtGetTexSubImageQCOM (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLvoid *texels); +GL_APICALL void GL_APIENTRY glExtGetBufferPointervQCOM (GLenum target, GLvoid **params); +#endif +typedef void (GL_APIENTRYP PFNGLEXTGETTEXTURESQCOMPROC) (GLuint *textures, GLint maxTextures, GLint *numTextures); +typedef void (GL_APIENTRYP PFNGLEXTGETBUFFERSQCOMPROC) (GLuint *buffers, GLint maxBuffers, GLint *numBuffers); +typedef void (GL_APIENTRYP PFNGLEXTGETRENDERBUFFERSQCOMPROC) (GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers); +typedef void (GL_APIENTRYP PFNGLEXTGETFRAMEBUFFERSQCOMPROC) (GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers); +typedef void (GL_APIENTRYP PFNGLEXTGETTEXLEVELPARAMETERIVQCOMPROC) (GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLEXTTEXOBJECTSTATEOVERRIDEIQCOMPROC) (GLenum target, GLenum pname, GLint param); +typedef void (GL_APIENTRYP PFNGLEXTGETTEXSUBIMAGEQCOMPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLvoid *texels); +typedef void (GL_APIENTRYP PFNGLEXTGETBUFFERPOINTERVQCOMPROC) (GLenum target, GLvoid **params); +#endif + +/* GL_QCOM_extended_get2 */ +#ifndef GL_QCOM_extended_get2 +#define GL_QCOM_extended_get2 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glExtGetShadersQCOM (GLuint *shaders, GLint maxShaders, GLint *numShaders); +GL_APICALL void GL_APIENTRY glExtGetProgramsQCOM (GLuint *programs, GLint maxPrograms, GLint *numPrograms); +GL_APICALL GLboolean GL_APIENTRY glExtIsProgramBinaryQCOM (GLuint program); +GL_APICALL void GL_APIENTRY glExtGetProgramBinarySourceQCOM (GLuint program, GLenum shadertype, GLchar *source, GLint *length); +#endif +typedef void (GL_APIENTRYP PFNGLEXTGETSHADERSQCOMPROC) (GLuint *shaders, GLint maxShaders, GLint *numShaders); +typedef void (GL_APIENTRYP PFNGLEXTGETPROGRAMSQCOMPROC) (GLuint *programs, GLint maxPrograms, GLint *numPrograms); +typedef GLboolean (GL_APIENTRYP PFNGLEXTISPROGRAMBINARYQCOMPROC) (GLuint program); +typedef void (GL_APIENTRYP PFNGLEXTGETPROGRAMBINARYSOURCEQCOMPROC) (GLuint program, GLenum shadertype, GLchar *source, GLint *length); +#endif + +/* GL_QCOM_perfmon_global_mode */ +#ifndef GL_QCOM_perfmon_global_mode +#define GL_QCOM_perfmon_global_mode 1 +#endif + +/* GL_QCOM_writeonly_rendering */ +#ifndef GL_QCOM_writeonly_rendering +#define GL_QCOM_writeonly_rendering 1 +#endif + +/* GL_QCOM_tiled_rendering */ +#ifndef GL_QCOM_tiled_rendering +#define GL_QCOM_tiled_rendering 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glStartTilingQCOM (GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask); +GL_APICALL void GL_APIENTRY glEndTilingQCOM (GLbitfield preserveMask); +#endif +typedef void (GL_APIENTRYP PFNGLSTARTTILINGQCOMPROC) (GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask); +typedef void (GL_APIENTRYP PFNGLENDTILINGQCOMPROC) (GLbitfield preserveMask); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* __gl2ext_h_ */ diff -Nru lwjgl-2.7.1+dfsg/src/native/common/GLES2/gl2extimg.h lwjgl-2.9.3+dfsg/src/native/common/GLES2/gl2extimg.h --- lwjgl-2.7.1+dfsg/src/native/common/GLES2/gl2extimg.h 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/common/GLES2/gl2extimg.h 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,51 @@ +#ifndef __gl2extimg_h_ +#define __gl2extimg_h_ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/*------------------------------------------------------------------------* + * IMG extension tokens + *------------------------------------------------------------------------*/ + +/* GL_IMG_binary_shader */ +#ifndef GL_IMG_binary_shader +#define GL_SGX_BINARY_IMG 0x8C0A +#endif + +/* GL_IMG_texture_compression_pvrtc */ +#ifndef GL_IMG_texture_compression_pvrtc +#define GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG 0x8C00 +#define GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG 0x8C01 +#define GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG 0x8C02 +#define GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG 0x8C03 +#endif + + +/* GL_IMG_texture_format_BGRA8888 */ +#define GL_BGRA 0x80E1 + + +/*------------------------------------------------------------------------* + * IMG extension functions + *------------------------------------------------------------------------*/ + +/* GL_IMG_binary_shader */ +#ifndef GL_IMG_binary_shader +#define GL_IMG_binary_shader 1 +#endif + +/* GL_IMG_texture_compression_pvrtc */ +#ifndef GL_IMG_texture_compression_pvrtc +#define GL_IMG_texture_compression_pvrtc 1 +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* __gl2extimg_h_ */ diff -Nru lwjgl-2.7.1+dfsg/src/native/common/GLES2/gl2.h lwjgl-2.9.3+dfsg/src/native/common/GLES2/gl2.h --- lwjgl-2.7.1+dfsg/src/native/common/GLES2/gl2.h 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/common/GLES2/gl2.h 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,621 @@ +#ifndef __gl2_h_ +#define __gl2_h_ + +/* $Revision: 10602 $ on $Date:: 2010-03-04 22:35:34 -0800 #$ */ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * This document is licensed under the SGI Free Software B License Version + * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ . + */ + +/*------------------------------------------------------------------------- + * Data type definitions + *-----------------------------------------------------------------------*/ + +typedef void GLvoid; +typedef char GLchar; +typedef unsigned int GLenum; +typedef unsigned char GLboolean; +typedef unsigned int GLbitfield; +typedef khronos_int8_t GLbyte; +typedef short GLshort; +typedef int GLint; +typedef int GLsizei; +typedef khronos_uint8_t GLubyte; +typedef unsigned short GLushort; +typedef unsigned int GLuint; +typedef khronos_float_t GLfloat; +typedef khronos_float_t GLclampf; +typedef khronos_int32_t GLfixed; + +/* GL types for handling large vertex buffer objects */ +typedef khronos_intptr_t GLintptr; +typedef khronos_ssize_t GLsizeiptr; + +/* OpenGL ES core versions */ +#define GL_ES_VERSION_2_0 1 + +/* ClearBufferMask */ +#define GL_DEPTH_BUFFER_BIT 0x00000100 +#define GL_STENCIL_BUFFER_BIT 0x00000400 +#define GL_COLOR_BUFFER_BIT 0x00004000 + +/* Boolean */ +#define GL_FALSE 0 +#define GL_TRUE 1 + +/* BeginMode */ +#define GL_POINTS 0x0000 +#define GL_LINES 0x0001 +#define GL_LINE_LOOP 0x0002 +#define GL_LINE_STRIP 0x0003 +#define GL_TRIANGLES 0x0004 +#define GL_TRIANGLE_STRIP 0x0005 +#define GL_TRIANGLE_FAN 0x0006 + +/* AlphaFunction (not supported in ES20) */ +/* GL_NEVER */ +/* GL_LESS */ +/* GL_EQUAL */ +/* GL_LEQUAL */ +/* GL_GREATER */ +/* GL_NOTEQUAL */ +/* GL_GEQUAL */ +/* GL_ALWAYS */ + +/* BlendingFactorDest */ +#define GL_ZERO 0 +#define GL_ONE 1 +#define GL_SRC_COLOR 0x0300 +#define GL_ONE_MINUS_SRC_COLOR 0x0301 +#define GL_SRC_ALPHA 0x0302 +#define GL_ONE_MINUS_SRC_ALPHA 0x0303 +#define GL_DST_ALPHA 0x0304 +#define GL_ONE_MINUS_DST_ALPHA 0x0305 + +/* BlendingFactorSrc */ +/* GL_ZERO */ +/* GL_ONE */ +#define GL_DST_COLOR 0x0306 +#define GL_ONE_MINUS_DST_COLOR 0x0307 +#define GL_SRC_ALPHA_SATURATE 0x0308 +/* GL_SRC_ALPHA */ +/* GL_ONE_MINUS_SRC_ALPHA */ +/* GL_DST_ALPHA */ +/* GL_ONE_MINUS_DST_ALPHA */ + +/* BlendEquationSeparate */ +#define GL_FUNC_ADD 0x8006 +#define GL_BLEND_EQUATION 0x8009 +#define GL_BLEND_EQUATION_RGB 0x8009 /* same as BLEND_EQUATION */ +#define GL_BLEND_EQUATION_ALPHA 0x883D + +/* BlendSubtract */ +#define GL_FUNC_SUBTRACT 0x800A +#define GL_FUNC_REVERSE_SUBTRACT 0x800B + +/* Separate Blend Functions */ +#define GL_BLEND_DST_RGB 0x80C8 +#define GL_BLEND_SRC_RGB 0x80C9 +#define GL_BLEND_DST_ALPHA 0x80CA +#define GL_BLEND_SRC_ALPHA 0x80CB +#define GL_CONSTANT_COLOR 0x8001 +#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002 +#define GL_CONSTANT_ALPHA 0x8003 +#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 +#define GL_BLEND_COLOR 0x8005 + +/* Buffer Objects */ +#define GL_ARRAY_BUFFER 0x8892 +#define GL_ELEMENT_ARRAY_BUFFER 0x8893 +#define GL_ARRAY_BUFFER_BINDING 0x8894 +#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895 + +#define GL_STREAM_DRAW 0x88E0 +#define GL_STATIC_DRAW 0x88E4 +#define GL_DYNAMIC_DRAW 0x88E8 + +#define GL_BUFFER_SIZE 0x8764 +#define GL_BUFFER_USAGE 0x8765 + +#define GL_CURRENT_VERTEX_ATTRIB 0x8626 + +/* CullFaceMode */ +#define GL_FRONT 0x0404 +#define GL_BACK 0x0405 +#define GL_FRONT_AND_BACK 0x0408 + +/* DepthFunction */ +/* GL_NEVER */ +/* GL_LESS */ +/* GL_EQUAL */ +/* GL_LEQUAL */ +/* GL_GREATER */ +/* GL_NOTEQUAL */ +/* GL_GEQUAL */ +/* GL_ALWAYS */ + +/* EnableCap */ +#define GL_TEXTURE_2D 0x0DE1 +#define GL_CULL_FACE 0x0B44 +#define GL_BLEND 0x0BE2 +#define GL_DITHER 0x0BD0 +#define GL_STENCIL_TEST 0x0B90 +#define GL_DEPTH_TEST 0x0B71 +#define GL_SCISSOR_TEST 0x0C11 +#define GL_POLYGON_OFFSET_FILL 0x8037 +#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E +#define GL_SAMPLE_COVERAGE 0x80A0 + +/* ErrorCode */ +#define GL_NO_ERROR 0 +#define GL_INVALID_ENUM 0x0500 +#define GL_INVALID_VALUE 0x0501 +#define GL_INVALID_OPERATION 0x0502 +#define GL_OUT_OF_MEMORY 0x0505 + +/* FrontFaceDirection */ +#define GL_CW 0x0900 +#define GL_CCW 0x0901 + +/* GetPName */ +#define GL_LINE_WIDTH 0x0B21 +#define GL_ALIASED_POINT_SIZE_RANGE 0x846D +#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E +#define GL_CULL_FACE_MODE 0x0B45 +#define GL_FRONT_FACE 0x0B46 +#define GL_DEPTH_RANGE 0x0B70 +#define GL_DEPTH_WRITEMASK 0x0B72 +#define GL_DEPTH_CLEAR_VALUE 0x0B73 +#define GL_DEPTH_FUNC 0x0B74 +#define GL_STENCIL_CLEAR_VALUE 0x0B91 +#define GL_STENCIL_FUNC 0x0B92 +#define GL_STENCIL_FAIL 0x0B94 +#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95 +#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96 +#define GL_STENCIL_REF 0x0B97 +#define GL_STENCIL_VALUE_MASK 0x0B93 +#define GL_STENCIL_WRITEMASK 0x0B98 +#define GL_STENCIL_BACK_FUNC 0x8800 +#define GL_STENCIL_BACK_FAIL 0x8801 +#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802 +#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803 +#define GL_STENCIL_BACK_REF 0x8CA3 +#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4 +#define GL_STENCIL_BACK_WRITEMASK 0x8CA5 +#define GL_VIEWPORT 0x0BA2 +#define GL_SCISSOR_BOX 0x0C10 +/* GL_SCISSOR_TEST */ +#define GL_COLOR_CLEAR_VALUE 0x0C22 +#define GL_COLOR_WRITEMASK 0x0C23 +#define GL_UNPACK_ALIGNMENT 0x0CF5 +#define GL_PACK_ALIGNMENT 0x0D05 +#define GL_MAX_TEXTURE_SIZE 0x0D33 +#define GL_MAX_VIEWPORT_DIMS 0x0D3A +#define GL_SUBPIXEL_BITS 0x0D50 +#define GL_RED_BITS 0x0D52 +#define GL_GREEN_BITS 0x0D53 +#define GL_BLUE_BITS 0x0D54 +#define GL_ALPHA_BITS 0x0D55 +#define GL_DEPTH_BITS 0x0D56 +#define GL_STENCIL_BITS 0x0D57 +#define GL_POLYGON_OFFSET_UNITS 0x2A00 +/* GL_POLYGON_OFFSET_FILL */ +#define GL_POLYGON_OFFSET_FACTOR 0x8038 +#define GL_TEXTURE_BINDING_2D 0x8069 +#define GL_SAMPLE_BUFFERS 0x80A8 +#define GL_SAMPLES 0x80A9 +#define GL_SAMPLE_COVERAGE_VALUE 0x80AA +#define GL_SAMPLE_COVERAGE_INVERT 0x80AB + +/* GetTextureParameter */ +/* GL_TEXTURE_MAG_FILTER */ +/* GL_TEXTURE_MIN_FILTER */ +/* GL_TEXTURE_WRAP_S */ +/* GL_TEXTURE_WRAP_T */ + +#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2 +#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3 + +/* HintMode */ +#define GL_DONT_CARE 0x1100 +#define GL_FASTEST 0x1101 +#define GL_NICEST 0x1102 + +/* HintTarget */ +#define GL_GENERATE_MIPMAP_HINT 0x8192 + +/* DataType */ +#define GL_BYTE 0x1400 +#define GL_UNSIGNED_BYTE 0x1401 +#define GL_SHORT 0x1402 +#define GL_UNSIGNED_SHORT 0x1403 +#define GL_INT 0x1404 +#define GL_UNSIGNED_INT 0x1405 +#define GL_FLOAT 0x1406 +#define GL_FIXED 0x140C + +/* PixelFormat */ +#define GL_DEPTH_COMPONENT 0x1902 +#define GL_ALPHA 0x1906 +#define GL_RGB 0x1907 +#define GL_RGBA 0x1908 +#define GL_LUMINANCE 0x1909 +#define GL_LUMINANCE_ALPHA 0x190A + +/* PixelType */ +/* GL_UNSIGNED_BYTE */ +#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033 +#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034 +#define GL_UNSIGNED_SHORT_5_6_5 0x8363 + +/* Shaders */ +#define GL_FRAGMENT_SHADER 0x8B30 +#define GL_VERTEX_SHADER 0x8B31 +#define GL_MAX_VERTEX_ATTRIBS 0x8869 +#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB +#define GL_MAX_VARYING_VECTORS 0x8DFC +#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D +#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C +#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872 +#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD +#define GL_SHADER_TYPE 0x8B4F +#define GL_DELETE_STATUS 0x8B80 +#define GL_LINK_STATUS 0x8B82 +#define GL_VALIDATE_STATUS 0x8B83 +#define GL_ATTACHED_SHADERS 0x8B85 +#define GL_ACTIVE_UNIFORMS 0x8B86 +#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87 +#define GL_ACTIVE_ATTRIBUTES 0x8B89 +#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A +#define GL_SHADING_LANGUAGE_VERSION 0x8B8C +#define GL_CURRENT_PROGRAM 0x8B8D + +/* StencilFunction */ +#define GL_NEVER 0x0200 +#define GL_LESS 0x0201 +#define GL_EQUAL 0x0202 +#define GL_LEQUAL 0x0203 +#define GL_GREATER 0x0204 +#define GL_NOTEQUAL 0x0205 +#define GL_GEQUAL 0x0206 +#define GL_ALWAYS 0x0207 + +/* StencilOp */ +/* GL_ZERO */ +#define GL_KEEP 0x1E00 +#define GL_REPLACE 0x1E01 +#define GL_INCR 0x1E02 +#define GL_DECR 0x1E03 +#define GL_INVERT 0x150A +#define GL_INCR_WRAP 0x8507 +#define GL_DECR_WRAP 0x8508 + +/* StringName */ +#define GL_VENDOR 0x1F00 +#define GL_RENDERER 0x1F01 +#define GL_VERSION 0x1F02 +#define GL_EXTENSIONS 0x1F03 + +/* TextureMagFilter */ +#define GL_NEAREST 0x2600 +#define GL_LINEAR 0x2601 + +/* TextureMinFilter */ +/* GL_NEAREST */ +/* GL_LINEAR */ +#define GL_NEAREST_MIPMAP_NEAREST 0x2700 +#define GL_LINEAR_MIPMAP_NEAREST 0x2701 +#define GL_NEAREST_MIPMAP_LINEAR 0x2702 +#define GL_LINEAR_MIPMAP_LINEAR 0x2703 + +/* TextureParameterName */ +#define GL_TEXTURE_MAG_FILTER 0x2800 +#define GL_TEXTURE_MIN_FILTER 0x2801 +#define GL_TEXTURE_WRAP_S 0x2802 +#define GL_TEXTURE_WRAP_T 0x2803 + +/* TextureTarget */ +/* GL_TEXTURE_2D */ +#define GL_TEXTURE 0x1702 + +#define GL_TEXTURE_CUBE_MAP 0x8513 +#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A +#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C + +/* TextureUnit */ +#define GL_TEXTURE0 0x84C0 +#define GL_TEXTURE1 0x84C1 +#define GL_TEXTURE2 0x84C2 +#define GL_TEXTURE3 0x84C3 +#define GL_TEXTURE4 0x84C4 +#define GL_TEXTURE5 0x84C5 +#define GL_TEXTURE6 0x84C6 +#define GL_TEXTURE7 0x84C7 +#define GL_TEXTURE8 0x84C8 +#define GL_TEXTURE9 0x84C9 +#define GL_TEXTURE10 0x84CA +#define GL_TEXTURE11 0x84CB +#define GL_TEXTURE12 0x84CC +#define GL_TEXTURE13 0x84CD +#define GL_TEXTURE14 0x84CE +#define GL_TEXTURE15 0x84CF +#define GL_TEXTURE16 0x84D0 +#define GL_TEXTURE17 0x84D1 +#define GL_TEXTURE18 0x84D2 +#define GL_TEXTURE19 0x84D3 +#define GL_TEXTURE20 0x84D4 +#define GL_TEXTURE21 0x84D5 +#define GL_TEXTURE22 0x84D6 +#define GL_TEXTURE23 0x84D7 +#define GL_TEXTURE24 0x84D8 +#define GL_TEXTURE25 0x84D9 +#define GL_TEXTURE26 0x84DA +#define GL_TEXTURE27 0x84DB +#define GL_TEXTURE28 0x84DC +#define GL_TEXTURE29 0x84DD +#define GL_TEXTURE30 0x84DE +#define GL_TEXTURE31 0x84DF +#define GL_ACTIVE_TEXTURE 0x84E0 + +/* TextureWrapMode */ +#define GL_REPEAT 0x2901 +#define GL_CLAMP_TO_EDGE 0x812F +#define GL_MIRRORED_REPEAT 0x8370 + +/* Uniform Types */ +#define GL_FLOAT_VEC2 0x8B50 +#define GL_FLOAT_VEC3 0x8B51 +#define GL_FLOAT_VEC4 0x8B52 +#define GL_INT_VEC2 0x8B53 +#define GL_INT_VEC3 0x8B54 +#define GL_INT_VEC4 0x8B55 +#define GL_BOOL 0x8B56 +#define GL_BOOL_VEC2 0x8B57 +#define GL_BOOL_VEC3 0x8B58 +#define GL_BOOL_VEC4 0x8B59 +#define GL_FLOAT_MAT2 0x8B5A +#define GL_FLOAT_MAT3 0x8B5B +#define GL_FLOAT_MAT4 0x8B5C +#define GL_SAMPLER_2D 0x8B5E +#define GL_SAMPLER_CUBE 0x8B60 + +/* Vertex Arrays */ +#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622 +#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623 +#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624 +#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625 +#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A +#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645 +#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F + +/* Read Format */ +#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A +#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B + +/* Shader Source */ +#define GL_COMPILE_STATUS 0x8B81 +#define GL_INFO_LOG_LENGTH 0x8B84 +#define GL_SHADER_SOURCE_LENGTH 0x8B88 +#define GL_SHADER_COMPILER 0x8DFA + +/* Shader Binary */ +#define GL_SHADER_BINARY_FORMATS 0x8DF8 +#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9 + +/* Shader Precision-Specified Types */ +#define GL_LOW_FLOAT 0x8DF0 +#define GL_MEDIUM_FLOAT 0x8DF1 +#define GL_HIGH_FLOAT 0x8DF2 +#define GL_LOW_INT 0x8DF3 +#define GL_MEDIUM_INT 0x8DF4 +#define GL_HIGH_INT 0x8DF5 + +/* Framebuffer Object. */ +#define GL_FRAMEBUFFER 0x8D40 +#define GL_RENDERBUFFER 0x8D41 + +#define GL_RGBA4 0x8056 +#define GL_RGB5_A1 0x8057 +#define GL_RGB565 0x8D62 +#define GL_DEPTH_COMPONENT16 0x81A5 +#define GL_STENCIL_INDEX 0x1901 +#define GL_STENCIL_INDEX8 0x8D48 + +#define GL_RENDERBUFFER_WIDTH 0x8D42 +#define GL_RENDERBUFFER_HEIGHT 0x8D43 +#define GL_RENDERBUFFER_INTERNAL_FORMAT 0x8D44 +#define GL_RENDERBUFFER_RED_SIZE 0x8D50 +#define GL_RENDERBUFFER_GREEN_SIZE 0x8D51 +#define GL_RENDERBUFFER_BLUE_SIZE 0x8D52 +#define GL_RENDERBUFFER_ALPHA_SIZE 0x8D53 +#define GL_RENDERBUFFER_DEPTH_SIZE 0x8D54 +#define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55 + +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0 +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3 + +#define GL_COLOR_ATTACHMENT0 0x8CE0 +#define GL_DEPTH_ATTACHMENT 0x8D00 +#define GL_STENCIL_ATTACHMENT 0x8D20 + +#define GL_NONE 0 + +#define GL_FRAMEBUFFER_COMPLETE 0x8CD5 +#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6 +#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7 +#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS 0x8CD9 +#define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD + +#define GL_FRAMEBUFFER_BINDING 0x8CA6 +#define GL_RENDERBUFFER_BINDING 0x8CA7 +#define GL_MAX_RENDERBUFFER_SIZE 0x84E8 + +#define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506 + +/*------------------------------------------------------------------------- + * GL core functions. + *-----------------------------------------------------------------------*/ + +GL_APICALL void GL_APIENTRY glActiveTexture (GLenum texture); +GL_APICALL void GL_APIENTRY glAttachShader (GLuint program, GLuint shader); +GL_APICALL void GL_APIENTRY glBindAttribLocation (GLuint program, GLuint index, const GLchar* name); +GL_APICALL void GL_APIENTRY glBindBuffer (GLenum target, GLuint buffer); +GL_APICALL void GL_APIENTRY glBindFramebuffer (GLenum target, GLuint framebuffer); +GL_APICALL void GL_APIENTRY glBindRenderbuffer (GLenum target, GLuint renderbuffer); +GL_APICALL void GL_APIENTRY glBindTexture (GLenum target, GLuint texture); +GL_APICALL void GL_APIENTRY glBlendColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); +GL_APICALL void GL_APIENTRY glBlendEquation ( GLenum mode ); +GL_APICALL void GL_APIENTRY glBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha); +GL_APICALL void GL_APIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor); +GL_APICALL void GL_APIENTRY glBlendFuncSeparate (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); +GL_APICALL void GL_APIENTRY glBufferData (GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage); +GL_APICALL void GL_APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data); +GL_APICALL GLenum GL_APIENTRY glCheckFramebufferStatus (GLenum target); +GL_APICALL void GL_APIENTRY glClear (GLbitfield mask); +GL_APICALL void GL_APIENTRY glClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); +GL_APICALL void GL_APIENTRY glClearDepthf (GLclampf depth); +GL_APICALL void GL_APIENTRY glClearStencil (GLint s); +GL_APICALL void GL_APIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); +GL_APICALL void GL_APIENTRY glCompileShader (GLuint shader); +GL_APICALL void GL_APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid* data); +GL_APICALL void GL_APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid* data); +GL_APICALL void GL_APIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); +GL_APICALL void GL_APIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +GL_APICALL GLuint GL_APIENTRY glCreateProgram (void); +GL_APICALL GLuint GL_APIENTRY glCreateShader (GLenum type); +GL_APICALL void GL_APIENTRY glCullFace (GLenum mode); +GL_APICALL void GL_APIENTRY glDeleteBuffers (GLsizei n, const GLuint* buffers); +GL_APICALL void GL_APIENTRY glDeleteFramebuffers (GLsizei n, const GLuint* framebuffers); +GL_APICALL void GL_APIENTRY glDeleteProgram (GLuint program); +GL_APICALL void GL_APIENTRY glDeleteRenderbuffers (GLsizei n, const GLuint* renderbuffers); +GL_APICALL void GL_APIENTRY glDeleteShader (GLuint shader); +GL_APICALL void GL_APIENTRY glDeleteTextures (GLsizei n, const GLuint* textures); +GL_APICALL void GL_APIENTRY glDepthFunc (GLenum func); +GL_APICALL void GL_APIENTRY glDepthMask (GLboolean flag); +GL_APICALL void GL_APIENTRY glDepthRangef (GLclampf zNear, GLclampf zFar); +GL_APICALL void GL_APIENTRY glDetachShader (GLuint program, GLuint shader); +GL_APICALL void GL_APIENTRY glDisable (GLenum cap); +GL_APICALL void GL_APIENTRY glDisableVertexAttribArray (GLuint index); +GL_APICALL void GL_APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count); +GL_APICALL void GL_APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const GLvoid* indices); +GL_APICALL void GL_APIENTRY glEnable (GLenum cap); +GL_APICALL void GL_APIENTRY glEnableVertexAttribArray (GLuint index); +GL_APICALL void GL_APIENTRY glFinish (void); +GL_APICALL void GL_APIENTRY glFlush (void); +GL_APICALL void GL_APIENTRY glFramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); +GL_APICALL void GL_APIENTRY glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +GL_APICALL void GL_APIENTRY glFrontFace (GLenum mode); +GL_APICALL void GL_APIENTRY glGenBuffers (GLsizei n, GLuint* buffers); +GL_APICALL void GL_APIENTRY glGenerateMipmap (GLenum target); +GL_APICALL void GL_APIENTRY glGenFramebuffers (GLsizei n, GLuint* framebuffers); +GL_APICALL void GL_APIENTRY glGenRenderbuffers (GLsizei n, GLuint* renderbuffers); +GL_APICALL void GL_APIENTRY glGenTextures (GLsizei n, GLuint* textures); +GL_APICALL void GL_APIENTRY glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name); +GL_APICALL void GL_APIENTRY glGetActiveUniform (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name); +GL_APICALL void GL_APIENTRY glGetAttachedShaders (GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders); +GL_APICALL int GL_APIENTRY glGetAttribLocation (GLuint program, const GLchar* name); +GL_APICALL void GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean* params); +GL_APICALL void GL_APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint* params); +GL_APICALL GLenum GL_APIENTRY glGetError (void); +GL_APICALL void GL_APIENTRY glGetFloatv (GLenum pname, GLfloat* params); +GL_APICALL void GL_APIENTRY glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint* params); +GL_APICALL void GL_APIENTRY glGetIntegerv (GLenum pname, GLint* params); +GL_APICALL void GL_APIENTRY glGetProgramiv (GLuint program, GLenum pname, GLint* params); +GL_APICALL void GL_APIENTRY glGetProgramInfoLog (GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog); +GL_APICALL void GL_APIENTRY glGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint* params); +GL_APICALL void GL_APIENTRY glGetShaderiv (GLuint shader, GLenum pname, GLint* params); +GL_APICALL void GL_APIENTRY glGetShaderInfoLog (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog); +GL_APICALL void GL_APIENTRY glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision); +GL_APICALL void GL_APIENTRY glGetShaderSource (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source); +GL_APICALL const GLubyte* GL_APIENTRY glGetString (GLenum name); +GL_APICALL void GL_APIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat* params); +GL_APICALL void GL_APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint* params); +GL_APICALL void GL_APIENTRY glGetUniformfv (GLuint program, GLint location, GLfloat* params); +GL_APICALL void GL_APIENTRY glGetUniformiv (GLuint program, GLint location, GLint* params); +GL_APICALL int GL_APIENTRY glGetUniformLocation (GLuint program, const GLchar* name); +GL_APICALL void GL_APIENTRY glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat* params); +GL_APICALL void GL_APIENTRY glGetVertexAttribiv (GLuint index, GLenum pname, GLint* params); +GL_APICALL void GL_APIENTRY glGetVertexAttribPointerv (GLuint index, GLenum pname, GLvoid** pointer); +GL_APICALL void GL_APIENTRY glHint (GLenum target, GLenum mode); +GL_APICALL GLboolean GL_APIENTRY glIsBuffer (GLuint buffer); +GL_APICALL GLboolean GL_APIENTRY glIsEnabled (GLenum cap); +GL_APICALL GLboolean GL_APIENTRY glIsFramebuffer (GLuint framebuffer); +GL_APICALL GLboolean GL_APIENTRY glIsProgram (GLuint program); +GL_APICALL GLboolean GL_APIENTRY glIsRenderbuffer (GLuint renderbuffer); +GL_APICALL GLboolean GL_APIENTRY glIsShader (GLuint shader); +GL_APICALL GLboolean GL_APIENTRY glIsTexture (GLuint texture); +GL_APICALL void GL_APIENTRY glLineWidth (GLfloat width); +GL_APICALL void GL_APIENTRY glLinkProgram (GLuint program); +GL_APICALL void GL_APIENTRY glPixelStorei (GLenum pname, GLint param); +GL_APICALL void GL_APIENTRY glPolygonOffset (GLfloat factor, GLfloat units); +GL_APICALL void GL_APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels); +GL_APICALL void GL_APIENTRY glReleaseShaderCompiler (void); +GL_APICALL void GL_APIENTRY glRenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); +GL_APICALL void GL_APIENTRY glSampleCoverage (GLclampf value, GLboolean invert); +GL_APICALL void GL_APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height); +GL_APICALL void GL_APIENTRY glShaderBinary (GLsizei n, const GLuint* shaders, GLenum binaryformat, const GLvoid* binary, GLsizei length); +GL_APICALL void GL_APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar** string, const GLint* length); +GL_APICALL void GL_APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask); +GL_APICALL void GL_APIENTRY glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask); +GL_APICALL void GL_APIENTRY glStencilMask (GLuint mask); +GL_APICALL void GL_APIENTRY glStencilMaskSeparate (GLenum face, GLuint mask); +GL_APICALL void GL_APIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass); +GL_APICALL void GL_APIENTRY glStencilOpSeparate (GLenum face, GLenum fail, GLenum zfail, GLenum zpass); +GL_APICALL void GL_APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels); +GL_APICALL void GL_APIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param); +GL_APICALL void GL_APIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat* params); +GL_APICALL void GL_APIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param); +GL_APICALL void GL_APIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint* params); +GL_APICALL void GL_APIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels); +GL_APICALL void GL_APIENTRY glUniform1f (GLint location, GLfloat x); +GL_APICALL void GL_APIENTRY glUniform1fv (GLint location, GLsizei count, const GLfloat* v); +GL_APICALL void GL_APIENTRY glUniform1i (GLint location, GLint x); +GL_APICALL void GL_APIENTRY glUniform1iv (GLint location, GLsizei count, const GLint* v); +GL_APICALL void GL_APIENTRY glUniform2f (GLint location, GLfloat x, GLfloat y); +GL_APICALL void GL_APIENTRY glUniform2fv (GLint location, GLsizei count, const GLfloat* v); +GL_APICALL void GL_APIENTRY glUniform2i (GLint location, GLint x, GLint y); +GL_APICALL void GL_APIENTRY glUniform2iv (GLint location, GLsizei count, const GLint* v); +GL_APICALL void GL_APIENTRY glUniform3f (GLint location, GLfloat x, GLfloat y, GLfloat z); +GL_APICALL void GL_APIENTRY glUniform3fv (GLint location, GLsizei count, const GLfloat* v); +GL_APICALL void GL_APIENTRY glUniform3i (GLint location, GLint x, GLint y, GLint z); +GL_APICALL void GL_APIENTRY glUniform3iv (GLint location, GLsizei count, const GLint* v); +GL_APICALL void GL_APIENTRY glUniform4f (GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GL_APICALL void GL_APIENTRY glUniform4fv (GLint location, GLsizei count, const GLfloat* v); +GL_APICALL void GL_APIENTRY glUniform4i (GLint location, GLint x, GLint y, GLint z, GLint w); +GL_APICALL void GL_APIENTRY glUniform4iv (GLint location, GLsizei count, const GLint* v); +GL_APICALL void GL_APIENTRY glUniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); +GL_APICALL void GL_APIENTRY glUniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); +GL_APICALL void GL_APIENTRY glUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); +GL_APICALL void GL_APIENTRY glUseProgram (GLuint program); +GL_APICALL void GL_APIENTRY glValidateProgram (GLuint program); +GL_APICALL void GL_APIENTRY glVertexAttrib1f (GLuint indx, GLfloat x); +GL_APICALL void GL_APIENTRY glVertexAttrib1fv (GLuint indx, const GLfloat* values); +GL_APICALL void GL_APIENTRY glVertexAttrib2f (GLuint indx, GLfloat x, GLfloat y); +GL_APICALL void GL_APIENTRY glVertexAttrib2fv (GLuint indx, const GLfloat* values); +GL_APICALL void GL_APIENTRY glVertexAttrib3f (GLuint indx, GLfloat x, GLfloat y, GLfloat z); +GL_APICALL void GL_APIENTRY glVertexAttrib3fv (GLuint indx, const GLfloat* values); +GL_APICALL void GL_APIENTRY glVertexAttrib4f (GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GL_APICALL void GL_APIENTRY glVertexAttrib4fv (GLuint indx, const GLfloat* values); +GL_APICALL void GL_APIENTRY glVertexAttribPointer (GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr); +GL_APICALL void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height); + +#ifdef __cplusplus +} +#endif + +#endif /* __gl2_h_ */ diff -Nru lwjgl-2.7.1+dfsg/src/native/common/GLES2/gl2platform.h lwjgl-2.9.3+dfsg/src/native/common/GLES2/gl2platform.h --- lwjgl-2.7.1+dfsg/src/native/common/GLES2/gl2platform.h 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/common/GLES2/gl2platform.h 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,30 @@ +#ifndef __gl2platform_h_ +#define __gl2platform_h_ + +/* $Revision: 10602 $ on $Date:: 2010-03-04 22:35:34 -0800 #$ */ + +/* + * This document is licensed under the SGI Free Software B License Version + * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ . + */ + +/* Platform-specific types and definitions for OpenGL ES 2.X gl2.h + * + * Adopters may modify khrplatform.h and this file to suit their platform. + * You are encouraged to submit all modifications to the Khronos group so that + * they can be included in future versions of this file. Please submit changes + * by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla) + * by filing a bug against product "OpenGL-ES" component "Registry". + */ + +#include + +#ifndef GL_APICALL +#define GL_APICALL KHRONOS_APICALL +#endif + +#ifndef GL_APIENTRY +#define GL_APIENTRY KHRONOS_APIENTRY +#endif + +#endif /* __gl2platform_h_ */ diff -Nru lwjgl-2.7.1+dfsg/src/native/common/KHR/khrplatform.h lwjgl-2.9.3+dfsg/src/native/common/KHR/khrplatform.h --- lwjgl-2.7.1+dfsg/src/native/common/KHR/khrplatform.h 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/common/KHR/khrplatform.h 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,269 @@ +#ifndef __khrplatform_h_ +#define __khrplatform_h_ + +/* +** Copyright (c) 2008-2009 The Khronos Group Inc. +** +** Permission is hereby granted, free of charge, to any person obtaining a +** copy of this software and/or associated documentation files (the +** "Materials"), to deal in the Materials without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Materials, and to +** permit persons to whom the Materials are furnished to do so, subject to +** the following conditions: +** +** The above copyright notice and this permission notice shall be included +** in all copies or substantial portions of the Materials. +** +** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. +*/ + +/* Khronos platform-specific types and definitions. + * + * $Revision: 9356 $ on $Date: 2009-10-21 02:52:25 -0700 (Wed, 21 Oct 2009) $ + * + * Adopters may modify this file to suit their platform. Adopters are + * encouraged to submit platform specific modifications to the Khronos + * group so that they can be included in future versions of this file. + * Please submit changes by sending them to the public Khronos Bugzilla + * (http://khronos.org/bugzilla) by filing a bug against product + * "Khronos (general)" component "Registry". + * + * A predefined template which fills in some of the bug fields can be + * reached using http://tinyurl.com/khrplatform-h-bugreport, but you + * must create a Bugzilla login first. + * + * + * See the Implementer's Guidelines for information about where this file + * should be located on your system and for more details of its use: + * http://www.khronos.org/registry/implementers_guide.pdf + * + * This file should be included as + * #include + * by Khronos client API header files that use its types and defines. + * + * The types in khrplatform.h should only be used to define API-specific types. + * + * Types defined in khrplatform.h: + * khronos_int8_t signed 8 bit + * khronos_uint8_t unsigned 8 bit + * khronos_int16_t signed 16 bit + * khronos_uint16_t unsigned 16 bit + * khronos_int32_t signed 32 bit + * khronos_uint32_t unsigned 32 bit + * khronos_int64_t signed 64 bit + * khronos_uint64_t unsigned 64 bit + * khronos_intptr_t signed same number of bits as a pointer + * khronos_uintptr_t unsigned same number of bits as a pointer + * khronos_ssize_t signed size + * khronos_usize_t unsigned size + * khronos_float_t signed 32 bit floating point + * khronos_time_ns_t unsigned 64 bit time in nanoseconds + * khronos_utime_nanoseconds_t unsigned time interval or absolute time in + * nanoseconds + * khronos_stime_nanoseconds_t signed time interval in nanoseconds + * khronos_boolean_enum_t enumerated boolean type. This should + * only be used as a base type when a client API's boolean type is + * an enum. Client APIs which use an integer or other type for + * booleans cannot use this as the base type for their boolean. + * + * Tokens defined in khrplatform.h: + * + * KHRONOS_FALSE, KHRONOS_TRUE Enumerated boolean false/true values. + * + * KHRONOS_SUPPORT_INT64 is 1 if 64 bit integers are supported; otherwise 0. + * KHRONOS_SUPPORT_FLOAT is 1 if floats are supported; otherwise 0. + * + * Calling convention macros defined in this file: + * KHRONOS_APICALL + * KHRONOS_APIENTRY + * KHRONOS_APIATTRIBUTES + * + * These may be used in function prototypes as: + * + * KHRONOS_APICALL void KHRONOS_APIENTRY funcname( + * int arg1, + * int arg2) KHRONOS_APIATTRIBUTES; + */ + +/*------------------------------------------------------------------------- + * Definition of KHRONOS_APICALL + *------------------------------------------------------------------------- + * This precedes the return type of the function in the function prototype. + */ +#if defined(_WIN32) && !defined(__SCITECH_SNAP__) +# define KHRONOS_APICALL __declspec(dllimport) +#elif defined (__SYMBIAN32__) +# define KHRONOS_APICALL IMPORT_C +#else +# define KHRONOS_APICALL +#endif + +/*------------------------------------------------------------------------- + * Definition of KHRONOS_APIENTRY + *------------------------------------------------------------------------- + * This follows the return type of the function and precedes the function + * name in the function prototype. + */ +#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__) + /* Win32 but not WinCE */ +# define KHRONOS_APIENTRY __stdcall +#else +# define KHRONOS_APIENTRY +#endif + +/*------------------------------------------------------------------------- + * Definition of KHRONOS_APIATTRIBUTES + *------------------------------------------------------------------------- + * This follows the closing parenthesis of the function prototype arguments. + */ +#if defined (__ARMCC_2__) +#define KHRONOS_APIATTRIBUTES __softfp +#else +#define KHRONOS_APIATTRIBUTES +#endif + +/*------------------------------------------------------------------------- + * basic type definitions + *-----------------------------------------------------------------------*/ +#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC__) || defined(__SCO__) || defined(__USLC__) + + +/* + * Using + */ +#include +typedef int32_t khronos_int32_t; +typedef uint32_t khronos_uint32_t; +typedef int64_t khronos_int64_t; +typedef uint64_t khronos_uint64_t; +#define KHRONOS_SUPPORT_INT64 1 +#define KHRONOS_SUPPORT_FLOAT 1 + +#elif defined(__VMS ) || defined(__sgi) + +/* + * Using + */ +#include +typedef int32_t khronos_int32_t; +typedef uint32_t khronos_uint32_t; +typedef int64_t khronos_int64_t; +typedef uint64_t khronos_uint64_t; +#define KHRONOS_SUPPORT_INT64 1 +#define KHRONOS_SUPPORT_FLOAT 1 + +#elif defined(_WIN32) && !defined(__SCITECH_SNAP__) + +/* + * Win32 + */ +typedef __int32 khronos_int32_t; +typedef unsigned __int32 khronos_uint32_t; +typedef __int64 khronos_int64_t; +typedef unsigned __int64 khronos_uint64_t; +#define KHRONOS_SUPPORT_INT64 1 +#define KHRONOS_SUPPORT_FLOAT 1 + +#elif defined(__sun__) || defined(__digital__) + +/* + * Sun or Digital + */ +typedef int khronos_int32_t; +typedef unsigned int khronos_uint32_t; +#if defined(__arch64__) || defined(_LP64) +typedef long int khronos_int64_t; +typedef unsigned long int khronos_uint64_t; +#else +typedef long long int khronos_int64_t; +typedef unsigned long long int khronos_uint64_t; +#endif /* __arch64__ */ +#define KHRONOS_SUPPORT_INT64 1 +#define KHRONOS_SUPPORT_FLOAT 1 + +#elif 0 + +/* + * Hypothetical platform with no float or int64 support + */ +typedef int khronos_int32_t; +typedef unsigned int khronos_uint32_t; +#define KHRONOS_SUPPORT_INT64 0 +#define KHRONOS_SUPPORT_FLOAT 0 + +#else + +/* + * Generic fallback + */ +#include +typedef int32_t khronos_int32_t; +typedef uint32_t khronos_uint32_t; +typedef int64_t khronos_int64_t; +typedef uint64_t khronos_uint64_t; +#define KHRONOS_SUPPORT_INT64 1 +#define KHRONOS_SUPPORT_FLOAT 1 + +#endif + + +/* + * Types that are (so far) the same on all platforms + */ +typedef signed char khronos_int8_t; +typedef unsigned char khronos_uint8_t; +typedef signed short int khronos_int16_t; +typedef unsigned short int khronos_uint16_t; +typedef signed long int khronos_intptr_t; +typedef unsigned long int khronos_uintptr_t; +typedef signed long int khronos_ssize_t; +typedef unsigned long int khronos_usize_t; + +#if KHRONOS_SUPPORT_FLOAT +/* + * Float type + */ +typedef float khronos_float_t; +#endif + +#if KHRONOS_SUPPORT_INT64 +/* Time types + * + * These types can be used to represent a time interval in nanoseconds or + * an absolute Unadjusted System Time. Unadjusted System Time is the number + * of nanoseconds since some arbitrary system event (e.g. since the last + * time the system booted). The Unadjusted System Time is an unsigned + * 64 bit value that wraps back to 0 every 584 years. Time intervals + * may be either signed or unsigned. + */ +typedef khronos_uint64_t khronos_utime_nanoseconds_t; +typedef khronos_int64_t khronos_stime_nanoseconds_t; +#endif + +/* + * Dummy value used to pad enum types to 32 bits. + */ +#ifndef KHRONOS_MAX_ENUM +#define KHRONOS_MAX_ENUM 0x7FFFFFFF +#endif + +/* + * Enumerated boolean type + * + * Values other than zero should be considered to be true. Therefore + * comparisons should not be made against KHRONOS_TRUE. + */ +typedef enum { + KHRONOS_FALSE = 0, + KHRONOS_TRUE = 1, + KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM +} khronos_boolean_enum_t; + +#endif /* __khrplatform_h_ */ diff -Nru lwjgl-2.7.1+dfsg/src/native/common/opengl/extgl.c lwjgl-2.9.3+dfsg/src/native/common/opengl/extgl.c --- lwjgl-2.7.1+dfsg/src/native/common/opengl/extgl.c 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/common/opengl/extgl.c 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,83 @@ +/* ---------------------------------------------------------------------------- +Copyright (c) 2001-2002, Lev Povalahev +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * The name of the author may be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF +THE POSSIBILITY OF SUCH DAMAGE. +------------------------------------------------------------------------------*/ +/* + Lev Povalahev + + levp@gmx.net + + http://www.uni-karlsruhe.de/~uli2/ + +*/ + +#include +#include +#include "extgl.h" +#include "common_tools.h" + +void extgl_InitializeClass(JNIEnv *env, jclass clazz, int num_functions, JavaMethodAndExtFunction *functions) { + ext_InitializeClass(env, clazz, &extgl_GetProcAddress, num_functions, functions); +} + +bool extgl_InitializeFunctions(int num_functions, ExtFunction *functions) { + return ext_InitializeFunctions(&extgl_GetProcAddress, num_functions, functions); +} + +bool extgl_QueryExtension(const GLubyte*extensions, const char *name) +{ + const GLubyte *start; + GLubyte *where, *terminator; + + if (extensions == NULL) { + printfDebug("NULL extension string\n"); + return false; + } + + /* Extension names should not have spaces. */ + where = (GLubyte *) strchr(name, ' '); + if (where || *name == '\0') + return false; + + /* It takes a bit of care to be fool-proof about parsing the + OpenGL extensions string. Don't be fooled by sub-strings, + etc. */ + start = extensions; + for (;;) + { + where = (GLubyte *) strstr((const char *) start, name); + if (!where) + break; + terminator = where + strlen(name); + if (where == start || *(where - 1) == ' ') + if (*terminator == ' ' || *terminator == '\0') { + return true; + } + start = terminator; + } + return false; + +} + diff -Nru lwjgl-2.7.1+dfsg/src/native/common/opengl/extgl.h lwjgl-2.9.3+dfsg/src/native/common/opengl/extgl.h --- lwjgl-2.7.1+dfsg/src/native/common/opengl/extgl.h 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/common/opengl/extgl.h 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,124 @@ +/* Small parts were taken from Mesa's glext.h and gl.h, here's the license: */ + +/* + * Mesa 3-D graphics library + * Version: 6.5.1 + * + * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +/* Some parts derived from files copyright (c) 2001-2002 Lev Povalahev under this license: */ + +/* ---------------------------------------------------------------------------- +Copyright (c) 2002, Lev Povalahev +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * The name of the author may be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF +THE POSSIBILITY OF SUCH DAMAGE. +------------------------------------------------------------------------------*/ +/* + GL_draw_range_elements support added by Benjamin Karaban + + Lev Povalahev contact information: + + levp@gmx.net + + http://www.uni-karlsruhe.de/~uli2/ +*/ + +#ifndef __EXTGL_H__ +#define __EXTGL_H__ + +#include + +#include +#include + +#ifdef __APPLE__ + #include +#else + #include +#endif + +#include "common_tools.h" + +#if defined(_WIN32) || defined(_WIN64) + #include // fix APIENTRY macro redefinition +#endif + +#ifndef APIENTRY + #define APIENTRY +#endif + +#include "extcl_types.h" +#include "extgl_types.h" + +/* AMD_debug_output callback function pointer. */ +typedef void (APIENTRY *GLDEBUGPROCAMD)(GLuint id, GLenum category, GLenum severity, GLsizei length, const GLchar* message, GLvoid* userParam); + +/* ARB_debug_output callback function pointer. */ +typedef void (APIENTRY *GLDEBUGPROCARB)(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message, GLvoid* userParam); + +/* KHR_debug callback function pointer. */ +typedef void (APIENTRY *GLDEBUGPROC)(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message, GLvoid* userParam); + +/* initializes everything, call this right after the rc is created. the function returns true if successful */ +extern bool extgl_Open(JNIEnv *env); +extern void extgl_Close(void); +extern void extgl_InitializeClass(JNIEnv *env, jclass clazz, int num_functions, JavaMethodAndExtFunction *functions); +extern bool extgl_InitializeFunctions(int num_functions, ExtFunction *functions); +extern bool extgl_QueryExtension(const GLubyte*extensions, const char *name); +extern void *extgl_GetProcAddress(const char *name); + + +#ifndef __APPLE__ + /* NV_present_video functions (GLX & WGL only) */ + extern jint extgl_EnumerateVideoDevicesNV(JNIEnv *env, jobject peer_info_handle, jobject devices, jint devices_position); + extern jboolean extgl_BindVideoDeviceNV(JNIEnv *env, jobject peer_info_handle, jint video_slot, jlong video_device, jobject attrib_list, jint attrib_list_position); + extern jboolean extgl_QueryContextNV(JNIEnv *env, jobject peer_info_handle, jobject context_handle, jint attrib, jobject value, jint value_position); + + /* NV_video_capture functions (GLX & WGL only) */ + extern jboolean extgl_BindVideoCaptureDeviceNV(JNIEnv *env, jobject peer_info_handle, jint video_slot, jlong device); + extern jint extgl_EnumerateVideoCaptureDevicesNV(JNIEnv *env, jobject peer_info_handle, jobject devices, jint devices_position); + extern jboolean extgl_LockVideoCaptureDeviceNV(JNIEnv *env, jobject peer_info_handle, jlong device); + extern jboolean extgl_QueryVideoCaptureDeviceNV(JNIEnv *env, jobject peer_info_handle, jlong device, jint attribute, jobject value, jint value_position); + extern jboolean extgl_ReleaseVideoCaptureDeviceNV(JNIEnv *env, jobject peer_info_handle, jlong device); +#endif + +#endif /* __EXTGL_H__ */ diff -Nru lwjgl-2.7.1+dfsg/src/native/common/opengl/extgl_types.h lwjgl-2.9.3+dfsg/src/native/common/opengl/extgl_types.h --- lwjgl-2.7.1+dfsg/src/native/common/opengl/extgl_types.h 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/common/opengl/extgl_types.h 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,55 @@ +#if defined(_WIN32) || defined(_WIN64) + #define int64_t __int64 + #define uint64_t unsigned __int64 +#endif + +#ifdef _MACOSX + typedef unsigned long GLenum; + typedef unsigned char GLboolean; + typedef unsigned long GLbitfield; + typedef signed char GLbyte; + typedef short GLshort; + typedef long GLint; + typedef long GLsizei; + typedef unsigned char GLubyte; + typedef unsigned short GLushort; + typedef unsigned long GLuint; + typedef float GLfloat; + typedef float GLclampf; + typedef double GLdouble; + typedef double GLclampd; + typedef void GLvoid; +#else + typedef unsigned int GLenum; + typedef unsigned char GLboolean; + typedef unsigned int GLbitfield; + typedef void GLvoid; + typedef signed char GLbyte; /* 1-byte signed */ + typedef short GLshort; /* 2-byte signed */ + typedef int GLint; /* 4-byte signed */ + typedef unsigned char GLubyte; /* 1-byte unsigned */ + typedef unsigned short GLushort; /* 2-byte unsigned */ + typedef unsigned int GLuint; /* 4-byte unsigned */ + typedef int GLsizei; /* 4-byte signed */ + typedef float GLfloat; /* single precision float */ + typedef float GLclampf; /* single precision float in [0,1] */ + typedef double GLdouble; /* double precision float */ + typedef double GLclampd; /* double precision float in [0,1] */ +#endif + +typedef char GLchar; /* native character */ + +typedef ptrdiff_t GLintptr; +typedef ptrdiff_t GLsizeiptr; +typedef ptrdiff_t GLintptrARB; +typedef ptrdiff_t GLsizeiptrARB; +typedef char GLcharARB; /* native character */ +typedef unsigned int GLhandleARB; /* shader object handle */ +typedef unsigned short GLhalfARB; +typedef unsigned short GLhalfNV; +typedef unsigned short GLhalf; +typedef int64_t GLint64EXT; +typedef uint64_t GLuint64EXT; +typedef int64_t GLint64; +typedef uint64_t GLuint64; +typedef struct __GLsync * GLsync; \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/native/common/opengl/org_lwjgl_opengl_CallbackUtil.c lwjgl-2.9.3+dfsg/src/native/common/opengl/org_lwjgl_opengl_CallbackUtil.c --- lwjgl-2.7.1+dfsg/src/native/common/opengl/org_lwjgl_opengl_CallbackUtil.c 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/common/opengl/org_lwjgl_opengl_CallbackUtil.c 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,143 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * JNI implementation of the ARB/AMD_debug_output & KHR_debug function callbacks. + * + * @author Spasi + */ + +#include +#include "common_tools.h" +#include "extgl.h" +#include "org_lwjgl_opengl_CallbackUtil.h" + +static jmethodID debugOutputCallbackARBJ; +static jmethodID debugOutputCallbackAMDJ; +static jmethodID debugCallbackKHRJ; + +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_CallbackUtil_ncreateGlobalRef(JNIEnv *env, jclass clazz, jobject obj) { + return (jlong)(intptr_t)(*env)->NewGlobalRef(env, obj); +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CallbackUtil_deleteGlobalRef(JNIEnv *env, jclass clazz, jlong globalRef) { + (*env)->DeleteGlobalRef(env, (jobject)(intptr_t)globalRef); +} + +// ----------------- [ ARB_debug_output ] ----------------- + +static void APIENTRY debugOutputCallbackARB(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message, GLvoid* userParam) { + JNIEnv *env = attachCurrentThread(); + + if ( env != NULL && !(*env)->ExceptionOccurred(env) && debugOutputCallbackARBJ != NULL ) { + (*env)->CallVoidMethod(env, (jobject)userParam, debugOutputCallbackARBJ, + (jint)source, + (jint)type, + (jint)id, + (jint)severity, + NewStringNativeWithLength(env, message, length) + ); + } + + detachCurrentThread(); +} + +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_CallbackUtil_getDebugOutputCallbackARB(JNIEnv *env, jclass clazz) { + // Cache the callback methodID + jclass callbackClass; + if ( debugOutputCallbackARBJ == NULL ) { + callbackClass = (*env)->FindClass(env, "org/lwjgl/opengl/ARBDebugOutputCallback$Handler"); + if ( callbackClass != NULL ) + debugOutputCallbackARBJ = (*env)->GetMethodID(env, callbackClass, "handleMessage", "(IIIILjava/lang/String;)V"); + } + + return (jlong)(intptr_t)&debugOutputCallbackARB; +} + +// ----------------- [ AMD_debug_output ] ----------------- + +static void APIENTRY debugOutputCallbackAMD(GLuint id, GLenum category, GLenum severity, GLsizei length, const GLchar* message, GLvoid* userParam) { + JNIEnv *env = attachCurrentThread(); + + if ( env != NULL && !(*env)->ExceptionOccurred(env) && debugOutputCallbackAMDJ != NULL ) { + (*env)->CallVoidMethod(env, (jobject)userParam, debugOutputCallbackAMDJ, + (jint)id, + (jint)category, + (jint)severity, + NewStringNativeWithLength(env, message, length) + ); + } + + detachCurrentThread(); +} + +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_CallbackUtil_getDebugOutputCallbackAMD(JNIEnv *env, jclass clazz) { + // Cache the callback methodID + jclass callbackClass; + if ( debugOutputCallbackAMDJ == NULL ) { + callbackClass = (*env)->FindClass(env, "org/lwjgl/opengl/AMDDebugOutputCallback$Handler"); + if ( callbackClass != NULL ) + debugOutputCallbackAMDJ = (*env)->GetMethodID(env, callbackClass, "handleMessage", "(IIILjava/lang/String;)V"); + } + + return (jlong)(intptr_t)&debugOutputCallbackAMD; +} + +// ----------------- [ KHR_debug ] ----------------- + +static void APIENTRY debugCallbackKHR(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message, GLvoid* userParam) { + JNIEnv *env = attachCurrentThread(); + + if ( env != NULL && !(*env)->ExceptionOccurred(env) && debugCallbackKHRJ != NULL ) { + (*env)->CallVoidMethod(env, (jobject)userParam, debugCallbackKHRJ, + (jint)source, + (jint)type, + (jint)id, + (jint)severity, + NewStringNativeWithLength(env, message, length) + ); + } + + detachCurrentThread(); +} + +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_CallbackUtil_getDebugCallbackKHR(JNIEnv *env, jclass clazz) { + // Cache the callback methodID + jclass callbackClass; + if ( debugCallbackKHRJ == NULL ) { + callbackClass = (*env)->FindClass(env, "org/lwjgl/opengl/KHRDebugCallback$Handler"); + if ( callbackClass != NULL ) + debugCallbackKHRJ = (*env)->GetMethodID(env, callbackClass, "handleMessage", "(IIIILjava/lang/String;)V"); + } + + return (jlong)(intptr_t)&debugCallbackKHR; +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/native/common/opengl/org_lwjgl_opengl_CallbackUtil.h lwjgl-2.9.3+dfsg/src/native/common/opengl/org_lwjgl_opengl_CallbackUtil.h --- lwjgl-2.7.1+dfsg/src/native/common/opengl/org_lwjgl_opengl_CallbackUtil.h 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/common/opengl/org_lwjgl_opengl_CallbackUtil.h 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,53 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_lwjgl_opengl_CallbackUtil */ + +#ifndef _Included_org_lwjgl_opengl_CallbackUtil +#define _Included_org_lwjgl_opengl_CallbackUtil +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: org_lwjgl_opengl_CallbackUtil + * Method: ncreateGlobalRef + * Signature: (Ljava/lang/Object;)J + */ +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_CallbackUtil_ncreateGlobalRef + (JNIEnv *, jclass, jobject); + +/* + * Class: org_lwjgl_opengl_CallbackUtil + * Method: deleteGlobalRef + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CallbackUtil_deleteGlobalRef + (JNIEnv *, jclass, jlong); + +/* + * Class: org_lwjgl_opengl_CallbackUtil + * Method: getDebugOutputCallbackARB + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_CallbackUtil_getDebugOutputCallbackARB + (JNIEnv *, jclass); + +/* + * Class: org_lwjgl_opengl_CallbackUtil + * Method: getDebugOutputCallbackAMD + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_CallbackUtil_getDebugOutputCallbackAMD + (JNIEnv *, jclass); + +/* + * Class: org_lwjgl_opengl_CallbackUtil + * Method: getDebugCallbackKHR + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_CallbackUtil_getDebugCallbackKHR + (JNIEnv *, jclass); + +#ifdef __cplusplus +} +#endif +#endif diff -Nru lwjgl-2.7.1+dfsg/src/native/common/opengl/org_lwjgl_opengl_GLContext.c lwjgl-2.9.3+dfsg/src/native/common/opengl/org_lwjgl_opengl_GLContext.c --- lwjgl-2.7.1+dfsg/src/native/common/opengl/org_lwjgl_opengl_GLContext.c 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/common/opengl/org_lwjgl_opengl_GLContext.c 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include "common_tools.h" +#include "org_lwjgl_opengl_GLContext.h" +#include "extgl.h" + +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_GLContext_ngetFunctionAddress(JNIEnv *env, jclass clazz, jlong function_name) { + return (jlong)(intptr_t)extgl_GetProcAddress((char *)(intptr_t)function_name); +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GLContext_nLoadOpenGLLibrary(JNIEnv * env, jclass clazz) { + extgl_Open(env); +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GLContext_nUnloadOpenGLLibrary(JNIEnv * env, jclass clazz) { + extgl_Close(); +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GLContext_resetNativeStubs(JNIEnv *env, jclass clazz, jclass gl_class) { + (*env)->UnregisterNatives(env, gl_class); +} diff -Nru lwjgl-2.7.1+dfsg/src/native/common/opengl/org_lwjgl_opengl_GLContext_CapabilitiesCacheEntry.h lwjgl-2.9.3+dfsg/src/native/common/opengl/org_lwjgl_opengl_GLContext_CapabilitiesCacheEntry.h --- lwjgl-2.7.1+dfsg/src/native/common/opengl/org_lwjgl_opengl_GLContext_CapabilitiesCacheEntry.h 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/common/opengl/org_lwjgl_opengl_GLContext_CapabilitiesCacheEntry.h 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,13 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_lwjgl_opengl_GLContext_CapabilitiesCacheEntry */ + +#ifndef _Included_org_lwjgl_opengl_GLContext_CapabilitiesCacheEntry +#define _Included_org_lwjgl_opengl_GLContext_CapabilitiesCacheEntry +#ifdef __cplusplus +extern "C" { +#endif +#ifdef __cplusplus +} +#endif +#endif diff -Nru lwjgl-2.7.1+dfsg/src/native/common/opengl/org_lwjgl_opengl_GLContext.h lwjgl-2.9.3+dfsg/src/native/common/opengl/org_lwjgl_opengl_GLContext.h --- lwjgl-2.7.1+dfsg/src/native/common/opengl/org_lwjgl_opengl_GLContext.h 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/common/opengl/org_lwjgl_opengl_GLContext.h 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,45 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_lwjgl_opengl_GLContext */ + +#ifndef _Included_org_lwjgl_opengl_GLContext +#define _Included_org_lwjgl_opengl_GLContext +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: org_lwjgl_opengl_GLContext + * Method: ngetFunctionAddress + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_GLContext_ngetFunctionAddress + (JNIEnv *, jclass, jlong); + +/* + * Class: org_lwjgl_opengl_GLContext + * Method: nLoadOpenGLLibrary + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GLContext_nLoadOpenGLLibrary + (JNIEnv *, jclass); + +/* + * Class: org_lwjgl_opengl_GLContext + * Method: nUnloadOpenGLLibrary + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GLContext_nUnloadOpenGLLibrary + (JNIEnv *, jclass); + +/* + * Class: org_lwjgl_opengl_GLContext + * Method: resetNativeStubs + * Signature: (Ljava/lang/Class;)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GLContext_resetNativeStubs + (JNIEnv *, jclass, jclass); + +#ifdef __cplusplus +} +#endif +#endif diff -Nru lwjgl-2.7.1+dfsg/src/native/common/opengl/org_lwjgl_opengl_NVPresentVideoUtil.c lwjgl-2.9.3+dfsg/src/native/common/opengl/org_lwjgl_opengl_NVPresentVideoUtil.c --- lwjgl-2.7.1+dfsg/src/native/common/opengl/org_lwjgl_opengl_NVPresentVideoUtil.c 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/common/opengl/org_lwjgl_opengl_NVPresentVideoUtil.c 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * JNI implementation of the NVPresentVideoUtil class (GLX & WGL only). + * + * @author Spasi + */ + +#include +#include "common_tools.h" +#include "extgl.h" +#include "org_lwjgl_opengl_NVPresentVideoUtil.h" + +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_NVPresentVideoUtil_nglEnumerateVideoDevicesNV( + JNIEnv *env, jclass clazz, jobject peer_info, jobject devices, jint devices_position +) { + #ifdef __APPLE__ + return 0; + #else + return extgl_EnumerateVideoDevicesNV(env, peer_info, devices, devices_position); + #endif +} + +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_NVPresentVideoUtil_nglBindVideoDeviceNV( + JNIEnv *env, jclass clazz, jobject peer_info, jint video_slot, jlong video_device, jobject attrib_list, jint attrib_list_position +) { + #ifdef __APPLE__ + return false; + #else + return extgl_BindVideoDeviceNV(env, peer_info, video_slot, video_device, attrib_list, attrib_list_position); + #endif +} + +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_NVPresentVideoUtil_nglQueryContextNV(JNIEnv *env, jclass clazz, jobject peer_info, jobject context_handle, jint attrib, jobject value, jint value_position) { + #ifdef __APPLE__ + return false; + #else + return extgl_QueryContextNV(env, peer_info, context_handle, attrib, value, value_position); + #endif +} diff -Nru lwjgl-2.7.1+dfsg/src/native/common/opengl/org_lwjgl_opengl_NVPresentVideoUtil.h lwjgl-2.9.3+dfsg/src/native/common/opengl/org_lwjgl_opengl_NVPresentVideoUtil.h --- lwjgl-2.7.1+dfsg/src/native/common/opengl/org_lwjgl_opengl_NVPresentVideoUtil.h 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/common/opengl/org_lwjgl_opengl_NVPresentVideoUtil.h 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,37 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_lwjgl_opengl_NVPresentVideoUtil */ + +#ifndef _Included_org_lwjgl_opengl_NVPresentVideoUtil +#define _Included_org_lwjgl_opengl_NVPresentVideoUtil +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: org_lwjgl_opengl_NVPresentVideoUtil + * Method: nglEnumerateVideoDevicesNV + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/LongBuffer;I)I + */ +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_NVPresentVideoUtil_nglEnumerateVideoDevicesNV + (JNIEnv *, jclass, jobject, jobject, jint); + +/* + * Class: org_lwjgl_opengl_NVPresentVideoUtil + * Method: nglBindVideoDeviceNV + * Signature: (Ljava/nio/ByteBuffer;IJLjava/nio/IntBuffer;I)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_NVPresentVideoUtil_nglBindVideoDeviceNV + (JNIEnv *, jclass, jobject, jint, jlong, jobject, jint); + +/* + * Class: org_lwjgl_opengl_NVPresentVideoUtil + * Method: nglQueryContextNV + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/ByteBuffer;ILjava/nio/IntBuffer;I)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_NVPresentVideoUtil_nglQueryContextNV + (JNIEnv *, jclass, jobject, jobject, jint, jobject, jint); + +#ifdef __cplusplus +} +#endif +#endif diff -Nru lwjgl-2.7.1+dfsg/src/native/common/opengl/org_lwjgl_opengl_NVVideoCaptureUtil.c lwjgl-2.9.3+dfsg/src/native/common/opengl/org_lwjgl_opengl_NVVideoCaptureUtil.c --- lwjgl-2.7.1+dfsg/src/native/common/opengl/org_lwjgl_opengl_NVVideoCaptureUtil.c 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/common/opengl/org_lwjgl_opengl_NVVideoCaptureUtil.c 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * JNI implementation of the NVVideoCaptureUtil class (GLX & WGL only). + * + * @author Spasi + */ + +#include +#include "common_tools.h" +#include "extgl.h" +#include "org_lwjgl_opengl_NVVideoCaptureUtil.h" + +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_NVVideoCaptureUtil_nglBindVideoCaptureDeviceNV(JNIEnv *env, jclass clazz, jobject peer_info, jint video_slot, jlong device) { + #ifdef __APPLE__ + return false; + #else + return extgl_BindVideoCaptureDeviceNV(env, peer_info, video_slot, device); + #endif +} + +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_NVVideoCaptureUtil_nglEnumerateVideoCaptureDevicesNV(JNIEnv *env, jclass clazz, jobject peer_info, jobject devices, jint devices_position) { + #ifdef __APPLE__ + return 0; + #else + return extgl_EnumerateVideoCaptureDevicesNV(env, peer_info, devices, devices_position); + #endif +} + +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_NVVideoCaptureUtil_nglLockVideoCaptureDeviceNV(JNIEnv *env, jclass clazz, jobject peer_info, jlong device) { + #ifdef __APPLE__ + return false; + #else + return extgl_LockVideoCaptureDeviceNV(env, peer_info, device); + #endif +} + +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_NVVideoCaptureUtil_nglQueryVideoCaptureDeviceNV(JNIEnv *env, jclass clazz, jobject peer_info, jlong device, jint attribute, jobject value, jint value_position) { + #ifdef __APPLE__ + return false; + #else + return extgl_QueryVideoCaptureDeviceNV(env, peer_info, device, attribute, value, value_position); + #endif +} + +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_NVVideoCaptureUtil_nglReleaseVideoCaptureDeviceNV(JNIEnv *env, jclass clazz, jobject peer_info, jlong device) { + #ifdef __APPLE__ + return false; + #else + return extgl_ReleaseVideoCaptureDeviceNV(env, peer_info, device); + #endif +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/native/common/opengl/org_lwjgl_opengl_NVVideoCaptureUtil.h lwjgl-2.9.3+dfsg/src/native/common/opengl/org_lwjgl_opengl_NVVideoCaptureUtil.h --- lwjgl-2.7.1+dfsg/src/native/common/opengl/org_lwjgl_opengl_NVVideoCaptureUtil.h 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/common/opengl/org_lwjgl_opengl_NVVideoCaptureUtil.h 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,53 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_lwjgl_opengl_NVVideoCaptureUtil */ + +#ifndef _Included_org_lwjgl_opengl_NVVideoCaptureUtil +#define _Included_org_lwjgl_opengl_NVVideoCaptureUtil +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: org_lwjgl_opengl_NVVideoCaptureUtil + * Method: nglBindVideoCaptureDeviceNV + * Signature: (Ljava/nio/ByteBuffer;IJ)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_NVVideoCaptureUtil_nglBindVideoCaptureDeviceNV + (JNIEnv *, jclass, jobject, jint, jlong); + +/* + * Class: org_lwjgl_opengl_NVVideoCaptureUtil + * Method: nglEnumerateVideoCaptureDevicesNV + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/LongBuffer;I)I + */ +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_NVVideoCaptureUtil_nglEnumerateVideoCaptureDevicesNV + (JNIEnv *, jclass, jobject, jobject, jint); + +/* + * Class: org_lwjgl_opengl_NVVideoCaptureUtil + * Method: nglLockVideoCaptureDeviceNV + * Signature: (Ljava/nio/ByteBuffer;J)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_NVVideoCaptureUtil_nglLockVideoCaptureDeviceNV + (JNIEnv *, jclass, jobject, jlong); + +/* + * Class: org_lwjgl_opengl_NVVideoCaptureUtil + * Method: nglQueryVideoCaptureDeviceNV + * Signature: (Ljava/nio/ByteBuffer;JILjava/nio/IntBuffer;I)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_NVVideoCaptureUtil_nglQueryVideoCaptureDeviceNV + (JNIEnv *, jclass, jobject, jlong, jint, jobject, jint); + +/* + * Class: org_lwjgl_opengl_NVVideoCaptureUtil + * Method: nglReleaseVideoCaptureDeviceNV + * Signature: (Ljava/nio/ByteBuffer;J)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_NVVideoCaptureUtil_nglReleaseVideoCaptureDeviceNV + (JNIEnv *, jclass, jobject, jlong); + +#ifdef __cplusplus +} +#endif +#endif diff -Nru lwjgl-2.7.1+dfsg/src/native/common/opengl/org_lwjgl_opengl_Pbuffer.h lwjgl-2.9.3+dfsg/src/native/common/opengl/org_lwjgl_opengl_Pbuffer.h --- lwjgl-2.7.1+dfsg/src/native/common/opengl/org_lwjgl_opengl_Pbuffer.h 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/common/opengl/org_lwjgl_opengl_Pbuffer.h 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,47 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_lwjgl_opengl_Pbuffer */ + +#ifndef _Included_org_lwjgl_opengl_Pbuffer +#define _Included_org_lwjgl_opengl_Pbuffer +#ifdef __cplusplus +extern "C" { +#endif +#undef org_lwjgl_opengl_Pbuffer_PBUFFER_SUPPORTED +#define org_lwjgl_opengl_Pbuffer_PBUFFER_SUPPORTED 1L +#undef org_lwjgl_opengl_Pbuffer_RENDER_TEXTURE_SUPPORTED +#define org_lwjgl_opengl_Pbuffer_RENDER_TEXTURE_SUPPORTED 2L +#undef org_lwjgl_opengl_Pbuffer_RENDER_TEXTURE_RECTANGLE_SUPPORTED +#define org_lwjgl_opengl_Pbuffer_RENDER_TEXTURE_RECTANGLE_SUPPORTED 4L +#undef org_lwjgl_opengl_Pbuffer_RENDER_DEPTH_TEXTURE_SUPPORTED +#define org_lwjgl_opengl_Pbuffer_RENDER_DEPTH_TEXTURE_SUPPORTED 8L +#undef org_lwjgl_opengl_Pbuffer_MIPMAP_LEVEL +#define org_lwjgl_opengl_Pbuffer_MIPMAP_LEVEL 8315L +#undef org_lwjgl_opengl_Pbuffer_CUBE_MAP_FACE +#define org_lwjgl_opengl_Pbuffer_CUBE_MAP_FACE 8316L +#undef org_lwjgl_opengl_Pbuffer_TEXTURE_CUBE_MAP_POSITIVE_X +#define org_lwjgl_opengl_Pbuffer_TEXTURE_CUBE_MAP_POSITIVE_X 8317L +#undef org_lwjgl_opengl_Pbuffer_TEXTURE_CUBE_MAP_NEGATIVE_X +#define org_lwjgl_opengl_Pbuffer_TEXTURE_CUBE_MAP_NEGATIVE_X 8318L +#undef org_lwjgl_opengl_Pbuffer_TEXTURE_CUBE_MAP_POSITIVE_Y +#define org_lwjgl_opengl_Pbuffer_TEXTURE_CUBE_MAP_POSITIVE_Y 8319L +#undef org_lwjgl_opengl_Pbuffer_TEXTURE_CUBE_MAP_NEGATIVE_Y +#define org_lwjgl_opengl_Pbuffer_TEXTURE_CUBE_MAP_NEGATIVE_Y 8320L +#undef org_lwjgl_opengl_Pbuffer_TEXTURE_CUBE_MAP_POSITIVE_Z +#define org_lwjgl_opengl_Pbuffer_TEXTURE_CUBE_MAP_POSITIVE_Z 8321L +#undef org_lwjgl_opengl_Pbuffer_TEXTURE_CUBE_MAP_NEGATIVE_Z +#define org_lwjgl_opengl_Pbuffer_TEXTURE_CUBE_MAP_NEGATIVE_Z 8322L +#undef org_lwjgl_opengl_Pbuffer_FRONT_LEFT_BUFFER +#define org_lwjgl_opengl_Pbuffer_FRONT_LEFT_BUFFER 8323L +#undef org_lwjgl_opengl_Pbuffer_FRONT_RIGHT_BUFFER +#define org_lwjgl_opengl_Pbuffer_FRONT_RIGHT_BUFFER 8324L +#undef org_lwjgl_opengl_Pbuffer_BACK_LEFT_BUFFER +#define org_lwjgl_opengl_Pbuffer_BACK_LEFT_BUFFER 8325L +#undef org_lwjgl_opengl_Pbuffer_BACK_RIGHT_BUFFER +#define org_lwjgl_opengl_Pbuffer_BACK_RIGHT_BUFFER 8326L +#undef org_lwjgl_opengl_Pbuffer_DEPTH_BUFFER +#define org_lwjgl_opengl_Pbuffer_DEPTH_BUFFER 8359L +#ifdef __cplusplus +} +#endif +#endif diff -Nru lwjgl-2.7.1+dfsg/src/native/common/opengles/extgl.c lwjgl-2.9.3+dfsg/src/native/common/opengles/extgl.c --- lwjgl-2.7.1+dfsg/src/native/common/opengles/extgl.c 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/common/opengles/extgl.c 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,83 @@ +/* ---------------------------------------------------------------------------- +Copyright (c) 2001-2002, Lev Povalahev +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * The name of the author may be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF +THE POSSIBILITY OF SUCH DAMAGE. +------------------------------------------------------------------------------*/ +/* + Lev Povalahev + + levp@gmx.net + + http://www.uni-karlsruhe.de/~uli2/ + +*/ + +#include +#include +#include "extgl.h" +#include "common_tools.h" + +void extgl_InitializeClass(JNIEnv *env, jclass clazz, int num_functions, JavaMethodAndExtFunction *functions) { + ext_InitializeClass(env, clazz, &extgl_GetProcAddress, num_functions, functions); +} + +bool extgl_InitializeFunctions(int num_functions, ExtFunction *functions) { + return ext_InitializeFunctions(&extgl_GetProcAddress, num_functions, functions); +} + +bool extgl_QueryExtension(const char *extensions, const char *name) +{ + const char *start; + char *where, *terminator; + + if (extensions == NULL) { + printfDebug("NULL extension string\n"); + return false; + } + + /* Extension names should not have spaces. */ + where = (char *) strchr(name, ' '); + if (where || *name == '\0') + return false; + + /* It takes a bit of care to be fool-proof about parsing the + OpenGL extensions string. Don't be fooled by sub-strings, + etc. */ + start = extensions; + for (;;) + { + where = (char *) strstr((const char *) start, name); + if (!where) + break; + terminator = where + strlen(name); + if (where == start || *(where - 1) == ' ') + if (*terminator == ' ' || *terminator == '\0') { + return true; + } + start = terminator; + } + return false; + +} + diff -Nru lwjgl-2.7.1+dfsg/src/native/common/opengles/extgl_egl.c lwjgl-2.9.3+dfsg/src/native/common/opengles/extgl_egl.c --- lwjgl-2.7.1+dfsg/src/native/common/opengles/extgl_egl.c 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/common/opengles/extgl_egl.c 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,106 @@ +/* +* Copyright (c) 2002-2011 LWJGL Project +* All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are +* met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* +* * Neither the name of 'LWJGL' nor the names of +* its contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +#include "extgl_egl.h" + +static void extgl_InitEGLKHRLockSurface(EGLExtensions *extensions) { + ExtFunction functions[] = { + { "eglLockSurfaceKHR", (void *)&extensions->eglLockSurfaceKHR }, + { "eglUnlockSurfaceKHR", (void *)&extensions->eglUnlockSurfaceKHR } + }; + if ( extensions->EGLKHRLockSurface ) + extensions->EGLKHRLockSurface = extgl_InitializeFunctions(sizeof(functions)/sizeof(ExtFunction), functions); +} + +static void extgl_InitEGLKHRImageBase(EGLExtensions *extensions) { + ExtFunction functions[] = { + { "eglCreateImageKHR", (void *)&extensions->eglCreateImageKHR }, + { "eglDestroyImageKHR", (void *)&extensions->eglDestroyImageKHR } + }; + if ( extensions->EGLKHRImageBase ) + extensions->EGLKHRImageBase = extgl_InitializeFunctions(sizeof(functions)/sizeof(ExtFunction), functions); +} + +static void extgl_InitEGLKHRFenceSync(EGLExtensions *extensions) { + ExtFunction functions[] = { + { "eglCreateSyncKHR", (void *)&extensions->eglCreateSyncKHR }, + { "eglDestroySyncKHR", (void *)&extensions->eglDestroySyncKHR }, + { "eglClientWaitSyncKHR", (void *)&extensions->eglClientWaitSyncKHR }, + { "eglSignalSyncKHR", (void *)&extensions->eglSignalSyncKHR }, + { "eglGetSyncAttribKHR", (void *)&extensions->eglGetSyncAttribKHR } + }; + if (extensions->EGLKHRFenceSync) + extensions->EGLKHRFenceSync = extgl_InitializeFunctions(sizeof(functions)/sizeof(ExtFunction), functions); +} + +static void extgl_InitEGLNVSync(EGLExtensions *extensions) { + ExtFunction functions[] = { + { "eglCreateFenceSyncNV", (void *)&extensions->eglCreateFenceSyncNV }, + { "eglDestroySyncNV", (void *)&extensions->eglDestroySyncNV }, + { "eglFenceNV", (void *)&extensions->eglFenceNV }, + { "eglClientWaitSyncNV", (void *)&extensions->eglClientWaitSyncNV }, + { "eglSignalSyncNV", (void *)&extensions->eglSignalSyncNV }, + { "eglGetSyncAttribNV", (void *)&extensions->eglGetSyncAttribNV } + + }; + if (extensions->EGLNVSync) + extensions->EGLNVSync = extgl_InitializeFunctions(sizeof(functions)/sizeof(ExtFunction), functions); +} + +static void extgl_InitSupportedEGLExtensions(EGLDisplay dpy, EGLExtensions *extensions) { + const char *extension_string = eglQueryString(dpy, EGL_EXTENSIONS); + + extensions->EGLKHRConfigAttribs = extgl_QueryExtension(extension_string, "EGL_KHR_config_attribs"); + extensions->EGLKHRLockSurface = extgl_QueryExtension(extension_string, "EGL_KHR_lock_surface"); + extensions->EGLKHRImage = extgl_QueryExtension(extension_string, "EGL_KHR_image"); + extensions->EGLKHRVGParentImage = extgl_QueryExtension(extension_string, "EGL_KHR_vg_parent_image"); + extensions->EGLKHRGLTexture2DImage = extgl_QueryExtension(extension_string, "EGL_KHR_gl_texture_2D_image"); + extensions->EGLKHRGLTextureCubemapImage = extgl_QueryExtension(extension_string, "EGL_KHR_gl_texture_cubemap_image"); + extensions->EGLKHRGLTexture3DImage = extgl_QueryExtension(extension_string, "EGL_KHR_gl_texture_3D_image"); + extensions->EGLKHRGLRenderbufferImage = extgl_QueryExtension(extension_string, "EGL_KHR_gl_renderbuffer_image"); + extensions->EGLKHRReusableSync = extgl_QueryExtension(extension_string, "EGL_KHR_reusable_sync"); + extensions->EGLKHRImageBase = extgl_QueryExtension(extension_string, "EGL_KHR_image_base"); + extensions->EGLKHRImagePixmap = extgl_QueryExtension(extension_string, "EGL_KHR_image_pixmap"); + extensions->EGLIMGContextPriority = extgl_QueryExtension(extension_string, "EGL_IMG_context_priority"); + extensions->EGLNVCoverageSample = extgl_QueryExtension(extension_string, "EGL_NV_coverage_sample"); + extensions->EGLNVDepthNonlinear = extgl_QueryExtension(extension_string, "EGL_NV_depth_nonlinear"); + extensions->EGLNVSync = extgl_QueryExtension(extension_string, "EGL_NV_sync"); + extensions->EGLKHRFenceSync = extgl_QueryExtension(extension_string, "EGL_KHR_fence_sync"); +} + +void extgl_InitEGL(EGLDisplay dpy, EGLExtensions *extensions) { + extgl_InitSupportedEGLExtensions(dpy, extensions); + + extgl_InitEGLKHRLockSurface(extensions); + extgl_InitEGLKHRImageBase(extensions); + extgl_InitEGLKHRFenceSync(extensions); + extgl_InitEGLNVSync(extensions); +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/native/common/opengles/extgl_egl.h lwjgl-2.9.3+dfsg/src/native/common/opengles/extgl_egl.h --- lwjgl-2.7.1+dfsg/src/native/common/opengles/extgl_egl.h 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/common/opengles/extgl_egl.h 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef _EXTGL_EGL_H +#define _EXTGL_EGL_H + +#include "extgl.h" +#include "common_tools.h" + +#include + +typedef struct { + bool EGLKHRConfigAttribs; + bool EGLKHRLockSurface; + bool EGLKHRImage; + bool EGLKHRVGParentImage; + bool EGLKHRGLTexture2DImage; + bool EGLKHRGLTextureCubemapImage; + bool EGLKHRGLTexture3DImage; + bool EGLKHRGLRenderbufferImage; + bool EGLKHRFenceSync; + bool EGLKHRReusableSync; + bool EGLKHRImageBase; + bool EGLKHRImagePixmap; + bool EGLIMGContextPriority; + bool EGLNVCoverageSample; + bool EGLNVDepthNonlinear; + bool EGLNVSync; + + PFNEGLLOCKSURFACEKHRPROC eglLockSurfaceKHR; + PFNEGLUNLOCKSURFACEKHRPROC eglUnlockSurfaceKHR; + + PFNEGLCREATEIMAGEKHRPROC eglCreateImageKHR; + PFNEGLDESTROYIMAGEKHRPROC eglDestroyImageKHR; + + PFNEGLCREATESYNCKHRPROC eglCreateSyncKHR; + PFNEGLDESTROYSYNCKHRPROC eglDestroySyncKHR; + PFNEGLCLIENTWAITSYNCKHRPROC eglClientWaitSyncKHR; + PFNEGLSIGNALSYNCKHRPROC eglSignalSyncKHR; + PFNEGLGETSYNCATTRIBKHRPROC eglGetSyncAttribKHR; + + PFNEGLCREATEFENCESYNCNVPROC eglCreateFenceSyncNV; + PFNEGLDESTROYSYNCNVPROC eglDestroySyncNV; + PFNEGLFENCENVPROC eglFenceNV; + PFNEGLCLIENTWAITSYNCNVPROC eglClientWaitSyncNV; + PFNEGLSIGNALSYNCNVPROC eglSignalSyncNV; + PFNEGLGETSYNCATTRIBNVPROC eglGetSyncAttribNV; +} EGLExtensions; + +extern void extgl_InitEGL(EGLDisplay dpy, EGLExtensions *extensions); + +#endif diff -Nru lwjgl-2.7.1+dfsg/src/native/common/opengles/extgl.h lwjgl-2.9.3+dfsg/src/native/common/opengles/extgl.h --- lwjgl-2.7.1+dfsg/src/native/common/opengles/extgl.h 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/common/opengles/extgl.h 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,92 @@ +/* Small parts were taken from Mesa's glext.h and gl.h, here's the license: */ + +/* + * Mesa 3-D graphics library + * Version: 6.5.1 + * + * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +/* Some parts derived from files copyright (c) 2001-2002 Lev Povalahev under this license: */ + +/* ---------------------------------------------------------------------------- +Copyright (c) 2002, Lev Povalahev +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * The name of the author may be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF +THE POSSIBILITY OF SUCH DAMAGE. +------------------------------------------------------------------------------*/ +/* + GL_draw_range_elements support added by Benjamin Karaban + + Lev Povalahev contact information: + + levp@gmx.net + + http://www.uni-karlsruhe.de/~uli2/ +*/ + +#ifndef __EXTGL_H__ +#define __EXTGL_H__ + +#include + +#include +#include + +#include "common_tools.h" + +#include +//#include +#include + +#include "extgl_types.h" + +/* KHR_debug callback function pointer. */ +typedef void (GL_APIENTRY *GLDEBUGPROC)(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message, GLvoid* userParam); + +/* initializes everything, call this right after the rc is created. the function returns true if successful */ +extern bool extgl_Open(JNIEnv *env); +extern void extgl_Close(void); +extern void extgl_InitializeClass(JNIEnv *env, jclass clazz, int num_functions, JavaMethodAndExtFunction *functions); +extern bool extgl_InitializeFunctions(int num_functions, ExtFunction *functions); +extern bool extgl_QueryExtension(const char *extensions, const char *name); +extern void *extgl_GetProcAddress(const char *name); + +#endif /* __EXTGL_H__ */ diff -Nru lwjgl-2.7.1+dfsg/src/native/common/opengles/extgl_types.h lwjgl-2.9.3+dfsg/src/native/common/opengles/extgl_types.h --- lwjgl-2.7.1+dfsg/src/native/common/opengles/extgl_types.h 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/common/opengles/extgl_types.h 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef _EXTGL_TYPES_H +#define _EXTGL_TYPES_H + +#include + +/*------------------------------------------------------------------------- + * Data type definitions + *-----------------------------------------------------------------------*/ + +typedef void GLvoid; +typedef char GLchar; +typedef unsigned int GLenum; +typedef unsigned char GLboolean; +typedef unsigned int GLbitfield; +typedef khronos_int8_t GLbyte; +typedef short GLshort; +typedef int GLint; +typedef int GLsizei; +typedef khronos_uint8_t GLubyte; +typedef unsigned short GLushort; +typedef unsigned int GLuint; +typedef khronos_float_t GLfloat; +typedef khronos_float_t GLclampf; +typedef khronos_int32_t GLfixed; + +// OpenGL ES 3.0 +typedef unsigned short GLhalf; +typedef khronos_int64_t GLint64; +typedef khronos_uint64_t GLuint64; +typedef struct __GLsync *GLsync; + +/* GL types for handling large vertex buffer objects */ +typedef khronos_intptr_t GLintptr; +typedef khronos_ssize_t GLsizeiptr; + +typedef khronos_int64_t EGLint64NV; +typedef khronos_uint64_t EGLuint64NV; + +// EGL_image_OES +typedef void* GLeglImageOES; + +#endif \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/native/common/opengles/org_lwjgl_opengles_CallbackUtil.c lwjgl-2.9.3+dfsg/src/native/common/opengles/org_lwjgl_opengles_CallbackUtil.c --- lwjgl-2.7.1+dfsg/src/native/common/opengles/org_lwjgl_opengles_CallbackUtil.c 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/common/opengles/org_lwjgl_opengles_CallbackUtil.c 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * JNI implementation of the ARB/AMD_debug_output & KHR_debug function callbacks. + * + * @author Spasi + */ + +#include +#include "common_tools.h" +#include "extgl.h" +#include "org_lwjgl_opengles_CallbackUtil.h" + +static jmethodID debugCallbackKHRJ; + +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_CallbackUtil_ncreateGlobalRef(JNIEnv *env, jclass clazz, jobject obj) { + return (jlong)(intptr_t)(*env)->NewGlobalRef(env, obj); +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CallbackUtil_deleteGlobalRef(JNIEnv *env, jclass clazz, jlong globalRef) { + (*env)->DeleteGlobalRef(env, (jobject)(intptr_t)globalRef); +} + +// ----------------- [ KHR_debug ] ----------------- + +static void EGLAPIENTRY debugCallbackKHR(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message, GLvoid* userParam) { + JNIEnv *env = attachCurrentThread(); + + if ( env != NULL && !(*env)->ExceptionOccurred(env) && debugCallbackKHRJ != NULL ) { + (*env)->CallVoidMethod(env, (jobject)userParam, debugCallbackKHRJ, + (jint)source, + (jint)type, + (jint)id, + (jint)severity, + NewStringNativeWithLength(env, message, length) + ); + } + + detachCurrentThread(); +} + +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_CallbackUtil_getDebugCallbackKHR(JNIEnv *env, jclass clazz) { + // Cache the callback methodID + jclass callbackClass; + if ( debugCallbackKHRJ == NULL ) { + callbackClass = (*env)->FindClass(env, "org/lwjgl/opengles/KHRDebugCallback$Handler"); + if ( callbackClass != NULL ) + debugCallbackKHRJ = (*env)->GetMethodID(env, callbackClass, "handleMessage", "(IIIILjava/lang/String;)V"); + } + + return (jlong)(intptr_t)&debugCallbackKHR; +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/native/common/opengles/org_lwjgl_opengles_CallbackUtil.h lwjgl-2.9.3+dfsg/src/native/common/opengles/org_lwjgl_opengles_CallbackUtil.h --- lwjgl-2.7.1+dfsg/src/native/common/opengles/org_lwjgl_opengles_CallbackUtil.h 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/common/opengles/org_lwjgl_opengles_CallbackUtil.h 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,37 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_lwjgl_opengles_CallbackUtil */ + +#ifndef _Included_org_lwjgl_opengles_CallbackUtil +#define _Included_org_lwjgl_opengles_CallbackUtil +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: org_lwjgl_opengles_CallbackUtil + * Method: ncreateGlobalRef + * Signature: (Ljava/lang/Object;)J + */ +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengles_CallbackUtil_ncreateGlobalRef + (JNIEnv *, jclass, jobject); + +/* + * Class: org_lwjgl_opengles_CallbackUtil + * Method: deleteGlobalRef + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengles_CallbackUtil_deleteGlobalRef + (JNIEnv *, jclass, jlong); + +/* + * Class: org_lwjgl_opengles_CallbackUtil + * Method: getDebugCallbackKHR + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengles_CallbackUtil_getDebugCallbackKHR + (JNIEnv *, jclass); + +#ifdef __cplusplus +} +#endif +#endif diff -Nru lwjgl-2.7.1+dfsg/src/native/common/opengles/org_lwjgl_opengles_EGL.c lwjgl-2.9.3+dfsg/src/native/common/opengles/org_lwjgl_opengles_EGL.c --- lwjgl-2.7.1+dfsg/src/native/common/opengles/org_lwjgl_opengles_EGL.c 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/common/opengles/org_lwjgl_opengles_EGL.c 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,211 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include "common_tools.h" +#include "org_lwjgl_opengles_EGL.h" +#include "extgl_egl.h" + +JNIEXPORT jint JNICALL Java_org_lwjgl_opengles_EGL_eglGetError(JNIEnv *env, jclass clazz) { + return eglGetError(); +} + +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengles_EGL_neglGetDisplay(JNIEnv *env, jclass clazz, jlong display_id) { + return (intptr_t)eglGetDisplay((EGLNativeDisplayType)(intptr_t)display_id); +} + +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGL_neglInitialize(JNIEnv *env, jclass clazz, jlong dpy_ptr, jlong version) { + EGLDisplay dpy = (EGLDisplay)(intptr_t)dpy_ptr; + EGLint *version_address = (EGLint *)(intptr_t)version; + + return eglInitialize(dpy, version_address, version_address + 1); +} + +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGL_neglTerminate(JNIEnv *env, jclass clazz, jlong dpy_ptr) { + EGLDisplay dpy = (EGLDisplay)(intptr_t)dpy_ptr; + + return eglTerminate(dpy); +} + +JNIEXPORT jstring JNICALL Java_org_lwjgl_opengles_EGL_neglQueryString(JNIEnv *env, jclass clazz, jlong dpy_ptr, jint name) { + EGLDisplay dpy = (EGLDisplay)(intptr_t)dpy_ptr; + const char * __result = eglQueryString(dpy, name); + if ( __result == NULL ) + return NULL; + + return NewStringNativeWithLength(env, __result, (jsize)strlen(__result)); +} + +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGL_neglGetConfigs(JNIEnv *env, jclass clazz, jlong dpy_ptr, jlong configs, jint config_size, jlong num_config) { + EGLDisplay dpy = (EGLDisplay)(intptr_t)dpy_ptr; + EGLConfig *configs_address = (EGLConfig *)(intptr_t)configs; + EGLint *num_config_address = (EGLint *)(intptr_t)num_config; + + return eglGetConfigs(dpy, configs_address, config_size, num_config_address); +} + +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGL_neglChooseConfig(JNIEnv *env, jclass clazz, jlong dpy_ptr, jlong attrib_list, jlong configs, jint config_size, jlong num_config) { + EGLDisplay dpy = (EGLDisplay)(intptr_t)dpy_ptr; + const EGLint *attrib_list_address = (EGLint *)(intptr_t)attrib_list; + EGLConfig *configs_address = (EGLConfig *)(intptr_t)configs; + EGLint *num_config_address = (EGLint *)(intptr_t)num_config; + + return eglChooseConfig(dpy, attrib_list_address, configs_address, config_size, num_config_address); +} + +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGL_neglGetConfigAttrib(JNIEnv *env, jclass clazz, jlong dpy_ptr, jlong config_ptr, jint attribute, jlong value) { + EGLDisplay dpy = (EGLDisplay)(intptr_t)dpy_ptr; + EGLConfig config = (EGLConfig)(intptr_t)config_ptr; + EGLint *value_address = (EGLint *)(intptr_t)value; + + return eglGetConfigAttrib(dpy, config, attribute, value_address); +} + +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengles_EGL_neglCreateWindowSurface(JNIEnv *env, jclass clazz, jlong dpy_ptr, jlong config_ptr, jlong win, jlong attrib_list) { + EGLDisplay dpy = (EGLDisplay)(intptr_t)dpy_ptr; + EGLConfig config = (EGLConfig)(intptr_t)config_ptr; + const EGLint *attrib_list_address = (EGLint *)(intptr_t)attrib_list; + + return (intptr_t)eglCreateWindowSurface(dpy, config, (EGLNativeWindowType)(intptr_t)win, attrib_list_address); +} + +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengles_EGL_neglCreatePbufferSurface(JNIEnv *env, jclass clazz, jlong dpy_ptr, jlong config_ptr, jlong attrib_list) { + EGLDisplay dpy = (EGLDisplay)(intptr_t)dpy_ptr; + EGLConfig config = (EGLConfig)(intptr_t)config_ptr; + const EGLint *attrib_list_address = (EGLint *)(intptr_t)attrib_list; + + return (intptr_t)eglCreatePbufferSurface(dpy, config, attrib_list_address); +} + +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGL_neglDestroySurface(JNIEnv *env, jclass clazz, jlong dpy_ptr, jlong surface_ptr) { + EGLDisplay dpy = (EGLDisplay)(intptr_t)dpy_ptr; + EGLSurface surface = (EGLSurface)(intptr_t)surface_ptr; + + return eglDestroySurface(dpy, surface); +} + +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGL_neglSurfaceAttrib(JNIEnv *env, jclass clazz, jlong dpy_ptr, jlong surface_ptr, jint attribute, jint value) { + EGLDisplay dpy = (EGLDisplay)(intptr_t)dpy_ptr; + EGLSurface surface = (EGLSurface)(intptr_t)surface_ptr; + + return eglSurfaceAttrib(dpy, surface, attribute, value); +} + +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGL_neglQuerySurface(JNIEnv *env, jclass clazz, jlong dpy_ptr, jlong surface_ptr, jint attribute, jlong value) { + EGLDisplay dpy = (EGLDisplay)(intptr_t)dpy_ptr; + EGLSurface surface = (EGLSurface)(intptr_t)surface_ptr; + EGLint *value_address = (EGLint *)(intptr_t)value; + + return eglQuerySurface(dpy, surface, attribute, value_address); +} + +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGL_eglBindAPI(JNIEnv *env, jclass clazz, jint api) { + return eglBindAPI(api); +} + +JNIEXPORT jint JNICALL Java_org_lwjgl_opengles_EGL_eglQueryAPI(JNIEnv *env, jclass clazz) { + return eglQueryAPI(); +} + +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGL_eglReleaseThread(JNIEnv *env, jclass clazz) { + return eglReleaseThread(); +} + +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGL_neglSwapInterval(JNIEnv *env, jclass clazz, jlong dpy_ptr, jint interval) { + EGLDisplay dpy = (EGLDisplay)(intptr_t)dpy_ptr; + return eglSwapInterval(dpy, interval); +} + +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengles_EGL_neglCreateContext(JNIEnv *env, jclass clazz, jlong dpy_ptr, jlong config_ptr, jlong share_context_ptr, jlong attrib_list) { + EGLDisplay dpy = (EGLDisplay)(intptr_t)dpy_ptr; + EGLConfig config = (EGLConfig)(intptr_t)config_ptr; + EGLContext share_context = (EGLContext)(intptr_t)share_context_ptr; + const EGLint *attrib_list_address = (EGLint *)(intptr_t)attrib_list; + + return (intptr_t)eglCreateContext(dpy, config, share_context, attrib_list_address); +} + +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGL_neglDestroyContext(JNIEnv *env, jclass clazz, jlong dpy_ptr, jlong ctx_ptr) { + EGLDisplay dpy = (EGLDisplay)(intptr_t)dpy_ptr; + EGLContext ctx = (EGLContext)(intptr_t)ctx_ptr; + + return eglDestroyContext(dpy, ctx); +} + +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGL_neglMakeCurrent(JNIEnv *env, jclass clazz, jlong dpy_ptr, jlong draw_ptr, jlong read_ptr, jlong ctx_ptr) { + EGLDisplay dpy = (EGLDisplay)(intptr_t)dpy_ptr; + EGLSurface draw = (EGLSurface)(intptr_t)draw_ptr; + EGLSurface read = (EGLSurface)(intptr_t)read_ptr; + EGLContext ctx = (EGLContext)(intptr_t)ctx_ptr; + + return eglMakeCurrent(dpy, draw, read, ctx); +} + +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengles_EGL_neglGetCurrentContext(JNIEnv *env, jclass clazz) { + return (intptr_t)eglGetCurrentContext(); +} + +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengles_EGL_neglGetCurrentSurface(JNIEnv *env, jclass clazz, jint readdraw) { + return (intptr_t)eglGetCurrentSurface(readdraw); +} + +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengles_EGL_neglGetCurrentDisplay(JNIEnv *env, jclass clazz) { + return (intptr_t)eglGetCurrentDisplay(); +} + +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGL_neglQueryContext(JNIEnv *env, jclass clazz, jlong dpy_ptr, jlong ctx_ptr, jint attribute, jlong value) { + EGLDisplay dpy = (EGLDisplay)(intptr_t)dpy_ptr; + EGLContext ctx = (EGLContext)(intptr_t)ctx_ptr; + EGLint *value_address = (EGLint *)(intptr_t)value; + + return eglQueryContext(dpy, ctx, attribute, value_address); + +} + +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGL_eglWaitClient(JNIEnv *env, jclass clazz) { + return eglWaitClient(); +} + +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGL_eglWaitGL(JNIEnv *env, jclass clazz) { + return eglWaitGL(); +} + +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGL_eglWaitNative(JNIEnv *env, jclass clazz, jint engine) { + return eglWaitNative(engine); +} + +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGL_neglSwapBuffers(JNIEnv *env, jclass clazz, jlong dpy_ptr, jlong surface_ptr) { + EGLDisplay dpy = (EGLDisplay)(intptr_t)dpy_ptr; + EGLSurface surface = (EGLSurface)(intptr_t)surface_ptr; + + return eglSwapBuffers(dpy, surface); +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/native/common/opengles/org_lwjgl_opengles_EGL.h lwjgl-2.9.3+dfsg/src/native/common/opengles/org_lwjgl_opengles_EGL.h --- lwjgl-2.7.1+dfsg/src/native/common/opengles/org_lwjgl_opengles_EGL.h 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/common/opengles/org_lwjgl_opengles_EGL.h 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,469 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_lwjgl_opengles_EGL */ + +#ifndef _Included_org_lwjgl_opengles_EGL +#define _Included_org_lwjgl_opengles_EGL +#ifdef __cplusplus +extern "C" { +#endif +#undef org_lwjgl_opengles_EGL_EGL_FALSE +#define org_lwjgl_opengles_EGL_EGL_FALSE 0L +#undef org_lwjgl_opengles_EGL_EGL_TRUE +#define org_lwjgl_opengles_EGL_EGL_TRUE 1L +#undef org_lwjgl_opengles_EGL_EGL_DEFAULT_DISPLAY +#define org_lwjgl_opengles_EGL_EGL_DEFAULT_DISPLAY 0L +#undef org_lwjgl_opengles_EGL_EGL_NO_CONTEXT +#define org_lwjgl_opengles_EGL_EGL_NO_CONTEXT 0L +#undef org_lwjgl_opengles_EGL_EGL_NO_DISPLAY +#define org_lwjgl_opengles_EGL_EGL_NO_DISPLAY 0L +#undef org_lwjgl_opengles_EGL_EGL_NO_SURFACE +#define org_lwjgl_opengles_EGL_EGL_NO_SURFACE 0L +#undef org_lwjgl_opengles_EGL_EGL_DONT_CARE +#define org_lwjgl_opengles_EGL_EGL_DONT_CARE -1L +#undef org_lwjgl_opengles_EGL_EGL_SUCCESS +#define org_lwjgl_opengles_EGL_EGL_SUCCESS 12288L +#undef org_lwjgl_opengles_EGL_EGL_NOT_INITIALIZED +#define org_lwjgl_opengles_EGL_EGL_NOT_INITIALIZED 12289L +#undef org_lwjgl_opengles_EGL_EGL_BAD_ACCESS +#define org_lwjgl_opengles_EGL_EGL_BAD_ACCESS 12290L +#undef org_lwjgl_opengles_EGL_EGL_BAD_ALLOC +#define org_lwjgl_opengles_EGL_EGL_BAD_ALLOC 12291L +#undef org_lwjgl_opengles_EGL_EGL_BAD_ATTRIBUTE +#define org_lwjgl_opengles_EGL_EGL_BAD_ATTRIBUTE 12292L +#undef org_lwjgl_opengles_EGL_EGL_BAD_CONFIG +#define org_lwjgl_opengles_EGL_EGL_BAD_CONFIG 12293L +#undef org_lwjgl_opengles_EGL_EGL_BAD_CONTEXT +#define org_lwjgl_opengles_EGL_EGL_BAD_CONTEXT 12294L +#undef org_lwjgl_opengles_EGL_EGL_BAD_CURRENT_SURFACE +#define org_lwjgl_opengles_EGL_EGL_BAD_CURRENT_SURFACE 12295L +#undef org_lwjgl_opengles_EGL_EGL_BAD_DISPLAY +#define org_lwjgl_opengles_EGL_EGL_BAD_DISPLAY 12296L +#undef org_lwjgl_opengles_EGL_EGL_BAD_MATCH +#define org_lwjgl_opengles_EGL_EGL_BAD_MATCH 12297L +#undef org_lwjgl_opengles_EGL_EGL_BAD_NATIVE_PIXMAP +#define org_lwjgl_opengles_EGL_EGL_BAD_NATIVE_PIXMAP 12298L +#undef org_lwjgl_opengles_EGL_EGL_BAD_NATIVE_WINDOW +#define org_lwjgl_opengles_EGL_EGL_BAD_NATIVE_WINDOW 12299L +#undef org_lwjgl_opengles_EGL_EGL_BAD_PARAMETER +#define org_lwjgl_opengles_EGL_EGL_BAD_PARAMETER 12300L +#undef org_lwjgl_opengles_EGL_EGL_BAD_SURFACE +#define org_lwjgl_opengles_EGL_EGL_BAD_SURFACE 12301L +#undef org_lwjgl_opengles_EGL_EGL_CONTEXT_LOST +#define org_lwjgl_opengles_EGL_EGL_CONTEXT_LOST 12302L +#undef org_lwjgl_opengles_EGL_EGL_BUFFER_SIZE +#define org_lwjgl_opengles_EGL_EGL_BUFFER_SIZE 12320L +#undef org_lwjgl_opengles_EGL_EGL_ALPHA_SIZE +#define org_lwjgl_opengles_EGL_EGL_ALPHA_SIZE 12321L +#undef org_lwjgl_opengles_EGL_EGL_BLUE_SIZE +#define org_lwjgl_opengles_EGL_EGL_BLUE_SIZE 12322L +#undef org_lwjgl_opengles_EGL_EGL_GREEN_SIZE +#define org_lwjgl_opengles_EGL_EGL_GREEN_SIZE 12323L +#undef org_lwjgl_opengles_EGL_EGL_RED_SIZE +#define org_lwjgl_opengles_EGL_EGL_RED_SIZE 12324L +#undef org_lwjgl_opengles_EGL_EGL_DEPTH_SIZE +#define org_lwjgl_opengles_EGL_EGL_DEPTH_SIZE 12325L +#undef org_lwjgl_opengles_EGL_EGL_STENCIL_SIZE +#define org_lwjgl_opengles_EGL_EGL_STENCIL_SIZE 12326L +#undef org_lwjgl_opengles_EGL_EGL_CONFIG_CAVEAT +#define org_lwjgl_opengles_EGL_EGL_CONFIG_CAVEAT 12327L +#undef org_lwjgl_opengles_EGL_EGL_CONFIG_ID +#define org_lwjgl_opengles_EGL_EGL_CONFIG_ID 12328L +#undef org_lwjgl_opengles_EGL_EGL_LEVEL +#define org_lwjgl_opengles_EGL_EGL_LEVEL 12329L +#undef org_lwjgl_opengles_EGL_EGL_MAX_PBUFFER_HEIGHT +#define org_lwjgl_opengles_EGL_EGL_MAX_PBUFFER_HEIGHT 12330L +#undef org_lwjgl_opengles_EGL_EGL_MAX_PBUFFER_PIXELS +#define org_lwjgl_opengles_EGL_EGL_MAX_PBUFFER_PIXELS 12331L +#undef org_lwjgl_opengles_EGL_EGL_MAX_PBUFFER_WIDTH +#define org_lwjgl_opengles_EGL_EGL_MAX_PBUFFER_WIDTH 12332L +#undef org_lwjgl_opengles_EGL_EGL_NATIVE_RENDERABLE +#define org_lwjgl_opengles_EGL_EGL_NATIVE_RENDERABLE 12333L +#undef org_lwjgl_opengles_EGL_EGL_NATIVE_VISUAL_ID +#define org_lwjgl_opengles_EGL_EGL_NATIVE_VISUAL_ID 12334L +#undef org_lwjgl_opengles_EGL_EGL_NATIVE_VISUAL_TYPE +#define org_lwjgl_opengles_EGL_EGL_NATIVE_VISUAL_TYPE 12335L +#undef org_lwjgl_opengles_EGL_EGL_SAMPLES +#define org_lwjgl_opengles_EGL_EGL_SAMPLES 12337L +#undef org_lwjgl_opengles_EGL_EGL_SAMPLE_BUFFERS +#define org_lwjgl_opengles_EGL_EGL_SAMPLE_BUFFERS 12338L +#undef org_lwjgl_opengles_EGL_EGL_SURFACE_TYPE +#define org_lwjgl_opengles_EGL_EGL_SURFACE_TYPE 12339L +#undef org_lwjgl_opengles_EGL_EGL_TRANSPARENT_TYPE +#define org_lwjgl_opengles_EGL_EGL_TRANSPARENT_TYPE 12340L +#undef org_lwjgl_opengles_EGL_EGL_TRANSPARENT_BLUE_VALUE +#define org_lwjgl_opengles_EGL_EGL_TRANSPARENT_BLUE_VALUE 12341L +#undef org_lwjgl_opengles_EGL_EGL_TRANSPARENT_GREEN_VALUE +#define org_lwjgl_opengles_EGL_EGL_TRANSPARENT_GREEN_VALUE 12342L +#undef org_lwjgl_opengles_EGL_EGL_TRANSPARENT_RED_VALUE +#define org_lwjgl_opengles_EGL_EGL_TRANSPARENT_RED_VALUE 12343L +#undef org_lwjgl_opengles_EGL_EGL_NONE +#define org_lwjgl_opengles_EGL_EGL_NONE 12344L +#undef org_lwjgl_opengles_EGL_EGL_BIND_TO_TEXTURE_RGB +#define org_lwjgl_opengles_EGL_EGL_BIND_TO_TEXTURE_RGB 12345L +#undef org_lwjgl_opengles_EGL_EGL_BIND_TO_TEXTURE_RGBA +#define org_lwjgl_opengles_EGL_EGL_BIND_TO_TEXTURE_RGBA 12346L +#undef org_lwjgl_opengles_EGL_EGL_MIN_SWAP_INTERVAL +#define org_lwjgl_opengles_EGL_EGL_MIN_SWAP_INTERVAL 12347L +#undef org_lwjgl_opengles_EGL_EGL_MAX_SWAP_INTERVAL +#define org_lwjgl_opengles_EGL_EGL_MAX_SWAP_INTERVAL 12348L +#undef org_lwjgl_opengles_EGL_EGL_LUMINANCE_SIZE +#define org_lwjgl_opengles_EGL_EGL_LUMINANCE_SIZE 12349L +#undef org_lwjgl_opengles_EGL_EGL_ALPHA_MASK_SIZE +#define org_lwjgl_opengles_EGL_EGL_ALPHA_MASK_SIZE 12350L +#undef org_lwjgl_opengles_EGL_EGL_COLOR_BUFFER_TYPE +#define org_lwjgl_opengles_EGL_EGL_COLOR_BUFFER_TYPE 12351L +#undef org_lwjgl_opengles_EGL_EGL_RENDERABLE_TYPE +#define org_lwjgl_opengles_EGL_EGL_RENDERABLE_TYPE 12352L +#undef org_lwjgl_opengles_EGL_EGL_MATCH_NATIVE_PIXMAP +#define org_lwjgl_opengles_EGL_EGL_MATCH_NATIVE_PIXMAP 12353L +#undef org_lwjgl_opengles_EGL_EGL_CONFORMANT +#define org_lwjgl_opengles_EGL_EGL_CONFORMANT 12354L +#undef org_lwjgl_opengles_EGL_EGL_SLOW_CONFIG +#define org_lwjgl_opengles_EGL_EGL_SLOW_CONFIG 12368L +#undef org_lwjgl_opengles_EGL_EGL_NON_CONFORMANT_CONFIG +#define org_lwjgl_opengles_EGL_EGL_NON_CONFORMANT_CONFIG 12369L +#undef org_lwjgl_opengles_EGL_EGL_TRANSPARENT_RGB +#define org_lwjgl_opengles_EGL_EGL_TRANSPARENT_RGB 12370L +#undef org_lwjgl_opengles_EGL_EGL_RGB_BUFFER +#define org_lwjgl_opengles_EGL_EGL_RGB_BUFFER 12430L +#undef org_lwjgl_opengles_EGL_EGL_LUMINANCE_BUFFER +#define org_lwjgl_opengles_EGL_EGL_LUMINANCE_BUFFER 12431L +#undef org_lwjgl_opengles_EGL_EGL_NO_TEXTURE +#define org_lwjgl_opengles_EGL_EGL_NO_TEXTURE 12380L +#undef org_lwjgl_opengles_EGL_EGL_TEXTURE_RGB +#define org_lwjgl_opengles_EGL_EGL_TEXTURE_RGB 12381L +#undef org_lwjgl_opengles_EGL_EGL_TEXTURE_RGBA +#define org_lwjgl_opengles_EGL_EGL_TEXTURE_RGBA 12382L +#undef org_lwjgl_opengles_EGL_EGL_TEXTURE_2D +#define org_lwjgl_opengles_EGL_EGL_TEXTURE_2D 12383L +#undef org_lwjgl_opengles_EGL_EGL_PBUFFER_BIT +#define org_lwjgl_opengles_EGL_EGL_PBUFFER_BIT 1L +#undef org_lwjgl_opengles_EGL_EGL_PIXMAP_BIT +#define org_lwjgl_opengles_EGL_EGL_PIXMAP_BIT 2L +#undef org_lwjgl_opengles_EGL_EGL_WINDOW_BIT +#define org_lwjgl_opengles_EGL_EGL_WINDOW_BIT 4L +#undef org_lwjgl_opengles_EGL_EGL_VG_COLORSPACE_LINEAR_BIT +#define org_lwjgl_opengles_EGL_EGL_VG_COLORSPACE_LINEAR_BIT 32L +#undef org_lwjgl_opengles_EGL_EGL_VG_ALPHA_FORMAT_PRE_BIT +#define org_lwjgl_opengles_EGL_EGL_VG_ALPHA_FORMAT_PRE_BIT 64L +#undef org_lwjgl_opengles_EGL_EGL_MULTISAMPLE_RESOLVE_BOX_BIT +#define org_lwjgl_opengles_EGL_EGL_MULTISAMPLE_RESOLVE_BOX_BIT 512L +#undef org_lwjgl_opengles_EGL_EGL_SWAP_BEHAVIOR_PRESERVED_BIT +#define org_lwjgl_opengles_EGL_EGL_SWAP_BEHAVIOR_PRESERVED_BIT 1024L +#undef org_lwjgl_opengles_EGL_EGL_OPENGL_ES_BIT +#define org_lwjgl_opengles_EGL_EGL_OPENGL_ES_BIT 1L +#undef org_lwjgl_opengles_EGL_EGL_OPENVG_BIT +#define org_lwjgl_opengles_EGL_EGL_OPENVG_BIT 2L +#undef org_lwjgl_opengles_EGL_EGL_OPENGL_ES2_BIT +#define org_lwjgl_opengles_EGL_EGL_OPENGL_ES2_BIT 4L +#undef org_lwjgl_opengles_EGL_EGL_OPENGL_BIT +#define org_lwjgl_opengles_EGL_EGL_OPENGL_BIT 8L +#undef org_lwjgl_opengles_EGL_EGL_VENDOR +#define org_lwjgl_opengles_EGL_EGL_VENDOR 12371L +#undef org_lwjgl_opengles_EGL_EGL_VERSION +#define org_lwjgl_opengles_EGL_EGL_VERSION 12372L +#undef org_lwjgl_opengles_EGL_EGL_EXTENSIONS +#define org_lwjgl_opengles_EGL_EGL_EXTENSIONS 12373L +#undef org_lwjgl_opengles_EGL_EGL_CLIENT_APIS +#define org_lwjgl_opengles_EGL_EGL_CLIENT_APIS 12429L +#undef org_lwjgl_opengles_EGL_EGL_HEIGHT +#define org_lwjgl_opengles_EGL_EGL_HEIGHT 12374L +#undef org_lwjgl_opengles_EGL_EGL_WIDTH +#define org_lwjgl_opengles_EGL_EGL_WIDTH 12375L +#undef org_lwjgl_opengles_EGL_EGL_LARGEST_PBUFFER +#define org_lwjgl_opengles_EGL_EGL_LARGEST_PBUFFER 12376L +#undef org_lwjgl_opengles_EGL_EGL_TEXTURE_FORMAT +#define org_lwjgl_opengles_EGL_EGL_TEXTURE_FORMAT 12416L +#undef org_lwjgl_opengles_EGL_EGL_TEXTURE_TARGET +#define org_lwjgl_opengles_EGL_EGL_TEXTURE_TARGET 12417L +#undef org_lwjgl_opengles_EGL_EGL_MIPMAP_TEXTURE +#define org_lwjgl_opengles_EGL_EGL_MIPMAP_TEXTURE 12418L +#undef org_lwjgl_opengles_EGL_EGL_MIPMAP_LEVEL +#define org_lwjgl_opengles_EGL_EGL_MIPMAP_LEVEL 12419L +#undef org_lwjgl_opengles_EGL_EGL_RENDER_BUFFER +#define org_lwjgl_opengles_EGL_EGL_RENDER_BUFFER 12422L +#undef org_lwjgl_opengles_EGL_EGL_VG_COLORSPACE +#define org_lwjgl_opengles_EGL_EGL_VG_COLORSPACE 12423L +#undef org_lwjgl_opengles_EGL_EGL_VG_ALPHA_FORMAT +#define org_lwjgl_opengles_EGL_EGL_VG_ALPHA_FORMAT 12424L +#undef org_lwjgl_opengles_EGL_EGL_HORIZONTAL_RESOLUTION +#define org_lwjgl_opengles_EGL_EGL_HORIZONTAL_RESOLUTION 12432L +#undef org_lwjgl_opengles_EGL_EGL_VERTICAL_RESOLUTION +#define org_lwjgl_opengles_EGL_EGL_VERTICAL_RESOLUTION 12433L +#undef org_lwjgl_opengles_EGL_EGL_PIXEL_ASPECT_RATIO +#define org_lwjgl_opengles_EGL_EGL_PIXEL_ASPECT_RATIO 12434L +#undef org_lwjgl_opengles_EGL_EGL_SWAP_BEHAVIOR +#define org_lwjgl_opengles_EGL_EGL_SWAP_BEHAVIOR 12435L +#undef org_lwjgl_opengles_EGL_EGL_MULTISAMPLE_RESOLVE +#define org_lwjgl_opengles_EGL_EGL_MULTISAMPLE_RESOLVE 12441L +#undef org_lwjgl_opengles_EGL_EGL_BACK_BUFFER +#define org_lwjgl_opengles_EGL_EGL_BACK_BUFFER 12420L +#undef org_lwjgl_opengles_EGL_EGL_SINGLE_BUFFER +#define org_lwjgl_opengles_EGL_EGL_SINGLE_BUFFER 12421L +#undef org_lwjgl_opengles_EGL_EGL_VG_COLORSPACE_sRGB +#define org_lwjgl_opengles_EGL_EGL_VG_COLORSPACE_sRGB 12425L +#undef org_lwjgl_opengles_EGL_EGL_VG_COLORSPACE_LINEAR +#define org_lwjgl_opengles_EGL_EGL_VG_COLORSPACE_LINEAR 12426L +#undef org_lwjgl_opengles_EGL_EGL_VG_ALPHA_FORMAT_NONPRE +#define org_lwjgl_opengles_EGL_EGL_VG_ALPHA_FORMAT_NONPRE 12427L +#undef org_lwjgl_opengles_EGL_EGL_VG_ALPHA_FORMAT_PRE +#define org_lwjgl_opengles_EGL_EGL_VG_ALPHA_FORMAT_PRE 12428L +#undef org_lwjgl_opengles_EGL_EGL_DISPLAY_SCALING +#define org_lwjgl_opengles_EGL_EGL_DISPLAY_SCALING 10000L +#undef org_lwjgl_opengles_EGL_EGL_UNKNOWN +#define org_lwjgl_opengles_EGL_EGL_UNKNOWN -1L +#undef org_lwjgl_opengles_EGL_EGL_BUFFER_PRESERVED +#define org_lwjgl_opengles_EGL_EGL_BUFFER_PRESERVED 12436L +#undef org_lwjgl_opengles_EGL_EGL_BUFFER_DESTROYED +#define org_lwjgl_opengles_EGL_EGL_BUFFER_DESTROYED 12437L +#undef org_lwjgl_opengles_EGL_EGL_OPENVG_IMAGE +#define org_lwjgl_opengles_EGL_EGL_OPENVG_IMAGE 12438L +#undef org_lwjgl_opengles_EGL_EGL_CONTEXT_CLIENT_TYPE +#define org_lwjgl_opengles_EGL_EGL_CONTEXT_CLIENT_TYPE 12439L +#undef org_lwjgl_opengles_EGL_EGL_CONTEXT_CLIENT_VERSION +#define org_lwjgl_opengles_EGL_EGL_CONTEXT_CLIENT_VERSION 12440L +#undef org_lwjgl_opengles_EGL_EGL_MULTISAMPLE_RESOLVE_DEFAULT +#define org_lwjgl_opengles_EGL_EGL_MULTISAMPLE_RESOLVE_DEFAULT 12442L +#undef org_lwjgl_opengles_EGL_EGL_MULTISAMPLE_RESOLVE_BOX +#define org_lwjgl_opengles_EGL_EGL_MULTISAMPLE_RESOLVE_BOX 12443L +#undef org_lwjgl_opengles_EGL_EGL_OPENGL_ES_API +#define org_lwjgl_opengles_EGL_EGL_OPENGL_ES_API 12448L +#undef org_lwjgl_opengles_EGL_EGL_OPENVG_API +#define org_lwjgl_opengles_EGL_EGL_OPENVG_API 12449L +#undef org_lwjgl_opengles_EGL_EGL_OPENGL_API +#define org_lwjgl_opengles_EGL_EGL_OPENGL_API 12450L +#undef org_lwjgl_opengles_EGL_EGL_DRAW +#define org_lwjgl_opengles_EGL_EGL_DRAW 12377L +#undef org_lwjgl_opengles_EGL_EGL_READ +#define org_lwjgl_opengles_EGL_EGL_READ 12378L +#undef org_lwjgl_opengles_EGL_EGL_CORE_NATIVE_ENGINE +#define org_lwjgl_opengles_EGL_EGL_CORE_NATIVE_ENGINE 12379L +/* + * Class: org_lwjgl_opengles_EGL + * Method: eglGetError + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_org_lwjgl_opengles_EGL_eglGetError + (JNIEnv *, jclass); + +/* + * Class: org_lwjgl_opengles_EGL + * Method: neglGetDisplay + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengles_EGL_neglGetDisplay + (JNIEnv *, jclass, jlong); + +/* + * Class: org_lwjgl_opengles_EGL + * Method: neglInitialize + * Signature: (JJ)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGL_neglInitialize + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: org_lwjgl_opengles_EGL + * Method: neglTerminate + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGL_neglTerminate + (JNIEnv *, jclass, jlong); + +/* + * Class: org_lwjgl_opengles_EGL + * Method: neglQueryString + * Signature: (JI)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_org_lwjgl_opengles_EGL_neglQueryString + (JNIEnv *, jclass, jlong, jint); + +/* + * Class: org_lwjgl_opengles_EGL + * Method: neglGetConfigs + * Signature: (JJIJ)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGL_neglGetConfigs + (JNIEnv *, jclass, jlong, jlong, jint, jlong); + +/* + * Class: org_lwjgl_opengles_EGL + * Method: neglChooseConfig + * Signature: (JJJIJ)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGL_neglChooseConfig + (JNIEnv *, jclass, jlong, jlong, jlong, jint, jlong); + +/* + * Class: org_lwjgl_opengles_EGL + * Method: neglGetConfigAttrib + * Signature: (JJIJ)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGL_neglGetConfigAttrib + (JNIEnv *, jclass, jlong, jlong, jint, jlong); + +/* + * Class: org_lwjgl_opengles_EGL + * Method: neglCreateWindowSurface + * Signature: (JJJJ)J + */ +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengles_EGL_neglCreateWindowSurface + (JNIEnv *, jclass, jlong, jlong, jlong, jlong); + +/* + * Class: org_lwjgl_opengles_EGL + * Method: neglCreatePbufferSurface + * Signature: (JJJ)J + */ +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengles_EGL_neglCreatePbufferSurface + (JNIEnv *, jclass, jlong, jlong, jlong); + +/* + * Class: org_lwjgl_opengles_EGL + * Method: neglSurfaceAttrib + * Signature: (JJII)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGL_neglSurfaceAttrib + (JNIEnv *, jclass, jlong, jlong, jint, jint); + +/* + * Class: org_lwjgl_opengles_EGL + * Method: neglDestroySurface + * Signature: (JJ)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGL_neglDestroySurface + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: org_lwjgl_opengles_EGL + * Method: neglQuerySurface + * Signature: (JJIJ)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGL_neglQuerySurface + (JNIEnv *, jclass, jlong, jlong, jint, jlong); + +/* + * Class: org_lwjgl_opengles_EGL + * Method: eglBindAPI + * Signature: (I)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGL_eglBindAPI + (JNIEnv *, jclass, jint); + +/* + * Class: org_lwjgl_opengles_EGL + * Method: eglQueryAPI + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_org_lwjgl_opengles_EGL_eglQueryAPI + (JNIEnv *, jclass); + +/* + * Class: org_lwjgl_opengles_EGL + * Method: eglReleaseThread + * Signature: ()Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGL_eglReleaseThread + (JNIEnv *, jclass); + +/* + * Class: org_lwjgl_opengles_EGL + * Method: neglSwapInterval + * Signature: (JI)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGL_neglSwapInterval + (JNIEnv *, jclass, jlong, jint); + +/* + * Class: org_lwjgl_opengles_EGL + * Method: neglCreateContext + * Signature: (JJJJ)J + */ +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengles_EGL_neglCreateContext + (JNIEnv *, jclass, jlong, jlong, jlong, jlong); + +/* + * Class: org_lwjgl_opengles_EGL + * Method: neglDestroyContext + * Signature: (JJ)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGL_neglDestroyContext + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: org_lwjgl_opengles_EGL + * Method: neglMakeCurrent + * Signature: (JJJJ)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGL_neglMakeCurrent + (JNIEnv *, jclass, jlong, jlong, jlong, jlong); + +/* + * Class: org_lwjgl_opengles_EGL + * Method: neglGetCurrentContext + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengles_EGL_neglGetCurrentContext + (JNIEnv *, jclass); + +/* + * Class: org_lwjgl_opengles_EGL + * Method: neglGetCurrentSurface + * Signature: (I)J + */ +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengles_EGL_neglGetCurrentSurface + (JNIEnv *, jclass, jint); + +/* + * Class: org_lwjgl_opengles_EGL + * Method: neglGetCurrentDisplay + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengles_EGL_neglGetCurrentDisplay + (JNIEnv *, jclass); + +/* + * Class: org_lwjgl_opengles_EGL + * Method: neglQueryContext + * Signature: (JJIJ)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGL_neglQueryContext + (JNIEnv *, jclass, jlong, jlong, jint, jlong); + +/* + * Class: org_lwjgl_opengles_EGL + * Method: eglWaitClient + * Signature: ()Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGL_eglWaitClient + (JNIEnv *, jclass); + +/* + * Class: org_lwjgl_opengles_EGL + * Method: eglWaitGL + * Signature: ()Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGL_eglWaitGL + (JNIEnv *, jclass); + +/* + * Class: org_lwjgl_opengles_EGL + * Method: eglWaitNative + * Signature: (I)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGL_eglWaitNative + (JNIEnv *, jclass, jint); + +/* + * Class: org_lwjgl_opengles_EGL + * Method: neglSwapBuffers + * Signature: (JJ)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGL_neglSwapBuffers + (JNIEnv *, jclass, jlong, jlong); + +#ifdef __cplusplus +} +#endif +#endif diff -Nru lwjgl-2.7.1+dfsg/src/native/common/opengles/org_lwjgl_opengles_EGLKHRFenceSync.c lwjgl-2.9.3+dfsg/src/native/common/opengles/org_lwjgl_opengles_EGLKHRFenceSync.c --- lwjgl-2.7.1+dfsg/src/native/common/opengles/org_lwjgl_opengles_EGLKHRFenceSync.c 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/common/opengles/org_lwjgl_opengles_EGLKHRFenceSync.c 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include "common_tools.h" +#include "org_lwjgl_opengles_EGLKHRFenceSync.h" +#include "extgl_egl.h" + +static PFNEGLCREATESYNCKHRPROC eglCreateSyncKHR; +static PFNEGLDESTROYSYNCKHRPROC eglDestroySyncKHR; +static PFNEGLCLIENTWAITSYNCKHRPROC eglClientWaitSyncKHR; +static PFNEGLGETSYNCATTRIBKHRPROC eglGetSyncAttribKHR; + +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengles_EGLKHRFenceSync_neglCreateSyncKHR(JNIEnv *env, jclass clazz, jlong dpy_ptr, jint type, jlong attrib_list) { + EGLDisplay dpy = (EGLDisplay)(intptr_t)dpy_ptr; + const EGLint *attrib_list_address = (EGLint *)(intptr_t)attrib_list; + + return (intptr_t)eglCreateSyncKHR(dpy, type, attrib_list_address); +} + +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGLKHRFenceSync_neglDestroySyncKHR(JNIEnv *env, jclass clazz, jlong dpy_ptr, jlong sync_ptr) { + EGLDisplay dpy = (EGLDisplay)(intptr_t)dpy_ptr; + EGLSyncKHR sync = (EGLSyncKHR)(intptr_t)sync_ptr; + + return eglDestroySyncKHR(dpy, sync); +} + +JNIEXPORT jint JNICALL Java_org_lwjgl_opengles_EGLKHRFenceSync_neglClientWaitSyncKHR(JNIEnv *env, jclass clazz, jlong dpy_ptr, jlong sync_ptr, jint flags, jlong timeout) { + EGLDisplay dpy = (EGLDisplay)(intptr_t)dpy_ptr; + EGLSyncKHR sync = (EGLSyncKHR)(intptr_t)sync_ptr; + + return eglClientWaitSyncKHR(dpy, sync, flags, timeout); +} + +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGLKHRFenceSync_neglGetSyncAttribKHR(JNIEnv *env, jclass clazz, jlong dpy_ptr, jlong sync_ptr, jint attribute, jlong value) { + EGLDisplay dpy = (EGLDisplay)(intptr_t)dpy_ptr; + EGLSyncKHR sync = (EGLSyncKHR)(intptr_t)sync_ptr; + EGLint *value_address = (EGLint *)(intptr_t)value; + + return eglGetSyncAttribKHR(dpy, sync, attribute, value_address); +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengles_EGLKHRFenceSync_initNativeStubs(JNIEnv *env, jclass clazz) { + JavaMethodAndExtFunction functions[] = { + {"neglCreateSyncKHR", "(JIJ)J", (void *)&Java_org_lwjgl_opengles_EGLKHRFenceSync_neglCreateSyncKHR, "eglCreateSyncKHR", (void *)&eglCreateSyncKHR, false}, + {"neglDestroySyncKHR", "(JJ)Z", (void *)&Java_org_lwjgl_opengles_EGLKHRFenceSync_neglDestroySyncKHR, "eglDestroySyncKHR", (void *)&eglDestroySyncKHR, false}, + {"neglClientWaitSyncKHR", "(JJIJ)I", (void *)&Java_org_lwjgl_opengles_EGLKHRFenceSync_neglClientWaitSyncKHR, "eglClientWaitSyncKHR", (void *)&eglClientWaitSyncKHR, false}, + {"neglGetSyncAttribKHR", "(JJIJ)Z", (void *)&Java_org_lwjgl_opengles_EGLKHRFenceSync_neglGetSyncAttribKHR, "eglGetSyncAttribKHR", (void *)&eglGetSyncAttribKHR, false} + }; + int num_functions = NUMFUNCTIONS(functions); + extgl_InitializeClass(env, clazz, num_functions, functions); +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/native/common/opengles/org_lwjgl_opengles_EGLKHRFenceSync.h lwjgl-2.9.3+dfsg/src/native/common/opengles/org_lwjgl_opengles_EGLKHRFenceSync.h --- lwjgl-2.7.1+dfsg/src/native/common/opengles/org_lwjgl_opengles_EGLKHRFenceSync.h 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/common/opengles/org_lwjgl_opengles_EGLKHRFenceSync.h 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,77 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_lwjgl_opengles_EGLKHRFenceSync */ + +#ifndef _Included_org_lwjgl_opengles_EGLKHRFenceSync +#define _Included_org_lwjgl_opengles_EGLKHRFenceSync +#ifdef __cplusplus +extern "C" { +#endif +#undef org_lwjgl_opengles_EGLKHRFenceSync_EGL_SYNC_FENCE_KHR +#define org_lwjgl_opengles_EGLKHRFenceSync_EGL_SYNC_FENCE_KHR 12537L +#undef org_lwjgl_opengles_EGLKHRFenceSync_EGL_SYNC_TYPE_KHR +#define org_lwjgl_opengles_EGLKHRFenceSync_EGL_SYNC_TYPE_KHR 12535L +#undef org_lwjgl_opengles_EGLKHRFenceSync_EGL_SYNC_STATUS_KHR +#define org_lwjgl_opengles_EGLKHRFenceSync_EGL_SYNC_STATUS_KHR 12529L +#undef org_lwjgl_opengles_EGLKHRFenceSync_EGL_SYNC_CONDITION_KHR +#define org_lwjgl_opengles_EGLKHRFenceSync_EGL_SYNC_CONDITION_KHR 12536L +#undef org_lwjgl_opengles_EGLKHRFenceSync_EGL_SIGNALED_KHR +#define org_lwjgl_opengles_EGLKHRFenceSync_EGL_SIGNALED_KHR 12530L +#undef org_lwjgl_opengles_EGLKHRFenceSync_EGL_UNSIGNALED_KHR +#define org_lwjgl_opengles_EGLKHRFenceSync_EGL_UNSIGNALED_KHR 12531L +#undef org_lwjgl_opengles_EGLKHRFenceSync_EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR +#define org_lwjgl_opengles_EGLKHRFenceSync_EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR 12528L +#undef org_lwjgl_opengles_EGLKHRFenceSync_EGL_SYNC_FLUSH_COMMANDS_BIT_KHR +#define org_lwjgl_opengles_EGLKHRFenceSync_EGL_SYNC_FLUSH_COMMANDS_BIT_KHR 1L +#undef org_lwjgl_opengles_EGLKHRFenceSync_EGL_FOREVER_KHR +#define org_lwjgl_opengles_EGLKHRFenceSync_EGL_FOREVER_KHR -1i64 +#undef org_lwjgl_opengles_EGLKHRFenceSync_EGL_TIMEOUT_EXPIRED_KHR +#define org_lwjgl_opengles_EGLKHRFenceSync_EGL_TIMEOUT_EXPIRED_KHR 12533L +#undef org_lwjgl_opengles_EGLKHRFenceSync_EGL_CONDITION_SATISFIED_KHR +#define org_lwjgl_opengles_EGLKHRFenceSync_EGL_CONDITION_SATISFIED_KHR 12534L +#undef org_lwjgl_opengles_EGLKHRFenceSync_EGL_NO_SYNC_KHR +#define org_lwjgl_opengles_EGLKHRFenceSync_EGL_NO_SYNC_KHR 0i64 +/* + * Class: org_lwjgl_opengles_EGLKHRFenceSync + * Method: initNativeStubs + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengles_EGLKHRFenceSync_initNativeStubs + (JNIEnv *, jclass); + +/* + * Class: org_lwjgl_opengles_EGLKHRFenceSync + * Method: neglCreateSyncKHR + * Signature: (JIJ)J + */ +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengles_EGLKHRFenceSync_neglCreateSyncKHR + (JNIEnv *, jclass, jlong, jint, jlong); + +/* + * Class: org_lwjgl_opengles_EGLKHRFenceSync + * Method: neglDestroySyncKHR + * Signature: (JJ)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGLKHRFenceSync_neglDestroySyncKHR + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: org_lwjgl_opengles_EGLKHRFenceSync + * Method: neglClientWaitSyncKHR + * Signature: (JJIJ)I + */ +JNIEXPORT jint JNICALL Java_org_lwjgl_opengles_EGLKHRFenceSync_neglClientWaitSyncKHR + (JNIEnv *, jclass, jlong, jlong, jint, jlong); + +/* + * Class: org_lwjgl_opengles_EGLKHRFenceSync + * Method: neglGetSyncAttribKHR + * Signature: (JJIJ)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGLKHRFenceSync_neglGetSyncAttribKHR + (JNIEnv *, jclass, jlong, jlong, jint, jlong); + +#ifdef __cplusplus +} +#endif +#endif diff -Nru lwjgl-2.7.1+dfsg/src/native/common/opengles/org_lwjgl_opengles_EGLKHRReusableSync.c lwjgl-2.9.3+dfsg/src/native/common/opengles/org_lwjgl_opengles_EGLKHRReusableSync.c --- lwjgl-2.7.1+dfsg/src/native/common/opengles/org_lwjgl_opengles_EGLKHRReusableSync.c 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/common/opengles/org_lwjgl_opengles_EGLKHRReusableSync.c 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include "common_tools.h" +#include "org_lwjgl_opengles_EGLKHRReusableSync.h" +#include "extgl_egl.h" + +static PFNEGLSIGNALSYNCKHRPROC eglSignalSyncKHR; + +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGLKHRReusableSync_neglSignalSyncKHR(JNIEnv *env, jclass clazz, jlong dpy_ptr, jlong sync_ptr, jint mode) { + EGLDisplay dpy = (EGLDisplay)(intptr_t)dpy_ptr; + EGLSyncKHR sync = (EGLSyncKHR)(intptr_t)sync_ptr; + return eglSignalSyncKHR(dpy, sync, mode); +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengles_EGLKHRReusableSync_initNativeStubs(JNIEnv *env, jclass clazz) { + JavaMethodAndExtFunction functions[] = { + {"neglSignalSyncKHR", "(JJI)Z", (void *)&Java_org_lwjgl_opengles_EGLKHRReusableSync_neglSignalSyncKHR, "eglSignalSyncKHR", (void *)&eglSignalSyncKHR, false} + }; + int num_functions = NUMFUNCTIONS(functions); + extgl_InitializeClass(env, clazz, num_functions, functions); +} diff -Nru lwjgl-2.7.1+dfsg/src/native/common/opengles/org_lwjgl_opengles_EGLKHRReusableSync.h lwjgl-2.9.3+dfsg/src/native/common/opengles/org_lwjgl_opengles_EGLKHRReusableSync.h --- lwjgl-2.7.1+dfsg/src/native/common/opengles/org_lwjgl_opengles_EGLKHRReusableSync.h 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/common/opengles/org_lwjgl_opengles_EGLKHRReusableSync.h 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,49 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_lwjgl_opengles_EGLKHRReusableSync */ + +#ifndef _Included_org_lwjgl_opengles_EGLKHRReusableSync +#define _Included_org_lwjgl_opengles_EGLKHRReusableSync +#ifdef __cplusplus +extern "C" { +#endif +#undef org_lwjgl_opengles_EGLKHRReusableSync_EGL_SYNC_REUSABLE_KHR +#define org_lwjgl_opengles_EGLKHRReusableSync_EGL_SYNC_REUSABLE_KHR 12538L +#undef org_lwjgl_opengles_EGLKHRReusableSync_EGL_SYNC_TYPE_KHR +#define org_lwjgl_opengles_EGLKHRReusableSync_EGL_SYNC_TYPE_KHR 12535L +#undef org_lwjgl_opengles_EGLKHRReusableSync_EGL_SYNC_STATUS_KHR +#define org_lwjgl_opengles_EGLKHRReusableSync_EGL_SYNC_STATUS_KHR 12529L +#undef org_lwjgl_opengles_EGLKHRReusableSync_EGL_SIGNALED_KHR +#define org_lwjgl_opengles_EGLKHRReusableSync_EGL_SIGNALED_KHR 12530L +#undef org_lwjgl_opengles_EGLKHRReusableSync_EGL_UNSIGNALED_KHR +#define org_lwjgl_opengles_EGLKHRReusableSync_EGL_UNSIGNALED_KHR 12531L +#undef org_lwjgl_opengles_EGLKHRReusableSync_EGL_SYNC_FLUSH_COMMANDS_BIT_KHR +#define org_lwjgl_opengles_EGLKHRReusableSync_EGL_SYNC_FLUSH_COMMANDS_BIT_KHR 1L +#undef org_lwjgl_opengles_EGLKHRReusableSync_EGL_FOREVER_KHR +#define org_lwjgl_opengles_EGLKHRReusableSync_EGL_FOREVER_KHR -1i64 +#undef org_lwjgl_opengles_EGLKHRReusableSync_EGL_TIMEOUT_EXPIRED_KHR +#define org_lwjgl_opengles_EGLKHRReusableSync_EGL_TIMEOUT_EXPIRED_KHR 12533L +#undef org_lwjgl_opengles_EGLKHRReusableSync_EGL_CONDITION_SATISFIED_KHR +#define org_lwjgl_opengles_EGLKHRReusableSync_EGL_CONDITION_SATISFIED_KHR 12534L +#undef org_lwjgl_opengles_EGLKHRReusableSync_EGL_NO_SYNC_KHR +#define org_lwjgl_opengles_EGLKHRReusableSync_EGL_NO_SYNC_KHR 0i64 +/* + * Class: org_lwjgl_opengles_EGLKHRReusableSync + * Method: initNativeStubs + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengles_EGLKHRReusableSync_initNativeStubs + (JNIEnv *, jclass); + +/* + * Class: org_lwjgl_opengles_EGLKHRReusableSync + * Method: neglSignalSyncKHR + * Signature: (JJI)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGLKHRReusableSync_neglSignalSyncKHR + (JNIEnv *, jclass, jlong, jlong, jint); + +#ifdef __cplusplus +} +#endif +#endif diff -Nru lwjgl-2.7.1+dfsg/src/native/common/opengles/org_lwjgl_opengles_EGLNVSync.c lwjgl-2.9.3+dfsg/src/native/common/opengles/org_lwjgl_opengles_EGLNVSync.c --- lwjgl-2.7.1+dfsg/src/native/common/opengles/org_lwjgl_opengles_EGLNVSync.c 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/common/opengles/org_lwjgl_opengles_EGLNVSync.c 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,94 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include "common_tools.h" +#include "org_lwjgl_opengles_EGLNVSync.h" +#include "extgl_egl.h" + +static PFNEGLCREATEFENCESYNCNVPROC eglCreateFenceSyncNV; +static PFNEGLDESTROYSYNCNVPROC eglDestroySyncNV; +static PFNEGLFENCENVPROC eglFenceNV; +static PFNEGLCLIENTWAITSYNCNVPROC eglClientWaitSyncNV; +static PFNEGLSIGNALSYNCNVPROC eglSignalSyncNV; +static PFNEGLGETSYNCATTRIBNVPROC eglGetSyncAttribNV; + +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengles_EGLNVSync_neglCreateFenceSyncNV(JNIEnv *env, jclass clazz, jlong dpy_ptr, jint condition, jlong attrib_list) { + EGLDisplay dpy = (EGLDisplay)(intptr_t)dpy_ptr; + const EGLint *attrib_list_address = (EGLint *)(intptr_t)attrib_list; + + return (intptr_t)eglCreateFenceSyncNV(dpy, condition, attrib_list_address); +} + +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGLNVSync_neglDestroySyncNV(JNIEnv *env, jclass clazz, jlong sync_ptr) { + EGLSyncNV sync = (EGLSyncNV)(intptr_t)sync_ptr; + + return eglDestroySyncNV(sync); +} + +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGLNVSync_neglFenceNV(JNIEnv *env, jclass clazz, jlong sync_ptr) { + EGLSyncNV sync = (EGLSyncNV)(intptr_t)sync_ptr; + + return eglFenceNV(sync); +} + +JNIEXPORT jint JNICALL Java_org_lwjgl_opengles_EGLNVSync_neglClientWaitSyncNV(JNIEnv *env, jclass clazz, jlong sync_ptr, jint flags, jlong timeout) { + EGLSyncNV sync = (EGLSyncNV)(intptr_t)sync_ptr; + + return eglClientWaitSyncNV(sync, flags, timeout); +} + +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGLNVSync_neglSignalSyncNV(JNIEnv *env, jclass clazz, jlong sync_ptr, jint mode) { + EGLSyncNV sync = (EGLSyncNV)(intptr_t)sync_ptr; + + return eglSignalSyncNV(sync, mode); +} + +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGLNVSync_neglGetSyncAttribNV(JNIEnv *env, jclass clazz, jlong sync_ptr, jint attribute, jlong value) { + EGLSyncNV sync = (EGLSyncNV)(intptr_t)sync_ptr; + EGLint *value_address = (EGLint *)(intptr_t)value; + + return eglGetSyncAttribNV(sync, attribute, value_address); +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengles_EGLNVSync_initNativeStubs(JNIEnv *env, jclass clazz) { + JavaMethodAndExtFunction functions[] = { + {"neglCreateFenceSyncNV", "(JIJ)J", (void *)&Java_org_lwjgl_opengles_EGLNVSync_neglCreateFenceSyncNV, "eglCreateFenceSyncNV", (void *)&eglCreateFenceSyncNV, false}, + {"neglDestroySyncNV", "(J)Z", (void *)&Java_org_lwjgl_opengles_EGLNVSync_neglDestroySyncNV, "eglDestroySyncNV", (void *)&eglDestroySyncNV, false}, + {"neglFenceNV", "(J)Z", (void *)&Java_org_lwjgl_opengles_EGLNVSync_neglFenceNV, "eglFenceNV", (void *)&eglFenceNV, false}, + {"neglClientWaitSyncNV", "(JIJ)I", (void *)&Java_org_lwjgl_opengles_EGLNVSync_neglClientWaitSyncNV, "eglClientWaitSyncNV", (void *)&eglClientWaitSyncNV, false}, + {"neglSignalSyncNV", "(JI)Z", (void *)&Java_org_lwjgl_opengles_EGLNVSync_neglSignalSyncNV, "eglSignalSyncNV", (void *)&eglSignalSyncNV, false}, + {"neglGetSyncAttribNV", "(JIJ)Z", (void *)&Java_org_lwjgl_opengles_EGLNVSync_neglGetSyncAttribNV, "eglGetSyncAttribNV", (void *)&eglGetSyncAttribNV, false} + }; + int num_functions = NUMFUNCTIONS(functions); + extgl_InitializeClass(env, clazz, num_functions, functions); +} diff -Nru lwjgl-2.7.1+dfsg/src/native/common/opengles/org_lwjgl_opengles_EGLNVSync.h lwjgl-2.9.3+dfsg/src/native/common/opengles/org_lwjgl_opengles_EGLNVSync.h --- lwjgl-2.7.1+dfsg/src/native/common/opengles/org_lwjgl_opengles_EGLNVSync.h 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/common/opengles/org_lwjgl_opengles_EGLNVSync.h 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,95 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_lwjgl_opengles_EGLNVSync */ + +#ifndef _Included_org_lwjgl_opengles_EGLNVSync +#define _Included_org_lwjgl_opengles_EGLNVSync +#ifdef __cplusplus +extern "C" { +#endif +#undef org_lwjgl_opengles_EGLNVSync_EGL_SYNC_PRIOR_COMMANDS_COMPLETE_NV +#define org_lwjgl_opengles_EGLNVSync_EGL_SYNC_PRIOR_COMMANDS_COMPLETE_NV 12518L +#undef org_lwjgl_opengles_EGLNVSync_EGL_SYNC_STATUS_NV +#define org_lwjgl_opengles_EGLNVSync_EGL_SYNC_STATUS_NV 12519L +#undef org_lwjgl_opengles_EGLNVSync_EGL_SIGNALED_NV +#define org_lwjgl_opengles_EGLNVSync_EGL_SIGNALED_NV 12520L +#undef org_lwjgl_opengles_EGLNVSync_EGL_UNSIGNALED_NV +#define org_lwjgl_opengles_EGLNVSync_EGL_UNSIGNALED_NV 12521L +#undef org_lwjgl_opengles_EGLNVSync_EGL_SYNC_FLUSH_COMMANDS_BIT_NV +#define org_lwjgl_opengles_EGLNVSync_EGL_SYNC_FLUSH_COMMANDS_BIT_NV 1L +#undef org_lwjgl_opengles_EGLNVSync_EGL_FOREVER_NV +#define org_lwjgl_opengles_EGLNVSync_EGL_FOREVER_NV -1i64 +#undef org_lwjgl_opengles_EGLNVSync_EGL_ALREADY_SIGNALED_NV +#define org_lwjgl_opengles_EGLNVSync_EGL_ALREADY_SIGNALED_NV 12522L +#undef org_lwjgl_opengles_EGLNVSync_EGL_TIMEOUT_EXPIRED_NV +#define org_lwjgl_opengles_EGLNVSync_EGL_TIMEOUT_EXPIRED_NV 12523L +#undef org_lwjgl_opengles_EGLNVSync_EGL_CONDITION_SATISFIED_NV +#define org_lwjgl_opengles_EGLNVSync_EGL_CONDITION_SATISFIED_NV 12524L +#undef org_lwjgl_opengles_EGLNVSync_EGL_SYNC_TYPE_NV +#define org_lwjgl_opengles_EGLNVSync_EGL_SYNC_TYPE_NV 12525L +#undef org_lwjgl_opengles_EGLNVSync_EGL_SYNC_CONDITION_NV +#define org_lwjgl_opengles_EGLNVSync_EGL_SYNC_CONDITION_NV 12526L +#undef org_lwjgl_opengles_EGLNVSync_EGL_SYNC_FENCE_NV +#define org_lwjgl_opengles_EGLNVSync_EGL_SYNC_FENCE_NV 12527L +#undef org_lwjgl_opengles_EGLNVSync_EGL_NO_SYNC_NV +#define org_lwjgl_opengles_EGLNVSync_EGL_NO_SYNC_NV 0i64 +/* + * Class: org_lwjgl_opengles_EGLNVSync + * Method: initNativeStubs + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengles_EGLNVSync_initNativeStubs + (JNIEnv *, jclass); + +/* + * Class: org_lwjgl_opengles_EGLNVSync + * Method: neglCreateFenceSyncNV + * Signature: (JIJ)J + */ +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengles_EGLNVSync_neglCreateFenceSyncNV + (JNIEnv *, jclass, jlong, jint, jlong); + +/* + * Class: org_lwjgl_opengles_EGLNVSync + * Method: neglDestroySyncNV + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGLNVSync_neglDestroySyncNV + (JNIEnv *, jclass, jlong); + +/* + * Class: org_lwjgl_opengles_EGLNVSync + * Method: neglFenceNV + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGLNVSync_neglFenceNV + (JNIEnv *, jclass, jlong); + +/* + * Class: org_lwjgl_opengles_EGLNVSync + * Method: neglClientWaitSyncNV + * Signature: (JIJ)I + */ +JNIEXPORT jint JNICALL Java_org_lwjgl_opengles_EGLNVSync_neglClientWaitSyncNV + (JNIEnv *, jclass, jlong, jint, jlong); + +/* + * Class: org_lwjgl_opengles_EGLNVSync + * Method: neglSignalSyncNV + * Signature: (JI)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGLNVSync_neglSignalSyncNV + (JNIEnv *, jclass, jlong, jint); + +/* + * Class: org_lwjgl_opengles_EGLNVSync + * Method: neglGetSyncAttribNV + * Signature: (JIJ)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGLNVSync_neglGetSyncAttribNV + (JNIEnv *, jclass, jlong, jint, jlong); + +#ifdef __cplusplus +} +#endif +#endif diff -Nru lwjgl-2.7.1+dfsg/src/native/common/opengles/org_lwjgl_opengles_GLContext.c lwjgl-2.9.3+dfsg/src/native/common/opengles/org_lwjgl_opengles_GLContext.c --- lwjgl-2.7.1+dfsg/src/native/common/opengles/org_lwjgl_opengles_GLContext.c 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/common/opengles/org_lwjgl_opengles_GLContext.c 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include "common_tools.h" +#include "org_lwjgl_opengles_GLContext.h" +#include "extgl.h" + +JNIEXPORT void JNICALL Java_org_lwjgl_opengles_GLContext_nLoadOpenGLLibrary(JNIEnv * env, jclass clazz) { + extgl_Open(env); +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengles_GLContext_nUnloadOpenGLLibrary(JNIEnv * env, jclass clazz) { + extgl_Close(); +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengles_GLContext_resetNativeStubs(JNIEnv *env, jclass clazz, jclass gl_class) { + //(*env)->UnregisterNatives(env, gl_class); +} diff -Nru lwjgl-2.7.1+dfsg/src/native/common/opengles/org_lwjgl_opengles_GLContext_CapabilitiesCacheEntry.h lwjgl-2.9.3+dfsg/src/native/common/opengles/org_lwjgl_opengles_GLContext_CapabilitiesCacheEntry.h --- lwjgl-2.7.1+dfsg/src/native/common/opengles/org_lwjgl_opengles_GLContext_CapabilitiesCacheEntry.h 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/common/opengles/org_lwjgl_opengles_GLContext_CapabilitiesCacheEntry.h 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,13 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_lwjgl_opengles_GLContext_CapabilitiesCacheEntry */ + +#ifndef _Included_org_lwjgl_opengles_GLContext_CapabilitiesCacheEntry +#define _Included_org_lwjgl_opengles_GLContext_CapabilitiesCacheEntry +#ifdef __cplusplus +extern "C" { +#endif +#ifdef __cplusplus +} +#endif +#endif diff -Nru lwjgl-2.7.1+dfsg/src/native/common/opengles/org_lwjgl_opengles_GLContext.h lwjgl-2.9.3+dfsg/src/native/common/opengles/org_lwjgl_opengles_GLContext.h --- lwjgl-2.7.1+dfsg/src/native/common/opengles/org_lwjgl_opengles_GLContext.h 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/common/opengles/org_lwjgl_opengles_GLContext.h 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,37 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_lwjgl_opengles_GLContext */ + +#ifndef _Included_org_lwjgl_opengles_GLContext +#define _Included_org_lwjgl_opengles_GLContext +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: org_lwjgl_opengles_GLContext + * Method: nLoadOpenGLLibrary + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengles_GLContext_nLoadOpenGLLibrary + (JNIEnv *, jclass); + +/* + * Class: org_lwjgl_opengles_GLContext + * Method: nUnloadOpenGLLibrary + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengles_GLContext_nUnloadOpenGLLibrary + (JNIEnv *, jclass); + +/* + * Class: org_lwjgl_opengles_GLContext + * Method: resetNativeStubs + * Signature: (Ljava/lang/Class;)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengles_GLContext_resetNativeStubs + (JNIEnv *, jclass, jclass); + +#ifdef __cplusplus +} +#endif +#endif diff -Nru lwjgl-2.7.1+dfsg/src/native/common/org_lwjgl_BufferUtils.c lwjgl-2.9.3+dfsg/src/native/common/org_lwjgl_BufferUtils.c --- lwjgl-2.7.1+dfsg/src/native/common/org_lwjgl_BufferUtils.c 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/common/org_lwjgl_BufferUtils.c 2016-04-09 16:26:57.000000000 +0000 @@ -1,5 +1,10 @@ #include "org_lwjgl_BufferUtils.h" +#include "common_tools.h" JNIEXPORT void JNICALL Java_org_lwjgl_BufferUtils_zeroBuffer0(JNIEnv *env, jclass clazz, jobject buffer, jlong offset, jlong size) { memset((char*)(*env)->GetDirectBufferAddress(env, buffer) + (size_t)offset, 0, (size_t)size); -} \ No newline at end of file +} + +JNIEXPORT jlong JNICALL Java_org_lwjgl_BufferUtils_getBufferAddress(JNIEnv *env, jclass clazz, jobject buffer) { + return (intptr_t)(*env)->GetDirectBufferAddress(env, buffer); +} diff -Nru lwjgl-2.7.1+dfsg/src/native/common/org_lwjgl_BufferUtils.h lwjgl-2.9.3+dfsg/src/native/common/org_lwjgl_BufferUtils.h --- lwjgl-2.7.1+dfsg/src/native/common/org_lwjgl_BufferUtils.h 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/common/org_lwjgl_BufferUtils.h 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,29 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_lwjgl_BufferUtils */ + +#ifndef _Included_org_lwjgl_BufferUtils +#define _Included_org_lwjgl_BufferUtils +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: org_lwjgl_BufferUtils + * Method: zeroBuffer0 + * Signature: (Ljava/nio/Buffer;JJ)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_BufferUtils_zeroBuffer0 + (JNIEnv *, jclass, jobject, jlong, jlong); + +/* + * Class: org_lwjgl_BufferUtils + * Method: getBufferAddress + * Signature: (Ljava/nio/Buffer;)J + */ +JNIEXPORT jlong JNICALL Java_org_lwjgl_BufferUtils_getBufferAddress + (JNIEnv *, jclass, jobject); + +#ifdef __cplusplus +} +#endif +#endif diff -Nru lwjgl-2.7.1+dfsg/src/native/common/org_lwjgl_DefaultSysImplementation.h lwjgl-2.9.3+dfsg/src/native/common/org_lwjgl_DefaultSysImplementation.h --- lwjgl-2.7.1+dfsg/src/native/common/org_lwjgl_DefaultSysImplementation.h 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/common/org_lwjgl_DefaultSysImplementation.h 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,37 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_lwjgl_DefaultSysImplementation */ + +#ifndef _Included_org_lwjgl_DefaultSysImplementation +#define _Included_org_lwjgl_DefaultSysImplementation +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: org_lwjgl_DefaultSysImplementation + * Method: getJNIVersion + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_org_lwjgl_DefaultSysImplementation_getJNIVersion + (JNIEnv *, jobject); + +/* + * Class: org_lwjgl_DefaultSysImplementation + * Method: getPointerSize + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_org_lwjgl_DefaultSysImplementation_getPointerSize + (JNIEnv *, jobject); + +/* + * Class: org_lwjgl_DefaultSysImplementation + * Method: setDebug + * Signature: (Z)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_DefaultSysImplementation_setDebug + (JNIEnv *, jobject, jboolean); + +#ifdef __cplusplus +} +#endif +#endif diff -Nru lwjgl-2.7.1+dfsg/src/native/common/org_lwjgl_input_Cursor_CursorElement.h lwjgl-2.9.3+dfsg/src/native/common/org_lwjgl_input_Cursor_CursorElement.h --- lwjgl-2.7.1+dfsg/src/native/common/org_lwjgl_input_Cursor_CursorElement.h 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/common/org_lwjgl_input_Cursor_CursorElement.h 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,13 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_lwjgl_input_Cursor_CursorElement */ + +#ifndef _Included_org_lwjgl_input_Cursor_CursorElement +#define _Included_org_lwjgl_input_Cursor_CursorElement +#ifdef __cplusplus +extern "C" { +#endif +#ifdef __cplusplus +} +#endif +#endif diff -Nru lwjgl-2.7.1+dfsg/src/native/common/org_lwjgl_input_Cursor.h lwjgl-2.9.3+dfsg/src/native/common/org_lwjgl_input_Cursor.h --- lwjgl-2.7.1+dfsg/src/native/common/org_lwjgl_input_Cursor.h 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/common/org_lwjgl_input_Cursor.h 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,19 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_lwjgl_input_Cursor */ + +#ifndef _Included_org_lwjgl_input_Cursor +#define _Included_org_lwjgl_input_Cursor +#ifdef __cplusplus +extern "C" { +#endif +#undef org_lwjgl_input_Cursor_CURSOR_ONE_BIT_TRANSPARENCY +#define org_lwjgl_input_Cursor_CURSOR_ONE_BIT_TRANSPARENCY 1L +#undef org_lwjgl_input_Cursor_CURSOR_8_BIT_ALPHA +#define org_lwjgl_input_Cursor_CURSOR_8_BIT_ALPHA 2L +#undef org_lwjgl_input_Cursor_CURSOR_ANIMATION +#define org_lwjgl_input_Cursor_CURSOR_ANIMATION 4L +#ifdef __cplusplus +} +#endif +#endif diff -Nru lwjgl-2.7.1+dfsg/src/native/common/org_lwjgl_input_Keyboard.h lwjgl-2.9.3+dfsg/src/native/common/org_lwjgl_input_Keyboard.h --- lwjgl-2.7.1+dfsg/src/native/common/org_lwjgl_input_Keyboard.h 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/common/org_lwjgl_input_Keyboard.h 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,287 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_lwjgl_input_Keyboard */ + +#ifndef _Included_org_lwjgl_input_Keyboard +#define _Included_org_lwjgl_input_Keyboard +#ifdef __cplusplus +extern "C" { +#endif +#undef org_lwjgl_input_Keyboard_EVENT_SIZE +#define org_lwjgl_input_Keyboard_EVENT_SIZE 18L +#undef org_lwjgl_input_Keyboard_CHAR_NONE +#define org_lwjgl_input_Keyboard_CHAR_NONE 0L +#undef org_lwjgl_input_Keyboard_KEY_NONE +#define org_lwjgl_input_Keyboard_KEY_NONE 0L +#undef org_lwjgl_input_Keyboard_KEY_ESCAPE +#define org_lwjgl_input_Keyboard_KEY_ESCAPE 1L +#undef org_lwjgl_input_Keyboard_KEY_1 +#define org_lwjgl_input_Keyboard_KEY_1 2L +#undef org_lwjgl_input_Keyboard_KEY_2 +#define org_lwjgl_input_Keyboard_KEY_2 3L +#undef org_lwjgl_input_Keyboard_KEY_3 +#define org_lwjgl_input_Keyboard_KEY_3 4L +#undef org_lwjgl_input_Keyboard_KEY_4 +#define org_lwjgl_input_Keyboard_KEY_4 5L +#undef org_lwjgl_input_Keyboard_KEY_5 +#define org_lwjgl_input_Keyboard_KEY_5 6L +#undef org_lwjgl_input_Keyboard_KEY_6 +#define org_lwjgl_input_Keyboard_KEY_6 7L +#undef org_lwjgl_input_Keyboard_KEY_7 +#define org_lwjgl_input_Keyboard_KEY_7 8L +#undef org_lwjgl_input_Keyboard_KEY_8 +#define org_lwjgl_input_Keyboard_KEY_8 9L +#undef org_lwjgl_input_Keyboard_KEY_9 +#define org_lwjgl_input_Keyboard_KEY_9 10L +#undef org_lwjgl_input_Keyboard_KEY_0 +#define org_lwjgl_input_Keyboard_KEY_0 11L +#undef org_lwjgl_input_Keyboard_KEY_MINUS +#define org_lwjgl_input_Keyboard_KEY_MINUS 12L +#undef org_lwjgl_input_Keyboard_KEY_EQUALS +#define org_lwjgl_input_Keyboard_KEY_EQUALS 13L +#undef org_lwjgl_input_Keyboard_KEY_BACK +#define org_lwjgl_input_Keyboard_KEY_BACK 14L +#undef org_lwjgl_input_Keyboard_KEY_TAB +#define org_lwjgl_input_Keyboard_KEY_TAB 15L +#undef org_lwjgl_input_Keyboard_KEY_Q +#define org_lwjgl_input_Keyboard_KEY_Q 16L +#undef org_lwjgl_input_Keyboard_KEY_W +#define org_lwjgl_input_Keyboard_KEY_W 17L +#undef org_lwjgl_input_Keyboard_KEY_E +#define org_lwjgl_input_Keyboard_KEY_E 18L +#undef org_lwjgl_input_Keyboard_KEY_R +#define org_lwjgl_input_Keyboard_KEY_R 19L +#undef org_lwjgl_input_Keyboard_KEY_T +#define org_lwjgl_input_Keyboard_KEY_T 20L +#undef org_lwjgl_input_Keyboard_KEY_Y +#define org_lwjgl_input_Keyboard_KEY_Y 21L +#undef org_lwjgl_input_Keyboard_KEY_U +#define org_lwjgl_input_Keyboard_KEY_U 22L +#undef org_lwjgl_input_Keyboard_KEY_I +#define org_lwjgl_input_Keyboard_KEY_I 23L +#undef org_lwjgl_input_Keyboard_KEY_O +#define org_lwjgl_input_Keyboard_KEY_O 24L +#undef org_lwjgl_input_Keyboard_KEY_P +#define org_lwjgl_input_Keyboard_KEY_P 25L +#undef org_lwjgl_input_Keyboard_KEY_LBRACKET +#define org_lwjgl_input_Keyboard_KEY_LBRACKET 26L +#undef org_lwjgl_input_Keyboard_KEY_RBRACKET +#define org_lwjgl_input_Keyboard_KEY_RBRACKET 27L +#undef org_lwjgl_input_Keyboard_KEY_RETURN +#define org_lwjgl_input_Keyboard_KEY_RETURN 28L +#undef org_lwjgl_input_Keyboard_KEY_LCONTROL +#define org_lwjgl_input_Keyboard_KEY_LCONTROL 29L +#undef org_lwjgl_input_Keyboard_KEY_A +#define org_lwjgl_input_Keyboard_KEY_A 30L +#undef org_lwjgl_input_Keyboard_KEY_S +#define org_lwjgl_input_Keyboard_KEY_S 31L +#undef org_lwjgl_input_Keyboard_KEY_D +#define org_lwjgl_input_Keyboard_KEY_D 32L +#undef org_lwjgl_input_Keyboard_KEY_F +#define org_lwjgl_input_Keyboard_KEY_F 33L +#undef org_lwjgl_input_Keyboard_KEY_G +#define org_lwjgl_input_Keyboard_KEY_G 34L +#undef org_lwjgl_input_Keyboard_KEY_H +#define org_lwjgl_input_Keyboard_KEY_H 35L +#undef org_lwjgl_input_Keyboard_KEY_J +#define org_lwjgl_input_Keyboard_KEY_J 36L +#undef org_lwjgl_input_Keyboard_KEY_K +#define org_lwjgl_input_Keyboard_KEY_K 37L +#undef org_lwjgl_input_Keyboard_KEY_L +#define org_lwjgl_input_Keyboard_KEY_L 38L +#undef org_lwjgl_input_Keyboard_KEY_SEMICOLON +#define org_lwjgl_input_Keyboard_KEY_SEMICOLON 39L +#undef org_lwjgl_input_Keyboard_KEY_APOSTROPHE +#define org_lwjgl_input_Keyboard_KEY_APOSTROPHE 40L +#undef org_lwjgl_input_Keyboard_KEY_GRAVE +#define org_lwjgl_input_Keyboard_KEY_GRAVE 41L +#undef org_lwjgl_input_Keyboard_KEY_LSHIFT +#define org_lwjgl_input_Keyboard_KEY_LSHIFT 42L +#undef org_lwjgl_input_Keyboard_KEY_BACKSLASH +#define org_lwjgl_input_Keyboard_KEY_BACKSLASH 43L +#undef org_lwjgl_input_Keyboard_KEY_Z +#define org_lwjgl_input_Keyboard_KEY_Z 44L +#undef org_lwjgl_input_Keyboard_KEY_X +#define org_lwjgl_input_Keyboard_KEY_X 45L +#undef org_lwjgl_input_Keyboard_KEY_C +#define org_lwjgl_input_Keyboard_KEY_C 46L +#undef org_lwjgl_input_Keyboard_KEY_V +#define org_lwjgl_input_Keyboard_KEY_V 47L +#undef org_lwjgl_input_Keyboard_KEY_B +#define org_lwjgl_input_Keyboard_KEY_B 48L +#undef org_lwjgl_input_Keyboard_KEY_N +#define org_lwjgl_input_Keyboard_KEY_N 49L +#undef org_lwjgl_input_Keyboard_KEY_M +#define org_lwjgl_input_Keyboard_KEY_M 50L +#undef org_lwjgl_input_Keyboard_KEY_COMMA +#define org_lwjgl_input_Keyboard_KEY_COMMA 51L +#undef org_lwjgl_input_Keyboard_KEY_PERIOD +#define org_lwjgl_input_Keyboard_KEY_PERIOD 52L +#undef org_lwjgl_input_Keyboard_KEY_SLASH +#define org_lwjgl_input_Keyboard_KEY_SLASH 53L +#undef org_lwjgl_input_Keyboard_KEY_RSHIFT +#define org_lwjgl_input_Keyboard_KEY_RSHIFT 54L +#undef org_lwjgl_input_Keyboard_KEY_MULTIPLY +#define org_lwjgl_input_Keyboard_KEY_MULTIPLY 55L +#undef org_lwjgl_input_Keyboard_KEY_LMENU +#define org_lwjgl_input_Keyboard_KEY_LMENU 56L +#undef org_lwjgl_input_Keyboard_KEY_SPACE +#define org_lwjgl_input_Keyboard_KEY_SPACE 57L +#undef org_lwjgl_input_Keyboard_KEY_CAPITAL +#define org_lwjgl_input_Keyboard_KEY_CAPITAL 58L +#undef org_lwjgl_input_Keyboard_KEY_F1 +#define org_lwjgl_input_Keyboard_KEY_F1 59L +#undef org_lwjgl_input_Keyboard_KEY_F2 +#define org_lwjgl_input_Keyboard_KEY_F2 60L +#undef org_lwjgl_input_Keyboard_KEY_F3 +#define org_lwjgl_input_Keyboard_KEY_F3 61L +#undef org_lwjgl_input_Keyboard_KEY_F4 +#define org_lwjgl_input_Keyboard_KEY_F4 62L +#undef org_lwjgl_input_Keyboard_KEY_F5 +#define org_lwjgl_input_Keyboard_KEY_F5 63L +#undef org_lwjgl_input_Keyboard_KEY_F6 +#define org_lwjgl_input_Keyboard_KEY_F6 64L +#undef org_lwjgl_input_Keyboard_KEY_F7 +#define org_lwjgl_input_Keyboard_KEY_F7 65L +#undef org_lwjgl_input_Keyboard_KEY_F8 +#define org_lwjgl_input_Keyboard_KEY_F8 66L +#undef org_lwjgl_input_Keyboard_KEY_F9 +#define org_lwjgl_input_Keyboard_KEY_F9 67L +#undef org_lwjgl_input_Keyboard_KEY_F10 +#define org_lwjgl_input_Keyboard_KEY_F10 68L +#undef org_lwjgl_input_Keyboard_KEY_NUMLOCK +#define org_lwjgl_input_Keyboard_KEY_NUMLOCK 69L +#undef org_lwjgl_input_Keyboard_KEY_SCROLL +#define org_lwjgl_input_Keyboard_KEY_SCROLL 70L +#undef org_lwjgl_input_Keyboard_KEY_NUMPAD7 +#define org_lwjgl_input_Keyboard_KEY_NUMPAD7 71L +#undef org_lwjgl_input_Keyboard_KEY_NUMPAD8 +#define org_lwjgl_input_Keyboard_KEY_NUMPAD8 72L +#undef org_lwjgl_input_Keyboard_KEY_NUMPAD9 +#define org_lwjgl_input_Keyboard_KEY_NUMPAD9 73L +#undef org_lwjgl_input_Keyboard_KEY_SUBTRACT +#define org_lwjgl_input_Keyboard_KEY_SUBTRACT 74L +#undef org_lwjgl_input_Keyboard_KEY_NUMPAD4 +#define org_lwjgl_input_Keyboard_KEY_NUMPAD4 75L +#undef org_lwjgl_input_Keyboard_KEY_NUMPAD5 +#define org_lwjgl_input_Keyboard_KEY_NUMPAD5 76L +#undef org_lwjgl_input_Keyboard_KEY_NUMPAD6 +#define org_lwjgl_input_Keyboard_KEY_NUMPAD6 77L +#undef org_lwjgl_input_Keyboard_KEY_ADD +#define org_lwjgl_input_Keyboard_KEY_ADD 78L +#undef org_lwjgl_input_Keyboard_KEY_NUMPAD1 +#define org_lwjgl_input_Keyboard_KEY_NUMPAD1 79L +#undef org_lwjgl_input_Keyboard_KEY_NUMPAD2 +#define org_lwjgl_input_Keyboard_KEY_NUMPAD2 80L +#undef org_lwjgl_input_Keyboard_KEY_NUMPAD3 +#define org_lwjgl_input_Keyboard_KEY_NUMPAD3 81L +#undef org_lwjgl_input_Keyboard_KEY_NUMPAD0 +#define org_lwjgl_input_Keyboard_KEY_NUMPAD0 82L +#undef org_lwjgl_input_Keyboard_KEY_DECIMAL +#define org_lwjgl_input_Keyboard_KEY_DECIMAL 83L +#undef org_lwjgl_input_Keyboard_KEY_F11 +#define org_lwjgl_input_Keyboard_KEY_F11 87L +#undef org_lwjgl_input_Keyboard_KEY_F12 +#define org_lwjgl_input_Keyboard_KEY_F12 88L +#undef org_lwjgl_input_Keyboard_KEY_F13 +#define org_lwjgl_input_Keyboard_KEY_F13 100L +#undef org_lwjgl_input_Keyboard_KEY_F14 +#define org_lwjgl_input_Keyboard_KEY_F14 101L +#undef org_lwjgl_input_Keyboard_KEY_F15 +#define org_lwjgl_input_Keyboard_KEY_F15 102L +#undef org_lwjgl_input_Keyboard_KEY_F16 +#define org_lwjgl_input_Keyboard_KEY_F16 103L +#undef org_lwjgl_input_Keyboard_KEY_F17 +#define org_lwjgl_input_Keyboard_KEY_F17 104L +#undef org_lwjgl_input_Keyboard_KEY_F18 +#define org_lwjgl_input_Keyboard_KEY_F18 105L +#undef org_lwjgl_input_Keyboard_KEY_KANA +#define org_lwjgl_input_Keyboard_KEY_KANA 112L +#undef org_lwjgl_input_Keyboard_KEY_F19 +#define org_lwjgl_input_Keyboard_KEY_F19 113L +#undef org_lwjgl_input_Keyboard_KEY_CONVERT +#define org_lwjgl_input_Keyboard_KEY_CONVERT 121L +#undef org_lwjgl_input_Keyboard_KEY_NOCONVERT +#define org_lwjgl_input_Keyboard_KEY_NOCONVERT 123L +#undef org_lwjgl_input_Keyboard_KEY_YEN +#define org_lwjgl_input_Keyboard_KEY_YEN 125L +#undef org_lwjgl_input_Keyboard_KEY_NUMPADEQUALS +#define org_lwjgl_input_Keyboard_KEY_NUMPADEQUALS 141L +#undef org_lwjgl_input_Keyboard_KEY_CIRCUMFLEX +#define org_lwjgl_input_Keyboard_KEY_CIRCUMFLEX 144L +#undef org_lwjgl_input_Keyboard_KEY_AT +#define org_lwjgl_input_Keyboard_KEY_AT 145L +#undef org_lwjgl_input_Keyboard_KEY_COLON +#define org_lwjgl_input_Keyboard_KEY_COLON 146L +#undef org_lwjgl_input_Keyboard_KEY_UNDERLINE +#define org_lwjgl_input_Keyboard_KEY_UNDERLINE 147L +#undef org_lwjgl_input_Keyboard_KEY_KANJI +#define org_lwjgl_input_Keyboard_KEY_KANJI 148L +#undef org_lwjgl_input_Keyboard_KEY_STOP +#define org_lwjgl_input_Keyboard_KEY_STOP 149L +#undef org_lwjgl_input_Keyboard_KEY_AX +#define org_lwjgl_input_Keyboard_KEY_AX 150L +#undef org_lwjgl_input_Keyboard_KEY_UNLABELED +#define org_lwjgl_input_Keyboard_KEY_UNLABELED 151L +#undef org_lwjgl_input_Keyboard_KEY_NUMPADENTER +#define org_lwjgl_input_Keyboard_KEY_NUMPADENTER 156L +#undef org_lwjgl_input_Keyboard_KEY_RCONTROL +#define org_lwjgl_input_Keyboard_KEY_RCONTROL 157L +#undef org_lwjgl_input_Keyboard_KEY_SECTION +#define org_lwjgl_input_Keyboard_KEY_SECTION 167L +#undef org_lwjgl_input_Keyboard_KEY_NUMPADCOMMA +#define org_lwjgl_input_Keyboard_KEY_NUMPADCOMMA 179L +#undef org_lwjgl_input_Keyboard_KEY_DIVIDE +#define org_lwjgl_input_Keyboard_KEY_DIVIDE 181L +#undef org_lwjgl_input_Keyboard_KEY_SYSRQ +#define org_lwjgl_input_Keyboard_KEY_SYSRQ 183L +#undef org_lwjgl_input_Keyboard_KEY_RMENU +#define org_lwjgl_input_Keyboard_KEY_RMENU 184L +#undef org_lwjgl_input_Keyboard_KEY_FUNCTION +#define org_lwjgl_input_Keyboard_KEY_FUNCTION 196L +#undef org_lwjgl_input_Keyboard_KEY_PAUSE +#define org_lwjgl_input_Keyboard_KEY_PAUSE 197L +#undef org_lwjgl_input_Keyboard_KEY_HOME +#define org_lwjgl_input_Keyboard_KEY_HOME 199L +#undef org_lwjgl_input_Keyboard_KEY_UP +#define org_lwjgl_input_Keyboard_KEY_UP 200L +#undef org_lwjgl_input_Keyboard_KEY_PRIOR +#define org_lwjgl_input_Keyboard_KEY_PRIOR 201L +#undef org_lwjgl_input_Keyboard_KEY_LEFT +#define org_lwjgl_input_Keyboard_KEY_LEFT 203L +#undef org_lwjgl_input_Keyboard_KEY_RIGHT +#define org_lwjgl_input_Keyboard_KEY_RIGHT 205L +#undef org_lwjgl_input_Keyboard_KEY_END +#define org_lwjgl_input_Keyboard_KEY_END 207L +#undef org_lwjgl_input_Keyboard_KEY_DOWN +#define org_lwjgl_input_Keyboard_KEY_DOWN 208L +#undef org_lwjgl_input_Keyboard_KEY_NEXT +#define org_lwjgl_input_Keyboard_KEY_NEXT 209L +#undef org_lwjgl_input_Keyboard_KEY_INSERT +#define org_lwjgl_input_Keyboard_KEY_INSERT 210L +#undef org_lwjgl_input_Keyboard_KEY_DELETE +#define org_lwjgl_input_Keyboard_KEY_DELETE 211L +#undef org_lwjgl_input_Keyboard_KEY_CLEAR +#define org_lwjgl_input_Keyboard_KEY_CLEAR 218L +#undef org_lwjgl_input_Keyboard_KEY_LMETA +#define org_lwjgl_input_Keyboard_KEY_LMETA 219L +#undef org_lwjgl_input_Keyboard_KEY_LWIN +#define org_lwjgl_input_Keyboard_KEY_LWIN 219L +#undef org_lwjgl_input_Keyboard_KEY_RMETA +#define org_lwjgl_input_Keyboard_KEY_RMETA 220L +#undef org_lwjgl_input_Keyboard_KEY_RWIN +#define org_lwjgl_input_Keyboard_KEY_RWIN 220L +#undef org_lwjgl_input_Keyboard_KEY_APPS +#define org_lwjgl_input_Keyboard_KEY_APPS 221L +#undef org_lwjgl_input_Keyboard_KEY_POWER +#define org_lwjgl_input_Keyboard_KEY_POWER 222L +#undef org_lwjgl_input_Keyboard_KEY_SLEEP +#define org_lwjgl_input_Keyboard_KEY_SLEEP 223L +#undef org_lwjgl_input_Keyboard_KEYBOARD_SIZE +#define org_lwjgl_input_Keyboard_KEYBOARD_SIZE 256L +#undef org_lwjgl_input_Keyboard_BUFFER_SIZE +#define org_lwjgl_input_Keyboard_BUFFER_SIZE 50L +#ifdef __cplusplus +} +#endif +#endif diff -Nru lwjgl-2.7.1+dfsg/src/native/common/org_lwjgl_input_Keyboard_KeyEvent.h lwjgl-2.9.3+dfsg/src/native/common/org_lwjgl_input_Keyboard_KeyEvent.h --- lwjgl-2.7.1+dfsg/src/native/common/org_lwjgl_input_Keyboard_KeyEvent.h 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/common/org_lwjgl_input_Keyboard_KeyEvent.h 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,13 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_lwjgl_input_Keyboard_KeyEvent */ + +#ifndef _Included_org_lwjgl_input_Keyboard_KeyEvent +#define _Included_org_lwjgl_input_Keyboard_KeyEvent +#ifdef __cplusplus +extern "C" { +#endif +#ifdef __cplusplus +} +#endif +#endif diff -Nru lwjgl-2.7.1+dfsg/src/native/common/org_lwjgl_input_Mouse.h lwjgl-2.9.3+dfsg/src/native/common/org_lwjgl_input_Mouse.h --- lwjgl-2.7.1+dfsg/src/native/common/org_lwjgl_input_Mouse.h 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/common/org_lwjgl_input_Mouse.h 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,17 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_lwjgl_input_Mouse */ + +#ifndef _Included_org_lwjgl_input_Mouse +#define _Included_org_lwjgl_input_Mouse +#ifdef __cplusplus +extern "C" { +#endif +#undef org_lwjgl_input_Mouse_EVENT_SIZE +#define org_lwjgl_input_Mouse_EVENT_SIZE 22L +#undef org_lwjgl_input_Mouse_BUFFER_SIZE +#define org_lwjgl_input_Mouse_BUFFER_SIZE 50L +#ifdef __cplusplus +} +#endif +#endif diff -Nru lwjgl-2.7.1+dfsg/src/native/common/org_lwjgl_openal_ALC10.c lwjgl-2.9.3+dfsg/src/native/common/org_lwjgl_openal_ALC10.c --- lwjgl-2.7.1+dfsg/src/native/common/org_lwjgl_openal_ALC10.c 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/common/org_lwjgl_openal_ALC10.c 2016-04-09 16:26:57.000000000 +0000 @@ -1,40 +1,40 @@ -/* +/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are + * modification, are permitted provided that the following conditions are * met: - * - * * Redistributions of source code must retain the above copyright + * + * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * * Neither the name of 'LWJGL' nor the names of - * its contributors may be used to endorse or promote products derived + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + /** * $Id: org_lwjgl_openal_ALC.c 2279 2006-02-23 19:22:00Z elias_naur $ * - * This is the actual JNI implementation of the OpenAL context/device library. - * + * This is the actual JNI implementation of the OpenAL context/device library. + * * @author Brian Matzon * @version $Revision: 2279 $ */ @@ -81,9 +81,9 @@ * C Specification: * ALubyte * alcGetString(ALCdevice *device, ALenum token); */ -static jstring JNICALL Java_org_lwjgl_openal_ALC10_nalcGetString (JNIEnv *env, jclass clazz, jlong deviceaddress, jint token) { - const char* alcString = (const char*) alcGetString((ALCdevice*)((intptr_t)deviceaddress), (ALenum) token); - int length; +static jobject JNICALL Java_org_lwjgl_openal_ALC10_nalcGetString (JNIEnv *env, jclass clazz, jlong deviceaddress, jint token) { + char* alcString = (char*) alcGetString((ALCdevice*)((intptr_t)deviceaddress), (ALenum) token); + size_t length; int i=1; if (alcString == NULL) { @@ -103,60 +103,42 @@ break; } case 0x1013: // ALC_ALL_DEVICES_SPECIFIER - while (alcString[i - 1] != '\0' || alcString[i] != '\0') { - i++; + while (alcString[i - 1] != '\0' || alcString[i] != '\0') { + i++; } length = i + 1; break; default: // e.g. ALC_DEFAULT_ALL_DEVICES_SPECIFIER length = strlen(alcString); } - return NewStringNativeWithLength(env, alcString, length); + //return NewStringNativeWithLength(env, alcString, length); + return safeNewBuffer(env, alcString, length); } /** * This function returns integers related to the context. - * + * * C Specification: * ALvoid alcGetIntegerv(ALCdevice *device, ALenum token, ALsizei size, ALint *dest); */ -static void JNICALL Java_org_lwjgl_openal_ALC10_nalcGetIntegerv (JNIEnv *env, jclass clazz, jlong deviceaddress, jint token, jint size, jobject dest, jint offset) { - ALint* address = NULL; - if (dest != NULL) { - address = offset + (ALint*) (*env)->GetDirectBufferAddress(env, dest); - } - alcGetIntegerv((ALCdevice*)((intptr_t)deviceaddress), (ALenum) token, (ALsizei) size, address); +static void JNICALL Java_org_lwjgl_openal_ALC10_nalcGetIntegerv (JNIEnv *env, jclass clazz, jlong deviceaddress, jint token, jint size, jlong dest) { + ALint* dest_address = (ALint*)(intptr_t)dest; + alcGetIntegerv((ALCdevice*)((intptr_t)deviceaddress), (ALenum) token, (ALsizei) size, dest_address); } /** * This function opens a device by name. - * + * * C Specification: * ALCdevice *alcOpenDevice( const ALubyte *tokstr ); */ -static jlong JNICALL Java_org_lwjgl_openal_ALC10_nalcOpenDevice (JNIEnv *env, jclass clazz, jstring tokstr) { - char * tokenstring; - ALCdevice* device; - - if(tokstr != NULL) { - tokenstring = GetStringNativeChars(env, tokstr); - } else { - tokenstring = NULL; - } - - /* get device */ - device = alcOpenDevice((ALubyte *) tokenstring); - - if(tokenstring != NULL) { - free(tokenstring); - } - - return (jlong)((intptr_t)device); +static jlong JNICALL Java_org_lwjgl_openal_ALC10_nalcOpenDevice (JNIEnv *env, jclass clazz, jlong tokstr) { + return (jlong)(intptr_t)alcOpenDevice((ALubyte *)(intptr_t)tokstr); } /** * This function closes a device by name. - * + * * C Specification: * bool alcCloseDevice( ALCdevice *dev ); */ @@ -166,19 +148,16 @@ /** * This function creates a context using a specified device. - * + * * C Specification: * ALCcontext* alcCreateContext( ALCdevice *dev, ALint* attrlist ); */ -static jlong JNICALL Java_org_lwjgl_openal_ALC10_nalcCreateContext (JNIEnv *env, jclass clazz, jlong deviceaddress, jobject attrlist) { - ALint* address = NULL; +static jlong JNICALL Java_org_lwjgl_openal_ALC10_nalcCreateContext (JNIEnv *env, jclass clazz, jlong deviceaddress, jlong attrlist) { + ALint* attrlist_address = (ALint*)(intptr_t)attrlist; ALCcontext* context; - if (attrlist != NULL) { - address = (ALint*) safeGetBufferAddress(env, attrlist); - } - context = alcCreateContext((ALCdevice*)((intptr_t)deviceaddress), address); - + context = alcCreateContext((ALCdevice*)((intptr_t)deviceaddress), attrlist_address); + return (jlong)((intptr_t)context); } @@ -195,7 +174,7 @@ /** * This function tells a context to begin processing. - * + * * C Specification: * void alcProcessContext(ALCcontext *context); */ @@ -205,7 +184,7 @@ /** * This function retrieves the current context. - * + * * C Specification: * ALCcontext* alcGetCurrentContext( ALvoid ); */ @@ -216,7 +195,7 @@ /** * This function retrieves the specified contexts device - * + * * C Specification: * ALCdevice* alcGetContextsDevice(ALCcontext *context); */ @@ -237,7 +216,7 @@ /** * This function destroys a context. - * + * * C Specification: * void alcDestroyContext(ALCcontext *context); */ @@ -247,7 +226,7 @@ /** * This function retrieves the specified devices context error state. - * + * * C Specification: * ALCenum alcGetError(ALCdevice *device); */ @@ -257,19 +236,12 @@ /** * This function queries if a specified context extension is available. - * + * * C Specification: * ALboolean alcIsExtensionPresent(ALCdevice *device, ALubyte *extName); */ -static jboolean JNICALL Java_org_lwjgl_openal_ALC10_nalcIsExtensionPresent (JNIEnv *env, jclass clazz, jlong deviceaddress, jstring extName) { - /* get extension */ - ALubyte* functionname = (ALubyte*) GetStringNativeChars(env, extName); - - jboolean result = (jboolean) alcIsExtensionPresent((ALCdevice*)((intptr_t)deviceaddress), functionname); - - free(functionname); - - return result; +static jboolean JNICALL Java_org_lwjgl_openal_ALC10_nalcIsExtensionPresent (JNIEnv *env, jclass clazz, jlong deviceaddress, jlong extName) { + return (jboolean) alcIsExtensionPresent((ALCdevice*)((intptr_t)deviceaddress), (ALubyte*)(intptr_t)extName); } /** @@ -278,15 +250,8 @@ * C Specification: * ALenum alcGetEnumValue(ALCdevice *device, ALubyte *enumName); */ -static jint JNICALL Java_org_lwjgl_openal_ALC10_nalcGetEnumValue (JNIEnv *env, jclass clazz, jlong deviceaddress, jstring enumName) { - /* get extension */ - ALubyte* enumerationname = (ALubyte*) GetStringNativeChars(env, enumName); - - jint result = (jint) alcGetEnumValue((ALCdevice*)((intptr_t)deviceaddress), enumerationname); - - free(enumerationname); - - return result; +static jint JNICALL Java_org_lwjgl_openal_ALC10_nalcGetEnumValue (JNIEnv *env, jclass clazz, jlong deviceaddress, jlong enumName) { + return (jint) alcGetEnumValue((ALCdevice*)((intptr_t)deviceaddress), (ALubyte*)(intptr_t)enumName); } /** @@ -299,20 +264,20 @@ #endif JNIEXPORT void JNICALL Java_org_lwjgl_openal_ALC10_initNativeStubs(JNIEnv *env, jclass clazz) { JavaMethodAndExtFunction functions[] = { - {"nalcGetString", "(JI)Ljava/lang/String;", (void*)&Java_org_lwjgl_openal_ALC10_nalcGetString, "alcGetString", (void*)&alcGetString}, - {"nalcGetIntegerv", "(JIILjava/nio/Buffer;I)V", (void*)&Java_org_lwjgl_openal_ALC10_nalcGetIntegerv, "alcGetIntegerv", (void*)&alcGetIntegerv}, - {"nalcOpenDevice", "(Ljava/lang/String;)J", (void*)&Java_org_lwjgl_openal_ALC10_nalcOpenDevice, "alcOpenDevice", (void*)&alcOpenDevice}, - {"nalcCloseDevice", "(J)Z", (void*)&Java_org_lwjgl_openal_ALC10_nalcCloseDevice, "alcCloseDevice", (void*)&alcCloseDevice}, - {"nalcCreateContext", "(JLjava/nio/IntBuffer;)J", (void*)&Java_org_lwjgl_openal_ALC10_nalcCreateContext, "alcCreateContext", (void*)&alcCreateContext}, - {"nalcMakeContextCurrent", "(J)I", (void*)&Java_org_lwjgl_openal_ALC10_nalcMakeContextCurrent, "alcMakeContextCurrent", (void*)&alcMakeContextCurrent}, - {"nalcProcessContext", "(J)V", (void*)&Java_org_lwjgl_openal_ALC10_nalcProcessContext, "alcProcessContext", (void*)&alcProcessContext}, - {"nalcGetCurrentContext", "()J", (void*)&Java_org_lwjgl_openal_ALC10_nalcGetCurrentContext, "alcGetCurrentContext", (void*)&alcGetCurrentContext}, - {"nalcGetContextsDevice", "(J)J", (void*)&Java_org_lwjgl_openal_ALC10_nalcGetContextsDevice, "alcGetContextsDevice", (void*)&alcGetContextsDevice}, - {"nalcSuspendContext", "(J)V", (void*)&Java_org_lwjgl_openal_ALC10_nalcSuspendContext, "alcSuspendContext", (void*)&alcSuspendContext}, - {"nalcDestroyContext", "(J)V", (void*)&Java_org_lwjgl_openal_ALC10_nalcDestroyContext, "alcDestroyContext", (void*)&alcDestroyContext}, - {"nalcGetError", "(J)I", (void*)&Java_org_lwjgl_openal_ALC10_nalcGetError, "alcGetError", (void*)&alcGetError}, - {"nalcIsExtensionPresent", "(JLjava/lang/String;)Z", (void*)&Java_org_lwjgl_openal_ALC10_nalcIsExtensionPresent, "alcIsExtensionPresent", (void*)&alcIsExtensionPresent}, - {"nalcGetEnumValue", "(JLjava/lang/String;)I", (void*)&Java_org_lwjgl_openal_ALC10_nalcGetEnumValue, "alcGetEnumValue", (void*)&alcGetEnumValue} + {"nalcGetString", "(JI)Ljava/nio/ByteBuffer;", (void*)&Java_org_lwjgl_openal_ALC10_nalcGetString, "alcGetString", (void*)&alcGetString, false}, + {"nalcGetIntegerv", "(JIIJ)V", (void*)&Java_org_lwjgl_openal_ALC10_nalcGetIntegerv, "alcGetIntegerv", (void*)&alcGetIntegerv, false}, + {"nalcOpenDevice", "(J)J", (void*)&Java_org_lwjgl_openal_ALC10_nalcOpenDevice, "alcOpenDevice", (void*)&alcOpenDevice, false}, + {"nalcCloseDevice", "(J)Z", (void*)&Java_org_lwjgl_openal_ALC10_nalcCloseDevice, "alcCloseDevice", (void*)&alcCloseDevice, false}, + {"nalcCreateContext", "(JJ)J", (void*)&Java_org_lwjgl_openal_ALC10_nalcCreateContext, "alcCreateContext", (void*)&alcCreateContext, false}, + {"nalcMakeContextCurrent", "(J)I", (void*)&Java_org_lwjgl_openal_ALC10_nalcMakeContextCurrent, "alcMakeContextCurrent", (void*)&alcMakeContextCurrent, false}, + {"nalcProcessContext", "(J)V", (void*)&Java_org_lwjgl_openal_ALC10_nalcProcessContext, "alcProcessContext", (void*)&alcProcessContext, false}, + {"nalcGetCurrentContext", "()J", (void*)&Java_org_lwjgl_openal_ALC10_nalcGetCurrentContext, "alcGetCurrentContext", (void*)&alcGetCurrentContext, false}, + {"nalcGetContextsDevice", "(J)J", (void*)&Java_org_lwjgl_openal_ALC10_nalcGetContextsDevice, "alcGetContextsDevice", (void*)&alcGetContextsDevice, false}, + {"nalcSuspendContext", "(J)V", (void*)&Java_org_lwjgl_openal_ALC10_nalcSuspendContext, "alcSuspendContext", (void*)&alcSuspendContext, false}, + {"nalcDestroyContext", "(J)V", (void*)&Java_org_lwjgl_openal_ALC10_nalcDestroyContext, "alcDestroyContext", (void*)&alcDestroyContext, false}, + {"nalcGetError", "(J)I", (void*)&Java_org_lwjgl_openal_ALC10_nalcGetError, "alcGetError", (void*)&alcGetError, false}, + {"nalcIsExtensionPresent", "(JJ)Z", (void*)&Java_org_lwjgl_openal_ALC10_nalcIsExtensionPresent, "alcIsExtensionPresent", (void*)&alcIsExtensionPresent, false}, + {"nalcGetEnumValue", "(JJ)I", (void*)&Java_org_lwjgl_openal_ALC10_nalcGetEnumValue, "alcGetEnumValue", (void*)&alcGetEnumValue, false} }; int num_functions = NUMFUNCTIONS(functions); extal_InitializeClass(env, clazz, num_functions, functions); diff -Nru lwjgl-2.7.1+dfsg/src/native/common/org_lwjgl_openal_ALC11.c lwjgl-2.9.3+dfsg/src/native/common/org_lwjgl_openal_ALC11.c --- lwjgl-2.7.1+dfsg/src/native/common/org_lwjgl_openal_ALC11.c 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/common/org_lwjgl_openal_ALC11.c 2016-04-09 16:26:57.000000000 +0000 @@ -1,40 +1,40 @@ -/* +/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are + * modification, are permitted provided that the following conditions are * met: - * - * * Redistributions of source code must retain the above copyright + * + * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * * Neither the name of 'LWJGL' nor the names of - * its contributors may be used to endorse or promote products derived + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + /** * $Id: org_lwjgl_openal_ALC.c 2279 2006-02-23 19:22:00Z elias_naur $ * - * This is the actual JNI implementation of the OpenAL context/device library. - * + * This is the actual JNI implementation of the OpenAL context/device library. + * * @author Brian Matzon * @version $Revision: 2279 $ */ @@ -60,18 +60,8 @@ * Method: nalcCaptureOpenDevice * Signature: (Ljava/lang/String;III)J */ -static jlong JNICALL Java_org_lwjgl_openal_ALC11_nalcCaptureOpenDevice(JNIEnv *env, jclass clazz, jstring devicename, jint frequency, jint format, jint buffersize) { - ALubyte* dev_name = NULL; - ALCdevice* device = NULL; - - if(devicename != NULL) { - dev_name = (ALubyte*) GetStringNativeChars(env, devicename); - } - - device = alcCaptureOpenDevice((const char *)dev_name, (unsigned int) frequency, format, buffersize); - - free(dev_name); - return (jlong) ((intptr_t)device); +static jlong JNICALL Java_org_lwjgl_openal_ALC11_nalcCaptureOpenDevice(JNIEnv *env, jclass clazz, jlong devicename, jint frequency, jint format, jint buffersize) { + return (jlong)(intptr_t)alcCaptureOpenDevice((const char *)(intptr_t)devicename, (unsigned int) frequency, format, buffersize); } /* @@ -106,8 +96,8 @@ * Method: nalcCaptureSamples * Signature: (JLjava/nio/ByteBuffer;I)V */ -static void JNICALL Java_org_lwjgl_openal_ALC11_nalcCaptureSamples(JNIEnv *env, jclass clazz, jlong device, jobject buffer, jint position, jint samples) { - ALvoid *buffer_address = ((ALbyte *)(((char*)(*env)->GetDirectBufferAddress(env, buffer)) + position)); +static void JNICALL Java_org_lwjgl_openal_ALC11_nalcCaptureSamples(JNIEnv *env, jclass clazz, jlong device, jlong buffer, jint samples) { + ALvoid *buffer_address = (ALbyte *)(intptr_t)buffer; alcCaptureSamples((ALCdevice*) ((intptr_t)device), buffer_address, samples); } @@ -121,11 +111,11 @@ #endif JNIEXPORT void JNICALL Java_org_lwjgl_openal_ALC11_initNativeStubs(JNIEnv *env, jclass clazz) { JavaMethodAndExtFunction functions[] = { - {"nalcCaptureOpenDevice", "(Ljava/lang/String;III)J", (void*)&Java_org_lwjgl_openal_ALC11_nalcCaptureOpenDevice, "alcCaptureOpenDevice", (void*)&alcCaptureOpenDevice}, - {"nalcCaptureCloseDevice", "(J)Z", (void*)&Java_org_lwjgl_openal_ALC11_nalcCaptureCloseDevice, "alcCaptureCloseDevice", (void*)&alcCaptureCloseDevice}, - {"nalcCaptureStart", "(J)V", (void*)&Java_org_lwjgl_openal_ALC11_nalcCaptureStart, "alcCaptureStart", (void*)&alcCaptureStart}, - {"nalcCaptureStop", "(J)V", (void*)&Java_org_lwjgl_openal_ALC11_nalcCaptureStop, "alcCaptureStop", (void*)&alcCaptureStop}, - {"nalcCaptureSamples", "(JLjava/nio/ByteBuffer;II)V", (void*)&Java_org_lwjgl_openal_ALC11_nalcCaptureSamples, "alcCaptureSamples", (void*)&alcCaptureSamples} + {"nalcCaptureOpenDevice", "(JIII)J", (void*)&Java_org_lwjgl_openal_ALC11_nalcCaptureOpenDevice, "alcCaptureOpenDevice", (void*)&alcCaptureOpenDevice, false}, + {"nalcCaptureCloseDevice", "(J)Z", (void*)&Java_org_lwjgl_openal_ALC11_nalcCaptureCloseDevice, "alcCaptureCloseDevice", (void*)&alcCaptureCloseDevice, false}, + {"nalcCaptureStart", "(J)V", (void*)&Java_org_lwjgl_openal_ALC11_nalcCaptureStart, "alcCaptureStart", (void*)&alcCaptureStart, false}, + {"nalcCaptureStop", "(J)V", (void*)&Java_org_lwjgl_openal_ALC11_nalcCaptureStop, "alcCaptureStop", (void*)&alcCaptureStop, false}, + {"nalcCaptureSamples", "(JJI)V", (void*)&Java_org_lwjgl_openal_ALC11_nalcCaptureSamples, "alcCaptureSamples", (void*)&alcCaptureSamples, false} }; int num_functions = NUMFUNCTIONS(functions); extal_InitializeClass(env, clazz, num_functions, functions); diff -Nru lwjgl-2.7.1+dfsg/src/native/common/org_lwjgl_openal_AL.h lwjgl-2.9.3+dfsg/src/native/common/org_lwjgl_openal_AL.h --- lwjgl-2.7.1+dfsg/src/native/common/org_lwjgl_openal_AL.h 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/common/org_lwjgl_openal_AL.h 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,45 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_lwjgl_openal_AL */ + +#ifndef _Included_org_lwjgl_openal_AL +#define _Included_org_lwjgl_openal_AL +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: org_lwjgl_openal_AL + * Method: nCreate + * Signature: (Ljava/lang/String;)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_openal_AL_nCreate + (JNIEnv *, jclass, jstring); + +/* + * Class: org_lwjgl_openal_AL + * Method: nCreateDefault + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_openal_AL_nCreateDefault + (JNIEnv *, jclass); + +/* + * Class: org_lwjgl_openal_AL + * Method: nDestroy + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_openal_AL_nDestroy + (JNIEnv *, jclass); + +/* + * Class: org_lwjgl_openal_AL + * Method: resetNativeStubs + * Signature: (Ljava/lang/Class;)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_openal_AL_resetNativeStubs + (JNIEnv *, jclass, jclass); + +#ifdef __cplusplus +} +#endif +#endif diff -Nru lwjgl-2.7.1+dfsg/src/native/common/org_lwjgl_opencl_CallbackUtil.c lwjgl-2.9.3+dfsg/src/native/common/org_lwjgl_opencl_CallbackUtil.c --- lwjgl-2.7.1+dfsg/src/native/common/org_lwjgl_opencl_CallbackUtil.c 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/common/org_lwjgl_opencl_CallbackUtil.c 2016-04-09 16:26:57.000000000 +0000 @@ -31,7 +31,7 @@ */ /** - * JNI implementation of the AMD_debug_output function callback. + * JNI implementation of the OpenCL function callbacks. * * @author Spasi */ @@ -43,9 +43,10 @@ static jmethodID contextCallbackJ; static jmethodID memObjectDestructorCallbackJ; -static jmethodID buildProgramCallbackJ; +static jmethodID programCallbackJ; static jmethodID nativeKernelCallbackJ; static jmethodID eventCallbackJ; +static jmethodID printfCallbackJ; JNIEXPORT jlong JNICALL Java_org_lwjgl_opencl_CallbackUtil_ncreateGlobalRef(JNIEnv *env, jclass clazz, jobject obj) { return (intptr_t)(*env)->NewGlobalRef(env, obj); @@ -66,7 +67,7 @@ private_info_buffer = NewReadOnlyDirectByteBuffer(env, private_info, cb); (*env)->CallVoidMethod(env, (jobject)user_data, contextCallbackJ, - NewStringNativeWithLength(env, errinfo, strlen(errinfo)), + NewStringNativeWithLength(env, errinfo, (jsize)strlen(errinfo)), private_info_buffer ); } @@ -113,13 +114,13 @@ return (jlong)(intptr_t)&memObjectDestructorCallback; } -// ----------------- [ MEM OBJECT DESTRUCTOR CALLBACK ] ----------------- +// ----------------- [ PROGRAM CALLBACK ] ----------------- -static void CL_CALLBACK buildProgramCallback(cl_program program, void *user_data) { +static void CL_CALLBACK programCallback(cl_program program, void *user_data) { JNIEnv *env = attachCurrentThread(); - if ( env != NULL && !(*env)->ExceptionOccurred(env) && buildProgramCallbackJ != NULL ) { - (*env)->CallVoidMethod(env, (jobject)user_data, buildProgramCallbackJ, + if ( env != NULL && !(*env)->ExceptionOccurred(env) && programCallbackJ != NULL ) { + (*env)->CallVoidMethod(env, (jobject)user_data, programCallbackJ, (jlong)(intptr_t)program ); (*env)->DeleteGlobalRef(env, (jobject)user_data); @@ -128,27 +129,27 @@ detachCurrentThread(); } -JNIEXPORT jlong JNICALL Java_org_lwjgl_opencl_CallbackUtil_getBuildProgramCallback(JNIEnv *env, jclass clazz) { +JNIEXPORT jlong JNICALL Java_org_lwjgl_opencl_CallbackUtil_getProgramCallback(JNIEnv *env, jclass clazz) { // Cache the callback methodID jclass callbackClass; - if ( buildProgramCallbackJ == NULL ) { - callbackClass = (*env)->FindClass(env, "org/lwjgl/opencl/CLBuildProgramCallback"); + if ( programCallbackJ == NULL ) { + callbackClass = (*env)->FindClass(env, "org/lwjgl/opencl/CLProgramCallback"); if ( callbackClass != NULL ) - buildProgramCallbackJ = (*env)->GetMethodID(env, callbackClass, "handleMessage", "(J)V"); + programCallbackJ = (*env)->GetMethodID(env, callbackClass, "handleMessage", "(J)V"); } - return (jlong)(intptr_t)&buildProgramCallback; + return (jlong)(intptr_t)&programCallback; } // ----------------- [ NATIVE KERNEL CALLBACK ] ----------------- -static void CL_USER_FUNC_CALLBACK nativeKernelCallback(void *args) { +static void CL_CALLBACK nativeKernelCallback(void *args) { JNIEnv *env = attachCurrentThread(); jobject user_func = (jobject)(intptr_t)*(jlong *)args; - jint num_mem_objects = *(jint *)((char *)args + 8); + jsize num_mem_objects = *(jsize *)((char *)args + 8); jobjectArray memobjs = NULL; jobject buffer; - jint i; + jsize i; if ( env != NULL && !(*env)->ExceptionOccurred(env) && nativeKernelCallbackJ != NULL ) { if ( num_mem_objects > 0 ) { @@ -214,6 +215,32 @@ return (jlong)(intptr_t)&eventCallback; } +// ----------------- [ PRINTF CALLBACK ] ----------------- + +static void CL_CALLBACK printfCallback(cl_context context, cl_uint printf_data_len, char *printf_data_ptr, void *user_data) { + JNIEnv *env = attachCurrentThread(); + + if ( env != NULL && !(*env)->ExceptionOccurred(env) && printfCallbackJ != NULL ) { + (*env)->CallVoidMethod(env, (jobject)user_data, printfCallbackJ, + NewStringNativeWithLength(env, printf_data_ptr, printf_data_len) + ); + } + + detachCurrentThread(); +} + +JNIEXPORT jlong JNICALL Java_org_lwjgl_opencl_CallbackUtil_getPrintfCallback(JNIEnv *env, jclass clazz) { + // Cache the callback methodID + jclass callbackClass; + if ( printfCallbackJ == NULL ) { + callbackClass = (*env)->FindClass(env, "org/lwjgl/opencl/CLPrintfCallback"); + if ( callbackClass != NULL ) + printfCallbackJ = (*env)->GetMethodID(env, callbackClass, "handleMessage", "(Ljava/lang/String;)V"); + } + + return (jlong)(intptr_t)&printfCallback; +} + // ----------------- [ APPLE_ContextLoggingFunctions CALLBACKS ] ----------------- JNIEXPORT jlong JNICALL Java_org_lwjgl_opencl_CallbackUtil_getLogMessageToSystemLogAPPLE(JNIEnv *env, jclass clazz) { diff -Nru lwjgl-2.7.1+dfsg/src/native/common/org_lwjgl_opencl_CallbackUtil.h lwjgl-2.9.3+dfsg/src/native/common/org_lwjgl_opencl_CallbackUtil.h --- lwjgl-2.7.1+dfsg/src/native/common/org_lwjgl_opencl_CallbackUtil.h 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/common/org_lwjgl_opencl_CallbackUtil.h 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,101 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_lwjgl_opencl_CallbackUtil */ + +#ifndef _Included_org_lwjgl_opencl_CallbackUtil +#define _Included_org_lwjgl_opencl_CallbackUtil +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: org_lwjgl_opencl_CallbackUtil + * Method: ncreateGlobalRef + * Signature: (Ljava/lang/Object;)J + */ +JNIEXPORT jlong JNICALL Java_org_lwjgl_opencl_CallbackUtil_ncreateGlobalRef + (JNIEnv *, jclass, jobject); + +/* + * Class: org_lwjgl_opencl_CallbackUtil + * Method: deleteGlobalRef + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opencl_CallbackUtil_deleteGlobalRef + (JNIEnv *, jclass, jlong); + +/* + * Class: org_lwjgl_opencl_CallbackUtil + * Method: getContextCallback + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_org_lwjgl_opencl_CallbackUtil_getContextCallback + (JNIEnv *, jclass); + +/* + * Class: org_lwjgl_opencl_CallbackUtil + * Method: getMemObjectDestructorCallback + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_org_lwjgl_opencl_CallbackUtil_getMemObjectDestructorCallback + (JNIEnv *, jclass); + +/* + * Class: org_lwjgl_opencl_CallbackUtil + * Method: getProgramCallback + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_org_lwjgl_opencl_CallbackUtil_getProgramCallback + (JNIEnv *, jclass); + +/* + * Class: org_lwjgl_opencl_CallbackUtil + * Method: getNativeKernelCallback + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_org_lwjgl_opencl_CallbackUtil_getNativeKernelCallback + (JNIEnv *, jclass); + +/* + * Class: org_lwjgl_opencl_CallbackUtil + * Method: getEventCallback + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_org_lwjgl_opencl_CallbackUtil_getEventCallback + (JNIEnv *, jclass); + +/* + * Class: org_lwjgl_opencl_CallbackUtil + * Method: getPrintfCallback + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_org_lwjgl_opencl_CallbackUtil_getPrintfCallback + (JNIEnv *, jclass); + +/* + * Class: org_lwjgl_opencl_CallbackUtil + * Method: getLogMessageToSystemLogAPPLE + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_org_lwjgl_opencl_CallbackUtil_getLogMessageToSystemLogAPPLE + (JNIEnv *, jclass); + +/* + * Class: org_lwjgl_opencl_CallbackUtil + * Method: getLogMessageToStdoutAPPLE + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_org_lwjgl_opencl_CallbackUtil_getLogMessageToStdoutAPPLE + (JNIEnv *, jclass); + +/* + * Class: org_lwjgl_opencl_CallbackUtil + * Method: getLogMessageToStderrAPPLE + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_org_lwjgl_opencl_CallbackUtil_getLogMessageToStderrAPPLE + (JNIEnv *, jclass); + +#ifdef __cplusplus +} +#endif +#endif diff -Nru lwjgl-2.7.1+dfsg/src/native/common/org_lwjgl_opencl_CL.c lwjgl-2.9.3+dfsg/src/native/common/org_lwjgl_opencl_CL.c --- lwjgl-2.7.1+dfsg/src/native/common/org_lwjgl_opencl_CL.c 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/common/org_lwjgl_opencl_CL.c 2016-04-09 16:26:57.000000000 +0000 @@ -42,13 +42,8 @@ extcl_UnloadLibrary(); } -JNIEXPORT jlong JNICALL Java_org_lwjgl_opencl_CL_getFunctionAddress(JNIEnv *env, jclass clazz, jstring function_name) { - jlong address_jlong; - char *function_name_pointer = GetStringNativeChars(env, function_name); - void *address = extcl_GetProcAddress(function_name_pointer); - free(function_name_pointer); - address_jlong = (jlong)(intptr_t)address; - return address_jlong; +JNIEXPORT jlong JNICALL Java_org_lwjgl_opencl_CL_ngetFunctionAddress(JNIEnv *env, jclass clazz, jlong function_name) { + return (jlong)(intptr_t)extcl_GetProcAddress((char *)(intptr_t)function_name); } JNIEXPORT jobject JNICALL Java_org_lwjgl_opencl_CL_getHostBuffer(JNIEnv *env, jclass clazz, jlong address, jint size) { diff -Nru lwjgl-2.7.1+dfsg/src/native/common/org_lwjgl_opencl_CL.h lwjgl-2.9.3+dfsg/src/native/common/org_lwjgl_opencl_CL.h --- lwjgl-2.7.1+dfsg/src/native/common/org_lwjgl_opencl_CL.h 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/common/org_lwjgl_opencl_CL.h 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,61 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_lwjgl_opencl_CL */ + +#ifndef _Included_org_lwjgl_opencl_CL +#define _Included_org_lwjgl_opencl_CL +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: org_lwjgl_opencl_CL + * Method: nCreate + * Signature: (Ljava/lang/String;)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opencl_CL_nCreate + (JNIEnv *, jclass, jstring); + +/* + * Class: org_lwjgl_opencl_CL + * Method: nCreateDefault + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opencl_CL_nCreateDefault + (JNIEnv *, jclass); + +/* + * Class: org_lwjgl_opencl_CL + * Method: nDestroy + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opencl_CL_nDestroy + (JNIEnv *, jclass); + +/* + * Class: org_lwjgl_opencl_CL + * Method: ngetFunctionAddress + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_lwjgl_opencl_CL_ngetFunctionAddress + (JNIEnv *, jclass, jlong); + +/* + * Class: org_lwjgl_opencl_CL + * Method: getHostBuffer + * Signature: (JI)Ljava/nio/ByteBuffer; + */ +JNIEXPORT jobject JNICALL Java_org_lwjgl_opencl_CL_getHostBuffer + (JNIEnv *, jclass, jlong, jint); + +/* + * Class: org_lwjgl_opencl_CL + * Method: resetNativeStubs + * Signature: (Ljava/lang/Class;)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opencl_CL_resetNativeStubs + (JNIEnv *, jclass, jclass); + +#ifdef __cplusplus +} +#endif +#endif diff -Nru lwjgl-2.7.1+dfsg/src/native/common/org_lwjgl_opengl_AWTSurfaceLock.c lwjgl-2.9.3+dfsg/src/native/common/org_lwjgl_opengl_AWTSurfaceLock.c --- lwjgl-2.7.1+dfsg/src/native/common/org_lwjgl_opengl_AWTSurfaceLock.c 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/common/org_lwjgl_opengl_AWTSurfaceLock.c 2016-04-09 16:26:57.000000000 +0000 @@ -31,14 +31,19 @@ */ /** - * $Id: org_lwjgl_opengl_AWTSurfaceLock.c 2985 2008-04-07 18:42:36Z matzon $ + * $Id$ * * @author elias_naur - * @version $Revision: 2985 $ + * @author kappaOne + * @version $Revision$ */ #include +#ifdef __MACH__ +#include +#else #include +#endif #include "org_lwjgl_opengl_AWTSurfaceLock.h" #include "awt_tools.h" #include "common_tools.h" @@ -54,10 +59,22 @@ JAWT_DrawingSurface* ds; JAWT_DrawingSurfaceInfo *dsi; AWTSurfaceLock *awt_lock = (AWTSurfaceLock *)(*env)->GetDirectBufferAddress(env, lock_buffer_handle); - awt.version = JAWT_VERSION_1_4; - if (JAWT_GetAWT(env, &awt) == JNI_FALSE) { - throwException(env, "Could not get the JAWT interface"); - return JNI_FALSE; + + jboolean result = JNI_FALSE; + + #ifdef __MACH__ + // try get JAWT with JAWT_MACOSX_USE_CALAYER Opt In + awt.version = JAWT_VERSION_1_4 | 0x80000000;//JAWT_MACOSX_USE_CALAYER; + result = JAWT_GetAWT(env, &awt); + #endif + + if (result == JNI_FALSE) { + // now try without CALAYER + awt.version = JAWT_VERSION_1_4; + if (JAWT_GetAWT(env, &awt) == JNI_FALSE) { + throwException(env, "Could not get the JAWT interface"); + return JNI_FALSE; + } } ds = awt.GetDrawingSurface(env, canvas); diff -Nru lwjgl-2.7.1+dfsg/src/native/common/org_lwjgl_opengl_AWTSurfaceLock.h lwjgl-2.9.3+dfsg/src/native/common/org_lwjgl_opengl_AWTSurfaceLock.h --- lwjgl-2.7.1+dfsg/src/native/common/org_lwjgl_opengl_AWTSurfaceLock.h 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/common/org_lwjgl_opengl_AWTSurfaceLock.h 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,39 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_lwjgl_opengl_AWTSurfaceLock */ + +#ifndef _Included_org_lwjgl_opengl_AWTSurfaceLock +#define _Included_org_lwjgl_opengl_AWTSurfaceLock +#ifdef __cplusplus +extern "C" { +#endif +#undef org_lwjgl_opengl_AWTSurfaceLock_WAIT_DELAY_MILLIS +#define org_lwjgl_opengl_AWTSurfaceLock_WAIT_DELAY_MILLIS 100L +/* + * Class: org_lwjgl_opengl_AWTSurfaceLock + * Method: createHandle + * Signature: ()Ljava/nio/ByteBuffer; + */ +JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_AWTSurfaceLock_createHandle + (JNIEnv *, jclass); + +/* + * Class: org_lwjgl_opengl_AWTSurfaceLock + * Method: lockAndInitHandle + * Signature: (Ljava/nio/ByteBuffer;Ljava/awt/Canvas;)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_AWTSurfaceLock_lockAndInitHandle + (JNIEnv *, jclass, jobject, jobject); + +/* + * Class: org_lwjgl_opengl_AWTSurfaceLock + * Method: nUnlock + * Signature: (Ljava/nio/ByteBuffer;)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_AWTSurfaceLock_nUnlock + (JNIEnv *, jclass, jobject); + +#ifdef __cplusplus +} +#endif +#endif diff -Nru lwjgl-2.7.1+dfsg/src/native/common/org_lwjgl_opengl_CallbackUtil.c lwjgl-2.9.3+dfsg/src/native/common/org_lwjgl_opengl_CallbackUtil.c --- lwjgl-2.7.1+dfsg/src/native/common/org_lwjgl_opengl_CallbackUtil.c 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/common/org_lwjgl_opengl_CallbackUtil.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,112 +0,0 @@ -/* - * Copyright (c) 2002-2008 LWJGL Project - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of 'LWJGL' nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/** - * JNI implementation of the AMD_debug_output function callback. - * - * @author Spasi - */ - -#include -#include "common_tools.h" -#include "extgl.h" -#include "org_lwjgl_opengl_CallbackUtil.h" - -static jmethodID debugOutputCallbackARBJ; -static jmethodID debugOutputCallbackAMDJ; - -JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_CallbackUtil_ncreateGlobalRef(JNIEnv *env, jclass clazz, jobject obj) { - return (jlong)(*env)->NewGlobalRef(env, obj); -} - -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CallbackUtil_deleteGlobalRef(JNIEnv *env, jclass clazz, jlong globalRef) { - (*env)->DeleteGlobalRef(env, (jobject)globalRef); -} - -// ----------------- [ ARB_debug_output ] ----------------- - -static void APIENTRY debugOutputCallbackARB(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message, GLvoid* userParam) { - JNIEnv *env = attachCurrentThread(); - - if ( env != NULL && !(*env)->ExceptionOccurred(env) && debugOutputCallbackARBJ != NULL ) { - (*env)->CallVoidMethod(env, (jobject)userParam, debugOutputCallbackARBJ, - (jint)source, - (jint)type, - (jint)id, - (jint)severity, - NewStringNativeWithLength(env, message, length) - ); - } - - detachCurrentThread(); -} - -JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_CallbackUtil_getDebugOutputCallbackARB(JNIEnv *env, jclass clazz) { - // Cache the callback methodID - jclass callbackClass; - if ( debugOutputCallbackARBJ == NULL ) { - callbackClass = (*env)->FindClass(env, "org/lwjgl/opengl/ARBDebugOutputCallback$Handler"); - if ( callbackClass != NULL ) - debugOutputCallbackARBJ = (*env)->GetMethodID(env, callbackClass, "handleMessage", "(IIIILjava/lang/String;)V"); - } - - return (jlong)(intptr_t)&debugOutputCallbackARB; -} - -// ----------------- [ AMD_debug_output ] ----------------- - -static void APIENTRY debugOutputCallbackAMD(GLuint id, GLenum category, GLenum severity, GLsizei length, const GLchar* message, GLvoid* userParam) { - JNIEnv *env = attachCurrentThread(); - - if ( env != NULL && !(*env)->ExceptionOccurred(env) && debugOutputCallbackAMDJ != NULL ) { - (*env)->CallVoidMethod(env, (jobject)userParam, debugOutputCallbackAMDJ, - (jint)id, - (jint)category, - (jint)severity, - NewStringNativeWithLength(env, message, length) - ); - } - - detachCurrentThread(); -} - -JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_CallbackUtil_getDebugOutputCallbackAMD(JNIEnv *env, jclass clazz) { - // Cache the callback methodID - jclass callbackClass; - if ( debugOutputCallbackAMDJ == NULL ) { - callbackClass = (*env)->FindClass(env, "org/lwjgl/opengl/AMDDebugOutputCallback$Handler"); - if ( callbackClass != NULL ) - debugOutputCallbackAMDJ = (*env)->GetMethodID(env, callbackClass, "handleMessage", "(IIILjava/lang/String;)V"); - } - - return (jlong)(intptr_t)&debugOutputCallbackAMD; -} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/native/common/org_lwjgl_opengl_GLContext.c lwjgl-2.9.3+dfsg/src/native/common/org_lwjgl_opengl_GLContext.c --- lwjgl-2.7.1+dfsg/src/native/common/org_lwjgl_opengl_GLContext.c 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/common/org_lwjgl_opengl_GLContext.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2002-2008 LWJGL Project - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of 'LWJGL' nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include -#include "common_tools.h" -#include "org_lwjgl_opengl_GLContext.h" -#include "extgl.h" - -JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_GLContext_getFunctionAddress(JNIEnv *env, jclass clazz, jstring function_name) { - jlong address_jlong; - char *function_name_pointer = GetStringNativeChars(env, function_name); - void *address = extgl_GetProcAddress(function_name_pointer); - free(function_name_pointer); - address_jlong = (jlong)(intptr_t)address; - return address_jlong; -} - -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GLContext_nLoadOpenGLLibrary(JNIEnv * env, jclass clazz) { - extgl_Open(env); -} - -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GLContext_nUnloadOpenGLLibrary(JNIEnv * env, jclass clazz) { - extgl_Close(); -} - -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GLContext_resetNativeStubs(JNIEnv *env, jclass clazz, jclass gl_class) { - (*env)->UnregisterNatives(env, gl_class); -} diff -Nru lwjgl-2.7.1+dfsg/src/native/linux/context.c lwjgl-2.9.3+dfsg/src/native/linux/context.c --- lwjgl-2.7.1+dfsg/src/native/linux/context.c 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/linux/context.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,359 +0,0 @@ -/* - * Copyright (c) 2002-2008 LWJGL Project - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of 'LWJGL' nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/** - * $Id: context.c 3357 2010-06-02 23:35:38Z spasi $ - * - * Include file to access public window features - * - * @author elias_naur - * @version $Revision: 3357 $ - */ - -#include -#include -#include -#include -#include "extgl_glx.h" -#include "context.h" - -XVisualInfo *getVisualInfoFromPeerInfo(JNIEnv *env, X11PeerInfo *peer_info) { - XVisualInfo *vis_info; - if (!peer_info->glx13) { - XVisualInfo template; - template.visualid = peer_info->config.glx_config.visualid; - template.depth = peer_info->config.glx_config.depth; - template.screen = peer_info->screen; - int num_infos; - vis_info = XGetVisualInfo(peer_info->display, VisualIDMask | VisualScreenMask | VisualDepthMask, &template, &num_infos); - if (vis_info == NULL) { - throwException(env, "Could not find VisualInfo from peer info"); - return NULL; - } - // Check the assumption from GLX 1.3 docs that a VisualInfo is uniquely identified by its - // {VisualID, screen, depth} tuple - if (num_infos != 1) { - XFree(vis_info); - throwException(env, "No unique VisualInfo matches peer info"); - return NULL; - } - } else { - GLXFBConfig *configs = getFBConfigFromPeerInfo(env, peer_info); - if (configs == NULL) - return NULL; - vis_info = lwjgl_glXGetVisualFromFBConfig(peer_info->display, configs[0]); - if (vis_info == NULL) - throwException(env, "Could not get VisualInfo from GLX 1.3 config"); - XFree(configs); - } - return vis_info; -} - -GLXFBConfig *getFBConfigFromPeerInfo(JNIEnv *env, X11PeerInfo *peer_info) { - int attribs[] = {GLX_FBCONFIG_ID, peer_info->config.glx13_config.config_id, None, None}; - int num_elements; - GLXFBConfig *configs = lwjgl_glXChooseFBConfig(peer_info->display, peer_info->screen, attribs, &num_elements); - if (configs == NULL) { - throwException(env, "Could not find GLX 1.3 config from peer info"); - return NULL; - } - // Check that only one FBConfig matches the config id - if (num_elements != 1) { - XFree(configs); - throwException(env, "No unique GLX 1.3 config matches peer info"); - return NULL; - } - return configs; -} - -static int convertToBPE(int bpp) { - int bpe; - switch (bpp) { - case 0: - bpe = 0; - break; - case 32: - case 24: - bpe = 8; - break; - case 16: /* Fall through */ - default: - bpe = 4; - break; - } - return bpe; -} - -static GLXFBConfig *chooseVisualGLX13FromBPP(JNIEnv *env, Display *disp, int screen, jobject pixel_format, int bpp, int drawable_type, bool double_buffer) { - jclass cls_pixel_format = (*env)->GetObjectClass(env, pixel_format); - int alpha = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "alpha", "I")); - int depth = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "depth", "I")); - int stencil = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "stencil", "I")); - int samples = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "samples", "I")); - int colorSamples = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "colorSamples", "I")); - int num_aux_buffers = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "num_aux_buffers", "I")); - int accum_bpp = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "accum_bpp", "I")); - int accum_alpha = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "accum_alpha", "I")); - - bool stereo = (bool)(*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "stereo", "Z")); - bool floating_point = (bool)(*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "floating_point", "Z")); - bool floating_point_packed = (bool)(*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "floating_point_packed", "Z")); - bool sRGB = (bool)(*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "sRGB", "Z")); - - int bpe = convertToBPE(bpp); - int accum_bpe = convertToBPE(accum_bpp); - attrib_list_t attrib_list; - initAttribList(&attrib_list); - int render_type; - - if ( floating_point ) - render_type = GLX_RGBA_FLOAT_BIT; - else if ( floating_point_packed ) - render_type = GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT; - else - render_type = GLX_RGBA_BIT; - - putAttrib(&attrib_list, GLX_RENDER_TYPE); putAttrib(&attrib_list, render_type); - putAttrib(&attrib_list, GLX_DOUBLEBUFFER); putAttrib(&attrib_list, double_buffer ? True : False); - putAttrib(&attrib_list, GLX_DRAWABLE_TYPE); putAttrib(&attrib_list, drawable_type); - putAttrib(&attrib_list, GLX_DEPTH_SIZE); putAttrib(&attrib_list, depth); - putAttrib(&attrib_list, GLX_RED_SIZE); putAttrib(&attrib_list, bpe); - putAttrib(&attrib_list, GLX_GREEN_SIZE); putAttrib(&attrib_list, bpe); - putAttrib(&attrib_list, GLX_BLUE_SIZE); putAttrib(&attrib_list, bpe); - putAttrib(&attrib_list, GLX_ALPHA_SIZE); putAttrib(&attrib_list, alpha); - putAttrib(&attrib_list, GLX_STENCIL_SIZE); putAttrib(&attrib_list, stencil); - putAttrib(&attrib_list, GLX_AUX_BUFFERS); putAttrib(&attrib_list, num_aux_buffers); - putAttrib(&attrib_list, GLX_ACCUM_RED_SIZE); putAttrib(&attrib_list, accum_bpe); - putAttrib(&attrib_list, GLX_ACCUM_GREEN_SIZE); putAttrib(&attrib_list, accum_bpe); - putAttrib(&attrib_list, GLX_ACCUM_BLUE_SIZE); putAttrib(&attrib_list, accum_bpe); - putAttrib(&attrib_list, GLX_ACCUM_ALPHA_SIZE); putAttrib(&attrib_list, accum_alpha); - if (stereo) { - putAttrib(&attrib_list, GLX_STEREO); putAttrib(&attrib_list, True); - } - // Assume the caller has checked support for multisample - if (samples > 0) { - putAttrib(&attrib_list, GLX_SAMPLE_BUFFERS_ARB); putAttrib(&attrib_list, 1); - putAttrib(&attrib_list, GLX_SAMPLES_ARB); putAttrib(&attrib_list, samples); // GLX_COVERAGE_SAMPLES_NV if colorSamples > 0 - if ( colorSamples > 0 ) { - putAttrib(&attrib_list, GLX_COLOR_SAMPLES_NV); putAttrib(&attrib_list, colorSamples); - } - } - if (sRGB) { - putAttrib(&attrib_list, GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB); putAttrib(&attrib_list, True); - } - putAttrib(&attrib_list, None); putAttrib(&attrib_list, None); - int num_formats = 0; - GLXFBConfig* configs = lwjgl_glXChooseFBConfig(disp, screen, attrib_list.attribs, &num_formats); - if (num_formats > 0) { - return configs; - } else { - if (configs != NULL) - XFree(configs); - return NULL; - } -} - -GLXFBConfig *chooseVisualGLX13(JNIEnv *env, Display *disp, int screen, jobject pixel_format, bool use_display_bpp, int drawable_type, bool double_buffer) { - jclass cls_pixel_format = (*env)->GetObjectClass(env, pixel_format); - int bpp; - if (use_display_bpp) { - bpp = XDefaultDepthOfScreen(XScreenOfDisplay(disp, screen)); - GLXFBConfig *configs = chooseVisualGLX13FromBPP(env, disp, screen, pixel_format, bpp, drawable_type, double_buffer); - if (configs != NULL) - return configs; - else - bpp = 16; - } else - bpp = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "bpp", "I")); - return chooseVisualGLX13FromBPP(env, disp, screen, pixel_format, bpp, drawable_type, double_buffer); -} - -static XVisualInfo *chooseVisualGLXFromBPP(JNIEnv *env, Display *disp, int screen, jobject pixel_format, int bpp, bool double_buffer) { - jclass cls_pixel_format = (*env)->GetObjectClass(env, pixel_format); - int alpha = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "alpha", "I")); - int depth = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "depth", "I")); - int stencil = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "stencil", "I")); - int samples = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "samples", "I")); - int colorSamples = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "colorSamples", "I")); - int num_aux_buffers = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "num_aux_buffers", "I")); - int accum_bpp = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "accum_bpp", "I")); - int accum_alpha = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "accum_alpha", "I")); - - bool stereo = (bool)(*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "stereo", "Z")); - bool sRGB = (bool)(*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "sRGB", "Z")); - - int bpe = convertToBPE(bpp); - int accum_bpe = convertToBPE(accum_bpp); - attrib_list_t attrib_list; - initAttribList(&attrib_list); - putAttrib(&attrib_list, GLX_RGBA); - putAttrib(&attrib_list, GLX_DOUBLEBUFFER); - putAttrib(&attrib_list, GLX_DEPTH_SIZE); putAttrib(&attrib_list, depth); - putAttrib(&attrib_list, GLX_RED_SIZE); putAttrib(&attrib_list, bpe); - putAttrib(&attrib_list, GLX_GREEN_SIZE); putAttrib(&attrib_list, bpe); - putAttrib(&attrib_list, GLX_BLUE_SIZE); putAttrib(&attrib_list, bpe); - putAttrib(&attrib_list, GLX_ALPHA_SIZE); putAttrib(&attrib_list, alpha); - putAttrib(&attrib_list, GLX_STENCIL_SIZE); putAttrib(&attrib_list, stencil); - putAttrib(&attrib_list, GLX_AUX_BUFFERS); putAttrib(&attrib_list, num_aux_buffers); - putAttrib(&attrib_list, GLX_ACCUM_RED_SIZE); putAttrib(&attrib_list, accum_bpe); - putAttrib(&attrib_list, GLX_ACCUM_GREEN_SIZE); putAttrib(&attrib_list, accum_bpe); - putAttrib(&attrib_list, GLX_ACCUM_BLUE_SIZE); putAttrib(&attrib_list, accum_bpe); - putAttrib(&attrib_list, GLX_ACCUM_ALPHA_SIZE); putAttrib(&attrib_list, accum_alpha); - if (stereo) - putAttrib(&attrib_list, GLX_STEREO); - // Assume the caller has checked support for multisample - if (samples > 0) { - putAttrib(&attrib_list, GLX_SAMPLE_BUFFERS_ARB); putAttrib(&attrib_list, 1); - putAttrib(&attrib_list, GLX_SAMPLES_ARB); putAttrib(&attrib_list, samples); // GLX_COVERAGE_SAMPLES_NV if colorSamples > 0 - if ( colorSamples > 0 ) - putAttrib(&attrib_list, GLX_COLOR_SAMPLES_NV); putAttrib(&attrib_list, colorSamples); - } - if (sRGB) - putAttrib(&attrib_list, GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB); - putAttrib(&attrib_list, None); - return lwjgl_glXChooseVisual(disp, screen, attrib_list.attribs); -} - -XVisualInfo *chooseVisualGLX(JNIEnv *env, Display *disp, int screen, jobject pixel_format, bool use_display_bpp, bool double_buffer) { - jclass cls_pixel_format = (*env)->GetObjectClass(env, pixel_format); - int bpp; - if (use_display_bpp) { - bpp = XDefaultDepthOfScreen(XScreenOfDisplay(disp, screen)); - XVisualInfo *vis_info = chooseVisualGLXFromBPP(env, disp, screen, pixel_format, bpp, double_buffer); - if (vis_info != NULL) - return vis_info; - else - bpp = 16; - } else - bpp = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "bpp", "I")); - return chooseVisualGLXFromBPP(env, disp, screen, pixel_format, bpp, double_buffer); -} - -static void dumpVisualInfo(JNIEnv *env, Display *display, GLXExtensions *extension_flags, XVisualInfo *vis_info) { - int alpha, depth, stencil, r, g, b; - int sample_buffers = 0; - int samples = 0; - lwjgl_glXGetConfig(display, vis_info, GLX_RED_SIZE, &r); - lwjgl_glXGetConfig(display, vis_info, GLX_GREEN_SIZE, &g); - lwjgl_glXGetConfig(display, vis_info, GLX_BLUE_SIZE, &b); - lwjgl_glXGetConfig(display, vis_info, GLX_ALPHA_SIZE, &alpha); - lwjgl_glXGetConfig(display, vis_info, GLX_DEPTH_SIZE, &depth); - lwjgl_glXGetConfig(display, vis_info, GLX_STENCIL_SIZE, &stencil); - if (extension_flags->GLX_ARB_multisample) { - lwjgl_glXGetConfig(display, vis_info, GLX_SAMPLE_BUFFERS_ARB, &sample_buffers); - lwjgl_glXGetConfig(display, vis_info, GLX_SAMPLES_ARB, &samples); - } - printfDebugJava(env, "Pixel format info: r = %d, g = %d, b = %d, a = %d, depth = %d, stencil = %d, sample buffers = %d, samples = %d", r, g, b, alpha, depth, stencil, sample_buffers, samples); -} - -bool initPeerInfo(JNIEnv *env, jobject peer_info_handle, Display *display, int screen, jobject pixel_format, bool use_display_bpp, int drawable_type, bool double_buffered, bool force_glx13) { - if ((*env)->GetDirectBufferCapacity(env, peer_info_handle) < sizeof(X11PeerInfo)) { - throwException(env, "Handle too small"); - return false; - } - X11PeerInfo *peer_info = (*env)->GetDirectBufferAddress(env, peer_info_handle); - GLXExtensions extension_flags; - if (!extgl_InitGLX(display, screen, &extension_flags)) { - throwException(env, "Could not init GLX"); - return false; - } - if (!extension_flags.GLX13 && force_glx13) { - throwException(env, "GLX13 is required, but is not available"); - return false; - } - jclass cls_pixel_format = (*env)->GetObjectClass(env, pixel_format); - int samples = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "samples", "I")); - if (samples > 0 && !extension_flags.GLX_ARB_multisample) { - throwException(env, "Samples > 0 specified but there's no support for GLX_ARB_multisample"); - return false; - } - int colorSamples = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "colorSamples", "I")); - if (colorSamples > 0 && !extension_flags.GLX_NV_multisample_coverage) { - throwException(env, "Color samples > 0 specified but there's no support for GLX_NV_multisample_coverage"); - return false; - } - bool floating_point = (bool)(*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "floating_point", "Z")); - if (floating_point && !(extension_flags.GLX13 && extension_flags.GLX_ARB_fbconfig_float)) { // We need GLX13 to support floating point - throwException(env, "Floating point specified but there's no support for GLX_ARB_fbconfig_float"); - return false; - } - bool floating_point_packed = (bool)(*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "floating_point_packed", "Z")); - if (floating_point_packed && !(extension_flags.GLX13 && extension_flags.GLX_EXT_fbconfig_packed_float)) { // We need GLX13 to support packed floating point - throwException(env, "Packed floating point specified but there's no support for GLX_EXT_fbconfig_packed_float"); - return false; - } - bool sRGB = (bool)(*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "sRGB", "Z")); - if (sRGB && !extension_flags.GLX_ARB_framebuffer_sRGB) { - throwException(env, "sRGB specified but there's no support for GLX_ARB_framebuffer_sRGB"); - return false; - } - - peer_info->glx13 = extension_flags.GLX13; - if (peer_info->glx13) { - GLXFBConfig *configs = chooseVisualGLX13(env, display, screen, pixel_format, use_display_bpp, drawable_type, double_buffered); - if (configs == NULL) { - throwException(env, "Could not choose GLX13 config"); - return false; - } - if (isDebugEnabled()) { - XVisualInfo *vis_info = lwjgl_glXGetVisualFromFBConfig(display, configs[0]); - if (vis_info != NULL) { - dumpVisualInfo(env, display, &extension_flags, vis_info); - XFree(vis_info); - } - } - int config_id; - int result = lwjgl_glXGetFBConfigAttrib(display, configs[0], GLX_FBCONFIG_ID, &config_id); - XFree(configs); - if (result != Success) { - throwException(env, "Could not get GLX_FBCONFIG_ID from GLXFBConfig"); - return false; - } - peer_info->config.glx13_config.config_id = config_id; - } else { - XVisualInfo *vis_info = chooseVisualGLX(env, display, screen, pixel_format, use_display_bpp, double_buffered); - if (vis_info == NULL) { - throwException(env, "Could not choose visual"); - return false; - } - peer_info->config.glx_config.visualid = vis_info->visualid; - peer_info->config.glx_config.depth = vis_info->depth; - peer_info->screen = vis_info->screen; - if (isDebugEnabled()) - dumpVisualInfo(env, display, &extension_flags, vis_info); - XFree(vis_info); - } - peer_info->display = display; - peer_info->screen = screen; - peer_info->drawable = None; - return true; -} diff -Nru lwjgl-2.7.1+dfsg/src/native/linux/context.h lwjgl-2.9.3+dfsg/src/native/linux/context.h --- lwjgl-2.7.1+dfsg/src/native/linux/context.h 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/linux/context.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2002-2008 LWJGL Project - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of 'LWJGL' nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/** - * $Id: context.h 2985 2008-04-07 18:42:36Z matzon $ - * - * Include file to access public window features - * - * @author elias_naur - * @version $Revision: 2985 $ - */ - -#ifndef _LWJGL_CONTEXT_H_INCLUDED_ -#define _LWJGL_CONTEXT_H_INCLUDED_ - -#include -#include -#include -#include -#include "extgl_glx.h" - -typedef struct { - VisualID visualid; - int depth; -} GLXConfig; - -typedef struct { - GLXFBConfigID config_id; -} GLX13Config; - -typedef struct { - Display *display; - int screen; - GLXDrawable drawable; - // This flag determines the appropriate glx struct - bool glx13; - union { - GLXConfig glx_config; - GLX13Config glx13_config; - } config; -} X11PeerInfo; - -/* GLX 1.3 chooser */ -extern GLXFBConfig *chooseVisualGLX13(JNIEnv *env, Display *disp, int screen, jobject pixel_format, bool use_display_bpp, int drawable_type, bool double_buffer); - -/* Default GLX chooser*/ -extern XVisualInfo *chooseVisualGLX(JNIEnv *env, Display *disp, int screen, jobject pixel_format, bool use_display_bpp, bool double_buffer); - -extern XVisualInfo *getVisualInfoFromPeerInfo(JNIEnv *env, X11PeerInfo *peer_info); -extern GLXFBConfig *getFBConfigFromPeerInfo(JNIEnv *env, X11PeerInfo *peer_info); - -extern bool initPeerInfo(JNIEnv *env, jobject peer_info_handle, Display *display, int screen, jobject pixel_format, bool use_display_bpp, int drawable_type, bool double_buffered, bool force_glx13); - -#endif /* _LWJGL_CONTEXT_H_INCLUDED_ */ diff -Nru lwjgl-2.7.1+dfsg/src/native/linux/display.c lwjgl-2.9.3+dfsg/src/native/linux/display.c --- lwjgl-2.7.1+dfsg/src/native/linux/display.c 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/linux/display.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,411 +0,0 @@ -/* - * Copyright (c) 2002-2008 LWJGL Project - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of 'LWJGL' nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/** - * $Id: display.c 2985 2008-04-07 18:42:36Z matzon $ - * - * Linux specific library for display handling. - * - * @author elias_naur - * @version $Revision: 2985 $ - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "common_tools.h" -#include "org_lwjgl_opengl_LinuxDisplay.h" - -#define NUM_XRANDR_RETRIES 5 - -typedef struct { - int width; - int height; - int freq; - union { - int size_index; // Data for Xrandr extension - XF86VidModeModeInfo xf86vm_modeinfo; // Data for XF86VidMode extension - } mode_data; -} mode_info; - -static bool getXF86VidModeVersion(JNIEnv *env, Display *disp, int *major, int *minor) { - int event_base, error_base; - - if (!XF86VidModeQueryExtension(disp, &event_base, &error_base)) { - printfDebugJava(env, "XF86VidMode extension not available"); - return false; - } - if (!XF86VidModeQueryVersion(disp, major, minor)) { - throwException(env, "Could not query XF86VidMode version"); - return false; - } - printfDebugJava(env, "XF86VidMode extension version %i.%i", *major, *minor); - return true; -} - -static bool getXrandrVersion(JNIEnv *env, Display *disp, int *major, int *minor) { - int event_base, error_base; - - if (!XRRQueryExtension(disp, &event_base, &error_base)) { - printfDebugJava(env, "Xrandr extension not available"); - return false; - } - if (!XRRQueryVersion(disp, major, minor)) { - throwException(env, "Could not query Xrandr version"); - return false; - } - printfDebugJava(env, "Xrandr extension version %i.%i", *major, *minor); - return true; -} - -static bool isXrandrSupported(JNIEnv *env, Display *disp) { - int major, minor; - if (!getXrandrVersion(env, disp, &major, &minor)) - return false; - return major >= 1; -} - -static bool isXF86VidModeSupported(JNIEnv *env, Display *disp) { - int minor_ver, major_ver; - if (!getXF86VidModeVersion(env, disp, &major_ver, &minor_ver)) - return false; - return major_ver >= 2; -} - -JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nIsXrandrSupported(JNIEnv *env, jclass unused, jlong display) { - Display *disp = (Display *)(intptr_t)display; - jboolean result = isXrandrSupported(env, disp) ? JNI_TRUE : JNI_FALSE; - return result; -} - -JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nIsXF86VidModeSupported(JNIEnv *env, jclass unused, jlong display) { - Display *disp = (Display *)(intptr_t)display; - jboolean result = isXF86VidModeSupported(env, disp) ? JNI_TRUE : JNI_FALSE; - return result; -} - -static mode_info *getXrandrDisplayModes(Display *disp, int screen, int *num_modes) { - int num_randr_sizes; - XRRScreenSize *sizes = XRRSizes(disp, screen, &num_randr_sizes); - mode_info *avail_modes = NULL; - int list_size = 0; - /* Count number of modes */ - int i; - int mode_index = 0; - for (i = 0; i < num_randr_sizes; i++) { - int num_randr_rates; - short *freqs = XRRRates(disp, screen, i, &num_randr_rates); - int j; - for (j = 0; j < num_randr_rates; j++) { - if (list_size <= mode_index) { - list_size += 1; - avail_modes = (mode_info *)realloc(avail_modes, sizeof(mode_info)*list_size); - if (avail_modes == NULL) - return NULL; - } - avail_modes[mode_index].width = sizes[i].width; - avail_modes[mode_index].height = sizes[i].height; - avail_modes[mode_index].freq = freqs[j]; - avail_modes[mode_index].mode_data.size_index = i; - mode_index++; - } - } - *num_modes = mode_index; - return avail_modes; -} - -static mode_info *getXF86VidModeDisplayModes(Display *disp, int screen, int *num_modes) { - int num_xf86vm_modes; - XF86VidModeModeInfo **avail_xf86vm_modes; - XF86VidModeGetAllModeLines(disp, screen, &num_xf86vm_modes, &avail_xf86vm_modes); - mode_info *avail_modes = (mode_info *)malloc(sizeof(mode_info)*num_xf86vm_modes); - if (avail_modes == NULL) { - XFree(avail_xf86vm_modes); - return NULL; - } - int i; - for (i = 0; i < num_xf86vm_modes; i++) { - avail_modes[i].width = avail_xf86vm_modes[i]->hdisplay; - avail_modes[i].height = avail_xf86vm_modes[i]->vdisplay; - avail_modes[i].freq = 0; // No frequency support in XF86VidMode - avail_modes[i].mode_data.xf86vm_modeinfo = *avail_xf86vm_modes[i]; - } - XFree(avail_xf86vm_modes); - *num_modes = num_xf86vm_modes; - return avail_modes; -} - -static mode_info *getDisplayModes(Display *disp, int screen, jint extension, int *num_modes) { - switch (extension) { - case org_lwjgl_opengl_LinuxDisplay_XF86VIDMODE: - return getXF86VidModeDisplayModes(disp, screen, num_modes); - case org_lwjgl_opengl_LinuxDisplay_XRANDR: - return getXrandrDisplayModes(disp, screen, num_modes); - case org_lwjgl_opengl_LinuxDisplay_NONE: - // fall through - default: - return NULL; - } -} - -static bool setXF86VidModeMode(Display *disp, int screen, mode_info *mode) { - return True == XF86VidModeSwitchToMode(disp, screen, &mode->mode_data.xf86vm_modeinfo); -} - -/* Try to set the mode specified through XRandR. - * Return value is the Status code of the mode switch - * The timestamp parameter is filled with the latest timestamp returned from XRRConfigTimes - */ -static Status trySetXrandrMode(Display *disp, int screen, mode_info *mode, Time *timestamp) { - Status status; - Drawable root_window = RootWindow(disp, screen); - XRRScreenConfiguration *screen_configuration = XRRGetScreenInfo(disp, root_window); - Time config_time; - *timestamp = XRRConfigTimes(screen_configuration, &config_time); - Rotation current_rotation; - XRRConfigCurrentConfiguration(screen_configuration, ¤t_rotation); - status = XRRSetScreenConfigAndRate(disp, screen_configuration, root_window, mode->mode_data.size_index, current_rotation, mode->freq, *timestamp); - XRRFreeScreenConfigInfo(screen_configuration); - return status; -} - -static bool setXrandrMode(Display *disp, int screen, mode_info *mode) { - int iteration; - Time timestamp; - Status status = trySetXrandrMode(disp, screen, mode, ×tamp); - if (status == 0) - return true; // Success - Time new_timestamp; - for (iteration = 0; iteration < NUM_XRANDR_RETRIES; iteration++) { - status = trySetXrandrMode(disp, screen, mode, &new_timestamp); - if (status == 0) - return true; // Success - if (new_timestamp == timestamp) { - return false; // Failure, and the stamps are equal meaning that the failure is not merely transient - } - timestamp = new_timestamp; - } - return false; -} - -static bool setMode(JNIEnv *env, Display *disp, int screen, jint extension, int width, int height, int freq) { - int num_modes, i; - mode_info *avail_modes = getDisplayModes(disp, screen, extension, &num_modes); - if (avail_modes == NULL) { - printfDebugJava(env, "Could not get display modes"); - return false; - } - bool result = false; - for (i = 0; i < num_modes; ++i) { - printfDebugJava(env, "Mode %d: %dx%d @%d", i, avail_modes[i].width, avail_modes[i].height, avail_modes[i].freq); - if (avail_modes[i].width == width && avail_modes[i].height == height && avail_modes[i].freq == freq) { - switch (extension) { - case org_lwjgl_opengl_LinuxDisplay_XF86VIDMODE: - if (!setXF86VidModeMode(disp, screen, &avail_modes[i])) { - printfDebugJava(env, "Could not switch mode"); - continue; - } - break; - case org_lwjgl_opengl_LinuxDisplay_XRANDR: - if (!setXrandrMode(disp, screen, &avail_modes[i])) { - printfDebugJava(env, "Could not switch mode"); - continue; - } - break; - case org_lwjgl_opengl_LinuxDisplay_NONE: // Should never happen, since NONE imply no available display modes - default: // Should never happen - continue; - } - result = true; - break; - } - } - free(avail_modes); - XFlush(disp); - return result; -} - -static int getGammaRampLengthOfDisplay(JNIEnv *env, Display *disp, int screen) { - int ramp_size; - if (XF86VidModeGetGammaRampSize(disp, screen, &ramp_size) == False) { - throwException(env, "XF86VidModeGetGammaRampSize call failed"); - return 0; - } - return ramp_size; -} - -JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nConvertToNativeRamp(JNIEnv *env, jclass unused, jobject ramp_buffer, jint buffer_offset, jint length) { - const jfloat *ramp_ptr = (const jfloat *)(*env)->GetDirectBufferAddress(env, ramp_buffer) + buffer_offset; - jobject native_ramp = newJavaManagedByteBuffer(env, length*3*sizeof(unsigned short)); - if (native_ramp == NULL) { - throwException(env, "Failed to allocate gamma ramp buffer"); - return NULL; - } - unsigned short *native_ramp_ptr = (unsigned short *)(*env)->GetDirectBufferAddress(env, native_ramp); - int i; - for (i = 0; i < length; i++) { - float scaled_gamma = ramp_ptr[i]*0xffff; - short scaled_gamma_short = (unsigned short)roundf(scaled_gamma); - native_ramp_ptr[i] = scaled_gamma_short; - native_ramp_ptr[i + length] = scaled_gamma_short; - native_ramp_ptr[i + length*2] = scaled_gamma_short; - } - return native_ramp; -} - -JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetCurrentGammaRamp(JNIEnv *env, jclass unused, jlong display, jint screen) { - Display *disp = (Display *)(intptr_t)display; - int ramp_size = getGammaRampLengthOfDisplay(env, disp, screen); - jobject ramp_buffer = newJavaManagedByteBuffer(env, sizeof(unsigned short)*3*ramp_size); - if (ramp_buffer == NULL) { - throwException(env, "Could not allocate gamma ramp buffer"); - return NULL; - } - unsigned short *ramp = (unsigned short *)(*env)->GetDirectBufferAddress(env, ramp_buffer); - if (!XF86VidModeGetGammaRamp(disp, screen, ramp_size, ramp, - ramp + ramp_size, ramp + ramp_size*2)) { - throwException(env, "Could not get the current gamma ramp"); - return NULL; - } - return ramp_buffer; -} - -static void setGamma(JNIEnv *env, Display *disp, int screen, jobject ramp_buffer) { - if (ramp_buffer == NULL) - return; - unsigned short *ramp_ptr = (unsigned short *)(*env)->GetDirectBufferAddress(env, ramp_buffer); - jlong capacity = (*env)->GetDirectBufferCapacity(env, ramp_buffer); - int size = capacity/(sizeof(unsigned short)*3); - if (size == 0) - return; - if (XF86VidModeSetGammaRamp(disp, screen, size, ramp_ptr, ramp_ptr + size, ramp_ptr + size*2) == False) { - throwException(env, "Could not set gamma ramp."); - } -} - -static bool switchDisplayMode(JNIEnv * env, Display *disp, int screen, jint extension, jobject mode) { - if (mode == NULL) { - throwException(env, "mode must be non-null"); - return false; - } - jclass cls_displayMode = (*env)->GetObjectClass(env, mode); - jfieldID fid_width = (*env)->GetFieldID(env, cls_displayMode, "width", "I"); - jfieldID fid_height = (*env)->GetFieldID(env, cls_displayMode, "height", "I"); - jfieldID fid_freq = (*env)->GetFieldID(env, cls_displayMode, "freq", "I"); - int width = (*env)->GetIntField(env, mode, fid_width); - int height = (*env)->GetIntField(env, mode, fid_height); - int freq = (*env)->GetIntField(env, mode, fid_freq); - if (!setMode(env, disp, screen, extension, width, height, freq)) { - throwException(env, "Could not switch mode."); - return false; - } - return true; -} - -static jobjectArray getAvailableDisplayModes(JNIEnv * env, Display *disp, int screen, jint extension) { - int num_modes, i; - mode_info *avail_modes; - int bpp = XDefaultDepth(disp, screen); - avail_modes = getDisplayModes(disp, screen, extension, &num_modes); - if (avail_modes == NULL) { - printfDebugJava(env, "Could not get display modes"); - return NULL; - } - // Allocate an array of DisplayModes big enough - jclass displayModeClass = (*env)->FindClass(env, "org/lwjgl/opengl/DisplayMode"); - jobjectArray ret = (*env)->NewObjectArray(env, num_modes, displayModeClass, NULL); - jmethodID displayModeConstructor = (*env)->GetMethodID(env, displayModeClass, "", "(IIII)V"); - - for (i = 0; i < num_modes; i++) { - jobject displayMode = (*env)->NewObject(env, displayModeClass, displayModeConstructor, avail_modes[i].width, avail_modes[i].height, bpp, avail_modes[i].freq); - (*env)->SetObjectArrayElement(env, ret, i, displayMode); - } - free(avail_modes); - return ret; -} - -static jobject getCurrentXRandrMode(JNIEnv * env, Display *disp, int screen) { - Drawable root_window = RootWindow(disp, screen); - XRRScreenConfiguration *config = XRRGetScreenInfo(disp, root_window); - if (config == NULL) { - throwException(env, "Could not get current screen configuration."); - return NULL; - } - short rate = XRRConfigCurrentRate(config); - Rotation current_rotation; - SizeID size_index = XRRConfigCurrentConfiguration(config, ¤t_rotation); - int n_sizes; - XRRScreenSize *sizes = XRRConfigSizes(config, &n_sizes); - if (size_index >= n_sizes) { - throwFormattedException(env, "Xrandr current index (%d) is larger than or equals to the number of sizes (%d).", size_index, n_sizes); - XRRFreeScreenConfigInfo(config); - return NULL; - } - XRRScreenSize current_size = sizes[size_index]; - XRRFreeScreenConfigInfo(config); - int bpp = XDefaultDepth(disp, screen); - jclass displayModeClass = (*env)->FindClass(env, "org/lwjgl/opengl/DisplayMode"); - jmethodID displayModeConstructor = (*env)->GetMethodID(env, displayModeClass, "", "(IIII)V"); - jobject displayMode = (*env)->NewObject(env, displayModeClass, displayModeConstructor, current_size.width, current_size.height, bpp, rate); - return displayMode; -} - -JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetCurrentXRandrMode(JNIEnv *env, jclass unused, jlong display, jint screen) { - Display *disp = (Display *)(intptr_t)display; - return getCurrentXRandrMode(env, disp, screen); -} - -JNIEXPORT jobjectArray JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetAvailableDisplayModes(JNIEnv *env, jclass clazz, jlong display, jint screen, jint extension) { - Display *disp = (Display *)(intptr_t)display; - return getAvailableDisplayModes(env, disp, screen, extension); -} - -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nSwitchDisplayMode(JNIEnv *env, jclass clazz, jlong display, jint screen, jint extension, jobject mode) { - Display *disp = (Display *)(intptr_t)display; - switchDisplayMode(env, disp, screen, extension, mode); -} - -JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetGammaRampLength(JNIEnv *env, jclass clazz, jlong display_ptr, jint screen) { - Display *disp = (Display *)(intptr_t)display_ptr; - return (jint)getGammaRampLengthOfDisplay(env, disp, screen); -} - -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nSetGammaRamp(JNIEnv *env, jclass clazz, jlong display, jint screen, jobject gamma_buffer) { - Display *disp = (Display *)(intptr_t)display; - setGamma(env, disp, screen, gamma_buffer); -} - diff -Nru lwjgl-2.7.1+dfsg/src/native/linux/extgl_glx.c lwjgl-2.9.3+dfsg/src/native/linux/extgl_glx.c --- lwjgl-2.7.1+dfsg/src/native/linux/extgl_glx.c 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/linux/extgl_glx.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,232 +0,0 @@ -/* - * Copyright (c) 2002-2008 LWJGL Project - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of 'LWJGL' nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include -#include "extgl_glx.h" - -glXGetFBConfigsPROC lwjgl_glXGetFBConfigs = NULL; -glXChooseFBConfigPROC lwjgl_glXChooseFBConfig = NULL; -glXGetFBConfigAttribPROC lwjgl_glXGetFBConfigAttrib = NULL; -glXGetVisualFromFBConfigPROC lwjgl_glXGetVisualFromFBConfig = NULL; -glXCreateWindowPROC lwjgl_glXCreateWindow = NULL; -glXDestroyWindowPROC lwjgl_glXDestroyWindow = NULL; -glXCreatePixmapPROC lwjgl_glXCreatePixmap = NULL; -glXDestroyPixmapPROC lwjgl_glXDestroyPixmap = NULL; -glXCreatePbufferPROC lwjgl_glXCreatePbuffer = NULL; -glXDestroyPbufferPROC lwjgl_glXDestroyPbuffer = NULL; -glXQueryDrawablePROC lwjgl_glXQueryDrawable = NULL; -glXCreateNewContextPROC lwjgl_glXCreateNewContext = NULL; -glXMakeContextCurrentPROC lwjgl_glXMakeContextCurrent = NULL; -glXGetCurrentReadDrawablePROC lwjgl_glXGetCurrentReadDrawable = NULL; -glXGetCurrentDisplayPROC lwjgl_glXGetCurrentDisplay = NULL; -glXQueryContextPROC lwjgl_glXQueryContext = NULL; -glXSelectEventPROC lwjgl_glXSelectEvent = NULL; -glXGetSelectedEventPROC lwjgl_glXGetSelectedEvent = NULL; -glXChooseVisualPROC lwjgl_glXChooseVisual = NULL; -glXCopyContextPROC lwjgl_glXCopyContext = NULL; -glXCreateContextPROC lwjgl_glXCreateContext = NULL; -glXCreateGLXPixmapPROC lwjgl_glXCreateGLXPixmap = NULL; -glXDestroyContextPROC lwjgl_glXDestroyContext = NULL; -glXDestroyGLXPixmapPROC lwjgl_glXDestroyGLXPixmap = NULL; -glXGetConfigPROC lwjgl_glXGetConfig = NULL; -glXGetCurrentContextPROC lwjgl_glXGetCurrentContext = NULL; -glXGetCurrentDrawablePROC lwjgl_glXGetCurrentDrawable = NULL; -glXIsDirectPROC lwjgl_glXIsDirect = NULL; -glXMakeCurrentPROC lwjgl_glXMakeCurrent = NULL; -glXQueryExtensionPROC lwjgl_glXQueryExtension = NULL; -glXQueryVersionPROC lwjgl_glXQueryVersion = NULL; -glXSwapBuffersPROC lwjgl_glXSwapBuffers = NULL; -glXUseXFontPROC lwjgl_glXUseXFont = NULL; -glXWaitGLPROC lwjgl_glXWaitGL = NULL; -glXWaitXPROC lwjgl_glXWaitX = NULL; -glXGetClientStringPROC lwjgl_glXGetClientString = NULL; -glXQueryServerStringPROC lwjgl_glXQueryServerString = NULL; -glXQueryExtensionsStringPROC lwjgl_glXQueryExtensionsString = NULL; - -/* GLX_SGI_swap_control */ -glXSwapIntervalSGIPROC lwjgl_glXSwapIntervalSGI = NULL; - -/* GLX_ARB_create_context */ -glXCreateContextAttribsARBPROC lwjgl_glXCreateContextAttribsARB = NULL; - -static void * lib_gl_handle = NULL; - -typedef void * (APIENTRY * glXGetProcAddressARBPROC) (const GLubyte *procName); - -static glXGetProcAddressARBPROC lwjgl_glXGetProcAddressARB; - -static GLXExtensions symbols_flags; - -/** returns true if the extention is available */ -static bool GLXQueryExtension(Display *disp, int screen, const char *name) { - const GLubyte *exts = (const GLubyte *)lwjgl_glXQueryExtensionsString(disp, screen); - return extgl_QueryExtension(exts, name); -} - -static void extgl_InitGLX13() { - ExtFunction functions[] = { - {"glXGetFBConfigs", (void*)&lwjgl_glXGetFBConfigs}, - {"glXChooseFBConfig", (void*)&lwjgl_glXChooseFBConfig}, - {"glXGetFBConfigAttrib", (void*)&lwjgl_glXGetFBConfigAttrib}, - {"glXGetVisualFromFBConfig", (void*)&lwjgl_glXGetVisualFromFBConfig}, - {"glXCreateWindow", (void*)&lwjgl_glXCreateWindow}, - {"glXDestroyWindow", (void*)&lwjgl_glXDestroyWindow}, - {"glXCreatePixmap", (void*)&lwjgl_glXCreatePixmap}, - {"glXDestroyPixmap", (void*)&lwjgl_glXDestroyPixmap}, - {"glXCreatePbuffer", (void*)&lwjgl_glXCreatePbuffer}, - {"glXDestroyPbuffer", (void*)&lwjgl_glXDestroyPbuffer}, - {"glXQueryDrawable", (void*)&lwjgl_glXQueryDrawable}, - {"glXCreateNewContext", (void*)&lwjgl_glXCreateNewContext}, - {"glXMakeContextCurrent", (void*)&lwjgl_glXMakeContextCurrent}, - {"glXGetCurrentReadDrawable", (void*)&lwjgl_glXGetCurrentReadDrawable}, - {"glXGetCurrentDisplay", (void*)&lwjgl_glXGetCurrentDisplay}, - {"glXQueryContext", (void*)&lwjgl_glXQueryContext}, - {"glXSelectEvent", (void*)&lwjgl_glXSelectEvent}, - {"glXGetSelectedEvent", (void*)&lwjgl_glXGetSelectedEvent}}; - symbols_flags.GLX13 = extgl_InitializeFunctions(sizeof(functions)/sizeof(ExtFunction), functions); -} - -static void extgl_InitGLX12(void) { - ExtFunction functions[] = { - {"glXChooseVisual", (void*)&lwjgl_glXChooseVisual}, - {"glXCopyContext", (void*)&lwjgl_glXCopyContext}, - {"glXCreateContext", (void*)&lwjgl_glXCreateContext}, - {"glXCreateGLXPixmap", (void*)&lwjgl_glXCreateGLXPixmap}, - {"glXDestroyContext", (void*)&lwjgl_glXDestroyContext}, - {"glXDestroyGLXPixmap", (void*)&lwjgl_glXDestroyGLXPixmap}, - {"glXGetConfig", (void*)&lwjgl_glXGetConfig}, - {"glXGetCurrentContext", (void*)&lwjgl_glXGetCurrentContext}, - {"glXGetCurrentDrawable", (void*)&lwjgl_glXGetCurrentDrawable}, - {"glXIsDirect", (void*)&lwjgl_glXIsDirect}, - {"glXMakeCurrent", (void*)&lwjgl_glXMakeCurrent}, - {"glXQueryExtension", (void*)&lwjgl_glXQueryExtension}, - {"glXQueryVersion", (void*)&lwjgl_glXQueryVersion}, - {"glXSwapBuffers", (void*)&lwjgl_glXSwapBuffers}, - {"glXUseXFont", (void*)&lwjgl_glXUseXFont}, - {"glXWaitGL", (void*)&lwjgl_glXWaitGL}, - {"glXWaitX", (void*)&lwjgl_glXWaitX}, - {"glXGetClientString", (void*)&lwjgl_glXGetClientString}, - {"glXQueryServerString", (void*)&lwjgl_glXQueryServerString}, - {"glXQueryExtensionsString", (void*)&lwjgl_glXQueryExtensionsString}}; - symbols_flags.GLX12 = extgl_InitializeFunctions(sizeof(functions)/sizeof(ExtFunction), functions); -} - -static void extgl_InitGLXSGISwapControl() { - ExtFunction functions[] = { - {"glXSwapIntervalSGI", (void*)&lwjgl_glXSwapIntervalSGI}}; - symbols_flags.GLX_SGI_swap_control = extgl_InitializeFunctions(sizeof(functions)/sizeof(ExtFunction), functions); -} - -static void extgl_InitGLXARBCreateContext() { - ExtFunction functions[] = { - {"glXCreateContextAttribsARB", (void*)&lwjgl_glXCreateContextAttribsARB}}; - symbols_flags.GLX_ARB_create_context = extgl_InitializeFunctions(sizeof(functions)/sizeof(ExtFunction), functions); -} - -static void extgl_InitGLXSupportedExtensions(Display *disp, int screen, GLXExtensions *extension_flags) { -/* extension_flags.GLX_EXT_visual_info = GLXQueryExtension(disp, screen, "GLX_EXT_visual_info"); - extension_flags.GLX_EXT_visual_rating = GLXQueryExtension(disp, screen, "GLX_EXT_visual_rating");*/ - extension_flags->GLX_SGI_swap_control = symbols_flags.GLX_SGI_swap_control && GLXQueryExtension(disp, screen, "GLX_SGI_swap_control"); - extension_flags->GLX_ARB_multisample = GLXQueryExtension(disp, screen, "GLX_ARB_multisample"); - extension_flags->GLX_ARB_fbconfig_float = GLXQueryExtension(disp, screen, "GLX_ARB_fbconfig_float"); - extension_flags->GLX_EXT_fbconfig_packed_float = GLXQueryExtension(disp, screen, "GLX_EXT_fbconfig_packed_float"); - extension_flags->GLX_ARB_framebuffer_sRGB = GLXQueryExtension(disp, screen, "GLX_ARB_framebuffer_sRGB") || GLXQueryExtension(disp, screen, "GLX_EXT_framebuffer_sRGB"); - extension_flags->GLX_ARB_create_context = GLXQueryExtension(disp, screen, "GLX_ARB_create_context"); - extension_flags->GLX_NV_multisample_coverage = GLXQueryExtension(disp, screen, "GLX_NV_multisample_coverage"); -} - -bool extgl_Open(JNIEnv *env) { - if (lib_gl_handle != NULL) - return true; - /* - * Actually we don't need the RTLD_GLOBAL flag, since the symbols - * we load should be private to us. However, according to the - * documentation at - * - * http://dri.sourceforge.net/doc/DRIuserguide.html - * - * DRI drivers need this flag to work properly - */ - lib_gl_handle = dlopen("libGL.so.1", RTLD_LAZY | RTLD_GLOBAL); - if (lib_gl_handle == NULL) { - throwFormattedException(env, "Error loading libGL.so.1: %s", dlerror()); - return false; - } - lwjgl_glXGetProcAddressARB = (glXGetProcAddressARBPROC)dlsym(lib_gl_handle, "glXGetProcAddressARB"); - if (lwjgl_glXGetProcAddressARB == NULL) { - extgl_Close(); - throwException(env, "Could not get address of glXGetProcAddressARB"); - return false; - } - /* Unlike Windows, GLX function addresses are context-independent - * so we only have to initialize the addresses once at load - */ - extgl_InitGLX12(); - extgl_InitGLX13(); - extgl_InitGLXSGISwapControl(); - extgl_InitGLXARBCreateContext(); - return true; -} - -void *extgl_GetProcAddress(const char *name) { - void *t = (void*)lwjgl_glXGetProcAddressARB((const GLubyte*)name); - if (t == NULL) { - t = dlsym(lib_gl_handle, name); - if (t == NULL) { - printfDebug("Could not locate symbol %s\n", name); - } - } - return t; -} - -void extgl_Close(void) { - dlclose(lib_gl_handle); - lib_gl_handle = NULL; -} - -bool extgl_InitGLX(Display *disp, int screen, GLXExtensions *extension_flags) { - int major, minor; - /* Assume glx ver >= 1.2 */ - // Check GLX 1.2 symbols available - if (!symbols_flags.GLX12) - return false; - if (lwjgl_glXQueryVersion(disp, &major, &minor) != True) - return false; - bool glx12 = major > 1 || (major == 1 && minor >= 2); - // Check GLX 1.2 version - if (!glx12) - return false; - extension_flags->GLX12 = glx12; - extension_flags->GLX13 = major > 1 || (major == 1 && minor >= 3); - extension_flags->GLX14 = major > 1 || (major == 1 && minor >= 4); - extgl_InitGLXSupportedExtensions(disp, screen, extension_flags); - return true; -} diff -Nru lwjgl-2.7.1+dfsg/src/native/linux/extgl_glx.h lwjgl-2.9.3+dfsg/src/native/linux/extgl_glx.h --- lwjgl-2.7.1+dfsg/src/native/linux/extgl_glx.h 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/linux/extgl_glx.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,404 +0,0 @@ -/* - * Copyright (c) 2002-2008 LWJGL Project - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of 'LWJGL' nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef EXTGL_GLX_H -#define EXTGL_GLX_H - -#include -#include "extgl.h" - -/* - * Names for attributes to lwjgl_glXGetConfig. - */ -#define GLX_USE_GL 1 /* support GLX rendering */ -#define GLX_BUFFER_SIZE 2 /* depth of the color buffer */ -#define GLX_LEVEL 3 /* level in plane stacking */ -#define GLX_RGBA 4 /* true if RGBA mode */ -#define GLX_DOUBLEBUFFER 5 /* double buffering supported */ -#define GLX_STEREO 6 /* stereo buffering supported */ -#define GLX_AUX_BUFFERS 7 /* number of aux buffers */ -#define GLX_RED_SIZE 8 /* number of red component bits */ -#define GLX_GREEN_SIZE 9 /* number of green component bits */ -#define GLX_BLUE_SIZE 10 /* number of blue component bits */ -#define GLX_ALPHA_SIZE 11 /* number of alpha component bits */ -#define GLX_DEPTH_SIZE 12 /* number of depth bits */ -#define GLX_STENCIL_SIZE 13 /* number of stencil bits */ -#define GLX_ACCUM_RED_SIZE 14 /* number of red accum bits */ -#define GLX_ACCUM_GREEN_SIZE 15 /* number of green accum bits */ -#define GLX_ACCUM_BLUE_SIZE 16 /* number of blue accum bits */ -#define GLX_ACCUM_ALPHA_SIZE 17 /* number of alpha accum bits */ - -#define GLX_SAMPLE_BUFFERS_ARB 100000 /* number of multisample buffers */ -#define GLX_SAMPLES_ARB 100001 /* number of multisample samples */ - -/* - * FBConfig-specific attributes - */ -#define GLX_X_VISUAL_TYPE 0x22 -#define GLX_CONFIG_CAVEAT 0x20 /* Like visual_info VISUAL_CAVEAT */ -#define GLX_TRANSPARENT_TYPE 0x23 -#define GLX_TRANSPARENT_INDEX_VALUE 0x24 -#define GLX_TRANSPARENT_RED_VALUE 0x25 -#define GLX_TRANSPARENT_GREEN_VALUE 0x26 -#define GLX_TRANSPARENT_BLUE_VALUE 0x27 -#define GLX_TRANSPARENT_ALPHA_VALUE 0x28 -#define GLX_DRAWABLE_TYPE 0x8010 -#define GLX_RENDER_TYPE 0x8011 -#define GLX_X_RENDERABLE 0x8012 -#define GLX_FBCONFIG_ID 0x8013 -#define GLX_MAX_PBUFFER_WIDTH 0x8016 -#define GLX_MAX_PBUFFER_HEIGHT 0x8017 -#define GLX_MAX_PBUFFER_PIXELS 0x8018 -#define GLX_VISUAL_ID 0x800B - -#define GLX_DRAWABLE_TYPE_SGIX GLX_DRAWABLE_TYPE -#define GLX_RENDER_TYPE_SGIX GLX_RENDER_TYPE -#define GLX_X_RENDERABLE_SGIX GLX_X_RENDERABLE -#define GLX_FBCONFIG_ID_SGIX GLX_FBCONFIG_ID -#define GLX_MAX_PBUFFER_WIDTH_SGIX GLX_MAX_PBUFFER_WIDTH -#define GLX_MAX_PBUFFER_HEIGHT_SGIX GLX_MAX_PBUFFER_HEIGHT -#define GLX_MAX_PBUFFER_PIXELS_SGIX GLX_MAX_PBUFFER_PIXELS -#define GLX_OPTIMAL_PBUFFER_WIDTH_SGIX 0x8019 -#define GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX 0x801A - -/* - * Error return values from lwjgl_glXGetConfig. Success is indicated by - * a value of 0. - */ -#define GLX_BAD_SCREEN 1 /* screen # is bad */ -#define GLX_BAD_ATTRIBUTE 2 /* attribute to get is bad */ -#define GLX_NO_EXTENSION 3 /* no glx extension on server */ -#define GLX_BAD_VISUAL 4 /* visual # not known by GLX */ -#define GLX_BAD_CONTEXT 5 -#define GLX_BAD_VALUE 6 -#define GLX_BAD_ENUM 7 - - -/* FBConfig attribute values */ - -/* - * Generic "don't care" value for lwjgl_glX ChooseFBConfig attributes (except - * GLX_LEVEL). - */ -#define GLX_DONT_CARE 0xFFFFFFFF - -/* GLX_RENDER_TYPE bits */ -#define GLX_RGBA_BIT 0x00000001 -#define GLX_COLOR_INDEX_BIT 0x00000002 -#define GLX_RGBA_BIT_SGIX GLX_RGBA_BIT -#define GLX_COLOR_INDEX_BIT_SGIX GLX_COLOR_INDEX_BIT - -/* GLX_DRAWABLE_TYPE bits */ -#define GLX_WINDOW_BIT 0x00000001 -#define GLX_PIXMAP_BIT 0x00000002 -#define GLX_PBUFFER_BIT 0x00000004 -#define GLX_WINDOW_BIT_SGIX GLX_WINDOW_BIT -#define GLX_PIXMAP_BIT_SGIX GLX_PIXMAP_BIT -#define GLX_PBUFFER_BIT_SGIX GLX_PBUFFER_BIT - -/* GLX_CONFIG_CAVEAT attribute values */ -#define GLX_NONE 0x8000 -#define GLX_SLOW_CONFIG 0x8001 -#define GLX_NON_CONFORMANT_CONFIG 0x800D - -/* GLX_X_VISUAL_TYPE attribute values */ -#define GLX_TRUE_COLOR 0x8002 -#define GLX_DIRECT_COLOR 0x8003 -#define GLX_PSEUDO_COLOR 0x8004 -#define GLX_STATIC_COLOR 0x8005 -#define GLX_GRAY_SCALE 0x8006 -#define GLX_STATIC_GRAY 0x8007 - -/* GLX_TRANSPARENT_TYPE attribute values */ -/* #define GLX_NONE 0x8000 */ -#define GLX_TRANSPARENT_RGB 0x8008 -#define GLX_TRANSPARENT_INDEX 0x8009 - -/* lwjgl_glXCreateGLXPbuffer attributes */ -#define GLX_PRESERVED_CONTENTS 0x801B -#define GLX_LARGEST_PBUFFER 0x801C -#define GLX_PBUFFER_HEIGHT 0x8040 /* New for GLX 1.3 */ -#define GLX_PBUFFER_WIDTH 0x8041 /* New for GLX 1.3 */ -#define GLX_PRESERVED_CONTENTS_SGIX GLX_PRESERVED_CONTENTS -#define GLX_LARGEST_PBUFFER_SGIX GLX_LARGEST_PBUFFER - -/* lwjgl_glXQueryGLXPBuffer attributes */ -#define GLX_WIDTH 0x801D -#define GLX_HEIGHT 0x801E -#define GLX_EVENT_MASK 0x801F -#define GLX_WIDTH_SGIX GLX_WIDTH -#define GLX_HEIGHT_SGIX GLX_HEIGHT -#define GLX_EVENT_MASK_SGIX GLX_EVENT_MASK - -/* lwjgl_glXCreateNewContext render_type attribute values */ -#define GLX_RGBA_TYPE 0x8014 -#define GLX_COLOR_INDEX_TYPE 0x8015 -#define GLX_RGBA_TYPE_SGIX GLX_RGBA_TYPE -#define GLX_COLOR_INDEX_TYPE_SGIX GLX_COLOR_INDEX_TYPE - -/* lwjgl_glXQueryContext attributes */ -/* #define GLX_FBCONFIG_ID 0x8013 */ -/* #define GLX_RENDER_TYPE 0x8011 */ -#define GLX_SCREEN 0x800C - -/* lwjgl_glXSelectEvent event mask bits */ -#define GLX_PBUFFER_CLOBBER_MASK 0x08000000 -#define GLX_PBUFFER_CLOBBER_MASK_SGIX GLX_PBUFFER_CLOBBER_MASK - -/* GLXPbufferClobberEvent event_type values */ -#define GLX_DAMAGED 0x8020 -#define GLX_SAVED 0x8021 -#define GLX_DAMAGED_SGIX GLX_DAMAGED -#define GLX_SAVED_SGIX GLX_SAVED - -/* GLXPbufferClobberEvent draw_type values */ -#define GLX_WINDOW 0x8022 -#define GLX_PBUFFER 0x8023 -#define GLX_WINDOW_SGIX GLX_WINDOW -#define GLX_PBUFFER_SGIX GLX_PBUFFER - -/* GLXPbufferClobberEvent buffer_mask bits */ -#define GLX_FRONT_LEFT_BUFFER_BIT 0x00000001 -#define GLX_FRONT_RIGHT_BUFFER_BIT 0x00000002 -#define GLX_BACK_LEFT_BUFFER_BIT 0x00000004 -#define GLX_BACK_RIGHT_BUFFER_BIT 0x00000008 -#define GLX_AUX_BUFFERS_BIT 0x00000010 -#define GLX_DEPTH_BUFFER_BIT 0x00000020 -#define GLX_STENCIL_BUFFER_BIT 0x00000040 -#define GLX_ACCUM_BUFFER_BIT 0x00000080 -#define GLX_FRONT_LEFT_BUFFER_BIT_SGIX GLX_FRONT_LEFT_BUFFER_BIT -#define GLX_FRONT_RIGHT_BUFFER_BIT_SGIX GLX_FRONT_RIGHT_BUFFER_BIT -#define GLX_BACK_LEFT_BUFFER_BIT_SGIX GLX_BACK_LEFT_BUFFER_BIT -#define GLX_BACK_RIGHT_BUFFER_BIT_SGIX GLX_BACK_RIGHT_BUFFER_BIT -#define GLX_AUX_BUFFERS_BIT_SGIX GLX_AUX_BUFFERS_BIT -#define GLX_DEPTH_BUFFER_BIT_SGIX GLX_DEPTH_BUFFER_BIT -#define GLX_STENCIL_BUFFER_BIT_SGIX GLX_STENCIL_BUFFER_BIT -#define GLX_ACCUM_BUFFER_BIT_SGIX GLX_ACCUM_BUFFER_BIT - -/* - * Extension return values from lwjgl_glXGetConfig. These are also - * accepted as parameter values for lwjgl_glXChooseVisual. - */ - -#define GLX_X_VISUAL_TYPE_EXT 0x22 /* visual_info extension type */ -#define GLX_TRANSPARENT_TYPE_EXT 0x23 /* visual_info extension */ -#define GLX_TRANSPARENT_INDEX_VALUE_EXT 0x24 /* visual_info extension */ -#define GLX_TRANSPARENT_RED_VALUE_EXT 0x25 /* visual_info extension */ -#define GLX_TRANSPARENT_GREEN_VALUE_EXT 0x26 /* visual_info extension */ -#define GLX_TRANSPARENT_BLUE_VALUE_EXT 0x27 /* visual_info extension */ -#define GLX_TRANSPARENT_ALPHA_VALUE_EXT 0x28 /* visual_info extension */ - -/* Property values for visual_type */ -#define GLX_TRUE_COLOR_EXT 0x8002 -#define GLX_DIRECT_COLOR_EXT 0x8003 -#define GLX_PSEUDO_COLOR_EXT 0x8004 -#define GLX_STATIC_COLOR_EXT 0x8005 -#define GLX_GRAY_SCALE_EXT 0x8006 -#define GLX_STATIC_GRAY_EXT 0x8007 - -/* Property values for transparent pixel */ -#define GLX_NONE_EXT 0x8000 -#define GLX_TRANSPARENT_RGB_EXT 0x8008 -#define GLX_TRANSPARENT_INDEX_EXT 0x8009 - -/* Property values for visual_rating */ -#define GLX_VISUAL_CAVEAT_EXT 0x20 /* visual_rating extension type */ -#define GLX_SLOW_VISUAL_EXT 0x8001 -#define GLX_NON_CONFORMANT_VISUAL_EXT 0x800D - -/* - * Names for attributes to lwjgl_glXGetClientString. - */ -#define GLX_VENDOR 0x1 -#define GLX_VERSION 0x2 -#define GLX_EXTENSIONS 0x3 - -/* - * Names for attributes to lwjgl_glXQueryContextInfoEXT. - */ -#define GLX_SHARE_CONTEXT_EXT 0x800A /* id of share context */ -#define GLX_VISUAL_ID_EXT 0x800B /* id of context's visual */ -#define GLX_SCREEN_EXT 0x800C /* screen number */ - -/* NV_float_buffer */ -#define GLX_FLOAT_COMPONENTS_NV 0x20B0 - -/* GLX_ARB_fbconfig_float */ -#define GLX_RGBA_FLOAT_TYPE 0x20B9 -#define GLX_RGBA_FLOAT_BIT 0x0004 - -/* GLX_ARB_fbconfig_float */ -#define GLX_RGBA_UNSIGNED_FLOAT_TYPE_EXT 0x20B1 -#define GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT 0x00000008 - -/* GLX_ARB_framebuffer_sRGB */ -#define GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB 0x20B2 - -/* GLX_ARB_create_context */ -#define GLX_CONTEXT_MAJOR_VERSION_ARB 0x2091 -#define GLX_CONTEXT_MINOR_VERSION_ARB 0x2092 -#define GLX_CONTEXT_FLAGS_ARB 0x2094 - -#define GLX_CONTEXT_DEBUG_BIT_ARB 0x0001 -#define GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x0002 - -/* GLX_NV_multisample_coverage */ -#define GLX_COVERAGE_SAMPLES_NV 100001 -#define GLX_COLOR_SAMPLES_NV 0x20B3 - - -typedef XID GLXContextID; -typedef XID GLXPixmap; -typedef XID GLXDrawable; -typedef XID GLXPbuffer; -typedef XID GLXWindow; -typedef XID GLXFBConfigID; - -typedef struct __GLXcontextRec *GLXContext; - -typedef struct __GLXFBConfigRec *GLXFBConfig; - -typedef GLXFBConfig * (APIENTRY * glXGetFBConfigsPROC) (Display *dpy, int screen, int *nelements); -typedef GLXFBConfig * (APIENTRY * glXChooseFBConfigPROC) (Display *dpy, int screen, const int *attrib_list, int *nelements); -typedef int (APIENTRY * glXGetFBConfigAttribPROC) (Display *dpy, GLXFBConfig config, int attribute, int *value); -typedef XVisualInfo * (APIENTRY * glXGetVisualFromFBConfigPROC) (Display *dpy, GLXFBConfig config); -typedef GLXWindow (APIENTRY * glXCreateWindowPROC) (Display *dpy, GLXFBConfig config, Window win, const int *attrib_list); -typedef void (APIENTRY * glXDestroyWindowPROC) (Display *dpy, GLXWindow win); -typedef GLXPixmap (APIENTRY * glXCreatePixmapPROC) (Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attrib_list); -typedef void (APIENTRY * glXDestroyPixmapPROC) (Display *dpy, GLXPixmap pixmap); -typedef GLXPbuffer (APIENTRY * glXCreatePbufferPROC) (Display *dpy, GLXFBConfig config, const int *attrib_list); -typedef void (APIENTRY * glXDestroyPbufferPROC) (Display *dpy, GLXPbuffer pbuf); -typedef void (APIENTRY * glXQueryDrawablePROC) (Display *dpy, GLXDrawable draw, int attribute, unsigned int *value); -typedef GLXContext (APIENTRY * glXCreateNewContextPROC) (Display *dpy, GLXFBConfig config, int render_type, GLXContext share_list, Bool direct); -typedef Bool (APIENTRY * glXMakeContextCurrentPROC) (Display *display, GLXDrawable draw, GLXDrawable read, GLXContext ctx); -typedef GLXDrawable (APIENTRY * glXGetCurrentReadDrawablePROC) (void); -typedef Display * (APIENTRY * glXGetCurrentDisplayPROC) (void); -typedef int (APIENTRY * glXQueryContextPROC) (Display *dpy, GLXContext ctx, int attribute, int *value); -typedef void (APIENTRY * glXSelectEventPROC) (Display *dpy, GLXDrawable draw, unsigned long event_mask); -typedef void (APIENTRY * glXGetSelectedEventPROC) (Display *dpy, GLXDrawable draw, unsigned long *event_mask); - -typedef GLXContextID (APIENTRY * glXGetContextIDEXTPROC) (const GLXContext ctx); -typedef GLXDrawable (APIENTRY * glXGetCurrentDrawableEXTPROC) (void); -typedef GLXContext (APIENTRY * glXImportContextEXTPROC) (Display *dpy, GLXContextID contextID); -typedef void (APIENTRY * glXFreeContextEXTPROC) (Display *dpy, GLXContext ctx); -typedef int (APIENTRY * glXQueryContextInfoEXTPROC) (Display *dpy, GLXContext ctx, int attribute, int *value); - -typedef XVisualInfo* (APIENTRY * glXChooseVisualPROC) (Display *dpy, int screen, int *attribList); -typedef void (APIENTRY * glXCopyContextPROC) (Display *dpy, GLXContext src, GLXContext dst, unsigned long mask); -typedef GLXContext (APIENTRY * glXCreateContextPROC) (Display *dpy, XVisualInfo *vis, GLXContext shareList, Bool direct); -typedef GLXPixmap (APIENTRY * glXCreateGLXPixmapPROC) (Display *dpy, XVisualInfo *vis, Pixmap pixmap); -typedef void (APIENTRY * glXDestroyContextPROC) (Display *dpy, GLXContext ctx); -typedef void (APIENTRY * glXDestroyGLXPixmapPROC) (Display *dpy, GLXPixmap pix); -typedef int (APIENTRY * glXGetConfigPROC) (Display *dpy, XVisualInfo *vis, int attrib, int *value); -typedef GLXContext (APIENTRY * glXGetCurrentContextPROC) (void); -typedef GLXDrawable (APIENTRY * glXGetCurrentDrawablePROC) (void); -typedef Bool (APIENTRY * glXIsDirectPROC) (Display *dpy, GLXContext ctx); -typedef Bool (APIENTRY * glXMakeCurrentPROC) (Display *dpy, GLXDrawable drawable, GLXContext ctx); -typedef Bool (APIENTRY * glXQueryExtensionPROC) (Display *dpy, int *errorBase, int *eventBase); -typedef Bool (APIENTRY * glXQueryVersionPROC) (Display *dpy, int *major, int *minor); -typedef void (APIENTRY * glXSwapBuffersPROC) (Display *dpy, GLXDrawable drawable); -typedef void (APIENTRY * glXUseXFontPROC) (Font font, int first, int count, int listBase); -typedef void (APIENTRY * glXWaitGLPROC) (void); -typedef void (APIENTRY * glXWaitXPROC) (void); -typedef const char * (APIENTRY * glXGetClientStringPROC) (Display *dpy, int name ); -typedef const char * (APIENTRY * glXQueryServerStringPROC) (Display *dpy, int screen, int name ); -typedef const char * (APIENTRY * glXQueryExtensionsStringPROC) (Display *dpy, int screen ); - -/* GLX_SGI_swap_control */ -typedef void (APIENTRY * glXSwapIntervalSGIPROC)(int interval); - -/* GLX_ARB_create_context */ -typedef GLXContext (APIENTRY * glXCreateContextAttribsARBPROC) (Display *dpy, GLXFBConfig config, GLXContext share_context, Bool direct, const int *attrib_list); - -typedef struct { - bool GLX12; - bool GLX13; - bool GLX14; -/* bool GLX_EXT_visual_info; - bool GLX_EXT_visual_rating;*/ - bool GLX_SGI_swap_control; - bool GLX_ARB_multisample; - bool GLX_ARB_fbconfig_float; - bool GLX_EXT_fbconfig_packed_float; - bool GLX_ARB_framebuffer_sRGB; - bool GLX_ARB_create_context; - bool GLX_NV_multisample_coverage; -} GLXExtensions; - -/* Add _ to global symbols to avoid symbol clash with the OpenGL library */ -extern glXGetFBConfigsPROC lwjgl_glXGetFBConfigs; -extern glXChooseFBConfigPROC lwjgl_glXChooseFBConfig; -extern glXGetFBConfigAttribPROC lwjgl_glXGetFBConfigAttrib; -extern glXGetVisualFromFBConfigPROC lwjgl_glXGetVisualFromFBConfig; -extern glXCreateWindowPROC lwjgl_glXCreateWindow; -extern glXDestroyWindowPROC lwjgl_glXDestroyWindow; -extern glXCreatePixmapPROC lwjgl_glXCreatePixmap; -extern glXDestroyPixmapPROC lwjgl_glXDestroyPixmap; -extern glXCreatePbufferPROC lwjgl_glXCreatePbuffer; -extern glXDestroyPbufferPROC lwjgl_glXDestroyPbuffer; -extern glXQueryDrawablePROC lwjgl_glXQueryDrawable; -extern glXCreateNewContextPROC lwjgl_glXCreateNewContext; -extern glXMakeContextCurrentPROC lwjgl_glXMakeContextCurrent; -extern glXGetCurrentReadDrawablePROC lwjgl_glXGetCurrentReadDrawable; -extern glXGetCurrentDisplayPROC lwjgl_glXGetCurrentDisplay; -extern glXQueryContextPROC lwjgl_glXQueryContext; -extern glXSelectEventPROC lwjgl_glXSelectEvent; -extern glXGetSelectedEventPROC lwjgl_glXGetSelectedEvent; - -extern glXChooseVisualPROC lwjgl_glXChooseVisual; -extern glXCopyContextPROC lwjgl_glXCopyContext; -extern glXCreateContextPROC lwjgl_glXCreateContext; -extern glXCreateGLXPixmapPROC lwjgl_glXCreateGLXPixmap; -extern glXDestroyContextPROC lwjgl_glXDestroyContext; -extern glXDestroyGLXPixmapPROC lwjgl_glXDestroyGLXPixmap; -extern glXGetConfigPROC lwjgl_glXGetConfig; -extern glXGetCurrentContextPROC lwjgl_glXGetCurrentContext; -extern glXGetCurrentDrawablePROC lwjgl_glXGetCurrentDrawable; -extern glXIsDirectPROC lwjgl_glXIsDirect; -extern glXMakeCurrentPROC lwjgl_glXMakeCurrent; -extern glXQueryExtensionPROC lwjgl_glXQueryExtension; -extern glXQueryVersionPROC lwjgl_glXQueryVersion; -extern glXSwapBuffersPROC lwjgl_glXSwapBuffers; -extern glXUseXFontPROC lwjgl_glXUseXFont; -extern glXWaitGLPROC lwjgl_glXWaitGL; -extern glXWaitXPROC lwjgl_glXWaitX; -extern glXGetClientStringPROC lwjgl_glXGetClientString; -extern glXQueryServerStringPROC lwjgl_glXQueryServerString; -extern glXQueryExtensionsStringPROC lwjgl_glXQueryExtensionsString; - -extern glXSwapIntervalSGIPROC lwjgl_glXSwapIntervalSGI; - -extern glXCreateContextAttribsARBPROC lwjgl_glXCreateContextAttribsARB; - -extern bool extgl_InitGLX(Display *disp, int screen, GLXExtensions *extension_flags); - -#endif diff -Nru lwjgl-2.7.1+dfsg/src/native/linux/opengl/context.c lwjgl-2.9.3+dfsg/src/native/linux/opengl/context.c --- lwjgl-2.7.1+dfsg/src/native/linux/opengl/context.c 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/linux/opengl/context.c 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,359 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * $Id$ + * + * Include file to access public window features + * + * @author elias_naur + * @version $Revision$ + */ + +#include +#include +#include +#include +#include "extgl_glx.h" +#include "context.h" + +XVisualInfo *getVisualInfoFromPeerInfo(JNIEnv *env, X11PeerInfo *peer_info) { + XVisualInfo *vis_info; + if (!peer_info->glx13) { + XVisualInfo template; + template.visualid = peer_info->config.glx_config.visualid; + template.depth = peer_info->config.glx_config.depth; + template.screen = peer_info->screen; + int num_infos; + vis_info = XGetVisualInfo(peer_info->display, VisualIDMask | VisualScreenMask | VisualDepthMask, &template, &num_infos); + if (vis_info == NULL) { + throwException(env, "Could not find VisualInfo from peer info"); + return NULL; + } + // Check the assumption from GLX 1.3 docs that a VisualInfo is uniquely identified by its + // {VisualID, screen, depth} tuple + if (num_infos != 1) { + XFree(vis_info); + throwException(env, "No unique VisualInfo matches peer info"); + return NULL; + } + } else { + GLXFBConfig *configs = getFBConfigFromPeerInfo(env, peer_info); + if (configs == NULL) + return NULL; + vis_info = lwjgl_glXGetVisualFromFBConfig(peer_info->display, configs[0]); + if (vis_info == NULL) + throwException(env, "Could not get VisualInfo from GLX 1.3 config"); + XFree(configs); + } + return vis_info; +} + +GLXFBConfig *getFBConfigFromPeerInfo(JNIEnv *env, X11PeerInfo *peer_info) { + int attribs[] = {GLX_FBCONFIG_ID, peer_info->config.glx13_config.config_id, None, None}; + int num_elements; + GLXFBConfig *configs = lwjgl_glXChooseFBConfig(peer_info->display, peer_info->screen, attribs, &num_elements); + if (configs == NULL) { + throwException(env, "Could not find GLX 1.3 config from peer info"); + return NULL; + } + // Check that only one FBConfig matches the config id + if (num_elements != 1) { + XFree(configs); + throwException(env, "No unique GLX 1.3 config matches peer info"); + return NULL; + } + return configs; +} + +static int convertToBPE(int bpp) { + int bpe; + switch (bpp) { + case 0: + bpe = 0; + break; + case 32: + case 24: + bpe = 8; + break; + case 16: /* Fall through */ + default: + bpe = 4; + break; + } + return bpe; +} + +static GLXFBConfig *chooseVisualGLX13FromBPP(JNIEnv *env, Display *disp, int screen, jobject pixel_format, int bpp, int drawable_type, bool double_buffer) { + jclass cls_pixel_format = (*env)->GetObjectClass(env, pixel_format); + int alpha = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "alpha", "I")); + int depth = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "depth", "I")); + int stencil = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "stencil", "I")); + int samples = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "samples", "I")); + int colorSamples = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "colorSamples", "I")); + int num_aux_buffers = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "num_aux_buffers", "I")); + int accum_bpp = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "accum_bpp", "I")); + int accum_alpha = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "accum_alpha", "I")); + + bool stereo = (bool)(*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "stereo", "Z")); + bool floating_point = (bool)(*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "floating_point", "Z")); + bool floating_point_packed = (bool)(*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "floating_point_packed", "Z")); + bool sRGB = (bool)(*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "sRGB", "Z")); + + int bpe = convertToBPE(bpp); + int accum_bpe = convertToBPE(accum_bpp); + attrib_list_t attrib_list; + initAttribList(&attrib_list); + int render_type; + + if ( floating_point ) + render_type = GLX_RGBA_FLOAT_BIT; + else if ( floating_point_packed ) + render_type = GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT; + else + render_type = GLX_RGBA_BIT; + + putAttrib(&attrib_list, GLX_RENDER_TYPE); putAttrib(&attrib_list, render_type); + putAttrib(&attrib_list, GLX_DOUBLEBUFFER); putAttrib(&attrib_list, double_buffer ? True : False); + putAttrib(&attrib_list, GLX_DRAWABLE_TYPE); putAttrib(&attrib_list, drawable_type); + putAttrib(&attrib_list, GLX_DEPTH_SIZE); putAttrib(&attrib_list, depth); + putAttrib(&attrib_list, GLX_RED_SIZE); putAttrib(&attrib_list, bpe); + putAttrib(&attrib_list, GLX_GREEN_SIZE); putAttrib(&attrib_list, bpe); + putAttrib(&attrib_list, GLX_BLUE_SIZE); putAttrib(&attrib_list, bpe); + putAttrib(&attrib_list, GLX_ALPHA_SIZE); putAttrib(&attrib_list, alpha); + putAttrib(&attrib_list, GLX_STENCIL_SIZE); putAttrib(&attrib_list, stencil); + putAttrib(&attrib_list, GLX_AUX_BUFFERS); putAttrib(&attrib_list, num_aux_buffers); + putAttrib(&attrib_list, GLX_ACCUM_RED_SIZE); putAttrib(&attrib_list, accum_bpe); + putAttrib(&attrib_list, GLX_ACCUM_GREEN_SIZE); putAttrib(&attrib_list, accum_bpe); + putAttrib(&attrib_list, GLX_ACCUM_BLUE_SIZE); putAttrib(&attrib_list, accum_bpe); + putAttrib(&attrib_list, GLX_ACCUM_ALPHA_SIZE); putAttrib(&attrib_list, accum_alpha); + if (stereo) { + putAttrib(&attrib_list, GLX_STEREO); putAttrib(&attrib_list, True); + } + // Assume the caller has checked support for multisample + if (samples > 0) { + putAttrib(&attrib_list, GLX_SAMPLE_BUFFERS_ARB); putAttrib(&attrib_list, 1); + putAttrib(&attrib_list, GLX_SAMPLES_ARB); putAttrib(&attrib_list, samples); // GLX_COVERAGE_SAMPLES_NV if colorSamples > 0 + if ( colorSamples > 0 ) { + putAttrib(&attrib_list, GLX_COLOR_SAMPLES_NV); putAttrib(&attrib_list, colorSamples); + } + } + if (sRGB) { + putAttrib(&attrib_list, GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB); putAttrib(&attrib_list, True); + } + putAttrib(&attrib_list, None); putAttrib(&attrib_list, None); + int num_formats = 0; + GLXFBConfig* configs = lwjgl_glXChooseFBConfig(disp, screen, attrib_list.attribs, &num_formats); + if (num_formats > 0) { + return configs; + } else { + if (configs != NULL) + XFree(configs); + return NULL; + } +} + +GLXFBConfig *chooseVisualGLX13(JNIEnv *env, Display *disp, int screen, jobject pixel_format, bool use_display_bpp, int drawable_type, bool double_buffer) { + jclass cls_pixel_format = (*env)->GetObjectClass(env, pixel_format); + int bpp; + if (use_display_bpp) { + bpp = XDefaultDepthOfScreen(XScreenOfDisplay(disp, screen)); + GLXFBConfig *configs = chooseVisualGLX13FromBPP(env, disp, screen, pixel_format, bpp, drawable_type, double_buffer); + if (configs != NULL) + return configs; + else + bpp = 16; + } else + bpp = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "bpp", "I")); + return chooseVisualGLX13FromBPP(env, disp, screen, pixel_format, bpp, drawable_type, double_buffer); +} + +static XVisualInfo *chooseVisualGLXFromBPP(JNIEnv *env, Display *disp, int screen, jobject pixel_format, int bpp, bool double_buffer) { + jclass cls_pixel_format = (*env)->GetObjectClass(env, pixel_format); + int alpha = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "alpha", "I")); + int depth = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "depth", "I")); + int stencil = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "stencil", "I")); + int samples = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "samples", "I")); + int colorSamples = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "colorSamples", "I")); + int num_aux_buffers = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "num_aux_buffers", "I")); + int accum_bpp = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "accum_bpp", "I")); + int accum_alpha = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "accum_alpha", "I")); + + bool stereo = (bool)(*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "stereo", "Z")); + bool sRGB = (bool)(*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "sRGB", "Z")); + + int bpe = convertToBPE(bpp); + int accum_bpe = convertToBPE(accum_bpp); + attrib_list_t attrib_list; + initAttribList(&attrib_list); + putAttrib(&attrib_list, GLX_RGBA); + putAttrib(&attrib_list, GLX_DOUBLEBUFFER); + putAttrib(&attrib_list, GLX_DEPTH_SIZE); putAttrib(&attrib_list, depth); + putAttrib(&attrib_list, GLX_RED_SIZE); putAttrib(&attrib_list, bpe); + putAttrib(&attrib_list, GLX_GREEN_SIZE); putAttrib(&attrib_list, bpe); + putAttrib(&attrib_list, GLX_BLUE_SIZE); putAttrib(&attrib_list, bpe); + putAttrib(&attrib_list, GLX_ALPHA_SIZE); putAttrib(&attrib_list, alpha); + putAttrib(&attrib_list, GLX_STENCIL_SIZE); putAttrib(&attrib_list, stencil); + putAttrib(&attrib_list, GLX_AUX_BUFFERS); putAttrib(&attrib_list, num_aux_buffers); + putAttrib(&attrib_list, GLX_ACCUM_RED_SIZE); putAttrib(&attrib_list, accum_bpe); + putAttrib(&attrib_list, GLX_ACCUM_GREEN_SIZE); putAttrib(&attrib_list, accum_bpe); + putAttrib(&attrib_list, GLX_ACCUM_BLUE_SIZE); putAttrib(&attrib_list, accum_bpe); + putAttrib(&attrib_list, GLX_ACCUM_ALPHA_SIZE); putAttrib(&attrib_list, accum_alpha); + if (stereo) + putAttrib(&attrib_list, GLX_STEREO); + // Assume the caller has checked support for multisample + if (samples > 0) { + putAttrib(&attrib_list, GLX_SAMPLE_BUFFERS_ARB); putAttrib(&attrib_list, 1); + putAttrib(&attrib_list, GLX_SAMPLES_ARB); putAttrib(&attrib_list, samples); // GLX_COVERAGE_SAMPLES_NV if colorSamples > 0 + if ( colorSamples > 0 ) + putAttrib(&attrib_list, GLX_COLOR_SAMPLES_NV); putAttrib(&attrib_list, colorSamples); + } + if (sRGB) + putAttrib(&attrib_list, GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB); + putAttrib(&attrib_list, None); + return lwjgl_glXChooseVisual(disp, screen, attrib_list.attribs); +} + +XVisualInfo *chooseVisualGLX(JNIEnv *env, Display *disp, int screen, jobject pixel_format, bool use_display_bpp, bool double_buffer) { + jclass cls_pixel_format = (*env)->GetObjectClass(env, pixel_format); + int bpp; + if (use_display_bpp) { + bpp = XDefaultDepthOfScreen(XScreenOfDisplay(disp, screen)); + XVisualInfo *vis_info = chooseVisualGLXFromBPP(env, disp, screen, pixel_format, bpp, double_buffer); + if (vis_info != NULL) + return vis_info; + else + bpp = 16; + } else + bpp = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "bpp", "I")); + return chooseVisualGLXFromBPP(env, disp, screen, pixel_format, bpp, double_buffer); +} + +static void dumpVisualInfo(JNIEnv *env, Display *display, GLXExtensions *extension_flags, XVisualInfo *vis_info) { + int alpha, depth, stencil, r, g, b; + int sample_buffers = 0; + int samples = 0; + lwjgl_glXGetConfig(display, vis_info, GLX_RED_SIZE, &r); + lwjgl_glXGetConfig(display, vis_info, GLX_GREEN_SIZE, &g); + lwjgl_glXGetConfig(display, vis_info, GLX_BLUE_SIZE, &b); + lwjgl_glXGetConfig(display, vis_info, GLX_ALPHA_SIZE, &alpha); + lwjgl_glXGetConfig(display, vis_info, GLX_DEPTH_SIZE, &depth); + lwjgl_glXGetConfig(display, vis_info, GLX_STENCIL_SIZE, &stencil); + if (extension_flags->GLX_ARB_multisample) { + lwjgl_glXGetConfig(display, vis_info, GLX_SAMPLE_BUFFERS_ARB, &sample_buffers); + lwjgl_glXGetConfig(display, vis_info, GLX_SAMPLES_ARB, &samples); + } + printfDebugJava(env, "Pixel format info: r = %d, g = %d, b = %d, a = %d, depth = %d, stencil = %d, sample buffers = %d, samples = %d", r, g, b, alpha, depth, stencil, sample_buffers, samples); +} + +bool initPeerInfo(JNIEnv *env, jobject peer_info_handle, Display *display, int screen, jobject pixel_format, bool use_display_bpp, int drawable_type, bool double_buffered, bool force_glx13) { + if ((*env)->GetDirectBufferCapacity(env, peer_info_handle) < sizeof(X11PeerInfo)) { + throwException(env, "Handle too small"); + return false; + } + X11PeerInfo *peer_info = (*env)->GetDirectBufferAddress(env, peer_info_handle); + GLXExtensions extension_flags; + if (!extgl_InitGLX(display, screen, &extension_flags)) { + throwException(env, "Could not init GLX"); + return false; + } + if (!extension_flags.GLX13 && force_glx13) { + throwException(env, "GLX13 is required, but is not available"); + return false; + } + jclass cls_pixel_format = (*env)->GetObjectClass(env, pixel_format); + int samples = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "samples", "I")); + if (samples > 0 && !extension_flags.GLX_ARB_multisample) { + throwException(env, "Samples > 0 specified but there's no support for GLX_ARB_multisample"); + return false; + } + int colorSamples = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "colorSamples", "I")); + if (colorSamples > 0 && !extension_flags.GLX_NV_multisample_coverage) { + throwException(env, "Color samples > 0 specified but there's no support for GLX_NV_multisample_coverage"); + return false; + } + bool floating_point = (bool)(*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "floating_point", "Z")); + if (floating_point && !(extension_flags.GLX13 && extension_flags.GLX_ARB_fbconfig_float)) { // We need GLX13 to support floating point + throwException(env, "Floating point specified but there's no support for GLX_ARB_fbconfig_float"); + return false; + } + bool floating_point_packed = (bool)(*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "floating_point_packed", "Z")); + if (floating_point_packed && !(extension_flags.GLX13 && extension_flags.GLX_EXT_fbconfig_packed_float)) { // We need GLX13 to support packed floating point + throwException(env, "Packed floating point specified but there's no support for GLX_EXT_fbconfig_packed_float"); + return false; + } + bool sRGB = (bool)(*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "sRGB", "Z")); + if (sRGB && !extension_flags.GLX_ARB_framebuffer_sRGB) { + throwException(env, "sRGB specified but there's no support for GLX_ARB_framebuffer_sRGB"); + return false; + } + + peer_info->glx13 = extension_flags.GLX13; + if (peer_info->glx13) { + GLXFBConfig *configs = chooseVisualGLX13(env, display, screen, pixel_format, use_display_bpp, drawable_type, double_buffered); + if (configs == NULL) { + throwException(env, "Could not choose GLX13 config"); + return false; + } + if (isDebugEnabled()) { + XVisualInfo *vis_info = lwjgl_glXGetVisualFromFBConfig(display, configs[0]); + if (vis_info != NULL) { + dumpVisualInfo(env, display, &extension_flags, vis_info); + XFree(vis_info); + } + } + int config_id; + int result = lwjgl_glXGetFBConfigAttrib(display, configs[0], GLX_FBCONFIG_ID, &config_id); + XFree(configs); + if (result != Success) { + throwException(env, "Could not get GLX_FBCONFIG_ID from GLXFBConfig"); + return false; + } + peer_info->config.glx13_config.config_id = config_id; + } else { + XVisualInfo *vis_info = chooseVisualGLX(env, display, screen, pixel_format, use_display_bpp, double_buffered); + if (vis_info == NULL) { + throwException(env, "Could not choose visual"); + return false; + } + peer_info->config.glx_config.visualid = vis_info->visualid; + peer_info->config.glx_config.depth = vis_info->depth; + peer_info->screen = vis_info->screen; + if (isDebugEnabled()) + dumpVisualInfo(env, display, &extension_flags, vis_info); + XFree(vis_info); + } + peer_info->display = display; + peer_info->screen = screen; + peer_info->drawable = None; + return true; +} diff -Nru lwjgl-2.7.1+dfsg/src/native/linux/opengl/context.h lwjgl-2.9.3+dfsg/src/native/linux/opengl/context.h --- lwjgl-2.7.1+dfsg/src/native/linux/opengl/context.h 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/linux/opengl/context.h 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * $Id$ + * + * Include file to access public window features + * + * @author elias_naur + * @version $Revision$ + */ + +#ifndef _LWJGL_CONTEXT_H_INCLUDED_ +#define _LWJGL_CONTEXT_H_INCLUDED_ + +#include +#include +#include +#include +#include "extgl_glx.h" + +typedef struct { + VisualID visualid; + int depth; +} GLXConfig; + +typedef struct { + GLXFBConfigID config_id; +} GLX13Config; + +typedef struct { + Display *display; + int screen; + GLXDrawable drawable; + // This flag determines the appropriate glx struct + bool glx13; + union { + GLXConfig glx_config; + GLX13Config glx13_config; + } config; +} X11PeerInfo; + +/* GLX 1.3 chooser */ +extern GLXFBConfig *chooseVisualGLX13(JNIEnv *env, Display *disp, int screen, jobject pixel_format, bool use_display_bpp, int drawable_type, bool double_buffer); + +/* Default GLX chooser*/ +extern XVisualInfo *chooseVisualGLX(JNIEnv *env, Display *disp, int screen, jobject pixel_format, bool use_display_bpp, bool double_buffer); + +extern XVisualInfo *getVisualInfoFromPeerInfo(JNIEnv *env, X11PeerInfo *peer_info); +extern GLXFBConfig *getFBConfigFromPeerInfo(JNIEnv *env, X11PeerInfo *peer_info); + +extern bool initPeerInfo(JNIEnv *env, jobject peer_info_handle, Display *display, int screen, jobject pixel_format, bool use_display_bpp, int drawable_type, bool double_buffered, bool force_glx13); + +#endif /* _LWJGL_CONTEXT_H_INCLUDED_ */ diff -Nru lwjgl-2.7.1+dfsg/src/native/linux/opengl/display.c lwjgl-2.9.3+dfsg/src/native/linux/opengl/display.c --- lwjgl-2.7.1+dfsg/src/native/linux/opengl/display.c 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/linux/opengl/display.c 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,411 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * $Id$ + * + * Linux specific library for display handling. + * + * @author elias_naur + * @version $Revision$ + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include "common_tools.h" +#include "org_lwjgl_opengl_LinuxDisplay.h" + +#define NUM_XRANDR_RETRIES 5 + +typedef struct { + int width; + int height; + int freq; + union { + int size_index; // Data for Xrandr extension + XF86VidModeModeInfo xf86vm_modeinfo; // Data for XF86VidMode extension + } mode_data; +} mode_info; + +static bool getXF86VidModeVersion(JNIEnv *env, Display *disp, int *major, int *minor) { + int event_base, error_base; + + if (!XF86VidModeQueryExtension(disp, &event_base, &error_base)) { + printfDebugJava(env, "XF86VidMode extension not available"); + return false; + } + if (!XF86VidModeQueryVersion(disp, major, minor)) { + throwException(env, "Could not query XF86VidMode version"); + return false; + } + printfDebugJava(env, "XF86VidMode extension version %i.%i", *major, *minor); + return true; +} + +static bool getXrandrVersion(JNIEnv *env, Display *disp, int *major, int *minor) { + int event_base, error_base; + + if (!XRRQueryExtension(disp, &event_base, &error_base)) { + printfDebugJava(env, "Xrandr extension not available"); + return false; + } + if (!XRRQueryVersion(disp, major, minor)) { + throwException(env, "Could not query Xrandr version"); + return false; + } + printfDebugJava(env, "Xrandr extension version %i.%i", *major, *minor); + return true; +} + +static bool isXrandrSupported(JNIEnv *env, Display *disp) { + int major, minor; + if (!getXrandrVersion(env, disp, &major, &minor)) + return false; + return major >= 1; +} + +static bool isXF86VidModeSupported(JNIEnv *env, Display *disp) { + int minor_ver, major_ver; + if (!getXF86VidModeVersion(env, disp, &major_ver, &minor_ver)) + return false; + return major_ver >= 2; +} + +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nIsXrandrSupported(JNIEnv *env, jclass unused, jlong display) { + Display *disp = (Display *)(intptr_t)display; + jboolean result = isXrandrSupported(env, disp) ? JNI_TRUE : JNI_FALSE; + return result; +} + +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nIsXF86VidModeSupported(JNIEnv *env, jclass unused, jlong display) { + Display *disp = (Display *)(intptr_t)display; + jboolean result = isXF86VidModeSupported(env, disp) ? JNI_TRUE : JNI_FALSE; + return result; +} + +static mode_info *getXrandrDisplayModes(Display *disp, int screen, int *num_modes) { + int num_randr_sizes; + XRRScreenSize *sizes = XRRSizes(disp, screen, &num_randr_sizes); + mode_info *avail_modes = NULL; + int list_size = 0; + /* Count number of modes */ + int i; + int mode_index = 0; + for (i = 0; i < num_randr_sizes; i++) { + int num_randr_rates; + short *freqs = XRRRates(disp, screen, i, &num_randr_rates); + int j; + for (j = 0; j < num_randr_rates; j++) { + if (list_size <= mode_index) { + list_size += 1; + avail_modes = (mode_info *)realloc(avail_modes, sizeof(mode_info)*list_size); + if (avail_modes == NULL) + return NULL; + } + avail_modes[mode_index].width = sizes[i].width; + avail_modes[mode_index].height = sizes[i].height; + avail_modes[mode_index].freq = freqs[j]; + avail_modes[mode_index].mode_data.size_index = i; + mode_index++; + } + } + *num_modes = mode_index; + return avail_modes; +} + +static mode_info *getXF86VidModeDisplayModes(Display *disp, int screen, int *num_modes) { + int num_xf86vm_modes; + XF86VidModeModeInfo **avail_xf86vm_modes; + XF86VidModeGetAllModeLines(disp, screen, &num_xf86vm_modes, &avail_xf86vm_modes); + mode_info *avail_modes = (mode_info *)malloc(sizeof(mode_info)*num_xf86vm_modes); + if (avail_modes == NULL) { + XFree(avail_xf86vm_modes); + return NULL; + } + int i; + for (i = 0; i < num_xf86vm_modes; i++) { + avail_modes[i].width = avail_xf86vm_modes[i]->hdisplay; + avail_modes[i].height = avail_xf86vm_modes[i]->vdisplay; + avail_modes[i].freq = 0; // No frequency support in XF86VidMode + avail_modes[i].mode_data.xf86vm_modeinfo = *avail_xf86vm_modes[i]; + } + XFree(avail_xf86vm_modes); + *num_modes = num_xf86vm_modes; + return avail_modes; +} + +static mode_info *getDisplayModes(Display *disp, int screen, jint extension, int *num_modes) { + switch (extension) { + case org_lwjgl_opengl_LinuxDisplay_XF86VIDMODE: + return getXF86VidModeDisplayModes(disp, screen, num_modes); + case org_lwjgl_opengl_LinuxDisplay_XRANDR: + return getXrandrDisplayModes(disp, screen, num_modes); + case org_lwjgl_opengl_LinuxDisplay_NONE: + // fall through + default: + return NULL; + } +} + +static bool setXF86VidModeMode(Display *disp, int screen, mode_info *mode) { + return True == XF86VidModeSwitchToMode(disp, screen, &mode->mode_data.xf86vm_modeinfo); +} + +/* Try to set the mode specified through XRandR. + * Return value is the Status code of the mode switch + * The timestamp parameter is filled with the latest timestamp returned from XRRConfigTimes + */ +static Status trySetXrandrMode(Display *disp, int screen, mode_info *mode, Time *timestamp) { + Status status; + Drawable root_window = RootWindow(disp, screen); + XRRScreenConfiguration *screen_configuration = XRRGetScreenInfo(disp, root_window); + Time config_time; + *timestamp = XRRConfigTimes(screen_configuration, &config_time); + Rotation current_rotation; + XRRConfigCurrentConfiguration(screen_configuration, ¤t_rotation); + status = XRRSetScreenConfigAndRate(disp, screen_configuration, root_window, mode->mode_data.size_index, current_rotation, mode->freq, *timestamp); + XRRFreeScreenConfigInfo(screen_configuration); + return status; +} + +static bool setXrandrMode(Display *disp, int screen, mode_info *mode) { + int iteration; + Time timestamp; + Status status = trySetXrandrMode(disp, screen, mode, ×tamp); + if (status == 0) + return true; // Success + Time new_timestamp; + for (iteration = 0; iteration < NUM_XRANDR_RETRIES; iteration++) { + status = trySetXrandrMode(disp, screen, mode, &new_timestamp); + if (status == 0) + return true; // Success + if (new_timestamp == timestamp) { + return false; // Failure, and the stamps are equal meaning that the failure is not merely transient + } + timestamp = new_timestamp; + } + return false; +} + +static bool setMode(JNIEnv *env, Display *disp, int screen, jint extension, int width, int height, int freq) { + int num_modes, i; + mode_info *avail_modes = getDisplayModes(disp, screen, extension, &num_modes); + if (avail_modes == NULL) { + printfDebugJava(env, "Could not get display modes"); + return false; + } + bool result = false; + for (i = 0; i < num_modes; ++i) { + printfDebugJava(env, "Mode %d: %dx%d @%d", i, avail_modes[i].width, avail_modes[i].height, avail_modes[i].freq); + if (avail_modes[i].width == width && avail_modes[i].height == height && avail_modes[i].freq == freq) { + switch (extension) { + case org_lwjgl_opengl_LinuxDisplay_XF86VIDMODE: + if (!setXF86VidModeMode(disp, screen, &avail_modes[i])) { + printfDebugJava(env, "Could not switch mode"); + continue; + } + break; + case org_lwjgl_opengl_LinuxDisplay_XRANDR: + if (!setXrandrMode(disp, screen, &avail_modes[i])) { + printfDebugJava(env, "Could not switch mode"); + continue; + } + break; + case org_lwjgl_opengl_LinuxDisplay_NONE: // Should never happen, since NONE imply no available display modes + default: // Should never happen + continue; + } + result = true; + break; + } + } + free(avail_modes); + XFlush(disp); + return result; +} + +static int getGammaRampLengthOfDisplay(JNIEnv *env, Display *disp, int screen) { + int ramp_size; + if (XF86VidModeGetGammaRampSize(disp, screen, &ramp_size) == False) { + throwException(env, "XF86VidModeGetGammaRampSize call failed"); + return 0; + } + return ramp_size; +} + +JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nConvertToNativeRamp(JNIEnv *env, jclass unused, jobject ramp_buffer, jint buffer_offset, jint length) { + const jfloat *ramp_ptr = (const jfloat *)(*env)->GetDirectBufferAddress(env, ramp_buffer) + buffer_offset; + jobject native_ramp = newJavaManagedByteBuffer(env, length*3*sizeof(unsigned short)); + if (native_ramp == NULL) { + throwException(env, "Failed to allocate gamma ramp buffer"); + return NULL; + } + unsigned short *native_ramp_ptr = (unsigned short *)(*env)->GetDirectBufferAddress(env, native_ramp); + int i; + for (i = 0; i < length; i++) { + float scaled_gamma = ramp_ptr[i]*0xffff; + short scaled_gamma_short = (unsigned short)roundf(scaled_gamma); + native_ramp_ptr[i] = scaled_gamma_short; + native_ramp_ptr[i + length] = scaled_gamma_short; + native_ramp_ptr[i + length*2] = scaled_gamma_short; + } + return native_ramp; +} + +JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetCurrentGammaRamp(JNIEnv *env, jclass unused, jlong display, jint screen) { + Display *disp = (Display *)(intptr_t)display; + int ramp_size = getGammaRampLengthOfDisplay(env, disp, screen); + jobject ramp_buffer = newJavaManagedByteBuffer(env, sizeof(unsigned short)*3*ramp_size); + if (ramp_buffer == NULL) { + throwException(env, "Could not allocate gamma ramp buffer"); + return NULL; + } + unsigned short *ramp = (unsigned short *)(*env)->GetDirectBufferAddress(env, ramp_buffer); + if (!XF86VidModeGetGammaRamp(disp, screen, ramp_size, ramp, + ramp + ramp_size, ramp + ramp_size*2)) { + throwException(env, "Could not get the current gamma ramp"); + return NULL; + } + return ramp_buffer; +} + +static void setGamma(JNIEnv *env, Display *disp, int screen, jobject ramp_buffer) { + if (ramp_buffer == NULL) + return; + unsigned short *ramp_ptr = (unsigned short *)(*env)->GetDirectBufferAddress(env, ramp_buffer); + jlong capacity = (*env)->GetDirectBufferCapacity(env, ramp_buffer); + int size = capacity/(sizeof(unsigned short)*3); + if (size == 0) + return; + if (XF86VidModeSetGammaRamp(disp, screen, size, ramp_ptr, ramp_ptr + size, ramp_ptr + size*2) == False) { + throwException(env, "Could not set gamma ramp."); + } +} + +static bool switchDisplayMode(JNIEnv * env, Display *disp, int screen, jint extension, jobject mode) { + if (mode == NULL) { + throwException(env, "mode must be non-null"); + return false; + } + jclass cls_displayMode = (*env)->GetObjectClass(env, mode); + jfieldID fid_width = (*env)->GetFieldID(env, cls_displayMode, "width", "I"); + jfieldID fid_height = (*env)->GetFieldID(env, cls_displayMode, "height", "I"); + jfieldID fid_freq = (*env)->GetFieldID(env, cls_displayMode, "freq", "I"); + int width = (*env)->GetIntField(env, mode, fid_width); + int height = (*env)->GetIntField(env, mode, fid_height); + int freq = (*env)->GetIntField(env, mode, fid_freq); + if (!setMode(env, disp, screen, extension, width, height, freq)) { + throwException(env, "Could not switch mode."); + return false; + } + return true; +} + +static jobjectArray getAvailableDisplayModes(JNIEnv * env, Display *disp, int screen, jint extension) { + int num_modes, i; + mode_info *avail_modes; + int bpp = XDefaultDepth(disp, screen); + avail_modes = getDisplayModes(disp, screen, extension, &num_modes); + if (avail_modes == NULL) { + printfDebugJava(env, "Could not get display modes"); + return NULL; + } + // Allocate an array of DisplayModes big enough + jclass displayModeClass = (*env)->FindClass(env, "org/lwjgl/opengl/DisplayMode"); + jobjectArray ret = (*env)->NewObjectArray(env, num_modes, displayModeClass, NULL); + jmethodID displayModeConstructor = (*env)->GetMethodID(env, displayModeClass, "", "(IIII)V"); + + for (i = 0; i < num_modes; i++) { + jobject displayMode = (*env)->NewObject(env, displayModeClass, displayModeConstructor, avail_modes[i].width, avail_modes[i].height, bpp, avail_modes[i].freq); + (*env)->SetObjectArrayElement(env, ret, i, displayMode); + } + free(avail_modes); + return ret; +} + +static jobject getCurrentXRandrMode(JNIEnv * env, Display *disp, int screen) { + Drawable root_window = RootWindow(disp, screen); + XRRScreenConfiguration *config = XRRGetScreenInfo(disp, root_window); + if (config == NULL) { + throwException(env, "Could not get current screen configuration."); + return NULL; + } + short rate = XRRConfigCurrentRate(config); + Rotation current_rotation; + SizeID size_index = XRRConfigCurrentConfiguration(config, ¤t_rotation); + int n_sizes; + XRRScreenSize *sizes = XRRConfigSizes(config, &n_sizes); + if (size_index >= n_sizes) { + throwFormattedException(env, "Xrandr current index (%d) is larger than or equals to the number of sizes (%d).", size_index, n_sizes); + XRRFreeScreenConfigInfo(config); + return NULL; + } + XRRScreenSize current_size = sizes[size_index]; + XRRFreeScreenConfigInfo(config); + int bpp = XDefaultDepth(disp, screen); + jclass displayModeClass = (*env)->FindClass(env, "org/lwjgl/opengl/DisplayMode"); + jmethodID displayModeConstructor = (*env)->GetMethodID(env, displayModeClass, "", "(IIII)V"); + jobject displayMode = (*env)->NewObject(env, displayModeClass, displayModeConstructor, current_size.width, current_size.height, bpp, rate); + return displayMode; +} + +JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetCurrentXRandrMode(JNIEnv *env, jclass unused, jlong display, jint screen) { + Display *disp = (Display *)(intptr_t)display; + return getCurrentXRandrMode(env, disp, screen); +} + +JNIEXPORT jobjectArray JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetAvailableDisplayModes(JNIEnv *env, jclass clazz, jlong display, jint screen, jint extension) { + Display *disp = (Display *)(intptr_t)display; + return getAvailableDisplayModes(env, disp, screen, extension); +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nSwitchDisplayMode(JNIEnv *env, jclass clazz, jlong display, jint screen, jint extension, jobject mode) { + Display *disp = (Display *)(intptr_t)display; + switchDisplayMode(env, disp, screen, extension, mode); +} + +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetGammaRampLength(JNIEnv *env, jclass clazz, jlong display_ptr, jint screen) { + Display *disp = (Display *)(intptr_t)display_ptr; + return (jint)getGammaRampLengthOfDisplay(env, disp, screen); +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nSetGammaRamp(JNIEnv *env, jclass clazz, jlong display, jint screen, jobject gamma_buffer) { + Display *disp = (Display *)(intptr_t)display; + setGamma(env, disp, screen, gamma_buffer); +} + diff -Nru lwjgl-2.7.1+dfsg/src/native/linux/opengl/extgl_glx.c lwjgl-2.9.3+dfsg/src/native/linux/opengl/extgl_glx.c --- lwjgl-2.7.1+dfsg/src/native/linux/opengl/extgl_glx.c 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/linux/opengl/extgl_glx.c 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,284 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include +#include "extgl_glx.h" + +glXGetFBConfigsPROC lwjgl_glXGetFBConfigs = NULL; +glXChooseFBConfigPROC lwjgl_glXChooseFBConfig = NULL; +glXGetFBConfigAttribPROC lwjgl_glXGetFBConfigAttrib = NULL; +glXGetVisualFromFBConfigPROC lwjgl_glXGetVisualFromFBConfig = NULL; +glXCreateWindowPROC lwjgl_glXCreateWindow = NULL; +glXDestroyWindowPROC lwjgl_glXDestroyWindow = NULL; +glXCreatePixmapPROC lwjgl_glXCreatePixmap = NULL; +glXDestroyPixmapPROC lwjgl_glXDestroyPixmap = NULL; +glXCreatePbufferPROC lwjgl_glXCreatePbuffer = NULL; +glXDestroyPbufferPROC lwjgl_glXDestroyPbuffer = NULL; +glXQueryDrawablePROC lwjgl_glXQueryDrawable = NULL; +glXCreateNewContextPROC lwjgl_glXCreateNewContext = NULL; +glXMakeContextCurrentPROC lwjgl_glXMakeContextCurrent = NULL; +glXGetCurrentReadDrawablePROC lwjgl_glXGetCurrentReadDrawable = NULL; +glXGetCurrentDisplayPROC lwjgl_glXGetCurrentDisplay = NULL; +glXQueryContextPROC lwjgl_glXQueryContext = NULL; +glXSelectEventPROC lwjgl_glXSelectEvent = NULL; +glXGetSelectedEventPROC lwjgl_glXGetSelectedEvent = NULL; +glXChooseVisualPROC lwjgl_glXChooseVisual = NULL; +glXCopyContextPROC lwjgl_glXCopyContext = NULL; +glXCreateContextPROC lwjgl_glXCreateContext = NULL; +glXCreateGLXPixmapPROC lwjgl_glXCreateGLXPixmap = NULL; +glXDestroyContextPROC lwjgl_glXDestroyContext = NULL; +glXDestroyGLXPixmapPROC lwjgl_glXDestroyGLXPixmap = NULL; +glXGetConfigPROC lwjgl_glXGetConfig = NULL; +glXGetCurrentContextPROC lwjgl_glXGetCurrentContext = NULL; +glXGetCurrentDrawablePROC lwjgl_glXGetCurrentDrawable = NULL; +glXIsDirectPROC lwjgl_glXIsDirect = NULL; +glXMakeCurrentPROC lwjgl_glXMakeCurrent = NULL; +glXQueryExtensionPROC lwjgl_glXQueryExtension = NULL; +glXQueryVersionPROC lwjgl_glXQueryVersion = NULL; +glXSwapBuffersPROC lwjgl_glXSwapBuffers = NULL; +glXUseXFontPROC lwjgl_glXUseXFont = NULL; +glXWaitGLPROC lwjgl_glXWaitGL = NULL; +glXWaitXPROC lwjgl_glXWaitX = NULL; +glXGetClientStringPROC lwjgl_glXGetClientString = NULL; +glXQueryServerStringPROC lwjgl_glXQueryServerString = NULL; +glXQueryExtensionsStringPROC lwjgl_glXQueryExtensionsString = NULL; + +/* GLX_SGI_swap_control */ +glXSwapIntervalSGIPROC lwjgl_glXSwapIntervalSGI = NULL; + +/* GLX_EXT_swap_control */ +glXSwapIntervalEXTPROC lwjgl_glXSwapIntervalEXT = NULL; + +/* GLX_ARB_create_context */ +glXCreateContextAttribsARBPROC lwjgl_glXCreateContextAttribsARB = NULL; + +/* GLX_NV_present_video */ +glXEnumerateVideoDevicesNVPROC lwjgl_glXEnumerateVideoDevicesNV = NULL; +glXBindVideoDeviceNVPROC lwjgl_glXBindVideoDeviceNV = NULL; + +/* GLX_NV_video_capture */ +glXBindVideoCaptureDeviceNVPROC lwjgl_glXBindVideoCaptureDeviceNV = NULL; +glXEnumerateVideoCaptureDevicesNVPROC lwjgl_glXEnumerateVideoCaptureDevicesNV = NULL; +glXLockVideoCaptureDeviceNVPROC lwjgl_glXLockVideoCaptureDeviceNV = NULL; +glXQueryVideoCaptureDeviceNVPROC lwjgl_glXQueryVideoCaptureDeviceNV = NULL; +glXReleaseVideoCaptureDeviceNVPROC lwjgl_glXReleaseVideoCaptureDeviceNV = NULL; + +static void * lib_gl_handle = NULL; + +typedef void * (APIENTRY * glXGetProcAddressARBPROC) (const GLubyte *procName); + +static glXGetProcAddressARBPROC lwjgl_glXGetProcAddressARB; + +static GLXExtensions symbols_flags; + +/** returns true if the extention is available */ +static inline bool GLXQueryExtension(const GLubyte *exts, const char *name) { + return extgl_QueryExtension(exts, name); +} + +static void extgl_InitGLX13() { + ExtFunction functions[] = { + {"glXGetFBConfigs", (void*)&lwjgl_glXGetFBConfigs}, + {"glXChooseFBConfig", (void*)&lwjgl_glXChooseFBConfig}, + {"glXGetFBConfigAttrib", (void*)&lwjgl_glXGetFBConfigAttrib}, + {"glXGetVisualFromFBConfig", (void*)&lwjgl_glXGetVisualFromFBConfig}, + {"glXCreateWindow", (void*)&lwjgl_glXCreateWindow}, + {"glXDestroyWindow", (void*)&lwjgl_glXDestroyWindow}, + {"glXCreatePixmap", (void*)&lwjgl_glXCreatePixmap}, + {"glXDestroyPixmap", (void*)&lwjgl_glXDestroyPixmap}, + {"glXCreatePbuffer", (void*)&lwjgl_glXCreatePbuffer}, + {"glXDestroyPbuffer", (void*)&lwjgl_glXDestroyPbuffer}, + {"glXQueryDrawable", (void*)&lwjgl_glXQueryDrawable}, + {"glXCreateNewContext", (void*)&lwjgl_glXCreateNewContext}, + {"glXMakeContextCurrent", (void*)&lwjgl_glXMakeContextCurrent}, + {"glXGetCurrentReadDrawable", (void*)&lwjgl_glXGetCurrentReadDrawable}, + {"glXGetCurrentDisplay", (void*)&lwjgl_glXGetCurrentDisplay}, + {"glXQueryContext", (void*)&lwjgl_glXQueryContext}, + {"glXSelectEvent", (void*)&lwjgl_glXSelectEvent}, + {"glXGetSelectedEvent", (void*)&lwjgl_glXGetSelectedEvent}}; + symbols_flags.GLX13 = extgl_InitializeFunctions(sizeof(functions)/sizeof(ExtFunction), functions); +} + +static void extgl_InitGLX12(void) { + ExtFunction functions[] = { + {"glXChooseVisual", (void*)&lwjgl_glXChooseVisual}, + {"glXCopyContext", (void*)&lwjgl_glXCopyContext}, + {"glXCreateContext", (void*)&lwjgl_glXCreateContext}, + {"glXCreateGLXPixmap", (void*)&lwjgl_glXCreateGLXPixmap}, + {"glXDestroyContext", (void*)&lwjgl_glXDestroyContext}, + {"glXDestroyGLXPixmap", (void*)&lwjgl_glXDestroyGLXPixmap}, + {"glXGetConfig", (void*)&lwjgl_glXGetConfig}, + {"glXGetCurrentContext", (void*)&lwjgl_glXGetCurrentContext}, + {"glXGetCurrentDrawable", (void*)&lwjgl_glXGetCurrentDrawable}, + {"glXIsDirect", (void*)&lwjgl_glXIsDirect}, + {"glXMakeCurrent", (void*)&lwjgl_glXMakeCurrent}, + {"glXQueryExtension", (void*)&lwjgl_glXQueryExtension}, + {"glXQueryVersion", (void*)&lwjgl_glXQueryVersion}, + {"glXSwapBuffers", (void*)&lwjgl_glXSwapBuffers}, + {"glXUseXFont", (void*)&lwjgl_glXUseXFont}, + {"glXWaitGL", (void*)&lwjgl_glXWaitGL}, + {"glXWaitX", (void*)&lwjgl_glXWaitX}, + {"glXGetClientString", (void*)&lwjgl_glXGetClientString}, + {"glXQueryServerString", (void*)&lwjgl_glXQueryServerString}, + {"glXQueryExtensionsString", (void*)&lwjgl_glXQueryExtensionsString}}; + symbols_flags.GLX12 = extgl_InitializeFunctions(sizeof(functions)/sizeof(ExtFunction), functions); +} + +static void extgl_InitGLXSGISwapControl() { + ExtFunction functions[] = { + {"glXSwapIntervalSGI", (void*)&lwjgl_glXSwapIntervalSGI}}; + symbols_flags.GLX_SGI_swap_control = extgl_InitializeFunctions(sizeof(functions)/sizeof(ExtFunction), functions); +} + +static void extgl_InitGLXEXTSwapControl() { + ExtFunction functions[] = { + {"glXSwapIntervalEXT", (void*)&lwjgl_glXSwapIntervalEXT}}; + symbols_flags.GLX_EXT_swap_control = extgl_InitializeFunctions(sizeof(functions)/sizeof(ExtFunction), functions); +} + +static void extgl_InitGLXARBCreateContext() { + ExtFunction functions[] = { + {"glXCreateContextAttribsARB", (void*)&lwjgl_glXCreateContextAttribsARB}}; + symbols_flags.GLX_ARB_create_context = extgl_InitializeFunctions(sizeof(functions)/sizeof(ExtFunction), functions); +} + +static void extgl_InitGLXNVPresentVideo() { + ExtFunction functions[] = { + { "glXEnumerateVideoDevicesNV", (void*)&lwjgl_glXEnumerateVideoDevicesNV }, + { "glXBindVideoDeviceNV", (void*)&lwjgl_glXBindVideoDeviceNV } + }; + + symbols_flags.GLX_NV_present_video = extgl_InitializeFunctions(sizeof(functions)/sizeof(ExtFunction), functions); +} + +static void extgl_InitGLXNVVideoCapture() { + ExtFunction functions[] = { + { "glXBindVideoCaptureDeviceNV", (void*)&lwjgl_glXBindVideoCaptureDeviceNV }, + { "glXEnumerateVideoCaptureDevicesNV", (void*)&lwjgl_glXEnumerateVideoCaptureDevicesNV }, + { "glXLockVideoCaptureDeviceNV", (void*)&lwjgl_glXLockVideoCaptureDeviceNV }, + { "glXQueryVideoCaptureDeviceNV", (void*)&lwjgl_glXQueryVideoCaptureDeviceNV }, + { "glXReleaseVideoCaptureDeviceNV", (void*)&lwjgl_glXReleaseVideoCaptureDeviceNV } + }; + + symbols_flags.GLX_NV_video_capture = extgl_InitializeFunctions(sizeof(functions)/sizeof(ExtFunction), functions); +} + +static void extgl_InitGLXSupportedExtensions(Display *disp, int screen, GLXExtensions *extension_flags) { + const GLubyte *exts = (const GLubyte *)lwjgl_glXQueryExtensionsString(disp, screen); + +/* extension_flags.GLX_EXT_visual_info = GLXQueryExtension(exts, "GLX_EXT_visual_info"); + extension_flags.GLX_EXT_visual_rating = GLXQueryExtension(exts, "GLX_EXT_visual_rating");*/ + extension_flags->GLX_SGI_swap_control = symbols_flags.GLX_SGI_swap_control && GLXQueryExtension(exts, "GLX_SGI_swap_control"); + extension_flags->GLX_EXT_swap_control = symbols_flags.GLX_EXT_swap_control && GLXQueryExtension(exts, "GLX_EXT_swap_control"); + extension_flags->GLX_ARB_multisample = GLXQueryExtension(exts, "GLX_ARB_multisample"); + extension_flags->GLX_ARB_fbconfig_float = GLXQueryExtension(exts, "GLX_ARB_fbconfig_float"); + extension_flags->GLX_EXT_fbconfig_packed_float = GLXQueryExtension(exts, "GLX_EXT_fbconfig_packed_float"); + extension_flags->GLX_ARB_framebuffer_sRGB = GLXQueryExtension(exts, "GLX_ARB_framebuffer_sRGB") || GLXQueryExtension(exts, "GLX_EXT_framebuffer_sRGB"); + extension_flags->GLX_ARB_create_context = GLXQueryExtension(exts, "GLX_ARB_create_context"); + extension_flags->GLX_NV_multisample_coverage = GLXQueryExtension(exts, "GLX_NV_multisample_coverage"); + extension_flags->GLX_NV_present_video = GLXQueryExtension(exts, "GLX_NV_present_video"); + extension_flags->GLX_NV_video_capture = GLXQueryExtension(exts, "GLX_NV_video_capture"); +} + +bool extgl_Open(JNIEnv *env) { + if (lib_gl_handle != NULL) + return true; + /* + * Actually we don't need the RTLD_GLOBAL flag, since the symbols + * we load should be private to us. However, according to the + * documentation at + * + * http://dri.sourceforge.net/doc/DRIuserguide.html + * + * DRI drivers need this flag to work properly + */ +#ifdef __OpenBSD__ + lib_gl_handle = dlopen("libGL.so", RTLD_LAZY | RTLD_GLOBAL); +#else + lib_gl_handle = dlopen("libGL.so.1", RTLD_LAZY | RTLD_GLOBAL); +#endif + if (lib_gl_handle == NULL) { + throwFormattedException(env, "Error loading libGL.so.1: %s", dlerror()); + return false; + } + lwjgl_glXGetProcAddressARB = (glXGetProcAddressARBPROC)dlsym(lib_gl_handle, "glXGetProcAddressARB"); + if (lwjgl_glXGetProcAddressARB == NULL) { + extgl_Close(); + throwException(env, "Could not get address of glXGetProcAddressARB"); + return false; + } + /* Unlike Windows, GLX function addresses are context-independent + * so we only have to initialize the addresses once at load + */ + extgl_InitGLX12(); + extgl_InitGLX13(); + extgl_InitGLXSGISwapControl(); + extgl_InitGLXEXTSwapControl(); + extgl_InitGLXARBCreateContext(); + extgl_InitGLXNVPresentVideo(); + extgl_InitGLXNVVideoCapture(); + return true; +} + +void *extgl_GetProcAddress(const char *name) { + void *t = (void*)lwjgl_glXGetProcAddressARB((const GLubyte*)name); + if (t == NULL) { + t = dlsym(lib_gl_handle, name); + if (t == NULL) { + printfDebug("Could not locate symbol %s\n", name); + } + } + return t; +} + +void extgl_Close(void) { + dlclose(lib_gl_handle); + lib_gl_handle = NULL; +} + +bool extgl_InitGLX(Display *disp, int screen, GLXExtensions *extension_flags) { + int major, minor; + /* Assume glx ver >= 1.2 */ + // Check GLX 1.2 symbols available + if (!symbols_flags.GLX12) + return false; + if (lwjgl_glXQueryVersion(disp, &major, &minor) != True) + return false; + bool glx12 = major > 1 || (major == 1 && minor >= 2); + // Check GLX 1.2 version + if (!glx12) + return false; + extension_flags->GLX12 = glx12; + extension_flags->GLX13 = major > 1 || (major == 1 && minor >= 3); + extension_flags->GLX14 = major > 1 || (major == 1 && minor >= 4); + extgl_InitGLXSupportedExtensions(disp, screen, extension_flags); + return true; +} diff -Nru lwjgl-2.7.1+dfsg/src/native/linux/opengl/extgl_glx.h lwjgl-2.9.3+dfsg/src/native/linux/opengl/extgl_glx.h --- lwjgl-2.7.1+dfsg/src/native/linux/opengl/extgl_glx.h 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/linux/opengl/extgl_glx.h 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,441 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef EXTGL_GLX_H +#define EXTGL_GLX_H + +#include +#include "extgl.h" + +/* + * Names for attributes to lwjgl_glXGetConfig. + */ +#define GLX_USE_GL 1 /* support GLX rendering */ +#define GLX_BUFFER_SIZE 2 /* depth of the color buffer */ +#define GLX_LEVEL 3 /* level in plane stacking */ +#define GLX_RGBA 4 /* true if RGBA mode */ +#define GLX_DOUBLEBUFFER 5 /* double buffering supported */ +#define GLX_STEREO 6 /* stereo buffering supported */ +#define GLX_AUX_BUFFERS 7 /* number of aux buffers */ +#define GLX_RED_SIZE 8 /* number of red component bits */ +#define GLX_GREEN_SIZE 9 /* number of green component bits */ +#define GLX_BLUE_SIZE 10 /* number of blue component bits */ +#define GLX_ALPHA_SIZE 11 /* number of alpha component bits */ +#define GLX_DEPTH_SIZE 12 /* number of depth bits */ +#define GLX_STENCIL_SIZE 13 /* number of stencil bits */ +#define GLX_ACCUM_RED_SIZE 14 /* number of red accum bits */ +#define GLX_ACCUM_GREEN_SIZE 15 /* number of green accum bits */ +#define GLX_ACCUM_BLUE_SIZE 16 /* number of blue accum bits */ +#define GLX_ACCUM_ALPHA_SIZE 17 /* number of alpha accum bits */ + +#define GLX_SAMPLE_BUFFERS_ARB 100000 /* number of multisample buffers */ +#define GLX_SAMPLES_ARB 100001 /* number of multisample samples */ + +/* + * FBConfig-specific attributes + */ +#define GLX_X_VISUAL_TYPE 0x22 +#define GLX_CONFIG_CAVEAT 0x20 /* Like visual_info VISUAL_CAVEAT */ +#define GLX_TRANSPARENT_TYPE 0x23 +#define GLX_TRANSPARENT_INDEX_VALUE 0x24 +#define GLX_TRANSPARENT_RED_VALUE 0x25 +#define GLX_TRANSPARENT_GREEN_VALUE 0x26 +#define GLX_TRANSPARENT_BLUE_VALUE 0x27 +#define GLX_TRANSPARENT_ALPHA_VALUE 0x28 +#define GLX_DRAWABLE_TYPE 0x8010 +#define GLX_RENDER_TYPE 0x8011 +#define GLX_X_RENDERABLE 0x8012 +#define GLX_FBCONFIG_ID 0x8013 +#define GLX_MAX_PBUFFER_WIDTH 0x8016 +#define GLX_MAX_PBUFFER_HEIGHT 0x8017 +#define GLX_MAX_PBUFFER_PIXELS 0x8018 +#define GLX_VISUAL_ID 0x800B + +#define GLX_DRAWABLE_TYPE_SGIX GLX_DRAWABLE_TYPE +#define GLX_RENDER_TYPE_SGIX GLX_RENDER_TYPE +#define GLX_X_RENDERABLE_SGIX GLX_X_RENDERABLE +#define GLX_FBCONFIG_ID_SGIX GLX_FBCONFIG_ID +#define GLX_MAX_PBUFFER_WIDTH_SGIX GLX_MAX_PBUFFER_WIDTH +#define GLX_MAX_PBUFFER_HEIGHT_SGIX GLX_MAX_PBUFFER_HEIGHT +#define GLX_MAX_PBUFFER_PIXELS_SGIX GLX_MAX_PBUFFER_PIXELS +#define GLX_OPTIMAL_PBUFFER_WIDTH_SGIX 0x8019 +#define GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX 0x801A + +/* + * Error return values from lwjgl_glXGetConfig. Success is indicated by + * a value of 0. + */ +#define GLX_BAD_SCREEN 1 /* screen # is bad */ +#define GLX_BAD_ATTRIBUTE 2 /* attribute to get is bad */ +#define GLX_NO_EXTENSION 3 /* no glx extension on server */ +#define GLX_BAD_VISUAL 4 /* visual # not known by GLX */ +#define GLX_BAD_CONTEXT 5 +#define GLX_BAD_VALUE 6 +#define GLX_BAD_ENUM 7 + + +/* FBConfig attribute values */ + +/* + * Generic "don't care" value for lwjgl_glX ChooseFBConfig attributes (except + * GLX_LEVEL). + */ +#define GLX_DONT_CARE 0xFFFFFFFF + +/* GLX_RENDER_TYPE bits */ +#define GLX_RGBA_BIT 0x00000001 +#define GLX_COLOR_INDEX_BIT 0x00000002 +#define GLX_RGBA_BIT_SGIX GLX_RGBA_BIT +#define GLX_COLOR_INDEX_BIT_SGIX GLX_COLOR_INDEX_BIT + +/* GLX_DRAWABLE_TYPE bits */ +#define GLX_WINDOW_BIT 0x00000001 +#define GLX_PIXMAP_BIT 0x00000002 +#define GLX_PBUFFER_BIT 0x00000004 +#define GLX_WINDOW_BIT_SGIX GLX_WINDOW_BIT +#define GLX_PIXMAP_BIT_SGIX GLX_PIXMAP_BIT +#define GLX_PBUFFER_BIT_SGIX GLX_PBUFFER_BIT + +/* GLX_CONFIG_CAVEAT attribute values */ +#define GLX_NONE 0x8000 +#define GLX_SLOW_CONFIG 0x8001 +#define GLX_NON_CONFORMANT_CONFIG 0x800D + +/* GLX_X_VISUAL_TYPE attribute values */ +#define GLX_TRUE_COLOR 0x8002 +#define GLX_DIRECT_COLOR 0x8003 +#define GLX_PSEUDO_COLOR 0x8004 +#define GLX_STATIC_COLOR 0x8005 +#define GLX_GRAY_SCALE 0x8006 +#define GLX_STATIC_GRAY 0x8007 + +/* GLX_TRANSPARENT_TYPE attribute values */ +/* #define GLX_NONE 0x8000 */ +#define GLX_TRANSPARENT_RGB 0x8008 +#define GLX_TRANSPARENT_INDEX 0x8009 + +/* lwjgl_glXCreateGLXPbuffer attributes */ +#define GLX_PRESERVED_CONTENTS 0x801B +#define GLX_LARGEST_PBUFFER 0x801C +#define GLX_PBUFFER_HEIGHT 0x8040 /* New for GLX 1.3 */ +#define GLX_PBUFFER_WIDTH 0x8041 /* New for GLX 1.3 */ +#define GLX_PRESERVED_CONTENTS_SGIX GLX_PRESERVED_CONTENTS +#define GLX_LARGEST_PBUFFER_SGIX GLX_LARGEST_PBUFFER + +/* lwjgl_glXQueryGLXPBuffer attributes */ +#define GLX_WIDTH 0x801D +#define GLX_HEIGHT 0x801E +#define GLX_EVENT_MASK 0x801F +#define GLX_WIDTH_SGIX GLX_WIDTH +#define GLX_HEIGHT_SGIX GLX_HEIGHT +#define GLX_EVENT_MASK_SGIX GLX_EVENT_MASK + +/* lwjgl_glXCreateNewContext render_type attribute values */ +#define GLX_RGBA_TYPE 0x8014 +#define GLX_COLOR_INDEX_TYPE 0x8015 +#define GLX_RGBA_TYPE_SGIX GLX_RGBA_TYPE +#define GLX_COLOR_INDEX_TYPE_SGIX GLX_COLOR_INDEX_TYPE + +/* lwjgl_glXQueryContext attributes */ +/* #define GLX_FBCONFIG_ID 0x8013 */ +/* #define GLX_RENDER_TYPE 0x8011 */ +#define GLX_SCREEN 0x800C + +/* lwjgl_glXSelectEvent event mask bits */ +#define GLX_PBUFFER_CLOBBER_MASK 0x08000000 +#define GLX_PBUFFER_CLOBBER_MASK_SGIX GLX_PBUFFER_CLOBBER_MASK + +/* GLXPbufferClobberEvent event_type values */ +#define GLX_DAMAGED 0x8020 +#define GLX_SAVED 0x8021 +#define GLX_DAMAGED_SGIX GLX_DAMAGED +#define GLX_SAVED_SGIX GLX_SAVED + +/* GLXPbufferClobberEvent draw_type values */ +#define GLX_WINDOW 0x8022 +#define GLX_PBUFFER 0x8023 +#define GLX_WINDOW_SGIX GLX_WINDOW +#define GLX_PBUFFER_SGIX GLX_PBUFFER + +/* GLXPbufferClobberEvent buffer_mask bits */ +#define GLX_FRONT_LEFT_BUFFER_BIT 0x00000001 +#define GLX_FRONT_RIGHT_BUFFER_BIT 0x00000002 +#define GLX_BACK_LEFT_BUFFER_BIT 0x00000004 +#define GLX_BACK_RIGHT_BUFFER_BIT 0x00000008 +#define GLX_AUX_BUFFERS_BIT 0x00000010 +#define GLX_DEPTH_BUFFER_BIT 0x00000020 +#define GLX_STENCIL_BUFFER_BIT 0x00000040 +#define GLX_ACCUM_BUFFER_BIT 0x00000080 +#define GLX_FRONT_LEFT_BUFFER_BIT_SGIX GLX_FRONT_LEFT_BUFFER_BIT +#define GLX_FRONT_RIGHT_BUFFER_BIT_SGIX GLX_FRONT_RIGHT_BUFFER_BIT +#define GLX_BACK_LEFT_BUFFER_BIT_SGIX GLX_BACK_LEFT_BUFFER_BIT +#define GLX_BACK_RIGHT_BUFFER_BIT_SGIX GLX_BACK_RIGHT_BUFFER_BIT +#define GLX_AUX_BUFFERS_BIT_SGIX GLX_AUX_BUFFERS_BIT +#define GLX_DEPTH_BUFFER_BIT_SGIX GLX_DEPTH_BUFFER_BIT +#define GLX_STENCIL_BUFFER_BIT_SGIX GLX_STENCIL_BUFFER_BIT +#define GLX_ACCUM_BUFFER_BIT_SGIX GLX_ACCUM_BUFFER_BIT + +/* + * Extension return values from lwjgl_glXGetConfig. These are also + * accepted as parameter values for lwjgl_glXChooseVisual. + */ + +#define GLX_X_VISUAL_TYPE_EXT 0x22 /* visual_info extension type */ +#define GLX_TRANSPARENT_TYPE_EXT 0x23 /* visual_info extension */ +#define GLX_TRANSPARENT_INDEX_VALUE_EXT 0x24 /* visual_info extension */ +#define GLX_TRANSPARENT_RED_VALUE_EXT 0x25 /* visual_info extension */ +#define GLX_TRANSPARENT_GREEN_VALUE_EXT 0x26 /* visual_info extension */ +#define GLX_TRANSPARENT_BLUE_VALUE_EXT 0x27 /* visual_info extension */ +#define GLX_TRANSPARENT_ALPHA_VALUE_EXT 0x28 /* visual_info extension */ + +/* Property values for visual_type */ +#define GLX_TRUE_COLOR_EXT 0x8002 +#define GLX_DIRECT_COLOR_EXT 0x8003 +#define GLX_PSEUDO_COLOR_EXT 0x8004 +#define GLX_STATIC_COLOR_EXT 0x8005 +#define GLX_GRAY_SCALE_EXT 0x8006 +#define GLX_STATIC_GRAY_EXT 0x8007 + +/* Property values for transparent pixel */ +#define GLX_NONE_EXT 0x8000 +#define GLX_TRANSPARENT_RGB_EXT 0x8008 +#define GLX_TRANSPARENT_INDEX_EXT 0x8009 + +/* Property values for visual_rating */ +#define GLX_VISUAL_CAVEAT_EXT 0x20 /* visual_rating extension type */ +#define GLX_SLOW_VISUAL_EXT 0x8001 +#define GLX_NON_CONFORMANT_VISUAL_EXT 0x800D + +/* + * Names for attributes to lwjgl_glXGetClientString. + */ +#define GLX_VENDOR 0x1 +#define GLX_VERSION 0x2 +#define GLX_EXTENSIONS 0x3 + +/* + * Names for attributes to lwjgl_glXQueryContextInfoEXT. + */ +#define GLX_SHARE_CONTEXT_EXT 0x800A /* id of share context */ +#define GLX_VISUAL_ID_EXT 0x800B /* id of context's visual */ +#define GLX_SCREEN_EXT 0x800C /* screen number */ + +/* NV_float_buffer */ +#define GLX_FLOAT_COMPONENTS_NV 0x20B0 + +/* GLX_ARB_fbconfig_float */ +#define GLX_RGBA_FLOAT_TYPE 0x20B9 +#define GLX_RGBA_FLOAT_BIT 0x0004 + +/* GLX_ARB_fbconfig_float */ +#define GLX_RGBA_UNSIGNED_FLOAT_TYPE_EXT 0x20B1 +#define GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT 0x00000008 + +/* GLX_ARB_framebuffer_sRGB */ +#define GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB 0x20B2 + +/* GLX_ARB_create_context */ +#define GLX_CONTEXT_MAJOR_VERSION_ARB 0x2091 +#define GLX_CONTEXT_MINOR_VERSION_ARB 0x2092 +#define GLX_CONTEXT_FLAGS_ARB 0x2094 + +#define GLX_CONTEXT_DEBUG_BIT_ARB 0x0001 +#define GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x0002 + +/* GLX_NV_multisample_coverage */ +#define GLX_COVERAGE_SAMPLES_NV 100001 +#define GLX_COLOR_SAMPLES_NV 0x20B3 + +/* GLX_NV_present_video */ +#define GLX_NUM_VIDEO_SLOTS_NV 0x20F0 + +/* GLX_NV_video_capture */ +#define GLX_DEVICE_ID_NV 0x20CD +#define GLX_NUM_VIDEO_CAPTURE_SLOTS_NV 0x20CF +#define GLX_UNIQUE_ID_NV 0x20CE + +typedef XID GLXContextID; +typedef XID GLXPixmap; +typedef XID GLXDrawable; +typedef XID GLXPbuffer; +typedef XID GLXWindow; +typedef XID GLXFBConfigID; + +typedef struct __GLXcontextRec *GLXContext; + +typedef struct __GLXFBConfigRec *GLXFBConfig; + +typedef GLXFBConfig * (APIENTRY * glXGetFBConfigsPROC) (Display *dpy, int screen, int *nelements); +typedef GLXFBConfig * (APIENTRY * glXChooseFBConfigPROC) (Display *dpy, int screen, const int *attrib_list, int *nelements); +typedef int (APIENTRY * glXGetFBConfigAttribPROC) (Display *dpy, GLXFBConfig config, int attribute, int *value); +typedef XVisualInfo * (APIENTRY * glXGetVisualFromFBConfigPROC) (Display *dpy, GLXFBConfig config); +typedef GLXWindow (APIENTRY * glXCreateWindowPROC) (Display *dpy, GLXFBConfig config, Window win, const int *attrib_list); +typedef void (APIENTRY * glXDestroyWindowPROC) (Display *dpy, GLXWindow win); +typedef GLXPixmap (APIENTRY * glXCreatePixmapPROC) (Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attrib_list); +typedef void (APIENTRY * glXDestroyPixmapPROC) (Display *dpy, GLXPixmap pixmap); +typedef GLXPbuffer (APIENTRY * glXCreatePbufferPROC) (Display *dpy, GLXFBConfig config, const int *attrib_list); +typedef void (APIENTRY * glXDestroyPbufferPROC) (Display *dpy, GLXPbuffer pbuf); +typedef void (APIENTRY * glXQueryDrawablePROC) (Display *dpy, GLXDrawable draw, int attribute, unsigned int *value); +typedef GLXContext (APIENTRY * glXCreateNewContextPROC) (Display *dpy, GLXFBConfig config, int render_type, GLXContext share_list, Bool direct); +typedef Bool (APIENTRY * glXMakeContextCurrentPROC) (Display *display, GLXDrawable draw, GLXDrawable read, GLXContext ctx); +typedef GLXDrawable (APIENTRY * glXGetCurrentReadDrawablePROC) (void); +typedef Display * (APIENTRY * glXGetCurrentDisplayPROC) (void); +typedef int (APIENTRY * glXQueryContextPROC) (Display *dpy, GLXContext ctx, int attribute, int *value); +typedef void (APIENTRY * glXSelectEventPROC) (Display *dpy, GLXDrawable draw, unsigned long event_mask); +typedef void (APIENTRY * glXGetSelectedEventPROC) (Display *dpy, GLXDrawable draw, unsigned long *event_mask); + +typedef GLXContextID (APIENTRY * glXGetContextIDEXTPROC) (const GLXContext ctx); +typedef GLXDrawable (APIENTRY * glXGetCurrentDrawableEXTPROC) (void); +typedef GLXContext (APIENTRY * glXImportContextEXTPROC) (Display *dpy, GLXContextID contextID); +typedef void (APIENTRY * glXFreeContextEXTPROC) (Display *dpy, GLXContext ctx); +typedef int (APIENTRY * glXQueryContextInfoEXTPROC) (Display *dpy, GLXContext ctx, int attribute, int *value); + +typedef XVisualInfo* (APIENTRY * glXChooseVisualPROC) (Display *dpy, int screen, int *attribList); +typedef void (APIENTRY * glXCopyContextPROC) (Display *dpy, GLXContext src, GLXContext dst, unsigned long mask); +typedef GLXContext (APIENTRY * glXCreateContextPROC) (Display *dpy, XVisualInfo *vis, GLXContext shareList, Bool direct); +typedef GLXPixmap (APIENTRY * glXCreateGLXPixmapPROC) (Display *dpy, XVisualInfo *vis, Pixmap pixmap); +typedef void (APIENTRY * glXDestroyContextPROC) (Display *dpy, GLXContext ctx); +typedef void (APIENTRY * glXDestroyGLXPixmapPROC) (Display *dpy, GLXPixmap pix); +typedef int (APIENTRY * glXGetConfigPROC) (Display *dpy, XVisualInfo *vis, int attrib, int *value); +typedef GLXContext (APIENTRY * glXGetCurrentContextPROC) (void); +typedef GLXDrawable (APIENTRY * glXGetCurrentDrawablePROC) (void); +typedef Bool (APIENTRY * glXIsDirectPROC) (Display *dpy, GLXContext ctx); +typedef Bool (APIENTRY * glXMakeCurrentPROC) (Display *dpy, GLXDrawable drawable, GLXContext ctx); +typedef Bool (APIENTRY * glXQueryExtensionPROC) (Display *dpy, int *errorBase, int *eventBase); +typedef Bool (APIENTRY * glXQueryVersionPROC) (Display *dpy, int *major, int *minor); +typedef void (APIENTRY * glXSwapBuffersPROC) (Display *dpy, GLXDrawable drawable); +typedef void (APIENTRY * glXUseXFontPROC) (Font font, int first, int count, int listBase); +typedef void (APIENTRY * glXWaitGLPROC) (void); +typedef void (APIENTRY * glXWaitXPROC) (void); +typedef const char * (APIENTRY * glXGetClientStringPROC) (Display *dpy, int name ); +typedef const char * (APIENTRY * glXQueryServerStringPROC) (Display *dpy, int screen, int name ); +typedef const char * (APIENTRY * glXQueryExtensionsStringPROC) (Display *dpy, int screen ); + +/* GLX_SGI_swap_control */ +typedef void (APIENTRY * glXSwapIntervalSGIPROC)(int interval); + +/* GLX_EXT_swap_control */ +typedef void (APIENTRY * glXSwapIntervalEXTPROC)(Display *dpy, GLXDrawable drawable, int interval); + +/* GLX_ARB_create_context */ +typedef GLXContext (APIENTRY * glXCreateContextAttribsARBPROC) (Display *dpy, GLXFBConfig config, GLXContext share_context, Bool direct, const int *attrib_list); + +/* GLX_NV_present_video */ +typedef unsigned int * (APIENTRY * glXEnumerateVideoDevicesNVPROC) (Display *dpy, int screen, int *nelements); +typedef int (APIENTRY * glXBindVideoDeviceNVPROC) (Display *dpy, unsigned int video_slot, unsigned int video_device, const int *attrib_list); + +/* GLX_NV_video_capture */ +typedef XID GLXVideoCaptureDeviceNV; +typedef int (APIENTRY * glXBindVideoCaptureDeviceNVPROC) (Display *dpy, unsigned int video_capture_slot, GLXVideoCaptureDeviceNV device); +typedef GLXVideoCaptureDeviceNV * (APIENTRY * glXEnumerateVideoCaptureDevicesNVPROC) (Display *dpy, int screen, int *nelements); +typedef void (APIENTRY * glXLockVideoCaptureDeviceNVPROC) (Display *dpy, GLXVideoCaptureDeviceNV device); +typedef int (APIENTRY * glXQueryVideoCaptureDeviceNVPROC) (Display *dpy, GLXVideoCaptureDeviceNV device, int attribute, int *value); +typedef void (APIENTRY * glXReleaseVideoCaptureDeviceNVPROC) (Display *dpy, GLXVideoCaptureDeviceNV device); + +typedef struct { + bool GLX12; + bool GLX13; + bool GLX14; +/* bool GLX_EXT_visual_info; + bool GLX_EXT_visual_rating;*/ + bool GLX_SGI_swap_control; + bool GLX_EXT_swap_control; + bool GLX_ARB_multisample; + bool GLX_ARB_fbconfig_float; + bool GLX_EXT_fbconfig_packed_float; + bool GLX_ARB_framebuffer_sRGB; + bool GLX_ARB_create_context; + bool GLX_NV_multisample_coverage; + bool GLX_NV_present_video; + bool GLX_NV_video_capture; +} GLXExtensions; + +/* Add _ to global symbols to avoid symbol clash with the OpenGL library */ +extern glXGetFBConfigsPROC lwjgl_glXGetFBConfigs; +extern glXChooseFBConfigPROC lwjgl_glXChooseFBConfig; +extern glXGetFBConfigAttribPROC lwjgl_glXGetFBConfigAttrib; +extern glXGetVisualFromFBConfigPROC lwjgl_glXGetVisualFromFBConfig; +extern glXCreateWindowPROC lwjgl_glXCreateWindow; +extern glXDestroyWindowPROC lwjgl_glXDestroyWindow; +extern glXCreatePixmapPROC lwjgl_glXCreatePixmap; +extern glXDestroyPixmapPROC lwjgl_glXDestroyPixmap; +extern glXCreatePbufferPROC lwjgl_glXCreatePbuffer; +extern glXDestroyPbufferPROC lwjgl_glXDestroyPbuffer; +extern glXQueryDrawablePROC lwjgl_glXQueryDrawable; +extern glXCreateNewContextPROC lwjgl_glXCreateNewContext; +extern glXMakeContextCurrentPROC lwjgl_glXMakeContextCurrent; +extern glXGetCurrentReadDrawablePROC lwjgl_glXGetCurrentReadDrawable; +extern glXGetCurrentDisplayPROC lwjgl_glXGetCurrentDisplay; +extern glXQueryContextPROC lwjgl_glXQueryContext; +extern glXSelectEventPROC lwjgl_glXSelectEvent; +extern glXGetSelectedEventPROC lwjgl_glXGetSelectedEvent; + +extern glXChooseVisualPROC lwjgl_glXChooseVisual; +extern glXCopyContextPROC lwjgl_glXCopyContext; +extern glXCreateContextPROC lwjgl_glXCreateContext; +extern glXCreateGLXPixmapPROC lwjgl_glXCreateGLXPixmap; +extern glXDestroyContextPROC lwjgl_glXDestroyContext; +extern glXDestroyGLXPixmapPROC lwjgl_glXDestroyGLXPixmap; +extern glXGetConfigPROC lwjgl_glXGetConfig; +extern glXGetCurrentContextPROC lwjgl_glXGetCurrentContext; +extern glXGetCurrentDrawablePROC lwjgl_glXGetCurrentDrawable; +extern glXIsDirectPROC lwjgl_glXIsDirect; +extern glXMakeCurrentPROC lwjgl_glXMakeCurrent; +extern glXQueryExtensionPROC lwjgl_glXQueryExtension; +extern glXQueryVersionPROC lwjgl_glXQueryVersion; +extern glXSwapBuffersPROC lwjgl_glXSwapBuffers; +extern glXUseXFontPROC lwjgl_glXUseXFont; +extern glXWaitGLPROC lwjgl_glXWaitGL; +extern glXWaitXPROC lwjgl_glXWaitX; +extern glXGetClientStringPROC lwjgl_glXGetClientString; +extern glXQueryServerStringPROC lwjgl_glXQueryServerString; +extern glXQueryExtensionsStringPROC lwjgl_glXQueryExtensionsString; + +extern glXSwapIntervalSGIPROC lwjgl_glXSwapIntervalSGI; +extern glXSwapIntervalEXTPROC lwjgl_glXSwapIntervalEXT; + +extern glXCreateContextAttribsARBPROC lwjgl_glXCreateContextAttribsARB; + +/* GLX_NV_present_video */ +extern glXEnumerateVideoDevicesNVPROC lwjgl_glXEnumerateVideoDevicesNV; +extern glXBindVideoDeviceNVPROC lwjgl_glXBindVideoDeviceNV; + +/* GLX_NV_video_capture */ +extern glXBindVideoCaptureDeviceNVPROC lwjgl_glXBindVideoCaptureDeviceNV; +extern glXEnumerateVideoCaptureDevicesNVPROC lwjgl_glXEnumerateVideoCaptureDevicesNV; +extern glXLockVideoCaptureDeviceNVPROC lwjgl_glXLockVideoCaptureDeviceNV; +extern glXQueryVideoCaptureDeviceNVPROC lwjgl_glXQueryVideoCaptureDeviceNV; +extern glXReleaseVideoCaptureDeviceNVPROC lwjgl_glXReleaseVideoCaptureDeviceNV; + +extern bool extgl_InitGLX(Display *disp, int screen, GLXExtensions *extension_flags); + +#endif diff -Nru lwjgl-2.7.1+dfsg/src/native/linux/opengl/GLX.c lwjgl-2.9.3+dfsg/src/native/linux/opengl/GLX.c --- lwjgl-2.7.1+dfsg/src/native/linux/opengl/GLX.c 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/linux/opengl/GLX.c 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,121 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * GLX extension implementations. + * + * @author Spasi + */ +#include "GLX.h" + +/* NV_present_video functions */ + +typedef struct { + GLXExtensions extension_flags; + GLXContext context; +} X11Context; + +jint extgl_EnumerateVideoDevicesNV(JNIEnv *env, jobject peer_info_handle, jobject devices, jint devices_position) { + X11PeerInfo *peer_info = (*env)->GetDirectBufferAddress(env, peer_info_handle); + jlong *devices_address = ((jlong *)safeGetBufferAddress(env, devices)) + devices_position; + unsigned int *result; + int i, elements; + + result = lwjgl_glXEnumerateVideoDevicesNV(peer_info->display, peer_info->screen, &elements); + if ( devices_address != NULL ) { + for ( i = 0; i < elements; i++ ) + devices_address[i] = (jlong)result[i]; + } + XFree(result); + + return elements; +} + +jboolean extgl_BindVideoDeviceNV(JNIEnv *env, jobject peer_info_handle, jint video_slot, jlong video_device, jobject attrib_list, jint attrib_list_position) { + X11PeerInfo *peer_info = (*env)->GetDirectBufferAddress(env, peer_info_handle); + const int *attrib_list_address = ((const int *)safeGetBufferAddress(env, attrib_list)) + attrib_list_position; + + return lwjgl_glXBindVideoDeviceNV(peer_info->display, video_slot, (unsigned int)video_device, attrib_list_address); +} + +jboolean extgl_QueryContextNV(JNIEnv *env, jobject peer_info_handle, jobject context_handle, jint attrib, jobject value, jint value_position) { + X11PeerInfo *peer_info = (*env)->GetDirectBufferAddress(env, peer_info_handle); + X11Context *context_info = (*env)->GetDirectBufferAddress(env, context_handle); + int *value_address = ((int *)(*env)->GetDirectBufferAddress(env, value)) + value_position; + + return lwjgl_glXQueryContext(peer_info->display, context_info->context, attrib, value_address) == GLX_BAD_ATTRIBUTE ? 0 : 1; +} + +/* NV_video_capture functions */ + +jboolean extgl_BindVideoCaptureDeviceNV(JNIEnv *env, jobject peer_info_handle, jint video_slot, jlong device) { + X11PeerInfo *peer_info = (*env)->GetDirectBufferAddress(env, peer_info_handle); + + return lwjgl_glXBindVideoCaptureDeviceNV(peer_info->display, video_slot, (GLXVideoCaptureDeviceNV)device); +} + +jint extgl_EnumerateVideoCaptureDevicesNV(JNIEnv *env, jobject peer_info_handle, jobject devices, jint devices_position) { + X11PeerInfo *peer_info = (*env)->GetDirectBufferAddress(env, peer_info_handle); + jlong *devices_address = ((jlong *)safeGetBufferAddress(env, devices)) + devices_position; + GLXVideoCaptureDeviceNV *result; + int i, elements; + + result = lwjgl_glXEnumerateVideoCaptureDevicesNV(peer_info->display, peer_info->screen, &elements); + if ( devices_address != NULL ) { + for ( i = 0; i < elements; i++ ) + devices_address[i] = (jlong)result[i]; + } + XFree(devices); + + return elements; +} + +jboolean extgl_LockVideoCaptureDeviceNV(JNIEnv *env, jobject peer_info_handle, jlong device) { + X11PeerInfo *peer_info = (*env)->GetDirectBufferAddress(env, peer_info_handle); + + lwjgl_glXLockVideoCaptureDeviceNV(peer_info->display, (GLXVideoCaptureDeviceNV)device); + return true; +} + +jboolean extgl_QueryVideoCaptureDeviceNV(JNIEnv *env, jobject peer_info_handle, jlong device, jint attribute, jobject value, jint value_position) { + X11PeerInfo *peer_info = (*env)->GetDirectBufferAddress(env, peer_info_handle); + int *value_address = ((int *)(*env)->GetDirectBufferAddress(env, value)) + value_position; + + return lwjgl_glXQueryVideoCaptureDeviceNV(peer_info->display, (GLXVideoCaptureDeviceNV)device, attribute, value_address); +} + +jboolean extgl_ReleaseVideoCaptureDeviceNV(JNIEnv *env, jobject peer_info_handle, jlong device) { + X11PeerInfo *peer_info = (*env)->GetDirectBufferAddress(env, peer_info_handle); + + lwjgl_glXReleaseVideoCaptureDeviceNV(peer_info->display, (GLXVideoCaptureDeviceNV)device); + return true; +} diff -Nru lwjgl-2.7.1+dfsg/src/native/linux/opengl/GLX.h lwjgl-2.9.3+dfsg/src/native/linux/opengl/GLX.h --- lwjgl-2.7.1+dfsg/src/native/linux/opengl/GLX.h 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/linux/opengl/GLX.h 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * GLX extension implementations. + * + * @author Spasi + */ +#ifndef __LWJGL_GLX_H +#define __LWJGL_GLX_H + +#include +#include "common_tools.h" +#include "context.h" + +#include "extgl.h" +#include "extgl_glx.h" + +/* NV_present_video functions */ +extern jint extgl_EnumerateVideoDevicesNV(JNIEnv *env, jobject peer_info_handle, jobject devices, jint devices_position); +extern jboolean extgl_BindVideoDeviceNV(JNIEnv *env, jobject peer_info_handle, jint video_slot, jlong video_device, jobject attrib_list, jint attrib_list_position); +extern jboolean extgl_QueryContextNV(JNIEnv *env, jobject peer_info_handle, jobject context_handle, jint attrib, jobject value, jint value_position); + +/* NV_video_capture functions */ +extern jboolean extgl_BindVideoCaptureDeviceNV(JNIEnv *env, jobject peer_info_handle, jint video_slot, jlong device); +extern jint extgl_EnumerateVideoCaptureDevicesNV(JNIEnv *env, jobject peer_info_handle, jobject devices, jint devices_position); +extern jboolean extgl_LockVideoCaptureDeviceNV(JNIEnv *env, jobject peer_info_handle, jlong device); +extern jboolean extgl_QueryVideoCaptureDeviceNV(JNIEnv *env, jobject peer_info_handle, jlong device, jint attribute, jobject value, jint value_position); +extern jboolean extgl_ReleaseVideoCaptureDeviceNV(JNIEnv *env, jobject peer_info_handle, jlong device); + +#endif diff -Nru lwjgl-2.7.1+dfsg/src/native/linux/opengl/org_lwjgl_opengl_Display.c lwjgl-2.9.3+dfsg/src/native/linux/opengl/org_lwjgl_opengl_Display.c --- lwjgl-2.7.1+dfsg/src/native/linux/opengl/org_lwjgl_opengl_Display.c 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/linux/opengl/org_lwjgl_opengl_Display.c 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,680 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * $Id$ + * + * Linux specific display functions. + * + * @author elias_naur + * @version $Revision$ + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "common_tools.h" +#include "extgl.h" +#include "extgl_glx.h" +#include "context.h" +#include "org_lwjgl_opengl_LinuxDisplay.h" +#include "org_lwjgl_opengl_LinuxDisplayPeerInfo.h" +#include "org_lwjgl_LinuxSysImplementation.h" + +#define ERR_MSG_SIZE 1024 + +typedef struct { + unsigned long flags; + unsigned long functions; + unsigned long decorations; + long input_mode; + unsigned long status; +} MotifWmHints; + +#define MWM_HINTS_DECORATIONS (1L << 1) + +static GLXWindow glx_window = None; + +static Colormap cmap; +static int current_depth; + +static Visual *current_visual; + +static bool checkXError(JNIEnv *env, Display *disp) { + XSync(disp, False); + return (*env)->ExceptionCheck(env) == JNI_FALSE; +} + +static int global_error_handler(Display *disp, XErrorEvent *error) { + JNIEnv *env = getThreadEnv(); + if (env != NULL) { + jclass org_lwjgl_LinuxDisplay_class = (*env)->FindClass(env, "org/lwjgl/opengl/LinuxDisplay"); + if (org_lwjgl_LinuxDisplay_class == NULL) { + // Don't propagate error + (*env)->ExceptionClear(env); + return 0; + } + jmethodID handler_method = (*env)->GetStaticMethodID(env, org_lwjgl_LinuxDisplay_class, "globalErrorHandler", "(JJJJJJJ)I"); + if (handler_method == NULL) + return 0; + return (*env)->CallStaticIntMethod(env, org_lwjgl_LinuxDisplay_class, handler_method, (jlong)(intptr_t)disp, (jlong)(intptr_t)error, + (jlong)(intptr_t)error->display, (jlong)error->serial, (jlong)error->error_code, (jlong)error->request_code, (jlong)error->minor_code); + } else + return 0; +} + +static jlong openDisplay(JNIEnv *env) { + Display *display_connection = XOpenDisplay(NULL); + if (display_connection == NULL) { + throwException(env, "Could not open X display connection"); + return (intptr_t)NULL; + } + return (intptr_t)display_connection; +} + +JNIEXPORT jint JNICALL Java_org_lwjgl_DefaultSysImplementation_getJNIVersion + (JNIEnv *env, jobject ignored) { + return org_lwjgl_LinuxSysImplementation_JNI_VERSION; +} + +JNIEXPORT jstring JNICALL Java_org_lwjgl_opengl_LinuxDisplay_getErrorText(JNIEnv *env, jclass unused, jlong display_ptr, jlong error_code) { + Display *disp = (Display *)(intptr_t)display_ptr; + char err_msg_buffer[ERR_MSG_SIZE]; + XGetErrorText(disp, error_code, err_msg_buffer, ERR_MSG_SIZE); + err_msg_buffer[ERR_MSG_SIZE - 1] = '\0'; + return NewStringNativeWithLength(env, err_msg_buffer, strlen(err_msg_buffer)); +} + +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_callErrorHandler(JNIEnv *env, jclass unused, jlong handler_ptr, jlong display_ptr, jlong event_ptr) { + XErrorHandler handler = (XErrorHandler)(intptr_t)handler_ptr; + Display *disp = (Display *)(intptr_t)display_ptr; + XErrorEvent *event = (XErrorEvent *)(intptr_t)event_ptr; + return (jint)handler(disp, event); +} + +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxDisplay_setErrorHandler(JNIEnv *env, jclass unused) { + return (intptr_t)XSetErrorHandler(global_error_handler); +} + +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxDisplay_resetErrorHandler(JNIEnv *env, jclass unused, jlong handler_ptr) { + XErrorHandler handler = (XErrorHandler)(intptr_t)handler_ptr; + return (intptr_t)XSetErrorHandler(handler); +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nSync(JNIEnv *env, jclass unused, jlong display_ptr, jboolean throw_away_events) { + Display *disp = (Display *)(intptr_t)display_ptr; + XSync(disp, throw_away_events ? True : False); +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_sync(JNIEnv *env, jclass unused, jlong display_ptr, jboolean throw_away_events) { + Display *disp = (Display *)(intptr_t)display_ptr; + XSync(disp, throw_away_events ? True : False); +} + +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetDefaultScreen(JNIEnv *env, jclass unused, jlong display_ptr) { + Display *disp = (Display *)(intptr_t)display_ptr; + return XDefaultScreen(disp); +} + +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nInternAtom(JNIEnv *env, jclass unused, jlong display_ptr, jstring atom_name_obj, jboolean only_if_exists) { + Display *disp = (Display *)(intptr_t)display_ptr; + char *atom_name = GetStringNativeChars(env, atom_name_obj); + if (atom_name == NULL) + return 0; + Atom atom = XInternAtom(disp, atom_name, only_if_exists ? True : False); + free(atom_name); + return atom; +} + +static void setDecorations(Display *disp, Window window, int dec) { + Atom motif_hints_atom = XInternAtom(disp, "_MOTIF_WM_HINTS", False); + MotifWmHints motif_hints; + motif_hints.flags = MWM_HINTS_DECORATIONS; + motif_hints.decorations = dec; + XChangeProperty(disp, window, motif_hints_atom, motif_hints_atom, 32, PropModeReplace, (unsigned char *)&motif_hints, sizeof(MotifWmHints)/sizeof(long)); +} + +static bool isLegacyFullscreen(jint window_mode) { + return window_mode == org_lwjgl_opengl_LinuxDisplay_FULLSCREEN_LEGACY; +} + +static void setWindowTitle(Display *disp, Window window, jlong title, jint len) { + Atom UTF8_STRING = XInternAtom(disp, "UTF8_STRING", True); + Atom _NET_WM_NAME = XInternAtom(disp, "_NET_WM_NAME", True); + Atom _NET_WM_ICON_NAME = XInternAtom(disp, "_NET_WM_ICON_NAME", True); + + // ASCII fallback if XChangeProperty fails. + XmbSetWMProperties(disp, window, (const char *)(intptr_t)title, (const char *)(intptr_t)title, NULL, 0, NULL, NULL, NULL); + + // Set the UTF-8 encoded title + if ( _NET_WM_NAME ) + XChangeProperty( + disp, window, _NET_WM_NAME, UTF8_STRING, + 8, PropModeReplace, (const unsigned char *)(intptr_t)title, len + ); + + if ( _NET_WM_ICON_NAME ) + XChangeProperty( + disp, window, _NET_WM_ICON_NAME, UTF8_STRING, + 8, PropModeReplace, (const unsigned char *)(intptr_t)title, len + ); +} + +static void setClassHint(Display *disp, Window window, jlong wm_name, jlong wm_class) { + XClassHint* hint = XAllocClassHint(); + + hint->res_name = (char *)(intptr_t)wm_name; + hint->res_class = (char *)(intptr_t)wm_class; + + XSetClassHint(disp, window, hint); + + XFree(hint); +} + +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxDisplay_openDisplay(JNIEnv *env, jclass clazz) { + return openDisplay(env); +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_closeDisplay(JNIEnv *env, jclass clazz, jlong display) { + Display *disp = (Display *)(intptr_t)display; + XCloseDisplay(disp); +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplayPeerInfo_initDrawable(JNIEnv *env, jclass clazz, jlong window, jobject peer_info_handle) { + X11PeerInfo *peer_info = (*env)->GetDirectBufferAddress(env, peer_info_handle); + if (peer_info->glx13) + peer_info->drawable = glx_window; + else + peer_info->drawable = window; +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplayPeerInfo_initDefaultPeerInfo(JNIEnv *env, jclass clazz, jlong display, jint screen, jobject peer_info_handle, jobject pixel_format) { + Display *disp = (Display *)(intptr_t)display; + initPeerInfo(env, peer_info_handle, disp, screen, pixel_format, true, GLX_WINDOW_BIT, true, false); +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nSetTitle(JNIEnv * env, jclass clazz, jlong display, jlong window_ptr, jlong title, jint len) { + Display *disp = (Display *)(intptr_t)display; + Window window = (Window)window_ptr; + setWindowTitle(disp, window, title, len); +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nSetClassHint(JNIEnv * env, jclass clazz, jlong display, jlong window_ptr, jlong wm_name, jlong wm_class) { + Display *disp = (Display *)(intptr_t)display; + Window window = (Window)window_ptr; + setClassHint(disp, window, wm_name, wm_class); +} + +static void destroyWindow(JNIEnv *env, Display *disp, Window window) { + if (glx_window != None) { + lwjgl_glXDestroyWindow(disp, glx_window); + glx_window = None; + } + XDestroyWindow(disp, window); + XFreeColormap(disp, cmap); +} + +static bool isNetWMFullscreenSupported(JNIEnv *env, Display *disp, int screen) { + unsigned long nitems; + Atom actual_type; + int actual_format; + unsigned long bytes_after; + Atom *supported_list; + Atom netwm_supported_atom = XInternAtom(disp, "_NET_SUPPORTED", False); + int result = XGetWindowProperty(disp, RootWindow(disp, screen), netwm_supported_atom, 0, 10000, False, AnyPropertyType, &actual_type, &actual_format, &nitems, &bytes_after, (void *)&supported_list); + if (result != Success) { + throwException(env, "Unable to query _NET_SUPPORTED window property"); + return false; + } + Atom fullscreen_atom = XInternAtom(disp, "_NET_WM_STATE_FULLSCREEN", False); + bool supported = false; + unsigned long i; + for (i = 0; i < nitems; i++) { + if (fullscreen_atom == supported_list[i]) { + supported = true; + break; + } + } + XFree(supported_list); + return supported; +} + +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nIsNetWMFullscreenSupported(JNIEnv *env, jclass unused, jlong display, jint screen) { + Display *disp = (Display *)(intptr_t)display; + return isNetWMFullscreenSupported(env, disp, screen) ? JNI_TRUE : JNI_FALSE; +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nReshape(JNIEnv *env, jclass clazz, jlong display, jlong window_ptr, jint x, jint y, jint width, jint height) { + Display *disp = (Display *)(intptr_t)display; + Window window = (Window)window_ptr; + XMoveWindow(disp, window, x, y); + XResizeWindow(disp, window, width, height); +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_synchronize(JNIEnv *env, jclass clazz, jlong display, jboolean synchronize) { + Display *disp = (Display *)(intptr_t)display; + XSynchronize(disp, synchronize ? True : False); +} + +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxDisplay_getRootWindow(JNIEnv *env, jclass clazz, jlong display, jint screen) { + Display *disp = (Display *)(intptr_t)display; + return RootWindow(disp, screen); +} + +static Window getCurrentWindow(JNIEnv *env, jlong display_ptr, jlong window_ptr) { + Display *disp = (Display *)(intptr_t)display_ptr; + + Window parent = (Window)window_ptr; + Window win, root; + + Window *children; + unsigned int nchildren; + + do { + win = parent; + + if (XQueryTree(disp, win, &root, &parent, &children, &nchildren) == 0) { + throwException(env, "XQueryTree failed"); + return 0; + } + + if (children != NULL) XFree(children); + } while (parent != root); + + return win; +} + +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetX(JNIEnv *env, jclass unused, jlong display_ptr, jlong window_ptr) { + Display *disp = (Display *)(intptr_t)display_ptr; + Window win = getCurrentWindow(env, display_ptr, window_ptr); + + XWindowAttributes win_attribs; + XGetWindowAttributes(disp, win, &win_attribs); + + return win_attribs.x; +} + +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetY(JNIEnv *env, jclass unused, jlong display_ptr, jlong window_ptr) { + Display *disp = (Display *)(intptr_t)display_ptr; + Window win = getCurrentWindow(env, display_ptr, window_ptr); + + XWindowAttributes win_attribs; + XGetWindowAttributes(disp, win, &win_attribs); + + return win_attribs.y; +} + +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetWidth(JNIEnv *env, jclass unused, jlong display_ptr, jlong window_ptr) { + Display *disp = (Display *)(intptr_t)display_ptr; + Window win = (Window)window_ptr; + XWindowAttributes win_attribs; + + XGetWindowAttributes(disp, win, &win_attribs); + + return win_attribs.width; +} + +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetHeight(JNIEnv *env, jclass unused, jlong display_ptr, jlong window_ptr) { + Display *disp = (Display *)(intptr_t)display_ptr; + Window win = (Window)window_ptr; + XWindowAttributes win_attribs; + + XGetWindowAttributes(disp, win, &win_attribs); + + return win_attribs.height; +} + +static void updateWindowHints(JNIEnv *env, Display *disp, Window window) { + XWMHints* win_hints = XAllocWMHints(); + if (win_hints == NULL) { + throwException(env, "XAllocWMHints failed"); + return; + } + + win_hints->flags = InputHint; + win_hints->input = True; + + XSetWMHints(disp, window, win_hints); + XFree(win_hints); + XFlush(disp); +} + +static void updateWindowBounds(Display *disp, Window win, int x, int y, int width, int height, jboolean position, jboolean resizable) { + XSizeHints *window_hints = XAllocSizeHints(); + + if (position) { + window_hints->flags |= PPosition; + window_hints->x = x; + window_hints->y = y; + } + + if (!resizable) { + window_hints->flags |= PMinSize | PMaxSize; + window_hints->min_width = width; + window_hints->max_width = width; + window_hints->min_height = height; + window_hints->max_height = height; + } + + XSetWMNormalHints(disp, win, window_hints); + XFree(window_hints); +} + +static Window createWindow(JNIEnv* env, Display *disp, int screen, jint window_mode, X11PeerInfo *peer_info, int x, int y, int width, int height, jboolean undecorated, long parent_handle, jboolean resizable) { + Window parent = (Window)parent_handle; + Window win; + XSetWindowAttributes attribs; + int attribmask; + + XVisualInfo *vis_info = getVisualInfoFromPeerInfo(env, peer_info); + if (vis_info == NULL) + return false; + cmap = XCreateColormap(disp, parent, vis_info->visual, AllocNone); + attribs.colormap = cmap; + attribs.border_pixel = 0; + attribs.event_mask = ExposureMask | FocusChangeMask | VisibilityChangeMask | StructureNotifyMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | PointerMotionMask| EnterWindowMask | LeaveWindowMask; + attribmask = CWColormap | CWEventMask | CWBorderPixel; + if (isLegacyFullscreen(window_mode)) { + attribmask |= CWOverrideRedirect; + attribs.override_redirect = True; + } + win = XCreateWindow(disp, parent, x, y, width, height, 0, vis_info->depth, InputOutput, vis_info->visual, attribmask, &attribs); + + current_depth = vis_info->depth; + current_visual = vis_info->visual; + + XFree(vis_info); + if (!checkXError(env, disp)) { + XFreeColormap(disp, cmap); + return false; + } +// printfDebugJava(env, "Created window"); + if (undecorated) { + // Use Motif decoration hint property and hope the window manager respects them + setDecorations(disp, win, 0); + } + + if (RootWindow(disp, screen) == parent_handle) { // only set hints when Display.setParent isn't used + updateWindowBounds(disp, win, x, y, width, height, JNI_TRUE, resizable); + updateWindowHints(env, disp, win); + } + +#define NUM_ATOMS 1 + Atom protocol_atoms[NUM_ATOMS] = {XInternAtom(disp, "WM_DELETE_WINDOW", False)/*, XInternAtom(disp, "WM_TAKE_FOCUS", False)*/}; + XSetWMProtocols(disp, win, protocol_atoms, NUM_ATOMS); + if (window_mode == org_lwjgl_opengl_LinuxDisplay_FULLSCREEN_NETWM) { + Atom fullscreen_atom = XInternAtom(disp, "_NET_WM_STATE_FULLSCREEN", False); + XChangeProperty(disp, win, XInternAtom(disp, "_NET_WM_STATE", False), + XInternAtom(disp, "ATOM", False), 32, PropModeReplace, (const unsigned char*)&fullscreen_atom, 1); + } + if (!checkXError(env, disp)) { + destroyWindow(env, disp, win); + return 0; + } + return win; +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_reparentWindow(JNIEnv *env, jclass unused, jlong display, jlong window_ptr, jlong parent_ptr, jint x, jint y) { + Display *disp = (Display *)(intptr_t)display; + Window window = (Window)window_ptr; + Window parent = (Window)parent_ptr; + XReparentWindow(disp, window, parent, x, y); +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_mapRaised(JNIEnv *env, jclass unused, jlong display, jlong window_ptr) { + Display *disp = (Display *)(intptr_t)display; + Window window = (Window)window_ptr; + XMapRaised(disp, window); +} + +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxDisplay_getParentWindow(JNIEnv *env, jclass unused, jlong display, jlong window_ptr) { + Display *disp = (Display *)(intptr_t)display; + Window window = (Window)window_ptr; + Window root, parent; + Window *children; + unsigned int nchildren; + if (XQueryTree(disp, window, &root, &parent, &children, &nchildren) == 0) { + throwException(env, "XQueryTree failed"); + return None; + } + if (children != NULL) + XFree(children); + return parent; +} + +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_getChildCount(JNIEnv *env, jclass unused, jlong display, jlong window_ptr) { + Display *disp = (Display *)(intptr_t)display; + Window window = (Window)window_ptr; + Window root, parent; + Window *children; + unsigned int nchildren; + if (XQueryTree(disp, window, &root, &parent, &children, &nchildren) == 0) { + throwException(env, "XQueryTree failed"); + return None; + } + if (children != NULL) + XFree(children); + + return nchildren; +} + +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_LinuxDisplay_hasProperty(JNIEnv *env, jclass unusued, jlong display, jlong window_ptr, jlong property_ptr) { + Display *disp = (Display *)(intptr_t)display; + Window window = (Window)window_ptr; + Atom property = (Atom)property_ptr; + int num_props; + Atom *properties = XListProperties(disp, window, &num_props); + if (properties == NULL) + return JNI_FALSE; + jboolean result = JNI_FALSE; + for (int i = 0; i < num_props; i++) { + if (properties[i] == property) { + result = JNI_TRUE; + break; + } + } + XFree(properties); + return result; +} + +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetInputFocus(JNIEnv *env, jclass unused, jlong display_ptr) { + Display *disp = (Display *)(intptr_t)display_ptr; + int revert_mode; + Window win; + XGetInputFocus(disp, &win, &revert_mode); + return win; +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nSetInputFocus(JNIEnv *env, jclass clazz, jlong display, jlong window_ptr, jlong time) { + Display *disp = (Display *)(intptr_t)display; + Window window = (Window)window_ptr; + XSetInputFocus(disp, window, RevertToParent, time); +} + +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nCreateWindow(JNIEnv *env, jclass clazz, jlong display, jint screen, jobject peer_info_handle, jobject mode, jint window_mode, jint x, jint y, jboolean undecorated, jlong parent_handle, jboolean resizable) { + Display *disp = (Display *)(intptr_t)display; + X11PeerInfo *peer_info = (*env)->GetDirectBufferAddress(env, peer_info_handle); + GLXFBConfig *fb_config = NULL; + if (peer_info->glx13) { + fb_config = getFBConfigFromPeerInfo(env, peer_info); + if (fb_config == NULL) + return 0; + } + jclass cls_displayMode = (*env)->GetObjectClass(env, mode); + jfieldID fid_width = (*env)->GetFieldID(env, cls_displayMode, "width", "I"); + jfieldID fid_height = (*env)->GetFieldID(env, cls_displayMode, "height", "I"); + int width = (*env)->GetIntField(env, mode, fid_width); + int height = (*env)->GetIntField(env, mode, fid_height); + Window win = createWindow(env, disp, screen, window_mode, peer_info, x, y, width, height, undecorated, parent_handle, resizable); + if ((*env)->ExceptionOccurred(env)) { + return 0; + } + if (peer_info->glx13) { + glx_window = lwjgl_glXCreateWindow(disp, *fb_config, win, NULL); + XFree(fb_config); + } + if (!checkXError(env, disp)) { + lwjgl_glXDestroyWindow(disp, glx_window); + destroyWindow(env, disp, win); + } + return win; +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nSetWindowSize(JNIEnv *env, jclass clazz, jlong display, jlong window_ptr, jint width, jint height, jboolean resizable) { + Display *disp = (Display *)(intptr_t)display; + Window win = (Window)window_ptr; + updateWindowBounds(disp, win, 0, 0, width, height, JNI_FALSE, resizable); +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nDestroyWindow(JNIEnv *env, jclass clazz, jlong display, jlong window_ptr) { + Display *disp = (Display *)(intptr_t)display; + Window window = (Window)window_ptr; + destroyWindow(env, disp, window); +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nLockAWT(JNIEnv *env, jclass clazz) { + JAWT jawt; + jawt.version = JAWT_VERSION_1_4; + if (JAWT_GetAWT(env, &jawt) != JNI_TRUE) { + throwException(env, "GetAWT failed"); + return; + } + jawt.Lock(env); +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nUnlockAWT(JNIEnv *env, jclass clazz) { + JAWT jawt; + jawt.version = JAWT_VERSION_1_4; + if (JAWT_GetAWT(env, &jawt) != JNI_TRUE) { + throwException(env, "GetAWT failed"); + return; + } + jawt.Unlock(env); +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nSetWindowIcon + (JNIEnv *env, jclass clazz, jlong display, jlong window_ptr, jobject icons_buffer, jint icons_buffer_size) +{ + Display *disp = (Display *)(intptr_t)display; + Window window = (Window)window_ptr; + const unsigned char *icons_char_buffer = (const unsigned char *)(*env)->GetDirectBufferAddress(env, icons_buffer); + + int length = icons_buffer_size/4; + unsigned long icons_long_buffer[length]; + int i = 0; + + // copy byte array to long array + for (i = 0; i < icons_buffer_size; i += 4) { + unsigned long argb = (icons_char_buffer[i] << 24) | + (icons_char_buffer[i+1] << 16) | + (icons_char_buffer[i+2] << 8) | + (icons_char_buffer[i+3]); + icons_long_buffer[i/4] = argb; + } + + XChangeProperty(disp, window, + XInternAtom(disp, "_NET_WM_ICON", False), + XInternAtom(disp, "CARDINAL", False), + 32, PropModeReplace, (const unsigned char*) icons_long_buffer, length); +} + +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nUngrabKeyboard(JNIEnv *env, jclass unused, jlong display_ptr) { + Display *disp = (Display *)(intptr_t)display_ptr; + return XUngrabKeyboard(disp, CurrentTime); +} + +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGrabKeyboard(JNIEnv *env, jclass unused, jlong display_ptr, jlong window_ptr) { + Display *disp = (Display *)(intptr_t)display_ptr; + Window win = (Window)window_ptr; + return XGrabKeyboard(disp, win, False, GrabModeAsync, GrabModeAsync, CurrentTime); +} + +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGrabPointer(JNIEnv *env, jclass unused, jlong display_ptr, jlong window_ptr, jlong cursor_ptr) { + Display *disp = (Display *)(intptr_t)display_ptr; + Window win = (Window)window_ptr; + Cursor cursor = (Cursor)cursor_ptr; + int grab_mask = PointerMotionMask | ButtonPressMask | ButtonReleaseMask; + return XGrabPointer(disp, win, False, grab_mask, GrabModeAsync, GrabModeAsync, win, cursor, CurrentTime); +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nSetViewPort(JNIEnv *env, jclass unused, jlong display_ptr, jlong window_ptr, jint screen) { + Display *disp = (Display *)(intptr_t)display_ptr; + Window win = (Window)window_ptr; + XWindowAttributes win_attribs; + + XGetWindowAttributes(disp, win, &win_attribs); + XF86VidModeSetViewPort(disp, screen, win_attribs.x, win_attribs.y); +} + +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nUngrabPointer(JNIEnv *env, jclass unused, jlong display_ptr) { + Display *disp = (Display *)(intptr_t)display_ptr; + return XUngrabPointer(disp, CurrentTime); +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nDefineCursor(JNIEnv *env, jclass unused, jlong display_ptr, jlong window_ptr, jlong cursor_ptr) { + Display *disp = (Display *)(intptr_t)display_ptr; + Window win = (Window)window_ptr; + Cursor cursor = (Cursor)cursor_ptr; + XDefineCursor(disp, win, cursor); +} + +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nCreateBlankCursor(JNIEnv *env, jclass unused, jlong display_ptr, jlong window_ptr) { + Display *disp = (Display *)(intptr_t)display_ptr; + Window win = (Window)window_ptr; + unsigned int best_width, best_height; + if (XQueryBestCursor(disp, win, 1, 1, &best_width, &best_height) == 0) { + throwException(env, "Could not query best cursor size"); + return false; + } + Pixmap mask = XCreatePixmap(disp, win, best_width, best_height, 1); + XGCValues gc_values; + gc_values.foreground = 0; + GC gc = XCreateGC(disp, mask, GCForeground, &gc_values); + XFillRectangle(disp, mask, gc, 0, 0, best_width, best_height); + XFreeGC(disp, gc); + XColor dummy_color; + Cursor cursor = XCreatePixmapCursor(disp, mask, mask, &dummy_color, &dummy_color, 0, 0); + XFreePixmap(disp, mask); + return cursor; +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nIconifyWindow(JNIEnv *env, jclass unused, jlong display_ptr, jlong window_ptr, jint screen) { + Display *disp = (Display *)(intptr_t)display_ptr; + Window win = (Window)window_ptr; + XIconifyWindow(disp, win, screen); +} diff -Nru lwjgl-2.7.1+dfsg/src/native/linux/opengl/org_lwjgl_opengl_LinuxAWTGLCanvasPeerInfo.c lwjgl-2.9.3+dfsg/src/native/linux/opengl/org_lwjgl_opengl_LinuxAWTGLCanvasPeerInfo.c --- lwjgl-2.7.1+dfsg/src/native/linux/opengl/org_lwjgl_opengl_LinuxAWTGLCanvasPeerInfo.c 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/linux/opengl/org_lwjgl_opengl_LinuxAWTGLCanvasPeerInfo.c 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * $Id$ + * + * @author elias_naur + * @version $Revision$ + */ + +#include +#include +#include +#include +#include +#include "awt_tools.h" +#include "org_lwjgl_opengl_LinuxAWTGLCanvasPeerInfo.h" +#include "context.h" + +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxAWTGLCanvasPeerInfo_getScreenFromSurfaceInfo + (JNIEnv *env, jclass clazz, jobject lock_buffer_handle) { + const AWTSurfaceLock *awt_lock = (AWTSurfaceLock *)(*env)->GetDirectBufferAddress(env, lock_buffer_handle); + // Get the platform-specific drawing info + JAWT_X11DrawingSurfaceInfo *dsi_x11 = (JAWT_X11DrawingSurfaceInfo*)awt_lock->dsi->platformInfo; + + XVisualInfo template; + int num_infos; + template.visualid = dsi_x11->visualID; + template.depth = dsi_x11->depth; + XVisualInfo *vis_info = XGetVisualInfo(dsi_x11->display, VisualIDMask | VisualDepthMask, &template, &num_infos); + if (vis_info == NULL) { + throwException(env, "Could not determine screen"); + return -1; + } + int screen = vis_info[0].screen; + XFree(vis_info); + return screen; +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxAWTGLCanvasPeerInfo_nInitHandle + (JNIEnv *env, jclass clazz, int screen, jobject lock_buffer_handle, jobject peer_info_handle) { + const AWTSurfaceLock *awt_lock = (AWTSurfaceLock *)(*env)->GetDirectBufferAddress(env, lock_buffer_handle); + X11PeerInfo *peer_info = (X11PeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); + // Get the platform-specific drawing info + JAWT_X11DrawingSurfaceInfo *dsi_x11 = (JAWT_X11DrawingSurfaceInfo*)awt_lock->dsi->platformInfo; + + peer_info->display = dsi_x11->display; + peer_info->screen = screen; + peer_info->drawable = dsi_x11->drawable; + peer_info->glx13 = false; + peer_info->config.glx_config.visualid = dsi_x11->visualID; + peer_info->config.glx_config.depth = dsi_x11->depth; +} diff -Nru lwjgl-2.7.1+dfsg/src/native/linux/opengl/org_lwjgl_opengl_LinuxAWTGLCanvasPeerInfo.h lwjgl-2.9.3+dfsg/src/native/linux/opengl/org_lwjgl_opengl_LinuxAWTGLCanvasPeerInfo.h --- lwjgl-2.7.1+dfsg/src/native/linux/opengl/org_lwjgl_opengl_LinuxAWTGLCanvasPeerInfo.h 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/linux/opengl/org_lwjgl_opengl_LinuxAWTGLCanvasPeerInfo.h 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,29 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_lwjgl_opengl_LinuxAWTGLCanvasPeerInfo */ + +#ifndef _Included_org_lwjgl_opengl_LinuxAWTGLCanvasPeerInfo +#define _Included_org_lwjgl_opengl_LinuxAWTGLCanvasPeerInfo +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: org_lwjgl_opengl_LinuxAWTGLCanvasPeerInfo + * Method: getScreenFromSurfaceInfo + * Signature: (Ljava/nio/ByteBuffer;)I + */ +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxAWTGLCanvasPeerInfo_getScreenFromSurfaceInfo + (JNIEnv *, jclass, jobject); + +/* + * Class: org_lwjgl_opengl_LinuxAWTGLCanvasPeerInfo + * Method: nInitHandle + * Signature: (ILjava/nio/ByteBuffer;Ljava/nio/ByteBuffer;)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxAWTGLCanvasPeerInfo_nInitHandle + (JNIEnv *, jclass, jint, jobject, jobject); + +#ifdef __cplusplus +} +#endif +#endif diff -Nru lwjgl-2.7.1+dfsg/src/native/linux/opengl/org_lwjgl_opengl_LinuxCanvasImplementation.c lwjgl-2.9.3+dfsg/src/native/linux/opengl/org_lwjgl_opengl_LinuxCanvasImplementation.c --- lwjgl-2.7.1+dfsg/src/native/linux/opengl/org_lwjgl_opengl_LinuxCanvasImplementation.c 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/linux/opengl/org_lwjgl_opengl_LinuxCanvasImplementation.c 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * $Id$ + * + * @author elias_naur + * @version $Revision$ + */ + +#include +#include +#include +#include +#include "org_lwjgl_opengl_LinuxCanvasImplementation.h" +#include "extgl_glx.h" +#include "context.h" + +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxCanvasImplementation_nFindVisualIDFromFormat + (JNIEnv *env, jclass clazz, jlong display, jint screen, jobject pixel_format) { + Display *disp = (Display *)(intptr_t)display; + GLXExtensions extension_flags; + if (!extgl_InitGLX(disp, screen, &extension_flags)) { + throwException(env, "Could not initialize GLX"); + return -1; + } + XVisualInfo *vis_info = chooseVisualGLX(env, disp, screen, pixel_format, true, true); + if (vis_info == NULL) { + throwException(env, "Could not choose a VisualInfo"); + return -1; + } + + VisualID vis_id = vis_info->visualid; + XFree(vis_info); + return vis_id; +} diff -Nru lwjgl-2.7.1+dfsg/src/native/linux/opengl/org_lwjgl_opengl_LinuxCanvasImplementation.h lwjgl-2.9.3+dfsg/src/native/linux/opengl/org_lwjgl_opengl_LinuxCanvasImplementation.h --- lwjgl-2.7.1+dfsg/src/native/linux/opengl/org_lwjgl_opengl_LinuxCanvasImplementation.h 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/linux/opengl/org_lwjgl_opengl_LinuxCanvasImplementation.h 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,21 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_lwjgl_opengl_LinuxCanvasImplementation */ + +#ifndef _Included_org_lwjgl_opengl_LinuxCanvasImplementation +#define _Included_org_lwjgl_opengl_LinuxCanvasImplementation +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: org_lwjgl_opengl_LinuxCanvasImplementation + * Method: nFindVisualIDFromFormat + * Signature: (JILorg/lwjgl/opengl/PixelFormat;)I + */ +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxCanvasImplementation_nFindVisualIDFromFormat + (JNIEnv *, jclass, jlong, jint, jobject); + +#ifdef __cplusplus +} +#endif +#endif diff -Nru lwjgl-2.7.1+dfsg/src/native/linux/opengl/org_lwjgl_opengl_LinuxContextImplementation.c lwjgl-2.9.3+dfsg/src/native/linux/opengl/org_lwjgl_opengl_LinuxContextImplementation.c --- lwjgl-2.7.1+dfsg/src/native/linux/opengl/org_lwjgl_opengl_LinuxContextImplementation.c 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/linux/opengl/org_lwjgl_opengl_LinuxContextImplementation.c 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,205 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * $Id$ + * + * @author elias_naur + * @version $Revision$ + */ + +#include +#include +#include +#include +#include "org_lwjgl_opengl_LinuxContextImplementation.h" +#include "extgl_glx.h" +#include "context.h" +#include "common_tools.h" + +typedef struct { + GLXExtensions extension_flags; + GLXContext context; +} X11Context; + +static bool checkContext(JNIEnv *env, Display *display, GLXContext context) { + if (context == NULL) { + throwException(env, "Could not create GLX context"); + return false; + } + /* + * Ditched the requirement that contexts have to be direct. It was + * never true that all accelerated contexts are direct, but it + * was a reasonable test until the appearance of Xgl and AIGLX. + * Now the test is at best useless, and at worst wrong, + * in case the current X server accelerates indirect rendering. + */ +/* jboolean allow_software_acceleration = getBooleanProperty(env, "org.lwjgl.opengl.Display.allowSoftwareOpenGL"); + if (!allow_software_acceleration && lwjgl_glXIsDirect(display, context) == False) { + lwjgl_glXDestroyContext(display, context); + throwException(env, "Could not create a direct GLX context"); + return false; + }*/ + return true; +} + +static void createContextGLX13(JNIEnv *env, X11PeerInfo *peer_info, X11Context *context_info, jobject attribs, GLXContext shared_context) { + GLXFBConfig *config = getFBConfigFromPeerInfo(env, peer_info); + if (config == NULL) + return; + GLXContext context; + if (attribs) { + const int *attrib_list = (const int *)(*env)->GetDirectBufferAddress(env, attribs); + context = lwjgl_glXCreateContextAttribsARB(peer_info->display, *config, shared_context, True, attrib_list); + } else { + int render_type; + if (lwjgl_glXGetFBConfigAttrib(peer_info->display, *config, GLX_RENDER_TYPE, &render_type) != 0) { + throwException(env, "Could not get GLX_RENDER_TYPE attribute"); + return; + } + int context_render_type = (render_type & GLX_RGBA_FLOAT_BIT) != 0 ? GLX_RGBA_FLOAT_TYPE : GLX_RGBA_TYPE; + context = lwjgl_glXCreateNewContext(peer_info->display, *config, context_render_type, shared_context, True); + } + XFree(config); + if (!checkContext(env, peer_info->display, context)) + return; + context_info->context = context; +} + +static void createContextGLX(JNIEnv *env, X11PeerInfo *peer_info, X11Context *context_info, GLXContext shared_context) { + XVisualInfo *vis_info = getVisualInfoFromPeerInfo(env, peer_info); + if (vis_info == NULL) + return; + GLXContext context = lwjgl_glXCreateContext(peer_info->display, vis_info, shared_context, True); + XFree(vis_info); + if (!checkContext(env, peer_info->display, context)) + return; + context_info->context = context; +} + +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxContextImplementation_getGLXContext(JNIEnv *env, jclass clazz, jobject context_handle) { + X11Context *context_info = (*env)->GetDirectBufferAddress(env, context_handle); + return (intptr_t)context_info->context; +} + +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxContextImplementation_getDisplay(JNIEnv *env, jclass clazz, jobject peer_info_handle) { + X11PeerInfo *peer_info = (*env)->GetDirectBufferAddress(env, peer_info_handle); + return (intptr_t)peer_info->display; +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxContextImplementation_nSetSwapInterval + (JNIEnv *env, jclass clazz, jobject peer_info_handle, jobject context_handle, jint value) +{ + X11PeerInfo *peer_info = (*env)->GetDirectBufferAddress(env, peer_info_handle); + X11Context *context_info = (*env)->GetDirectBufferAddress(env, context_handle); + + if (context_info->extension_flags.GLX_EXT_swap_control) { + lwjgl_glXSwapIntervalEXT(peer_info->display, peer_info->drawable, value); + } + else if (context_info->extension_flags.GLX_SGI_swap_control) { + lwjgl_glXSwapIntervalSGI(value); + } +} + +JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_LinuxContextImplementation_nCreate + (JNIEnv *env , jclass clazz, jobject peer_handle, jobject attribs, jobject shared_context_handle) { + jobject context_handle = newJavaManagedByteBuffer(env, sizeof(X11Context)); + if (context_handle == NULL) { + throwException(env, "Could not allocate handle buffer"); + return NULL; + } + X11PeerInfo *peer_info = (*env)->GetDirectBufferAddress(env, peer_handle); + X11Context *context_info = (*env)->GetDirectBufferAddress(env, context_handle); + GLXExtensions extension_flags; + if (!extgl_InitGLX(peer_info->display, peer_info->screen, &extension_flags)) { + throwException(env, "Could not initialize GLX"); + return NULL; + } + GLXContext shared_context = NULL; + if (shared_context_handle != NULL) { + X11Context *shared_context_info = (*env)->GetDirectBufferAddress(env, shared_context_handle); + shared_context = shared_context_info->context; + } + if (peer_info->glx13) { + createContextGLX13(env, peer_info, context_info, extension_flags.GLX_ARB_create_context ? attribs : NULL, shared_context); + } else { + createContextGLX(env, peer_info, context_info, shared_context); + } + context_info->extension_flags = extension_flags; + return context_handle; +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxContextImplementation_nDestroy + (JNIEnv *env, jclass clazz, jobject peer_handle, jobject context_handle) { + X11PeerInfo *peer_info = (*env)->GetDirectBufferAddress(env, peer_handle); + X11Context *context_info = (*env)->GetDirectBufferAddress(env, context_handle); + lwjgl_glXDestroyContext(peer_info->display, context_info->context); +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxContextImplementation_nReleaseCurrentContext + (JNIEnv *env , jclass clazz, jobject peer_info_handle) { + X11PeerInfo *peer_info = (*env)->GetDirectBufferAddress(env, peer_info_handle); + Bool result; + if (peer_info->glx13) { + result = lwjgl_glXMakeContextCurrent(peer_info->display, None, None, NULL); + } else { + result = lwjgl_glXMakeCurrent(peer_info->display, None, NULL); + } + if (!result) + throwException(env, "Could not release current context"); +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxContextImplementation_nMakeCurrent + (JNIEnv *env, jclass clazz, jobject peer_info_handle, jobject context_handle) { + X11PeerInfo *peer_info = (*env)->GetDirectBufferAddress(env, peer_info_handle); + X11Context *context_info = (*env)->GetDirectBufferAddress(env, context_handle); + Bool result; + if (peer_info->glx13) { + result = lwjgl_glXMakeContextCurrent(peer_info->display, peer_info->drawable, peer_info->drawable, context_info->context); + } else { + result = lwjgl_glXMakeCurrent(peer_info->display, peer_info->drawable, context_info->context); + } + if (!result) + throwException(env, "Could not make context current"); +} + +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_LinuxContextImplementation_nIsCurrent + (JNIEnv *env, jclass clazz, jobject context_handle) { + X11Context *context_info = (*env)->GetDirectBufferAddress(env, context_handle); + return context_info->context == lwjgl_glXGetCurrentContext(); +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxContextImplementation_nSwapBuffers + (JNIEnv *env, jclass clazz, jobject peer_info_handle) { + X11PeerInfo *peer_info = (*env)->GetDirectBufferAddress(env, peer_info_handle); + lwjgl_glXSwapBuffers(peer_info->display, peer_info->drawable); +} diff -Nru lwjgl-2.7.1+dfsg/src/native/linux/opengl/org_lwjgl_opengl_LinuxContextImplementation.h lwjgl-2.9.3+dfsg/src/native/linux/opengl/org_lwjgl_opengl_LinuxContextImplementation.h --- lwjgl-2.7.1+dfsg/src/native/linux/opengl/org_lwjgl_opengl_LinuxContextImplementation.h 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/linux/opengl/org_lwjgl_opengl_LinuxContextImplementation.h 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,85 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_lwjgl_opengl_LinuxContextImplementation */ + +#ifndef _Included_org_lwjgl_opengl_LinuxContextImplementation +#define _Included_org_lwjgl_opengl_LinuxContextImplementation +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: org_lwjgl_opengl_LinuxContextImplementation + * Method: nCreate + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;Ljava/nio/ByteBuffer;)Ljava/nio/ByteBuffer; + */ +JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_LinuxContextImplementation_nCreate + (JNIEnv *, jclass, jobject, jobject, jobject); + +/* + * Class: org_lwjgl_opengl_LinuxContextImplementation + * Method: getGLXContext + * Signature: (Ljava/nio/ByteBuffer;)J + */ +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxContextImplementation_getGLXContext + (JNIEnv *, jobject, jobject); + +/* + * Class: org_lwjgl_opengl_LinuxContextImplementation + * Method: getDisplay + * Signature: (Ljava/nio/ByteBuffer;)J + */ +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxContextImplementation_getDisplay + (JNIEnv *, jobject, jobject); + +/* + * Class: org_lwjgl_opengl_LinuxContextImplementation + * Method: nSwapBuffers + * Signature: (Ljava/nio/ByteBuffer;)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxContextImplementation_nSwapBuffers + (JNIEnv *, jclass, jobject); + +/* + * Class: org_lwjgl_opengl_LinuxContextImplementation + * Method: nReleaseCurrentContext + * Signature: (Ljava/nio/ByteBuffer;)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxContextImplementation_nReleaseCurrentContext + (JNIEnv *, jclass, jobject); + +/* + * Class: org_lwjgl_opengl_LinuxContextImplementation + * Method: nMakeCurrent + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/ByteBuffer;)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxContextImplementation_nMakeCurrent + (JNIEnv *, jclass, jobject, jobject); + +/* + * Class: org_lwjgl_opengl_LinuxContextImplementation + * Method: nIsCurrent + * Signature: (Ljava/nio/ByteBuffer;)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_LinuxContextImplementation_nIsCurrent + (JNIEnv *, jclass, jobject); + +/* + * Class: org_lwjgl_opengl_LinuxContextImplementation + * Method: nSetSwapInterval + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/ByteBuffer;I)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxContextImplementation_nSetSwapInterval + (JNIEnv *, jclass, jobject, jobject, jint); + +/* + * Class: org_lwjgl_opengl_LinuxContextImplementation + * Method: nDestroy + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/ByteBuffer;)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxContextImplementation_nDestroy + (JNIEnv *, jclass, jobject, jobject); + +#ifdef __cplusplus +} +#endif +#endif diff -Nru lwjgl-2.7.1+dfsg/src/native/linux/opengl/org_lwjgl_opengl_LinuxDisplayPeerInfo.h lwjgl-2.9.3+dfsg/src/native/linux/opengl/org_lwjgl_opengl_LinuxDisplayPeerInfo.h --- lwjgl-2.7.1+dfsg/src/native/linux/opengl/org_lwjgl_opengl_LinuxDisplayPeerInfo.h 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/linux/opengl/org_lwjgl_opengl_LinuxDisplayPeerInfo.h 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,29 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_lwjgl_opengl_LinuxDisplayPeerInfo */ + +#ifndef _Included_org_lwjgl_opengl_LinuxDisplayPeerInfo +#define _Included_org_lwjgl_opengl_LinuxDisplayPeerInfo +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: org_lwjgl_opengl_LinuxDisplayPeerInfo + * Method: initDefaultPeerInfo + * Signature: (JILjava/nio/ByteBuffer;Lorg/lwjgl/opengl/PixelFormat;)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplayPeerInfo_initDefaultPeerInfo + (JNIEnv *, jclass, jlong, jint, jobject, jobject); + +/* + * Class: org_lwjgl_opengl_LinuxDisplayPeerInfo + * Method: initDrawable + * Signature: (JLjava/nio/ByteBuffer;)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplayPeerInfo_initDrawable + (JNIEnv *, jclass, jlong, jobject); + +#ifdef __cplusplus +} +#endif +#endif diff -Nru lwjgl-2.7.1+dfsg/src/native/linux/opengl/org_lwjgl_opengl_LinuxPbufferPeerInfo.h lwjgl-2.9.3+dfsg/src/native/linux/opengl/org_lwjgl_opengl_LinuxPbufferPeerInfo.h --- lwjgl-2.7.1+dfsg/src/native/linux/opengl/org_lwjgl_opengl_LinuxPbufferPeerInfo.h 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/linux/opengl/org_lwjgl_opengl_LinuxPbufferPeerInfo.h 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,29 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_lwjgl_opengl_LinuxPbufferPeerInfo */ + +#ifndef _Included_org_lwjgl_opengl_LinuxPbufferPeerInfo +#define _Included_org_lwjgl_opengl_LinuxPbufferPeerInfo +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: org_lwjgl_opengl_LinuxPbufferPeerInfo + * Method: nInitHandle + * Signature: (JILjava/nio/ByteBuffer;IILorg/lwjgl/opengl/PixelFormat;)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxPbufferPeerInfo_nInitHandle + (JNIEnv *, jclass, jlong, jint, jobject, jint, jint, jobject); + +/* + * Class: org_lwjgl_opengl_LinuxPbufferPeerInfo + * Method: nDestroy + * Signature: (Ljava/nio/ByteBuffer;)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxPbufferPeerInfo_nDestroy + (JNIEnv *, jclass, jobject); + +#ifdef __cplusplus +} +#endif +#endif diff -Nru lwjgl-2.7.1+dfsg/src/native/linux/opengl/org_lwjgl_opengl_Pbuffer.c lwjgl-2.9.3+dfsg/src/native/linux/opengl/org_lwjgl_opengl_Pbuffer.c --- lwjgl-2.7.1+dfsg/src/native/linux/opengl/org_lwjgl_opengl_Pbuffer.c 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/linux/opengl/org_lwjgl_opengl_Pbuffer.c 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * $Id$ + * + * Linux Pbuffer. + * + * @author elias_naur + * @version $Revision$ + */ + +#include +#include "org_lwjgl_opengl_LinuxPbufferPeerInfo.h" +#include "org_lwjgl_opengl_Pbuffer.h" +#include "extgl.h" +#include "context.h" +#include "common_tools.h" + +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetPbufferCapabilities + (JNIEnv *env, jclass clazz, jlong display, jint screen) +{ + Display *disp = (Display *)(intptr_t)display; + GLXExtensions extension_flags; + if (!extgl_InitGLX(disp, screen, &extension_flags)) + return 0; + // Only support the GLX 1.3 Pbuffers and ignore the GLX_SGIX_pbuffer extension + return extension_flags.GLX13 ? org_lwjgl_opengl_Pbuffer_PBUFFER_SUPPORTED : 0; +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxPbufferPeerInfo_nInitHandle + (JNIEnv *env, jclass clazz, jlong display, jint screen, jobject peer_info_handle, jint width, jint height, jobject pixel_format) { + Display *disp = (Display *)(intptr_t)display; + GLXExtensions extension_flags; + if (!extgl_InitGLX(disp, screen, &extension_flags) || !extension_flags.GLX13) { + throwException(env, "No Pbuffer support"); + return; + } + bool result = initPeerInfo(env, peer_info_handle, disp, screen, pixel_format, false, GLX_PBUFFER_BIT, false, true); + if (!result) + return; + const int buffer_attribs[] = {GLX_PBUFFER_WIDTH, width, + GLX_PBUFFER_HEIGHT, height, + GLX_PRESERVED_CONTENTS, True, + GLX_LARGEST_PBUFFER, False, + None, None}; + + X11PeerInfo *peer_info = (X11PeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); + GLXFBConfig *config = getFBConfigFromPeerInfo(env, peer_info); + if (config != NULL) { + GLXPbuffer buffer = lwjgl_glXCreatePbuffer(peer_info->display, *config, buffer_attribs); + XFree(config); + peer_info->drawable = buffer; + } +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxPbufferPeerInfo_nDestroy + (JNIEnv *env, jclass clazz, jobject peer_info_handle) { + X11PeerInfo *peer_info = (X11PeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); + lwjgl_glXDestroyPbuffer(peer_info->display, peer_info->drawable); +} diff -Nru lwjgl-2.7.1+dfsg/src/native/linux/opengles/context.c lwjgl-2.9.3+dfsg/src/native/linux/opengles/context.c --- lwjgl-2.7.1+dfsg/src/native/linux/opengles/context.c 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/linux/opengles/context.c 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * $Id: context.c 3116 2008-08-19 16:46:03Z spasi $ + * + * Include file to access public window features + * + * @author elias_naur + * @version $Revision: 3116 $ + */ + +#include "context.h" + +bool initPeerInfo(JNIEnv *env, jobject peer_info_handle, Display *display, int screen) { + /* + if ((*env)->GetDirectBufferCapacity(env, peer_info_handle) < sizeof(X11PeerInfo)) { + throwException(env, "Handle too small"); + return false; + } + */ + X11PeerInfo *peer_info = (*env)->GetDirectBufferAddress(env, peer_info_handle); + + peer_info->display = display; + peer_info->screen = screen; + return true; +} diff -Nru lwjgl-2.7.1+dfsg/src/native/linux/opengles/context.h lwjgl-2.9.3+dfsg/src/native/linux/opengles/context.h --- lwjgl-2.7.1+dfsg/src/native/linux/opengles/context.h 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/linux/opengles/context.h 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * $Id: context.h 2985 2008-04-07 18:42:36Z matzon $ + * + * Include file to access public window features + * + * @author elias_naur + * @version $Revision: 2985 $ + */ + +#ifndef _LWJGL_CONTEXT_H_INCLUDED_ +#define _LWJGL_CONTEXT_H_INCLUDED_ + +#include +#include +#include "extgl.h" + +typedef struct { + Display *display; + int screen; + jlong drawable; +} X11PeerInfo; + +extern bool initPeerInfo(JNIEnv *env, jobject peer_info_handle, Display *display, int screen); + +#endif /* _LWJGL_CONTEXT_H_INCLUDED_ */ diff -Nru lwjgl-2.7.1+dfsg/src/native/linux/opengles/display.c lwjgl-2.9.3+dfsg/src/native/linux/opengles/display.c --- lwjgl-2.7.1+dfsg/src/native/linux/opengles/display.c 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/linux/opengles/display.c 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,409 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * $Id: display.c 2985 2008-04-07 18:42:36Z matzon $ + * + * Linux specific library for display handling. + * + * @author elias_naur + * @version $Revision: 2985 $ + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include "common_tools.h" +#include "org_lwjgl_opengl_LinuxDisplay.h" + +#define NUM_XRANDR_RETRIES 5 + +typedef struct { + int width; + int height; + int freq; + union { + int size_index; // Data for Xrandr extension + XF86VidModeModeInfo xf86vm_modeinfo; // Data for XF86VidMode extension + } mode_data; +} mode_info; + +static bool getXF86VidModeVersion(JNIEnv *env, Display *disp, int *major, int *minor) { + int event_base, error_base; + + if (!XF86VidModeQueryExtension(disp, &event_base, &error_base)) { + printfDebugJava(env, "XF86VidMode extension not available"); + return false; + } + if (!XF86VidModeQueryVersion(disp, major, minor)) { + throwException(env, "Could not query XF86VidMode version"); + return false; + } + printfDebugJava(env, "XF86VidMode extension version %i.%i", *major, *minor); + return true; +} + +static bool getXrandrVersion(JNIEnv *env, Display *disp, int *major, int *minor) { + int event_base, error_base; + + if (!XRRQueryExtension(disp, &event_base, &error_base)) { + printfDebugJava(env, "Xrandr extension not available"); + return false; + } + if (!XRRQueryVersion(disp, major, minor)) { + throwException(env, "Could not query Xrandr version"); + return false; + } + printfDebugJava(env, "Xrandr extension version %i.%i", *major, *minor); + return true; +} + +static bool isXrandrSupported(JNIEnv *env, Display *disp) { + int major, minor; + if (!getXrandrVersion(env, disp, &major, &minor)) + return false; + return major >= 1; +} + +static bool isXF86VidModeSupported(JNIEnv *env, Display *disp) { + int minor_ver, major_ver; + if (!getXF86VidModeVersion(env, disp, &major_ver, &minor_ver)) + return false; + return major_ver >= 2; +} + +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nIsXrandrSupported(JNIEnv *env, jclass unused, jlong display) { + Display *disp = (Display *)(intptr_t)display; + jboolean result = isXrandrSupported(env, disp) ? JNI_TRUE : JNI_FALSE; + return result; +} + +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nIsXF86VidModeSupported(JNIEnv *env, jclass unused, jlong display) { + Display *disp = (Display *)(intptr_t)display; + jboolean result = isXF86VidModeSupported(env, disp) ? JNI_TRUE : JNI_FALSE; + return result; +} + +static mode_info *getXrandrDisplayModes(Display *disp, int screen, int *num_modes) { + int num_randr_sizes; + XRRScreenSize *sizes = XRRSizes(disp, screen, &num_randr_sizes); + mode_info *avail_modes = NULL; + int list_size = 0; + /* Count number of modes */ + int i; + int mode_index = 0; + for (i = 0; i < num_randr_sizes; i++) { + int num_randr_rates; + short *freqs = XRRRates(disp, screen, i, &num_randr_rates); + int j; + for (j = 0; j < num_randr_rates; j++) { + if (list_size <= mode_index) { + list_size += 1; + avail_modes = (mode_info *)realloc(avail_modes, sizeof(mode_info)*list_size); + if (avail_modes == NULL) + return NULL; + } + avail_modes[mode_index].width = sizes[i].width; + avail_modes[mode_index].height = sizes[i].height; + avail_modes[mode_index].freq = freqs[j]; + avail_modes[mode_index].mode_data.size_index = i; + mode_index++; + } + } + *num_modes = mode_index; + return avail_modes; +} + +static mode_info *getXF86VidModeDisplayModes(Display *disp, int screen, int *num_modes) { + int num_xf86vm_modes; + XF86VidModeModeInfo **avail_xf86vm_modes; + XF86VidModeGetAllModeLines(disp, screen, &num_xf86vm_modes, &avail_xf86vm_modes); + mode_info *avail_modes = (mode_info *)malloc(sizeof(mode_info)*num_xf86vm_modes); + if (avail_modes == NULL) { + XFree(avail_xf86vm_modes); + return NULL; + } + int i; + for (i = 0; i < num_xf86vm_modes; i++) { + avail_modes[i].width = avail_xf86vm_modes[i]->hdisplay; + avail_modes[i].height = avail_xf86vm_modes[i]->vdisplay; + avail_modes[i].freq = 0; // No frequency support in XF86VidMode + avail_modes[i].mode_data.xf86vm_modeinfo = *avail_xf86vm_modes[i]; + } + XFree(avail_xf86vm_modes); + *num_modes = num_xf86vm_modes; + return avail_modes; +} + +static mode_info *getDisplayModes(Display *disp, int screen, jint extension, int *num_modes) { + switch (extension) { + case org_lwjgl_opengl_LinuxDisplay_XF86VIDMODE: + return getXF86VidModeDisplayModes(disp, screen, num_modes); + case org_lwjgl_opengl_LinuxDisplay_XRANDR: + return getXrandrDisplayModes(disp, screen, num_modes); + case org_lwjgl_opengl_LinuxDisplay_NONE: + // fall through + default: + return NULL; + } +} + +static bool setXF86VidModeMode(Display *disp, int screen, mode_info *mode) { + return True == XF86VidModeSwitchToMode(disp, screen, &mode->mode_data.xf86vm_modeinfo); +} + +/* Try to set the mode specified through XRandR. + * Return value is the Status code of the mode switch + * The timestamp parameter is filled with the latest timestamp returned from XRRConfigTimes + */ +static Status trySetXrandrMode(Display *disp, int screen, mode_info *mode, Time *timestamp) { + Status status; + Drawable root_window = RootWindow(disp, screen); + XRRScreenConfiguration *screen_configuration = XRRGetScreenInfo(disp, root_window); + Time config_time; + *timestamp = XRRConfigTimes(screen_configuration, &config_time); + Rotation current_rotation; + XRRConfigCurrentConfiguration(screen_configuration, ¤t_rotation); + status = XRRSetScreenConfigAndRate(disp, screen_configuration, root_window, mode->mode_data.size_index, current_rotation, mode->freq, *timestamp); + XRRFreeScreenConfigInfo(screen_configuration); + return status; +} + +static bool setXrandrMode(Display *disp, int screen, mode_info *mode) { + int iteration; + Time timestamp; + Status status = trySetXrandrMode(disp, screen, mode, ×tamp); + if (status == 0) + return true; // Success + Time new_timestamp; + for (iteration = 0; iteration < NUM_XRANDR_RETRIES; iteration++) { + status = trySetXrandrMode(disp, screen, mode, &new_timestamp); + if (status == 0) + return true; // Success + if (new_timestamp == timestamp) { + return false; // Failure, and the stamps are equal meaning that the failure is not merely transient + } + timestamp = new_timestamp; + } + return false; +} + +static bool setMode(JNIEnv *env, Display *disp, int screen, jint extension, int width, int height, int freq) { + int num_modes, i; + mode_info *avail_modes = getDisplayModes(disp, screen, extension, &num_modes); + if (avail_modes == NULL) { + printfDebugJava(env, "Could not get display modes"); + return false; + } + bool result = false; + for (i = 0; i < num_modes; ++i) { + printfDebugJava(env, "Mode %d: %dx%d @%d", i, avail_modes[i].width, avail_modes[i].height, avail_modes[i].freq); + if (avail_modes[i].width == width && avail_modes[i].height == height && avail_modes[i].freq == freq) { + switch (extension) { + case org_lwjgl_opengl_LinuxDisplay_XF86VIDMODE: + if (!setXF86VidModeMode(disp, screen, &avail_modes[i])) { + printfDebugJava(env, "Could not switch mode"); + continue; + } + break; + case org_lwjgl_opengl_LinuxDisplay_XRANDR: + if (!setXrandrMode(disp, screen, &avail_modes[i])) { + printfDebugJava(env, "Could not switch mode"); + continue; + } + break; + case org_lwjgl_opengl_LinuxDisplay_NONE: // Should never happen, since NONE imply no available display modes + default: // Should never happen + continue; + } + result = true; + break; + } + } + free(avail_modes); + XFlush(disp); + return result; +} + +static int getGammaRampLengthOfDisplay(JNIEnv *env, Display *disp, int screen) { + int ramp_size; + if (XF86VidModeGetGammaRampSize(disp, screen, &ramp_size) == False) { + throwException(env, "XF86VidModeGetGammaRampSize call failed"); + return 0; + } + return ramp_size; +} + +JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nConvertToNativeRamp(JNIEnv *env, jclass unused, jobject ramp_buffer, jint buffer_offset, jint length) { + const jfloat *ramp_ptr = (const jfloat *)(*env)->GetDirectBufferAddress(env, ramp_buffer) + buffer_offset; + jobject native_ramp = newJavaManagedByteBuffer(env, length*3*sizeof(unsigned short)); + if (native_ramp == NULL) { + throwException(env, "Failed to allocate gamma ramp buffer"); + return NULL; + } + unsigned short *native_ramp_ptr = (unsigned short *)(*env)->GetDirectBufferAddress(env, native_ramp); + int i; + for (i = 0; i < length; i++) { + float scaled_gamma = ramp_ptr[i]*0xffff; + short scaled_gamma_short = (unsigned short)roundf(scaled_gamma); + native_ramp_ptr[i] = scaled_gamma_short; + native_ramp_ptr[i + length] = scaled_gamma_short; + native_ramp_ptr[i + length*2] = scaled_gamma_short; + } + return native_ramp; +} + +JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetCurrentGammaRamp(JNIEnv *env, jclass unused, jlong display, jint screen) { + Display *disp = (Display *)(intptr_t)display; + int ramp_size = getGammaRampLengthOfDisplay(env, disp, screen); + jobject ramp_buffer = newJavaManagedByteBuffer(env, sizeof(unsigned short)*3*ramp_size); + if (ramp_buffer == NULL) { + throwException(env, "Could not allocate gamma ramp buffer"); + return NULL; + } + unsigned short *ramp = (unsigned short *)(*env)->GetDirectBufferAddress(env, ramp_buffer); + if (!XF86VidModeGetGammaRamp(disp, screen, ramp_size, ramp, ramp + ramp_size, ramp + ramp_size*2)) { + throwException(env, "Could not get the current gamma ramp"); + return NULL; + } + return ramp_buffer; +} + +static void setGamma(JNIEnv *env, Display *disp, int screen, jobject ramp_buffer) { + if (ramp_buffer == NULL) + return; + unsigned short *ramp_ptr = (unsigned short *)(*env)->GetDirectBufferAddress(env, ramp_buffer); + jlong capacity = (*env)->GetDirectBufferCapacity(env, ramp_buffer); + int size = capacity/(sizeof(unsigned short)*3); + if (size == 0) + return; + if (XF86VidModeSetGammaRamp(disp, screen, size, ramp_ptr, ramp_ptr + size, ramp_ptr + size*2) == False) { + throwException(env, "Could not set gamma ramp."); + } +} + +static bool switchDisplayMode(JNIEnv * env, Display *disp, int screen, jint extension, jobject mode) { + if (mode == NULL) { + throwException(env, "mode must be non-null"); + return false; + } + jclass cls_displayMode = (*env)->GetObjectClass(env, mode); + jfieldID fid_width = (*env)->GetFieldID(env, cls_displayMode, "width", "I"); + jfieldID fid_height = (*env)->GetFieldID(env, cls_displayMode, "height", "I"); + jfieldID fid_freq = (*env)->GetFieldID(env, cls_displayMode, "freq", "I"); + int width = (*env)->GetIntField(env, mode, fid_width); + int height = (*env)->GetIntField(env, mode, fid_height); + int freq = (*env)->GetIntField(env, mode, fid_freq); + if (!setMode(env, disp, screen, extension, width, height, freq)) { + throwException(env, "Could not switch mode."); + return false; + } + return true; +} + +static jobjectArray getAvailableDisplayModes(JNIEnv * env, Display *disp, int screen, jint extension) { + int num_modes, i; + mode_info *avail_modes; + int bpp = XDefaultDepth(disp, screen); + avail_modes = getDisplayModes(disp, screen, extension, &num_modes); + if (avail_modes == NULL) { + printfDebugJava(env, "Could not get display modes"); + return NULL; + } + // Allocate an array of DisplayModes big enough + jclass displayModeClass = (*env)->FindClass(env, "org/lwjgl/opengl/DisplayMode"); + jobjectArray ret = (*env)->NewObjectArray(env, num_modes, displayModeClass, NULL); + jmethodID displayModeConstructor = (*env)->GetMethodID(env, displayModeClass, "", "(IIII)V"); + + for (i = 0; i < num_modes; i++) { + jobject displayMode = (*env)->NewObject(env, displayModeClass, displayModeConstructor, avail_modes[i].width, avail_modes[i].height, bpp, avail_modes[i].freq); + (*env)->SetObjectArrayElement(env, ret, i, displayMode); + } + free(avail_modes); + return ret; +} + +static jobject getCurrentXRandrMode(JNIEnv * env, Display *disp, int screen) { + Drawable root_window = RootWindow(disp, screen); + XRRScreenConfiguration *config = XRRGetScreenInfo(disp, root_window); + if (config == NULL) { + throwException(env, "Could not get current screen configuration."); + return NULL; + } + short rate = XRRConfigCurrentRate(config); + Rotation current_rotation; + SizeID size_index = XRRConfigCurrentConfiguration(config, ¤t_rotation); + int n_sizes; + XRRScreenSize *sizes = XRRConfigSizes(config, &n_sizes); + if (size_index >= n_sizes) { + throwFormattedException(env, "Xrandr current index (%d) is larger than or equals to the number of sizes (%d).", size_index, n_sizes); + XRRFreeScreenConfigInfo(config); + return NULL; + } + XRRScreenSize current_size = sizes[size_index]; + XRRFreeScreenConfigInfo(config); + int bpp = XDefaultDepth(disp, screen); + jclass displayModeClass = (*env)->FindClass(env, "org/lwjgl/opengl/DisplayMode"); + jmethodID displayModeConstructor = (*env)->GetMethodID(env, displayModeClass, "", "(IIII)V"); + jobject displayMode = (*env)->NewObject(env, displayModeClass, displayModeConstructor, current_size.width, current_size.height, bpp, rate); + return displayMode; +} + +JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetCurrentXRandrMode(JNIEnv *env, jclass unused, jlong display, jint screen) { + Display *disp = (Display *)(intptr_t)display; + return getCurrentXRandrMode(env, disp, screen); +} + +JNIEXPORT jobjectArray JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetAvailableDisplayModes(JNIEnv *env, jclass clazz, jlong display, jint screen, jint extension) { + Display *disp = (Display *)(intptr_t)display; + return getAvailableDisplayModes(env, disp, screen, extension); +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nSwitchDisplayMode(JNIEnv *env, jclass clazz, jlong display, jint screen, jint extension, jobject mode) { + Display *disp = (Display *)(intptr_t)display; + switchDisplayMode(env, disp, screen, extension, mode); +} + +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetGammaRampLength(JNIEnv *env, jclass clazz, jlong display_ptr, jint screen) { + Display *disp = (Display *)(intptr_t)display_ptr; + return (jint)getGammaRampLengthOfDisplay(env, disp, screen); +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nSetGammaRamp(JNIEnv *env, jclass clazz, jlong display, jint screen, jobject gamma_buffer) { + Display *disp = (Display *)(intptr_t)display; + setGamma(env, disp, screen, gamma_buffer); +} diff -Nru lwjgl-2.7.1+dfsg/src/native/linux/opengles/extgl_glx.c lwjgl-2.9.3+dfsg/src/native/linux/opengles/extgl_glx.c --- lwjgl-2.7.1+dfsg/src/native/linux/opengles/extgl_glx.c 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/linux/opengles/extgl_glx.c 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include +#include +#include +#include "extgl.h" + +static void * lib_gl_handle = NULL; + +bool extgl_Open(JNIEnv *env) { + if ( lib_gl_handle != NULL ) + return true; + + lib_gl_handle = dlopen("libGLESv2.so", RTLD_LAZY | RTLD_GLOBAL); + if (lib_gl_handle == NULL) { + throwFormattedException(env, "Error loading libGLESv2.so: %s", dlerror()); + return false; + } + return true; +} + +void extgl_Close(void) { + dlclose(lib_gl_handle); + lib_gl_handle = NULL; +} + +void *extgl_GetProcAddress(const char *name) { + void *t = eglGetProcAddress(name); + + if ( t == NULL ) { + t = dlsym(lib_gl_handle, name); + if ( t == NULL ) + printfDebug("Could not locate symbol %s\n", name); + } + + //if ( t != NULL ) + //printfDebug("Located symbol %s\n", name); + + return t; +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/native/linux/opengles/org_lwjgl_opengl_Display.c lwjgl-2.9.3+dfsg/src/native/linux/opengles/org_lwjgl_opengl_Display.c --- lwjgl-2.7.1+dfsg/src/native/linux/opengles/org_lwjgl_opengl_Display.c 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/linux/opengles/org_lwjgl_opengl_Display.c 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,658 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * $Id: org_lwjgl_opengl_Display.c 3555 2011-07-02 20:50:27Z kappa1 $ + * + * Linux specific display functions. + * + * @author elias_naur + * @version $Revision: 3555 $ + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "common_tools.h" +#include "extgl.h" +#include "context.h" +#include "org_lwjgl_opengl_LinuxDisplay.h" +//#include "org_lwjgl_opengl_LinuxDisplayPeerInfo.h" +#include "org_lwjgl_LinuxSysImplementation.h" + +#define ERR_MSG_SIZE 1024 + +typedef struct { + unsigned long flags; + unsigned long functions; + unsigned long decorations; + long input_mode; + unsigned long status; +} MotifWmHints; + +#define MWM_HINTS_DECORATIONS (1L << 1) + +static Colormap cmap; +static int current_depth; + +static Visual *current_visual; + +static bool checkXError(JNIEnv *env, Display *disp) { + XSync(disp, False); + return (*env)->ExceptionCheck(env) == JNI_FALSE; +} + +static int global_error_handler(Display *disp, XErrorEvent *error) { + JNIEnv *env = getThreadEnv(); + if (env != NULL) { + jclass org_lwjgl_LinuxDisplay_class = (*env)->FindClass(env, "org/lwjgl/opengl/LinuxDisplay"); + if (org_lwjgl_LinuxDisplay_class == NULL) { + // Don't propagate error + (*env)->ExceptionClear(env); + return 0; + } + jmethodID handler_method = (*env)->GetStaticMethodID(env, org_lwjgl_LinuxDisplay_class, "globalErrorHandler", "(JJJJJJJ)I"); + if (handler_method == NULL) + return 0; + return (*env)->CallStaticIntMethod(env, org_lwjgl_LinuxDisplay_class, handler_method, (jlong)(intptr_t)disp, (jlong)(intptr_t)error, + (jlong)(intptr_t)error->display, (jlong)error->serial, (jlong)error->error_code, (jlong)error->request_code, (jlong)error->minor_code); + } else + return 0; +} + +static jlong openDisplay(JNIEnv *env) { + Display *display_connection = XOpenDisplay(NULL); + if (display_connection == NULL) { + throwException(env, "Could not open X display connection"); + return (intptr_t)NULL; + } + return (intptr_t)display_connection; +} + +JNIEXPORT jint JNICALL Java_org_lwjgl_DefaultSysImplementation_getJNIVersion + (JNIEnv *env, jobject ignored) { + return org_lwjgl_LinuxSysImplementation_JNI_VERSION; +} + +JNIEXPORT jstring JNICALL Java_org_lwjgl_opengl_LinuxDisplay_getErrorText(JNIEnv *env, jclass unused, jlong display_ptr, jlong error_code) { + Display *disp = (Display *)(intptr_t)display_ptr; + char err_msg_buffer[ERR_MSG_SIZE]; + XGetErrorText(disp, error_code, err_msg_buffer, ERR_MSG_SIZE); + err_msg_buffer[ERR_MSG_SIZE - 1] = '\0'; + return NewStringNativeWithLength(env, err_msg_buffer, strlen(err_msg_buffer)); +} + +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_callErrorHandler(JNIEnv *env, jclass unused, jlong handler_ptr, jlong display_ptr, jlong event_ptr) { + XErrorHandler handler = (XErrorHandler)(intptr_t)handler_ptr; + Display *disp = (Display *)(intptr_t)display_ptr; + XErrorEvent *event = (XErrorEvent *)(intptr_t)event_ptr; + return (jint)handler(disp, event); +} + +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxDisplay_setErrorHandler(JNIEnv *env, jclass unused) { + return (intptr_t)XSetErrorHandler(global_error_handler); +} + +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxDisplay_resetErrorHandler(JNIEnv *env, jclass unused, jlong handler_ptr) { + XErrorHandler handler = (XErrorHandler)(intptr_t)handler_ptr; + return (intptr_t)XSetErrorHandler(handler); +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nSync(JNIEnv *env, jclass unused, jlong display_ptr, jboolean throw_away_events) { + Display *disp = (Display *)(intptr_t)display_ptr; + XSync(disp, throw_away_events ? True : False); +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_sync(JNIEnv *env, jclass unused, jlong display_ptr, jboolean throw_away_events) { + Display *disp = (Display *)(intptr_t)display_ptr; + XSync(disp, throw_away_events ? True : False); +} + +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetDefaultScreen(JNIEnv *env, jclass unused, jlong display_ptr) { + Display *disp = (Display *)(intptr_t)display_ptr; + return XDefaultScreen(disp); +} + +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nInternAtom(JNIEnv *env, jclass unused, jlong display_ptr, jstring atom_name_obj, jboolean only_if_exists) { + Display *disp = (Display *)(intptr_t)display_ptr; + char *atom_name = GetStringNativeChars(env, atom_name_obj); + if (atom_name == NULL) + return 0; + Atom atom = XInternAtom(disp, atom_name, only_if_exists ? True : False); + free(atom_name); + return atom; +} + +static void setDecorations(Display *disp, Window window, int dec) { + Atom motif_hints_atom = XInternAtom(disp, "_MOTIF_WM_HINTS", False); + MotifWmHints motif_hints; + motif_hints.flags = MWM_HINTS_DECORATIONS; + motif_hints.decorations = dec; + XChangeProperty(disp, window, motif_hints_atom, motif_hints_atom, 32, PropModeReplace, (unsigned char *)&motif_hints, sizeof(MotifWmHints)/sizeof(long)); +} + +static bool isLegacyFullscreen(jint window_mode) { + return window_mode == org_lwjgl_opengl_LinuxDisplay_FULLSCREEN_LEGACY; +} + +static void setWindowTitle(Display *disp, Window window, jlong title, jint len) { + // ASCII fallback if XChangeProperty fails. + XStoreName(disp, window, (const char *)(intptr_t)title); + + // Set the UTF-8 encoded title + XChangeProperty(disp, window, + XInternAtom(disp, "_NET_WM_NAME", False), + XInternAtom(disp, "UTF8_STRING", False), + 8, PropModeReplace, (const unsigned char *)(intptr_t)title, + len); +} + +static void setClassHint(Display *disp, Window window, jlong wm_name, jlong wm_class) { + XClassHint* hint = XAllocClassHint(); + + hint->res_name = (char *)(intptr_t)wm_name; + hint->res_class = (char *)(intptr_t)wm_class; + + XSetClassHint(disp, window, hint); + + XFree(hint); +} + +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxDisplay_openDisplay(JNIEnv *env, jclass clazz) { + return openDisplay(env); +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_closeDisplay(JNIEnv *env, jclass clazz, jlong display) { + Display *disp = (Display *)(intptr_t)display; + XCloseDisplay(disp); +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplayPeerInfo_initDrawable(JNIEnv *env, jclass clazz, jlong window, jobject peer_info_handle) { + X11PeerInfo *peer_info = (*env)->GetDirectBufferAddress(env, peer_info_handle); + peer_info->drawable = window; +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplayPeerInfo_initDefaultPeerInfo(JNIEnv *env, jclass clazz, jlong display, jint screen, jobject peer_info_handle) { + //Display *disp = (Display *)(intptr_t)display; + //initPeerInfo(env, peer_info_handle, disp, screen); +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nSetTitle(JNIEnv * env, jclass clazz, jlong display, jlong window_ptr, jlong title, jint len) { + Display *disp = (Display *)(intptr_t)display; + Window window = (Window)window_ptr; + setWindowTitle(disp, window, title, len); +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nSetClassHint(JNIEnv * env, jclass clazz, jlong display, jlong window_ptr, jlong wm_name, jlong wm_class) { + Display *disp = (Display *)(intptr_t)display; + Window window = (Window)window_ptr; + setClassHint(disp, window, wm_name, wm_class); +} + +static void destroyWindow(JNIEnv *env, Display *disp, Window window) { + XDestroyWindow(disp, window); + XFreeColormap(disp, cmap); +} + +static bool isNetWMFullscreenSupported(JNIEnv *env, Display *disp, int screen) { + unsigned long nitems; + Atom actual_type; + int actual_format; + unsigned long bytes_after; + Atom *supported_list; + Atom netwm_supported_atom = XInternAtom(disp, "_NET_SUPPORTED", False); + int result = XGetWindowProperty(disp, RootWindow(disp, screen), netwm_supported_atom, 0, 10000, False, AnyPropertyType, &actual_type, &actual_format, &nitems, &bytes_after, (void *)&supported_list); + if (result != Success) { + throwException(env, "Unable to query _NET_SUPPORTED window property"); + return false; + } + Atom fullscreen_atom = XInternAtom(disp, "_NET_WM_STATE_FULLSCREEN", False); + bool supported = false; + unsigned long i; + for (i = 0; i < nitems; i++) { + if (fullscreen_atom == supported_list[i]) { + supported = true; + break; + } + } + XFree(supported_list); + return supported; +} + +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nIsNetWMFullscreenSupported(JNIEnv *env, jclass unused, jlong display, jint screen) { + Display *disp = (Display *)(intptr_t)display; + return isNetWMFullscreenSupported(env, disp, screen) ? JNI_TRUE : JNI_FALSE; +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nReshape(JNIEnv *env, jclass clazz, jlong display, jlong window_ptr, jint x, jint y, jint width, jint height) { + Display *disp = (Display *)(intptr_t)display; + Window window = (Window)window_ptr; + XMoveWindow(disp, window, x, y); + XResizeWindow(disp, window, width, height); +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_synchronize(JNIEnv *env, jclass clazz, jlong display, jboolean synchronize) { + Display *disp = (Display *)(intptr_t)display; + XSynchronize(disp, synchronize ? True : False); +} + +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxDisplay_getRootWindow(JNIEnv *env, jclass clazz, jlong display, jint screen) { + Display *disp = (Display *)(intptr_t)display; + return RootWindow(disp, screen); +} + +static Window getCurrentWindow(JNIEnv *env, jlong display_ptr, jlong window_ptr) { + Display *disp = (Display *)(intptr_t)display_ptr; + + Window parent = (Window)window_ptr; + Window win, root; + + Window *children; + unsigned int nchildren; + + do { + win = parent; + + if (XQueryTree(disp, win, &root, &parent, &children, &nchildren) == 0) { + throwException(env, "XQueryTree failed"); + return 0; + } + + if (children != NULL) XFree(children); + } while (parent != root); + + return win; +} + +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetX(JNIEnv *env, jclass unused, jlong display_ptr, jlong window_ptr) { + Display *disp = (Display *)(intptr_t)display_ptr; + Window win = getCurrentWindow(env, display_ptr, window_ptr); + + XWindowAttributes win_attribs; + XGetWindowAttributes(disp, win, &win_attribs); + + return win_attribs.x; +} + +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetY(JNIEnv *env, jclass unused, jlong display_ptr, jlong window_ptr) { + Display *disp = (Display *)(intptr_t)display_ptr; + Window win = getCurrentWindow(env, display_ptr, window_ptr); + + XWindowAttributes win_attribs; + XGetWindowAttributes(disp, win, &win_attribs); + + return win_attribs.y; +} + +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetWidth(JNIEnv *env, jclass unused, jlong display_ptr, jlong window_ptr) { + Display *disp = (Display *)(intptr_t)display_ptr; + Window win = (Window)window_ptr; + XWindowAttributes win_attribs; + + XGetWindowAttributes(disp, win, &win_attribs); + + return win_attribs.width; +} + +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetHeight(JNIEnv *env, jclass unused, jlong display_ptr, jlong window_ptr) { + Display *disp = (Display *)(intptr_t)display_ptr; + Window win = (Window)window_ptr; + XWindowAttributes win_attribs; + + XGetWindowAttributes(disp, win, &win_attribs); + + return win_attribs.height; +} + +static void updateWindowHints(JNIEnv *env, Display *disp, Window window) { + XWMHints* win_hints = XAllocWMHints(); + if (win_hints == NULL) { + throwException(env, "XAllocWMHints failed"); + return; + } + + win_hints->flags = InputHint; + win_hints->input = True; + + XSetWMHints(disp, window, win_hints); + XFree(win_hints); + XFlush(disp); +} + +static void updateWindowBounds(Display *disp, Window win, int x, int y, int width, int height, jboolean position, jboolean resizable) { + XSizeHints *window_hints = XAllocSizeHints(); + + if (position) { + window_hints->flags |= PPosition; + window_hints->x = x; + window_hints->y = y; + } + + if (!resizable) { + window_hints->flags |= PMinSize | PMaxSize; + window_hints->min_width = width; + window_hints->max_width = width; + window_hints->min_height = height; + window_hints->max_height = height; + } + + XSetWMNormalHints(disp, win, window_hints); + XFree(window_hints); +} + +static Window createWindow(JNIEnv* env, Display *disp, int screen, jint window_mode, X11PeerInfo *peer_info, int x, int y, int width, int height, jboolean undecorated, long parent_handle, jboolean resizable) { + Window parent = (Window)parent_handle; + Window win; + XSetWindowAttributes attribs; + unsigned int attribmask; + + XVisualInfo vis_info; + if ( !XMatchVisualInfo(disp, screen, DefaultDepth(disp, screen), TrueColor, &vis_info) ) { + throwException(env, "Failed to acquire X visual."); + return false; + } + + cmap = XCreateColormap(disp, parent, vis_info.visual, AllocNone); + if (!checkXError(env, disp)) { + return false; + } + attribs.colormap = cmap; + attribs.border_pixel = 0; + attribs.event_mask = ExposureMask | FocusChangeMask | VisibilityChangeMask | StructureNotifyMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | PointerMotionMask; + attribmask = CWColormap | CWEventMask | CWBorderPixel | CWBackPixel; + if (isLegacyFullscreen(window_mode)) { + attribmask |= CWOverrideRedirect; + attribs.override_redirect = True; + } + win = XCreateWindow(disp, parent, x, y, width, height, 0, vis_info.depth, InputOutput, vis_info.visual, attribmask, &attribs); + + current_depth = vis_info.depth; + current_visual = vis_info.visual; + + if (!checkXError(env, disp)) { + XFreeColormap(disp, cmap); + return false; + } + if (undecorated) { + // Use Motif decoration hint property and hope the window manager respects them + setDecorations(disp, win, 0); + } + + if (RootWindow(disp, screen) == parent_handle) { // only set hints when Display.setParent isn't used + updateWindowBounds(disp, win, x, y, width, height, JNI_TRUE, resizable); + updateWindowHints(env, disp, win); + } + +#define NUM_ATOMS 1 + Atom protocol_atoms[NUM_ATOMS] = {XInternAtom(disp, "WM_DELETE_WINDOW", False)/*, XInternAtom(disp, "WM_TAKE_FOCUS", False)*/}; + XSetWMProtocols(disp, win, protocol_atoms, NUM_ATOMS); + if (window_mode == org_lwjgl_opengl_LinuxDisplay_FULLSCREEN_NETWM) { + Atom fullscreen_atom = XInternAtom(disp, "_NET_WM_STATE_FULLSCREEN", False); + XChangeProperty(disp, win, XInternAtom(disp, "_NET_WM_STATE", False), + XInternAtom(disp, "ATOM", False), 32, PropModeReplace, (const unsigned char*)&fullscreen_atom, 1); + } + if (!checkXError(env, disp)) { + destroyWindow(env, disp, win); + return 0; + } + return win; +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_reparentWindow(JNIEnv *env, jclass unused, jlong display, jlong window_ptr, jlong parent_ptr, jint x, jint y) { + Display *disp = (Display *)(intptr_t)display; + Window window = (Window)window_ptr; + Window parent = (Window)parent_ptr; + XReparentWindow(disp, window, parent, x, y); +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_mapRaised(JNIEnv *env, jclass unused, jlong display, jlong window_ptr) { + Display *disp = (Display *)(intptr_t)display; + Window window = (Window)window_ptr; + XMapRaised(disp, window); +} + +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxDisplay_getParentWindow(JNIEnv *env, jclass unused, jlong display, jlong window_ptr) { + Display *disp = (Display *)(intptr_t)display; + Window window = (Window)window_ptr; + Window root, parent; + Window *children; + unsigned int nchildren; + if (XQueryTree(disp, window, &root, &parent, &children, &nchildren) == 0) { + throwException(env, "XQueryTree failed"); + return None; + } + if (children != NULL) + XFree(children); + return parent; +} + +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_getChildCount(JNIEnv *env, jclass unused, jlong display, jlong window_ptr) { + Display *disp = (Display *)(intptr_t)display; + Window window = (Window)window_ptr; + Window root, parent; + Window *children; + unsigned int nchildren; + if (XQueryTree(disp, window, &root, &parent, &children, &nchildren) == 0) { + throwException(env, "XQueryTree failed"); + return None; + } + if (children != NULL) + XFree(children); + + return nchildren; +} + +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_LinuxDisplay_hasProperty(JNIEnv *env, jclass unusued, jlong display, jlong window_ptr, jlong property_ptr) { + Display *disp = (Display *)(intptr_t)display; + Window window = (Window)window_ptr; + Atom property = (Atom)property_ptr; + int num_props; + Atom *properties = XListProperties(disp, window, &num_props); + if (properties == NULL) + return JNI_FALSE; + jboolean result = JNI_FALSE; + for (int i = 0; i < num_props; i++) { + if (properties[i] == property) { + result = JNI_TRUE; + break; + } + } + XFree(properties); + return result; +} + +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetInputFocus(JNIEnv *env, jclass unused, jlong display_ptr) { + Display *disp = (Display *)(intptr_t)display_ptr; + int revert_mode; + Window win; + XGetInputFocus(disp, &win, &revert_mode); + return win; +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nSetInputFocus(JNIEnv *env, jclass clazz, jlong display, jlong window_ptr, jlong time) { + Display *disp = (Display *)(intptr_t)display; + Window window = (Window)window_ptr; + XSetInputFocus(disp, window, RevertToParent, time); +} + +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nCreateWindow(JNIEnv *env, jclass clazz, jlong display, jint screen, jobject peer_info_handle, jobject mode, jint window_mode, jint x, jint y, jboolean undecorated, jlong parent_handle, jboolean resizable) { + Display *disp = (Display *)(intptr_t)display; + X11PeerInfo *peer_info = (*env)->GetDirectBufferAddress(env, peer_info_handle); + + jclass cls_displayMode = (*env)->GetObjectClass(env, mode); + + jfieldID fid_width = (*env)->GetFieldID(env, cls_displayMode, "width", "I"); + jfieldID fid_height = (*env)->GetFieldID(env, cls_displayMode, "height", "I"); + + int width = (*env)->GetIntField(env, mode, fid_width); + int height = (*env)->GetIntField(env, mode, fid_height); + + Window win = createWindow(env, disp, screen, window_mode, peer_info, x, y, width, height, undecorated, parent_handle, resizable); + + if ((*env)->ExceptionOccurred(env)) + return 0; + + if (!checkXError(env, disp)) + destroyWindow(env, disp, win); + + return win; +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nSetWindowSize(JNIEnv *env, jclass clazz, jlong display, jlong window_ptr, jint width, jint height, jboolean resizable) { + Display *disp = (Display *)(intptr_t)display; + Window win = (Window)window_ptr; + updateWindowBounds(disp, win, 0, 0, width, height, JNI_FALSE, resizable); +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nDestroyWindow(JNIEnv *env, jclass clazz, jlong display, jlong window_ptr) { + Display *disp = (Display *)(intptr_t)display; + Window window = (Window)window_ptr; + destroyWindow(env, disp, window); +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nLockAWT(JNIEnv *env, jclass clazz) { + JAWT jawt; + jawt.version = JAWT_VERSION_1_4; + if (JAWT_GetAWT(env, &jawt) != JNI_TRUE) { + throwException(env, "GetAWT failed"); + return; + } + jawt.Lock(env); +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nUnlockAWT(JNIEnv *env, jclass clazz) { + JAWT jawt; + jawt.version = JAWT_VERSION_1_4; + if (JAWT_GetAWT(env, &jawt) != JNI_TRUE) { + throwException(env, "GetAWT failed"); + return; + } + jawt.Unlock(env); +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nSetWindowIcon + (JNIEnv *env, jclass clazz, jlong display, jlong window_ptr, jobject icons_buffer, jint icons_buffer_size) +{ + Display *disp = (Display *)(intptr_t)display; + Window window = (Window)window_ptr; + const unsigned char *icons_char_buffer = (const unsigned char *)(*env)->GetDirectBufferAddress(env, icons_buffer); + + int length = icons_buffer_size/4; + unsigned long icons_long_buffer[length]; + int i = 0; + + // copy byte array to long array + for (i = 0; i < icons_buffer_size; i += 4) { + unsigned long argb = (icons_char_buffer[i] << 24) | + (icons_char_buffer[i+1] << 16) | + (icons_char_buffer[i+2] << 8) | + (icons_char_buffer[i+3]); + icons_long_buffer[i/4] = argb; + } + + XChangeProperty(disp, window, + XInternAtom(disp, "_NET_WM_ICON", False), + XInternAtom(disp, "CARDINAL", False), + 32, PropModeReplace, (const unsigned char*) icons_long_buffer, length); +} + +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nUngrabKeyboard(JNIEnv *env, jclass unused, jlong display_ptr) { + Display *disp = (Display *)(intptr_t)display_ptr; + return XUngrabKeyboard(disp, CurrentTime); +} + +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGrabKeyboard(JNIEnv *env, jclass unused, jlong display_ptr, jlong window_ptr) { + Display *disp = (Display *)(intptr_t)display_ptr; + Window win = (Window)window_ptr; + return XGrabKeyboard(disp, win, False, GrabModeAsync, GrabModeAsync, CurrentTime); +} + +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGrabPointer(JNIEnv *env, jclass unused, jlong display_ptr, jlong window_ptr, jlong cursor_ptr) { + Display *disp = (Display *)(intptr_t)display_ptr; + Window win = (Window)window_ptr; + Cursor cursor = (Cursor)cursor_ptr; + int grab_mask = PointerMotionMask | ButtonPressMask | ButtonReleaseMask; + return XGrabPointer(disp, win, False, grab_mask, GrabModeAsync, GrabModeAsync, win, cursor, CurrentTime); +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nSetViewPort(JNIEnv *env, jclass unused, jlong display_ptr, jlong window_ptr, jint screen) { + Display *disp = (Display *)(intptr_t)display_ptr; + Window win = (Window)window_ptr; + XWindowAttributes win_attribs; + + XGetWindowAttributes(disp, win, &win_attribs); + XF86VidModeSetViewPort(disp, screen, win_attribs.x, win_attribs.y); +} + +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nUngrabPointer(JNIEnv *env, jclass unused, jlong display_ptr) { + Display *disp = (Display *)(intptr_t)display_ptr; + return XUngrabPointer(disp, CurrentTime); +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nDefineCursor(JNIEnv *env, jclass unused, jlong display_ptr, jlong window_ptr, jlong cursor_ptr) { + Display *disp = (Display *)(intptr_t)display_ptr; + Window win = (Window)window_ptr; + Cursor cursor = (Cursor)cursor_ptr; + XDefineCursor(disp, win, cursor); +} + +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nCreateBlankCursor(JNIEnv *env, jclass unused, jlong display_ptr, jlong window_ptr) { + Display *disp = (Display *)(intptr_t)display_ptr; + Window win = (Window)window_ptr; + unsigned int best_width, best_height; + if (XQueryBestCursor(disp, win, 1, 1, &best_width, &best_height) == 0) { + throwException(env, "Could not query best cursor size"); + return false; + } + Pixmap mask = XCreatePixmap(disp, win, best_width, best_height, 1); + XGCValues gc_values; + gc_values.foreground = 0; + GC gc = XCreateGC(disp, mask, GCForeground, &gc_values); + XFillRectangle(disp, mask, gc, 0, 0, best_width, best_height); + XFreeGC(disp, gc); + XColor dummy_color; + Cursor cursor = XCreatePixmapCursor(disp, mask, mask, &dummy_color, &dummy_color, 0, 0); + XFreePixmap(disp, mask); + return cursor; +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nIconifyWindow(JNIEnv *env, jclass unused, jlong display_ptr, jlong window_ptr, jint screen) { + Display *disp = (Display *)(intptr_t)display_ptr; + Window win = (Window)window_ptr; + XIconifyWindow(disp, win, screen); +} diff -Nru lwjgl-2.7.1+dfsg/src/native/linux/org_lwjgl_input_Cursor.c lwjgl-2.9.3+dfsg/src/native/linux/org_lwjgl_input_Cursor.c --- lwjgl-2.7.1+dfsg/src/native/linux/org_lwjgl_input_Cursor.c 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/linux/org_lwjgl_input_Cursor.c 2016-04-09 16:26:57.000000000 +0000 @@ -31,12 +31,12 @@ */ /** - * $Id: org_lwjgl_input_Cursor.c 2985 2008-04-07 18:42:36Z matzon $ + * $Id$ * * Linux cursor handling. * * @author elias_naur - * @version $Revision: 2985 $ + * @version $Revision$ */ #include diff -Nru lwjgl-2.7.1+dfsg/src/native/linux/org_lwjgl_LinuxSysImplementation.h lwjgl-2.9.3+dfsg/src/native/linux/org_lwjgl_LinuxSysImplementation.h --- lwjgl-2.7.1+dfsg/src/native/linux/org_lwjgl_LinuxSysImplementation.h 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/linux/org_lwjgl_LinuxSysImplementation.h 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,15 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_lwjgl_LinuxSysImplementation */ + +#ifndef _Included_org_lwjgl_LinuxSysImplementation +#define _Included_org_lwjgl_LinuxSysImplementation +#ifdef __cplusplus +extern "C" { +#endif +#undef org_lwjgl_LinuxSysImplementation_JNI_VERSION +#define org_lwjgl_LinuxSysImplementation_JNI_VERSION 19L +#ifdef __cplusplus +} +#endif +#endif diff -Nru lwjgl-2.7.1+dfsg/src/native/linux/org_lwjgl_opengl_Display.c lwjgl-2.9.3+dfsg/src/native/linux/org_lwjgl_opengl_Display.c --- lwjgl-2.7.1+dfsg/src/native/linux/org_lwjgl_opengl_Display.c 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/linux/org_lwjgl_opengl_Display.c 2016-04-09 16:26:57.000000000 +0000 @@ -1,589 +0,0 @@ -/* - * Copyright (c) 2002-2008 LWJGL Project - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of 'LWJGL' nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/** - * $Id: org_lwjgl_opengl_Display.c 3453 2010-10-28 21:39:55Z kappa1 $ - * - * Linux specific display functions. - * - * @author elias_naur - * @version $Revision: 3453 $ - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "common_tools.h" -#include "extgl.h" -#include "extgl_glx.h" -#include "context.h" -#include "org_lwjgl_opengl_LinuxDisplay.h" -#include "org_lwjgl_opengl_LinuxDisplayPeerInfo.h" -#include "org_lwjgl_LinuxSysImplementation.h" - -#define ERR_MSG_SIZE 1024 - -typedef struct { - unsigned long flags; - unsigned long functions; - unsigned long decorations; - long input_mode; - unsigned long status; -} MotifWmHints; - -#define MWM_HINTS_DECORATIONS (1L << 1) - -static GLXWindow glx_window = None; - -static Colormap cmap; -static int current_depth; -static Pixmap current_icon_pixmap; -static Pixmap current_icon_mask_pixmap; - -static Visual *current_visual; - -static bool checkXError(JNIEnv *env, Display *disp) { - XSync(disp, False); - return (*env)->ExceptionCheck(env) == JNI_FALSE; -} - -static int global_error_handler(Display *disp, XErrorEvent *error) { - JNIEnv *env = getThreadEnv(); - if (env != NULL) { - jclass org_lwjgl_LinuxDisplay_class = (*env)->FindClass(env, "org/lwjgl/opengl/LinuxDisplay"); - if (org_lwjgl_LinuxDisplay_class == NULL) { - // Don't propagate error - (*env)->ExceptionClear(env); - return 0; - } - jmethodID handler_method = (*env)->GetStaticMethodID(env, org_lwjgl_LinuxDisplay_class, "globalErrorHandler", "(JJJJJJJ)I"); - if (handler_method == NULL) - return 0; - return (*env)->CallStaticIntMethod(env, org_lwjgl_LinuxDisplay_class, handler_method, (jlong)(intptr_t)disp, (jlong)(intptr_t)error, - (jlong)(intptr_t)error->display, (jlong)error->serial, (jlong)error->error_code, (jlong)error->request_code, (jlong)error->minor_code); - } else - return 0; -} - -static jlong openDisplay(JNIEnv *env) { - Display *display_connection = XOpenDisplay(NULL); - if (display_connection == NULL) { - throwException(env, "Could not open X display connection"); - return (intptr_t)NULL; - } - return (intptr_t)display_connection; -} - -JNIEXPORT jint JNICALL Java_org_lwjgl_DefaultSysImplementation_getJNIVersion - (JNIEnv *env, jobject ignored) { - return org_lwjgl_LinuxSysImplementation_JNI_VERSION; -} - -JNIEXPORT jstring JNICALL Java_org_lwjgl_opengl_LinuxDisplay_getErrorText(JNIEnv *env, jclass unused, jlong display_ptr, jlong error_code) { - Display *disp = (Display *)(intptr_t)display_ptr; - char err_msg_buffer[ERR_MSG_SIZE]; - XGetErrorText(disp, error_code, err_msg_buffer, ERR_MSG_SIZE); - err_msg_buffer[ERR_MSG_SIZE - 1] = '\0'; - return NewStringNativeWithLength(env, err_msg_buffer, strlen(err_msg_buffer)); -} - -JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_callErrorHandler(JNIEnv *env, jclass unused, jlong handler_ptr, jlong display_ptr, jlong event_ptr) { - XErrorHandler handler = (XErrorHandler)(intptr_t)handler_ptr; - Display *disp = (Display *)(intptr_t)display_ptr; - XErrorEvent *event = (XErrorEvent *)(intptr_t)event_ptr; - return (jint)handler(disp, event); -} - -JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxDisplay_setErrorHandler(JNIEnv *env, jclass unused) { - return (intptr_t)XSetErrorHandler(global_error_handler); -} - -JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxDisplay_resetErrorHandler(JNIEnv *env, jclass unused, jlong handler_ptr) { - XErrorHandler handler = (XErrorHandler)(intptr_t)handler_ptr; - return (intptr_t)XSetErrorHandler(handler); -} - -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_sync(JNIEnv *env, jclass unused, jlong display_ptr, jboolean throw_away_events) { - Display *disp = (Display *)(intptr_t)display_ptr; - XSync(disp, throw_away_events ? True : False); -} - -JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetDefaultScreen(JNIEnv *env, jclass unused, jlong display_ptr) { - Display *disp = (Display *)(intptr_t)display_ptr; - return XDefaultScreen(disp); -} - -JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nInternAtom(JNIEnv *env, jclass unused, jlong display_ptr, jstring atom_name_obj, jboolean only_if_exists) { - Display *disp = (Display *)(intptr_t)display_ptr; - char *atom_name = GetStringNativeChars(env, atom_name_obj); - if (atom_name == NULL) - return 0; - Atom atom = XInternAtom(disp, atom_name, only_if_exists ? True : False); - free(atom_name); - return atom; -} - -static void setDecorations(Display *disp, Window window, int dec) { - Atom motif_hints_atom = XInternAtom(disp, "_MOTIF_WM_HINTS", False); - MotifWmHints motif_hints; - motif_hints.flags = MWM_HINTS_DECORATIONS; - motif_hints.decorations = dec; - XChangeProperty(disp, window, motif_hints_atom, motif_hints_atom, 32, PropModeReplace, (unsigned char *)&motif_hints, sizeof(MotifWmHints)/sizeof(long)); -} - -static bool isLegacyFullscreen(jint window_mode) { - return window_mode == org_lwjgl_opengl_LinuxDisplay_FULLSCREEN_LEGACY; -} - -static void setWindowTitle(Display *disp, Window window, const char *title) { - XStoreName(disp, window, title); -} - -JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxDisplay_openDisplay(JNIEnv *env, jclass clazz) { - return openDisplay(env); -} - -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_closeDisplay(JNIEnv *env, jclass clazz, jlong display) { - Display *disp = (Display *)(intptr_t)display; - XCloseDisplay(disp); -} - -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplayPeerInfo_initDrawable(JNIEnv *env, jclass clazz, jlong window, jobject peer_info_handle) { - X11PeerInfo *peer_info = (*env)->GetDirectBufferAddress(env, peer_info_handle); - if (peer_info->glx13) - peer_info->drawable = glx_window; - else - peer_info->drawable = window; -} - -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplayPeerInfo_initDefaultPeerInfo(JNIEnv *env, jclass clazz, jlong display, jint screen, jobject peer_info_handle, jobject pixel_format) { - Display *disp = (Display *)(intptr_t)display; - initPeerInfo(env, peer_info_handle, disp, screen, pixel_format, true, GLX_WINDOW_BIT, true, false); -} - -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nSetTitle(JNIEnv * env, jclass clazz, jlong display, jlong window_ptr, jstring title_obj) { - Display *disp = (Display *)(intptr_t)display; - Window window = (Window)window_ptr; - char * title = GetStringNativeChars(env, title_obj); - setWindowTitle(disp, window, title); - free(title); -} - -static void freeIconPixmap(Display *disp) { - if (current_icon_mask_pixmap != 0) { - XFreePixmap(disp, current_icon_mask_pixmap); - current_icon_mask_pixmap = 0; - } - if (current_icon_pixmap != 0) { - XFreePixmap(disp, current_icon_pixmap); - current_icon_pixmap = 0; - } -} - -static void destroyWindow(JNIEnv *env, Display *disp, Window window) { - if (glx_window != None) { - lwjgl_glXDestroyWindow(disp, glx_window); - glx_window = None; - } - XDestroyWindow(disp, window); - XFreeColormap(disp, cmap); - freeIconPixmap(disp); -} - -static bool isNetWMFullscreenSupported(JNIEnv *env, Display *disp, int screen) { - unsigned long nitems; - Atom actual_type; - int actual_format; - unsigned long bytes_after; - Atom *supported_list; - Atom netwm_supported_atom = XInternAtom(disp, "_NET_SUPPORTED", False); - int result = XGetWindowProperty(disp, RootWindow(disp, screen), netwm_supported_atom, 0, 10000, False, AnyPropertyType, &actual_type, &actual_format, &nitems, &bytes_after, (void *)&supported_list); - if (result != Success) { - throwException(env, "Unable to query _NET_SUPPORTED window property"); - return false; - } - Atom fullscreen_atom = XInternAtom(disp, "_NET_WM_STATE_FULLSCREEN", False); - bool supported = false; - unsigned long i; - for (i = 0; i < nitems; i++) { - if (fullscreen_atom == supported_list[i]) { - supported = true; - break; - } - } - XFree(supported_list); - return supported; -} - -JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nIsNetWMFullscreenSupported(JNIEnv *env, jclass unused, jlong display, jint screen) { - Display *disp = (Display *)(intptr_t)display; - return isNetWMFullscreenSupported(env, disp, screen) ? JNI_TRUE : JNI_FALSE; -} - -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nReshape(JNIEnv *env, jclass clazz, jlong display, jlong window_ptr, jint x, jint y, jint width, jint height) { - Display *disp = (Display *)(intptr_t)display; - Window window = (Window)window_ptr; - XMoveWindow(disp, window, x, y); - XResizeWindow(disp, window, width, height); -} - -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_synchronize(JNIEnv *env, jclass clazz, jlong display, jboolean synchronize) { - Display *disp = (Display *)(intptr_t)display; - XSynchronize(disp, synchronize ? True : False); -} - -JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxDisplay_getRootWindow(JNIEnv *env, jclass clazz, jlong display, jint screen) { - Display *disp = (Display *)(intptr_t)display; - return RootWindow(disp, screen); -} - -static void updateWindowHints(JNIEnv *env, Display *disp, Window window) { - XWMHints* win_hints = XAllocWMHints(); - if (win_hints == NULL) { - throwException(env, "XAllocWMHints failed"); - return; - } - - win_hints->flags = InputHint; - win_hints->input = True; - if (current_icon_pixmap != 0) { - win_hints->flags |= IconPixmapHint; - win_hints->icon_pixmap = current_icon_pixmap; - } - if (current_icon_mask_pixmap != 0) { - win_hints->flags |= IconMaskHint; - win_hints->icon_mask = current_icon_mask_pixmap; - } - - XSetWMHints(disp, window, win_hints); - XFree(win_hints); - XFlush(disp); -} - -static Window createWindow(JNIEnv* env, Display *disp, int screen, jint window_mode, X11PeerInfo *peer_info, int x, int y, int width, int height, jboolean undecorated, long parent_handle) { - Window parent = (Window)parent_handle; - Window win; - XSetWindowAttributes attribs; - int attribmask; - - XVisualInfo *vis_info = getVisualInfoFromPeerInfo(env, peer_info); - if (vis_info == NULL) - return false; - cmap = XCreateColormap(disp, parent, vis_info->visual, AllocNone); - attribs.colormap = cmap; - attribs.border_pixel = 0; - attribs.event_mask = ExposureMask | FocusChangeMask | VisibilityChangeMask | StructureNotifyMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | PointerMotionMask| EnterWindowMask | LeaveWindowMask; - attribmask = CWColormap | CWEventMask | CWBorderPixel; - if (isLegacyFullscreen(window_mode)) { - attribmask |= CWOverrideRedirect; - attribs.override_redirect = True; - } - win = XCreateWindow(disp, parent, x, y, width, height, 0, vis_info->depth, InputOutput, vis_info->visual, attribmask, &attribs); - - current_depth = vis_info->depth; - current_visual = vis_info->visual; - - XFree(vis_info); - if (!checkXError(env, disp)) { - XFreeColormap(disp, cmap); - return false; - } -// printfDebugJava(env, "Created window"); - if (undecorated) { - // Use Motif decoration hint property and hope the window manager respects them - setDecorations(disp, win, 0); - } - XSizeHints * size_hints = XAllocSizeHints(); - size_hints->flags = PMinSize | PMaxSize; - size_hints->min_width = width; - size_hints->max_width = width; - size_hints->min_height = height; - size_hints->max_height = height; - XSetWMNormalHints(disp, win, size_hints); - updateWindowHints(env, disp, win); - XFree(size_hints); -#define NUM_ATOMS 1 - Atom protocol_atoms[NUM_ATOMS] = {XInternAtom(disp, "WM_DELETE_WINDOW", False)/*, XInternAtom(disp, "WM_TAKE_FOCUS", False)*/}; - XSetWMProtocols(disp, win, protocol_atoms, NUM_ATOMS); - if (window_mode == org_lwjgl_opengl_LinuxDisplay_FULLSCREEN_NETWM) { - Atom fullscreen_atom = XInternAtom(disp, "_NET_WM_STATE_FULLSCREEN", False); - XChangeProperty(disp, win, XInternAtom(disp, "_NET_WM_STATE", False), - XInternAtom(disp, "ATOM", False), 32, PropModeReplace, (const unsigned char*)&fullscreen_atom, 1); - } - if (!checkXError(env, disp)) { - destroyWindow(env, disp, win); - return 0; - } - return win; -} - -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_reparentWindow(JNIEnv *env, jclass unused, jlong display, jlong window_ptr, jlong parent_ptr, jint x, jint y) { - Display *disp = (Display *)(intptr_t)display; - Window window = (Window)window_ptr; - Window parent = (Window)parent_ptr; - XReparentWindow(disp, window, parent, x, y); -} - -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_mapRaised(JNIEnv *env, jclass unused, jlong display, jlong window_ptr) { - Display *disp = (Display *)(intptr_t)display; - Window window = (Window)window_ptr; - XMapRaised(disp, window); -} - -JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxDisplay_getParentWindow(JNIEnv *env, jclass unused, jlong display, jlong window_ptr) { - Display *disp = (Display *)(intptr_t)display; - Window window = (Window)window_ptr; - Window root, parent; - Window *children; - unsigned int nchildren; - if (XQueryTree(disp, window, &root, &parent, &children, &nchildren) == 0) { - throwException(env, "XQueryTree failed"); - return None; - } - if (children != NULL) - XFree(children); - return parent; -} - -JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_LinuxDisplay_hasProperty(JNIEnv *env, jclass unusued, jlong display, jlong window_ptr, jlong property_ptr) { - Display *disp = (Display *)(intptr_t)display; - Window window = (Window)window_ptr; - Atom property = (Atom)property_ptr; - int num_props; - Atom *properties = XListProperties(disp, window, &num_props); - if (properties == NULL) - return JNI_FALSE; - jboolean result = JNI_FALSE; - for (int i = 0; i < num_props; i++) { - if (properties[i] == property) { - result = JNI_TRUE; - break; - } - } - XFree(properties); - return result; -} - -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_setInputFocus(JNIEnv *env, jclass clazz, jlong display, jlong window_ptr, jlong time) { - Display *disp = (Display *)(intptr_t)display; - Window window = (Window)window_ptr; - XSetInputFocus(disp, window, RevertToParent, time); -} - -JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nCreateWindow(JNIEnv *env, jclass clazz, jlong display, jint screen, jobject peer_info_handle, jobject mode, jint window_mode, jint x, jint y, jboolean undecorated, jlong parent_handle) { - Display *disp = (Display *)(intptr_t)display; - X11PeerInfo *peer_info = (*env)->GetDirectBufferAddress(env, peer_info_handle); - GLXFBConfig *fb_config = NULL; - if (peer_info->glx13) { - fb_config = getFBConfigFromPeerInfo(env, peer_info); - if (fb_config == NULL) - return 0; - } - jclass cls_displayMode = (*env)->GetObjectClass(env, mode); - jfieldID fid_width = (*env)->GetFieldID(env, cls_displayMode, "width", "I"); - jfieldID fid_height = (*env)->GetFieldID(env, cls_displayMode, "height", "I"); - int width = (*env)->GetIntField(env, mode, fid_width); - int height = (*env)->GetIntField(env, mode, fid_height); - Window win = createWindow(env, disp, screen, window_mode, peer_info, x, y, width, height, undecorated, parent_handle); - if ((*env)->ExceptionOccurred(env)) { - return 0; - } - if (peer_info->glx13) { - glx_window = lwjgl_glXCreateWindow(disp, *fb_config, win, NULL); - XFree(fb_config); - } - if (!checkXError(env, disp)) { - lwjgl_glXDestroyWindow(disp, glx_window); - destroyWindow(env, disp, win); - } - return win; -} - -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nDestroyWindow(JNIEnv *env, jclass clazz, jlong display, jlong window_ptr) { - Display *disp = (Display *)(intptr_t)display; - Window window = (Window)window_ptr; - destroyWindow(env, disp, window); -} - -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nLockAWT(JNIEnv *env, jclass clazz) { - JAWT jawt; - jawt.version = JAWT_VERSION_1_4; - if (JAWT_GetAWT(env, &jawt) != JNI_TRUE) { - throwException(env, "GetAWT failed"); - return; - } - jawt.Lock(env); -} - -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nUnlockAWT(JNIEnv *env, jclass clazz) { - JAWT jawt; - jawt.version = JAWT_VERSION_1_4; - if (JAWT_GetAWT(env, &jawt) != JNI_TRUE) { - throwException(env, "GetAWT failed"); - return; - } - jawt.Unlock(env); -} - -static Pixmap createPixmapFromBuffer(JNIEnv *env, Display *disp, Window window, char *data, int data_size, int width, int height, int format, int depth) { - Pixmap pixmap = XCreatePixmap(disp, window, width, height, depth); - /* We need to copy the image data since XDestroyImage will also free its data buffer, which can't be allowed - * since the data buffer is managed by the jvm (it's the storage for the direct ByteBuffer) - */ - char *icon_copy = (char *)malloc(sizeof(*icon_copy)*data_size); - - if (icon_copy == NULL) { - XFreePixmap(disp, pixmap); - throwException(env, "malloc failed"); - return None; - } - memcpy(icon_copy, data, data_size); - XImage *image = XCreateImage(disp, current_visual, depth, format, 0, icon_copy, width, height, 32, 0); - if (image == NULL) { - XFreePixmap(disp, pixmap); - free(icon_copy); - throwException(env, "XCreateImage failed"); - return None; - } - - GC gc = XCreateGC(disp, pixmap, 0, NULL); - XPutImage(disp, pixmap, gc, image, 0, 0, 0, 0, width, height); - XFreeGC(disp, gc); - XDestroyImage(image); - // We won't free icon_copy because it is freed by XDestroyImage - return pixmap; -} - -static void setIcon(JNIEnv *env, Display *disp, Window window, char *rgb_data, int rgb_size, char *mask_data, int mask_size, int width, int height) { - freeIconPixmap(disp); - current_icon_pixmap = createPixmapFromBuffer(env, disp, window, rgb_data, rgb_size, width, height, ZPixmap, current_depth); - if ((*env)->ExceptionCheck(env)) - return; - current_icon_mask_pixmap = createPixmapFromBuffer(env, disp, window, mask_data, mask_size, width, height, XYPixmap, 1); - if ((*env)->ExceptionCheck(env)) { - freeIconPixmap(disp); - return; - } - - updateWindowHints(env, disp, window); -} - -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nSetWindowIcon - (JNIEnv *env, jclass clazz, jlong display, jlong window_ptr, jobject icon_rgb_buffer, jint rgb_size, jobject icon_mask_buffer, jint mask_size, jint width, jint height) -{ - Display *disp = (Display *)(intptr_t)display; - Window window = (Window)window_ptr; - char *rgb_data= (char *)(*env)->GetDirectBufferAddress(env, icon_rgb_buffer); - char *mask_data= (char *)(*env)->GetDirectBufferAddress(env, icon_mask_buffer); - - setIcon(env, disp, window, rgb_data, rgb_size, mask_data, mask_size, width, height); -} - -JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nUngrabKeyboard(JNIEnv *env, jclass unused, jlong display_ptr) { - Display *disp = (Display *)(intptr_t)display_ptr; - return XUngrabKeyboard(disp, CurrentTime); -} - -JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGrabKeyboard(JNIEnv *env, jclass unused, jlong display_ptr, jlong window_ptr) { - Display *disp = (Display *)(intptr_t)display_ptr; - Window win = (Window)window_ptr; - return XGrabKeyboard(disp, win, False, GrabModeAsync, GrabModeAsync, CurrentTime); -} - -JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGrabPointer(JNIEnv *env, jclass unused, jlong display_ptr, jlong window_ptr, jlong cursor_ptr) { - Display *disp = (Display *)(intptr_t)display_ptr; - Window win = (Window)window_ptr; - Cursor cursor = (Cursor)cursor_ptr; - int grab_mask = PointerMotionMask | ButtonPressMask | ButtonReleaseMask; - return XGrabPointer(disp, win, False, grab_mask, GrabModeAsync, GrabModeAsync, win, cursor, CurrentTime); -} - -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nSetViewPort(JNIEnv *env, jclass unused, jlong display_ptr, jlong window_ptr, jint screen) { - Display *disp = (Display *)(intptr_t)display_ptr; - Window win = (Window)window_ptr; - XWindowAttributes win_attribs; - - XGetWindowAttributes(disp, win, &win_attribs); - XF86VidModeSetViewPort(disp, screen, win_attribs.x, win_attribs.y); -} - -JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nUngrabPointer(JNIEnv *env, jclass unused, jlong display_ptr) { - Display *disp = (Display *)(intptr_t)display_ptr; - return XUngrabPointer(disp, CurrentTime); -} - -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nDefineCursor(JNIEnv *env, jclass unused, jlong display_ptr, jlong window_ptr, jlong cursor_ptr) { - Display *disp = (Display *)(intptr_t)display_ptr; - Window win = (Window)window_ptr; - Cursor cursor = (Cursor)cursor_ptr; - XDefineCursor(disp, win, cursor); -} - -JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nCreateBlankCursor(JNIEnv *env, jclass unused, jlong display_ptr, jlong window_ptr) { - Display *disp = (Display *)(intptr_t)display_ptr; - Window win = (Window)window_ptr; - unsigned int best_width, best_height; - if (XQueryBestCursor(disp, win, 1, 1, &best_width, &best_height) == 0) { - throwException(env, "Could not query best cursor size"); - return false; - } - Pixmap mask = XCreatePixmap(disp, win, best_width, best_height, 1); - XGCValues gc_values; - gc_values.foreground = 0; - GC gc = XCreateGC(disp, mask, GCForeground, &gc_values); - XFillRectangle(disp, mask, gc, 0, 0, best_width, best_height); - XFreeGC(disp, gc); - XColor dummy_color; - Cursor cursor = XCreatePixmapCursor(disp, mask, mask, &dummy_color, &dummy_color, 0, 0); - XFreePixmap(disp, mask); - return cursor; -} - -JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetInputFocus(JNIEnv *env, jclass unused, jlong display_ptr) { - Display *disp = (Display *)(intptr_t)display_ptr; - int revert_mode; - Window win; - XGetInputFocus(disp, &win, &revert_mode); - return win; -} - -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nIconifyWindow(JNIEnv *env, jclass unused, jlong display_ptr, jlong window_ptr, jint screen) { - Display *disp = (Display *)(intptr_t)display_ptr; - Window win = (Window)window_ptr; - XIconifyWindow(disp, win, screen); -} diff -Nru lwjgl-2.7.1+dfsg/src/native/linux/org_lwjgl_opengl_LinuxAWTGLCanvasPeerInfo.c lwjgl-2.9.3+dfsg/src/native/linux/org_lwjgl_opengl_LinuxAWTGLCanvasPeerInfo.c --- lwjgl-2.7.1+dfsg/src/native/linux/org_lwjgl_opengl_LinuxAWTGLCanvasPeerInfo.c 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/linux/org_lwjgl_opengl_LinuxAWTGLCanvasPeerInfo.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2002-2008 LWJGL Project - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of 'LWJGL' nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/** - * $Id: org_lwjgl_opengl_LinuxAWTGLCanvasPeerInfo.c 2985 2008-04-07 18:42:36Z matzon $ - * - * @author elias_naur - * @version $Revision: 2985 $ - */ - -#include -#include -#include -#include -#include -#include "awt_tools.h" -#include "org_lwjgl_opengl_LinuxAWTGLCanvasPeerInfo.h" -#include "context.h" - -JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxAWTGLCanvasPeerInfo_getScreenFromSurfaceInfo - (JNIEnv *env, jclass clazz, jobject lock_buffer_handle) { - const AWTSurfaceLock *awt_lock = (AWTSurfaceLock *)(*env)->GetDirectBufferAddress(env, lock_buffer_handle); - // Get the platform-specific drawing info - JAWT_X11DrawingSurfaceInfo *dsi_x11 = (JAWT_X11DrawingSurfaceInfo*)awt_lock->dsi->platformInfo; - - XVisualInfo template; - int num_infos; - template.visualid = dsi_x11->visualID; - template.depth = dsi_x11->depth; - XVisualInfo *vis_info = XGetVisualInfo(dsi_x11->display, VisualIDMask | VisualDepthMask, &template, &num_infos); - if (vis_info == NULL) { - throwException(env, "Could not determine screen"); - return -1; - } - int screen = vis_info[0].screen; - XFree(vis_info); - return screen; -} - -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxAWTGLCanvasPeerInfo_nInitHandle - (JNIEnv *env, jclass clazz, int screen, jobject lock_buffer_handle, jobject peer_info_handle) { - const AWTSurfaceLock *awt_lock = (AWTSurfaceLock *)(*env)->GetDirectBufferAddress(env, lock_buffer_handle); - X11PeerInfo *peer_info = (X11PeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); - // Get the platform-specific drawing info - JAWT_X11DrawingSurfaceInfo *dsi_x11 = (JAWT_X11DrawingSurfaceInfo*)awt_lock->dsi->platformInfo; - - peer_info->display = dsi_x11->display; - peer_info->screen = screen; - peer_info->drawable = dsi_x11->drawable; - peer_info->glx13 = false; - peer_info->config.glx_config.visualid = dsi_x11->visualID; - peer_info->config.glx_config.depth = dsi_x11->depth; -} diff -Nru lwjgl-2.7.1+dfsg/src/native/linux/org_lwjgl_opengl_LinuxCanvasImplementation.c lwjgl-2.9.3+dfsg/src/native/linux/org_lwjgl_opengl_LinuxCanvasImplementation.c --- lwjgl-2.7.1+dfsg/src/native/linux/org_lwjgl_opengl_LinuxCanvasImplementation.c 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/linux/org_lwjgl_opengl_LinuxCanvasImplementation.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2002-2008 LWJGL Project - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of 'LWJGL' nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/** - * $Id: org_lwjgl_opengl_LinuxCanvasImplementation.c 2985 2008-04-07 18:42:36Z matzon $ - * - * @author elias_naur - * @version $Revision: 2985 $ - */ - -#include -#include -#include -#include -#include "org_lwjgl_opengl_LinuxCanvasImplementation.h" -#include "extgl_glx.h" -#include "context.h" - -JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxCanvasImplementation_nFindVisualIDFromFormat - (JNIEnv *env, jclass clazz, jlong display, jint screen, jobject pixel_format) { - Display *disp = (Display *)(intptr_t)display; - GLXExtensions extension_flags; - if (!extgl_InitGLX(disp, screen, &extension_flags)) { - throwException(env, "Could not initialize GLX"); - return -1; - } - XVisualInfo *vis_info = chooseVisualGLX(env, disp, screen, pixel_format, true, true); - if (vis_info == NULL) { - throwException(env, "Could not choose a VisualInfo"); - return -1; - } - - VisualID vis_id = vis_info->visualid; - XFree(vis_info); - return vis_id; -} diff -Nru lwjgl-2.7.1+dfsg/src/native/linux/org_lwjgl_opengl_LinuxContextImplementation.c lwjgl-2.9.3+dfsg/src/native/linux/org_lwjgl_opengl_LinuxContextImplementation.c --- lwjgl-2.7.1+dfsg/src/native/linux/org_lwjgl_opengl_LinuxContextImplementation.c 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/linux/org_lwjgl_opengl_LinuxContextImplementation.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,200 +0,0 @@ -/* - * Copyright (c) 2002-2008 LWJGL Project - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of 'LWJGL' nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/** - * $Id: org_lwjgl_opengl_LinuxContextImplementation.c 3412 2010-09-26 23:43:24Z spasi $ - * - * @author elias_naur - * @version $Revision: 3412 $ - */ - -#include -#include -#include -#include -#include "org_lwjgl_opengl_LinuxContextImplementation.h" -#include "extgl_glx.h" -#include "context.h" -#include "common_tools.h" - -typedef struct { - GLXExtensions extension_flags; - GLXContext context; -} X11Context; - -static bool checkContext(JNIEnv *env, Display *display, GLXContext context) { - if (context == NULL) { - throwException(env, "Could not create GLX context"); - return false; - } - /* - * Ditched the requirement that contexts have to be direct. It was - * never true that all accelerated contexts are direct, but it - * was a reasonable test until the appearance of Xgl and AIGLX. - * Now the test is at best useless, and at worst wrong, - * in case the current X server accelerates indirect rendering. - */ -/* jboolean allow_software_acceleration = getBooleanProperty(env, "org.lwjgl.opengl.Display.allowSoftwareOpenGL"); - if (!allow_software_acceleration && lwjgl_glXIsDirect(display, context) == False) { - lwjgl_glXDestroyContext(display, context); - throwException(env, "Could not create a direct GLX context"); - return false; - }*/ - return true; -} - -static void createContextGLX13(JNIEnv *env, X11PeerInfo *peer_info, X11Context *context_info, jobject attribs, GLXContext shared_context) { - GLXFBConfig *config = getFBConfigFromPeerInfo(env, peer_info); - if (config == NULL) - return; - GLXContext context; - if (attribs) { - const int *attrib_list = (const int *)(*env)->GetDirectBufferAddress(env, attribs); - context = lwjgl_glXCreateContextAttribsARB(peer_info->display, *config, shared_context, True, attrib_list); - } else { - int render_type; - if (lwjgl_glXGetFBConfigAttrib(peer_info->display, *config, GLX_RENDER_TYPE, &render_type) != 0) { - throwException(env, "Could not get GLX_RENDER_TYPE attribute"); - return; - } - int context_render_type = (render_type & GLX_RGBA_FLOAT_BIT) != 0 ? GLX_RGBA_FLOAT_TYPE : GLX_RGBA_TYPE; - context = lwjgl_glXCreateNewContext(peer_info->display, *config, context_render_type, shared_context, True); - } - XFree(config); - if (!checkContext(env, peer_info->display, context)) - return; - context_info->context = context; -} - -static void createContextGLX(JNIEnv *env, X11PeerInfo *peer_info, X11Context *context_info, GLXContext shared_context) { - XVisualInfo *vis_info = getVisualInfoFromPeerInfo(env, peer_info); - if (vis_info == NULL) - return; - GLXContext context = lwjgl_glXCreateContext(peer_info->display, vis_info, shared_context, True); - XFree(vis_info); - if (!checkContext(env, peer_info->display, context)) - return; - context_info->context = context; -} - -JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxContextImplementation_getGLXContext(JNIEnv *env, jclass clazz, jobject context_handle) { - X11Context *context_info = (*env)->GetDirectBufferAddress(env, context_handle); - return (intptr_t)context_info->context; -} - -JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxContextImplementation_getDisplay(JNIEnv *env, jclass clazz, jobject peer_info_handle) { - X11PeerInfo *peer_info = (*env)->GetDirectBufferAddress(env, peer_info_handle); - return (intptr_t)peer_info->display; -} - -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxContextImplementation_nSetSwapInterval - (JNIEnv *env, jclass clazz, jobject context_handle, jint value) -{ - X11Context *context_info = (*env)->GetDirectBufferAddress(env, context_handle); - if (context_info->extension_flags.GLX_SGI_swap_control) { - lwjgl_glXSwapIntervalSGI(value); - } -} - -JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_LinuxContextImplementation_nCreate - (JNIEnv *env , jclass clazz, jobject peer_handle, jobject attribs, jobject shared_context_handle) { - jobject context_handle = newJavaManagedByteBuffer(env, sizeof(X11Context)); - if (context_handle == NULL) { - throwException(env, "Could not allocate handle buffer"); - return NULL; - } - X11PeerInfo *peer_info = (*env)->GetDirectBufferAddress(env, peer_handle); - X11Context *context_info = (*env)->GetDirectBufferAddress(env, context_handle); - GLXExtensions extension_flags; - if (!extgl_InitGLX(peer_info->display, peer_info->screen, &extension_flags)) { - throwException(env, "Could not initialize GLX"); - return NULL; - } - GLXContext shared_context = NULL; - if (shared_context_handle != NULL) { - X11Context *shared_context_info = (*env)->GetDirectBufferAddress(env, shared_context_handle); - shared_context = shared_context_info->context; - } - if (peer_info->glx13) { - createContextGLX13(env, peer_info, context_info, extension_flags.GLX_ARB_create_context ? attribs : NULL, shared_context); - } else { - createContextGLX(env, peer_info, context_info, shared_context); - } - context_info->extension_flags = extension_flags; - return context_handle; -} - -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxContextImplementation_nDestroy - (JNIEnv *env, jclass clazz, jobject peer_handle, jobject context_handle) { - X11PeerInfo *peer_info = (*env)->GetDirectBufferAddress(env, peer_handle); - X11Context *context_info = (*env)->GetDirectBufferAddress(env, context_handle); - lwjgl_glXDestroyContext(peer_info->display, context_info->context); -} - -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxContextImplementation_nReleaseCurrentContext - (JNIEnv *env , jclass clazz, jobject peer_info_handle) { - X11PeerInfo *peer_info = (*env)->GetDirectBufferAddress(env, peer_info_handle); - Bool result; - if (peer_info->glx13) { - result = lwjgl_glXMakeContextCurrent(peer_info->display, None, None, NULL); - } else { - result = lwjgl_glXMakeCurrent(peer_info->display, None, NULL); - } - if (!result) - throwException(env, "Could not release current context"); -} - -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxContextImplementation_nMakeCurrent - (JNIEnv *env, jclass clazz, jobject peer_info_handle, jobject context_handle) { - X11PeerInfo *peer_info = (*env)->GetDirectBufferAddress(env, peer_info_handle); - X11Context *context_info = (*env)->GetDirectBufferAddress(env, context_handle); - Bool result; - if (peer_info->glx13) { - result = lwjgl_glXMakeContextCurrent(peer_info->display, peer_info->drawable, peer_info->drawable, context_info->context); - } else { - result = lwjgl_glXMakeCurrent(peer_info->display, peer_info->drawable, context_info->context); - } - if (!result) - throwException(env, "Could not make context current"); -} - -JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_LinuxContextImplementation_nIsCurrent - (JNIEnv *env, jclass clazz, jobject context_handle) { - X11Context *context_info = (*env)->GetDirectBufferAddress(env, context_handle); - return context_info->context == lwjgl_glXGetCurrentContext(); -} - -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxContextImplementation_nSwapBuffers - (JNIEnv *env, jclass clazz, jobject peer_info_handle) { - X11PeerInfo *peer_info = (*env)->GetDirectBufferAddress(env, peer_info_handle); - lwjgl_glXSwapBuffers(peer_info->display, peer_info->drawable); -} diff -Nru lwjgl-2.7.1+dfsg/src/native/linux/org_lwjgl_opengl_LinuxDisplay_Compiz.h lwjgl-2.9.3+dfsg/src/native/linux/org_lwjgl_opengl_LinuxDisplay_Compiz.h --- lwjgl-2.7.1+dfsg/src/native/linux/org_lwjgl_opengl_LinuxDisplay_Compiz.h 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/linux/org_lwjgl_opengl_LinuxDisplay_Compiz.h 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,13 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_lwjgl_opengl_LinuxDisplay_Compiz */ + +#ifndef _Included_org_lwjgl_opengl_LinuxDisplay_Compiz +#define _Included_org_lwjgl_opengl_LinuxDisplay_Compiz +#ifdef __cplusplus +extern "C" { +#endif +#ifdef __cplusplus +} +#endif +#endif diff -Nru lwjgl-2.7.1+dfsg/src/native/linux/org_lwjgl_opengl_LinuxDisplay_Compiz_Provider.h lwjgl-2.9.3+dfsg/src/native/linux/org_lwjgl_opengl_LinuxDisplay_Compiz_Provider.h --- lwjgl-2.7.1+dfsg/src/native/linux/org_lwjgl_opengl_LinuxDisplay_Compiz_Provider.h 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/linux/org_lwjgl_opengl_LinuxDisplay_Compiz_Provider.h 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,13 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_lwjgl_opengl_LinuxDisplay_Compiz_Provider */ + +#ifndef _Included_org_lwjgl_opengl_LinuxDisplay_Compiz_Provider +#define _Included_org_lwjgl_opengl_LinuxDisplay_Compiz_Provider +#ifdef __cplusplus +extern "C" { +#endif +#ifdef __cplusplus +} +#endif +#endif diff -Nru lwjgl-2.7.1+dfsg/src/native/linux/org_lwjgl_opengl_LinuxDisplay.h lwjgl-2.9.3+dfsg/src/native/linux/org_lwjgl_opengl_LinuxDisplay.h --- lwjgl-2.7.1+dfsg/src/native/linux/org_lwjgl_opengl_LinuxDisplay.h 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/linux/org_lwjgl_opengl_LinuxDisplay.h 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,503 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_lwjgl_opengl_LinuxDisplay */ + +#ifndef _Included_org_lwjgl_opengl_LinuxDisplay +#define _Included_org_lwjgl_opengl_LinuxDisplay +#ifdef __cplusplus +extern "C" { +#endif +#undef org_lwjgl_opengl_LinuxDisplay_CurrentTime +#define org_lwjgl_opengl_LinuxDisplay_CurrentTime 0L +#undef org_lwjgl_opengl_LinuxDisplay_GrabSuccess +#define org_lwjgl_opengl_LinuxDisplay_GrabSuccess 0L +#undef org_lwjgl_opengl_LinuxDisplay_AutoRepeatModeOff +#define org_lwjgl_opengl_LinuxDisplay_AutoRepeatModeOff 0L +#undef org_lwjgl_opengl_LinuxDisplay_AutoRepeatModeOn +#define org_lwjgl_opengl_LinuxDisplay_AutoRepeatModeOn 1L +#undef org_lwjgl_opengl_LinuxDisplay_AutoRepeatModeDefault +#define org_lwjgl_opengl_LinuxDisplay_AutoRepeatModeDefault 2L +#undef org_lwjgl_opengl_LinuxDisplay_None +#define org_lwjgl_opengl_LinuxDisplay_None 0L +#undef org_lwjgl_opengl_LinuxDisplay_KeyPressMask +#define org_lwjgl_opengl_LinuxDisplay_KeyPressMask 1L +#undef org_lwjgl_opengl_LinuxDisplay_KeyReleaseMask +#define org_lwjgl_opengl_LinuxDisplay_KeyReleaseMask 2L +#undef org_lwjgl_opengl_LinuxDisplay_ButtonPressMask +#define org_lwjgl_opengl_LinuxDisplay_ButtonPressMask 4L +#undef org_lwjgl_opengl_LinuxDisplay_ButtonReleaseMask +#define org_lwjgl_opengl_LinuxDisplay_ButtonReleaseMask 8L +#undef org_lwjgl_opengl_LinuxDisplay_NotifyAncestor +#define org_lwjgl_opengl_LinuxDisplay_NotifyAncestor 0L +#undef org_lwjgl_opengl_LinuxDisplay_NotifyNonlinear +#define org_lwjgl_opengl_LinuxDisplay_NotifyNonlinear 3L +#undef org_lwjgl_opengl_LinuxDisplay_NotifyPointer +#define org_lwjgl_opengl_LinuxDisplay_NotifyPointer 5L +#undef org_lwjgl_opengl_LinuxDisplay_NotifyPointerRoot +#define org_lwjgl_opengl_LinuxDisplay_NotifyPointerRoot 6L +#undef org_lwjgl_opengl_LinuxDisplay_NotifyDetailNone +#define org_lwjgl_opengl_LinuxDisplay_NotifyDetailNone 7L +#undef org_lwjgl_opengl_LinuxDisplay_SetModeInsert +#define org_lwjgl_opengl_LinuxDisplay_SetModeInsert 0L +#undef org_lwjgl_opengl_LinuxDisplay_SaveSetRoot +#define org_lwjgl_opengl_LinuxDisplay_SaveSetRoot 1L +#undef org_lwjgl_opengl_LinuxDisplay_SaveSetUnmap +#define org_lwjgl_opengl_LinuxDisplay_SaveSetUnmap 1L +#undef org_lwjgl_opengl_LinuxDisplay_X_SetInputFocus +#define org_lwjgl_opengl_LinuxDisplay_X_SetInputFocus 42L +#undef org_lwjgl_opengl_LinuxDisplay_FULLSCREEN_LEGACY +#define org_lwjgl_opengl_LinuxDisplay_FULLSCREEN_LEGACY 1L +#undef org_lwjgl_opengl_LinuxDisplay_FULLSCREEN_NETWM +#define org_lwjgl_opengl_LinuxDisplay_FULLSCREEN_NETWM 2L +#undef org_lwjgl_opengl_LinuxDisplay_WINDOWED +#define org_lwjgl_opengl_LinuxDisplay_WINDOWED 3L +#undef org_lwjgl_opengl_LinuxDisplay_XRANDR +#define org_lwjgl_opengl_LinuxDisplay_XRANDR 10L +#undef org_lwjgl_opengl_LinuxDisplay_XF86VIDMODE +#define org_lwjgl_opengl_LinuxDisplay_XF86VIDMODE 11L +#undef org_lwjgl_opengl_LinuxDisplay_NONE +#define org_lwjgl_opengl_LinuxDisplay_NONE 12L +/* + * Class: org_lwjgl_opengl_LinuxDisplay + * Method: nGetCurrentGammaRamp + * Signature: (JI)Ljava/nio/ByteBuffer; + */ +JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetCurrentGammaRamp + (JNIEnv *, jclass, jlong, jint); + +/* + * Class: org_lwjgl_opengl_LinuxDisplay + * Method: nIsXrandrSupported + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nIsXrandrSupported + (JNIEnv *, jclass, jlong); + +/* + * Class: org_lwjgl_opengl_LinuxDisplay + * Method: nIsXF86VidModeSupported + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nIsXF86VidModeSupported + (JNIEnv *, jclass, jlong); + +/* + * Class: org_lwjgl_opengl_LinuxDisplay + * Method: nIsNetWMFullscreenSupported + * Signature: (JI)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nIsNetWMFullscreenSupported + (JNIEnv *, jclass, jlong, jint); + +/* + * Class: org_lwjgl_opengl_LinuxDisplay + * Method: nLockAWT + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nLockAWT + (JNIEnv *, jclass); + +/* + * Class: org_lwjgl_opengl_LinuxDisplay + * Method: nUnlockAWT + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nUnlockAWT + (JNIEnv *, jclass); + +/* + * Class: org_lwjgl_opengl_LinuxDisplay + * Method: callErrorHandler + * Signature: (JJJ)I + */ +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_callErrorHandler + (JNIEnv *, jclass, jlong, jlong, jlong); + +/* + * Class: org_lwjgl_opengl_LinuxDisplay + * Method: setErrorHandler + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxDisplay_setErrorHandler + (JNIEnv *, jclass); + +/* + * Class: org_lwjgl_opengl_LinuxDisplay + * Method: resetErrorHandler + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxDisplay_resetErrorHandler + (JNIEnv *, jclass, jlong); + +/* + * Class: org_lwjgl_opengl_LinuxDisplay + * Method: synchronize + * Signature: (JZ)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_synchronize + (JNIEnv *, jclass, jlong, jboolean); + +/* + * Class: org_lwjgl_opengl_LinuxDisplay + * Method: getErrorText + * Signature: (JJ)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_org_lwjgl_opengl_LinuxDisplay_getErrorText + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: org_lwjgl_opengl_LinuxDisplay + * Method: openDisplay + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxDisplay_openDisplay + (JNIEnv *, jclass); + +/* + * Class: org_lwjgl_opengl_LinuxDisplay + * Method: closeDisplay + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_closeDisplay + (JNIEnv *, jclass, jlong); + +/* + * Class: org_lwjgl_opengl_LinuxDisplay + * Method: nGetDefaultScreen + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetDefaultScreen + (JNIEnv *, jclass, jlong); + +/* + * Class: org_lwjgl_opengl_LinuxDisplay + * Method: nUngrabKeyboard + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nUngrabKeyboard + (JNIEnv *, jclass, jlong); + +/* + * Class: org_lwjgl_opengl_LinuxDisplay + * Method: nGrabKeyboard + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGrabKeyboard + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: org_lwjgl_opengl_LinuxDisplay + * Method: nGrabPointer + * Signature: (JJJ)I + */ +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGrabPointer + (JNIEnv *, jclass, jlong, jlong, jlong); + +/* + * Class: org_lwjgl_opengl_LinuxDisplay + * Method: nSetViewPort + * Signature: (JJI)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nSetViewPort + (JNIEnv *, jclass, jlong, jlong, jint); + +/* + * Class: org_lwjgl_opengl_LinuxDisplay + * Method: nUngrabPointer + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nUngrabPointer + (JNIEnv *, jclass, jlong); + +/* + * Class: org_lwjgl_opengl_LinuxDisplay + * Method: nDefineCursor + * Signature: (JJJ)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nDefineCursor + (JNIEnv *, jclass, jlong, jlong, jlong); + +/* + * Class: org_lwjgl_opengl_LinuxDisplay + * Method: nCreateWindow + * Signature: (JILjava/nio/ByteBuffer;Lorg/lwjgl/opengl/DisplayMode;IIIZJZ)J + */ +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nCreateWindow + (JNIEnv *, jclass, jlong, jint, jobject, jobject, jint, jint, jint, jboolean, jlong, jboolean); + +/* + * Class: org_lwjgl_opengl_LinuxDisplay + * Method: getRootWindow + * Signature: (JI)J + */ +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxDisplay_getRootWindow + (JNIEnv *, jclass, jlong, jint); + +/* + * Class: org_lwjgl_opengl_LinuxDisplay + * Method: hasProperty + * Signature: (JJJ)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_LinuxDisplay_hasProperty + (JNIEnv *, jclass, jlong, jlong, jlong); + +/* + * Class: org_lwjgl_opengl_LinuxDisplay + * Method: getParentWindow + * Signature: (JJ)J + */ +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxDisplay_getParentWindow + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: org_lwjgl_opengl_LinuxDisplay + * Method: getChildCount + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_getChildCount + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: org_lwjgl_opengl_LinuxDisplay + * Method: mapRaised + * Signature: (JJ)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_mapRaised + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: org_lwjgl_opengl_LinuxDisplay + * Method: reparentWindow + * Signature: (JJJII)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_reparentWindow + (JNIEnv *, jclass, jlong, jlong, jlong, jint, jint); + +/* + * Class: org_lwjgl_opengl_LinuxDisplay + * Method: nGetInputFocus + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetInputFocus + (JNIEnv *, jclass, jlong); + +/* + * Class: org_lwjgl_opengl_LinuxDisplay + * Method: nSetInputFocus + * Signature: (JJJ)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nSetInputFocus + (JNIEnv *, jclass, jlong, jlong, jlong); + +/* + * Class: org_lwjgl_opengl_LinuxDisplay + * Method: nSetWindowSize + * Signature: (JJIIZ)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nSetWindowSize + (JNIEnv *, jclass, jlong, jlong, jint, jint, jboolean); + +/* + * Class: org_lwjgl_opengl_LinuxDisplay + * Method: nGetX + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetX + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: org_lwjgl_opengl_LinuxDisplay + * Method: nGetY + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetY + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: org_lwjgl_opengl_LinuxDisplay + * Method: nGetWidth + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetWidth + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: org_lwjgl_opengl_LinuxDisplay + * Method: nGetHeight + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetHeight + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: org_lwjgl_opengl_LinuxDisplay + * Method: nDestroyWindow + * Signature: (JJ)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nDestroyWindow + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: org_lwjgl_opengl_LinuxDisplay + * Method: nSwitchDisplayMode + * Signature: (JIILorg/lwjgl/opengl/DisplayMode;)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nSwitchDisplayMode + (JNIEnv *, jclass, jlong, jint, jint, jobject); + +/* + * Class: org_lwjgl_opengl_LinuxDisplay + * Method: nInternAtom + * Signature: (JLjava/lang/String;Z)J + */ +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nInternAtom + (JNIEnv *, jclass, jlong, jstring, jboolean); + +/* + * Class: org_lwjgl_opengl_LinuxDisplay + * Method: nGetGammaRampLength + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetGammaRampLength + (JNIEnv *, jclass, jlong, jint); + +/* + * Class: org_lwjgl_opengl_LinuxDisplay + * Method: nSetGammaRamp + * Signature: (JILjava/nio/ByteBuffer;)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nSetGammaRamp + (JNIEnv *, jclass, jlong, jint, jobject); + +/* + * Class: org_lwjgl_opengl_LinuxDisplay + * Method: nConvertToNativeRamp + * Signature: (Ljava/nio/FloatBuffer;II)Ljava/nio/ByteBuffer; + */ +JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nConvertToNativeRamp + (JNIEnv *, jclass, jobject, jint, jint); + +/* + * Class: org_lwjgl_opengl_LinuxDisplay + * Method: nGetCurrentXRandrMode + * Signature: (JI)Lorg/lwjgl/opengl/DisplayMode; + */ +JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetCurrentXRandrMode + (JNIEnv *, jclass, jlong, jint); + +/* + * Class: org_lwjgl_opengl_LinuxDisplay + * Method: nSetTitle + * Signature: (JJJI)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nSetTitle + (JNIEnv *, jclass, jlong, jlong, jlong, jint); + +/* + * Class: org_lwjgl_opengl_LinuxDisplay + * Method: nSetClassHint + * Signature: (JJJJ)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nSetClassHint + (JNIEnv *, jclass, jlong, jlong, jlong, jlong); + +/* + * Class: org_lwjgl_opengl_LinuxDisplay + * Method: nReshape + * Signature: (JJIIII)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nReshape + (JNIEnv *, jclass, jlong, jlong, jint, jint, jint, jint); + +/* + * Class: org_lwjgl_opengl_LinuxDisplay + * Method: nGetAvailableDisplayModes + * Signature: (JII)[Lorg/lwjgl/opengl/DisplayMode; + */ +JNIEXPORT jobjectArray JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetAvailableDisplayModes + (JNIEnv *, jclass, jlong, jint, jint); + +/* + * Class: org_lwjgl_opengl_LinuxDisplay + * Method: nSync + * Signature: (JZ)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nSync + (JNIEnv *, jclass, jlong, jboolean); + +/* + * Class: org_lwjgl_opengl_LinuxDisplay + * Method: nIconifyWindow + * Signature: (JJI)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nIconifyWindow + (JNIEnv *, jclass, jlong, jlong, jint); + +/* + * Class: org_lwjgl_opengl_LinuxDisplay + * Method: nGetNativeCursorCapabilities + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetNativeCursorCapabilities + (JNIEnv *, jclass, jlong); + +/* + * Class: org_lwjgl_opengl_LinuxDisplay + * Method: nGetMinCursorSize + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetMinCursorSize + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: org_lwjgl_opengl_LinuxDisplay + * Method: nGetMaxCursorSize + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetMaxCursorSize + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: org_lwjgl_opengl_LinuxDisplay + * Method: nCreateCursor + * Signature: (JIIIIILjava/nio/IntBuffer;ILjava/nio/IntBuffer;I)J + */ +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nCreateCursor + (JNIEnv *, jclass, jlong, jint, jint, jint, jint, jint, jobject, jint, jobject, jint); + +/* + * Class: org_lwjgl_opengl_LinuxDisplay + * Method: nCreateBlankCursor + * Signature: (JJ)J + */ +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nCreateBlankCursor + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: org_lwjgl_opengl_LinuxDisplay + * Method: nDestroyCursor + * Signature: (JJ)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nDestroyCursor + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: org_lwjgl_opengl_LinuxDisplay + * Method: nGetPbufferCapabilities + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetPbufferCapabilities + (JNIEnv *, jclass, jlong, jint); + +/* + * Class: org_lwjgl_opengl_LinuxDisplay + * Method: nSetWindowIcon + * Signature: (JJLjava/nio/ByteBuffer;I)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nSetWindowIcon + (JNIEnv *, jclass, jlong, jlong, jobject, jint); + +#ifdef __cplusplus +} +#endif +#endif diff -Nru lwjgl-2.7.1+dfsg/src/native/linux/org_lwjgl_opengl_LinuxEvent.h lwjgl-2.9.3+dfsg/src/native/linux/org_lwjgl_opengl_LinuxEvent.h --- lwjgl-2.7.1+dfsg/src/native/linux/org_lwjgl_opengl_LinuxEvent.h 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/linux/org_lwjgl_opengl_LinuxEvent.h 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,257 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_lwjgl_opengl_LinuxEvent */ + +#ifndef _Included_org_lwjgl_opengl_LinuxEvent +#define _Included_org_lwjgl_opengl_LinuxEvent +#ifdef __cplusplus +extern "C" { +#endif +#undef org_lwjgl_opengl_LinuxEvent_FocusIn +#define org_lwjgl_opengl_LinuxEvent_FocusIn 9L +#undef org_lwjgl_opengl_LinuxEvent_FocusOut +#define org_lwjgl_opengl_LinuxEvent_FocusOut 10L +#undef org_lwjgl_opengl_LinuxEvent_KeyPress +#define org_lwjgl_opengl_LinuxEvent_KeyPress 2L +#undef org_lwjgl_opengl_LinuxEvent_KeyRelease +#define org_lwjgl_opengl_LinuxEvent_KeyRelease 3L +#undef org_lwjgl_opengl_LinuxEvent_ButtonPress +#define org_lwjgl_opengl_LinuxEvent_ButtonPress 4L +#undef org_lwjgl_opengl_LinuxEvent_ButtonRelease +#define org_lwjgl_opengl_LinuxEvent_ButtonRelease 5L +#undef org_lwjgl_opengl_LinuxEvent_MotionNotify +#define org_lwjgl_opengl_LinuxEvent_MotionNotify 6L +#undef org_lwjgl_opengl_LinuxEvent_EnterNotify +#define org_lwjgl_opengl_LinuxEvent_EnterNotify 7L +#undef org_lwjgl_opengl_LinuxEvent_LeaveNotify +#define org_lwjgl_opengl_LinuxEvent_LeaveNotify 8L +#undef org_lwjgl_opengl_LinuxEvent_UnmapNotify +#define org_lwjgl_opengl_LinuxEvent_UnmapNotify 18L +#undef org_lwjgl_opengl_LinuxEvent_MapNotify +#define org_lwjgl_opengl_LinuxEvent_MapNotify 19L +#undef org_lwjgl_opengl_LinuxEvent_Expose +#define org_lwjgl_opengl_LinuxEvent_Expose 12L +#undef org_lwjgl_opengl_LinuxEvent_ConfigureNotify +#define org_lwjgl_opengl_LinuxEvent_ConfigureNotify 22L +#undef org_lwjgl_opengl_LinuxEvent_ClientMessage +#define org_lwjgl_opengl_LinuxEvent_ClientMessage 33L +/* + * Class: org_lwjgl_opengl_LinuxEvent + * Method: createEventBuffer + * Signature: ()Ljava/nio/ByteBuffer; + */ +JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_LinuxEvent_createEventBuffer + (JNIEnv *, jclass); + +/* + * Class: org_lwjgl_opengl_LinuxEvent + * Method: getPending + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxEvent_getPending + (JNIEnv *, jclass, jlong); + +/* + * Class: org_lwjgl_opengl_LinuxEvent + * Method: nSendEvent + * Signature: (Ljava/nio/ByteBuffer;JJZJ)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxEvent_nSendEvent + (JNIEnv *, jclass, jobject, jlong, jlong, jboolean, jlong); + +/* + * Class: org_lwjgl_opengl_LinuxEvent + * Method: nFilterEvent + * Signature: (Ljava/nio/ByteBuffer;J)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_LinuxEvent_nFilterEvent + (JNIEnv *, jclass, jobject, jlong); + +/* + * Class: org_lwjgl_opengl_LinuxEvent + * Method: nNextEvent + * Signature: (JLjava/nio/ByteBuffer;)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxEvent_nNextEvent + (JNIEnv *, jclass, jlong, jobject); + +/* + * Class: org_lwjgl_opengl_LinuxEvent + * Method: nGetType + * Signature: (Ljava/nio/ByteBuffer;)I + */ +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxEvent_nGetType + (JNIEnv *, jclass, jobject); + +/* + * Class: org_lwjgl_opengl_LinuxEvent + * Method: nGetWindow + * Signature: (Ljava/nio/ByteBuffer;)J + */ +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxEvent_nGetWindow + (JNIEnv *, jclass, jobject); + +/* + * Class: org_lwjgl_opengl_LinuxEvent + * Method: nSetWindow + * Signature: (Ljava/nio/ByteBuffer;J)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxEvent_nSetWindow + (JNIEnv *, jclass, jobject, jlong); + +/* + * Class: org_lwjgl_opengl_LinuxEvent + * Method: nGetFocusMode + * Signature: (Ljava/nio/ByteBuffer;)I + */ +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxEvent_nGetFocusMode + (JNIEnv *, jclass, jobject); + +/* + * Class: org_lwjgl_opengl_LinuxEvent + * Method: nGetFocusDetail + * Signature: (Ljava/nio/ByteBuffer;)I + */ +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxEvent_nGetFocusDetail + (JNIEnv *, jclass, jobject); + +/* + * Class: org_lwjgl_opengl_LinuxEvent + * Method: nGetClientMessageType + * Signature: (Ljava/nio/ByteBuffer;)J + */ +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxEvent_nGetClientMessageType + (JNIEnv *, jclass, jobject); + +/* + * Class: org_lwjgl_opengl_LinuxEvent + * Method: nGetClientData + * Signature: (Ljava/nio/ByteBuffer;I)I + */ +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxEvent_nGetClientData + (JNIEnv *, jclass, jobject, jint); + +/* + * Class: org_lwjgl_opengl_LinuxEvent + * Method: nGetClientFormat + * Signature: (Ljava/nio/ByteBuffer;)I + */ +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxEvent_nGetClientFormat + (JNIEnv *, jclass, jobject); + +/* + * Class: org_lwjgl_opengl_LinuxEvent + * Method: nGetButtonTime + * Signature: (Ljava/nio/ByteBuffer;)J + */ +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxEvent_nGetButtonTime + (JNIEnv *, jclass, jobject); + +/* + * Class: org_lwjgl_opengl_LinuxEvent + * Method: nGetButtonState + * Signature: (Ljava/nio/ByteBuffer;)I + */ +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxEvent_nGetButtonState + (JNIEnv *, jclass, jobject); + +/* + * Class: org_lwjgl_opengl_LinuxEvent + * Method: nGetButtonType + * Signature: (Ljava/nio/ByteBuffer;)I + */ +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxEvent_nGetButtonType + (JNIEnv *, jclass, jobject); + +/* + * Class: org_lwjgl_opengl_LinuxEvent + * Method: nGetButtonButton + * Signature: (Ljava/nio/ByteBuffer;)I + */ +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxEvent_nGetButtonButton + (JNIEnv *, jclass, jobject); + +/* + * Class: org_lwjgl_opengl_LinuxEvent + * Method: nGetButtonRoot + * Signature: (Ljava/nio/ByteBuffer;)J + */ +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxEvent_nGetButtonRoot + (JNIEnv *, jclass, jobject); + +/* + * Class: org_lwjgl_opengl_LinuxEvent + * Method: nGetButtonXRoot + * Signature: (Ljava/nio/ByteBuffer;)I + */ +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxEvent_nGetButtonXRoot + (JNIEnv *, jclass, jobject); + +/* + * Class: org_lwjgl_opengl_LinuxEvent + * Method: nGetButtonYRoot + * Signature: (Ljava/nio/ByteBuffer;)I + */ +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxEvent_nGetButtonYRoot + (JNIEnv *, jclass, jobject); + +/* + * Class: org_lwjgl_opengl_LinuxEvent + * Method: nGetButtonX + * Signature: (Ljava/nio/ByteBuffer;)I + */ +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxEvent_nGetButtonX + (JNIEnv *, jclass, jobject); + +/* + * Class: org_lwjgl_opengl_LinuxEvent + * Method: nGetButtonY + * Signature: (Ljava/nio/ByteBuffer;)I + */ +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxEvent_nGetButtonY + (JNIEnv *, jclass, jobject); + +/* + * Class: org_lwjgl_opengl_LinuxEvent + * Method: nGetKeyAddress + * Signature: (Ljava/nio/ByteBuffer;)J + */ +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxEvent_nGetKeyAddress + (JNIEnv *, jclass, jobject); + +/* + * Class: org_lwjgl_opengl_LinuxEvent + * Method: nGetKeyTime + * Signature: (Ljava/nio/ByteBuffer;)I + */ +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxEvent_nGetKeyTime + (JNIEnv *, jclass, jobject); + +/* + * Class: org_lwjgl_opengl_LinuxEvent + * Method: nGetKeyType + * Signature: (Ljava/nio/ByteBuffer;)I + */ +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxEvent_nGetKeyType + (JNIEnv *, jclass, jobject); + +/* + * Class: org_lwjgl_opengl_LinuxEvent + * Method: nGetKeyKeyCode + * Signature: (Ljava/nio/ByteBuffer;)I + */ +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxEvent_nGetKeyKeyCode + (JNIEnv *, jclass, jobject); + +/* + * Class: org_lwjgl_opengl_LinuxEvent + * Method: nGetKeyState + * Signature: (Ljava/nio/ByteBuffer;)I + */ +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxEvent_nGetKeyState + (JNIEnv *, jclass, jobject); + +#ifdef __cplusplus +} +#endif +#endif diff -Nru lwjgl-2.7.1+dfsg/src/native/linux/org_lwjgl_opengl_LinuxKeyboard.c lwjgl-2.9.3+dfsg/src/native/linux/org_lwjgl_opengl_LinuxKeyboard.c --- lwjgl-2.7.1+dfsg/src/native/linux/org_lwjgl_opengl_LinuxKeyboard.c 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/linux/org_lwjgl_opengl_LinuxKeyboard.c 2016-04-09 16:26:57.000000000 +0000 @@ -84,6 +84,7 @@ JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxKeyboard_openIM(JNIEnv *env, jclass unused, jlong display_ptr) { Display *disp = (Display *)(intptr_t)display_ptr; + XSetLocaleModifiers ("@im=none"); XIM xim = XOpenIM(disp, NULL, NULL, NULL); return (intptr_t)xim; } diff -Nru lwjgl-2.7.1+dfsg/src/native/linux/org_lwjgl_opengl_LinuxKeyboard.h lwjgl-2.9.3+dfsg/src/native/linux/org_lwjgl_opengl_LinuxKeyboard.h --- lwjgl-2.7.1+dfsg/src/native/linux/org_lwjgl_opengl_LinuxKeyboard.h 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/linux/org_lwjgl_opengl_LinuxKeyboard.h 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,155 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_lwjgl_opengl_LinuxKeyboard */ + +#ifndef _Included_org_lwjgl_opengl_LinuxKeyboard +#define _Included_org_lwjgl_opengl_LinuxKeyboard +#ifdef __cplusplus +extern "C" { +#endif +#undef org_lwjgl_opengl_LinuxKeyboard_LockMapIndex +#define org_lwjgl_opengl_LinuxKeyboard_LockMapIndex 1L +#undef org_lwjgl_opengl_LinuxKeyboard_NoSymbol +#define org_lwjgl_opengl_LinuxKeyboard_NoSymbol 0i64 +#undef org_lwjgl_opengl_LinuxKeyboard_ShiftMask +#define org_lwjgl_opengl_LinuxKeyboard_ShiftMask 1i64 +#undef org_lwjgl_opengl_LinuxKeyboard_LockMask +#define org_lwjgl_opengl_LinuxKeyboard_LockMask 2i64 +#undef org_lwjgl_opengl_LinuxKeyboard_XLookupChars +#define org_lwjgl_opengl_LinuxKeyboard_XLookupChars 2L +#undef org_lwjgl_opengl_LinuxKeyboard_XLookupBoth +#define org_lwjgl_opengl_LinuxKeyboard_XLookupBoth 4L +#undef org_lwjgl_opengl_LinuxKeyboard_KEYBOARD_BUFFER_SIZE +#define org_lwjgl_opengl_LinuxKeyboard_KEYBOARD_BUFFER_SIZE 50L +/* + * Class: org_lwjgl_opengl_LinuxKeyboard + * Method: getModifierMapping + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxKeyboard_getModifierMapping + (JNIEnv *, jclass, jlong); + +/* + * Class: org_lwjgl_opengl_LinuxKeyboard + * Method: freeModifierMapping + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxKeyboard_freeModifierMapping + (JNIEnv *, jclass, jlong); + +/* + * Class: org_lwjgl_opengl_LinuxKeyboard + * Method: getMaxKeyPerMod + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxKeyboard_getMaxKeyPerMod + (JNIEnv *, jclass, jlong); + +/* + * Class: org_lwjgl_opengl_LinuxKeyboard + * Method: lookupModifierMap + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxKeyboard_lookupModifierMap + (JNIEnv *, jclass, jlong, jint); + +/* + * Class: org_lwjgl_opengl_LinuxKeyboard + * Method: keycodeToKeySym + * Signature: (JI)J + */ +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxKeyboard_keycodeToKeySym + (JNIEnv *, jclass, jlong, jint); + +/* + * Class: org_lwjgl_opengl_LinuxKeyboard + * Method: openIM + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxKeyboard_openIM + (JNIEnv *, jclass, jlong); + +/* + * Class: org_lwjgl_opengl_LinuxKeyboard + * Method: createIC + * Signature: (JJ)J + */ +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxKeyboard_createIC + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: org_lwjgl_opengl_LinuxKeyboard + * Method: setupIMEventMask + * Signature: (JJJ)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxKeyboard_setupIMEventMask + (JNIEnv *, jclass, jlong, jlong, jlong); + +/* + * Class: org_lwjgl_opengl_LinuxKeyboard + * Method: allocateComposeStatus + * Signature: ()Ljava/nio/ByteBuffer; + */ +JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_LinuxKeyboard_allocateComposeStatus + (JNIEnv *, jclass); + +/* + * Class: org_lwjgl_opengl_LinuxKeyboard + * Method: nSetDetectableKeyRepeat + * Signature: (JZ)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_LinuxKeyboard_nSetDetectableKeyRepeat + (JNIEnv *, jclass, jlong, jboolean); + +/* + * Class: org_lwjgl_opengl_LinuxKeyboard + * Method: destroyIC + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxKeyboard_destroyIC + (JNIEnv *, jclass, jlong); + +/* + * Class: org_lwjgl_opengl_LinuxKeyboard + * Method: closeIM + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxKeyboard_closeIM + (JNIEnv *, jclass, jlong); + +/* + * Class: org_lwjgl_opengl_LinuxKeyboard + * Method: lookupString + * Signature: (JLjava/nio/ByteBuffer;Ljava/nio/ByteBuffer;)I + */ +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxKeyboard_lookupString + (JNIEnv *, jclass, jlong, jobject, jobject); + +/* + * Class: org_lwjgl_opengl_LinuxKeyboard + * Method: utf8LookupString + * Signature: (JJLjava/nio/ByteBuffer;II)I + */ +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxKeyboard_utf8LookupString + (JNIEnv *, jclass, jlong, jlong, jobject, jint, jint); + +/* + * Class: org_lwjgl_opengl_LinuxKeyboard + * Method: lookupKeysym + * Signature: (JI)J + */ +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxKeyboard_lookupKeysym + (JNIEnv *, jclass, jlong, jint); + +/* + * Class: org_lwjgl_opengl_LinuxKeyboard + * Method: toUpper + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxKeyboard_toUpper + (JNIEnv *, jclass, jlong); + +#ifdef __cplusplus +} +#endif +#endif diff -Nru lwjgl-2.7.1+dfsg/src/native/linux/org_lwjgl_opengl_LinuxMouse.c lwjgl-2.9.3+dfsg/src/native/linux/org_lwjgl_opengl_LinuxMouse.c --- lwjgl-2.7.1+dfsg/src/native/linux/org_lwjgl_opengl_LinuxMouse.c 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/linux/org_lwjgl_opengl_LinuxMouse.c 2016-04-09 16:26:57.000000000 +0000 @@ -103,3 +103,16 @@ warp_event.xclient.data.l[1] = y; XSendEvent(disp, win, False, 0, &warp_event); } + +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxMouse_nGetButtonCount(JNIEnv *env, jclass unused, jlong display_ptr) { + Display *disp = (Display *)(intptr_t)display_ptr; + + int count = 256; + + unsigned char * pointer_map = malloc(sizeof(unsigned char) * count); + count = XGetPointerMapping(disp, pointer_map, count); + + free(pointer_map); + + return count; +} diff -Nru lwjgl-2.7.1+dfsg/src/native/linux/org_lwjgl_opengl_LinuxMouse.h lwjgl-2.9.3+dfsg/src/native/linux/org_lwjgl_opengl_LinuxMouse.h --- lwjgl-2.7.1+dfsg/src/native/linux/org_lwjgl_opengl_LinuxMouse.h 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/linux/org_lwjgl_opengl_LinuxMouse.h 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,87 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_lwjgl_opengl_LinuxMouse */ + +#ifndef _Included_org_lwjgl_opengl_LinuxMouse +#define _Included_org_lwjgl_opengl_LinuxMouse +#ifdef __cplusplus +extern "C" { +#endif +#undef org_lwjgl_opengl_LinuxMouse_POINTER_WARP_BORDER +#define org_lwjgl_opengl_LinuxMouse_POINTER_WARP_BORDER 10L +#undef org_lwjgl_opengl_LinuxMouse_WHEEL_SCALE +#define org_lwjgl_opengl_LinuxMouse_WHEEL_SCALE 120L +#undef org_lwjgl_opengl_LinuxMouse_Button1 +#define org_lwjgl_opengl_LinuxMouse_Button1 1L +#undef org_lwjgl_opengl_LinuxMouse_Button2 +#define org_lwjgl_opengl_LinuxMouse_Button2 2L +#undef org_lwjgl_opengl_LinuxMouse_Button3 +#define org_lwjgl_opengl_LinuxMouse_Button3 3L +#undef org_lwjgl_opengl_LinuxMouse_Button4 +#define org_lwjgl_opengl_LinuxMouse_Button4 4L +#undef org_lwjgl_opengl_LinuxMouse_Button5 +#define org_lwjgl_opengl_LinuxMouse_Button5 5L +#undef org_lwjgl_opengl_LinuxMouse_Button6 +#define org_lwjgl_opengl_LinuxMouse_Button6 6L +#undef org_lwjgl_opengl_LinuxMouse_Button7 +#define org_lwjgl_opengl_LinuxMouse_Button7 7L +#undef org_lwjgl_opengl_LinuxMouse_Button8 +#define org_lwjgl_opengl_LinuxMouse_Button8 8L +#undef org_lwjgl_opengl_LinuxMouse_Button9 +#define org_lwjgl_opengl_LinuxMouse_Button9 9L +#undef org_lwjgl_opengl_LinuxMouse_ButtonPress +#define org_lwjgl_opengl_LinuxMouse_ButtonPress 4L +#undef org_lwjgl_opengl_LinuxMouse_ButtonRelease +#define org_lwjgl_opengl_LinuxMouse_ButtonRelease 5L +/* + * Class: org_lwjgl_opengl_LinuxMouse + * Method: nSendWarpEvent + * Signature: (JJJII)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxMouse_nSendWarpEvent + (JNIEnv *, jclass, jlong, jlong, jlong, jint, jint); + +/* + * Class: org_lwjgl_opengl_LinuxMouse + * Method: nGetWindowHeight + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxMouse_nGetWindowHeight + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: org_lwjgl_opengl_LinuxMouse + * Method: nGetWindowWidth + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxMouse_nGetWindowWidth + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: org_lwjgl_opengl_LinuxMouse + * Method: nGetButtonCount + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxMouse_nGetButtonCount + (JNIEnv *, jclass, jlong); + +/* + * Class: org_lwjgl_opengl_LinuxMouse + * Method: nQueryPointer + * Signature: (JJLjava/nio/IntBuffer;)J + */ +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxMouse_nQueryPointer + (JNIEnv *, jclass, jlong, jlong, jobject); + +/* + * Class: org_lwjgl_opengl_LinuxMouse + * Method: nWarpCursor + * Signature: (JJII)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxMouse_nWarpCursor + (JNIEnv *, jclass, jlong, jlong, jint, jint); + +#ifdef __cplusplus +} +#endif +#endif diff -Nru lwjgl-2.7.1+dfsg/src/native/linux/org_lwjgl_opengl_LinuxPeerInfo.c lwjgl-2.9.3+dfsg/src/native/linux/org_lwjgl_opengl_LinuxPeerInfo.c --- lwjgl-2.7.1+dfsg/src/native/linux/org_lwjgl_opengl_LinuxPeerInfo.c 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/linux/org_lwjgl_opengl_LinuxPeerInfo.c 2016-04-09 16:26:57.000000000 +0000 @@ -31,10 +31,10 @@ */ /** - * $Id: org_lwjgl_opengl_LinuxPeerInfo.c 3358 2010-06-03 15:49:26Z spasi $ + * $Id$ * * @author elias_naur - * @version $Revision: 3358 $ + * @version $Revision$ */ #include diff -Nru lwjgl-2.7.1+dfsg/src/native/linux/org_lwjgl_opengl_LinuxPeerInfo.h lwjgl-2.9.3+dfsg/src/native/linux/org_lwjgl_opengl_LinuxPeerInfo.h --- lwjgl-2.7.1+dfsg/src/native/linux/org_lwjgl_opengl_LinuxPeerInfo.h 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/linux/org_lwjgl_opengl_LinuxPeerInfo.h 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,37 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_lwjgl_opengl_LinuxPeerInfo */ + +#ifndef _Included_org_lwjgl_opengl_LinuxPeerInfo +#define _Included_org_lwjgl_opengl_LinuxPeerInfo +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: org_lwjgl_opengl_LinuxPeerInfo + * Method: createHandle + * Signature: ()Ljava/nio/ByteBuffer; + */ +JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_LinuxPeerInfo_createHandle + (JNIEnv *, jclass); + +/* + * Class: org_lwjgl_opengl_LinuxPeerInfo + * Method: nGetDisplay + * Signature: (Ljava/nio/ByteBuffer;)J + */ +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxPeerInfo_nGetDisplay + (JNIEnv *, jclass, jobject); + +/* + * Class: org_lwjgl_opengl_LinuxPeerInfo + * Method: nGetDrawable + * Signature: (Ljava/nio/ByteBuffer;)J + */ +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxPeerInfo_nGetDrawable + (JNIEnv *, jclass, jobject); + +#ifdef __cplusplus +} +#endif +#endif diff -Nru lwjgl-2.7.1+dfsg/src/native/linux/org_lwjgl_opengl_Pbuffer.c lwjgl-2.9.3+dfsg/src/native/linux/org_lwjgl_opengl_Pbuffer.c --- lwjgl-2.7.1+dfsg/src/native/linux/org_lwjgl_opengl_Pbuffer.c 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/linux/org_lwjgl_opengl_Pbuffer.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2002-2008 LWJGL Project - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of 'LWJGL' nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/** - * $Id: org_lwjgl_opengl_Pbuffer.c 3358 2010-06-03 15:49:26Z spasi $ - * - * Linux Pbuffer. - * - * @author elias_naur - * @version $Revision: 3358 $ - */ - -#include -#include "org_lwjgl_opengl_LinuxPbufferPeerInfo.h" -#include "org_lwjgl_opengl_Pbuffer.h" -#include "extgl.h" -#include "context.h" -#include "common_tools.h" - -JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetPbufferCapabilities - (JNIEnv *env, jclass clazz, jlong display, jint screen) -{ - Display *disp = (Display *)(intptr_t)display; - GLXExtensions extension_flags; - if (!extgl_InitGLX(disp, screen, &extension_flags)) - return 0; - // Only support the GLX 1.3 Pbuffers and ignore the GLX_SGIX_pbuffer extension - return extension_flags.GLX13 ? org_lwjgl_opengl_Pbuffer_PBUFFER_SUPPORTED : 0; -} - -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxPbufferPeerInfo_nInitHandle - (JNIEnv *env, jclass clazz, jlong display, jint screen, jobject peer_info_handle, jint width, jint height, jobject pixel_format) { - Display *disp = (Display *)(intptr_t)display; - GLXExtensions extension_flags; - if (!extgl_InitGLX(disp, screen, &extension_flags) || !extension_flags.GLX13) { - throwException(env, "No Pbuffer support"); - return; - } - bool result = initPeerInfo(env, peer_info_handle, disp, screen, pixel_format, false, GLX_PBUFFER_BIT, false, true); - if (!result) - return; - const int buffer_attribs[] = {GLX_PBUFFER_WIDTH, width, - GLX_PBUFFER_HEIGHT, height, - GLX_PRESERVED_CONTENTS, True, - GLX_LARGEST_PBUFFER, False, - None, None}; - - X11PeerInfo *peer_info = (X11PeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); - GLXFBConfig *config = getFBConfigFromPeerInfo(env, peer_info); - if (config != NULL) { - GLXPbuffer buffer = lwjgl_glXCreatePbuffer(peer_info->display, *config, buffer_attribs); - XFree(config); - peer_info->drawable = buffer; - } -} - -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxPbufferPeerInfo_nDestroy - (JNIEnv *env, jclass clazz, jobject peer_info_handle) { - X11PeerInfo *peer_info = (X11PeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); - lwjgl_glXDestroyPbuffer(peer_info->display, peer_info->drawable); -} diff -Nru lwjgl-2.7.1+dfsg/src/native/macosx/context.h lwjgl-2.9.3+dfsg/src/native/macosx/context.h --- lwjgl-2.7.1+dfsg/src/native/macosx/context.h 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/macosx/context.h 2016-04-09 16:26:57.000000000 +0000 @@ -1,42 +1,44 @@ -/* +/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are + * modification, are permitted provided that the following conditions are * met: - * - * * Redistributions of source code must retain the above copyright + * + * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * * Neither the name of 'LWJGL' nor the names of - * its contributors may be used to endorse or promote products derived + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /** - * $Id: context.h 2985 2008-04-07 18:42:36Z matzon $ + * $Id$ * * Base Win32 display * * @author cix_foo - * @version $Revision: 2985 $ + * @author mojang + * @author kappaOne + * @version $Revision$ */ #ifndef __LWJGL_CONTEXT_H @@ -46,15 +48,113 @@ #include #include #include "common_tools.h" +#include + +enum { + NSControlLeftKeyMask = 0x0001, + NSControlRightKeyMask = 0x2000, + NSShiftLeftKeyMask = 0x0002, + NSShiftRightKeyMask = 0x0004, + NSCommandLeftKeyMask = 0x0008, + NSCommandRightKeyMask = 0x0010, + NSAlternateLeftKeyMask = 0x0020, + NSAlternateRightKeyMask = 0x0040 +}; + +@class NSOpenGLContext, NSOpenGLPixelFormat, MacOSXOpenGLView, MacOSXKeyableWindow; typedef struct { + MacOSXKeyableWindow *window; + + NSRect display_rect; + + MacOSXOpenGLView *view; + NSOpenGLContext *context; + + // Native objects for Java callbacks + jobject jdisplay; + jobject jmouse; + jobject jkeyboard; + + jboolean fullscreen; + jboolean undecorated; + jboolean resizable; + jboolean parented; + + jboolean enableFullscreenModeAPI; + jboolean enableHighDPI; + + jboolean resized; + +} MacOSXWindowInfo; + +@interface MacOSXOpenGLView : NSView +{ + @public + MacOSXWindowInfo* _parent; + + @private + NSOpenGLContext* _openGLContext; + NSOpenGLPixelFormat* _pixelFormat; + NSTrackingArea * _trackingArea; +} + ++ (NSOpenGLPixelFormat*)defaultPixelFormat; +- (BOOL)windowShouldClose:(id)sender; +- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender; +- (id)initWithFrame:(NSRect)frameRect pixelFormat:(NSOpenGLPixelFormat*)format; +- (void)setOpenGLContext:(NSOpenGLContext*)context; +- (NSOpenGLContext*)openGLContext; +- (void)clearGLContext; +- (void)prepareOpenGL; +- (void)update; +- (void)lockFocus; +- (void)setPixelFormat:(NSOpenGLPixelFormat*)pixelFormat; +- (NSOpenGLPixelFormat*)pixelFormat; +- (void)setParent:(MacOSXWindowInfo*)parent; +- (BOOL)acceptsFirstResponder; +@end + +@interface GLLayer : CAOpenGLLayer { + @public + JAWT_MacOSXDrawingSurfaceInfo *macosx_dsi; + JAWT_Rectangle canvasBounds; + MacOSXWindowInfo *window_info; + bool setViewport; + bool autoResizable; + + @private + CGLContextObj contextObject; + int fboID; + int imageRenderBufferID; + int depthRenderBufferID; + int fboWidth; + int fboHeight; +} + +- (void) attachLayer; +- (void) removeLayer; +- (void) blitFrameBuffer; + +- (int) getWidth; +- (int) getHeight; +@end + +typedef struct { + bool isCALayer; + bool isWindowed; + MacOSXWindowInfo *window_info; NSOpenGLPixelFormat *pixel_format; - bool window; - union { - NSView *nsview; - NSOpenGLPixelBuffer *pbuffer; - }; + NSOpenGLPixelBuffer *pbuffer; + NSView *parent; + GLLayer *glLayer; } MacOSXPeerInfo; -NSOpenGLPixelFormat *choosePixelFormat(JNIEnv *env, jobject pixel_format, bool use_display_bpp, bool support_window, bool support_pbuffer, bool double_buffered); +@interface MacOSXKeyableWindow : NSWindow ++ (void)createWindow; ++ (void)destroyWindow; +- (BOOL)canBecomeKeyWindow; +@end + +NSOpenGLPixelFormat *choosePixelFormat(JNIEnv *env, jobject pixel_format, bool gl32, bool use_display_bpp, bool support_window, bool support_pbuffer, bool double_buffered); #endif diff -Nru lwjgl-2.7.1+dfsg/src/native/macosx/context.m lwjgl-2.9.3+dfsg/src/native/macosx/context.m --- lwjgl-2.7.1+dfsg/src/native/macosx/context.m 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/macosx/context.m 2016-04-09 16:26:57.000000000 +0000 @@ -1,40 +1,40 @@ -/* +/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are + * modification, are permitted provided that the following conditions are * met: - * - * * Redistributions of source code must retain the above copyright + * + * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * * Neither the name of 'LWJGL' nor the names of - * its contributors may be used to endorse or promote products derived + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /** - * $Id: context.m 3116 2008-08-19 16:46:03Z spasi $ + * $Id$ * * @author elias_naur - * @version $Revision: 3116 $ + * @version $Revision$ */ #import @@ -51,12 +51,12 @@ return address; } -static CFBundleRef loadFramework(JNIEnv *env) { +static CFBundleRef loadFramework(JNIEnv *env) { CFStringRef framework_path = CFSTR("/System/Library/Frameworks/OpenGL.framework"); if (framework_path == NULL) { printfDebugJava(env, "Failed to allocate string"); return NULL; - } + } CFURLRef url = CFURLCreateWithFileSystemPath(NULL, framework_path, kCFURLPOSIXPathStyle, TRUE); if (url == NULL) { printfDebugJava(env, "Failed to allocate URL"); @@ -87,14 +87,29 @@ } } -NSOpenGLPixelFormat *choosePixelFormat(JNIEnv *env, jobject pixel_format, bool use_display_bpp, bool support_window, bool support_pbuffer, bool double_buffered) { +NSOpenGLPixelFormat *choosePixelFormat(JNIEnv *env, jobject pixel_format, bool gl32, bool use_display_bpp, bool support_window, bool support_pbuffer, bool double_buffered) { int bpp; jclass cls_pixel_format = (*env)->GetObjectClass(env, pixel_format); if (use_display_bpp) - bpp = CGDisplayBitsPerPixel(kCGDirectMainDisplay); + { + if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_5) { // if OS X 10.6+ use newer api + CGDisplayModeRef mode = CGDisplayCopyDisplayMode(kCGDirectMainDisplay); + CFStringRef pixEnc = CGDisplayModeCopyPixelEncoding(mode); + if (CFStringCompare(pixEnc, CFSTR(IO32BitDirectPixels), kCFCompareCaseInsensitive) == kCFCompareEqualTo) + bpp = 32; + else if(CFStringCompare(pixEnc, CFSTR(IO16BitDirectPixels), kCFCompareCaseInsensitive) == kCFCompareEqualTo) + bpp = 16; + else if(CFStringCompare(pixEnc, CFSTR(IO8BitIndexedPixels), kCFCompareCaseInsensitive) == kCFCompareEqualTo) + bpp = 8; + else + bpp = CGDisplayBitsPerPixel(kCGDirectMainDisplay); + } else { + bpp = CGDisplayBitsPerPixel(kCGDirectMainDisplay); + } + } else bpp = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "bpp", "I")); - + int alpha = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "alpha", "I")); int depth = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "depth", "I")); int stencil = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "stencil", "I")); @@ -105,9 +120,9 @@ bool stereo = (bool)(*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "stereo", "Z")); bool floating_point = (bool)(*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "floating_point", "Z")); // TODO: Add floating_point_packed attribute below - bool floating_point_packed = (bool)(*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "floating_point_packed", "Z")); + //bool floating_point_packed = (bool)(*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "floating_point_packed", "Z")); // TODO: Add sRGB attribute below - bool sRGB = (bool)(*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "sRGB", "Z")); + //bool sRGB = (bool)(*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "sRGB", "Z")); attrib_list_t attribs; jboolean allow_software_acceleration = getBooleanProperty(env, "org.lwjgl.opengl.Display.allowSoftwareOpenGL"); @@ -125,10 +140,15 @@ putAttrib(&attribs, NSOpenGLPFASampleBuffers); putAttrib(&attribs, samples > 0 ? 1 : 0); putAttrib(&attribs, NSOpenGLPFASamples); putAttrib(&attribs, samples); putAttrib(&attribs, NSOpenGLPFAAuxBuffers); putAttrib(&attribs, num_aux_buffers); - if (support_window) - putAttrib(&attribs, NSOpenGLPFAWindow); - if (support_pbuffer) - putAttrib(&attribs, NSOpenGLPFAPixelBuffer); + if (gl32) { + putAttrib(&attribs, 99); // NSOpenGLPFAOpenGLProfile + putAttrib(&attribs, 0x3200); // NSOpenGLProfileVersion3_2Core + } else { + if (support_window) + putAttrib(&attribs, NSOpenGLPFAWindow); + if (support_pbuffer) + putAttrib(&attribs, NSOpenGLPFAPixelBuffer); + } if (stereo) putAttrib(&attribs, NSOpenGLPFAStereo); if (floating_point) diff -Nru lwjgl-2.7.1+dfsg/src/native/macosx/macosx_al.c lwjgl-2.9.3+dfsg/src/native/macosx/macosx_al.c --- lwjgl-2.7.1+dfsg/src/native/macosx/macosx_al.c 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/macosx/macosx_al.c 2016-04-09 16:26:57.000000000 +0000 @@ -41,12 +41,12 @@ #include "common_tools.h" /** - * $Id: macosx_al.c 3416 2010-09-27 00:25:59Z spasi $ + * $Id$ * * This file contains the AL extension assigning mechanism * * @author Brian Matzon - * @version $Revision: 3416 $ + * @version $Revision$ */ static const struct mach_header* handleOAL = NULL; diff -Nru lwjgl-2.7.1+dfsg/src/native/macosx/org_lwjgl_input_Mouse.c lwjgl-2.9.3+dfsg/src/native/macosx/org_lwjgl_input_Mouse.c --- lwjgl-2.7.1+dfsg/src/native/macosx/org_lwjgl_input_Mouse.c 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/macosx/org_lwjgl_input_Mouse.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2002-2008 LWJGL Project - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of 'LWJGL' nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/** - * $Id: org_lwjgl_input_Mouse.c 2985 2008-04-07 18:42:36Z matzon $ - * - * Mac OS X mouse handling. - * - * @author elias_naur - * @version $Revision: 2985 $ - */ - -#include -#include -#include "org_lwjgl_opengl_MacOSXMouseEventQueue.h" -#include "common_tools.h" - -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXMouseEventQueue_nGrabMouse(JNIEnv *env, jclass unused, jboolean grab) { - CGAssociateMouseAndMouseCursorPosition(grab == JNI_TRUE ? FALSE : TRUE); - if (grab) - CGDisplayHideCursor(kCGDirectMainDisplay); - else - CGDisplayShowCursor(kCGDirectMainDisplay); -} - -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXMouseEventQueue_nWarpCursor(JNIEnv *env, jclass unused, jint x, jint y) { - CGPoint p; - p.x = x; - p.y = y; - CGWarpMouseCursorPosition(p); -} - -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXMouseEventQueue_getMouseDeltas(JNIEnv *env, jclass unused, jobject delta_buffer) { - CGMouseDelta dx, dy; - CGGetLastMouseDelta(&dx, &dy); - int buffer_length = (*env)->GetDirectBufferCapacity(env, delta_buffer); - if (buffer_length != 2) { - printfDebugJava(env, "Delta buffer not large enough!"); - return; - } - jint *buffer = (*env)->GetDirectBufferAddress(env, delta_buffer); - buffer[0] = dx; - buffer[1] = dy; -} diff -Nru lwjgl-2.7.1+dfsg/src/native/macosx/org_lwjgl_MacOSXSysImplementation.h lwjgl-2.9.3+dfsg/src/native/macosx/org_lwjgl_MacOSXSysImplementation.h --- lwjgl-2.7.1+dfsg/src/native/macosx/org_lwjgl_MacOSXSysImplementation.h 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/macosx/org_lwjgl_MacOSXSysImplementation.h 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,15 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_lwjgl_MacOSXSysImplementation */ + +#ifndef _Included_org_lwjgl_MacOSXSysImplementation +#define _Included_org_lwjgl_MacOSXSysImplementation +#ifdef __cplusplus +extern "C" { +#endif +#undef org_lwjgl_MacOSXSysImplementation_JNI_VERSION +#define org_lwjgl_MacOSXSysImplementation_JNI_VERSION 25L +#ifdef __cplusplus +} +#endif +#endif diff -Nru lwjgl-2.7.1+dfsg/src/native/macosx/org_lwjgl_opengl_Display.m lwjgl-2.9.3+dfsg/src/native/macosx/org_lwjgl_opengl_Display.m --- lwjgl-2.7.1+dfsg/src/native/macosx/org_lwjgl_opengl_Display.m 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/macosx/org_lwjgl_opengl_Display.m 2016-04-09 16:26:57.000000000 +0000 @@ -31,28 +31,849 @@ */ /** - * $Id: org_lwjgl_opengl_Display.m 3055 2008-04-30 14:58:47Z elias_naur $ + * $Id$ * * Mac OS X specific display functions. * * @author elias_naur - * @version $Revision: 3055 $ + * @author mojang + * @author kappaOne + * @version $Revision$ */ +#import #import #import -#import #import #import -//#import "display.h" #import "common_tools.h" #import "org_lwjgl_opengl_MacOSXDisplay.h" #import "org_lwjgl_MacOSXSysImplementation.h" +#import "context.h" -#define WAIT_DELAY 100 +static NSOpenGLPixelFormat *default_format = nil; -JNIEXPORT jint JNICALL Java_org_lwjgl_DefaultSysImplementation_getJNIVersion - (JNIEnv *env, jobject ignored) { +static NSAutoreleasePool *pool; + +static MacOSXPeerInfo *peer_info; + +static bool leftMouseDown = false; +static bool rightMouseDown = false; + +static NSUInteger lastModifierFlags = 0; + +@implementation MacOSXKeyableWindow + ++ (void) createWindow { + MacOSXWindowInfo *window_info = peer_info->window_info; + + int width = window_info->display_rect.size.width; + int height = window_info->display_rect.size.height; + + NSRect view_rect = NSMakeRect(0.0, 0.0, width, height); + window_info->view = [[MacOSXOpenGLView alloc] initWithFrame:view_rect pixelFormat:peer_info->pixel_format]; + [window_info->view setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable]; + + // Inform the view of its parent window info; + [window_info->view setParent:window_info]; + + if (window_info->enableHighDPI) { + // call method using runtime selector as its a 10.7+ api and allows compiling on older SDK's + [window_info->view performSelector:NSSelectorFromString(@"setWantsBestResolutionOpenGLSurface:") withObject:YES]; + } + + // set nsapp delegate for catching app quit events + [NSApp setDelegate:window_info->view]; + + if (window_info->context != nil) { + [window_info->view setOpenGLContext:window_info->context]; + } + + if (!window_info->fullscreen) { + + if (window_info->parented) { + window_info->window = [peer_info->parent window]; + [peer_info->parent addSubview:window_info->view]; + } + else { + + int default_window_mask = NSBorderlessWindowMask; // undecorated + + if (!window_info->undecorated) { + default_window_mask = NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask; + } + + if (window_info->resizable) { + default_window_mask |= NSResizableWindowMask; + } + + window_info->window = [[MacOSXKeyableWindow alloc] initWithContentRect:window_info->display_rect styleMask:default_window_mask backing:NSBackingStoreBuffered defer:NO]; + + [window_info->window setContentView:window_info->view]; + [window_info->window setContentView:window_info->view]; // call twice to fix issue + + // set NSView as delegate of NSWindow to get windowShouldClose events + [window_info->window setDelegate:window_info->view]; + } + + // disable any fixed backbuffer size to allow resizing + CGLContextObj cgcontext = (CGLContextObj)[[window_info->view openGLContext] CGLContextObj]; + CGLDisable(cgcontext, kCGLCESurfaceBackingSize); + } + else { + // set a fixed backbuffer size for fullscreen + CGLContextObj cgcontext = (CGLContextObj)[window_info->context CGLContextObj]; + GLint dim[2] = {width, height}; + CGLSetParameter(cgcontext, kCGLCPSurfaceBackingSize, dim); + CGLEnable(cgcontext, kCGLCESurfaceBackingSize); + + // enter fullscreen mode + [window_info->view enterFullScreenMode: [NSScreen mainScreen] withOptions: nil ]; + window_info->window = [window_info->view window]; + + // adjust the NSView bounds to correct mouse coordinates in fullscreen + NSSize windowSize = [window_info->window frame].size; + NSSize newBounds = NSMakeSize(windowSize.width/width*windowSize.width, windowSize.height/height*windowSize.height); + [window_info->view setBoundsSize:newBounds]; + } + + if (window_info->enableFullscreenModeAPI && window_info->resizable) { + // manually create OS X 10.7+ mask to allow compilation on previous OS X versions + NSUInteger NSWindowCollectionBehaviorFullScreenPrimary = 1 << 7; + [window_info->window setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary]; + } + + [window_info->window makeFirstResponder:window_info->view]; + [window_info->window setInitialFirstResponder:window_info->view]; + [window_info->window makeKeyAndOrderFront:[NSApplication sharedApplication]]; +} + ++ (void) destroyWindow { + MacOSXWindowInfo *window_info = peer_info->window_info; + + if (window_info->fullscreen) { + [window_info->view exitFullScreenModeWithOptions: nil]; + window_info->window = nil; + } + else { + if (peer_info->isCALayer) { + peer_info->isCALayer = false; + [peer_info->glLayer removeLayer]; + [peer_info->glLayer release]; + peer_info->glLayer = nil; + return; + } + + if (window_info->window != nil) { + // if the nsview has no parent then close window + if ([window_info->window contentView] == window_info->view) { + // release the nsview and remove it from any parent nsview + [window_info->view removeFromSuperviewWithoutNeedingDisplay]; + [window_info->window close]; + window_info->window = nil; + } + else { + // release the nsview and remove it from any parent nsview + [window_info->view removeFromSuperviewWithoutNeedingDisplay]; + } + } + } +} + +- (BOOL)canBecomeKeyWindow; +{ + return YES; +} +@end + +@implementation MacOSXOpenGLView + ++ (NSOpenGLPixelFormat*)defaultPixelFormat { + NSOpenGLPixelFormatAttribute defaultAttribs[] = { + NSOpenGLPFADoubleBuffer, + NSOpenGLPFADepthSize, 16, + NSOpenGLPFAColorSize, 32, + 0 + }; + if (default_format == nil) { + default_format = [[NSOpenGLPixelFormat alloc] initWithAttributes:defaultAttribs]; + } + return default_format; +} + +- (BOOL)windowShouldClose:(id)sender { + if (_parent != nil) { + JNIEnv *env = attachCurrentThread(); + jclass display_class = (*env)->GetObjectClass(env, _parent->jdisplay); + jmethodID close_callback = (*env)->GetMethodID(env, display_class, "doHandleQuit", "()V"); + (*env)->CallVoidMethod(env, _parent->jdisplay, close_callback); + } + return NO; +} + +- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender { + [self windowShouldClose:nil]; + return NSTerminateCancel; +} + +- (id)initWithFrame:(NSRect)frameRect pixelFormat:(NSOpenGLPixelFormat*)format { + self = [super initWithFrame:frameRect]; + if (self != nil) { + _pixelFormat = [format retain]; + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(_surfaceNeedsUpdate:) + name:NSViewGlobalFrameDidChangeNotification + object:self]; + } + return self; +} + +- (void) _surfaceNeedsUpdate:(NSNotification*)notification { + [self update]; +} + +- (void)setOpenGLContext:(NSOpenGLContext*)context { + _openGLContext = context; +} + +- (NSOpenGLContext*)openGLContext { + return _openGLContext; +} + +- (void)clearGLContext { + [_openGLContext release]; + _openGLContext = nil; +} + +- (void)prepareOpenGL { + +} + +- (void)update { + [_openGLContext update]; +} + +- (void)lockFocus { + [super lockFocus]; + + NSOpenGLContext* context = [self openGLContext]; + + if (context == nil) return; + + if ([context view] != self) { + [context setView:self]; + } + + [context makeCurrentContext]; +} + +- (void)setPixelFormat:(NSOpenGLPixelFormat*)pixelFormat { + _pixelFormat = [pixelFormat retain]; +} + +- (NSOpenGLPixelFormat*)pixelFormat { + return _pixelFormat; +} + +- (BOOL)acceptsFirstResponder { + return YES; +} + +- (void)setParent:(MacOSXWindowInfo*)parent { + _parent = parent; +} + +- (void)keyDown:(NSEvent *)event { + JNIEnv *env = attachCurrentThread(); + if (env == nil || event == nil || _parent == nil || _parent->jkeyboard == nil) { + return; + } + long time = [event timestamp] * 1000000000; + jclass keyboard_class = (*env)->GetObjectClass(env, _parent->jkeyboard); + jmethodID keydown = (*env)->GetMethodID(env, keyboard_class, "keyPressed", "(ILjava/lang/String;J)V"); + + // convert key characters from NSString to jstring + const char *unichars = [[event characters] UTF8String]; + jstring characters = (*env)->NewStringUTF(env, unichars); + + (*env)->CallVoidMethod(env, _parent->jkeyboard, keydown, [event keyCode], characters, time); +} + +- (void)keyUp:(NSEvent *)event { + JNIEnv *env = attachCurrentThread(); + if (env == nil || event == nil || _parent == nil || _parent->jkeyboard == nil) { + return; + } + long time = [event timestamp] * 1000000000; + jclass keyboard_class = (*env)->GetObjectClass(env, _parent->jkeyboard); + jmethodID keyup = (*env)->GetMethodID(env, keyboard_class, "keyReleased", "(ILjava/lang/String;J)V"); + + // convert key characters from NSString to jstring + const char *unichars = [[event characters] UTF8String]; + jstring characters = (*env)->NewStringUTF(env, unichars); + + (*env)->CallVoidMethod(env, _parent->jkeyboard, keyup, [event keyCode], characters, time); +} + +- (void)flagsChanged:(NSEvent *)event { + JNIEnv *env = attachCurrentThread(); + if (env == nil || event == nil || _parent == nil || _parent->jkeyboard == nil) { + return; + } + long time = [event timestamp] * 1000000000; + + NSUInteger modifierFlags = [event modifierFlags]; + unsigned short keyCode = [event keyCode]; + + NSUInteger mask = ~0; + + switch(keyCode) { + case kVK_Control : mask = NSControlLeftKeyMask; break; + case kVK_Shift : mask = NSShiftLeftKeyMask; break; + case kVK_RightShift : mask = NSShiftRightKeyMask; break; + case kVK_Command : mask = NSCommandLeftKeyMask; break; + case 0x36 : mask = NSCommandRightKeyMask; break; // Should be: kVK_RightCommand -- missing O.o + case kVK_Option : mask = NSAlternateLeftKeyMask; break; + case kVK_RightOption : mask = NSAlternateRightKeyMask; break; + case kVK_RightControl: mask = NSControlRightKeyMask; break; + case kVK_CapsLock : mask = NSAlphaShiftKeyMask; break; + case kVK_Function : mask = NSFunctionKeyMask; break; + // case 0x?? : mask = NSNumericPadKeyMask; break; // Didn't have the keycode for this one :( + default: + // key code not specified when left Command key + Tab moves focus to another Window, therefore manually detect and specify correct key code + if (((lastModifierFlags & NSCommandLeftKeyMask) == NSCommandLeftKeyMask) && ((modifierFlags & NSCommandLeftKeyMask) != NSCommandLeftKeyMask)) { + keyCode = kVK_Command; // left command key code + } + // key code not specified when right Command key + Tab moves focus to another Window, therefore manually detect and specify correct key code + else if (((lastModifierFlags & NSCommandLeftKeyMask) == NSCommandLeftKeyMask) && ((modifierFlags & NSCommandLeftKeyMask) != NSCommandLeftKeyMask)) { + keyCode = 0x36; // right command key code + } + else { + NSLog(@"Unknown modifier with keycode: %d\n", [event keyCode]); + return; + } + } + + // save current modifierFlags for next use + lastModifierFlags = [event modifierFlags]; + + jclass keyboard_class = (*env)->GetObjectClass(env, _parent->jkeyboard); + + jmethodID keyMethod; + if ((modifierFlags & mask) == mask) { + keyMethod = (*env)->GetMethodID(env, keyboard_class, "keyPressed", "(ILjava/lang/String;J)V"); + } else { + keyMethod = (*env)->GetMethodID(env, keyboard_class, "keyReleased", "(ILjava/lang/String;J)V"); + } + + (*env)->CallVoidMethod(env, _parent->jkeyboard, keyMethod, keyCode, NULL, time); +} + +- (void)mouseButtonState:(NSEvent *)event :(int)button :(int)state { + JNIEnv *env = attachCurrentThread(); + if (env == nil || event == nil || _parent == nil || _parent->jkeyboard == nil) { + return; + } + long time = [event timestamp] * 1000000000; + jclass mouse_class = (*env)->GetObjectClass(env, _parent->jmouse); + jmethodID mousebutton = (*env)->GetMethodID(env, mouse_class, "setButton", "(IIJ)V"); + (*env)->CallVoidMethod(env, _parent->jmouse, mousebutton, button, state, time); +} + +- (void)mouseDown:(NSEvent *)event { + if ([event modifierFlags] & NSControlKeyMask) { + rightMouseDown = true; + [self rightMouseDown:event]; + return; + } + + leftMouseDown = true; + [self mouseButtonState:event :0 :1]; +} + +- (void)rightMouseDown:(NSEvent *)event { + [self mouseButtonState:event :1 :1]; +} + +- (void)otherMouseDown:(NSEvent *)event { + [self mouseButtonState:event :2 :1]; +} + +- (void)mouseUp:(NSEvent *)event { + if (rightMouseDown) { + rightMouseDown = false; + [self rightMouseUp:event]; + } + + if (leftMouseDown) { + leftMouseDown = false; + [self mouseButtonState:event :0 :0]; + } +} + +- (void)rightMouseUp:(NSEvent *)event { + [self mouseButtonState:event :1 :0]; +} + +- (void)otherMouseUp:(NSEvent *)event { + [self mouseButtonState:event :2 :0]; +} + +- (void)mouseDragged:(NSEvent *)event { + JNIEnv *env = attachCurrentThread(); + if (env == nil || event == nil || _parent == nil || _parent->jmouse == nil) { + return; + } + long time = [event timestamp] * 1000000000; + jclass mouse_class = (*env)->GetObjectClass(env, _parent->jmouse); + jmethodID mousemove = (*env)->GetMethodID(env, mouse_class, "mouseMoved", "(FFFFFJ)V"); + NSPoint loc = [self convertPoint:[event locationInWindow] toView:nil]; + (*env)->CallVoidMethod(env, _parent->jmouse, mousemove, loc.x, loc.y, [event deltaX], [event deltaY], 0.0f, time); +} + +- (void)rightMouseDragged:(NSEvent *)event { + JNIEnv *env = attachCurrentThread(); + if (env == nil || event == nil || _parent == nil || _parent->jmouse == nil) { + return; + } + long time = [event timestamp] * 1000000000; + jclass mouse_class = (*env)->GetObjectClass(env, _parent->jmouse); + jmethodID mousemove = (*env)->GetMethodID(env, mouse_class, "mouseMoved", "(FFFFFJ)V"); + NSPoint loc = [self convertPoint:[event locationInWindow] toView:nil]; + (*env)->CallVoidMethod(env, _parent->jmouse, mousemove, loc.x, loc.y, [event deltaX], [event deltaY], 0.0f, time); +} + +- (void)otherMouseDragged:(NSEvent *)event { + JNIEnv *env = attachCurrentThread(); + if (env == nil || event == nil || _parent == nil || _parent->jmouse == nil) { + return; + } + long time = [event timestamp] * 1000000000; + jclass mouse_class = (*env)->GetObjectClass(env, _parent->jmouse); + jmethodID mousemove = (*env)->GetMethodID(env, mouse_class, "mouseMoved", "(FFFFFJ)V"); + NSPoint loc = [self convertPoint:[event locationInWindow] toView:nil]; + (*env)->CallVoidMethod(env, _parent->jmouse, mousemove, loc.x, loc.y, [event deltaX], [event deltaY], 0.0f, time); +} + +- (void)mouseMoved:(NSEvent *)event { + JNIEnv *env = attachCurrentThread(); + if (env == nil || event == nil || _parent == nil || _parent->jmouse == nil) { + return; + } + long time = [event timestamp] * 1000000000; + jclass mouse_class = (*env)->GetObjectClass(env, _parent->jmouse); + jmethodID mousemove = (*env)->GetMethodID(env, mouse_class, "mouseMoved", "(FFFFFJ)V"); + NSPoint loc = [self convertPoint:[event locationInWindow] toView:nil]; + (*env)->CallVoidMethod(env, _parent->jmouse, mousemove, loc.x, loc.y, [event deltaX], [event deltaY], 0.0f, time); +} + +- (void)scrollWheel:(NSEvent *)event { + JNIEnv *env = attachCurrentThread(); + if (env == nil || event == nil || _parent == nil) { + return; + } + long time = [event timestamp] * 1000000000; + jclass mouse_class = (*env)->GetObjectClass(env, _parent->jmouse); + jmethodID mousemove = (*env)->GetMethodID(env, mouse_class, "mouseMoved", "(FFFFFJ)V"); + NSPoint loc = [self convertPoint:[event locationInWindow] toView:nil]; + (*env)->CallVoidMethod(env, _parent->jmouse, mousemove, loc.x, loc.y, [event deltaX], [event deltaY], 1.0f, time); +} + +- (void)viewDidMoveToWindow { + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(windowResized:) + name:NSWindowDidResizeNotification + object:[self window]]; +} + +- (void)dealloc { + [[NSNotificationCenter defaultCenter] removeObserver:self]; + [super dealloc]; +} + +- (void)windowResized:(NSNotification *)notification; +{ + if (_parent != nil) { + _parent->display_rect = [self frame]; + _parent->resized = JNI_TRUE; + } +} + +- (void)viewDidChangeBackingProperties { + JNIEnv *env = attachCurrentThread(); + if (env == nil || _parent == nil || _parent->jdisplay == nil) { + return; + } + + jclass display_class = (*env)->GetObjectClass(env, _parent->jdisplay); + jmethodID setScaleFactor_callback = (*env)->GetMethodID(env, display_class, "setScaleFactor", "(F)V"); + + CGFloat scaleFactor; + + // call method using runtime selector as its a 10.7+ api and allows compiling on older SDK's + SEL selector = NSSelectorFromString(@"backingScaleFactor"); + + // as we are using a runtime selector, we need to use NSInvocations to get a CGFloat value back from it + NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[[[self window] class] instanceMethodSignatureForSelector:selector]]; + [invocation setSelector:selector]; + [invocation setTarget:[self window]]; + [invocation invoke]; + [invocation getReturnValue:&scaleFactor]; + + (*env)->CallVoidMethod(env, _parent->jdisplay, setScaleFactor_callback, scaleFactor); +} + +-(void)updateTrackingAreas { + if(_trackingArea != nil) { + [self removeTrackingArea:_trackingArea]; + [_trackingArea release]; + } + + int options = (NSTrackingMouseEnteredAndExited | NSTrackingActiveAlways); + _trackingArea = [[NSTrackingArea alloc] initWithRect:[self bounds] + options:options + owner:self + userInfo:nil]; + [self addTrackingArea:_trackingArea]; + + // since nstrackingarea's don't know if mouse is inside or outside on creation + // manually detect this and send a fake mouse entered/exited message + NSPoint mouseLocation = [[self window] mouseLocationOutsideOfEventStream]; + mouseLocation = [self convertPoint:mouseLocation fromView:nil]; + + if (NSPointInRect(mouseLocation, [self bounds])) { + [self mouseEntered:nil]; + } + else { + [self mouseExited:nil]; + } +} + +-(void)mouseEntered:(NSEvent *)event { + JNIEnv *env = attachCurrentThread(); + if (env == nil || _parent == nil || _parent->jdisplay == nil) { + return; + } + + jclass display_class = (*env)->GetObjectClass(env, _parent->jdisplay); + jmethodID mouseInsideWindow_callback = (*env)->GetMethodID(env, display_class, "mouseInsideWindow", "(Z)V"); + (*env)->CallVoidMethod(env, _parent->jdisplay, mouseInsideWindow_callback, JNI_TRUE); +} + +-(void)mouseExited:(NSEvent *)event { + JNIEnv *env = attachCurrentThread(); + if (env == nil || _parent == nil || _parent->jdisplay == nil) { + return; + } + + jclass display_class = (*env)->GetObjectClass(env, _parent->jdisplay); + jmethodID mouseInsideWindow_callback = (*env)->GetMethodID(env, display_class, "mouseInsideWindow", "(Z)V"); + (*env)->CallVoidMethod(env, _parent->jdisplay, mouseInsideWindow_callback, JNI_FALSE); +} + +- (void) drawRect:(NSRect)rect { + // set black as the default background color + // for the nsview to avoid white flash on fullscreen + [[NSColor blackColor] setFill]; + NSRectFill(rect); +} +@end + +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_nIsMiniaturized(JNIEnv *env, jobject this, jobject window_handle) { + MacOSXWindowInfo *window_info = (MacOSXWindowInfo *)(*env)->GetDirectBufferAddress(env, window_handle); + return (jboolean)[window_info->window isMiniaturized]; +} + +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_nIsFocused(JNIEnv *env, jobject this, jobject window_handle) { + MacOSXWindowInfo *window_info = (MacOSXWindowInfo *)(*env)->GetDirectBufferAddress(env, window_handle); + // Display is focused if nswindow is key window and nsview is first responder in that nswindow + return (jboolean)([[window_info->view window] isKeyWindow] && [[window_info->view window] firstResponder] == window_info->view); +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_nResizeWindow(JNIEnv *env, jobject this, jobject window_handle, jint x, jint y, jint width, jint height) { + MacOSXWindowInfo *window_info = (MacOSXWindowInfo *)(*env)->GetDirectBufferAddress(env, window_handle); + window_info->display_rect = NSMakeRect(x, y, width, height); + [window_info->window setFrame:window_info->display_rect display:false]; + [window_info->view update]; +} + +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_nWasResized(JNIEnv *env, jobject this, jobject window_handle) { + MacOSXWindowInfo *window_info = (MacOSXWindowInfo *)(*env)->GetDirectBufferAddress(env, window_handle); + jboolean was_resized = window_info->resized; + window_info->resized = JNI_FALSE; + return was_resized; +} + +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_nGetWidth(JNIEnv *env, jobject this, jobject window_handle) { + MacOSXWindowInfo *window_info = (MacOSXWindowInfo *)(*env)->GetDirectBufferAddress(env, window_handle); + jint width = window_info->display_rect.size.width; + return width; +} + +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_nGetHeight(JNIEnv *env, jobject this, jobject window_handle) { + MacOSXWindowInfo *window_info = (MacOSXWindowInfo *)(*env)->GetDirectBufferAddress(env, window_handle); + jint height = window_info->display_rect.size.height; + return height; +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_nSetResizable(JNIEnv *env, jobject this, jobject window_handle, jboolean resizable) { + MacOSXWindowInfo *window_info = (MacOSXWindowInfo *)(*env)->GetDirectBufferAddress(env, window_handle); + NSUInteger style_mask = [window_info->window styleMask]; + if (resizable == true) { + style_mask |= NSResizableWindowMask; + } else { + style_mask &= ~NSResizableWindowMask; + } + [window_info->window setStyleMask:style_mask]; + + if (window_info->enableFullscreenModeAPI) { + if (resizable) { + // manually create OS X 10.7+ mask to allow compilation on previous OS X versions + NSUInteger NSWindowCollectionBehaviorFullScreenPrimary = 1 << 7; + [window_info->window setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary]; + } + else { + // manually create OS X 10.7+ mask to allow compilation on previous OS X versions + NSUInteger NSFullScreenWindowMask = 1 << 14; + // on disabling resizing exit fullscreen mode exit otherwise will be stuck in it + if ((style_mask & NSFullScreenWindowMask) == NSFullScreenWindowMask) { + // call method using runtime selector as its a 10.7+ api and allows compiling on older SDK's + [window_info->window performSelector:NSSelectorFromString(@"toggleFullScreen:") withObject:nil]; + } + [window_info->window setCollectionBehavior:NSWindowCollectionBehaviorDefault]; + } + } +} + +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_nGetX(JNIEnv *env, jobject this, jobject window_handle) { + MacOSXWindowInfo *window_info = (MacOSXWindowInfo *)(*env)->GetDirectBufferAddress(env, window_handle); + jint x = [[window_info->view window] frame].origin.x; + return x; +} + +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_nGetY(JNIEnv *env, jobject this, jobject window_handle) { + MacOSXWindowInfo *window_info = (MacOSXWindowInfo *)(*env)->GetDirectBufferAddress(env, window_handle); + + NSRect screenRect = [[window_info->window screen] frame]; + NSRect winRect = [[window_info->view window] frame]; + + // get top corner of window frame, also flip coords so origin is in top left + jint y = screenRect.size.height - (winRect.origin.y + winRect.size.height) - 1; + return y; +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_nSetTitle(JNIEnv *env, jobject this, jobject window_handle, jobject title_buffer) { + MacOSXWindowInfo *window_info = (MacOSXWindowInfo *)(*env)->GetDirectBufferAddress(env, window_handle); + const char *title_cstr = (const char *)(*env)->GetDirectBufferAddress(env, title_buffer); + NSString *title = [[NSString alloc] initWithUTF8String:title_cstr]; + [window_info->window performSelectorOnMainThread:@selector(setTitle:) withObject:title waitUntilDone:NO]; +} + +JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_nCreateWindow(JNIEnv *env, jobject this, jint x, jint y, jint width, jint height, jboolean fullscreen, jboolean undecorated, jboolean resizable, jboolean parented, jboolean enableFullscreenModeAPI, jboolean enableHighDPI, jobject peer_info_handle, jobject window_handle) { + + pool = [[NSAutoreleasePool alloc] init]; + + peer_info = (MacOSXPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); + + if (peer_info->isCALayer && !fullscreen) { + MacOSXWindowInfo *window_info = (MacOSXWindowInfo *)(*env)->GetDirectBufferAddress(env, window_handle); + window_info->fullscreen = fullscreen; + window_info->undecorated = undecorated; + window_info->parented = parented; + window_info->enableFullscreenModeAPI = enableFullscreenModeAPI; + + return window_handle; + } + + if (window_handle == NULL) { + window_handle = newJavaManagedByteBuffer(env, sizeof(MacOSXWindowInfo)); + if (window_handle == NULL) { + throwException(env, "Could not create handle buffer"); + return NULL; + } + } + + MacOSXWindowInfo *window_info = (MacOSXWindowInfo *)(*env)->GetDirectBufferAddress(env, window_handle); + + window_info->fullscreen = fullscreen; + window_info->undecorated = undecorated; + window_info->resizable = resizable; + window_info->parented = parented; + window_info->enableFullscreenModeAPI = enableFullscreenModeAPI; + window_info->enableHighDPI = enableHighDPI; + + peer_info->window_info = window_info; + peer_info->isWindowed = true; + + window_info->display_rect = NSMakeRect(x, [[NSScreen mainScreen] frame].size.height - y - height, width, height); + + // Cache the necessary info for window-close callbacks into the JVM + if (window_info->jdisplay == NULL) { + window_info->jdisplay = (*env)->NewGlobalRef(env, this); + } + + // create window on main thread + [MacOSXKeyableWindow performSelectorOnMainThread:@selector(createWindow) withObject:nil waitUntilDone:YES]; + + return window_handle; +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_nDestroyWindow(JNIEnv *env, jobject this, jobject window_handle) { + + // destroy window on main thread + [MacOSXKeyableWindow performSelectorOnMainThread:@selector(destroyWindow) withObject:nil waitUntilDone:YES]; + + [pool drain]; +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_nDestroyCALayer(JNIEnv *env, jobject this, jobject peer_info_handle) { + MacOSXPeerInfo *peer_info = (MacOSXPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); + if (peer_info->isCALayer) { + peer_info->isCALayer = false; + [peer_info->glLayer performSelectorOnMainThread:@selector(removeLayer) withObject:nil waitUntilDone:YES]; + [peer_info->glLayer release]; + peer_info->glLayer = nil; + } +} + +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_nIsNativeMode(JNIEnv *env, jobject this, jobject peer_info_handle) { + MacOSXPeerInfo *peer_info = (MacOSXPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); + if (peer_info->isCALayer) { + return JNI_FALSE; + } + else { + return JNI_TRUE; + } +} + +JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_nGetCurrentDisplayMode(JNIEnv *env, jobject this) { + + jclass displayClass = (*env)->GetObjectClass(env, this); + jmethodID createDisplayModeMethod = (*env)->GetMethodID(env, displayClass, "createDisplayMode", "(IIII)Ljava/lang/Object;"); + + if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_5) { // if OS X 10.6+ use newer api + + CGDisplayModeRef mode = CGDisplayCopyDisplayMode(kCGDirectMainDisplay); + + int width = (int) CGDisplayModeGetWidth(mode); + int height = (int) CGDisplayModeGetHeight(mode); + int refreshRate = (int)CGDisplayModeGetRefreshRate(mode); + int bitsPerPixel; + + // get bitsPerPixel + CFStringRef pixelEncoding = CGDisplayModeCopyPixelEncoding(mode); + + if(CFStringCompare(pixelEncoding, CFSTR(IO16BitDirectPixels), kCFCompareCaseInsensitive) == kCFCompareEqualTo) { + bitsPerPixel = 16; + } + else { + bitsPerPixel = 32; + } + + jobject displayMode = (*env)->CallObjectMethod(env, this, createDisplayModeMethod, width, height, bitsPerPixel, refreshRate); + + return displayMode; + + } else { + + CFDictionaryRef mode = CGDisplayCurrentMode(CGMainDisplayID()); + + long bitsPerPixel = 0; + long width = 0; + long height = 0; + long refreshRate = 0; + + CFNumberRef value; + + value = CFDictionaryGetValue(mode, kCGDisplayBitsPerPixel); + CFNumberGetValue(value, kCFNumberLongType, &bitsPerPixel); + + value = CFDictionaryGetValue(mode, kCGDisplayWidth); + CFNumberGetValue(value, kCFNumberLongType, &width); + + value = CFDictionaryGetValue(mode, kCGDisplayHeight); + CFNumberGetValue(value, kCFNumberLongType, &height); + + value = CFDictionaryGetValue(mode, kCGDisplayRefreshRate); + CFNumberGetValue(value, kCFNumberLongType, &refreshRate); + + jobject displayMode = (*env)->CallObjectMethod(env, this, createDisplayModeMethod, width, height, bitsPerPixel, refreshRate); + + return displayMode; + } +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_nGetDisplayModes(JNIEnv *env, jobject this, jobject modesList) { + + jclass displayClass = (*env)->GetObjectClass(env, this); + jmethodID addDisplayModeMethod = (*env)->GetMethodID(env, displayClass, "addDisplayMode", "(Ljava/lang/Object;IIII)V"); + + if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_5) { // if OS X 10.6+ use newer api + + CFArrayRef modes = CGDisplayCopyAllDisplayModes(kCGDirectMainDisplay, NULL); + + int i = 0; + + for (i = 0; i < CFArrayGetCount(modes); i++) { + CGDisplayModeRef mode = (CGDisplayModeRef)CFArrayGetValueAtIndex(modes, i); + + int width = (int) CGDisplayModeGetWidth(mode); + int height = (int) CGDisplayModeGetHeight(mode); + int refreshRate = (int)CGDisplayModeGetRefreshRate(mode); + int bitsPerPixel; + + // get bitsPerPixel + CFStringRef pixelEncoding = CGDisplayModeCopyPixelEncoding(mode); + if(CFStringCompare(pixelEncoding, CFSTR(IO32BitDirectPixels), kCFCompareCaseInsensitive) == kCFCompareEqualTo) { + bitsPerPixel = 32; + } + else if(CFStringCompare(pixelEncoding, CFSTR(IO16BitDirectPixels), kCFCompareCaseInsensitive) == kCFCompareEqualTo) { + bitsPerPixel = 16; + } + else { + continue; // ignore DisplayMode of other bitsPerPixel rates + } + + (*env)->CallVoidMethod(env, this, addDisplayModeMethod, modesList, width, height, bitsPerPixel, refreshRate); + } + + } else { + + CFArrayRef modes = CGDisplayAvailableModes(CGMainDisplayID()); + CFIndex index, count; + CFDictionaryRef mode; + + count = CFArrayGetCount(modes); + + for (index = 0; index < count; index++) { + mode = CFArrayGetValueAtIndex(modes, index); + + long bitsPerPixel = 0; + long width = 0; + long height = 0; + long refreshRate = 0; + + CFNumberRef value; + + value = CFDictionaryGetValue(mode, kCGDisplayBitsPerPixel); + CFNumberGetValue(value, kCFNumberLongType, &bitsPerPixel); + + value = CFDictionaryGetValue(mode, kCGDisplayWidth); + CFNumberGetValue(value, kCFNumberLongType, &width); + + value = CFDictionaryGetValue(mode, kCGDisplayHeight); + CFNumberGetValue(value, kCFNumberLongType, &height); + + value = CFDictionaryGetValue(mode, kCGDisplayRefreshRate); + CFNumberGetValue(value, kCFNumberLongType, &refreshRate); + + (*env)->CallVoidMethod(env, this, addDisplayModeMethod, modesList, width, height, bitsPerPixel, refreshRate); + } + } + +} + +JNIEXPORT jint JNICALL Java_org_lwjgl_DefaultSysImplementation_getJNIVersion(JNIEnv *env, jobject ignored) { return org_lwjgl_MacOSXSysImplementation_JNI_VERSION; } @@ -62,17 +883,9 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_setGammaRamp(JNIEnv *env, jobject this, jobject gamma_buffer) { const CGGammaValue *values = (*env)->GetDirectBufferAddress(env, gamma_buffer); - CGTableCount table_size = (*env)->GetDirectBufferCapacity(env, gamma_buffer); + uint32_t table_size = (*env)->GetDirectBufferCapacity(env, gamma_buffer); CGDisplayErr err = CGSetDisplayTransferByTable(kCGDirectMainDisplay, table_size, values, values, values); if (err != CGDisplayNoErr) { throwException(env, "Could not set display gamma"); } -} - -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_nHideUI(JNIEnv *env, jobject this, jboolean hide) { - if (hide == JNI_TRUE) { - SetSystemUIMode(kUIModeContentSuppressed, 0); - } else { - SetSystemUIMode(kUIModeNormal, 0); - } -} +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/native/macosx/org_lwjgl_opengl_MacOSXAWTMouse.m lwjgl-2.9.3+dfsg/src/native/macosx/org_lwjgl_opengl_MacOSXAWTMouse.m --- lwjgl-2.7.1+dfsg/src/native/macosx/org_lwjgl_opengl_MacOSXAWTMouse.m 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/macosx/org_lwjgl_opengl_MacOSXAWTMouse.m 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * $Id$ + * + * Mac OS X mouse handling. + * + * @author elias_naur + * @version $Revision$ + */ + +#include +#include +#include "org_lwjgl_opengl_MacOSXMouseEventQueue.h" +#include "common_tools.h" + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXMouseEventQueue_nGrabMouse(JNIEnv *env, jclass unused, jboolean grab) { + CGAssociateMouseAndMouseCursorPosition(grab == JNI_TRUE ? FALSE : TRUE); + if (grab) + CGDisplayHideCursor(kCGDirectMainDisplay); + else + CGDisplayShowCursor(kCGDirectMainDisplay); +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXMouseEventQueue_nWarpCursor(JNIEnv *env, jclass unused, jint x, jint y) { + CGPoint p; + p.x = x; + p.y = y; + CGWarpMouseCursorPosition(p); + CGAssociateMouseAndMouseCursorPosition(true); +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXMouseEventQueue_getMouseDeltas(JNIEnv *env, jclass unused, jobject delta_buffer) { + int32_t dx, dy; + CGGetLastMouseDelta(&dx, &dy); + int buffer_length = (*env)->GetDirectBufferCapacity(env, delta_buffer); + if (buffer_length != 2) { + printfDebugJava(env, "Delta buffer not large enough!"); + return; + } + jint *buffer = (*env)->GetDirectBufferAddress(env, delta_buffer); + buffer[0] = dx; + buffer[1] = dy; +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/native/macosx/org_lwjgl_opengl_MacOSXCanvasPeerInfo.h lwjgl-2.9.3+dfsg/src/native/macosx/org_lwjgl_opengl_MacOSXCanvasPeerInfo.h --- lwjgl-2.7.1+dfsg/src/native/macosx/org_lwjgl_opengl_MacOSXCanvasPeerInfo.h 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/macosx/org_lwjgl_opengl_MacOSXCanvasPeerInfo.h 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,37 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_lwjgl_opengl_MacOSXCanvasPeerInfo */ + +#ifndef _Included_org_lwjgl_opengl_MacOSXCanvasPeerInfo +#define _Included_org_lwjgl_opengl_MacOSXCanvasPeerInfo +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: org_lwjgl_opengl_MacOSXCanvasPeerInfo + * Method: nInitHandle + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/ByteBuffer;Ljava/nio/ByteBuffer;ZZII)Ljava/nio/ByteBuffer; + */ +JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_MacOSXCanvasPeerInfo_nInitHandle + (JNIEnv *, jclass, jobject, jobject, jobject, jboolean, jboolean, jint, jint); + +/* + * Class: org_lwjgl_opengl_MacOSXCanvasPeerInfo + * Method: nSetLayerPosition + * Signature: (Ljava/nio/ByteBuffer;II)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXCanvasPeerInfo_nSetLayerPosition + (JNIEnv *, jclass, jobject, jint, jint); + +/* + * Class: org_lwjgl_opengl_MacOSXCanvasPeerInfo + * Method: nSetLayerBounds + * Signature: (Ljava/nio/ByteBuffer;IIII)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXCanvasPeerInfo_nSetLayerBounds + (JNIEnv *, jclass, jobject, jint, jint, jint, jint); + +#ifdef __cplusplus +} +#endif +#endif diff -Nru lwjgl-2.7.1+dfsg/src/native/macosx/org_lwjgl_opengl_MacOSXCanvasPeerInfo.m lwjgl-2.9.3+dfsg/src/native/macosx/org_lwjgl_opengl_MacOSXCanvasPeerInfo.m --- lwjgl-2.7.1+dfsg/src/native/macosx/org_lwjgl_opengl_MacOSXCanvasPeerInfo.m 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/macosx/org_lwjgl_opengl_MacOSXCanvasPeerInfo.m 2016-04-09 16:26:57.000000000 +0000 @@ -31,12 +31,15 @@ */ /** - * $Id: org_lwjgl_opengl_MacOSXCanvasPeerInfo.m 2985 2008-04-07 18:42:36Z matzon $ + * $Id$ * * @author elias_naur - * @version $Revision: 2985 $ + * @author Pelle Johnsen + * @author kappaOne + * @version $Revision$ */ +#import #include #include #include "awt_tools.h" @@ -44,13 +47,292 @@ #include "context.h" #include "common_tools.h" -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXCanvasPeerInfo_nInitHandle - (JNIEnv *env, jclass clazz, jobject lock_buffer_handle, jobject peer_info_handle) { +JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_MacOSXCanvasPeerInfo_nInitHandle +(JNIEnv *env, jclass clazz, jobject lock_buffer_handle, jobject peer_info_handle, jobject window_handle, jboolean forceCALayer, jboolean autoResizable, jint x, jint y) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + MacOSXPeerInfo *peer_info = (MacOSXPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); AWTSurfaceLock *surface = (AWTSurfaceLock *)(*env)->GetDirectBufferAddress(env, lock_buffer_handle); JAWT_MacOSXDrawingSurfaceInfo *macosx_dsi = (JAWT_MacOSXDrawingSurfaceInfo *)surface->dsi->platformInfo; - peer_info->nsview = macosx_dsi->cocoaViewRef; - peer_info->window = true; + + // force CALayer usage or check if CALayer is supported (i.e. on Java 5 and Java 6) + if(forceCALayer || (surface->awt.version & 0x80000000)) { //JAWT_MACOSX_USE_CALAYER) { + + if (macosx_dsi != NULL) { + + if (window_handle == NULL) { + window_handle = newJavaManagedByteBuffer(env, sizeof(MacOSXWindowInfo)); + if (window_handle == NULL) { + throwException(env, "Could not create handle buffer"); + } + } else if (peer_info->window_info->window != nil) { + return window_handle; + } + + if (peer_info->isCALayer) { + [peer_info->glLayer release]; + } + + peer_info->glLayer = [GLLayer new]; + + peer_info->glLayer->macosx_dsi = macosx_dsi; + peer_info->window_info = (MacOSXWindowInfo *)(*env)->GetDirectBufferAddress(env, window_handle); + peer_info->glLayer->window_info = peer_info->window_info; + peer_info->glLayer->autoResizable = autoResizable; + + /* we set bounds as requested w/ frame function */ + peer_info->glLayer.frame = CGRectMake(x, y, surface->dsi->bounds.width, surface->dsi->bounds.height); + + [peer_info->glLayer performSelectorOnMainThread:@selector(createWindow:) withObject:peer_info->pixel_format waitUntilDone:YES]; + + peer_info->isCALayer = true; + peer_info->isWindowed = true; + peer_info->parent = nil; + + [pool release]; + return window_handle; + } + } + + // no CALayer support, fallback to using legacy method of getting the NSView of an AWT Canvas + peer_info->parent = macosx_dsi->cocoaViewRef; + peer_info->isCALayer = false; + peer_info->isWindowed = true; + [pool release]; + return NULL; +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXCanvasPeerInfo_nSetLayerPosition +(JNIEnv *env, jclass clazz, jobject peer_info_handle, jint x, jint y) { + MacOSXPeerInfo *peer_info = (MacOSXPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); + + if (peer_info->glLayer != nil) { + NSPoint point = NSMakePoint(x, y); + NSValue *value = [NSValue valueWithPoint:point]; + [peer_info->glLayer performSelectorOnMainThread:@selector(updatePosition:) withObject:value waitUntilDone:NO]; + } +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXCanvasPeerInfo_nSetLayerBounds +(JNIEnv *env, jclass clazz, jobject peer_info_handle, jint x, jint y, jint width, jint height) { + MacOSXPeerInfo *peer_info = (MacOSXPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); + + if (peer_info->glLayer != nil) { + NSRect rect = NSMakeRect(x, y, width, height); + NSValue *value = [NSValue valueWithRect:rect]; + [peer_info->glLayer performSelectorOnMainThread:@selector(updateBounds:) withObject:value waitUntilDone:NO]; + } +} + +@implementation GLLayer + +- (void) attachLayer { + self.asynchronous = YES; + self.needsDisplayOnBoundsChange = YES; + self.opaque = NO; + if (autoResizable) { + self.autoresizingMask = kCALayerWidthSizable | kCALayerHeightSizable; + } + else { + self.autoresizingMask = kCALayerNotSizable; + } + + // get root layer of the AWT Canvas and add self to it + id surfaceLayers = (id )macosx_dsi; + + if (surfaceLayers.layer != self) { + surfaceLayers.layer = self; + } +} + +- (void) removeLayer { + + // clean up resources + glDeleteFramebuffersEXT(1, &fboID); + glDeleteRenderbuffersEXT(1, &imageRenderBufferID); + glDeleteRenderbuffersEXT(1, &depthRenderBufferID); + + // finish any pending blits before destroying the offscreen window to prevent crashes + glFinish(); + + // destroy offscreen Display window + [self destroyWindow]; + + // remove self from root layer + [self removeFromSuperlayer]; +} + +- (void)updatePosition:(NSValue*)value { + NSPoint point = [value pointValue]; + self.position = CGPointMake(point.x, point.y); +} + +- (void)updateBounds:(NSValue*)value { + NSRect rect = [value rectValue]; + self.frame = CGRectMake(rect.origin.x, rect.origin.y, + rect.size.width, rect.size.height); +} + +- (int) getWidth { + return canvasBounds.width; +} + +- (int) getHeight { + return canvasBounds.height; } + +- (void) createWindow:(NSOpenGLPixelFormat*)pixel_format { + if (window_info->window != nil) { + [window_info->window close]; + } + + window_info->display_rect = [[NSScreen mainScreen] frame]; + + window_info->view = [[MacOSXOpenGLView alloc] initWithFrame:window_info->display_rect pixelFormat:pixel_format]; + + window_info->window = [[MacOSXKeyableWindow alloc] initWithContentRect:window_info->display_rect styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO]; + [window_info->window setContentView:window_info->view]; + + [window_info->window orderOut:nil]; +} + +- (void) destroyWindow { + if (window_info->window != nil) { + [window_info->view removeFromSuperviewWithoutNeedingDisplay]; + [window_info->window close]; + window_info->window = nil; + } +} + +- (void) blitFrameBuffer { + + // get the size of the CALayer/AWT Canvas + int width = self.bounds.size.width; + int height = self.bounds.size.height; + + if (width != fboWidth || height != fboHeight) { + + // store current fbo/renderbuffers for later deletion + int oldFboID = fboID; + int oldImageRenderBufferID = imageRenderBufferID; + int oldDepthRenderBufferID = depthRenderBufferID; + + // create new fbo + int tempFBO; + glGenFramebuffersEXT(1, &tempFBO); + + // create new render buffers + glGenRenderbuffersEXT(1, &imageRenderBufferID); + glGenRenderbuffersEXT(1, &depthRenderBufferID); + + // switch to new fbo to attach render buffers + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, tempFBO); + + // initialize and attach image render buffer + glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, imageRenderBufferID); + glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGB, width, height); + glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_RENDERBUFFER_EXT, imageRenderBufferID); + + // initialize and attach depth render buffer + glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, depthRenderBufferID); + glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT24, width, height); + glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, depthRenderBufferID); + + // clear garbage background on new fbo + glClearColor(0.0, 0.0, 0.0, 1.0); + glClear(GL_COLOR_BUFFER_BIT); + + // blit frameBuffer to the new fbo + glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, 0); + glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, tempFBO); + glBlitFramebufferEXT(0, 0, width, height, + 0, 0, width, height, + GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT, + GL_NEAREST); + + glFinish(); // finish before using new fbo and resizing the window + + // set new fbo and its sizes + fboID = tempFBO; + fboWidth = width; + fboHeight = height; + + // set the size of the offscreen frame buffer window + window_info->display_rect = NSMakeRect(0, 0, width, height); + + // clean up the old fbo and renderBuffers + glDeleteFramebuffersEXT(1, &oldFboID); + glDeleteRenderbuffersEXT(1, &oldImageRenderBufferID); + glDeleteRenderbuffersEXT(1, &oldDepthRenderBufferID); + } + else { + glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, 0); + glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, fboID); + + glBlitFramebufferEXT(0, 0, width, height, + 0, 0, width, height, + GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT, + GL_NEAREST); + } + + // restore default framebuffer + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); +} + +-(void)drawInCGLContext:(CGLContextObj)glContext + pixelFormat:(CGLPixelFormatObj)pixelFormat + forLayerTime:(CFTimeInterval)timeInterval + displayTime:(const CVTimeStamp *)timeStamp { + + // set the current context + CGLSetCurrentContext(glContext); + + // get the size of the CALayer/AWT Canvas + int width = self.bounds.size.width; + int height = self.bounds.size.height; + + if (width != fboWidth || height != fboHeight) { + // clear garbage background before lwjgl fbo blit + glClearColor(0.0, 0.0, 0.0, 1.0); + glClear(GL_COLOR_BUFFER_BIT); + } + + // read the LWJGL FBO and blit it into this CALayers FBO + glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, fboID); + glBlitFramebufferEXT(0, 0, width, height, + 0, 0, width, height, + GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT, + GL_NEAREST); + + // call super to finalize the drawing - by default all it does is call glFlush() + [super drawInCGLContext:glContext pixelFormat:pixelFormat forLayerTime:timeInterval displayTime:timeStamp]; +} + +-(BOOL)canDrawInCGLContext:(CGLContextObj)glContext + pixelFormat:(CGLPixelFormatObj)pixelFormat + forLayerTime:(CFTimeInterval)timeInterval + displayTime:(const CVTimeStamp *)timeStamp { + return YES; +} + +- (CGLContextObj)copyCGLContextForPixelFormat:(CGLPixelFormatObj)pixelFormat { + CGLCreateContext(pixelFormat, [window_info->context CGLContextObj], &contextObject); + return contextObject; +} + +- (void)releaseCGLContext:(CGLContextObj)glContext { + CGLClearDrawable(contextObject); + // disable releasing context due to nvidia crash bug when releasing shared contexts + //CGLDestroyContext(contextObject); +} + +- (CGLPixelFormatObj)copyCGLPixelFormatForDisplayMask:(uint32_t)mask { + return CGLGetPixelFormat([window_info->context CGLContextObj]); +} + +- (void)releaseCGLPixelFormat:(CGLPixelFormatObj)pixelFormat { + +} + +@end \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/native/macosx/org_lwjgl_opengl_MacOSXContextImplementation.h lwjgl-2.9.3+dfsg/src/native/macosx/org_lwjgl_opengl_MacOSXContextImplementation.h --- lwjgl-2.7.1+dfsg/src/native/macosx/org_lwjgl_opengl_MacOSXContextImplementation.h 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/macosx/org_lwjgl_opengl_MacOSXContextImplementation.h 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,101 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_lwjgl_opengl_MacOSXContextImplementation */ + +#ifndef _Included_org_lwjgl_opengl_MacOSXContextImplementation +#define _Included_org_lwjgl_opengl_MacOSXContextImplementation +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: org_lwjgl_opengl_MacOSXContextImplementation + * Method: nCreate + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/ByteBuffer;)Ljava/nio/ByteBuffer; + */ +JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_MacOSXContextImplementation_nCreate + (JNIEnv *, jclass, jobject, jobject); + +/* + * Class: org_lwjgl_opengl_MacOSXContextImplementation + * Method: getCGLShareGroup + * Signature: (Ljava/nio/ByteBuffer;)J + */ +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_MacOSXContextImplementation_getCGLShareGroup + (JNIEnv *, jobject, jobject); + +/* + * Class: org_lwjgl_opengl_MacOSXContextImplementation + * Method: nSwapBuffers + * Signature: (Ljava/nio/ByteBuffer;)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXContextImplementation_nSwapBuffers + (JNIEnv *, jclass, jobject); + +/* + * Class: org_lwjgl_opengl_MacOSXContextImplementation + * Method: nUpdate + * Signature: (Ljava/nio/ByteBuffer;)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXContextImplementation_nUpdate + (JNIEnv *, jclass, jobject); + +/* + * Class: org_lwjgl_opengl_MacOSXContextImplementation + * Method: nReleaseCurrentContext + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXContextImplementation_nReleaseCurrentContext + (JNIEnv *, jclass); + +/* + * Class: org_lwjgl_opengl_MacOSXContextImplementation + * Method: clearDrawable + * Signature: (Ljava/nio/ByteBuffer;)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXContextImplementation_clearDrawable + (JNIEnv *, jclass, jobject); + +/* + * Class: org_lwjgl_opengl_MacOSXContextImplementation + * Method: setView + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/ByteBuffer;)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXContextImplementation_setView + (JNIEnv *, jclass, jobject, jobject); + +/* + * Class: org_lwjgl_opengl_MacOSXContextImplementation + * Method: nMakeCurrent + * Signature: (Ljava/nio/ByteBuffer;)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXContextImplementation_nMakeCurrent + (JNIEnv *, jclass, jobject); + +/* + * Class: org_lwjgl_opengl_MacOSXContextImplementation + * Method: nIsCurrent + * Signature: (Ljava/nio/ByteBuffer;)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_MacOSXContextImplementation_nIsCurrent + (JNIEnv *, jclass, jobject); + +/* + * Class: org_lwjgl_opengl_MacOSXContextImplementation + * Method: nSetSwapInterval + * Signature: (Ljava/nio/ByteBuffer;I)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXContextImplementation_nSetSwapInterval + (JNIEnv *, jclass, jobject, jint); + +/* + * Class: org_lwjgl_opengl_MacOSXContextImplementation + * Method: nDestroy + * Signature: (Ljava/nio/ByteBuffer;)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXContextImplementation_nDestroy + (JNIEnv *, jclass, jobject); + +#ifdef __cplusplus +} +#endif +#endif diff -Nru lwjgl-2.7.1+dfsg/src/native/macosx/org_lwjgl_opengl_MacOSXContextImplementation.m lwjgl-2.9.3+dfsg/src/native/macosx/org_lwjgl_opengl_MacOSXContextImplementation.m --- lwjgl-2.7.1+dfsg/src/native/macosx/org_lwjgl_opengl_MacOSXContextImplementation.m 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/macosx/org_lwjgl_opengl_MacOSXContextImplementation.m 2016-04-09 16:26:57.000000000 +0000 @@ -1,60 +1,66 @@ -/* +/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are + * modification, are permitted provided that the following conditions are * met: - * - * * Redistributions of source code must retain the above copyright + * + * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * * Neither the name of 'LWJGL' nor the names of - * its contributors may be used to endorse or promote products derived + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /** - * $Id: org_lwjgl_opengl_MacOSXContextImplementation.m 3116 2008-08-19 16:46:03Z spasi $ + * $Id$ * * @author elias_naur - * @version $Revision: 3116 $ + * @author kappaOne + * @version $Revision$ */ #import +#import +#import +#import #import #import "org_lwjgl_opengl_MacOSXContextImplementation.h" #import "context.h" #import "common_tools.h" typedef struct { - NSOpenGLContext *context; + NSOpenGLContext *context; + MacOSXPeerInfo *peer_info; } MacOSXContext; JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_MacOSXContextImplementation_nCreate - (JNIEnv *env, jclass clazz, jobject peer_info_handle, jobject attribs, jobject shared_context_handle) { + (JNIEnv *env, jclass clazz, jobject peer_info_handle, jobject shared_context_handle) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; MacOSXPeerInfo *peer_info; MacOSXContext *shared_context_info; MacOSXContext *context_info; - NSOpenGLContext *context; - NSOpenGLContext *shared_context = NULL; + NSOpenGLContext *context; + NSOpenGLContext *shared_context = NULL; + jobject context_handle = newJavaManagedByteBuffer(env, sizeof(MacOSXContext)); if (context_handle == NULL) { throwException(env, "Could not create handle buffer"); @@ -63,27 +69,64 @@ peer_info = (MacOSXPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); if (shared_context_handle != NULL) { shared_context_info = (MacOSXContext *)(*env)->GetDirectBufferAddress(env, shared_context_handle); - shared_context = shared_context_info->context; + shared_context = shared_context_info->context; } - context = [[NSOpenGLContext alloc] initWithFormat:peer_info->pixel_format shareContext:shared_context]; + context = [[NSOpenGLContext alloc] initWithFormat:peer_info->pixel_format shareContext:shared_context]; if (context == NULL) { throwException(env, "Could not create context"); return NULL; } + + if (peer_info->isWindowed) { + if (peer_info->window_info->fullscreen) { + // set a fixed backbuffer size for fullscreen + CGLContextObj cgcontext = (CGLContextObj)[context CGLContextObj]; + NSSize displaySize = peer_info->window_info->display_rect.size; + GLint dim[2] = {displaySize.width, displaySize.height}; + CGLSetParameter(cgcontext, kCGLCPSurfaceBackingSize, dim); + CGLEnable(cgcontext, kCGLCESurfaceBackingSize); + } + else { + // disable any fixed backbuffer size to allow resizing + CGLContextObj cgcontext = (CGLContextObj)[context CGLContextObj]; + CGLDisable(cgcontext, kCGLCESurfaceBackingSize); + } + + [peer_info->window_info->view setOpenGLContext:context]; + peer_info->window_info->context = context; + } + context_info = (MacOSXContext *)(*env)->GetDirectBufferAddress(env, context_handle); context_info->context = context; + context_info->peer_info = peer_info; + [pool release]; - return context_handle; + return context_handle; } -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXContextImplementation_nSwapBuffers +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_MacOSXContextImplementation_getCGLShareGroup (JNIEnv *env, jclass clazz, jobject context_handle) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - MacOSXContext *peer_info = (MacOSXContext *)(*env)->GetDirectBufferAddress(env, context_handle); - [peer_info->context flushBuffer]; + MacOSXContext *context_info = (MacOSXContext *)(*env)->GetDirectBufferAddress(env, context_handle); + CGLContextObj cgl_context = [context_info->context CGLContextObj]; + CGLShareGroupObj share_group = CGLGetShareGroup(cgl_context); [pool release]; + return (jlong)share_group; } +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXContextImplementation_nSwapBuffers + (JNIEnv *env, jclass clazz, jobject context_handle) { + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + MacOSXContext *context_info = (MacOSXContext *)(*env)->GetDirectBufferAddress(env, context_handle); + [context_info->context flushBuffer]; + + if (context_info->peer_info->isCALayer) { + // blit the contents of buffer to CALayer + [context_info->peer_info->glLayer blitFrameBuffer]; + } + + [pool release]; +} JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXContextImplementation_nUpdate (JNIEnv *env, jclass clazz, jobject context_handle) { @@ -94,7 +137,7 @@ } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXContextImplementation_clearDrawable - (JNIEnv *env, jclass clazz, jobject context_handle) { +(JNIEnv *env, jclass clazz, jobject context_handle) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; MacOSXContext *context_info = (MacOSXContext *)(*env)->GetDirectBufferAddress(env, context_handle); [context_info->context clearDrawable]; @@ -104,35 +147,54 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXContextImplementation_nReleaseCurrentContext (JNIEnv *env, jclass clazz) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - [NSOpenGLContext clearCurrentContext]; + [NSOpenGLContext clearCurrentContext]; [pool release]; } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXContextImplementation_setView - (JNIEnv *env, jclass clazz, jobject peer_info_handle, jobject context_handle) { + (JNIEnv *env, jclass clazz, jobject peer_info_handle, jobject context_handle) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; MacOSXContext *context_info = (MacOSXContext *)(*env)->GetDirectBufferAddress(env, context_handle); MacOSXPeerInfo *peer_info = (MacOSXPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); - if (peer_info->window) { - [context_info->context setView: peer_info->nsview]; - } else { + + if (peer_info->isWindowed) { + if (peer_info->isCALayer && [context_info->context view] != peer_info->window_info->view) { + // mark glViewport to be set manually when setting a new context view + peer_info->glLayer->setViewport = YES; + } + + [context_info->context setView: peer_info->window_info->view]; + } + else { [context_info->context setPixelBuffer:peer_info->pbuffer cubeMapFace:0 mipMapLevel:0 currentVirtualScreen:0]; } + + if (peer_info->isCALayer) { + // if using a CALayer, attach it to AWT Canvas and create a shared opengl context with current context + [peer_info->glLayer performSelectorOnMainThread:@selector(attachLayer) withObject:nil waitUntilDone:NO]; + } + [pool release]; } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXContextImplementation_nMakeCurrent (JNIEnv *env, jclass clazz, jobject context_handle) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - MacOSXContext *context_info = (MacOSXContext *)(*env)->GetDirectBufferAddress(env, context_handle); + MacOSXContext *context_info = (MacOSXContext *)(*env)->GetDirectBufferAddress(env, context_handle); [context_info->context makeCurrentContext]; + + if (context_info->peer_info->isCALayer && context_info->peer_info->glLayer->setViewport) { + context_info->peer_info->glLayer->setViewport = NO; + glViewport(0, 0, [context_info->peer_info->glLayer getWidth], [context_info->peer_info->glLayer getHeight]); + } + [pool release]; } JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_MacOSXContextImplementation_nIsCurrent (JNIEnv *env, jclass clazz, jobject context_handle) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - MacOSXContext *context_info = (MacOSXContext *)(*env)->GetDirectBufferAddress(env, context_handle); + MacOSXContext *context_info = (MacOSXContext *)(*env)->GetDirectBufferAddress(env, context_handle); bool result = context_info->context == [NSOpenGLContext currentContext]; [pool release]; return result ? JNI_TRUE : JNI_FALSE; @@ -150,8 +212,31 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXContextImplementation_nDestroy (JNIEnv *env, jclass clazz, jobject context_handle) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + MacOSXContext *context_info = (MacOSXContext *)(*env)->GetDirectBufferAddress(env, context_handle); + + if (context_info->peer_info->isCALayer) { + context_info->peer_info->isCALayer = false; + [context_info->peer_info->glLayer performSelectorOnMainThread:@selector(removeLayer) withObject:nil waitUntilDone:YES]; + [context_info->peer_info->glLayer release]; + context_info->peer_info->glLayer = nil; + // don't release context due to nvidia driver bug when releasing shared contexts + [context_info->context retain]; + } + [context_info->context clearDrawable]; - [context_info->context release]; + + if (context_info->peer_info->isWindowed) { + [context_info->peer_info->window_info->view setOpenGLContext:nil]; + [context_info->context release]; + context_info->context = nil; + context_info->peer_info->window_info->context = nil; + } + else { + // don't release context due to nvidia driver bug when releasing shared contexts + //[context_info->context release]; + //context_info->context = nil; + } + [pool release]; } diff -Nru lwjgl-2.7.1+dfsg/src/native/macosx/org_lwjgl_opengl_MacOSXDisplay.h lwjgl-2.9.3+dfsg/src/native/macosx/org_lwjgl_opengl_MacOSXDisplay.h --- lwjgl-2.7.1+dfsg/src/native/macosx/org_lwjgl_opengl_MacOSXDisplay.h 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/macosx/org_lwjgl_opengl_MacOSXDisplay.h 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,161 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_lwjgl_opengl_MacOSXDisplay */ + +#ifndef _Included_org_lwjgl_opengl_MacOSXDisplay +#define _Included_org_lwjgl_opengl_MacOSXDisplay +#ifdef __cplusplus +extern "C" { +#endif +#undef org_lwjgl_opengl_MacOSXDisplay_PBUFFER_HANDLE_SIZE +#define org_lwjgl_opengl_MacOSXDisplay_PBUFFER_HANDLE_SIZE 24L +#undef org_lwjgl_opengl_MacOSXDisplay_GAMMA_LENGTH +#define org_lwjgl_opengl_MacOSXDisplay_GAMMA_LENGTH 256L +/* + * Class: org_lwjgl_opengl_MacOSXDisplay + * Method: nCreateWindow + * Signature: (IIIIZZZZZZLjava/nio/ByteBuffer;Ljava/nio/ByteBuffer;)Ljava/nio/ByteBuffer; + */ +JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_nCreateWindow + (JNIEnv *, jobject, jint, jint, jint, jint, jboolean, jboolean, jboolean, jboolean, jboolean, jboolean, jobject, jobject); + +/* + * Class: org_lwjgl_opengl_MacOSXDisplay + * Method: nGetCurrentDisplayMode + * Signature: ()Ljava/lang/Object; + */ +JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_nGetCurrentDisplayMode + (JNIEnv *, jobject); + +/* + * Class: org_lwjgl_opengl_MacOSXDisplay + * Method: nGetDisplayModes + * Signature: (Ljava/lang/Object;)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_nGetDisplayModes + (JNIEnv *, jobject, jobject); + +/* + * Class: org_lwjgl_opengl_MacOSXDisplay + * Method: nIsMiniaturized + * Signature: (Ljava/nio/ByteBuffer;)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_nIsMiniaturized + (JNIEnv *, jobject, jobject); + +/* + * Class: org_lwjgl_opengl_MacOSXDisplay + * Method: nIsFocused + * Signature: (Ljava/nio/ByteBuffer;)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_nIsFocused + (JNIEnv *, jobject, jobject); + +/* + * Class: org_lwjgl_opengl_MacOSXDisplay + * Method: nSetResizable + * Signature: (Ljava/nio/ByteBuffer;Z)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_nSetResizable + (JNIEnv *, jobject, jobject, jboolean); + +/* + * Class: org_lwjgl_opengl_MacOSXDisplay + * Method: nResizeWindow + * Signature: (Ljava/nio/ByteBuffer;IIII)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_nResizeWindow + (JNIEnv *, jobject, jobject, jint, jint, jint, jint); + +/* + * Class: org_lwjgl_opengl_MacOSXDisplay + * Method: nWasResized + * Signature: (Ljava/nio/ByteBuffer;)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_nWasResized + (JNIEnv *, jobject, jobject); + +/* + * Class: org_lwjgl_opengl_MacOSXDisplay + * Method: nGetX + * Signature: (Ljava/nio/ByteBuffer;)I + */ +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_nGetX + (JNIEnv *, jobject, jobject); + +/* + * Class: org_lwjgl_opengl_MacOSXDisplay + * Method: nGetY + * Signature: (Ljava/nio/ByteBuffer;)I + */ +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_nGetY + (JNIEnv *, jobject, jobject); + +/* + * Class: org_lwjgl_opengl_MacOSXDisplay + * Method: nGetWidth + * Signature: (Ljava/nio/ByteBuffer;)I + */ +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_nGetWidth + (JNIEnv *, jobject, jobject); + +/* + * Class: org_lwjgl_opengl_MacOSXDisplay + * Method: nGetHeight + * Signature: (Ljava/nio/ByteBuffer;)I + */ +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_nGetHeight + (JNIEnv *, jobject, jobject); + +/* + * Class: org_lwjgl_opengl_MacOSXDisplay + * Method: nIsNativeMode + * Signature: (Ljava/nio/ByteBuffer;)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_nIsNativeMode + (JNIEnv *, jobject, jobject); + +/* + * Class: org_lwjgl_opengl_MacOSXDisplay + * Method: nDestroyCALayer + * Signature: (Ljava/nio/ByteBuffer;)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_nDestroyCALayer + (JNIEnv *, jobject, jobject); + +/* + * Class: org_lwjgl_opengl_MacOSXDisplay + * Method: nDestroyWindow + * Signature: (Ljava/nio/ByteBuffer;)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_nDestroyWindow + (JNIEnv *, jobject, jobject); + +/* + * Class: org_lwjgl_opengl_MacOSXDisplay + * Method: setGammaRamp + * Signature: (Ljava/nio/FloatBuffer;)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_setGammaRamp + (JNIEnv *, jobject, jobject); + +/* + * Class: org_lwjgl_opengl_MacOSXDisplay + * Method: restoreGamma + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_restoreGamma + (JNIEnv *, jobject); + +/* + * Class: org_lwjgl_opengl_MacOSXDisplay + * Method: nSetTitle + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/ByteBuffer;)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_nSetTitle + (JNIEnv *, jobject, jobject, jobject); + +#ifdef __cplusplus +} +#endif +#endif diff -Nru lwjgl-2.7.1+dfsg/src/native/macosx/org_lwjgl_opengl_MacOSXMouseEventQueue.h lwjgl-2.9.3+dfsg/src/native/macosx/org_lwjgl_opengl_MacOSXMouseEventQueue.h --- lwjgl-2.7.1+dfsg/src/native/macosx/org_lwjgl_opengl_MacOSXMouseEventQueue.h 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/macosx/org_lwjgl_opengl_MacOSXMouseEventQueue.h 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,43 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_lwjgl_opengl_MacOSXMouseEventQueue */ + +#ifndef _Included_org_lwjgl_opengl_MacOSXMouseEventQueue +#define _Included_org_lwjgl_opengl_MacOSXMouseEventQueue +#ifdef __cplusplus +extern "C" { +#endif +#undef org_lwjgl_opengl_MacOSXMouseEventQueue_QUEUE_SIZE +#define org_lwjgl_opengl_MacOSXMouseEventQueue_QUEUE_SIZE 200L +#undef org_lwjgl_opengl_MacOSXMouseEventQueue_WHEEL_SCALE +#define org_lwjgl_opengl_MacOSXMouseEventQueue_WHEEL_SCALE 120L +#undef org_lwjgl_opengl_MacOSXMouseEventQueue_NUM_BUTTONS +#define org_lwjgl_opengl_MacOSXMouseEventQueue_NUM_BUTTONS 3L +/* + * Class: org_lwjgl_opengl_MacOSXMouseEventQueue + * Method: getMouseDeltas + * Signature: (Ljava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXMouseEventQueue_getMouseDeltas + (JNIEnv *, jclass, jobject); + +/* + * Class: org_lwjgl_opengl_MacOSXMouseEventQueue + * Method: nWarpCursor + * Signature: (II)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXMouseEventQueue_nWarpCursor + (JNIEnv *, jclass, jint, jint); + +/* + * Class: org_lwjgl_opengl_MacOSXMouseEventQueue + * Method: nGrabMouse + * Signature: (Z)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXMouseEventQueue_nGrabMouse + (JNIEnv *, jclass, jboolean); + +#ifdef __cplusplus +} +#endif +#endif diff -Nru lwjgl-2.7.1+dfsg/src/native/macosx/org_lwjgl_opengl_MacOSXNativeKeyboard.h lwjgl-2.9.3+dfsg/src/native/macosx/org_lwjgl_opengl_MacOSXNativeKeyboard.h --- lwjgl-2.7.1+dfsg/src/native/macosx/org_lwjgl_opengl_MacOSXNativeKeyboard.h 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/macosx/org_lwjgl_opengl_MacOSXNativeKeyboard.h 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,31 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_lwjgl_opengl_MacOSXNativeKeyboard */ + +#ifndef _Included_org_lwjgl_opengl_MacOSXNativeKeyboard +#define _Included_org_lwjgl_opengl_MacOSXNativeKeyboard +#ifdef __cplusplus +extern "C" { +#endif +#undef org_lwjgl_opengl_MacOSXNativeKeyboard_QUEUE_SIZE +#define org_lwjgl_opengl_MacOSXNativeKeyboard_QUEUE_SIZE 200L +/* + * Class: org_lwjgl_opengl_MacOSXNativeKeyboard + * Method: nRegisterKeyListener + * Signature: (Ljava/nio/ByteBuffer;)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXNativeKeyboard_nRegisterKeyListener + (JNIEnv *, jobject, jobject); + +/* + * Class: org_lwjgl_opengl_MacOSXNativeKeyboard + * Method: nUnregisterKeyListener + * Signature: (Ljava/nio/ByteBuffer;)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXNativeKeyboard_nUnregisterKeyListener + (JNIEnv *, jobject, jobject); + +#ifdef __cplusplus +} +#endif +#endif diff -Nru lwjgl-2.7.1+dfsg/src/native/macosx/org_lwjgl_opengl_MacOSXNativeKeyboard.m lwjgl-2.9.3+dfsg/src/native/macosx/org_lwjgl_opengl_MacOSXNativeKeyboard.m --- lwjgl-2.7.1+dfsg/src/native/macosx/org_lwjgl_opengl_MacOSXNativeKeyboard.m 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/macosx/org_lwjgl_opengl_MacOSXNativeKeyboard.m 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2002-2012 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * $Id: org_lwjgl_opengl_MacOSXNativeKeyboard.m 3055 2012-08-29 0:46:00Z mojang $ + * + * Mac OS X native keyboard functions. + * + * @author mojang + * @version $Revision: 3055 $ + */ + +#import +#import +#import +#import +#import "common_tools.h" +#import "org_lwjgl_opengl_MacOSXNativeKeyboard.h" +#import "context.h" + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXNativeKeyboard_nRegisterKeyListener(JNIEnv *env, jobject this, jobject window_handle) { + MacOSXWindowInfo *window_info = (MacOSXWindowInfo *)(*env)->GetDirectBufferAddress(env, window_handle); + window_info->jkeyboard = (*env)->NewGlobalRef(env, this); +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXNativeKeyboard_nUnregisterKeyListener(JNIEnv *env, jobject this, jobject window_handle) { + MacOSXWindowInfo *window_info = (MacOSXWindowInfo *)(*env)->GetDirectBufferAddress(env, window_handle); + window_info->jkeyboard = NULL; +} diff -Nru lwjgl-2.7.1+dfsg/src/native/macosx/org_lwjgl_opengl_MacOSXNativeMouse.h lwjgl-2.9.3+dfsg/src/native/macosx/org_lwjgl_opengl_MacOSXNativeMouse.h --- lwjgl-2.7.1+dfsg/src/native/macosx/org_lwjgl_opengl_MacOSXNativeMouse.h 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/macosx/org_lwjgl_opengl_MacOSXNativeMouse.h 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,75 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_lwjgl_opengl_MacOSXNativeMouse */ + +#ifndef _Included_org_lwjgl_opengl_MacOSXNativeMouse +#define _Included_org_lwjgl_opengl_MacOSXNativeMouse +#ifdef __cplusplus +extern "C" { +#endif +#undef org_lwjgl_opengl_MacOSXNativeMouse_QUEUE_SIZE +#define org_lwjgl_opengl_MacOSXNativeMouse_QUEUE_SIZE 200L +#undef org_lwjgl_opengl_MacOSXNativeMouse_WHEEL_SCALE +#define org_lwjgl_opengl_MacOSXNativeMouse_WHEEL_SCALE 120L +#undef org_lwjgl_opengl_MacOSXNativeMouse_NUM_BUTTONS +#define org_lwjgl_opengl_MacOSXNativeMouse_NUM_BUTTONS 3L +/* + * Class: org_lwjgl_opengl_MacOSXNativeMouse + * Method: nSetCursorPosition + * Signature: (Ljava/nio/ByteBuffer;II)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXNativeMouse_nSetCursorPosition + (JNIEnv *, jobject, jobject, jint, jint); + +/* + * Class: org_lwjgl_opengl_MacOSXNativeMouse + * Method: nGrabMouse + * Signature: (Z)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXNativeMouse_nGrabMouse + (JNIEnv *, jclass, jboolean); + +/* + * Class: org_lwjgl_opengl_MacOSXNativeMouse + * Method: nRegisterMouseListener + * Signature: (Ljava/nio/ByteBuffer;)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXNativeMouse_nRegisterMouseListener + (JNIEnv *, jobject, jobject); + +/* + * Class: org_lwjgl_opengl_MacOSXNativeMouse + * Method: nUnregisterMouseListener + * Signature: (Ljava/nio/ByteBuffer;)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXNativeMouse_nUnregisterMouseListener + (JNIEnv *, jobject, jobject); + +/* + * Class: org_lwjgl_opengl_MacOSXNativeMouse + * Method: nCreateCursor + * Signature: (IIIIILjava/nio/IntBuffer;ILjava/nio/IntBuffer;I)J + */ +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_MacOSXNativeMouse_nCreateCursor + (JNIEnv *, jclass, jint, jint, jint, jint, jint, jobject, jint, jobject, jint); + +/* + * Class: org_lwjgl_opengl_MacOSXNativeMouse + * Method: nDestroyCursor + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXNativeMouse_nDestroyCursor + (JNIEnv *, jclass, jlong); + +/* + * Class: org_lwjgl_opengl_MacOSXNativeMouse + * Method: nSetCursor + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXNativeMouse_nSetCursor + (JNIEnv *, jclass, jlong); + +#ifdef __cplusplus +} +#endif +#endif diff -Nru lwjgl-2.7.1+dfsg/src/native/macosx/org_lwjgl_opengl_MacOSXNativeMouse.m lwjgl-2.9.3+dfsg/src/native/macosx/org_lwjgl_opengl_MacOSXNativeMouse.m --- lwjgl-2.7.1+dfsg/src/native/macosx/org_lwjgl_opengl_MacOSXNativeMouse.m 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/macosx/org_lwjgl_opengl_MacOSXNativeMouse.m 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,170 @@ +/* + * Copyright (c) 2002-2012 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * $Id: org_lwjgl_opengl_MacOSXNativeKeyboard.m 3055 2012-08-29 0:46:00Z mojang $ + * + * Mac OS X native keyboard functions. + * + * @author mojang + * @author kappaOne + * @version $Revision: 3055 $ + */ + +#import +#import +#import +#import +#import "common_tools.h" +#import "org_lwjgl_opengl_MacOSXNativeMouse.h" +#import "context.h" + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXNativeMouse_nGrabMouse(JNIEnv *env, jclass this, jboolean grab) { + CGAssociateMouseAndMouseCursorPosition(grab == JNI_TRUE ? FALSE : TRUE); + if (grab) { + CGDisplayHideCursor(kCGDirectMainDisplay); + } + else { + CGDisplayShowCursor(kCGDirectMainDisplay); + } +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXNativeMouse_nSetCursorPosition(JNIEnv *env, jclass this, jobject window_handle, jint x, jint y) { + MacOSXWindowInfo *window_info = (MacOSXWindowInfo *)(*env)->GetDirectBufferAddress(env, window_handle); + + CGPoint p; + + if (window_info->fullscreen) { + NSPoint point = NSMakePoint(x, y); + + // convert point to window/screen coordinates + point = [window_info->view convertPoint:point fromView:nil]; + + p.x = point.x; + p.y = point.y; + } + else { + NSRect screenRect = [[window_info->window screen] frame]; + NSRect viewRect = [window_info->view frame]; + NSRect winRect = [window_info->window frame]; + + // get window coords of the view origin + NSPoint viewPoint = [window_info->view convertPoint:viewRect.origin fromView:nil]; + + // convert y to screen coordinates, origin bottom left + p.y = winRect.origin.y + viewPoint.y + (viewRect.size.height - y - 1); + + p.x = winRect.origin.x + viewPoint.x + x; + // flip y coordinates (origin top left) to allow use with CGDisplayMoveCursorToPoint + p.y = screenRect.size.height - p.y - 1; + } + + CGDisplayMoveCursorToPoint(CGMainDisplayID(), p); +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXNativeMouse_nRegisterMouseListener(JNIEnv *env, jobject _this, jobject window_handle) { + MacOSXWindowInfo *window_info = (MacOSXWindowInfo *)(*env)->GetDirectBufferAddress(env, window_handle); + [window_info->window setAcceptsMouseMovedEvents:YES]; + window_info->jmouse = (*env)->NewGlobalRef(env, _this); + + // since initial mouse location is not reported until mouse is moved + // manually get the mouse location and report it with a fake event + NSPoint mouseLocation = [window_info->window mouseLocationOutsideOfEventStream]; + mouseLocation = [window_info->view convertPoint:mouseLocation fromView:nil]; + + NSEvent *mouseLocationEvent = [NSEvent + mouseEventWithType:NSMouseMoved + location:mouseLocation + modifierFlags:NSMouseMovedMask + timestamp:0 + windowNumber:[window_info->window windowNumber] + context:nil + eventNumber:0 + clickCount:0 + pressure:0]; + + [window_info->view mouseMoved:mouseLocationEvent]; +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXNativeMouse_nUnregisterMouseListener(JNIEnv *env, jobject this, jobject window_handle) { + MacOSXWindowInfo *window_info = (MacOSXWindowInfo *)(*env)->GetDirectBufferAddress(env, window_handle); + [window_info->window setAcceptsMouseMovedEvents:NO]; + window_info->jmouse = nil; +} + +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_MacOSXNativeMouse_nCreateCursor(JNIEnv *env, jobject _this, jint width, jint height, jint x_hotspot, jint y_hotspot, jint num_images, jobject image_buffer, jint images_offset, jobject delay_buffer, jint delays_offset) { + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + + jlong *bytes = (jint *)(*env)->GetDirectBufferAddress(env, image_buffer) + images_offset; + + NSBitmapImageRep *bitmap = [[[NSBitmapImageRep alloc] + initWithBitmapDataPlanes:NULL + pixelsWide:width pixelsHigh:height + bitsPerSample:8 + samplesPerPixel:4 + hasAlpha:YES + isPlanar:NO + colorSpaceName:NSDeviceRGBColorSpace + bitmapFormat:NSAlphaNonpremultipliedBitmapFormat + bytesPerRow:width*4 + bitsPerPixel:32] autorelease]; + memcpy((void*)bitmap.bitmapData, (void*)bytes, width*height*4); + + NSImage *image = [[[NSImage alloc] initWithSize:NSMakeSize(width, height)] autorelease]; + + [image addRepresentation:bitmap]; + + + NSCursor *cursor = [[NSCursor alloc] initWithImage:image hotSpot:NSMakePoint(x_hotspot, y_hotspot)]; + + [pool release]; + + return (jlong)cursor; +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXNativeMouse_nDestroyCursor(JNIEnv *env, jobject _this, jlong cursor_pointer) { + if (cursor_pointer != 0) { + NSCursor *cursor = (NSCursor *)cursor_pointer; + [cursor release]; + } +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXNativeMouse_nSetCursor(JNIEnv *env, jobject _this, jlong cursor_pointer) { + if (cursor_pointer == 0) { + // restore default cursor + [[NSCursor arrowCursor] performSelectorOnMainThread:@selector(set) withObject:nil waitUntilDone:NO]; + } + else { + NSCursor *cursor = (NSCursor *)cursor_pointer; + [cursor performSelectorOnMainThread:@selector(set) withObject:nil waitUntilDone:NO]; + } +} diff -Nru lwjgl-2.7.1+dfsg/src/native/macosx/org_lwjgl_opengl_MacOSXPbufferPeerInfo.h lwjgl-2.9.3+dfsg/src/native/macosx/org_lwjgl_opengl_MacOSXPbufferPeerInfo.h --- lwjgl-2.7.1+dfsg/src/native/macosx/org_lwjgl_opengl_MacOSXPbufferPeerInfo.h 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/macosx/org_lwjgl_opengl_MacOSXPbufferPeerInfo.h 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,29 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_lwjgl_opengl_MacOSXPbufferPeerInfo */ + +#ifndef _Included_org_lwjgl_opengl_MacOSXPbufferPeerInfo +#define _Included_org_lwjgl_opengl_MacOSXPbufferPeerInfo +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: org_lwjgl_opengl_MacOSXPbufferPeerInfo + * Method: nCreate + * Signature: (Ljava/nio/ByteBuffer;II)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXPbufferPeerInfo_nCreate + (JNIEnv *, jclass, jobject, jint, jint); + +/* + * Class: org_lwjgl_opengl_MacOSXPbufferPeerInfo + * Method: nDestroy + * Signature: (Ljava/nio/ByteBuffer;)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXPbufferPeerInfo_nDestroy + (JNIEnv *, jclass, jobject); + +#ifdef __cplusplus +} +#endif +#endif diff -Nru lwjgl-2.7.1+dfsg/src/native/macosx/org_lwjgl_opengl_MacOSXPbufferPeerInfo.m lwjgl-2.9.3+dfsg/src/native/macosx/org_lwjgl_opengl_MacOSXPbufferPeerInfo.m --- lwjgl-2.7.1+dfsg/src/native/macosx/org_lwjgl_opengl_MacOSXPbufferPeerInfo.m 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/macosx/org_lwjgl_opengl_MacOSXPbufferPeerInfo.m 2016-04-09 16:26:57.000000000 +0000 @@ -31,10 +31,10 @@ */ /** - * $Id: org_lwjgl_opengl_MacOSXPbufferPeerInfo.m 2985 2008-04-07 18:42:36Z matzon $ + * $Id$ * * @author elias_naur - * @version $Revision: 2985 $ + * @version $Revision$ */ #import @@ -65,7 +65,7 @@ } MacOSXPeerInfo *peer_info = (MacOSXPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); peer_info->pbuffer = pbuffer; - peer_info->window = false; + peer_info->isWindowed = false; [pool release]; } diff -Nru lwjgl-2.7.1+dfsg/src/native/macosx/org_lwjgl_opengl_MacOSXPeerInfo.h lwjgl-2.9.3+dfsg/src/native/macosx/org_lwjgl_opengl_MacOSXPeerInfo.h --- lwjgl-2.7.1+dfsg/src/native/macosx/org_lwjgl_opengl_MacOSXPeerInfo.h 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/macosx/org_lwjgl_opengl_MacOSXPeerInfo.h 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,37 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_lwjgl_opengl_MacOSXPeerInfo */ + +#ifndef _Included_org_lwjgl_opengl_MacOSXPeerInfo +#define _Included_org_lwjgl_opengl_MacOSXPeerInfo +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: org_lwjgl_opengl_MacOSXPeerInfo + * Method: createHandle + * Signature: ()Ljava/nio/ByteBuffer; + */ +JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_MacOSXPeerInfo_createHandle + (JNIEnv *, jclass); + +/* + * Class: org_lwjgl_opengl_MacOSXPeerInfo + * Method: nChoosePixelFormat + * Signature: (Ljava/nio/ByteBuffer;Lorg/lwjgl/opengl/PixelFormat;ZZZZZ)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXPeerInfo_nChoosePixelFormat + (JNIEnv *, jclass, jobject, jobject, jboolean, jboolean, jboolean, jboolean, jboolean); + +/* + * Class: org_lwjgl_opengl_MacOSXPeerInfo + * Method: nDestroy + * Signature: (Ljava/nio/ByteBuffer;)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXPeerInfo_nDestroy + (JNIEnv *, jclass, jobject); + +#ifdef __cplusplus +} +#endif +#endif diff -Nru lwjgl-2.7.1+dfsg/src/native/macosx/org_lwjgl_opengl_MacOSXPeerInfo.m lwjgl-2.9.3+dfsg/src/native/macosx/org_lwjgl_opengl_MacOSXPeerInfo.m --- lwjgl-2.7.1+dfsg/src/native/macosx/org_lwjgl_opengl_MacOSXPeerInfo.m 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/macosx/org_lwjgl_opengl_MacOSXPeerInfo.m 2016-04-09 16:26:57.000000000 +0000 @@ -1,40 +1,40 @@ -/* +/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are + * modification, are permitted provided that the following conditions are * met: - * - * * Redistributions of source code must retain the above copyright + * + * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * * Neither the name of 'LWJGL' nor the names of - * its contributors may be used to endorse or promote products derived + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /** - * $Id: org_lwjgl_opengl_MacOSXPeerInfo.m 2985 2008-04-07 18:42:36Z matzon $ + * $Id$ * * @author elias_naur - * @version $Revision: 2985 $ + * @version $Revision$ */ #import @@ -52,10 +52,10 @@ } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXPeerInfo_nChoosePixelFormat - (JNIEnv *env, jclass clazz, jobject peer_info_handle, jobject pixel_format, jboolean use_display_bpp, jboolean support_window, jboolean support_pbuffer, jboolean double_buffered) { + (JNIEnv *env, jclass clazz, jobject peer_info_handle, jobject pixel_format, jboolean gl32, jboolean use_display_bpp, jboolean support_window, jboolean support_pbuffer, jboolean double_buffered) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; MacOSXPeerInfo *peer_info = (MacOSXPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); - NSOpenGLPixelFormat *macosx_pixel_format = choosePixelFormat(env, pixel_format, use_display_bpp, support_window, support_pbuffer, double_buffered); + NSOpenGLPixelFormat *macosx_pixel_format = choosePixelFormat(env, pixel_format, gl32, use_display_bpp, support_window, support_pbuffer, double_buffered); if (pixel_format == nil) { throwException(env, "Could not find pixel format"); return; diff -Nru lwjgl-2.7.1+dfsg/src/native/windows/context.c lwjgl-2.9.3+dfsg/src/native/windows/context.c --- lwjgl-2.7.1+dfsg/src/native/windows/context.c 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/windows/context.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,499 +0,0 @@ -/* - * Copyright (c) 2002-2008 LWJGL Project - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of 'LWJGL' nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/** - * $Id: context.c 3377 2010-07-12 12:04:56Z matzon $ - * - * @author elias_naue - * @version $Revision: 3377 $ - */ - -#include -#include -#include "common_tools.h" -#include "extgl.h" -#include "extgl_wgl.h" -#include "context.h" - -extern HINSTANCE dll_handle; // Handle to the LWJGL dll - -#define _CONTEXT_PRIVATE_CLASS_NAME "__lwjgl_context_class_name" - -/* - * Register the LWJGL window class. - * Returns true for success, or false for failure - */ -bool registerWindow(WNDPROC win_proc, LPCTSTR class_name) -{ - WNDCLASS windowClass; - memset(&windowClass, 0, sizeof(windowClass)); - windowClass.style = CS_OWNDC; - windowClass.lpfnWndProc = win_proc; - windowClass.cbClsExtra = 0; - windowClass.cbWndExtra = 0; - windowClass.hInstance = dll_handle; - windowClass.hIcon = LoadIcon(NULL, IDI_APPLICATION); - windowClass.hCursor = LoadCursor(NULL, IDC_ARROW); - windowClass.hbrBackground = NULL; - windowClass.lpszMenuName = NULL; - windowClass.lpszClassName = class_name; - - if (RegisterClass(&windowClass) == 0) { - printfDebug("Failed to register window class\n"); - return false; - } - return true; -} - -static LRESULT CALLBACK dummyWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { - return DefWindowProc(hwnd, msg, wParam, lParam); -} - -bool applyPixelFormat(JNIEnv *env, HDC hdc, int iPixelFormat) { - PIXELFORMATDESCRIPTOR desc; - if (DescribePixelFormat(hdc, iPixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &desc) == 0) { - throwFormattedException(env, "DescribePixelFormat failed (%d)", GetLastError()); - return false; - } - - // make that the pixel format of the device context - if (SetPixelFormat(hdc, iPixelFormat, &desc) == FALSE) { - throwFormattedException(env, "SetPixelFormat failed (%d)", GetLastError()); - return false; - } - return true; -} - -/* - * Close the window - */ -void closeWindow(HWND *hwnd, HDC *hdc) -{ - // Release device context - if (*hdc != NULL && *hwnd != NULL) { - ReleaseDC(*hwnd, *hdc); - *hdc = NULL; - } - - // Close the window - if (*hwnd != NULL) { - ShowWindow(*hwnd, SW_HIDE); - DestroyWindow(*hwnd); - *hwnd = NULL; - } -} - -void getWindowFlags(DWORD *windowflags_return, DWORD *exstyle_return, bool undecorated, bool child_window) { - DWORD exstyle, windowflags; - if (undecorated) { - exstyle = WS_EX_APPWINDOW; - windowflags = WS_POPUP; - } else if (child_window) { - exstyle = 0; - windowflags = WS_CHILDWINDOW; - } else { - exstyle = WS_EX_APPWINDOW; - windowflags = WS_OVERLAPPED | WS_BORDER | WS_CAPTION | WS_MINIMIZEBOX | WS_SYSMENU; - } - windowflags = windowflags | WS_CLIPCHILDREN | WS_CLIPSIBLINGS; - *windowflags_return = windowflags; - *exstyle_return = exstyle; -} - -HWND createWindow(LPCTSTR window_class_name, int x, int y, int width, int height, bool undecorated, bool child_window, HWND parent) -{ - RECT clientSize; - DWORD exstyle, windowflags; - HWND new_hwnd; - - getWindowFlags(&windowflags, &exstyle, undecorated, child_window); - - clientSize.bottom = height; - clientSize.left = 0; - clientSize.right = width; - clientSize.top = 0; - - AdjustWindowRectEx( - &clientSize, // client-rectangle structure - windowflags, // window styles - FALSE, // menu-present option - exstyle // extended window style - ); - // Create the window now, using that class: - new_hwnd = CreateWindowEx ( - exstyle, - window_class_name, - "", - windowflags, - x, y, clientSize.right - clientSize.left, clientSize.bottom - clientSize.top, - parent, - NULL, - dll_handle, - NULL); - - return new_hwnd; -} - -static int convertToBPE(int bpp) { - int bpe; - switch (bpp) { - case 0: - bpe = 0; - break; - case 32: - case 24: - bpe = 8; - break; - case 16: /* Fall through */ - default: - bpe = 4; - break; - } - return bpe; -} - -static int findPixelFormatARBFromBPP(JNIEnv *env, HDC hdc, WGLExtensions *extensions, jobject pixel_format, jobject pixelFormatCaps, int bpp, bool window, bool pbuffer, bool double_buffer) { - jclass cls_pixel_format = (*env)->GetObjectClass(env, pixel_format); - int alpha = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "alpha", "I")); - int depth = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "depth", "I")); - int stencil = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "stencil", "I")); - int samples = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "samples", "I")); - int colorSamples = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "colorSamples", "I")); - int num_aux_buffers = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "num_aux_buffers", "I")); - int accum_bpp = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "accum_bpp", "I")); - int accum_alpha = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "accum_alpha", "I")); - - jboolean stereo = (*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "stereo", "Z")); - jboolean floating_point = (*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "floating_point", "Z")); - jboolean floating_point_packed = (*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "floating_point_packed", "Z")); - jboolean sRGB = (*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "sRGB", "Z")); - - int pixel_type; - int iPixelFormat; - unsigned int num_formats_returned; - attrib_list_t attrib_list; - GLuint *pixelFormatCaps_ptr; - jlong pixelFormatCapsSize; - BOOL result; - jlong i; - int bpe = convertToBPE(bpp); - - if ( floating_point ) - pixel_type = WGL_TYPE_RGBA_FLOAT_ARB; - else if ( floating_point_packed ) - pixel_type = WGL_TYPE_RGBA_UNSIGNED_FLOAT_EXT; - else - pixel_type = WGL_TYPE_RGBA_ARB; - - initAttribList(&attrib_list); - if (window) { - putAttrib(&attrib_list, WGL_DRAW_TO_WINDOW_ARB); putAttrib(&attrib_list, TRUE); - } - if (pbuffer) { - putAttrib(&attrib_list, WGL_DRAW_TO_PBUFFER_ARB); putAttrib(&attrib_list, TRUE); - } - if (!getBooleanProperty(env, "org.lwjgl.opengl.Display.allowSoftwareOpenGL")) { - putAttrib(&attrib_list, WGL_ACCELERATION_ARB); putAttrib(&attrib_list, WGL_FULL_ACCELERATION_ARB); - } - putAttrib(&attrib_list, WGL_PIXEL_TYPE_ARB); putAttrib(&attrib_list, pixel_type); - putAttrib(&attrib_list, WGL_DOUBLE_BUFFER_ARB); putAttrib(&attrib_list, double_buffer ? TRUE : FALSE); - putAttrib(&attrib_list, WGL_SUPPORT_OPENGL_ARB); putAttrib(&attrib_list, TRUE); - putAttrib(&attrib_list, WGL_RED_BITS_ARB); putAttrib(&attrib_list, bpe); - putAttrib(&attrib_list, WGL_GREEN_BITS_ARB); putAttrib(&attrib_list, bpe); - putAttrib(&attrib_list, WGL_BLUE_BITS_ARB); putAttrib(&attrib_list, bpe); - putAttrib(&attrib_list, WGL_ALPHA_BITS_ARB); putAttrib(&attrib_list, alpha); - putAttrib(&attrib_list, WGL_DEPTH_BITS_ARB); putAttrib(&attrib_list, depth); - putAttrib(&attrib_list, WGL_STENCIL_BITS_ARB); putAttrib(&attrib_list, stencil); - // Assume caller checked extension availability - if (samples > 0) { - putAttrib(&attrib_list, WGL_SAMPLE_BUFFERS_ARB); putAttrib(&attrib_list, 1); - putAttrib(&attrib_list, WGL_SAMPLES_ARB); putAttrib(&attrib_list, samples); // WGL_COVERAGE_SAMPLES_NV if colorSamples > 0 - if ( colorSamples > 0 ) { - putAttrib(&attrib_list, WGL_COLOR_SAMPLES_NV); putAttrib(&attrib_list, colorSamples); - } - } - putAttrib(&attrib_list, WGL_ACCUM_BITS_ARB); putAttrib(&attrib_list, accum_bpp); - putAttrib(&attrib_list, WGL_ACCUM_ALPHA_BITS_ARB); putAttrib(&attrib_list, accum_alpha); - putAttrib(&attrib_list, WGL_STEREO_ARB); putAttrib(&attrib_list, stereo ? TRUE : FALSE); - putAttrib(&attrib_list, WGL_AUX_BUFFERS_ARB); putAttrib(&attrib_list, num_aux_buffers); - if (sRGB) { - putAttrib(&attrib_list, WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB); putAttrib(&attrib_list, TRUE); - } - - // Assume caller checked extension availability - if (pixelFormatCaps != NULL) { - pixelFormatCaps_ptr = (GLuint *)(*env)->GetDirectBufferAddress(env, pixelFormatCaps); - pixelFormatCapsSize = (*env)->GetDirectBufferCapacity(env, pixelFormatCaps); - - for (i = 0; i < pixelFormatCapsSize; i++) - putAttrib(&attrib_list, pixelFormatCaps_ptr[i]); - } - putAttrib(&attrib_list, 0); putAttrib(&attrib_list, 0); - result = extensions->wglChoosePixelFormatARB(hdc, attrib_list.attribs, NULL, 1, &iPixelFormat, &num_formats_returned); - - if (result == FALSE || num_formats_returned < 1) { - throwFormattedException(env, "Failed to find ARB pixel format %d %d\n", result, num_formats_returned); - return -1; - } - return iPixelFormat; -} - -static int findPixelFormatARB(JNIEnv *env, HDC hdc, WGLExtensions *extensions, jobject pixel_format, jobject pixelFormatCaps, bool use_hdc_bpp, bool window, bool pbuffer, bool double_buffer) { - int bpp; - int iPixelFormat; - int fallback_bpp = 16; - jclass cls_pixel_format = (*env)->GetObjectClass(env, pixel_format); - if (use_hdc_bpp) { - bpp = GetDeviceCaps(hdc, BITSPIXEL); - iPixelFormat = findPixelFormatARBFromBPP(env, hdc, extensions, pixel_format, pixelFormatCaps, bpp, window, pbuffer, double_buffer); - if ((*env)->ExceptionOccurred(env)) { - (*env)->ExceptionClear(env); - printfDebugJava(env, "Failed to find ARB pixel format with HDC depth %d, falling back to %d\n", bpp, fallback_bpp); - bpp = fallback_bpp; - } else - return iPixelFormat; - } else - bpp = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "bpp", "I")); - return findPixelFormatARBFromBPP(env, hdc, extensions, pixel_format, pixelFormatCaps, bpp, window, pbuffer, double_buffer); -} - -/* - * Find an appropriate pixel format - */ -static int findPixelFormatFromBPP(JNIEnv *env, HDC hdc, jobject pixel_format, int bpp, bool double_buffer) -{ - jclass cls_pixel_format = (*env)->GetObjectClass(env, pixel_format); - int alpha = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "alpha", "I")); - int depth = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "depth", "I")); - int stencil = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "stencil", "I")); - int num_aux_buffers = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "num_aux_buffers", "I")); - int accum_bpp = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "accum_bpp", "I")); - int accum_alpha = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "accum_alpha", "I")); - jboolean stereo = (*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "stereo", "Z")); - unsigned int flags = PFD_DRAW_TO_WINDOW | // support window - PFD_SUPPORT_OPENGL | - (double_buffer ? PFD_DOUBLEBUFFER : 0) | - (stereo ? PFD_STEREO : 0); - PIXELFORMATDESCRIPTOR desc; - int iPixelFormat; - PIXELFORMATDESCRIPTOR pfd = { - sizeof(PIXELFORMATDESCRIPTOR), // size of this pfd - 1, // version number - flags, // RGBA type - PFD_TYPE_RGBA, - (BYTE)bpp, - 0, 0, 0, 0, 0, 0, // color bits ignored - (BYTE)alpha, - 0, // shift bit ignored - accum_bpp + accum_alpha, // no accumulation buffer - 0, 0, 0, 0, // accum bits ignored - (BYTE)depth, - (BYTE)stencil, - num_aux_buffers, - PFD_MAIN_PLANE, // main layer - 0, // reserved - 0, 0, 0 // layer masks ignored - }; - // get the best available match of pixel format for the device context - iPixelFormat = ChoosePixelFormat(hdc, &pfd); - if (iPixelFormat == 0) { - throwException(env, "Failed to choose pixel format"); - return -1; - } - - if (DescribePixelFormat(hdc, iPixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &desc) == 0) { - throwException(env, "Could not describe pixel format"); - return -1; - } - - if (desc.cColorBits < bpp) { - throwException(env, "Insufficient color precision"); - return -1; - } - - if (desc.cAlphaBits < alpha) { - throwException(env, "Insufficient alpha precision"); - return -1; - } - - if (desc.cStencilBits < stencil) { - throwException(env, "Insufficient stencil precision"); - return -1; - } - - if (desc.cDepthBits < depth) { - throwException(env, "Insufficient depth buffer precision"); - return -1; - } - - if ((desc.dwFlags & PFD_GENERIC_FORMAT) != 0) { - jboolean allowSoftwareOpenGL = getBooleanProperty(env, "org.lwjgl.opengl.Display.allowSoftwareOpenGL"); - // secondary check for software override - if(!allowSoftwareOpenGL) { - throwException(env, "Pixel format not accelerated"); - return -1; - } - } - - if ((desc.dwFlags & flags) != flags) { - throwException(env, "Capabilities not supported"); - return -1; - } - return iPixelFormat; -} - -static int findPixelFormatDefault(JNIEnv *env, HDC hdc, jobject pixel_format, bool use_hdc_bpp, bool double_buffer) { - int bpp; - int iPixelFormat; - int fallback_bpp = 16; - jclass cls_pixel_format = (*env)->GetObjectClass(env, pixel_format); - if (use_hdc_bpp) { - bpp = GetDeviceCaps(hdc, BITSPIXEL); - iPixelFormat = findPixelFormatFromBPP(env, hdc, pixel_format, bpp, double_buffer); - if ((*env)->ExceptionOccurred(env)) { - (*env)->ExceptionClear(env); - printfDebugJava(env, "Failed to find pixel format with HDC depth %d, falling back to %d\n", bpp, fallback_bpp); - bpp = fallback_bpp; - } else - return iPixelFormat; - } else - bpp = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "bpp", "I")); - return findPixelFormatFromBPP(env, hdc, pixel_format, bpp, double_buffer); -} - -static bool validateAndGetExtensions(JNIEnv *env, WGLExtensions *extensions, HDC dummy_hdc, HGLRC dummy_hglrc, int samples, int colorSamples, bool floating_point, bool floating_point_packed, bool sRGB, jobject pixelFormatCaps) { - if (!wglMakeCurrent(dummy_hdc, dummy_hglrc)) { - throwException(env, "Could not bind context to dummy window"); - return false; - } - extgl_InitWGL(extensions); - - if (!extensions->WGL_ARB_pixel_format) { - throwException(env, "No support for WGL_ARB_pixel_format"); - return false; - } - if (samples > 0 && !extensions->WGL_ARB_multisample) { - throwException(env, "No support for WGL_ARB_multisample"); - return false; - } - if (colorSamples > 0 && !extensions->WGL_NV_multisample_coverage) { - throwException(env, "No support for WGL_NV_multisample_coverage"); - return false; - } - /* - * Apparently, some drivers don't report WGL_ARB_pixel_format_float - * even though GL_ARB_color_buffer_float and WGL_ATI_color_format_float - * is supported. - */ - if (floating_point && !(extensions->WGL_ARB_pixel_format_float || extensions->WGL_ATI_pixel_format_float)) { - throwException(env, "No support for WGL_ARB_pixel_format_float nor WGL_ATI_pixel_format_float"); - return false; - } - if (floating_point_packed && !(extensions->WGL_EXT_pixel_format_packed_float)) { - throwException(env, "No support for WGL_EXT_pixel_format_packed_float"); - return false; - } - if (sRGB && !(extensions->WGL_ARB_framebuffer_sRGB)) { - throwException(env, "No support for WGL_ARB_framebuffer_sRGB"); - return false; - } - if (pixelFormatCaps != NULL && !extensions->WGL_ARB_render_texture) { - throwException(env, "No support for WGL_ARB_render_texture"); - return false; - } - return true; -} - -int findPixelFormatOnDC(JNIEnv *env, HDC hdc, int origin_x, int origin_y, jobject pixel_format, jobject pixelFormatCaps, bool use_hdc_bpp, bool window, bool pbuffer, bool double_buffer) { - HGLRC dummy_hglrc; - HDC saved_current_hdc; - HGLRC saved_current_hglrc; - WGLExtensions extensions; - HWND dummy_hwnd; - HDC dummy_hdc; - int pixel_format_id; - jclass cls_pixel_format = (*env)->GetObjectClass(env, pixel_format); - - int samples = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "samples", "I")); - int colorSamples = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "colorSamples", "I")); - bool floating_point = (bool)(*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "floating_point", "Z")); - bool floating_point_packed = (bool)(*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "floating_point_packed", "Z")); - bool sRGB = (bool)(*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "sRGB", "Z")); - bool use_arb_selection = samples > 0 || floating_point || floating_point_packed || sRGB || pbuffer || pixelFormatCaps != NULL; - - pixel_format_id = findPixelFormatDefault(env, hdc, pixel_format, use_hdc_bpp, double_buffer); - if (!(*env)->ExceptionOccurred(env) && use_arb_selection) { - dummy_hwnd = createDummyWindow(origin_x, origin_y); - if (dummy_hwnd == NULL) { - throwException(env, "Could not create dummy window"); - return -1; - } - dummy_hdc = GetDC(dummy_hwnd); - if (!applyPixelFormat(env, dummy_hdc, pixel_format_id)) { - closeWindow(&dummy_hwnd, &dummy_hdc); - return -1; - } - dummy_hglrc = wglCreateContext(dummy_hdc); - if (dummy_hglrc == NULL) { - closeWindow(&dummy_hwnd, &dummy_hdc); - throwException(env, "Failed to create OpenGL rendering context"); - return -1; - } - // Save the current HDC and HGLRC to avoid disruption - saved_current_hdc = wglGetCurrentDC(); - saved_current_hglrc = wglGetCurrentContext(); - if (validateAndGetExtensions(env, &extensions, dummy_hdc, dummy_hglrc, samples, colorSamples, floating_point, floating_point_packed, sRGB, pixelFormatCaps)) { - pixel_format_id = findPixelFormatARB(env, hdc, &extensions, pixel_format, pixelFormatCaps, use_hdc_bpp, window, pbuffer, double_buffer); - } - wglMakeCurrent(saved_current_hdc, saved_current_hglrc); - wglDeleteContext(dummy_hglrc); - closeWindow(&dummy_hwnd, &dummy_hdc); - } - return pixel_format_id; -} - -static bool registerDummyWindow() { - static bool window_registered = false; - if (!window_registered) { - if (!registerWindow(dummyWindowProc, _CONTEXT_PRIVATE_CLASS_NAME)) { - return false; - } - window_registered = true; - } - return true; -} - -HWND createDummyWindow(int origin_x, int origin_y) { - if (!registerDummyWindow()) - return NULL; - return createWindow(_CONTEXT_PRIVATE_CLASS_NAME, origin_x, origin_y, 1, 1, false, false, NULL); -} diff -Nru lwjgl-2.7.1+dfsg/src/native/windows/context.h lwjgl-2.9.3+dfsg/src/native/windows/context.h --- lwjgl-2.7.1+dfsg/src/native/windows/context.h 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/windows/context.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,96 +0,0 @@ -/* - * Copyright (c) 2002-2008 LWJGL Project - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of 'LWJGL' nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/** - * $Id: context.h 3139 2008-10-28 09:53:16Z elias_naur $ - * - * @author elias_naur - * @version $Revision: 3139 $ - */ - -#ifndef __LWJGL_CONTEXT_H -#define __LWJGL_CONTEXT_H - -#include -#include -#include "common_tools.h" -#include "extgl.h" -#include "extgl_wgl.h" - -typedef struct { - union { - HWND hwnd; - struct { - HPBUFFERARB pbuffer; - // Contains the function pointers that - // created the pbuffer - WGLExtensions extensions; - } pbuffer; - } u; - HDC drawable_hdc; -} WindowsPeerInfo; - -/* - * Register the LWJGL window class. - * Returns true for success, or false for failure - */ -extern bool registerWindow(); - -extern bool applyPixelFormat(JNIEnv *env, HDC hdc, int iPixelFormat); - -/* - * Close the window - */ -extern void closeWindow(HWND *hwnd, HDC *hdc); - -/** - * Create a dummy window suitable to create contexts from - */ -extern HWND createDummyWindow(int x, int y); - -/** - * Return appropriate window and extended style flags from the given fullscreen and undecorated property - */ -extern void getWindowFlags(DWORD *windowflags_return, DWORD *exstyle_return, bool undecorated, bool child_window); - -/* - * Create a window with the specified position, size, and - * fullscreen attribute. The window will have DirectInput associated - * with it. - * - * Returns true for success, or false for failure - */ -extern HWND createWindow(LPCTSTR window_class_name, int x, int y, int width, int height, bool undecorated, bool child_window, HWND parent); - -extern int findPixelFormatOnDC(JNIEnv *env, HDC hdc, int origin_x, int origin_y, jobject pixel_format, jobject pixelFormatCaps, bool use_hdc_bpp, bool window, bool pbuffer, bool double_buffer); - -#endif diff -Nru lwjgl-2.7.1+dfsg/src/native/windows/display.c lwjgl-2.9.3+dfsg/src/native/windows/display.c --- lwjgl-2.7.1+dfsg/src/native/windows/display.c 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/windows/display.c 2016-04-09 16:26:57.000000000 +0000 @@ -31,12 +31,12 @@ */ /** - * $Id: display.c 2985 2008-04-07 18:42:36Z matzon $ + * $Id$ * * Windows specific library for display handling. * * @author cix_foo - * @version $Revision: 2985 $ + * @version $Revision$ */ #include @@ -95,7 +95,7 @@ while(EnumDisplaySettings((const char *) DisplayDevice.DeviceName, j++, &DevMode) != 0) {*/ while(EnumDisplaySettings(NULL, j++, &DevMode) != 0) { // Filter out indexed modes - if (DevMode.dmBitsPerPel > 8 && ChangeDisplaySettings(&DevMode, CDS_FULLSCREEN | CDS_TEST) == DISP_CHANGE_SUCCESSFUL) { + if (DevMode.dmBitsPerPel > 8) { jobject displayMode; if (list_size <= n) { list_size += 1; @@ -203,7 +203,7 @@ float scaledRampEntry; WORD rampEntry; const float *gammaRamp = (const float *)(*env)->GetDirectBufferAddress(env, float_gamma_obj); - jint gamma_ramp_length = (*env)->GetDirectBufferCapacity(env, float_gamma_obj); + jint gamma_ramp_length = (jint)(*env)->GetDirectBufferCapacity(env, float_gamma_obj); jobject native_ramp; WORD *native_ramp_buffer; diff -Nru lwjgl-2.7.1+dfsg/src/native/windows/display.h lwjgl-2.9.3+dfsg/src/native/windows/display.h --- lwjgl-2.7.1+dfsg/src/native/windows/display.h 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/windows/display.h 2016-04-09 16:26:57.000000000 +0000 @@ -31,12 +31,12 @@ */ /** - * $Id: display.h 2985 2008-04-07 18:42:36Z matzon $ + * $Id$ * * Windows specific library for display handling. * * @author cix_foo - * @version $Revision: 2985 $ + * @version $Revision$ */ #ifndef _DISPLAY_H diff -Nru lwjgl-2.7.1+dfsg/src/native/windows/extgl_wgl.c lwjgl-2.9.3+dfsg/src/native/windows/extgl_wgl.c --- lwjgl-2.7.1+dfsg/src/native/windows/extgl_wgl.c 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/windows/extgl_wgl.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,184 +0,0 @@ -/* ---------------------------------------------------------------------------- -Copyright (c) 2001-2002, Lev Povalahev -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * The name of the author may be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, -INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, -OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF -THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------*/ -/* - Lev Povalahev - - levp@gmx.net - - http://www.uni-karlsruhe.de/~uli2/ - -*/ - -#include -#include -#include "extgl_wgl.h" -#include "extgl.h" - -static HMODULE lib_gl_handle = NULL; - -void *extgl_GetProcAddress(const char *name) { - void *t = wglGetProcAddress(name); - if (t == NULL) - { - t = GetProcAddress(lib_gl_handle, name); - if (t == NULL) - { - printfDebug("Could not locate symbol %s\n", name); - } - } - return t; -} - -bool extgl_Open(JNIEnv *env) { - if (lib_gl_handle != NULL) - return true; - // load the dynamic libraries for OpenGL - lib_gl_handle = LoadLibrary("opengl32.dll"); - if (lib_gl_handle == NULL) { - throwException(env, "Could not load OpenGL library"); - return false; - } - return true; -} - -void extgl_Close(void) { - FreeLibrary(lib_gl_handle); - lib_gl_handle = NULL; -} - -/** returns true if the extension is available */ -static bool WGLQueryExtension(WGLExtensions *extensions, const char *name) { - const GLubyte *extension_string; - - if (!extensions->WGL_ARB_extensions_string) - if (!extensions->WGL_EXT_extensions_string) - return false; - else - extension_string = (GLubyte*)extensions->wglGetExtensionsStringEXT(); - else - extension_string = (GLubyte*)extensions->wglGetExtensionsStringARB(wglGetCurrentDC()); - return extgl_QueryExtension(extension_string, name); -} - -static void extgl_InitWGLARBPbuffer(WGLExtensions *extensions) { - ExtFunction functions[] = { - {"wglCreatePbufferARB", (void *)&extensions->wglCreatePbufferARB}, - {"wglGetPbufferDCARB", (void *)&extensions->wglGetPbufferDCARB}, - {"wglReleasePbufferDCARB", (void *)&extensions->wglReleasePbufferDCARB}, - {"wglDestroyPbufferARB", (void *)&extensions->wglDestroyPbufferARB}, - {"wglQueryPbufferARB", (void *)&extensions->wglQueryPbufferARB}}; - if (extensions->WGL_ARB_pbuffer) - extensions->WGL_ARB_pbuffer = extgl_InitializeFunctions(sizeof(functions)/sizeof(ExtFunction), functions); -} - -static void extgl_InitWGLARBPixelFormat(WGLExtensions *extensions) { - ExtFunction functions[] = { - {"wglGetPixelFormatAttribivARB", (void *)&extensions->wglGetPixelFormatAttribivARB}, - {"wglGetPixelFormatAttribfvARB", (void *)&extensions->wglGetPixelFormatAttribfvARB}, - {"wglChoosePixelFormatARB", (void *)&extensions->wglChoosePixelFormatARB}}; - if (extensions->WGL_ARB_pixel_format) - extensions->WGL_ARB_pixel_format = extgl_InitializeFunctions(sizeof(functions)/sizeof(ExtFunction), functions); -} - -static void extgl_InitWGLARBRenderTexture(WGLExtensions *extensions) { - ExtFunction functions[] = { - {"wglBindTexImageARB", (void *)&extensions->wglBindTexImageARB}, - {"wglReleaseTexImageARB", (void *)&extensions->wglReleaseTexImageARB}, - {"wglSetPbufferAttribARB", (void *)&extensions->wglSetPbufferAttribARB}}; - if (extensions->WGL_ARB_render_texture) - extensions->WGL_ARB_render_texture = extgl_InitializeFunctions(sizeof(functions)/sizeof(ExtFunction), functions); -} - -static void extgl_InitWGLEXTSwapControl(WGLExtensions *extensions) { - ExtFunction functions[] = { - {"wglSwapIntervalEXT", (void *)&extensions->wglSwapIntervalEXT}, - {"wglGetSwapIntervalEXT", (void *)&extensions->wglGetSwapIntervalEXT}}; - if (extensions->WGL_EXT_swap_control) - extensions->WGL_EXT_swap_control = extgl_InitializeFunctions(sizeof(functions)/sizeof(ExtFunction), functions); -} - -static void extgl_InitWGLARBMakeCurrentRead(WGLExtensions *extensions) { - ExtFunction functions[] = { - {"wglMakeContextCurrentARB", (void *)&extensions->wglMakeContextCurrentARB}, - {"wglGetCurrentReadDCARB", (void *)&extensions->wglGetCurrentReadDCARB}}; - if (extensions->WGL_ARB_make_current_read) - extensions->WGL_ARB_make_current_read = extgl_InitializeFunctions(sizeof(functions)/sizeof(ExtFunction), functions); -} - -static void extgl_InitWGLARBCreateContext(WGLExtensions *extensions) { - ExtFunction functions[] = { - {"wglCreateContextAttribsARB", (void *)&extensions->wglCreateContextAttribsARB} - }; - if (extensions->WGL_ARB_create_context) - extensions->WGL_ARB_create_context = extgl_InitializeFunctions(sizeof(functions)/sizeof(ExtFunction), functions); -} - -static void extgl_InitSupportedWGLExtensions(WGLExtensions *extensions) { - extensions->WGL_ARB_buffer_region = WGLQueryExtension(extensions, "WGL_ARB_buffer_region"); - extensions->WGL_ARB_make_current_read = WGLQueryExtension(extensions, "WGL_ARB_make_current_read"); - extensions->WGL_ARB_multisample = WGLQueryExtension(extensions, "WGL_ARB_multisample"); - extensions->WGL_ARB_pixel_format_float = WGLQueryExtension(extensions, "WGL_ARB_pixel_format_float"); - extensions->WGL_ATI_pixel_format_float = WGLQueryExtension(extensions, "WGL_ATI_pixel_format_float"); - extensions->WGL_ARB_pbuffer = WGLQueryExtension(extensions, "WGL_ARB_pbuffer"); - extensions->WGL_ARB_pixel_format = WGLQueryExtension(extensions, "WGL_ARB_pixel_format"); - extensions->WGL_ARB_render_texture = WGLQueryExtension(extensions, "WGL_ARB_render_texture"); - extensions->WGL_EXT_swap_control = WGLQueryExtension(extensions, "WGL_EXT_swap_control"); - extensions->WGL_NV_render_depth_texture = WGLQueryExtension(extensions, "WGL_NV_render_depth_texture"); - extensions->WGL_NV_render_texture_rectangle = WGLQueryExtension(extensions, "WGL_NV_render_texture_rectangle"); - extensions->WGL_ARB_framebuffer_sRGB = WGLQueryExtension(extensions, "WGL_ARB_framebuffer_sRGB") || WGLQueryExtension(extensions, "WGL_EXT_framebuffer_sRGB"); - extensions->WGL_EXT_pixel_format_packed_float = WGLQueryExtension(extensions, "WGL_EXT_pixel_format_packed_float"); - extensions->WGL_ARB_create_context = WGLQueryExtension(extensions, "WGL_ARB_create_context"); - extensions->WGL_NV_multisample_coverage = WGLQueryExtension(extensions, "WGL_NV_multisample_coverage"); -} - -static void extgl_InitWGLEXTExtensionsString(WGLExtensions *extensions) { - ExtFunction functions[] = { - {"wglGetExtensionsStringEXT", (void *)&extensions->wglGetExtensionsStringEXT} - }; - extensions->WGL_EXT_extensions_string = extgl_InitializeFunctions(sizeof(functions)/sizeof(ExtFunction), functions); -} - -static void extgl_InitWGLARBExtensionsString(WGLExtensions *extensions) { - ExtFunction functions[] = { - {"wglGetExtensionsStringARB", (void *)&extensions->wglGetExtensionsStringARB} - }; - extensions->WGL_ARB_extensions_string = extgl_InitializeFunctions(sizeof(functions)/sizeof(ExtFunction), functions); -} - -void extgl_InitWGL(WGLExtensions *extensions) { - extgl_InitWGLARBExtensionsString(extensions); - extgl_InitWGLEXTExtensionsString(extensions); - - extgl_InitSupportedWGLExtensions(extensions); - - extgl_InitWGLARBMakeCurrentRead(extensions); - extgl_InitWGLEXTSwapControl(extensions); - extgl_InitWGLARBRenderTexture(extensions); - extgl_InitWGLARBPixelFormat(extensions); - extgl_InitWGLARBPbuffer(extensions); - extgl_InitWGLARBCreateContext(extensions); -} diff -Nru lwjgl-2.7.1+dfsg/src/native/windows/extgl_wgl.h lwjgl-2.9.3+dfsg/src/native/windows/extgl_wgl.h --- lwjgl-2.7.1+dfsg/src/native/windows/extgl_wgl.h 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/windows/extgl_wgl.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,261 +0,0 @@ -/* ---------------------------------------------------------------------------- -Copyright (c) 2001-2002, Lev Povalahev -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * The name of the author may be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, -INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, -OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF -THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------*/ -/* - Lev Povalahev - - levp@gmx.net - - http://www.uni-karlsruhe.de/~uli2/ - -*/ - -#ifndef _EXTGL_WGL_H -#define _EXTGL_WGL_H - -#include -#include "extgl.h" -#include "common_tools.h" - -/*-------------------------------------------------------------------*/ -/*------------WGL_EXT_EXTENSION_STRING-------------------------------*/ -/*-------------------------------------------------------------------*/ - -typedef const char* (APIENTRY * wglGetExtensionsStringEXTPROC) (); - -/*-------------------------------------------------------------------*/ -/*------------WGL_ARB_EXTENSION_STRING-------------------------------*/ -/*-------------------------------------------------------------------*/ - -typedef const char* (APIENTRY * wglGetExtensionsStringARBPROC) (HDC hdc); - -/*-------------------------------------------------------------------*/ -/*------------WGL_ARB_PBUFFER----------------------------------------*/ -/*-------------------------------------------------------------------*/ - -#define WGL_DRAW_TO_PBUFFER_ARB 0x202D -#define WGL_DRAW_TO_PBUFFER_ARB 0x202D -#define WGL_MAX_PBUFFER_PIXELS_ARB 0x202E -#define WGL_MAX_PBUFFER_WIDTH_ARB 0x202F -#define WGL_MAX_PBUFFER_HEIGHT_ARB 0x2030 -#define WGL_PBUFFER_LARGEST_ARB 0x2033 -#define WGL_PBUFFER_WIDTH_ARB 0x2034 -#define WGL_PBUFFER_HEIGHT_ARB 0x2035 -#define WGL_PBUFFER_LOST_ARB 0x2036 - -DECLARE_HANDLE(HPBUFFERARB); - -typedef HPBUFFERARB (APIENTRY * wglCreatePbufferARBPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList); -typedef HDC (APIENTRY * wglGetPbufferDCARBPROC) (HPBUFFERARB hPbuffer); -typedef int (APIENTRY * wglReleasePbufferDCARBPROC) (HPBUFFERARB hPbuffer, HDC hDC); -typedef BOOL (APIENTRY * wglDestroyPbufferARBPROC) (HPBUFFERARB hPbuffer); -typedef BOOL (APIENTRY * wglQueryPbufferARBPROC) (HPBUFFERARB hPbuffer, int iAttribute, int *piValue); - -/*-------------------------------------------------------------------*/ -/*------------WGL_ARB_PIXEL_FORMAT-----------------------------------*/ -/*-------------------------------------------------------------------*/ - -#define WGL_NUMBER_PIXEL_FORMATS_ARB 0x2000 -#define WGL_DRAW_TO_WINDOW_ARB 0x2001 -#define WGL_DRAW_TO_BITMAP_ARB 0x2002 -#define WGL_ACCELERATION_ARB 0x2003 -#define WGL_NEED_PALETTE_ARB 0x2004 -#define WGL_NEED_SYSTEM_PALETTE_ARB 0x2005 -#define WGL_SWAP_LAYER_BUFFERS_ARB 0x2006 -#define WGL_SWAP_METHOD_ARB 0x2007 -#define WGL_NUMBER_OVERLAYS_ARB 0x2008 -#define WGL_NUMBER_UNDERLAYS_ARB 0x2009 -#define WGL_TRANSPARENT_ARB 0x200A -#define WGL_TRANSPARENT_RED_VALUE_ARB 0x2037 -#define WGL_TRANSPARENT_GREEN_VALUE_ARB 0x2038 -#define WGL_TRANSPARENT_BLUE_VALUE_ARB 0x2039 -#define WGL_TRANSPARENT_ALPHA_VALUE_ARB 0x203A -#define WGL_TRANSPARENT_INDEX_VALUE_ARB 0x203B -#define WGL_SHARE_DEPTH_ARB 0x200C -#define WGL_SHARE_STENCIL_ARB 0x200D -#define WGL_SHARE_ACCUM_ARB 0x200E -#define WGL_SUPPORT_GDI_ARB 0x200F -#define WGL_SUPPORT_OPENGL_ARB 0x2010 -#define WGL_DOUBLE_BUFFER_ARB 0x2011 -#define WGL_STEREO_ARB 0x2012 -#define WGL_PIXEL_TYPE_ARB 0x2013 -#define WGL_COLOR_BITS_ARB 0x2014 -#define WGL_RED_BITS_ARB 0x2015 -#define WGL_RED_SHIFT_ARB 0x2016 -#define WGL_GREEN_BITS_ARB 0x2017 -#define WGL_GREEN_SHIFT_ARB 0x2018 -#define WGL_BLUE_BITS_ARB 0x2019 -#define WGL_BLUE_SHIFT_ARB 0x201A -#define WGL_ALPHA_BITS_ARB 0x201B -#define WGL_ALPHA_SHIFT_ARB 0x201C -#define WGL_ACCUM_BITS_ARB 0x201D -#define WGL_ACCUM_RED_BITS_ARB 0x201E -#define WGL_ACCUM_GREEN_BITS_ARB 0x201F -#define WGL_ACCUM_BLUE_BITS_ARB 0x2020 -#define WGL_ACCUM_ALPHA_BITS_ARB 0x2021 -#define WGL_DEPTH_BITS_ARB 0x2022 -#define WGL_STENCIL_BITS_ARB 0x2023 -#define WGL_AUX_BUFFERS_ARB 0x2024 -#define WGL_NO_ACCELERATION_ARB 0x2025 -#define WGL_GENERIC_ACCELERATION_ARB 0x2026 -#define WGL_FULL_ACCELERATION_ARB 0x2027 -#define WGL_SWAP_EXCHANGE_ARB 0x2028 -#define WGL_SWAP_COPY_ARB 0x2029 -#define WGL_SWAP_UNDEFINED_ARB 0x202A -#define WGL_TYPE_RGBA_ARB 0x202B -#define WGL_TYPE_COLORINDEX_ARB 0x202C - -typedef BOOL (APIENTRY * wglGetPixelFormatAttribivARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, int *piValues); -typedef BOOL (APIENTRY * wglGetPixelFormatAttribfvARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, FLOAT *pfValues); -typedef BOOL (APIENTRY * wglChoosePixelFormatARBPROC) (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats); - -typedef BOOL (APIENTRY * wglBindTexImageARBPROC) (HPBUFFERARB hPbuffer, int iBuffer); -typedef BOOL (APIENTRY * wglReleaseTexImageARBPROC) (HPBUFFERARB hPbuffer, int iBuffer); -typedef BOOL (APIENTRY * wglSetPbufferAttribARBPROC) (HPBUFFERARB hPbuffer, const int *piAttribList); - -/*-------------------------------------------------------------------*/ -/*------------WGL_EXT_SWAP_CONTROL-----------------------------------*/ -/*-------------------------------------------------------------------*/ - -typedef BOOL (APIENTRY * wglSwapIntervalEXTPROC) (int interval); -typedef int (APIENTRY * wglGetSwapIntervalEXTPROC) (void); - -/*-------------------------------------------------------------------*/ -/*------------WGL_ARB_MAKE_CURRENT_READ------------------------------*/ -/*-------------------------------------------------------------------*/ - -#define ERROR_INVALID_PIXEL_TYPE_ARB 0x2043 -#define ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB 0x2054 - -typedef BOOL (APIENTRY * wglMakeContextCurrentARBPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc); -typedef HDC (APIENTRY * wglGetCurrentReadDCARBPROC) (void); - -/*-------------------------------------------------------------------*/ -/*------------WGL_ARB_MULTISAMPLE------------------------------------*/ -/*-------------------------------------------------------------------*/ - -#define WGL_SAMPLE_BUFFERS_ARB 0x2041 -#define WGL_SAMPLES_ARB 0x2042 - -/*-------------------------------------------------------------------*/ -/*------------WGL_ARB_pixel_format_float ----------------------------*/ -/*-------------------------------------------------------------------*/ - -#define WGL_TYPE_RGBA_FLOAT_ARB 0x21A0 - -/*-------------------------------------------------------------------*/ -/*------------WGL_ATI_pixel_format_float ----------------------------*/ -/*-------------------------------------------------------------------*/ - -#define WGL_TYPE_RGBA_FLOAT_ATI 0x21A0 - -/*------------------------------------------------------------------*/ -/*------------ WGL_ARB_framebuffer_sRGB ----------------------------*/ -/*------------------------------------------------------------------*/ - -#define WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB 0x20A9 - -/*---------------------------------------------------------------------------*/ -/*------------ WGL_EXT_pixel_format_packed_float ----------------------------*/ -/*---------------------------------------------------------------------------*/ - -#define WGL_TYPE_RGBA_UNSIGNED_FLOAT_EXT 0x20A8 - -/*----------------------------------------------------------------*/ -/*------------ WGL_ARB_create_context ----------------------------*/ -/*----------------------------------------------------------------*/ - -#define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091 -#define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092 -#define WGL_CONTEXT_LAYER_PLANE_ARB 0x2093 -#define WGL_CONTEXT_FLAGS_ARB 0x2094 - -#define WGL_CONTEXT_DEBUG_BIT_ARB 0x0001 -#define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x0002 - -#define ERROR_INVALID_VERSION_ARB 0x2095 - -typedef HGLRC (APIENTRY * wglCreateContextAttribsARBPROC) (HDC hDC, HGLRC hShareContext, const int *attribList); - -/*---------------------------------------------------------------------*/ -/*------------ WGL_NV_multisample_coverage ----------------------------*/ -/*---------------------------------------------------------------------*/ - -#define WGL_COVERAGE_SAMPLES_NV 0x2042 -#define WGL_COLOR_SAMPLES_NV 0x20B9 - -/*---------------------------------------------------------------------*/ - -typedef struct { - bool WGL_ARB_buffer_region; - bool WGL_ARB_extensions_string; - bool WGL_ARB_make_current_read; - bool WGL_ARB_multisample; - bool WGL_ARB_pbuffer; - bool WGL_ARB_pixel_format; - bool WGL_ARB_render_texture; - bool WGL_EXT_extensions_string; - bool WGL_EXT_swap_control; - bool WGL_NV_render_depth_texture; - bool WGL_NV_render_texture_rectangle; - bool WGL_ARB_pixel_format_float; - bool WGL_ATI_pixel_format_float; - bool WGL_ARB_framebuffer_sRGB; - bool WGL_EXT_pixel_format_packed_float; - bool WGL_ARB_create_context; - bool WGL_NV_multisample_coverage; - - wglGetExtensionsStringEXTPROC wglGetExtensionsStringEXT; - - wglGetExtensionsStringARBPROC wglGetExtensionsStringARB; - - wglCreatePbufferARBPROC wglCreatePbufferARB; - wglGetPbufferDCARBPROC wglGetPbufferDCARB; - wglReleasePbufferDCARBPROC wglReleasePbufferDCARB; - wglDestroyPbufferARBPROC wglDestroyPbufferARB; - wglQueryPbufferARBPROC wglQueryPbufferARB; - - wglGetPixelFormatAttribivARBPROC wglGetPixelFormatAttribivARB; - wglGetPixelFormatAttribfvARBPROC wglGetPixelFormatAttribfvARB; - wglChoosePixelFormatARBPROC wglChoosePixelFormatARB; - - wglBindTexImageARBPROC wglBindTexImageARB; - wglReleaseTexImageARBPROC wglReleaseTexImageARB; - wglSetPbufferAttribARBPROC wglSetPbufferAttribARB; - - wglSwapIntervalEXTPROC wglSwapIntervalEXT; - wglGetSwapIntervalEXTPROC wglGetSwapIntervalEXT; - - wglMakeContextCurrentARBPROC wglMakeContextCurrentARB; - wglGetCurrentReadDCARBPROC wglGetCurrentReadDCARB; - - wglCreateContextAttribsARBPROC wglCreateContextAttribsARB; -} WGLExtensions; - -extern void extgl_InitWGL(WGLExtensions *extensions); - - -#endif diff -Nru lwjgl-2.7.1+dfsg/src/native/windows/LWJGL.c lwjgl-2.9.3+dfsg/src/native/windows/LWJGL.c --- lwjgl-2.7.1+dfsg/src/native/windows/LWJGL.c 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/windows/LWJGL.c 2016-04-09 16:26:57.000000000 +0000 @@ -31,12 +31,12 @@ */ /** - * $Id: LWJGL.c 2985 2008-04-07 18:42:36Z matzon $ + * $Id$ * * Basic DLL stub. * * @author cix_foo - * @version $Revision: 2985 $ + * @version $Revision$ */ #define WIN32_LEAN_AND_MEAN @@ -47,6 +47,8 @@ HINSTANCE dll_handle; +__declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001; // Force high performance GPU for Nvidia Optimus systems + /* * DLL entry point for Windows. Called when Java loads the .dll */ diff -Nru lwjgl-2.7.1+dfsg/src/native/windows/opengl/context.c lwjgl-2.9.3+dfsg/src/native/windows/opengl/context.c --- lwjgl-2.7.1+dfsg/src/native/windows/opengl/context.c 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/windows/opengl/context.c 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,501 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * $Id$ + * + * @author elias_naue + * @version $Revision$ + */ + +#include +#include "Window.h" +#include "extgl.h" +#include "extgl_wgl.h" +#include "context.h" + +extern HINSTANCE dll_handle; // Handle to the LWJGL dll + +#define _CONTEXT_PRIVATE_CLASS_NAME _T("__lwjgl_context_class_name") + +/* + * Register the LWJGL window class. + * Returns true for success, or false for failure + */ +bool registerWindow(WNDPROC win_proc, LPCTSTR class_name) +{ + WNDCLASS windowClass; + memset(&windowClass, 0, sizeof(windowClass)); + windowClass.style = CS_OWNDC; + windowClass.lpfnWndProc = win_proc; + windowClass.cbClsExtra = 0; + windowClass.cbWndExtra = 0; + windowClass.hInstance = dll_handle; + windowClass.hIcon = LoadIcon(NULL, IDI_APPLICATION); + windowClass.hCursor = LoadCursor(NULL, IDC_ARROW); + windowClass.hbrBackground = NULL; + windowClass.lpszMenuName = NULL; + windowClass.lpszClassName = class_name; + + if (RegisterClass(&windowClass) == 0) { + printfDebug("Failed to register window class\n"); + return false; + } + return true; +} + +static LRESULT CALLBACK dummyWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { + return DefWindowProc(hwnd, msg, wParam, lParam); +} + +bool applyPixelFormat(JNIEnv *env, HDC hdc, int iPixelFormat) { + PIXELFORMATDESCRIPTOR desc; + if (DescribePixelFormat(hdc, iPixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &desc) == 0) { + throwFormattedException(env, "DescribePixelFormat failed (%d)", GetLastError()); + return false; + } + + // make that the pixel format of the device context + if (SetPixelFormat(hdc, iPixelFormat, &desc) == FALSE) { + throwFormattedException(env, "SetPixelFormat failed (%d)", GetLastError()); + return false; + } + return true; +} + +/* + * Close the window + */ +void closeWindow(HWND *hwnd, HDC *hdc) +{ + // Release device context + if (*hdc != NULL && *hwnd != NULL) { + ReleaseDC(*hwnd, *hdc); + *hdc = NULL; + } + + // Close the window + if (*hwnd != NULL) { + ShowWindow(*hwnd, SW_HIDE); + DestroyWindow(*hwnd); + *hwnd = NULL; + } +} + +void getWindowFlags(DWORD *windowflags_return, DWORD *exstyle_return, bool undecorated, bool child_window) { + DWORD exstyle, windowflags; + if (undecorated) { + exstyle = WS_EX_APPWINDOW; + windowflags = WS_POPUP; + } else if (child_window) { + exstyle = 0; + windowflags = WS_CHILD; + } else { + exstyle = WS_EX_APPWINDOW; + windowflags = WS_OVERLAPPED | WS_BORDER | WS_CAPTION | WS_MINIMIZEBOX | WS_SYSMENU; + } + windowflags = windowflags | WS_CLIPCHILDREN | WS_CLIPSIBLINGS; + *windowflags_return = windowflags; + *exstyle_return = exstyle; +} + +HWND createWindow(LPCTSTR window_class_name, int x, int y, int width, int height, bool undecorated, bool child_window, HWND parent) +{ + RECT clientSize; + DWORD exstyle, windowflags; + HWND new_hwnd; + + getWindowFlags(&windowflags, &exstyle, undecorated, child_window); + + clientSize.bottom = height; + clientSize.left = 0; + clientSize.right = width; + clientSize.top = 0; + + AdjustWindowRectEx( + &clientSize, // client-rectangle structure + windowflags, // window styles + FALSE, // menu-present option + exstyle // extended window style + ); + // Create the window now, using that class: + new_hwnd = CreateWindowEx ( + exstyle, + window_class_name, + _T(""), + windowflags, + x, y, clientSize.right - clientSize.left, clientSize.bottom - clientSize.top, + parent, + NULL, + dll_handle, + NULL); + + return new_hwnd; +} + +static int convertToBPE(int bpp) { + int bpe; + switch (bpp) { + case 0: + bpe = 0; + break; + case 32: + case 24: + bpe = 8; + break; + case 16: /* Fall through */ + default: + bpe = 4; + break; + } + return bpe; +} + +static int findPixelFormatARBFromBPP(JNIEnv *env, HDC hdc, WGLExtensions *extensions, jobject pixel_format, jobject pixelFormatCaps, int bpp, bool window, bool pbuffer, bool double_buffer) { + jclass cls_pixel_format = (*env)->GetObjectClass(env, pixel_format); + int alpha = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "alpha", "I")); + int depth = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "depth", "I")); + int stencil = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "stencil", "I")); + int samples = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "samples", "I")); + int colorSamples = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "colorSamples", "I")); + int num_aux_buffers = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "num_aux_buffers", "I")); + int accum_bpp = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "accum_bpp", "I")); + int accum_alpha = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "accum_alpha", "I")); + + jboolean stereo = (*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "stereo", "Z")); + jboolean floating_point = (*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "floating_point", "Z")); + jboolean floating_point_packed = (*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "floating_point_packed", "Z")); + jboolean sRGB = (*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "sRGB", "Z")); + + int pixel_type; + int iPixelFormat; + unsigned int num_formats_returned; + attrib_list_t attrib_list; + GLuint *pixelFormatCaps_ptr; + jlong pixelFormatCapsSize; + BOOL result; + jlong i; + int bpe = convertToBPE(bpp); + + if ( floating_point ) + pixel_type = WGL_TYPE_RGBA_FLOAT_ARB; + else if ( floating_point_packed ) + pixel_type = WGL_TYPE_RGBA_UNSIGNED_FLOAT_EXT; + else + pixel_type = WGL_TYPE_RGBA_ARB; + + initAttribList(&attrib_list); + if (window) { + putAttrib(&attrib_list, WGL_DRAW_TO_WINDOW_ARB); putAttrib(&attrib_list, TRUE); + } + if (pbuffer) { + putAttrib(&attrib_list, WGL_DRAW_TO_PBUFFER_ARB); putAttrib(&attrib_list, TRUE); + } + if (!getBooleanProperty(env, "org.lwjgl.opengl.Display.allowSoftwareOpenGL")) { + putAttrib(&attrib_list, WGL_ACCELERATION_ARB); putAttrib(&attrib_list, WGL_FULL_ACCELERATION_ARB); + } + putAttrib(&attrib_list, WGL_PIXEL_TYPE_ARB); putAttrib(&attrib_list, pixel_type); + if ( double_buffer || samples == 0 ) { + // Skip this for FALSE + MSAA: NV drivers won't return any PixelFormat + putAttrib(&attrib_list, WGL_DOUBLE_BUFFER_ARB); putAttrib(&attrib_list, double_buffer ? TRUE : FALSE); + } + putAttrib(&attrib_list, WGL_SUPPORT_OPENGL_ARB); putAttrib(&attrib_list, TRUE); + putAttrib(&attrib_list, WGL_RED_BITS_ARB); putAttrib(&attrib_list, bpe); + putAttrib(&attrib_list, WGL_GREEN_BITS_ARB); putAttrib(&attrib_list, bpe); + putAttrib(&attrib_list, WGL_BLUE_BITS_ARB); putAttrib(&attrib_list, bpe); + putAttrib(&attrib_list, WGL_ALPHA_BITS_ARB); putAttrib(&attrib_list, alpha); + putAttrib(&attrib_list, WGL_DEPTH_BITS_ARB); putAttrib(&attrib_list, depth); + putAttrib(&attrib_list, WGL_STENCIL_BITS_ARB); putAttrib(&attrib_list, stencil); + // Assume caller checked extension availability + if (samples > 0) { + putAttrib(&attrib_list, WGL_SAMPLE_BUFFERS_ARB); putAttrib(&attrib_list, 1); + putAttrib(&attrib_list, WGL_SAMPLES_ARB); putAttrib(&attrib_list, samples); // WGL_COVERAGE_SAMPLES_NV if colorSamples > 0 + if ( colorSamples > 0 ) { + putAttrib(&attrib_list, WGL_COLOR_SAMPLES_NV); putAttrib(&attrib_list, colorSamples); + } + } + putAttrib(&attrib_list, WGL_ACCUM_BITS_ARB); putAttrib(&attrib_list, accum_bpp); + putAttrib(&attrib_list, WGL_ACCUM_ALPHA_BITS_ARB); putAttrib(&attrib_list, accum_alpha); + putAttrib(&attrib_list, WGL_STEREO_ARB); putAttrib(&attrib_list, stereo ? TRUE : FALSE); + putAttrib(&attrib_list, WGL_AUX_BUFFERS_ARB); putAttrib(&attrib_list, num_aux_buffers); + if (sRGB) { + putAttrib(&attrib_list, WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB); putAttrib(&attrib_list, TRUE); + } + + // Assume caller checked extension availability + if (pixelFormatCaps != NULL) { + pixelFormatCaps_ptr = (GLuint *)(*env)->GetDirectBufferAddress(env, pixelFormatCaps); + pixelFormatCapsSize = (*env)->GetDirectBufferCapacity(env, pixelFormatCaps); + + for (i = 0; i < pixelFormatCapsSize; i++) + putAttrib(&attrib_list, pixelFormatCaps_ptr[i]); + } + putAttrib(&attrib_list, 0); putAttrib(&attrib_list, 0); + result = extensions->wglChoosePixelFormatARB(hdc, attrib_list.attribs, NULL, 1, &iPixelFormat, &num_formats_returned); + + if (result == FALSE || num_formats_returned < 1) { + throwFormattedException(env, "Failed to find ARB pixel format %d %d\n", result, num_formats_returned); + return -1; + } + return iPixelFormat; +} + +static int findPixelFormatARB(JNIEnv *env, HDC hdc, WGLExtensions *extensions, jobject pixel_format, jobject pixelFormatCaps, bool use_hdc_bpp, bool window, bool pbuffer, bool double_buffer) { + int bpp; + int iPixelFormat; + int fallback_bpp = 16; + jclass cls_pixel_format = (*env)->GetObjectClass(env, pixel_format); + if (use_hdc_bpp) { + bpp = GetDeviceCaps(hdc, BITSPIXEL); + iPixelFormat = findPixelFormatARBFromBPP(env, hdc, extensions, pixel_format, pixelFormatCaps, bpp, window, pbuffer, double_buffer); + if ((*env)->ExceptionOccurred(env)) { + (*env)->ExceptionClear(env); + printfDebugJava(env, "Failed to find ARB pixel format with HDC depth %d, falling back to %d\n", bpp, fallback_bpp); + bpp = fallback_bpp; + } else + return iPixelFormat; + } else + bpp = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "bpp", "I")); + return findPixelFormatARBFromBPP(env, hdc, extensions, pixel_format, pixelFormatCaps, bpp, window, pbuffer, double_buffer); +} + +/* + * Find an appropriate pixel format + */ +static int findPixelFormatFromBPP(JNIEnv *env, HDC hdc, jobject pixel_format, int bpp, bool double_buffer) +{ + jclass cls_pixel_format = (*env)->GetObjectClass(env, pixel_format); + int alpha = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "alpha", "I")); + int depth = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "depth", "I")); + int stencil = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "stencil", "I")); + int num_aux_buffers = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "num_aux_buffers", "I")); + int accum_bpp = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "accum_bpp", "I")); + int accum_alpha = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "accum_alpha", "I")); + jboolean stereo = (*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "stereo", "Z")); + unsigned int flags = PFD_DRAW_TO_WINDOW | // support window + PFD_SUPPORT_OPENGL | + (double_buffer ? PFD_DOUBLEBUFFER : 0) | + (stereo ? PFD_STEREO : 0); + PIXELFORMATDESCRIPTOR desc; + int iPixelFormat; + PIXELFORMATDESCRIPTOR pfd = { + sizeof(PIXELFORMATDESCRIPTOR), // size of this pfd + 1, // version number + flags, // RGBA type + PFD_TYPE_RGBA, + (BYTE)bpp, + 0, 0, 0, 0, 0, 0, // color bits ignored + (BYTE)alpha, + 0, // shift bit ignored + accum_bpp + accum_alpha, // no accumulation buffer + 0, 0, 0, 0, // accum bits ignored + (BYTE)depth, + (BYTE)stencil, + num_aux_buffers, + PFD_MAIN_PLANE, // main layer + 0, // reserved + 0, 0, 0 // layer masks ignored + }; + // get the best available match of pixel format for the device context + iPixelFormat = ChoosePixelFormat(hdc, &pfd); + if (iPixelFormat == 0) { + throwException(env, "Failed to choose pixel format"); + return -1; + } + + if (DescribePixelFormat(hdc, iPixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &desc) == 0) { + throwException(env, "Could not describe pixel format"); + return -1; + } + + if (desc.cColorBits < bpp) { + throwException(env, "Insufficient color precision"); + return -1; + } + + if (desc.cAlphaBits < alpha) { + throwException(env, "Insufficient alpha precision"); + return -1; + } + + if (desc.cStencilBits < stencil) { + throwException(env, "Insufficient stencil precision"); + return -1; + } + + if (desc.cDepthBits < depth) { + throwException(env, "Insufficient depth buffer precision"); + return -1; + } + + if ((desc.dwFlags & PFD_GENERIC_FORMAT) != 0) { + jboolean allowSoftwareOpenGL = getBooleanProperty(env, "org.lwjgl.opengl.Display.allowSoftwareOpenGL"); + // secondary check for software override + if(!allowSoftwareOpenGL) { + throwException(env, "Pixel format not accelerated"); + return -1; + } + } + + if ((desc.dwFlags & flags) != flags) { + throwException(env, "Capabilities not supported"); + return -1; + } + return iPixelFormat; +} + +static int findPixelFormatDefault(JNIEnv *env, HDC hdc, jobject pixel_format, bool use_hdc_bpp, bool double_buffer) { + int bpp; + int iPixelFormat; + int fallback_bpp = 16; + jclass cls_pixel_format = (*env)->GetObjectClass(env, pixel_format); + if (use_hdc_bpp) { + bpp = GetDeviceCaps(hdc, BITSPIXEL); + iPixelFormat = findPixelFormatFromBPP(env, hdc, pixel_format, bpp, double_buffer); + if ((*env)->ExceptionOccurred(env)) { + (*env)->ExceptionClear(env); + printfDebugJava(env, "Failed to find pixel format with HDC depth %d, falling back to %d\n", bpp, fallback_bpp); + bpp = fallback_bpp; + } else + return iPixelFormat; + } else + bpp = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "bpp", "I")); + return findPixelFormatFromBPP(env, hdc, pixel_format, bpp, double_buffer); +} + +static bool validateAndGetExtensions(JNIEnv *env, WGLExtensions *extensions, HDC dummy_hdc, HGLRC dummy_hglrc, int samples, int colorSamples, bool floating_point, bool floating_point_packed, bool sRGB, jobject pixelFormatCaps) { + if (!wglMakeCurrent(dummy_hdc, dummy_hglrc)) { + throwException(env, "Could not bind context to dummy window"); + return false; + } + extgl_InitWGL(extensions); + + if (!extensions->WGL_ARB_pixel_format) { + throwException(env, "No support for WGL_ARB_pixel_format"); + return false; + } + if (samples > 0 && !extensions->WGL_ARB_multisample) { + throwException(env, "No support for WGL_ARB_multisample"); + return false; + } + if (colorSamples > 0 && !extensions->WGL_NV_multisample_coverage) { + throwException(env, "No support for WGL_NV_multisample_coverage"); + return false; + } + /* + * Apparently, some drivers don't report WGL_ARB_pixel_format_float + * even though GL_ARB_color_buffer_float and WGL_ATI_color_format_float + * is supported. + */ + if (floating_point && !(extensions->WGL_ARB_pixel_format_float || extensions->WGL_ATI_pixel_format_float)) { + throwException(env, "No support for WGL_ARB_pixel_format_float nor WGL_ATI_pixel_format_float"); + return false; + } + if (floating_point_packed && !(extensions->WGL_EXT_pixel_format_packed_float)) { + throwException(env, "No support for WGL_EXT_pixel_format_packed_float"); + return false; + } + if (sRGB && !(extensions->WGL_ARB_framebuffer_sRGB)) { + throwException(env, "No support for WGL_ARB_framebuffer_sRGB"); + return false; + } + if (pixelFormatCaps != NULL && !extensions->WGL_ARB_render_texture) { + throwException(env, "No support for WGL_ARB_render_texture"); + return false; + } + return true; +} + +int findPixelFormatOnDC(JNIEnv *env, HDC hdc, int origin_x, int origin_y, jobject pixel_format, jobject pixelFormatCaps, bool use_hdc_bpp, bool window, bool pbuffer, bool double_buffer) { + HGLRC dummy_hglrc; + HDC saved_current_hdc; + HGLRC saved_current_hglrc; + WGLExtensions extensions; + HWND dummy_hwnd; + HDC dummy_hdc; + int pixel_format_id; + jclass cls_pixel_format = (*env)->GetObjectClass(env, pixel_format); + + int samples = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "samples", "I")); + int colorSamples = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "colorSamples", "I")); + bool floating_point = (bool)(*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "floating_point", "Z")); + bool floating_point_packed = (bool)(*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "floating_point_packed", "Z")); + bool sRGB = (bool)(*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "sRGB", "Z")); + bool use_arb_selection = samples > 0 || floating_point || floating_point_packed || sRGB || pbuffer || pixelFormatCaps != NULL; + + pixel_format_id = findPixelFormatDefault(env, hdc, pixel_format, use_hdc_bpp, double_buffer); + if (!(*env)->ExceptionOccurred(env) && use_arb_selection) { + dummy_hwnd = createDummyWindow(origin_x, origin_y); + if (dummy_hwnd == NULL) { + throwException(env, "Could not create dummy window"); + return -1; + } + dummy_hdc = GetDC(dummy_hwnd); + if (!applyPixelFormat(env, dummy_hdc, pixel_format_id)) { + closeWindow(&dummy_hwnd, &dummy_hdc); + return -1; + } + dummy_hglrc = wglCreateContext(dummy_hdc); + if (dummy_hglrc == NULL) { + closeWindow(&dummy_hwnd, &dummy_hdc); + throwException(env, "Failed to create OpenGL rendering context"); + return -1; + } + // Save the current HDC and HGLRC to avoid disruption + saved_current_hdc = wglGetCurrentDC(); + saved_current_hglrc = wglGetCurrentContext(); + if (validateAndGetExtensions(env, &extensions, dummy_hdc, dummy_hglrc, samples, colorSamples, floating_point, floating_point_packed, sRGB, pixelFormatCaps)) { + pixel_format_id = findPixelFormatARB(env, hdc, &extensions, pixel_format, pixelFormatCaps, use_hdc_bpp, window, pbuffer, double_buffer); + } + wglMakeCurrent(saved_current_hdc, saved_current_hglrc); + wglDeleteContext(dummy_hglrc); + closeWindow(&dummy_hwnd, &dummy_hdc); + } + return pixel_format_id; +} + +static bool registerDummyWindow() { + static bool window_registered = false; + if (!window_registered) { + if (!registerWindow(dummyWindowProc, _CONTEXT_PRIVATE_CLASS_NAME)) { + return false; + } + window_registered = true; + } + return true; +} + +HWND createDummyWindow(int origin_x, int origin_y) { + if (!registerDummyWindow()) + return NULL; + return createWindow(_CONTEXT_PRIVATE_CLASS_NAME, origin_x, origin_y, 1, 1, false, false, NULL); +} diff -Nru lwjgl-2.7.1+dfsg/src/native/windows/opengl/context.h lwjgl-2.9.3+dfsg/src/native/windows/opengl/context.h --- lwjgl-2.7.1+dfsg/src/native/windows/opengl/context.h 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/windows/opengl/context.h 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * $Id$ + * + * @author elias_naur + * @version $Revision$ + */ + +#ifndef __LWJGL_CONTEXT_H +#define __LWJGL_CONTEXT_H + +#include "Window.h" +#include "extgl.h" +#include "extgl_wgl.h" + +typedef struct { + union { + HWND hwnd; + HPBUFFERARB pbuffer; + } u; + HDC drawable_hdc; + WGLExtensions extensions; +} WindowsPeerInfo; + +/* + * Register the LWJGL window class. + * Returns true for success, or false for failure + */ +extern bool registerWindow(WNDPROC win_proc, LPCTSTR class_name); + +extern bool applyPixelFormat(JNIEnv *env, HDC hdc, int iPixelFormat); + +/* + * Close the window + */ +extern void closeWindow(HWND *hwnd, HDC *hdc); + +/** + * Create a dummy window suitable to create contexts from + */ +extern HWND createDummyWindow(int x, int y); + +/** + * Return appropriate window and extended style flags from the given fullscreen and undecorated property + */ +extern void getWindowFlags(DWORD *windowflags_return, DWORD *exstyle_return, bool undecorated, bool child_window); + +/* + * Create a window with the specified position, size, and + * fullscreen attribute. The window will have DirectInput associated + * with it. + * + * Returns true for success, or false for failure + */ +extern HWND createWindow(LPCTSTR window_class_name, int x, int y, int width, int height, bool undecorated, bool child_window, HWND parent); + +extern int findPixelFormatOnDC(JNIEnv *env, HDC hdc, int origin_x, int origin_y, jobject pixel_format, jobject pixelFormatCaps, bool use_hdc_bpp, bool window, bool pbuffer, bool double_buffer); + +#endif diff -Nru lwjgl-2.7.1+dfsg/src/native/windows/opengl/extgl_wgl.c lwjgl-2.9.3+dfsg/src/native/windows/opengl/extgl_wgl.c --- lwjgl-2.7.1+dfsg/src/native/windows/opengl/extgl_wgl.c 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/windows/opengl/extgl_wgl.c 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,216 @@ +/* ---------------------------------------------------------------------------- +Copyright (c) 2001-2002, Lev Povalahev +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * The name of the author may be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF +THE POSSIBILITY OF SUCH DAMAGE. +------------------------------------------------------------------------------*/ +/* + Lev Povalahev + + levp@gmx.net + + http://www.uni-karlsruhe.de/~uli2/ + +*/ + +#include +#include +#include "extgl_wgl.h" +#include "extgl.h" + +static HMODULE lib_gl_handle = NULL; + +void *extgl_GetProcAddress(const char *name) { + void *t = wglGetProcAddress(name); + if (t == NULL) + { + t = GetProcAddress(lib_gl_handle, name); + if (t == NULL) + { + printfDebug("Could not locate symbol %s\n", name); + } + } + return t; +} + +bool extgl_Open(JNIEnv *env) { + if (lib_gl_handle != NULL) + return true; + // load the dynamic libraries for OpenGL + lib_gl_handle = LoadLibrary("opengl32.dll"); + if (lib_gl_handle == NULL) { + throwException(env, "Could not load OpenGL library"); + return false; + } + return true; +} + +void extgl_Close(void) { + FreeLibrary(lib_gl_handle); + lib_gl_handle = NULL; +} + +/** returns true if the extension is available */ +static bool WGLQueryExtension(WGLExtensions *extensions, const char *name) { + const GLubyte *extension_string; + + if (!extensions->WGL_ARB_extensions_string) + if (!extensions->WGL_EXT_extensions_string) + return false; + else + extension_string = (GLubyte*)extensions->wglGetExtensionsStringEXT(); + else + extension_string = (GLubyte*)extensions->wglGetExtensionsStringARB(wglGetCurrentDC()); + return extgl_QueryExtension(extension_string, name); +} + +/*---------------------------------------------------------------------*/ + +static void extgl_InitWGLARBPbuffer(WGLExtensions *extensions) { + ExtFunction functions[] = { + {"wglCreatePbufferARB", (void *)&extensions->wglCreatePbufferARB}, + {"wglGetPbufferDCARB", (void *)&extensions->wglGetPbufferDCARB}, + {"wglReleasePbufferDCARB", (void *)&extensions->wglReleasePbufferDCARB}, + {"wglDestroyPbufferARB", (void *)&extensions->wglDestroyPbufferARB}, + {"wglQueryPbufferARB", (void *)&extensions->wglQueryPbufferARB}}; + if (extensions->WGL_ARB_pbuffer) + extensions->WGL_ARB_pbuffer = extgl_InitializeFunctions(sizeof(functions)/sizeof(ExtFunction), functions); +} + +static void extgl_InitWGLARBPixelFormat(WGLExtensions *extensions) { + ExtFunction functions[] = { + {"wglGetPixelFormatAttribivARB", (void *)&extensions->wglGetPixelFormatAttribivARB}, + {"wglGetPixelFormatAttribfvARB", (void *)&extensions->wglGetPixelFormatAttribfvARB}, + {"wglChoosePixelFormatARB", (void *)&extensions->wglChoosePixelFormatARB}}; + if (extensions->WGL_ARB_pixel_format) + extensions->WGL_ARB_pixel_format = extgl_InitializeFunctions(sizeof(functions)/sizeof(ExtFunction), functions); +} + +static void extgl_InitWGLARBRenderTexture(WGLExtensions *extensions) { + ExtFunction functions[] = { + {"wglBindTexImageARB", (void *)&extensions->wglBindTexImageARB}, + {"wglReleaseTexImageARB", (void *)&extensions->wglReleaseTexImageARB}, + {"wglSetPbufferAttribARB", (void *)&extensions->wglSetPbufferAttribARB}}; + if (extensions->WGL_ARB_render_texture) + extensions->WGL_ARB_render_texture = extgl_InitializeFunctions(sizeof(functions)/sizeof(ExtFunction), functions); +} + +static void extgl_InitWGLEXTSwapControl(WGLExtensions *extensions) { + ExtFunction functions[] = { + {"wglSwapIntervalEXT", (void *)&extensions->wglSwapIntervalEXT}, + {"wglGetSwapIntervalEXT", (void *)&extensions->wglGetSwapIntervalEXT}}; + if (extensions->WGL_EXT_swap_control) + extensions->WGL_EXT_swap_control = extgl_InitializeFunctions(sizeof(functions)/sizeof(ExtFunction), functions); +} + +static void extgl_InitWGLARBMakeCurrentRead(WGLExtensions *extensions) { + ExtFunction functions[] = { + {"wglMakeContextCurrentARB", (void *)&extensions->wglMakeContextCurrentARB}, + {"wglGetCurrentReadDCARB", (void *)&extensions->wglGetCurrentReadDCARB}}; + if (extensions->WGL_ARB_make_current_read) + extensions->WGL_ARB_make_current_read = extgl_InitializeFunctions(sizeof(functions)/sizeof(ExtFunction), functions); +} + +static void extgl_InitWGLARBCreateContext(WGLExtensions *extensions) { + ExtFunction functions[] = { + {"wglCreateContextAttribsARB", (void *)&extensions->wglCreateContextAttribsARB} + }; + if (extensions->WGL_ARB_create_context) + extensions->WGL_ARB_create_context = extgl_InitializeFunctions(sizeof(functions)/sizeof(ExtFunction), functions); +} + +static void extgl_InitWGLNVPresentVideo(WGLExtensions *extensions) { + ExtFunction functions[] = { + {"wglEnumerateVideoDevicesNV", (void *)&extensions->wglEnumerateVideoDevicesNV}, + {"wglBindVideoDeviceNV", (void *)&extensions->wglBindVideoDeviceNV}, + {"wglQueryCurrentContextNV", (void *)&extensions->wglQueryCurrentContextNV} + }; + + if (extensions->WGL_NV_present_video) + extensions->WGL_NV_present_video = extgl_InitializeFunctions(sizeof(functions)/sizeof(ExtFunction), functions); +} + +static void extgl_InitWGLNVVideoCapture(WGLExtensions *extensions) { + ExtFunction functions[] = { + {"wglBindVideoCaptureDeviceNV", (void *)&extensions->wglBindVideoCaptureDeviceNV}, + {"wglEnumerateVideoCaptureDevicesNV", (void *)&extensions->wglEnumerateVideoCaptureDevicesNV}, + {"wglLockVideoCaptureDeviceNV", (void *)&extensions->wglLockVideoCaptureDeviceNV}, + {"wglQueryVideoCaptureDeviceNV", (void *)&extensions->wglQueryVideoCaptureDeviceNV}, + {"wglReleaseVideoCaptureDeviceNV", (void *)&extensions->wglReleaseVideoCaptureDeviceNV} + }; + + if (extensions->WGL_NV_video_capture) + extensions->WGL_NV_video_capture = extgl_InitializeFunctions(sizeof(functions)/sizeof(ExtFunction), functions); +} + +/*---------------------------------------------------------------------*/ + +static void extgl_InitSupportedWGLExtensions(WGLExtensions *extensions) { + extensions->WGL_ARB_buffer_region = WGLQueryExtension(extensions, "WGL_ARB_buffer_region"); + extensions->WGL_ARB_make_current_read = WGLQueryExtension(extensions, "WGL_ARB_make_current_read"); + extensions->WGL_ARB_multisample = WGLQueryExtension(extensions, "WGL_ARB_multisample"); + extensions->WGL_ARB_pixel_format_float = WGLQueryExtension(extensions, "WGL_ARB_pixel_format_float"); + extensions->WGL_ATI_pixel_format_float = WGLQueryExtension(extensions, "WGL_ATI_pixel_format_float"); + extensions->WGL_ARB_pbuffer = WGLQueryExtension(extensions, "WGL_ARB_pbuffer"); + extensions->WGL_ARB_pixel_format = WGLQueryExtension(extensions, "WGL_ARB_pixel_format"); + extensions->WGL_ARB_render_texture = WGLQueryExtension(extensions, "WGL_ARB_render_texture"); + extensions->WGL_EXT_swap_control = WGLQueryExtension(extensions, "WGL_EXT_swap_control"); + extensions->WGL_NV_render_depth_texture = WGLQueryExtension(extensions, "WGL_NV_render_depth_texture"); + extensions->WGL_NV_render_texture_rectangle = WGLQueryExtension(extensions, "WGL_NV_render_texture_rectangle"); + extensions->WGL_ARB_framebuffer_sRGB = WGLQueryExtension(extensions, "WGL_ARB_framebuffer_sRGB") || WGLQueryExtension(extensions, "WGL_EXT_framebuffer_sRGB"); + extensions->WGL_EXT_pixel_format_packed_float = WGLQueryExtension(extensions, "WGL_EXT_pixel_format_packed_float"); + extensions->WGL_ARB_create_context = WGLQueryExtension(extensions, "WGL_ARB_create_context"); + extensions->WGL_NV_multisample_coverage = WGLQueryExtension(extensions, "WGL_NV_multisample_coverage"); + extensions->WGL_NV_present_video = WGLQueryExtension(extensions, "WGL_NV_present_video"); + extensions->WGL_NV_video_capture = WGLQueryExtension(extensions, "WGL_NV_video_capture"); +} + +static void extgl_InitWGLEXTExtensionsString(WGLExtensions *extensions) { + ExtFunction functions[] = { + {"wglGetExtensionsStringEXT", (void *)&extensions->wglGetExtensionsStringEXT} + }; + extensions->WGL_EXT_extensions_string = extgl_InitializeFunctions(sizeof(functions)/sizeof(ExtFunction), functions); +} + +static void extgl_InitWGLARBExtensionsString(WGLExtensions *extensions) { + ExtFunction functions[] = { + {"wglGetExtensionsStringARB", (void *)&extensions->wglGetExtensionsStringARB} + }; + extensions->WGL_ARB_extensions_string = extgl_InitializeFunctions(sizeof(functions)/sizeof(ExtFunction), functions); +} + +void extgl_InitWGL(WGLExtensions *extensions) { + extgl_InitWGLARBExtensionsString(extensions); + extgl_InitWGLEXTExtensionsString(extensions); + + extgl_InitSupportedWGLExtensions(extensions); + + extgl_InitWGLARBMakeCurrentRead(extensions); + extgl_InitWGLEXTSwapControl(extensions); + extgl_InitWGLARBRenderTexture(extensions); + extgl_InitWGLARBPixelFormat(extensions); + extgl_InitWGLARBPbuffer(extensions); + extgl_InitWGLARBCreateContext(extensions); + extgl_InitWGLNVPresentVideo(extensions); + extgl_InitWGLNVVideoCapture(extensions); +} diff -Nru lwjgl-2.7.1+dfsg/src/native/windows/opengl/extgl_wgl.h lwjgl-2.9.3+dfsg/src/native/windows/opengl/extgl_wgl.h --- lwjgl-2.7.1+dfsg/src/native/windows/opengl/extgl_wgl.h 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/windows/opengl/extgl_wgl.h 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,299 @@ +/* ---------------------------------------------------------------------------- +Copyright (c) 2001-2002, Lev Povalahev +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * The name of the author may be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF +THE POSSIBILITY OF SUCH DAMAGE. +------------------------------------------------------------------------------*/ +/* + Lev Povalahev + + levp@gmx.net + + http://www.uni-karlsruhe.de/~uli2/ + +*/ + +#ifndef _EXTGL_WGL_H +#define _EXTGL_WGL_H + +#include +#include "extgl.h" +#include "common_tools.h" + +/*-------------------------------------------------------------------*/ +/*------------WGL_EXT_EXTENSION_STRING-------------------------------*/ +/*-------------------------------------------------------------------*/ + +typedef const char* (APIENTRY * wglGetExtensionsStringEXTPROC) (); + +/*-------------------------------------------------------------------*/ +/*------------WGL_ARB_EXTENSION_STRING-------------------------------*/ +/*-------------------------------------------------------------------*/ + +typedef const char* (APIENTRY * wglGetExtensionsStringARBPROC) (HDC hdc); + +/*-------------------------------------------------------------------*/ +/*------------WGL_ARB_PBUFFER----------------------------------------*/ +/*-------------------------------------------------------------------*/ + +#define WGL_DRAW_TO_PBUFFER_ARB 0x202D +#define WGL_DRAW_TO_PBUFFER_ARB 0x202D +#define WGL_MAX_PBUFFER_PIXELS_ARB 0x202E +#define WGL_MAX_PBUFFER_WIDTH_ARB 0x202F +#define WGL_MAX_PBUFFER_HEIGHT_ARB 0x2030 +#define WGL_PBUFFER_LARGEST_ARB 0x2033 +#define WGL_PBUFFER_WIDTH_ARB 0x2034 +#define WGL_PBUFFER_HEIGHT_ARB 0x2035 +#define WGL_PBUFFER_LOST_ARB 0x2036 + +DECLARE_HANDLE(HPBUFFERARB); + +typedef HPBUFFERARB (APIENTRY * wglCreatePbufferARBPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList); +typedef HDC (APIENTRY * wglGetPbufferDCARBPROC) (HPBUFFERARB hPbuffer); +typedef int (APIENTRY * wglReleasePbufferDCARBPROC) (HPBUFFERARB hPbuffer, HDC hDC); +typedef BOOL (APIENTRY * wglDestroyPbufferARBPROC) (HPBUFFERARB hPbuffer); +typedef BOOL (APIENTRY * wglQueryPbufferARBPROC) (HPBUFFERARB hPbuffer, int iAttribute, int *piValue); + +/*-------------------------------------------------------------------*/ +/*------------WGL_ARB_PIXEL_FORMAT-----------------------------------*/ +/*-------------------------------------------------------------------*/ + +#define WGL_NUMBER_PIXEL_FORMATS_ARB 0x2000 +#define WGL_DRAW_TO_WINDOW_ARB 0x2001 +#define WGL_DRAW_TO_BITMAP_ARB 0x2002 +#define WGL_ACCELERATION_ARB 0x2003 +#define WGL_NEED_PALETTE_ARB 0x2004 +#define WGL_NEED_SYSTEM_PALETTE_ARB 0x2005 +#define WGL_SWAP_LAYER_BUFFERS_ARB 0x2006 +#define WGL_SWAP_METHOD_ARB 0x2007 +#define WGL_NUMBER_OVERLAYS_ARB 0x2008 +#define WGL_NUMBER_UNDERLAYS_ARB 0x2009 +#define WGL_TRANSPARENT_ARB 0x200A +#define WGL_TRANSPARENT_RED_VALUE_ARB 0x2037 +#define WGL_TRANSPARENT_GREEN_VALUE_ARB 0x2038 +#define WGL_TRANSPARENT_BLUE_VALUE_ARB 0x2039 +#define WGL_TRANSPARENT_ALPHA_VALUE_ARB 0x203A +#define WGL_TRANSPARENT_INDEX_VALUE_ARB 0x203B +#define WGL_SHARE_DEPTH_ARB 0x200C +#define WGL_SHARE_STENCIL_ARB 0x200D +#define WGL_SHARE_ACCUM_ARB 0x200E +#define WGL_SUPPORT_GDI_ARB 0x200F +#define WGL_SUPPORT_OPENGL_ARB 0x2010 +#define WGL_DOUBLE_BUFFER_ARB 0x2011 +#define WGL_STEREO_ARB 0x2012 +#define WGL_PIXEL_TYPE_ARB 0x2013 +#define WGL_COLOR_BITS_ARB 0x2014 +#define WGL_RED_BITS_ARB 0x2015 +#define WGL_RED_SHIFT_ARB 0x2016 +#define WGL_GREEN_BITS_ARB 0x2017 +#define WGL_GREEN_SHIFT_ARB 0x2018 +#define WGL_BLUE_BITS_ARB 0x2019 +#define WGL_BLUE_SHIFT_ARB 0x201A +#define WGL_ALPHA_BITS_ARB 0x201B +#define WGL_ALPHA_SHIFT_ARB 0x201C +#define WGL_ACCUM_BITS_ARB 0x201D +#define WGL_ACCUM_RED_BITS_ARB 0x201E +#define WGL_ACCUM_GREEN_BITS_ARB 0x201F +#define WGL_ACCUM_BLUE_BITS_ARB 0x2020 +#define WGL_ACCUM_ALPHA_BITS_ARB 0x2021 +#define WGL_DEPTH_BITS_ARB 0x2022 +#define WGL_STENCIL_BITS_ARB 0x2023 +#define WGL_AUX_BUFFERS_ARB 0x2024 +#define WGL_NO_ACCELERATION_ARB 0x2025 +#define WGL_GENERIC_ACCELERATION_ARB 0x2026 +#define WGL_FULL_ACCELERATION_ARB 0x2027 +#define WGL_SWAP_EXCHANGE_ARB 0x2028 +#define WGL_SWAP_COPY_ARB 0x2029 +#define WGL_SWAP_UNDEFINED_ARB 0x202A +#define WGL_TYPE_RGBA_ARB 0x202B +#define WGL_TYPE_COLORINDEX_ARB 0x202C + +typedef BOOL (APIENTRY * wglGetPixelFormatAttribivARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, int *piValues); +typedef BOOL (APIENTRY * wglGetPixelFormatAttribfvARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, FLOAT *pfValues); +typedef BOOL (APIENTRY * wglChoosePixelFormatARBPROC) (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats); + +typedef BOOL (APIENTRY * wglBindTexImageARBPROC) (HPBUFFERARB hPbuffer, int iBuffer); +typedef BOOL (APIENTRY * wglReleaseTexImageARBPROC) (HPBUFFERARB hPbuffer, int iBuffer); +typedef BOOL (APIENTRY * wglSetPbufferAttribARBPROC) (HPBUFFERARB hPbuffer, const int *piAttribList); + +/*-------------------------------------------------------------------*/ +/*------------WGL_EXT_SWAP_CONTROL-----------------------------------*/ +/*-------------------------------------------------------------------*/ + +typedef BOOL (APIENTRY * wglSwapIntervalEXTPROC) (int interval); +typedef int (APIENTRY * wglGetSwapIntervalEXTPROC) (void); + +/*-------------------------------------------------------------------*/ +/*------------WGL_ARB_MAKE_CURRENT_READ------------------------------*/ +/*-------------------------------------------------------------------*/ + +#define ERROR_INVALID_PIXEL_TYPE_ARB 0x2043 +#define ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB 0x2054 + +typedef BOOL (APIENTRY * wglMakeContextCurrentARBPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc); +typedef HDC (APIENTRY * wglGetCurrentReadDCARBPROC) (void); + +/*-------------------------------------------------------------------*/ +/*------------WGL_ARB_MULTISAMPLE------------------------------------*/ +/*-------------------------------------------------------------------*/ + +#define WGL_SAMPLE_BUFFERS_ARB 0x2041 +#define WGL_SAMPLES_ARB 0x2042 + +/*-------------------------------------------------------------------*/ +/*------------WGL_ARB_pixel_format_float ----------------------------*/ +/*-------------------------------------------------------------------*/ + +#define WGL_TYPE_RGBA_FLOAT_ARB 0x21A0 + +/*-------------------------------------------------------------------*/ +/*------------WGL_ATI_pixel_format_float ----------------------------*/ +/*-------------------------------------------------------------------*/ + +#define WGL_TYPE_RGBA_FLOAT_ATI 0x21A0 + +/*------------------------------------------------------------------*/ +/*------------ WGL_ARB_framebuffer_sRGB ----------------------------*/ +/*------------------------------------------------------------------*/ + +#define WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB 0x20A9 + +/*---------------------------------------------------------------------------*/ +/*------------ WGL_EXT_pixel_format_packed_float ----------------------------*/ +/*---------------------------------------------------------------------------*/ + +#define WGL_TYPE_RGBA_UNSIGNED_FLOAT_EXT 0x20A8 + +/*----------------------------------------------------------------*/ +/*------------ WGL_ARB_create_context ----------------------------*/ +/*----------------------------------------------------------------*/ + +#define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091 +#define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092 +#define WGL_CONTEXT_LAYER_PLANE_ARB 0x2093 +#define WGL_CONTEXT_FLAGS_ARB 0x2094 + +#define WGL_CONTEXT_DEBUG_BIT_ARB 0x0001 +#define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x0002 + +#define ERROR_INVALID_VERSION_ARB 0x2095 + +typedef HGLRC (APIENTRY * wglCreateContextAttribsARBPROC) (HDC hDC, HGLRC hShareContext, const int *attribList); + +/*---------------------------------------------------------------------*/ +/*------------ WGL_NV_multisample_coverage ----------------------------*/ +/*---------------------------------------------------------------------*/ + +#define WGL_COVERAGE_SAMPLES_NV 0x2042 +#define WGL_COLOR_SAMPLES_NV 0x20B9 + +/*--------------------------------------------------------------*/ +/*------------ WGL_NV_present_video ----------------------------*/ +/*--------------------------------------------------------------*/ + +DECLARE_HANDLE(HVIDEOOUTPUTDEVICENV); + +#define WGL_NUM_VIDEO_SLOTS_NV 0x20F0 + +typedef int (APIENTRY * wglEnumerateVideoDevicesNVPROC) (HDC hDc, HVIDEOOUTPUTDEVICENV *phDeviceList); +typedef BOOL (APIENTRY * wglBindVideoDeviceNVPROC) (HDC hDc, unsigned int uVideoSlot, HVIDEOOUTPUTDEVICENV hVideoDevice, const int *piAttribList); +typedef BOOL (APIENTRY * wglQueryCurrentContextNVPROC) (int iAttribute, int *piValue); + +/*--------------------------------------------------------------*/ +/*------------ WGL_NV_video_capture ----------------------------*/ +/*--------------------------------------------------------------*/ + +DECLARE_HANDLE(HVIDEOINPUTDEVICENV); + +#define WGL_NUM_VIDEO_SLOTS_NV 0x20F0 + +typedef BOOL (APIENTRY * wglBindVideoCaptureDeviceNVPROC) (UINT uVideoSlot, HVIDEOINPUTDEVICENV hDevice); +typedef UINT (APIENTRY * wglEnumerateVideoCaptureDevicesNVPROC) (HDC hDc, HVIDEOINPUTDEVICENV *phDeviceList); +typedef BOOL (APIENTRY * wglLockVideoCaptureDeviceNVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice); +typedef BOOL (APIENTRY * wglQueryVideoCaptureDeviceNVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice, int iAttribute, int *piValue); +typedef BOOL (APIENTRY * wglReleaseVideoCaptureDeviceNVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice); + +/*---------------------------------------------------------------------*/ + +typedef struct { + bool WGL_ARB_buffer_region; + bool WGL_ARB_extensions_string; + bool WGL_ARB_make_current_read; + bool WGL_ARB_multisample; + bool WGL_ARB_pbuffer; + bool WGL_ARB_pixel_format; + bool WGL_ARB_render_texture; + bool WGL_EXT_extensions_string; + bool WGL_EXT_swap_control; + bool WGL_NV_render_depth_texture; + bool WGL_NV_render_texture_rectangle; + bool WGL_ARB_pixel_format_float; + bool WGL_ATI_pixel_format_float; + bool WGL_ARB_framebuffer_sRGB; + bool WGL_EXT_pixel_format_packed_float; + bool WGL_ARB_create_context; + bool WGL_NV_multisample_coverage; + bool WGL_NV_present_video; + bool WGL_NV_video_capture; + + wglGetExtensionsStringEXTPROC wglGetExtensionsStringEXT; + + wglGetExtensionsStringARBPROC wglGetExtensionsStringARB; + + wglCreatePbufferARBPROC wglCreatePbufferARB; + wglGetPbufferDCARBPROC wglGetPbufferDCARB; + wglReleasePbufferDCARBPROC wglReleasePbufferDCARB; + wglDestroyPbufferARBPROC wglDestroyPbufferARB; + wglQueryPbufferARBPROC wglQueryPbufferARB; + + wglGetPixelFormatAttribivARBPROC wglGetPixelFormatAttribivARB; + wglGetPixelFormatAttribfvARBPROC wglGetPixelFormatAttribfvARB; + wglChoosePixelFormatARBPROC wglChoosePixelFormatARB; + + wglBindTexImageARBPROC wglBindTexImageARB; + wglReleaseTexImageARBPROC wglReleaseTexImageARB; + wglSetPbufferAttribARBPROC wglSetPbufferAttribARB; + + wglSwapIntervalEXTPROC wglSwapIntervalEXT; + wglGetSwapIntervalEXTPROC wglGetSwapIntervalEXT; + + wglMakeContextCurrentARBPROC wglMakeContextCurrentARB; + wglGetCurrentReadDCARBPROC wglGetCurrentReadDCARB; + + wglCreateContextAttribsARBPROC wglCreateContextAttribsARB; + + wglEnumerateVideoDevicesNVPROC wglEnumerateVideoDevicesNV; + wglBindVideoDeviceNVPROC wglBindVideoDeviceNV; + wglQueryCurrentContextNVPROC wglQueryCurrentContextNV; + + wglBindVideoCaptureDeviceNVPROC wglBindVideoCaptureDeviceNV; + wglEnumerateVideoCaptureDevicesNVPROC wglEnumerateVideoCaptureDevicesNV; + wglLockVideoCaptureDeviceNVPROC wglLockVideoCaptureDeviceNV; + wglQueryVideoCaptureDeviceNVPROC wglQueryVideoCaptureDeviceNV; + wglReleaseVideoCaptureDeviceNVPROC wglReleaseVideoCaptureDeviceNV; +} WGLExtensions; + +extern void extgl_InitWGL(WGLExtensions *extensions); + + +#endif diff -Nru lwjgl-2.7.1+dfsg/src/native/windows/opengl/org_lwjgl_opengl_Pbuffer.c lwjgl-2.9.3+dfsg/src/native/windows/opengl/org_lwjgl_opengl_Pbuffer.c --- lwjgl-2.7.1+dfsg/src/native/windows/opengl/org_lwjgl_opengl_Pbuffer.c 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/windows/opengl/org_lwjgl_opengl_Pbuffer.c 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,212 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * $Id$ + * + * Windows Pbuffer. + * + * @author elias_naur + * @version $Revision$ + */ + +#include +#include "org_lwjgl_opengl_WindowsDisplay.h" +#include "org_lwjgl_opengl_Pbuffer.h" +#include "context.h" + +#include "extgl.h" +#include "extgl_wgl.h" + +#include "common_tools.h" + +static bool isPbufferSupported(WGLExtensions *extensions) { + return extensions->WGL_ARB_pixel_format && extensions->WGL_ARB_pbuffer; +} + +static bool getExtensions(JNIEnv *env, WGLExtensions *extensions, jobject pixel_format, jobject pixelFormatCaps) { + int origin_x = 0; int origin_y = 0; + HWND dummy_hwnd; + HDC dummy_hdc; + HGLRC dummy_context; + HDC saved_hdc; + HGLRC saved_context; + int pixel_format_id; + + dummy_hwnd = createDummyWindow(origin_x, origin_y); + if (dummy_hwnd == NULL) { + throwException(env, "Could not create dummy window"); + return false; + } + dummy_hdc = GetDC(dummy_hwnd); + pixel_format_id = findPixelFormatOnDC(env, dummy_hdc, origin_x, origin_y, pixel_format, pixelFormatCaps, false, true, false, false); + if (pixel_format_id == -1) { + closeWindow(&dummy_hwnd, &dummy_hdc); + return false; + } + if (!applyPixelFormat(env, dummy_hdc, pixel_format_id)) { + closeWindow(&dummy_hwnd, &dummy_hdc); + return false; + } + dummy_context = wglCreateContext(dummy_hdc); + if (dummy_context == NULL) { + closeWindow(&dummy_hwnd, &dummy_hdc); + throwException(env, "Could not create dummy context"); + return false; + } + saved_hdc = wglGetCurrentDC(); + saved_context = wglGetCurrentContext(); + if (!wglMakeCurrent(dummy_hdc, dummy_context)) { + wglMakeCurrent(saved_hdc, saved_context); + closeWindow(&dummy_hwnd, &dummy_hdc); + wglDeleteContext(dummy_context); + throwException(env, "Could not make dummy context current"); + return false; + } + extgl_InitWGL(extensions); + if (!wglMakeCurrent(saved_hdc, saved_context)) + printfDebugJava(env, "ERROR: Could not restore current context"); + closeWindow(&dummy_hwnd, &dummy_hdc); + wglDeleteContext(dummy_context); + return true; +} + +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nGetPbufferCapabilities + (JNIEnv *env, jobject self, jobject pixel_format) +{ + int caps = 0; + WGLExtensions extensions; + if (!getExtensions(env, &extensions, pixel_format, NULL)) + return 0; + if (isPbufferSupported(&extensions)) + caps |= org_lwjgl_opengl_Pbuffer_PBUFFER_SUPPORTED; + + if (extensions.WGL_ARB_render_texture) + caps |= org_lwjgl_opengl_Pbuffer_RENDER_TEXTURE_SUPPORTED; + + if (extensions.WGL_NV_render_texture_rectangle) + caps |= org_lwjgl_opengl_Pbuffer_RENDER_TEXTURE_RECTANGLE_SUPPORTED; + + if (extensions.WGL_NV_render_depth_texture) + caps |= org_lwjgl_opengl_Pbuffer_RENDER_DEPTH_TEXTURE_SUPPORTED; + + return caps; +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsPbufferPeerInfo_nCreate + (JNIEnv *env, jobject self, jobject peer_info_handle, + jint width, jint height, jobject pixel_format, + jobject pixelFormatCaps, jobject pBufferAttribs) +{ + int origin_x = 0; int origin_y = 0; + HWND dummy_hwnd; + HDC dummy_hdc; + HPBUFFERARB Pbuffer; + HDC Pbuffer_dc; + WGLExtensions extensions; + const int *pBufferAttribs_ptr; + WindowsPeerInfo *peer_info = (WindowsPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); + int pixel_format_id; + + if ( pBufferAttribs != NULL ) { + pBufferAttribs_ptr = (const int *)(*env)->GetDirectBufferAddress(env, pBufferAttribs); + } else { + pBufferAttribs_ptr = NULL; + } + if (!getExtensions(env, &extensions, pixel_format, pixelFormatCaps)) + return; + dummy_hwnd = createDummyWindow(origin_x, origin_y); + if (dummy_hwnd == NULL) { + throwException(env, "Could not create dummy window"); + return; + } + dummy_hdc = GetDC(dummy_hwnd); + pixel_format_id = findPixelFormatOnDC(env, dummy_hdc, origin_x, origin_y, pixel_format, pixelFormatCaps, false, false, true, false); + if (pixel_format_id == -1) { + closeWindow(&dummy_hwnd, &dummy_hdc); + return; + } + Pbuffer = extensions.wglCreatePbufferARB(dummy_hdc, pixel_format_id, width, height, pBufferAttribs_ptr); + closeWindow(&dummy_hwnd, &dummy_hdc); + if (Pbuffer == NULL) { + throwException(env, "Could not create Pbuffer"); + return; + } + Pbuffer_dc = extensions.wglGetPbufferDCARB(Pbuffer); + if (Pbuffer_dc == NULL) { + extensions.wglDestroyPbufferARB(Pbuffer); + throwException(env, "Could not get Pbuffer DC"); + return; + } + peer_info->extensions = extensions; + peer_info->u.pbuffer = Pbuffer; + peer_info->drawable_hdc = Pbuffer_dc; +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsPbufferPeerInfo_nDestroy + (JNIEnv *env, jclass clazz, jobject peer_info_handle) { + WindowsPeerInfo *peer_info = (WindowsPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); + peer_info->extensions.wglReleasePbufferDCARB(peer_info->u.pbuffer, peer_info->drawable_hdc); + peer_info->extensions.wglDestroyPbufferARB(peer_info->u.pbuffer); +} + +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_WindowsPbufferPeerInfo_nIsBufferLost + (JNIEnv *env, jclass clazz, jobject peer_info_handle) { + WindowsPeerInfo *peer_info = (WindowsPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); + BOOL buffer_lost; + peer_info->extensions.wglQueryPbufferARB(peer_info->u.pbuffer, WGL_PBUFFER_LOST_ARB, &buffer_lost); + return buffer_lost ? JNI_TRUE : JNI_FALSE; +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsPbufferPeerInfo_nSetPbufferAttrib + (JNIEnv *env, jclass clazz, jobject peer_info_handle, jint attrib, jint value) { + WindowsPeerInfo *peer_info = (WindowsPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); + int attribs[3]; + + attribs[0] = attrib; + attribs[1] = value; + attribs[2] = 0; + + peer_info->extensions.wglSetPbufferAttribARB(peer_info->u.pbuffer, attribs); +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsPbufferPeerInfo_nBindTexImageToPbuffer + (JNIEnv *env, jclass clazz, jobject peer_info_handle, jint buffer) { + WindowsPeerInfo *peer_info = (WindowsPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); + peer_info->extensions.wglBindTexImageARB(peer_info->u.pbuffer, buffer); +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsPbufferPeerInfo_nReleaseTexImageFromPbuffer + (JNIEnv *env, jclass clazz, jobject peer_info_handle, jint buffer) { + WindowsPeerInfo *peer_info = (WindowsPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); + peer_info->extensions.wglReleaseTexImageARB(peer_info->u.pbuffer, buffer); +} diff -Nru lwjgl-2.7.1+dfsg/src/native/windows/opengl/org_lwjgl_opengl_WindowsContextImplementation.c lwjgl-2.9.3+dfsg/src/native/windows/opengl/org_lwjgl_opengl_WindowsContextImplementation.c --- lwjgl-2.7.1+dfsg/src/native/windows/opengl/org_lwjgl_opengl_WindowsContextImplementation.c 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/windows/opengl/org_lwjgl_opengl_WindowsContextImplementation.c 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,173 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * $Id$ + * + * @author elias_naur + * @version $Revision$ + */ + +#include +#include "org_lwjgl_opengl_WindowsContextImplementation.h" +#include "context.h" +#include "extgl_wgl.h" +#include "common_tools.h" + +typedef struct { + HGLRC context; +} WindowsContext; + +JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_WindowsContextImplementation_nCreate + (JNIEnv *env, jclass clazz, jobject peer_info_handle, jobject attribs, jobject shared_context_handle) { + WindowsPeerInfo *peer_info; + WindowsContext *shared_context_info; + WindowsContext *context_info; + HGLRC context; + HGLRC shared_context = NULL; + + // -- We need to create a temporary context to detect the presence of WGL_ARB_create_context + HDC saved_current_hdc; + HGLRC saved_current_hglrc; + WGLExtensions extensions; + const int *attribList = attribs == NULL ? NULL : ((const int *)(*env)->GetDirectBufferAddress(env, attribs)); + + jobject context_handle = newJavaManagedByteBuffer(env, sizeof(WindowsContext)); + if (context_handle == NULL) { + throwException(env, "Could not create handle buffer"); + return NULL; + } + + peer_info = (WindowsPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); + if (shared_context_handle != NULL) { + shared_context_info = (WindowsContext *)(*env)->GetDirectBufferAddress(env, shared_context_handle); + shared_context = shared_context_info->context; + } + + // Create the context + context = wglCreateContext(peer_info->drawable_hdc); + if (context == NULL) { + throwException(env, "Could not create context"); + return NULL; + } + + // Save the current HDC and HGLRC to avoid disruption + saved_current_hdc = wglGetCurrentDC(); + saved_current_hglrc = wglGetCurrentContext(); + + // Make context current and detect extensions + if (!wglMakeCurrent(peer_info->drawable_hdc, context)) { + throwException(env, "Could not bind dummy context"); + return NULL; + } + extgl_InitWGL(&extensions); + peer_info->extensions = extensions; + + // Restore previous context + wglMakeCurrent(saved_current_hdc, saved_current_hglrc); + + // + if ( extensions.WGL_ARB_create_context ) { // We support WGL_ARB_create_context, use the new context creation routine + // If we have no context to share and no special attributes, we don't have to recreate the context - wglCreateContext is equivalent to wglCreateContextAttribs(hdc,0,NULL). + if ( shared_context != NULL || attribList != NULL ) { + // Delete the oldschool context + wglDeleteContext(context); + // Create a new context using WGL_ARB_create_context + context = (HGLRC)extensions.wglCreateContextAttribsARB(peer_info->drawable_hdc, shared_context, attribList); + if (context == NULL) { + throwException(env, "Could not create context (WGL_ARB_create_context)"); + return NULL; + } + } + } else { // We don't support WGL_ARB_create_context, use the old context creation routine + if (shared_context != NULL && !wglShareLists(shared_context, context)) { // Use wglShareLists to share context data + wglDeleteContext(context); + throwException(env, "Could not share contexts"); + return NULL; + } + } + + context_info = (WindowsContext *)(*env)->GetDirectBufferAddress(env, context_handle); + context_info->context = context; + return context_handle; +} + +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsContextImplementation_getHGLRC(JNIEnv *env, jclass clazz, jobject context_handle) { + WindowsContext *context_info = (WindowsContext *)(*env)->GetDirectBufferAddress(env, context_handle); + return (intptr_t)context_info->context; +} + +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsContextImplementation_getHDC(JNIEnv *env, jclass clazz, jobject peer_info_handle) { + WindowsPeerInfo *peer_info = (WindowsPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); + return (intptr_t)peer_info->drawable_hdc; +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsContextImplementation_nSwapBuffers + (JNIEnv *env, jclass clazz, jobject peer_info_handle) { + WindowsPeerInfo *peer_info = (WindowsPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); + SwapBuffers(peer_info->drawable_hdc); +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsContextImplementation_nReleaseCurrentContext + (JNIEnv *env, jclass clazz) { + wglMakeCurrent(NULL, NULL); +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsContextImplementation_nMakeCurrent + (JNIEnv *env, jclass clazz, jobject peer_info_handle, jobject context_handle) { + WindowsContext *context_info = (WindowsContext *)(*env)->GetDirectBufferAddress(env, context_handle); + WindowsPeerInfo *peer_info = (WindowsPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); + if (!wglMakeCurrent(peer_info->drawable_hdc, context_info->context)) + throwException(env, "Could not make context current"); +} + +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_WindowsContextImplementation_nIsCurrent + (JNIEnv *env, jclass clazz, jobject context_handle) { + WindowsContext *context_info = (WindowsContext *)(*env)->GetDirectBufferAddress(env, context_handle); + return wglGetCurrentContext() == context_info->context; +} + +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_WindowsContextImplementation_nSetSwapInterval + (JNIEnv *env, jclass clazz, jint value) { + WGLExtensions extensions; + extgl_InitWGL(&extensions); + if (extensions.WGL_EXT_swap_control) { + return extensions.wglSwapIntervalEXT(value) ? JNI_TRUE : JNI_FALSE; + } else + return JNI_FALSE; +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsContextImplementation_nDestroy + (JNIEnv *env, jclass clazz, jobject context_handle) { + WindowsContext *context_info = (WindowsContext *)(*env)->GetDirectBufferAddress(env, context_handle); + wglDeleteContext(context_info->context); +} diff -Nru lwjgl-2.7.1+dfsg/src/native/windows/opengl/org_lwjgl_opengl_WindowsContextImplementation.h lwjgl-2.9.3+dfsg/src/native/windows/opengl/org_lwjgl_opengl_WindowsContextImplementation.h --- lwjgl-2.7.1+dfsg/src/native/windows/opengl/org_lwjgl_opengl_WindowsContextImplementation.h 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/windows/opengl/org_lwjgl_opengl_WindowsContextImplementation.h 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,85 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_lwjgl_opengl_WindowsContextImplementation */ + +#ifndef _Included_org_lwjgl_opengl_WindowsContextImplementation +#define _Included_org_lwjgl_opengl_WindowsContextImplementation +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: org_lwjgl_opengl_WindowsContextImplementation + * Method: nCreate + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;Ljava/nio/ByteBuffer;)Ljava/nio/ByteBuffer; + */ +JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_WindowsContextImplementation_nCreate + (JNIEnv *, jclass, jobject, jobject, jobject); + +/* + * Class: org_lwjgl_opengl_WindowsContextImplementation + * Method: getHGLRC + * Signature: (Ljava/nio/ByteBuffer;)J + */ +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsContextImplementation_getHGLRC + (JNIEnv *, jobject, jobject); + +/* + * Class: org_lwjgl_opengl_WindowsContextImplementation + * Method: getHDC + * Signature: (Ljava/nio/ByteBuffer;)J + */ +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsContextImplementation_getHDC + (JNIEnv *, jobject, jobject); + +/* + * Class: org_lwjgl_opengl_WindowsContextImplementation + * Method: nSwapBuffers + * Signature: (Ljava/nio/ByteBuffer;)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsContextImplementation_nSwapBuffers + (JNIEnv *, jclass, jobject); + +/* + * Class: org_lwjgl_opengl_WindowsContextImplementation + * Method: nReleaseCurrentContext + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsContextImplementation_nReleaseCurrentContext + (JNIEnv *, jclass); + +/* + * Class: org_lwjgl_opengl_WindowsContextImplementation + * Method: nMakeCurrent + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/ByteBuffer;)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsContextImplementation_nMakeCurrent + (JNIEnv *, jclass, jobject, jobject); + +/* + * Class: org_lwjgl_opengl_WindowsContextImplementation + * Method: nIsCurrent + * Signature: (Ljava/nio/ByteBuffer;)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_WindowsContextImplementation_nIsCurrent + (JNIEnv *, jclass, jobject); + +/* + * Class: org_lwjgl_opengl_WindowsContextImplementation + * Method: nSetSwapInterval + * Signature: (I)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_WindowsContextImplementation_nSetSwapInterval + (JNIEnv *, jclass, jint); + +/* + * Class: org_lwjgl_opengl_WindowsContextImplementation + * Method: nDestroy + * Signature: (Ljava/nio/ByteBuffer;)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsContextImplementation_nDestroy + (JNIEnv *, jclass, jobject); + +#ifdef __cplusplus +} +#endif +#endif diff -Nru lwjgl-2.7.1+dfsg/src/native/windows/opengl/org_lwjgl_opengl_WindowsPbufferPeerInfo.h lwjgl-2.9.3+dfsg/src/native/windows/opengl/org_lwjgl_opengl_WindowsPbufferPeerInfo.h --- lwjgl-2.7.1+dfsg/src/native/windows/opengl/org_lwjgl_opengl_WindowsPbufferPeerInfo.h 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/windows/opengl/org_lwjgl_opengl_WindowsPbufferPeerInfo.h 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,61 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_lwjgl_opengl_WindowsPbufferPeerInfo */ + +#ifndef _Included_org_lwjgl_opengl_WindowsPbufferPeerInfo +#define _Included_org_lwjgl_opengl_WindowsPbufferPeerInfo +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: org_lwjgl_opengl_WindowsPbufferPeerInfo + * Method: nCreate + * Signature: (Ljava/nio/ByteBuffer;IILorg/lwjgl/opengl/PixelFormat;Ljava/nio/IntBuffer;Ljava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsPbufferPeerInfo_nCreate + (JNIEnv *, jclass, jobject, jint, jint, jobject, jobject, jobject); + +/* + * Class: org_lwjgl_opengl_WindowsPbufferPeerInfo + * Method: nIsBufferLost + * Signature: (Ljava/nio/ByteBuffer;)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_WindowsPbufferPeerInfo_nIsBufferLost + (JNIEnv *, jclass, jobject); + +/* + * Class: org_lwjgl_opengl_WindowsPbufferPeerInfo + * Method: nSetPbufferAttrib + * Signature: (Ljava/nio/ByteBuffer;II)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsPbufferPeerInfo_nSetPbufferAttrib + (JNIEnv *, jclass, jobject, jint, jint); + +/* + * Class: org_lwjgl_opengl_WindowsPbufferPeerInfo + * Method: nBindTexImageToPbuffer + * Signature: (Ljava/nio/ByteBuffer;I)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsPbufferPeerInfo_nBindTexImageToPbuffer + (JNIEnv *, jclass, jobject, jint); + +/* + * Class: org_lwjgl_opengl_WindowsPbufferPeerInfo + * Method: nReleaseTexImageFromPbuffer + * Signature: (Ljava/nio/ByteBuffer;I)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsPbufferPeerInfo_nReleaseTexImageFromPbuffer + (JNIEnv *, jclass, jobject, jint); + +/* + * Class: org_lwjgl_opengl_WindowsPbufferPeerInfo + * Method: nDestroy + * Signature: (Ljava/nio/ByteBuffer;)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsPbufferPeerInfo_nDestroy + (JNIEnv *, jclass, jobject); + +#ifdef __cplusplus +} +#endif +#endif diff -Nru lwjgl-2.7.1+dfsg/src/native/windows/opengl/org_lwjgl_opengl_WindowsPeerInfo.c lwjgl-2.9.3+dfsg/src/native/windows/opengl/org_lwjgl_opengl_WindowsPeerInfo.c --- lwjgl-2.7.1+dfsg/src/native/windows/opengl/org_lwjgl_opengl_WindowsPeerInfo.c 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/windows/opengl/org_lwjgl_opengl_WindowsPeerInfo.c 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * $Id$ + * + * @author elias_naur + * @version $Revision$ + */ + +#include +#include "org_lwjgl_opengl_WindowsPeerInfo.h" +#include "context.h" +#include "common_tools.h" + +JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_WindowsPeerInfo_createHandle(JNIEnv *env, jclass clazz) { + return newJavaManagedByteBuffer(env, sizeof(WindowsPeerInfo)); +} + +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_WindowsPeerInfo_nChoosePixelFormat + (JNIEnv *env, jclass clazz, jlong hdc_ptr, jint origin_x, jint origin_y, jobject pixel_format, jobject pixel_format_caps, jboolean use_hdc_bpp, jboolean window, jboolean pbuffer, jboolean double_buffer) { + HDC hdc = (HDC)(INT_PTR)hdc_ptr; + return findPixelFormatOnDC(env, hdc, origin_x, origin_y, pixel_format, pixel_format_caps, use_hdc_bpp, window, pbuffer, double_buffer); +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsPeerInfo_setPixelFormat + (JNIEnv *env, jclass clazz, jlong hdc_ptr, jint pixel_format) { + HDC hdc = (HDC)(INT_PTR)hdc_ptr; + applyPixelFormat(env, hdc, pixel_format); +} + +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsPeerInfo_nGetHdc(JNIEnv *env, jclass unused, jobject peer_info_handle) { + WindowsPeerInfo *peer_info = (WindowsPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); + return (intptr_t)peer_info->drawable_hdc; +} + +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsPeerInfo_nGetHwnd(JNIEnv *env, jclass unused, jobject peer_info_handle) { + WindowsPeerInfo *peer_info = (WindowsPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); + return (intptr_t)peer_info->u.hwnd; +} diff -Nru lwjgl-2.7.1+dfsg/src/native/windows/opengl/org_lwjgl_opengl_WindowsPeerInfo.h lwjgl-2.9.3+dfsg/src/native/windows/opengl/org_lwjgl_opengl_WindowsPeerInfo.h --- lwjgl-2.7.1+dfsg/src/native/windows/opengl/org_lwjgl_opengl_WindowsPeerInfo.h 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/windows/opengl/org_lwjgl_opengl_WindowsPeerInfo.h 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,53 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_lwjgl_opengl_WindowsPeerInfo */ + +#ifndef _Included_org_lwjgl_opengl_WindowsPeerInfo +#define _Included_org_lwjgl_opengl_WindowsPeerInfo +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: org_lwjgl_opengl_WindowsPeerInfo + * Method: createHandle + * Signature: ()Ljava/nio/ByteBuffer; + */ +JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_WindowsPeerInfo_createHandle + (JNIEnv *, jclass); + +/* + * Class: org_lwjgl_opengl_WindowsPeerInfo + * Method: nChoosePixelFormat + * Signature: (JIILorg/lwjgl/opengl/PixelFormat;Ljava/nio/IntBuffer;ZZZZ)I + */ +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_WindowsPeerInfo_nChoosePixelFormat + (JNIEnv *, jclass, jlong, jint, jint, jobject, jobject, jboolean, jboolean, jboolean, jboolean); + +/* + * Class: org_lwjgl_opengl_WindowsPeerInfo + * Method: setPixelFormat + * Signature: (JI)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsPeerInfo_setPixelFormat + (JNIEnv *, jclass, jlong, jint); + +/* + * Class: org_lwjgl_opengl_WindowsPeerInfo + * Method: nGetHdc + * Signature: (Ljava/nio/ByteBuffer;)J + */ +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsPeerInfo_nGetHdc + (JNIEnv *, jclass, jobject); + +/* + * Class: org_lwjgl_opengl_WindowsPeerInfo + * Method: nGetHwnd + * Signature: (Ljava/nio/ByteBuffer;)J + */ +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsPeerInfo_nGetHwnd + (JNIEnv *, jclass, jobject); + +#ifdef __cplusplus +} +#endif +#endif diff -Nru lwjgl-2.7.1+dfsg/src/native/windows/opengl/WGL.c lwjgl-2.9.3+dfsg/src/native/windows/opengl/WGL.c --- lwjgl-2.7.1+dfsg/src/native/windows/opengl/WGL.c 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/windows/opengl/WGL.c 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * WGL extension implementations. + * + * @author Spasi + */ +#include "WGL.h" + +/* NV_present_video functions */ + +jint extgl_EnumerateVideoDevicesNV(JNIEnv *env, jobject peer_info_handle, jobject devices, jint devices_position) { + WindowsPeerInfo *peer_info = (WindowsPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); + HVIDEOOUTPUTDEVICENV *devices_address = ((HVIDEOOUTPUTDEVICENV *)safeGetBufferAddress(env, devices)) + devices_position; + + return peer_info->extensions.wglEnumerateVideoDevicesNV(peer_info->drawable_hdc, devices_address); +} + +jboolean extgl_BindVideoDeviceNV(JNIEnv *env, jobject peer_info_handle, jint video_slot, jlong video_device, jobject attrib_list, jint attrib_list_position) { + WindowsPeerInfo *peer_info = (WindowsPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); + const int *attrib_list_address = ((const int *)safeGetBufferAddress(env, attrib_list)) + attrib_list_position; + + return peer_info->extensions.wglBindVideoDeviceNV(peer_info->drawable_hdc, video_slot, video_device == 0 ? INVALID_HANDLE_VALUE : (HVIDEOOUTPUTDEVICENV)(intptr_t)video_device, attrib_list_address); +} + +jboolean extgl_QueryContextNV(JNIEnv *env, jobject peer_info_handle, jobject context_handle, jint attrib, jobject value, jint value_position) { + WindowsPeerInfo *peer_info = (WindowsPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); + int *value_address = ((int *)(*env)->GetDirectBufferAddress(env, value)) + value_position; + + return peer_info->extensions.wglQueryCurrentContextNV(attrib, value_address); +} + +/* NV_video_capture functions */ + +jboolean extgl_BindVideoCaptureDeviceNV(JNIEnv *env, jobject peer_info_handle, jint video_slot, jlong device) { + WindowsPeerInfo *peer_info = (WindowsPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); + + return peer_info->extensions.wglBindVideoCaptureDeviceNV(video_slot, (HVIDEOINPUTDEVICENV)(intptr_t)device); +} + +jint extgl_EnumerateVideoCaptureDevicesNV(JNIEnv *env, jobject peer_info_handle, jobject devices, jint devices_position) { + WindowsPeerInfo *peer_info = (WindowsPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); + HVIDEOINPUTDEVICENV *devices_address = ((HVIDEOINPUTDEVICENV *)safeGetBufferAddress(env, devices)) + devices_position; + + return peer_info->extensions.wglEnumerateVideoCaptureDevicesNV(peer_info->drawable_hdc, devices_address); +} + +jboolean extgl_LockVideoCaptureDeviceNV(JNIEnv *env, jobject peer_info_handle, jlong device) { + WindowsPeerInfo *peer_info = (WindowsPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); + + return peer_info->extensions.wglLockVideoCaptureDeviceNV(peer_info->drawable_hdc, (HVIDEOINPUTDEVICENV)(intptr_t)device); +} + +jboolean extgl_QueryVideoCaptureDeviceNV(JNIEnv *env, jobject peer_info_handle, jlong device, jint attribute, jobject value, jint value_position) { + WindowsPeerInfo *peer_info = (WindowsPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); + int *value_address = ((int *)(*env)->GetDirectBufferAddress(env, value)) + value_position; + + return peer_info->extensions.wglQueryVideoCaptureDeviceNV(peer_info->drawable_hdc, (HVIDEOINPUTDEVICENV)(intptr_t)device, attribute, value_address); +} + +jboolean extgl_ReleaseVideoCaptureDeviceNV(JNIEnv *env, jobject peer_info_handle, jlong device) { + WindowsPeerInfo *peer_info = (WindowsPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); + + return peer_info->extensions.wglReleaseVideoCaptureDeviceNV(peer_info->drawable_hdc, (HVIDEOINPUTDEVICENV)(intptr_t)device); +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/native/windows/opengl/WGL.h lwjgl-2.9.3+dfsg/src/native/windows/opengl/WGL.h --- lwjgl-2.7.1+dfsg/src/native/windows/opengl/WGL.h 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/windows/opengl/WGL.h 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * WGL extension implementations. + * + * @author Spasi + */ +#ifndef __LWJGL_WGL_H +#define __LWJGL_WGL_H + +#include +#include "common_tools.h" +#include "context.h" + +#include "extgl.h" +#include "extgl_wgl.h" + +/* NV_present_video functions */ +extern jint extgl_EnumerateVideoDevicesNV(JNIEnv *env, jobject peer_info_handle, jobject devices, jint devices_position); +extern jboolean extgl_BindVideoDeviceNV(JNIEnv *env, jobject peer_info_handle, jint video_slot, jlong video_device, jobject attrib_list, jint attrib_list_position); +extern jboolean extgl_QueryContextNV(JNIEnv *env, jobject peer_info_handle, jobject context_handle, jint attrib, jobject value, jint value_position); + +/* NV_video_capture functions */ +extern jboolean extgl_BindVideoCaptureDeviceNV(JNIEnv *env, jobject peer_info_handle, jint video_slot, jlong device); +extern jint extgl_EnumerateVideoCaptureDevicesNV(JNIEnv *env, jobject peer_info_handle, jobject devices, jint devices_position); +extern jboolean extgl_LockVideoCaptureDeviceNV(JNIEnv *env, jobject peer_info_handle, jlong device); +extern jboolean extgl_QueryVideoCaptureDeviceNV(JNIEnv *env, jobject peer_info_handle, jlong device, jint attribute, jobject value, jint value_position); +extern jboolean extgl_ReleaseVideoCaptureDeviceNV(JNIEnv *env, jobject peer_info_handle, jlong device); + +#endif \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/native/windows/opengles/context.c lwjgl-2.9.3+dfsg/src/native/windows/opengles/context.c --- lwjgl-2.7.1+dfsg/src/native/windows/opengles/context.c 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/windows/opengles/context.c 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,507 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * $Id: context.c -1 $ + * + * @author elias_naue + * @version $Revision: -1 $ + */ + +#include +#include "Window.h" +#include "extgl.h" +/*#include "extgl_wgl.h"*/ +#include "context.h" + +extern HINSTANCE dll_handle; // Handle to the LWJGL dll + +#define _CONTEXT_PRIVATE_CLASS_NAME _T("__lwjgl_context_class_name") + +/* + * Register the LWJGL window class. + * Returns true for success, or false for failure + */ +bool registerWindow(WNDPROC win_proc, LPCTSTR class_name) +{ + WNDCLASS windowClass; + memset(&windowClass, 0, sizeof(windowClass)); + windowClass.style = CS_OWNDC; + windowClass.lpfnWndProc = win_proc; + windowClass.cbClsExtra = 0; + windowClass.cbWndExtra = 0; + windowClass.hInstance = dll_handle; + windowClass.hIcon = LoadIcon(NULL, IDI_APPLICATION); + windowClass.hCursor = LoadCursor(NULL, IDC_ARROW); + windowClass.hbrBackground = NULL; + windowClass.lpszMenuName = NULL; + windowClass.lpszClassName = class_name; + + if (RegisterClass(&windowClass) == 0) { + printfDebug("Failed to register window class\n"); + return false; + } + return true; +} + +static LRESULT CALLBACK dummyWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { + return DefWindowProc(hwnd, msg, wParam, lParam); +} + +/* +bool applyPixelFormat(JNIEnv *env, HDC hdc, int iPixelFormat) { + PIXELFORMATDESCRIPTOR desc; + if (DescribePixelFormat(hdc, iPixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &desc) == 0) { + throwFormattedException(env, "DescribePixelFormat failed (%d)", GetLastError()); + return false; + } + + // make that the pixel format of the device context + if (SetPixelFormat(hdc, iPixelFormat, &desc) == FALSE) { + throwFormattedException(env, "SetPixelFormat failed (%d)", GetLastError()); + return false; + } + return true; +} +*/ + +/* + * Close the window + */ +void closeWindow(HWND *hwnd, HDC *hdc) +{ + // Release device context + if (*hdc != NULL && *hwnd != NULL) { + ReleaseDC(*hwnd, *hdc); + *hdc = NULL; + } + + // Close the window + if (*hwnd != NULL) { + ShowWindow(*hwnd, SW_HIDE); + DestroyWindow(*hwnd); + *hwnd = NULL; + } +} + +void getWindowFlags(DWORD *windowflags_return, DWORD *exstyle_return, bool undecorated, bool child_window) { + DWORD exstyle, windowflags; + if (undecorated) { + exstyle = WS_EX_APPWINDOW; + windowflags = WS_POPUP; + } else if (child_window) { + exstyle = 0; + windowflags = WS_CHILDWINDOW; + } else { + exstyle = WS_EX_APPWINDOW; + windowflags = WS_OVERLAPPED | WS_BORDER | WS_CAPTION | WS_MINIMIZEBOX | WS_SYSMENU; + } + windowflags = windowflags | WS_CLIPCHILDREN | WS_CLIPSIBLINGS; + *windowflags_return = windowflags; + *exstyle_return = exstyle; +} + +HWND createWindow(LPCTSTR window_class_name, int x, int y, int width, int height, bool undecorated, bool child_window, HWND parent) +{ + RECT clientSize; + DWORD exstyle, windowflags; + HWND new_hwnd; + + getWindowFlags(&windowflags, &exstyle, undecorated, child_window); + + clientSize.bottom = height; + clientSize.left = 0; + clientSize.right = width; + clientSize.top = 0; + + AdjustWindowRectEx( + &clientSize, // client-rectangle structure + windowflags, // window styles + FALSE, // menu-present option + exstyle // extended window style + ); + // Create the window now, using that class: + new_hwnd = CreateWindowEx ( + exstyle, + window_class_name, + _T(""), + windowflags, + x, y, clientSize.right - clientSize.left, clientSize.bottom - clientSize.top, + parent, + NULL, + dll_handle, + NULL); + + return new_hwnd; +} + +/* +static int convertToBPE(int bpp) { + int bpe; + switch (bpp) { + case 0: + bpe = 0; + break; + case 32: + case 24: + bpe = 8; + break; + case 16: // Fall through + default: + bpe = 4; + break; + } + return bpe; +} +*/ + +/* +static int findPixelFormatARBFromBPP(JNIEnv *env, HDC hdc, WGLExtensions *extensions, jobject pixel_format, jobject pixelFormatCaps, int bpp, bool window, bool pbuffer, bool double_buffer) { + jclass cls_pixel_format = (*env)->GetObjectClass(env, pixel_format); + int alpha = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "alpha", "I")); + int depth = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "depth", "I")); + int stencil = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "stencil", "I")); + int samples = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "samples", "I")); + int colorSamples = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "colorSamples", "I")); + int num_aux_buffers = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "num_aux_buffers", "I")); + int accum_bpp = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "accum_bpp", "I")); + int accum_alpha = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "accum_alpha", "I")); + + jboolean stereo = (*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "stereo", "Z")); + jboolean floating_point = (*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "floating_point", "Z")); + jboolean floating_point_packed = (*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "floating_point_packed", "Z")); + jboolean sRGB = (*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "sRGB", "Z")); + + int pixel_type; + int iPixelFormat; + unsigned int num_formats_returned; + attrib_list_t attrib_list; + GLuint *pixelFormatCaps_ptr; + jlong pixelFormatCapsSize; + BOOL result; + jlong i; + int bpe = convertToBPE(bpp); + + if ( floating_point ) + pixel_type = WGL_TYPE_RGBA_FLOAT_ARB; + else if ( floating_point_packed ) + pixel_type = WGL_TYPE_RGBA_UNSIGNED_FLOAT_EXT; + else + pixel_type = WGL_TYPE_RGBA_ARB; + + initAttribList(&attrib_list); + if (window) { + putAttrib(&attrib_list, WGL_DRAW_TO_WINDOW_ARB); putAttrib(&attrib_list, TRUE); + } + if (pbuffer) { + putAttrib(&attrib_list, WGL_DRAW_TO_PBUFFER_ARB); putAttrib(&attrib_list, TRUE); + } + if (!getBooleanProperty(env, "org.lwjgl.opengl.Display.allowSoftwareOpenGL")) { + putAttrib(&attrib_list, WGL_ACCELERATION_ARB); putAttrib(&attrib_list, WGL_FULL_ACCELERATION_ARB); + } + putAttrib(&attrib_list, WGL_PIXEL_TYPE_ARB); putAttrib(&attrib_list, pixel_type); + putAttrib(&attrib_list, WGL_DOUBLE_BUFFER_ARB); putAttrib(&attrib_list, double_buffer ? TRUE : FALSE); + putAttrib(&attrib_list, WGL_SUPPORT_OPENGL_ARB); putAttrib(&attrib_list, TRUE); + putAttrib(&attrib_list, WGL_RED_BITS_ARB); putAttrib(&attrib_list, bpe); + putAttrib(&attrib_list, WGL_GREEN_BITS_ARB); putAttrib(&attrib_list, bpe); + putAttrib(&attrib_list, WGL_BLUE_BITS_ARB); putAttrib(&attrib_list, bpe); + putAttrib(&attrib_list, WGL_ALPHA_BITS_ARB); putAttrib(&attrib_list, alpha); + putAttrib(&attrib_list, WGL_DEPTH_BITS_ARB); putAttrib(&attrib_list, depth); + putAttrib(&attrib_list, WGL_STENCIL_BITS_ARB); putAttrib(&attrib_list, stencil); + // Assume caller checked extension availability + if (samples > 0) { + putAttrib(&attrib_list, WGL_SAMPLE_BUFFERS_ARB); putAttrib(&attrib_list, 1); + putAttrib(&attrib_list, WGL_SAMPLES_ARB); putAttrib(&attrib_list, samples); // WGL_COVERAGE_SAMPLES_NV if colorSamples > 0 + if ( colorSamples > 0 ) { + putAttrib(&attrib_list, WGL_COLOR_SAMPLES_NV); putAttrib(&attrib_list, colorSamples); + } + } + putAttrib(&attrib_list, WGL_ACCUM_BITS_ARB); putAttrib(&attrib_list, accum_bpp); + putAttrib(&attrib_list, WGL_ACCUM_ALPHA_BITS_ARB); putAttrib(&attrib_list, accum_alpha); + putAttrib(&attrib_list, WGL_STEREO_ARB); putAttrib(&attrib_list, stereo ? TRUE : FALSE); + putAttrib(&attrib_list, WGL_AUX_BUFFERS_ARB); putAttrib(&attrib_list, num_aux_buffers); + if (sRGB) { + putAttrib(&attrib_list, WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB); putAttrib(&attrib_list, TRUE); + } + + // Assume caller checked extension availability + if (pixelFormatCaps != NULL) { + pixelFormatCaps_ptr = (GLuint *)(*env)->GetDirectBufferAddress(env, pixelFormatCaps); + pixelFormatCapsSize = (*env)->GetDirectBufferCapacity(env, pixelFormatCaps); + + for (i = 0; i < pixelFormatCapsSize; i++) + putAttrib(&attrib_list, pixelFormatCaps_ptr[i]); + } + putAttrib(&attrib_list, 0); putAttrib(&attrib_list, 0); + result = extensions->wglChoosePixelFormatARB(hdc, attrib_list.attribs, NULL, 1, &iPixelFormat, &num_formats_returned); + + if (result == FALSE || num_formats_returned < 1) { + throwFormattedException(env, "Failed to find ARB pixel format %d %d\n", result, num_formats_returned); + return -1; + } + return iPixelFormat; +} + +static int findPixelFormatARB(JNIEnv *env, HDC hdc, WGLExtensions *extensions, jobject pixel_format, jobject pixelFormatCaps, bool use_hdc_bpp, bool window, bool pbuffer, bool double_buffer) { + int bpp; + int iPixelFormat; + int fallback_bpp = 16; + jclass cls_pixel_format = (*env)->GetObjectClass(env, pixel_format); + if (use_hdc_bpp) { + bpp = GetDeviceCaps(hdc, BITSPIXEL); + iPixelFormat = findPixelFormatARBFromBPP(env, hdc, extensions, pixel_format, pixelFormatCaps, bpp, window, pbuffer, double_buffer); + if ((*env)->ExceptionOccurred(env)) { + (*env)->ExceptionClear(env); + printfDebugJava(env, "Failed to find ARB pixel format with HDC depth %d, falling back to %d\n", bpp, fallback_bpp); + bpp = fallback_bpp; + } else + return iPixelFormat; + } else + bpp = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "bpp", "I")); + return findPixelFormatARBFromBPP(env, hdc, extensions, pixel_format, pixelFormatCaps, bpp, window, pbuffer, double_buffer); +} +*/ + +/* + * Find an appropriate pixel format + */ + /* +static int findPixelFormatFromBPP(JNIEnv *env, HDC hdc, jobject pixel_format, int bpp, bool double_buffer) +{ + jclass cls_pixel_format = (*env)->GetObjectClass(env, pixel_format); + int alpha = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "alpha", "I")); + int depth = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "depth", "I")); + int stencil = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "stencil", "I")); + int num_aux_buffers = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "num_aux_buffers", "I")); + int accum_bpp = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "accum_bpp", "I")); + int accum_alpha = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "accum_alpha", "I")); + jboolean stereo = (*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "stereo", "Z")); + unsigned int flags = PFD_DRAW_TO_WINDOW | // support window + PFD_SUPPORT_OPENGL | + (double_buffer ? PFD_DOUBLEBUFFER : 0) | + (stereo ? PFD_STEREO : 0); + PIXELFORMATDESCRIPTOR desc; + int iPixelFormat; + PIXELFORMATDESCRIPTOR pfd = { + sizeof(PIXELFORMATDESCRIPTOR), // size of this pfd + 1, // version number + flags, // RGBA type + PFD_TYPE_RGBA, + (BYTE)bpp, + 0, 0, 0, 0, 0, 0, // color bits ignored + (BYTE)alpha, + 0, // shift bit ignored + accum_bpp + accum_alpha, // no accumulation buffer + 0, 0, 0, 0, // accum bits ignored + (BYTE)depth, + (BYTE)stencil, + num_aux_buffers, + PFD_MAIN_PLANE, // main layer + 0, // reserved + 0, 0, 0 // layer masks ignored + }; + // get the best available match of pixel format for the device context + iPixelFormat = ChoosePixelFormat(hdc, &pfd); + if (iPixelFormat == 0) { + throwException(env, "Failed to choose pixel format"); + return -1; + } + + if (DescribePixelFormat(hdc, iPixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &desc) == 0) { + throwException(env, "Could not describe pixel format"); + return -1; + } + + if (desc.cColorBits < bpp) { + throwException(env, "Insufficient color precision"); + return -1; + } + + if (desc.cAlphaBits < alpha) { + throwException(env, "Insufficient alpha precision"); + return -1; + } + + if (desc.cStencilBits < stencil) { + throwException(env, "Insufficient stencil precision"); + return -1; + } + + if (desc.cDepthBits < depth) { + throwException(env, "Insufficient depth buffer precision"); + return -1; + } + + if ((desc.dwFlags & PFD_GENERIC_FORMAT) != 0) { + jboolean allowSoftwareOpenGL = getBooleanProperty(env, "org.lwjgl.opengl.Display.allowSoftwareOpenGL"); + // secondary check for software override + if(!allowSoftwareOpenGL) { + throwException(env, "Pixel format not accelerated"); + return -1; + } + } + + if ((desc.dwFlags & flags) != flags) { + throwException(env, "Capabilities not supported"); + return -1; + } + return iPixelFormat; +} + +static int findPixelFormatDefault(JNIEnv *env, HDC hdc, jobject pixel_format, bool use_hdc_bpp, bool double_buffer) { + int bpp; + int iPixelFormat; + int fallback_bpp = 16; + jclass cls_pixel_format = (*env)->GetObjectClass(env, pixel_format); + if (use_hdc_bpp) { + bpp = GetDeviceCaps(hdc, BITSPIXEL); + iPixelFormat = findPixelFormatFromBPP(env, hdc, pixel_format, bpp, double_buffer); + if ((*env)->ExceptionOccurred(env)) { + (*env)->ExceptionClear(env); + printfDebugJava(env, "Failed to find pixel format with HDC depth %d, falling back to %d\n", bpp, fallback_bpp); + bpp = fallback_bpp; + } else + return iPixelFormat; + } else + bpp = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "bpp", "I")); + return findPixelFormatFromBPP(env, hdc, pixel_format, bpp, double_buffer); +} +*/ + +/* +static bool validateAndGetExtensions(JNIEnv *env, WGLExtensions *extensions, HDC dummy_hdc, HGLRC dummy_hglrc, int samples, int colorSamples, bool floating_point, bool floating_point_packed, bool sRGB, jobject pixelFormatCaps) { + if (!wglMakeCurrent(dummy_hdc, dummy_hglrc)) { + throwException(env, "Could not bind context to dummy window"); + return false; + } + extgl_InitWGL(extensions); + + if (!extensions->WGL_ARB_pixel_format) { + throwException(env, "No support for WGL_ARB_pixel_format"); + return false; + } + if (samples > 0 && !extensions->WGL_ARB_multisample) { + throwException(env, "No support for WGL_ARB_multisample"); + return false; + } + if (colorSamples > 0 && !extensions->WGL_NV_multisample_coverage) { + throwException(env, "No support for WGL_NV_multisample_coverage"); + return false; + } + + // Apparently, some drivers don't report WGL_ARB_pixel_format_float + // even though GL_ARB_color_buffer_float and WGL_ATI_color_format_float + // is supported. + if (floating_point && !(extensions->WGL_ARB_pixel_format_float || extensions->WGL_ATI_pixel_format_float)) { + throwException(env, "No support for WGL_ARB_pixel_format_float nor WGL_ATI_pixel_format_float"); + return false; + } + if (floating_point_packed && !(extensions->WGL_EXT_pixel_format_packed_float)) { + throwException(env, "No support for WGL_EXT_pixel_format_packed_float"); + return false; + } + if (sRGB && !(extensions->WGL_ARB_framebuffer_sRGB)) { + throwException(env, "No support for WGL_ARB_framebuffer_sRGB"); + return false; + } + if (pixelFormatCaps != NULL && !extensions->WGL_ARB_render_texture) { + throwException(env, "No support for WGL_ARB_render_texture"); + return false; + } + return true; +} + +int findPixelFormatOnDC(JNIEnv *env, HDC hdc, int origin_x, int origin_y, jobject pixel_format, jobject pixelFormatCaps, bool use_hdc_bpp, bool window, bool pbuffer, bool double_buffer) { + HGLRC dummy_hglrc; + HDC saved_current_hdc; + HGLRC saved_current_hglrc; + WGLExtensions extensions; + HWND dummy_hwnd; + HDC dummy_hdc; + int pixel_format_id; + jclass cls_pixel_format = (*env)->GetObjectClass(env, pixel_format); + + int samples = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "samples", "I")); + int colorSamples = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "colorSamples", "I")); + bool floating_point = (bool)(*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "floating_point", "Z")); + bool floating_point_packed = (bool)(*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "floating_point_packed", "Z")); + bool sRGB = (bool)(*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "sRGB", "Z")); + bool use_arb_selection = samples > 0 || floating_point || floating_point_packed || sRGB || pbuffer || pixelFormatCaps != NULL; + + pixel_format_id = findPixelFormatDefault(env, hdc, pixel_format, use_hdc_bpp, double_buffer); + if (!(*env)->ExceptionOccurred(env) && use_arb_selection) { + dummy_hwnd = createDummyWindow(origin_x, origin_y); + if (dummy_hwnd == NULL) { + throwException(env, "Could not create dummy window"); + return -1; + } + dummy_hdc = GetDC(dummy_hwnd); + if (!applyPixelFormat(env, dummy_hdc, pixel_format_id)) { + closeWindow(&dummy_hwnd, &dummy_hdc); + return -1; + } + dummy_hglrc = wglCreateContext(dummy_hdc); + if (dummy_hglrc == NULL) { + closeWindow(&dummy_hwnd, &dummy_hdc); + throwException(env, "Failed to create OpenGL rendering context"); + return -1; + } + // Save the current HDC and HGLRC to avoid disruption + saved_current_hdc = wglGetCurrentDC(); + saved_current_hglrc = wglGetCurrentContext(); + if (validateAndGetExtensions(env, &extensions, dummy_hdc, dummy_hglrc, samples, colorSamples, floating_point, floating_point_packed, sRGB, pixelFormatCaps)) { + pixel_format_id = findPixelFormatARB(env, hdc, &extensions, pixel_format, pixelFormatCaps, use_hdc_bpp, window, pbuffer, double_buffer); + } + wglMakeCurrent(saved_current_hdc, saved_current_hglrc); + wglDeleteContext(dummy_hglrc); + closeWindow(&dummy_hwnd, &dummy_hdc); + } + return pixel_format_id; +} +*/ + +static bool registerDummyWindow() { + static bool window_registered = false; + if (!window_registered) { + if (!registerWindow(dummyWindowProc, _CONTEXT_PRIVATE_CLASS_NAME)) { + return false; + } + window_registered = true; + } + return true; +} + +HWND createDummyWindow(int origin_x, int origin_y) { + if (!registerDummyWindow()) + return NULL; + return createWindow(_CONTEXT_PRIVATE_CLASS_NAME, origin_x, origin_y, 1, 1, false, false, NULL); +} diff -Nru lwjgl-2.7.1+dfsg/src/native/windows/opengles/context.h lwjgl-2.9.3+dfsg/src/native/windows/opengles/context.h --- lwjgl-2.7.1+dfsg/src/native/windows/opengles/context.h 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/windows/opengles/context.h 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * $Id: context.h -1 $ + * + * @author elias_naur + * @version $Revision: -1 $ + */ + +#ifndef __LWJGL_CONTEXT_H +#define __LWJGL_CONTEXT_H + +#include "Window.h" +#include "extgl.h" + +typedef struct { + union { + HWND hwnd; + } u; + HDC drawable_hdc; +} WindowsPeerInfo; + +/* + * Register the LWJGL window class. + * Returns true for success, or false for failure + */ +extern bool registerWindow(WNDPROC win_proc, LPCTSTR class_name); + +//extern bool applyPixelFormat(JNIEnv *env, HDC hdc, int iPixelFormat); + +/* + * Close the window + */ +extern void closeWindow(HWND *hwnd, HDC *hdc); + +/** + * Create a dummy window suitable to create contexts from + */ +extern HWND createDummyWindow(int x, int y); + +/** + * Return appropriate window and extended style flags from the given fullscreen and undecorated property + */ +extern void getWindowFlags(DWORD *windowflags_return, DWORD *exstyle_return, bool undecorated, bool child_window); + +/* + * Create a window with the specified position, size, and + * fullscreen attribute. The window will have DirectInput associated + * with it. + * + * Returns true for success, or false for failure + */ +extern HWND createWindow(LPCTSTR window_class_name, int x, int y, int width, int height, bool undecorated, bool child_window, HWND parent); + +//extern int findPixelFormatOnDC(JNIEnv *env, HDC hdc, int origin_x, int origin_y, jobject pixel_format, jobject pixelFormatCaps, bool use_hdc_bpp, bool window, bool pbuffer, bool double_buffer); + +#endif diff -Nru lwjgl-2.7.1+dfsg/src/native/windows/opengles/extgl_wgl.c lwjgl-2.9.3+dfsg/src/native/windows/opengles/extgl_wgl.c --- lwjgl-2.7.1+dfsg/src/native/windows/opengles/extgl_wgl.c 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/windows/opengles/extgl_wgl.c 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,70 @@ +/* ---------------------------------------------------------------------------- +Copyright (c) 2001-2002, Lev Povalahev +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * The name of the author may be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF +THE POSSIBILITY OF SUCH DAMAGE. +------------------------------------------------------------------------------*/ +/* + Lev Povalahev + + levp@gmx.net + + http://www.uni-karlsruhe.de/~uli2/ + +*/ + +#include +#include +#include "extgl.h" + +static HMODULE lib_gl_handle = NULL; + +void *extgl_GetProcAddress(const char *name) { + void *t = eglGetProcAddress(name); + if (t == NULL) + { + t = GetProcAddress(lib_gl_handle, name); + if (t == NULL) + { + printfDebug("Could not locate symbol %s\n", name); + } + } + return t; +} + +bool extgl_Open(JNIEnv *env) { + if (lib_gl_handle != NULL) + return true; + // load the dynamic libraries for OpenGL + lib_gl_handle = LoadLibrary("libGLESv2.dll"); + if (lib_gl_handle == NULL) { + throwException(env, "Could not load OpenGL ES library"); + return false; + } + return true; +} + +void extgl_Close(void) { + FreeLibrary(lib_gl_handle); + lib_gl_handle = NULL; +} diff -Nru lwjgl-2.7.1+dfsg/src/native/windows/opengles/org_lwjgl_opengl_WindowsPeerInfo.c lwjgl-2.9.3+dfsg/src/native/windows/opengles/org_lwjgl_opengl_WindowsPeerInfo.c --- lwjgl-2.7.1+dfsg/src/native/windows/opengles/org_lwjgl_opengl_WindowsPeerInfo.c 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/windows/opengles/org_lwjgl_opengl_WindowsPeerInfo.c 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * $Id: org_lwjgl_opengl_WindowsPeerInfo.c -1 $ + * + * @author elias_naur + * @version $Revision: -1 $ + */ + +#include +#include "org_lwjgl_opengl_WindowsPeerInfo.h" +#include "context.h" +#include "common_tools.h" + +JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_WindowsPeerInfo_createHandle(JNIEnv *env, jclass clazz) { + return newJavaManagedByteBuffer(env, sizeof(WindowsPeerInfo)); +} + +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsPeerInfo_nGetHdc(JNIEnv *env, jclass unused, jobject peer_info_handle) { + WindowsPeerInfo *peer_info = (WindowsPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); + return (intptr_t)peer_info->drawable_hdc; +} + +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsPeerInfo_nGetHwnd(JNIEnv *env, jclass unused, jobject peer_info_handle) { + WindowsPeerInfo *peer_info = (WindowsPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); + return (intptr_t)peer_info->u.hwnd; +} diff -Nru lwjgl-2.7.1+dfsg/src/native/windows/opengles/org_lwjgl_opengl_WindowsPeerInfo.h lwjgl-2.9.3+dfsg/src/native/windows/opengles/org_lwjgl_opengl_WindowsPeerInfo.h --- lwjgl-2.7.1+dfsg/src/native/windows/opengles/org_lwjgl_opengl_WindowsPeerInfo.h 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/windows/opengles/org_lwjgl_opengl_WindowsPeerInfo.h 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,53 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_lwjgl_opengl_WindowsPeerInfo */ + +#ifndef _Included_org_lwjgl_opengl_WindowsPeerInfo +#define _Included_org_lwjgl_opengl_WindowsPeerInfo +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: org_lwjgl_opengl_WindowsPeerInfo + * Method: createHandle + * Signature: ()Ljava/nio/ByteBuffer; + */ +JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_WindowsPeerInfo_createHandle + (JNIEnv *, jclass); + +/* + * Class: org_lwjgl_opengl_WindowsPeerInfo + * Method: nChoosePixelFormat + * Signature: (JIILorg/lwjgl/opengl/PixelFormat;Ljava/nio/IntBuffer;ZZZZ)I + */ +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_WindowsPeerInfo_nChoosePixelFormat + (JNIEnv *, jclass, jlong, jint, jint, jobject, jobject, jboolean, jboolean, jboolean, jboolean); + +/* + * Class: org_lwjgl_opengl_WindowsPeerInfo + * Method: setPixelFormat + * Signature: (JI)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsPeerInfo_setPixelFormat + (JNIEnv *, jclass, jlong, jint); + +/* + * Class: org_lwjgl_opengl_WindowsPeerInfo + * Method: nGetHdc + * Signature: (Ljava/nio/ByteBuffer;)J + */ +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsPeerInfo_nGetHdc + (JNIEnv *, jclass, jobject); + +/* + * Class: org_lwjgl_opengl_WindowsPeerInfo + * Method: nGetHwnd + * Signature: (Ljava/nio/ByteBuffer;)J + */ +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsPeerInfo_nGetHwnd + (JNIEnv *, jclass, jobject); + +#ifdef __cplusplus +} +#endif +#endif diff -Nru lwjgl-2.7.1+dfsg/src/native/windows/org_lwjgl_input_Cursor.c lwjgl-2.9.3+dfsg/src/native/windows/org_lwjgl_input_Cursor.c --- lwjgl-2.7.1+dfsg/src/native/windows/org_lwjgl_input_Cursor.c 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/windows/org_lwjgl_input_Cursor.c 2016-04-09 16:26:57.000000000 +0000 @@ -31,12 +31,12 @@ */ /** - * $Id: org_lwjgl_input_Cursor.c 3263 2010-01-10 22:46:41Z matzon $ + * $Id$ * * win32 mouse handling. * * @author elias_naur - * @version $Revision: 3263 $ + * @version $Revision$ */ #include "Window.h" diff -Nru lwjgl-2.7.1+dfsg/src/native/windows/org_lwjgl_opengl_Display.c lwjgl-2.9.3+dfsg/src/native/windows/org_lwjgl_opengl_Display.c --- lwjgl-2.7.1+dfsg/src/native/windows/org_lwjgl_opengl_Display.c 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/windows/org_lwjgl_opengl_Display.c 2016-04-09 16:26:57.000000000 +0000 @@ -1,49 +1,49 @@ -/* +/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are + * modification, are permitted provided that the following conditions are * met: - * - * * Redistributions of source code must retain the above copyright + * + * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * * Neither the name of 'LWJGL' nor the names of - * its contributors may be used to endorse or promote products derived + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + /** - * $Id: org_lwjgl_opengl_Display.c 3302 2010-03-31 23:56:24Z spasi $ + * $Id$ * * Base Windows display * * @author cix_foo - * @version $Revision: 3302 $ + * @version $Revision$ */ #define _PRIVATE_WINDOW_H_ -#include #include #include "Window.h" -#include "extgl_wgl.h" +#include +/*#include "extgl_wgl.h"*/ #include "common_tools.h" #include "display.h" #include "org_lwjgl_opengl_WindowsDisplay.h" @@ -51,7 +51,10 @@ #include "context.h" #include -#define WINDOWCLASSNAME "LWJGL" +#define WINDOWCLASSNAME _T("LWJGL") + +static jclass windowsDisplayClass; +static jmethodID javaWindowProc; /* * WindowProc for the GL window. @@ -61,10 +64,12 @@ WPARAM wParam, LPARAM lParam) { + /* jclass display_class; jclass display_class_global; jmethodID handleMessage_method; LONG message_time; + */ JNIEnv *env = getThreadEnv(); if (env != NULL && !(*env)->ExceptionOccurred(env)) { /* @@ -80,6 +85,8 @@ * a window is created, where we are sure that the calling class' classloader has * LWJGL classes in it. */ + + /* display_class_global = (jclass)(LONG_PTR)GetWindowLongPtr(hWnd, GWLP_USERDATA); if (display_class_global == NULL) { display_class = (*env)->FindClass(env, "org/lwjgl/opengl/WindowsDisplay"); @@ -91,15 +98,27 @@ } if (display_class_global != NULL) { message_time = GetMessageTime(); - handleMessage_method = (*env)->GetStaticMethodID(env, display_class_global, "handleMessage", "(JIJJJ)I"); + handleMessage_method = (*env)->GetStaticMethodID(env, display_class_global, "handleMessage", "(JIJJJ)J"); if (handleMessage_method != NULL) - return (*env)->CallStaticIntMethod(env, display_class_global, handleMessage_method, (jlong)(intptr_t)hWnd, (jint)msg, (jlong)wParam, (jlong)lParam, (jlong)message_time); + return (*env)->CallStaticLongMethod(env, display_class_global, handleMessage_method, (jlong)(intptr_t)hWnd, (jint)msg, (jlong)wParam, (jlong)lParam, (jlong)message_time); + } + */ + + return (*env)->CallStaticLongMethod( + env, windowsDisplayClass, javaWindowProc, + (jlong)(intptr_t)hWnd, (jint)msg, (jlong)wParam, (jlong)lParam, (jlong)GetMessageTime() + ); } return DefWindowProc(hWnd, msg, wParam, lParam); } -JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_WindowsDisplay_defWindowProc(JNIEnv *env, jclass unused, jlong hWnd, jint msg, jlong wParam, jlong lParam) { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_setWindowProc(JNIEnv *env, jclass clazz, jobject method) { + windowsDisplayClass = (*env)->NewGlobalRef(env, clazz); + javaWindowProc = (*env)->FromReflectedMethod(env, method); +} + +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsDisplay_defWindowProc(JNIEnv *env, jclass unused, jlong hWnd, jint msg, jlong wParam, jlong lParam) { return DefWindowProc((HWND)(INT_PTR)hWnd, msg, wParam, lParam); } @@ -121,8 +140,8 @@ PM_REMOVE // removal options )) { - if (msg.message == WM_QUIT) - break; + if (msg.message == WM_QUIT) + break; TranslateMessage(&msg); DispatchMessage(&msg); } @@ -134,11 +153,9 @@ } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nSetTitle - (JNIEnv * env, jclass unused, jlong hwnd_ptr, jstring title_obj) { + (JNIEnv * env, jclass unused, jlong hwnd_ptr, jlong title) { HWND hwnd = (HWND)(INT_PTR)hwnd_ptr; - char * title = GetStringNativeChars(env, title_obj); - SetWindowText(hwnd, title); - free(title); + SetWindowText(hwnd, (LPCTSTR)(intptr_t)title); } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nUpdate(JNIEnv * env, jclass class) { @@ -201,6 +218,18 @@ buffer[1] = point.y; } + +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_WindowsDisplay_getWindowRect(JNIEnv *env, jclass unused, jlong hwnd_int, jobject buffer_handle) { + HWND hwnd = (HWND)(INT_PTR)hwnd_int; + RECT *buffer = (RECT *)(*env)->GetDirectBufferAddress(env, buffer_handle); + jlong size = (*env)->GetDirectBufferCapacity(env, buffer_handle); + if (size < 4) { + throwFormattedRuntimeException(env, "Buffer size < 4", size); + return false; + } + return GetWindowRect(hwnd, buffer); +} + JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsDisplay_getForegroundWindow(JNIEnv *env, jclass unused) { return (INT_PTR)GetForegroundWindow(); } @@ -216,10 +245,10 @@ throwFormattedRuntimeException(env, "Buffer size < 4", size); return; } - rect->top = buffer[0]; - rect->bottom = buffer[1]; - rect->left = buffer[2]; - rect->right = buffer[3]; + rect->left = buffer[0]; + rect->top = buffer[1]; + rect->right = buffer[2]; + rect->bottom = buffer[3]; } static void copyRectToBuffer(JNIEnv *env, RECT *rect, jobject buffer_handle) { @@ -229,10 +258,10 @@ throwFormattedRuntimeException(env, "Buffer size < 4", size); return; } - buffer[0] = rect->top; - buffer[1] = rect->bottom; - buffer[2] = rect->left; - buffer[3] = rect->right; + buffer[0] = rect->left; + buffer[1] = rect->top; + buffer[2] = rect->right; + buffer[3] = rect->bottom; } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_clipCursor(JNIEnv *env, jclass unused, jobject handle_buffer) { @@ -303,27 +332,24 @@ RECT clientSize; getWindowFlags(&windowflags, &exstyle, undecorated, child); - + // If we're not a fullscreen window, adjust the height to account for the // height of the title bar: clientSize.bottom = height; clientSize.left = 0; clientSize.right = width; clientSize.top = 0; - + AdjustWindowRectEx( &clientSize, // client-rectangle structure windowflags, // window styles FALSE, // menu-present option exstyle // extended window style ); - SetWindowPos(hwnd, HWND_TOP, x, y, clientSize.right - clientSize.left, clientSize.bottom - clientSize.top, SWP_NOZORDER); } static HICON createWindowIcon(JNIEnv *env, jint *pixels, jint width, jint height) { - unsigned char col; - unsigned char mask; BITMAPV5HEADER bitmapInfo; HBITMAP cursorMask; HBITMAP colorBitmap; @@ -335,11 +361,9 @@ int imageSize; unsigned char *maskPixels; int widthInBytes; - int leftShift; - int maskPixelsOff; int scanlineWidth; HBITMAP colorDIB; - + memset(&bitmapInfo, 0, sizeof(BITMAPV5HEADER)); bitmapInfo.bV5Size = sizeof(BITMAPV5HEADER); bitmapInfo.bV5Width = width; @@ -380,7 +404,7 @@ DeleteObject(colorDIB); // Convert alpha map to pixel packed mask - + // number of bytes it takes to fit a bit packed scan line. widthInBytes = (width & 0x7) != 0 ? (width >> 3) + 1 : (width >> 3); @@ -392,9 +416,9 @@ imageSize = scanlineWidth*height; maskPixels = (unsigned char*)malloc(sizeof(unsigned char)*imageSize); memset(maskPixels, 0xFF, sizeof(unsigned char)*imageSize); - + cursorMask = CreateBitmap(width, height, 1, 1, maskPixels); - + memset(&iconInfo, 0, sizeof(ICONINFO)); iconInfo.hbmMask = cursorMask; iconInfo.hbmColor = colorBitmap; @@ -427,6 +451,29 @@ return SendMessage(hwnd, (UINT)msg, (WPARAM)wparam, (LPARAM)lparam); } +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsDisplay_setWindowLongPtr + (JNIEnv *env, jclass clazz, jlong hwnd_ptr, jint nindex, jlong longPtr) { + HWND hwnd = (HWND)(INT_PTR)hwnd_ptr; + return SetWindowLongPtr(hwnd, nindex, (LONG_PTR) longPtr); +} + +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsDisplay_getWindowLongPtr + (JNIEnv *env, jclass clazz, jlong hwnd_ptr, jint nindex) { + HWND hwnd = (HWND)(INT_PTR)hwnd_ptr; + jlong result = GetWindowLongPtr(hwnd, nindex); + return result; +} + +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_WindowsDisplay_setWindowPos + (JNIEnv *env, jclass clazz, jlong hwnd_ptr, jlong hwnd_after_ptr, jint x, jint y, jint width, jint height, jlong uflags) { + jboolean result; + HWND hwnd = (HWND)(INT_PTR)hwnd_ptr; + HWND hwnd_after = (HWND)(INT_PTR)hwnd_after_ptr; + + result = SetWindowPos(hwnd, hwnd_after, x, y, width, height, (UINT) uflags); + return result; +} + JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nSetCursorPosition (JNIEnv * env, jclass unused, jint x, jint y) { if (!SetCursorPos(x, y)) @@ -441,6 +488,16 @@ copyRectToBuffer(env, &clientRect, rect_buffer); } +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_WindowsDisplay_adjustWindowRectEx + (JNIEnv *env, jclass unused, jobject rect_buffer, jint style, jboolean menu, jint styleex) { + jboolean result; + RECT clientRect; + copyBufferToRect(env, rect_buffer, &clientRect); + result = AdjustWindowRectEx(&clientRect, style, menu, styleex); + copyRectToBuffer(env, &clientRect, rect_buffer); + return result; +} + JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nSetNativeCursor (JNIEnv *env, jclass unused, jlong hwnd_int, jobject handle_buffer) { diff -Nru lwjgl-2.7.1+dfsg/src/native/windows/org_lwjgl_opengl_Pbuffer.c lwjgl-2.9.3+dfsg/src/native/windows/org_lwjgl_opengl_Pbuffer.c --- lwjgl-2.7.1+dfsg/src/native/windows/org_lwjgl_opengl_Pbuffer.c 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/windows/org_lwjgl_opengl_Pbuffer.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,212 +0,0 @@ -/* - * Copyright (c) 2002-2008 LWJGL Project - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of 'LWJGL' nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/** - * $Id: org_lwjgl_opengl_Pbuffer.c 3358 2010-06-03 15:49:26Z spasi $ - * - * Windows Pbuffer. - * - * @author elias_naur - * @version $Revision: 3358 $ - */ - -#include -#include "org_lwjgl_opengl_WindowsDisplay.h" -#include "org_lwjgl_opengl_Pbuffer.h" -#include "context.h" - -#include "extgl.h" -#include "extgl_wgl.h" - -#include "common_tools.h" - -static bool isPbufferSupported(WGLExtensions *extensions) { - return extensions->WGL_ARB_pixel_format && extensions->WGL_ARB_pbuffer; -} - -static bool getExtensions(JNIEnv *env, WGLExtensions *extensions, jobject pixel_format, jobject pixelFormatCaps) { - int origin_x = 0; int origin_y = 0; - HWND dummy_hwnd; - HDC dummy_hdc; - HGLRC dummy_context; - HDC saved_hdc; - HGLRC saved_context; - int pixel_format_id; - - dummy_hwnd = createDummyWindow(origin_x, origin_y); - if (dummy_hwnd == NULL) { - throwException(env, "Could not create dummy window"); - return false; - } - dummy_hdc = GetDC(dummy_hwnd); - pixel_format_id = findPixelFormatOnDC(env, dummy_hdc, origin_x, origin_y, pixel_format, pixelFormatCaps, false, true, false, false); - if (pixel_format_id == -1) { - closeWindow(&dummy_hwnd, &dummy_hdc); - return false; - } - if (!applyPixelFormat(env, dummy_hdc, pixel_format_id)) { - closeWindow(&dummy_hwnd, &dummy_hdc); - return false; - } - dummy_context = wglCreateContext(dummy_hdc); - if (dummy_context == NULL) { - closeWindow(&dummy_hwnd, &dummy_hdc); - throwException(env, "Could not create dummy context"); - return false; - } - saved_hdc = wglGetCurrentDC(); - saved_context = wglGetCurrentContext(); - if (!wglMakeCurrent(dummy_hdc, dummy_context)) { - wglMakeCurrent(saved_hdc, saved_context); - closeWindow(&dummy_hwnd, &dummy_hdc); - wglDeleteContext(dummy_context); - throwException(env, "Could not make dummy context current"); - return false; - } - extgl_InitWGL(extensions); - if (!wglMakeCurrent(saved_hdc, saved_context)) - printfDebugJava(env, "ERROR: Could not restore current context"); - closeWindow(&dummy_hwnd, &dummy_hdc); - wglDeleteContext(dummy_context); - return true; -} - -JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nGetPbufferCapabilities - (JNIEnv *env, jobject self, jobject pixel_format) -{ - int caps = 0; - WGLExtensions extensions; - if (!getExtensions(env, &extensions, pixel_format, NULL)) - return 0; - if (isPbufferSupported(&extensions)) - caps |= org_lwjgl_opengl_Pbuffer_PBUFFER_SUPPORTED; - - if (extensions.WGL_ARB_render_texture) - caps |= org_lwjgl_opengl_Pbuffer_RENDER_TEXTURE_SUPPORTED; - - if (extensions.WGL_NV_render_texture_rectangle) - caps |= org_lwjgl_opengl_Pbuffer_RENDER_TEXTURE_RECTANGLE_SUPPORTED; - - if (extensions.WGL_NV_render_depth_texture) - caps |= org_lwjgl_opengl_Pbuffer_RENDER_DEPTH_TEXTURE_SUPPORTED; - - return caps; -} - -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsPbufferPeerInfo_nCreate - (JNIEnv *env, jobject self, jobject peer_info_handle, - jint width, jint height, jobject pixel_format, - jobject pixelFormatCaps, jobject pBufferAttribs) -{ - int origin_x = 0; int origin_y = 0; - HWND dummy_hwnd; - HDC dummy_hdc; - HPBUFFERARB Pbuffer; - HDC Pbuffer_dc; - WGLExtensions extensions; - const int *pBufferAttribs_ptr; - WindowsPeerInfo *peer_info = (WindowsPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); - int pixel_format_id; - - if ( pBufferAttribs != NULL ) { - pBufferAttribs_ptr = (const int *)(*env)->GetDirectBufferAddress(env, pBufferAttribs); - } else { - pBufferAttribs_ptr = NULL; - } - if (!getExtensions(env, &extensions, pixel_format, pixelFormatCaps)) - return; - dummy_hwnd = createDummyWindow(origin_x, origin_y); - if (dummy_hwnd == NULL) { - throwException(env, "Could not create dummy window"); - return; - } - dummy_hdc = GetDC(dummy_hwnd); - pixel_format_id = findPixelFormatOnDC(env, dummy_hdc, origin_x, origin_y, pixel_format, pixelFormatCaps, false, false, true, false); - if (pixel_format_id == -1) { - closeWindow(&dummy_hwnd, &dummy_hdc); - return; - } - Pbuffer = extensions.wglCreatePbufferARB(dummy_hdc, pixel_format_id, width, height, pBufferAttribs_ptr); - closeWindow(&dummy_hwnd, &dummy_hdc); - if (Pbuffer == NULL) { - throwException(env, "Could not create Pbuffer"); - return; - } - Pbuffer_dc = extensions.wglGetPbufferDCARB(Pbuffer); - if (Pbuffer_dc == NULL) { - extensions.wglDestroyPbufferARB(Pbuffer); - throwException(env, "Could not get Pbuffer DC"); - return; - } - peer_info->u.pbuffer.extensions = extensions; - peer_info->u.pbuffer.pbuffer = Pbuffer; - peer_info->drawable_hdc = Pbuffer_dc; -} - -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsPbufferPeerInfo_nDestroy - (JNIEnv *env, jclass clazz, jobject peer_info_handle) { - WindowsPeerInfo *peer_info = (WindowsPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); - peer_info->u.pbuffer.extensions.wglReleasePbufferDCARB(peer_info->u.pbuffer.pbuffer, peer_info->drawable_hdc); - peer_info->u.pbuffer.extensions.wglDestroyPbufferARB(peer_info->u.pbuffer.pbuffer); -} - -JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_WindowsPbufferPeerInfo_nIsBufferLost - (JNIEnv *env, jclass clazz, jobject peer_info_handle) { - WindowsPeerInfo *peer_info = (WindowsPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); - BOOL buffer_lost; - peer_info->u.pbuffer.extensions.wglQueryPbufferARB(peer_info->u.pbuffer.pbuffer, WGL_PBUFFER_LOST_ARB, &buffer_lost); - return buffer_lost ? JNI_TRUE : JNI_FALSE; -} - -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsPbufferPeerInfo_nSetPbufferAttrib - (JNIEnv *env, jclass clazz, jobject peer_info_handle, jint attrib, jint value) { - WindowsPeerInfo *peer_info = (WindowsPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); - int attribs[3]; - - attribs[0] = attrib; - attribs[1] = value; - attribs[2] = 0; - - peer_info->u.pbuffer.extensions.wglSetPbufferAttribARB(peer_info->u.pbuffer.pbuffer, attribs); -} - -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsPbufferPeerInfo_nBindTexImageToPbuffer - (JNIEnv *env, jclass clazz, jobject peer_info_handle, jint buffer) { - WindowsPeerInfo *peer_info = (WindowsPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); - peer_info->u.pbuffer.extensions.wglBindTexImageARB(peer_info->u.pbuffer.pbuffer, buffer); -} - -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsPbufferPeerInfo_nReleaseTexImageFromPbuffer - (JNIEnv *env, jclass clazz, jobject peer_info_handle, jint buffer) { - WindowsPeerInfo *peer_info = (WindowsPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); - peer_info->u.pbuffer.extensions.wglReleaseTexImageARB(peer_info->u.pbuffer.pbuffer, buffer); -} diff -Nru lwjgl-2.7.1+dfsg/src/native/windows/org_lwjgl_opengl_WindowsAWTGLCanvasPeerInfo.c lwjgl-2.9.3+dfsg/src/native/windows/org_lwjgl_opengl_WindowsAWTGLCanvasPeerInfo.c --- lwjgl-2.7.1+dfsg/src/native/windows/org_lwjgl_opengl_WindowsAWTGLCanvasPeerInfo.c 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/windows/org_lwjgl_opengl_WindowsAWTGLCanvasPeerInfo.c 2016-04-09 16:26:57.000000000 +0000 @@ -31,10 +31,10 @@ */ /** - * $Id: org_lwjgl_opengl_WindowsAWTGLCanvasPeerInfo.c 2985 2008-04-07 18:42:36Z matzon $ + * $Id$ * * @author elias_naur - * @version $Revision: 2985 $ + * @version $Revision$ */ #include diff -Nru lwjgl-2.7.1+dfsg/src/native/windows/org_lwjgl_opengl_WindowsAWTGLCanvasPeerInfo.h lwjgl-2.9.3+dfsg/src/native/windows/org_lwjgl_opengl_WindowsAWTGLCanvasPeerInfo.h --- lwjgl-2.7.1+dfsg/src/native/windows/org_lwjgl_opengl_WindowsAWTGLCanvasPeerInfo.h 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/windows/org_lwjgl_opengl_WindowsAWTGLCanvasPeerInfo.h 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,21 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_lwjgl_opengl_WindowsAWTGLCanvasPeerInfo */ + +#ifndef _Included_org_lwjgl_opengl_WindowsAWTGLCanvasPeerInfo +#define _Included_org_lwjgl_opengl_WindowsAWTGLCanvasPeerInfo +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: org_lwjgl_opengl_WindowsAWTGLCanvasPeerInfo + * Method: nInitHandle + * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/ByteBuffer;)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsAWTGLCanvasPeerInfo_nInitHandle + (JNIEnv *, jclass, jobject, jobject); + +#ifdef __cplusplus +} +#endif +#endif diff -Nru lwjgl-2.7.1+dfsg/src/native/windows/org_lwjgl_opengl_WindowsContextImplementation.c lwjgl-2.9.3+dfsg/src/native/windows/org_lwjgl_opengl_WindowsContextImplementation.c --- lwjgl-2.7.1+dfsg/src/native/windows/org_lwjgl_opengl_WindowsContextImplementation.c 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/windows/org_lwjgl_opengl_WindowsContextImplementation.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,172 +0,0 @@ -/* - * Copyright (c) 2002-2008 LWJGL Project - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of 'LWJGL' nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/** - * $Id: org_lwjgl_opengl_WindowsContextImplementation.c 3412 2010-09-26 23:43:24Z spasi $ - * - * @author elias_naur - * @version $Revision: 3412 $ - */ - -#include -#include "org_lwjgl_opengl_WindowsContextImplementation.h" -#include "context.h" -#include "extgl_wgl.h" -#include "common_tools.h" - -typedef struct { - HGLRC context; -} WindowsContext; - -JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_WindowsContextImplementation_nCreate - (JNIEnv *env, jclass clazz, jobject peer_info_handle, jobject attribs, jobject shared_context_handle) { - WindowsPeerInfo *peer_info; - WindowsContext *shared_context_info; - WindowsContext *context_info; - HGLRC context; - HGLRC shared_context = NULL; - - // -- We need to create a temporary context to detect the presence of WGL_ARB_create_context - HDC saved_current_hdc; - HGLRC saved_current_hglrc; - WGLExtensions extensions; - const int *attribList = attribs == NULL ? NULL : ((const int *)(*env)->GetDirectBufferAddress(env, attribs)); - - jobject context_handle = newJavaManagedByteBuffer(env, sizeof(WindowsContext)); - if (context_handle == NULL) { - throwException(env, "Could not create handle buffer"); - return NULL; - } - - peer_info = (WindowsPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); - if (shared_context_handle != NULL) { - shared_context_info = (WindowsContext *)(*env)->GetDirectBufferAddress(env, shared_context_handle); - shared_context = shared_context_info->context; - } - - // Create the context - context = wglCreateContext(peer_info->drawable_hdc); - if (context == NULL) { - throwException(env, "Could not create context"); - return NULL; - } - - // Save the current HDC and HGLRC to avoid disruption - saved_current_hdc = wglGetCurrentDC(); - saved_current_hglrc = wglGetCurrentContext(); - - // Make context current and detect extensions - if (!wglMakeCurrent(peer_info->drawable_hdc, context)) { - throwException(env, "Could not bind dummy context"); - return NULL; - } - extgl_InitWGL(&extensions); - - // Restore previous context - wglMakeCurrent(saved_current_hdc, saved_current_hglrc); - - // - if ( extensions.WGL_ARB_create_context ) { // We support WGL_ARB_create_context, use the new context creation routine - // If we have no context to share and no special attributes, we don't have to recreate the context - wglCreateContext is equivalent to wglCreateContextAttribs(hdc,0,NULL). - if ( shared_context != NULL || attribList != NULL ) { - // Delete the oldschool context - wglDeleteContext(context); - // Create a new context using WGL_ARB_create_context - context = (HGLRC)extensions.wglCreateContextAttribsARB(peer_info->drawable_hdc, shared_context, attribList); - if (context == NULL) { - throwException(env, "Could not create context (WGL_ARB_create_context)"); - return NULL; - } - } - } else { // We don't support WGL_ARB_create_context, use the old context creation routine - if (shared_context != NULL && !wglShareLists(shared_context, context)) { // Use wglShareLists to share context data - wglDeleteContext(context); - throwException(env, "Could not share contexts"); - return NULL; - } - } - - context_info = (WindowsContext *)(*env)->GetDirectBufferAddress(env, context_handle); - context_info->context = context; - return context_handle; -} - -JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsContextImplementation_getHGLRC(JNIEnv *env, jclass clazz, jobject context_handle) { - WindowsContext *context_info = (WindowsContext *)(*env)->GetDirectBufferAddress(env, context_handle); - return (intptr_t)context_info->context; -} - -JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsContextImplementation_getHDC(JNIEnv *env, jclass clazz, jobject peer_info_handle) { - WindowsPeerInfo *peer_info = (WindowsPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); - return (intptr_t)peer_info->drawable_hdc; -} - -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsContextImplementation_nSwapBuffers - (JNIEnv *env, jclass clazz, jobject peer_info_handle) { - WindowsPeerInfo *peer_info = (WindowsPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); - SwapBuffers(peer_info->drawable_hdc); -} - -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsContextImplementation_nReleaseCurrentContext - (JNIEnv *env, jclass clazz) { - wglMakeCurrent(NULL, NULL); -} - -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsContextImplementation_nMakeCurrent - (JNIEnv *env, jclass clazz, jobject peer_info_handle, jobject context_handle) { - WindowsContext *context_info = (WindowsContext *)(*env)->GetDirectBufferAddress(env, context_handle); - WindowsPeerInfo *peer_info = (WindowsPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); - if (!wglMakeCurrent(peer_info->drawable_hdc, context_info->context)) - throwException(env, "Could not make context current"); -} - -JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_WindowsContextImplementation_nIsCurrent - (JNIEnv *env, jclass clazz, jobject context_handle) { - WindowsContext *context_info = (WindowsContext *)(*env)->GetDirectBufferAddress(env, context_handle); - return wglGetCurrentContext() == context_info->context; -} - -JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_WindowsContextImplementation_nSetSwapInterval - (JNIEnv *env, jclass clazz, jint value) { - WGLExtensions extensions; - extgl_InitWGL(&extensions); - if (extensions.WGL_EXT_swap_control) { - return extensions.wglSwapIntervalEXT(value) ? JNI_TRUE : JNI_FALSE; - } else - return JNI_FALSE; -} - -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsContextImplementation_nDestroy - (JNIEnv *env, jclass clazz, jobject context_handle) { - WindowsContext *context_info = (WindowsContext *)(*env)->GetDirectBufferAddress(env, context_handle); - wglDeleteContext(context_info->context); -} diff -Nru lwjgl-2.7.1+dfsg/src/native/windows/org_lwjgl_opengl_WindowsDisplay.h lwjgl-2.9.3+dfsg/src/native/windows/org_lwjgl_opengl_WindowsDisplay.h --- lwjgl-2.7.1+dfsg/src/native/windows/org_lwjgl_opengl_WindowsDisplay.h 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/windows/org_lwjgl_opengl_WindowsDisplay.h 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,545 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_lwjgl_opengl_WindowsDisplay */ + +#ifndef _Included_org_lwjgl_opengl_WindowsDisplay +#define _Included_org_lwjgl_opengl_WindowsDisplay +#ifdef __cplusplus +extern "C" { +#endif +#undef org_lwjgl_opengl_WindowsDisplay_GAMMA_LENGTH +#define org_lwjgl_opengl_WindowsDisplay_GAMMA_LENGTH 256L +#undef org_lwjgl_opengl_WindowsDisplay_WM_WINDOWPOSCHANGED +#define org_lwjgl_opengl_WindowsDisplay_WM_WINDOWPOSCHANGED 71L +#undef org_lwjgl_opengl_WindowsDisplay_WM_MOVE +#define org_lwjgl_opengl_WindowsDisplay_WM_MOVE 3L +#undef org_lwjgl_opengl_WindowsDisplay_WM_CANCELMODE +#define org_lwjgl_opengl_WindowsDisplay_WM_CANCELMODE 31L +#undef org_lwjgl_opengl_WindowsDisplay_WM_MOUSEMOVE +#define org_lwjgl_opengl_WindowsDisplay_WM_MOUSEMOVE 512L +#undef org_lwjgl_opengl_WindowsDisplay_WM_LBUTTONDOWN +#define org_lwjgl_opengl_WindowsDisplay_WM_LBUTTONDOWN 513L +#undef org_lwjgl_opengl_WindowsDisplay_WM_LBUTTONUP +#define org_lwjgl_opengl_WindowsDisplay_WM_LBUTTONUP 514L +#undef org_lwjgl_opengl_WindowsDisplay_WM_LBUTTONDBLCLK +#define org_lwjgl_opengl_WindowsDisplay_WM_LBUTTONDBLCLK 515L +#undef org_lwjgl_opengl_WindowsDisplay_WM_RBUTTONDOWN +#define org_lwjgl_opengl_WindowsDisplay_WM_RBUTTONDOWN 516L +#undef org_lwjgl_opengl_WindowsDisplay_WM_RBUTTONUP +#define org_lwjgl_opengl_WindowsDisplay_WM_RBUTTONUP 517L +#undef org_lwjgl_opengl_WindowsDisplay_WM_RBUTTONDBLCLK +#define org_lwjgl_opengl_WindowsDisplay_WM_RBUTTONDBLCLK 518L +#undef org_lwjgl_opengl_WindowsDisplay_WM_MBUTTONDOWN +#define org_lwjgl_opengl_WindowsDisplay_WM_MBUTTONDOWN 519L +#undef org_lwjgl_opengl_WindowsDisplay_WM_MBUTTONUP +#define org_lwjgl_opengl_WindowsDisplay_WM_MBUTTONUP 520L +#undef org_lwjgl_opengl_WindowsDisplay_WM_MBUTTONDBLCLK +#define org_lwjgl_opengl_WindowsDisplay_WM_MBUTTONDBLCLK 521L +#undef org_lwjgl_opengl_WindowsDisplay_WM_XBUTTONDOWN +#define org_lwjgl_opengl_WindowsDisplay_WM_XBUTTONDOWN 523L +#undef org_lwjgl_opengl_WindowsDisplay_WM_XBUTTONUP +#define org_lwjgl_opengl_WindowsDisplay_WM_XBUTTONUP 524L +#undef org_lwjgl_opengl_WindowsDisplay_WM_XBUTTONDBLCLK +#define org_lwjgl_opengl_WindowsDisplay_WM_XBUTTONDBLCLK 525L +#undef org_lwjgl_opengl_WindowsDisplay_WM_MOUSEWHEEL +#define org_lwjgl_opengl_WindowsDisplay_WM_MOUSEWHEEL 522L +#undef org_lwjgl_opengl_WindowsDisplay_WM_CAPTURECHANGED +#define org_lwjgl_opengl_WindowsDisplay_WM_CAPTURECHANGED 533L +#undef org_lwjgl_opengl_WindowsDisplay_WM_MOUSELEAVE +#define org_lwjgl_opengl_WindowsDisplay_WM_MOUSELEAVE 675L +#undef org_lwjgl_opengl_WindowsDisplay_WM_ENTERSIZEMOVE +#define org_lwjgl_opengl_WindowsDisplay_WM_ENTERSIZEMOVE 561L +#undef org_lwjgl_opengl_WindowsDisplay_WM_EXITSIZEMOVE +#define org_lwjgl_opengl_WindowsDisplay_WM_EXITSIZEMOVE 562L +#undef org_lwjgl_opengl_WindowsDisplay_WM_SIZING +#define org_lwjgl_opengl_WindowsDisplay_WM_SIZING 532L +#undef org_lwjgl_opengl_WindowsDisplay_WM_KEYDOWN +#define org_lwjgl_opengl_WindowsDisplay_WM_KEYDOWN 256L +#undef org_lwjgl_opengl_WindowsDisplay_WM_KEYUP +#define org_lwjgl_opengl_WindowsDisplay_WM_KEYUP 257L +#undef org_lwjgl_opengl_WindowsDisplay_WM_SYSKEYUP +#define org_lwjgl_opengl_WindowsDisplay_WM_SYSKEYUP 261L +#undef org_lwjgl_opengl_WindowsDisplay_WM_SYSKEYDOWN +#define org_lwjgl_opengl_WindowsDisplay_WM_SYSKEYDOWN 260L +#undef org_lwjgl_opengl_WindowsDisplay_WM_SYSCHAR +#define org_lwjgl_opengl_WindowsDisplay_WM_SYSCHAR 262L +#undef org_lwjgl_opengl_WindowsDisplay_WM_CHAR +#define org_lwjgl_opengl_WindowsDisplay_WM_CHAR 258L +#undef org_lwjgl_opengl_WindowsDisplay_WM_GETICON +#define org_lwjgl_opengl_WindowsDisplay_WM_GETICON 127L +#undef org_lwjgl_opengl_WindowsDisplay_WM_SETICON +#define org_lwjgl_opengl_WindowsDisplay_WM_SETICON 128L +#undef org_lwjgl_opengl_WindowsDisplay_WM_SETCURSOR +#define org_lwjgl_opengl_WindowsDisplay_WM_SETCURSOR 32L +#undef org_lwjgl_opengl_WindowsDisplay_WM_MOUSEACTIVATE +#define org_lwjgl_opengl_WindowsDisplay_WM_MOUSEACTIVATE 33L +#undef org_lwjgl_opengl_WindowsDisplay_WM_QUIT +#define org_lwjgl_opengl_WindowsDisplay_WM_QUIT 18L +#undef org_lwjgl_opengl_WindowsDisplay_WM_SYSCOMMAND +#define org_lwjgl_opengl_WindowsDisplay_WM_SYSCOMMAND 274L +#undef org_lwjgl_opengl_WindowsDisplay_WM_PAINT +#define org_lwjgl_opengl_WindowsDisplay_WM_PAINT 15L +#undef org_lwjgl_opengl_WindowsDisplay_WM_KILLFOCUS +#define org_lwjgl_opengl_WindowsDisplay_WM_KILLFOCUS 8L +#undef org_lwjgl_opengl_WindowsDisplay_WM_SETFOCUS +#define org_lwjgl_opengl_WindowsDisplay_WM_SETFOCUS 7L +#undef org_lwjgl_opengl_WindowsDisplay_SC_SIZE +#define org_lwjgl_opengl_WindowsDisplay_SC_SIZE 61440L +#undef org_lwjgl_opengl_WindowsDisplay_SC_MOVE +#define org_lwjgl_opengl_WindowsDisplay_SC_MOVE 61456L +#undef org_lwjgl_opengl_WindowsDisplay_SC_MINIMIZE +#define org_lwjgl_opengl_WindowsDisplay_SC_MINIMIZE 61472L +#undef org_lwjgl_opengl_WindowsDisplay_SC_MAXIMIZE +#define org_lwjgl_opengl_WindowsDisplay_SC_MAXIMIZE 61488L +#undef org_lwjgl_opengl_WindowsDisplay_SC_NEXTWINDOW +#define org_lwjgl_opengl_WindowsDisplay_SC_NEXTWINDOW 61504L +#undef org_lwjgl_opengl_WindowsDisplay_SC_PREVWINDOW +#define org_lwjgl_opengl_WindowsDisplay_SC_PREVWINDOW 61520L +#undef org_lwjgl_opengl_WindowsDisplay_SC_CLOSE +#define org_lwjgl_opengl_WindowsDisplay_SC_CLOSE 61536L +#undef org_lwjgl_opengl_WindowsDisplay_SC_VSCROLL +#define org_lwjgl_opengl_WindowsDisplay_SC_VSCROLL 61552L +#undef org_lwjgl_opengl_WindowsDisplay_SC_HSCROLL +#define org_lwjgl_opengl_WindowsDisplay_SC_HSCROLL 61568L +#undef org_lwjgl_opengl_WindowsDisplay_SC_MOUSEMENU +#define org_lwjgl_opengl_WindowsDisplay_SC_MOUSEMENU 61584L +#undef org_lwjgl_opengl_WindowsDisplay_SC_KEYMENU +#define org_lwjgl_opengl_WindowsDisplay_SC_KEYMENU 61696L +#undef org_lwjgl_opengl_WindowsDisplay_SC_ARRANGE +#define org_lwjgl_opengl_WindowsDisplay_SC_ARRANGE 61712L +#undef org_lwjgl_opengl_WindowsDisplay_SC_RESTORE +#define org_lwjgl_opengl_WindowsDisplay_SC_RESTORE 61728L +#undef org_lwjgl_opengl_WindowsDisplay_SC_TASKLIST +#define org_lwjgl_opengl_WindowsDisplay_SC_TASKLIST 61744L +#undef org_lwjgl_opengl_WindowsDisplay_SC_SCREENSAVE +#define org_lwjgl_opengl_WindowsDisplay_SC_SCREENSAVE 61760L +#undef org_lwjgl_opengl_WindowsDisplay_SC_HOTKEY +#define org_lwjgl_opengl_WindowsDisplay_SC_HOTKEY 61776L +#undef org_lwjgl_opengl_WindowsDisplay_SC_DEFAULT +#define org_lwjgl_opengl_WindowsDisplay_SC_DEFAULT 61792L +#undef org_lwjgl_opengl_WindowsDisplay_SC_MONITORPOWER +#define org_lwjgl_opengl_WindowsDisplay_SC_MONITORPOWER 61808L +#undef org_lwjgl_opengl_WindowsDisplay_SC_CONTEXTHELP +#define org_lwjgl_opengl_WindowsDisplay_SC_CONTEXTHELP 61824L +#undef org_lwjgl_opengl_WindowsDisplay_SC_SEPARATOR +#define org_lwjgl_opengl_WindowsDisplay_SC_SEPARATOR 61455L +#undef org_lwjgl_opengl_WindowsDisplay_SM_CXCURSOR +#define org_lwjgl_opengl_WindowsDisplay_SM_CXCURSOR 13L +#undef org_lwjgl_opengl_WindowsDisplay_SM_CYCURSOR +#define org_lwjgl_opengl_WindowsDisplay_SM_CYCURSOR 14L +#undef org_lwjgl_opengl_WindowsDisplay_SM_CMOUSEBUTTONS +#define org_lwjgl_opengl_WindowsDisplay_SM_CMOUSEBUTTONS 43L +#undef org_lwjgl_opengl_WindowsDisplay_SM_MOUSEWHEELPRESENT +#define org_lwjgl_opengl_WindowsDisplay_SM_MOUSEWHEELPRESENT 75L +#undef org_lwjgl_opengl_WindowsDisplay_SIZE_RESTORED +#define org_lwjgl_opengl_WindowsDisplay_SIZE_RESTORED 0L +#undef org_lwjgl_opengl_WindowsDisplay_SIZE_MINIMIZED +#define org_lwjgl_opengl_WindowsDisplay_SIZE_MINIMIZED 1L +#undef org_lwjgl_opengl_WindowsDisplay_SIZE_MAXIMIZED +#define org_lwjgl_opengl_WindowsDisplay_SIZE_MAXIMIZED 2L +#undef org_lwjgl_opengl_WindowsDisplay_WM_SIZE +#define org_lwjgl_opengl_WindowsDisplay_WM_SIZE 5L +#undef org_lwjgl_opengl_WindowsDisplay_WM_ACTIVATE +#define org_lwjgl_opengl_WindowsDisplay_WM_ACTIVATE 6L +#undef org_lwjgl_opengl_WindowsDisplay_WA_INACTIVE +#define org_lwjgl_opengl_WindowsDisplay_WA_INACTIVE 0L +#undef org_lwjgl_opengl_WindowsDisplay_WA_ACTIVE +#define org_lwjgl_opengl_WindowsDisplay_WA_ACTIVE 1L +#undef org_lwjgl_opengl_WindowsDisplay_WA_CLICKACTIVE +#define org_lwjgl_opengl_WindowsDisplay_WA_CLICKACTIVE 2L +#undef org_lwjgl_opengl_WindowsDisplay_SW_NORMAL +#define org_lwjgl_opengl_WindowsDisplay_SW_NORMAL 1L +#undef org_lwjgl_opengl_WindowsDisplay_SW_SHOWMINNOACTIVE +#define org_lwjgl_opengl_WindowsDisplay_SW_SHOWMINNOACTIVE 7L +#undef org_lwjgl_opengl_WindowsDisplay_SW_SHOWDEFAULT +#define org_lwjgl_opengl_WindowsDisplay_SW_SHOWDEFAULT 10L +#undef org_lwjgl_opengl_WindowsDisplay_SW_RESTORE +#define org_lwjgl_opengl_WindowsDisplay_SW_RESTORE 9L +#undef org_lwjgl_opengl_WindowsDisplay_SW_MAXIMIZE +#define org_lwjgl_opengl_WindowsDisplay_SW_MAXIMIZE 3L +#undef org_lwjgl_opengl_WindowsDisplay_ICON_SMALL +#define org_lwjgl_opengl_WindowsDisplay_ICON_SMALL 0L +#undef org_lwjgl_opengl_WindowsDisplay_ICON_BIG +#define org_lwjgl_opengl_WindowsDisplay_ICON_BIG 1L +#undef org_lwjgl_opengl_WindowsDisplay_HWND_TOP +#define org_lwjgl_opengl_WindowsDisplay_HWND_TOP 0i64 +#undef org_lwjgl_opengl_WindowsDisplay_HWND_BOTTOM +#define org_lwjgl_opengl_WindowsDisplay_HWND_BOTTOM 1i64 +#undef org_lwjgl_opengl_WindowsDisplay_HWND_TOPMOST +#define org_lwjgl_opengl_WindowsDisplay_HWND_TOPMOST -1i64 +#undef org_lwjgl_opengl_WindowsDisplay_HWND_NOTOPMOST +#define org_lwjgl_opengl_WindowsDisplay_HWND_NOTOPMOST -2i64 +#undef org_lwjgl_opengl_WindowsDisplay_SWP_NOSIZE +#define org_lwjgl_opengl_WindowsDisplay_SWP_NOSIZE 1L +#undef org_lwjgl_opengl_WindowsDisplay_SWP_NOMOVE +#define org_lwjgl_opengl_WindowsDisplay_SWP_NOMOVE 2L +#undef org_lwjgl_opengl_WindowsDisplay_SWP_NOZORDER +#define org_lwjgl_opengl_WindowsDisplay_SWP_NOZORDER 4L +#undef org_lwjgl_opengl_WindowsDisplay_SWP_FRAMECHANGED +#define org_lwjgl_opengl_WindowsDisplay_SWP_FRAMECHANGED 32L +#undef org_lwjgl_opengl_WindowsDisplay_GWL_STYLE +#define org_lwjgl_opengl_WindowsDisplay_GWL_STYLE -16L +#undef org_lwjgl_opengl_WindowsDisplay_GWL_EXSTYLE +#define org_lwjgl_opengl_WindowsDisplay_GWL_EXSTYLE -20L +#undef org_lwjgl_opengl_WindowsDisplay_WS_THICKFRAME +#define org_lwjgl_opengl_WindowsDisplay_WS_THICKFRAME 262144L +#undef org_lwjgl_opengl_WindowsDisplay_WS_MAXIMIZEBOX +#define org_lwjgl_opengl_WindowsDisplay_WS_MAXIMIZEBOX 65536L +#undef org_lwjgl_opengl_WindowsDisplay_HTCLIENT +#define org_lwjgl_opengl_WindowsDisplay_HTCLIENT 1L +#undef org_lwjgl_opengl_WindowsDisplay_MK_XBUTTON1 +#define org_lwjgl_opengl_WindowsDisplay_MK_XBUTTON1 32L +#undef org_lwjgl_opengl_WindowsDisplay_MK_XBUTTON2 +#define org_lwjgl_opengl_WindowsDisplay_MK_XBUTTON2 64L +#undef org_lwjgl_opengl_WindowsDisplay_XBUTTON1 +#define org_lwjgl_opengl_WindowsDisplay_XBUTTON1 1L +#undef org_lwjgl_opengl_WindowsDisplay_XBUTTON2 +#define org_lwjgl_opengl_WindowsDisplay_XBUTTON2 2L +/* + * Class: org_lwjgl_opengl_WindowsDisplay + * Method: nCreateWindow + * Signature: (IIIIZZJ)J + */ +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nCreateWindow + (JNIEnv *, jclass, jint, jint, jint, jint, jboolean, jboolean, jlong); + +/* + * Class: org_lwjgl_opengl_WindowsDisplay + * Method: nReleaseDC + * Signature: (JJ)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nReleaseDC + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: org_lwjgl_opengl_WindowsDisplay + * Method: nDestroyWindow + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nDestroyWindow + (JNIEnv *, jclass, jlong); + +/* + * Class: org_lwjgl_opengl_WindowsDisplay + * Method: clipCursor + * Signature: (Ljava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_clipCursor + (JNIEnv *, jclass, jobject); + +/* + * Class: org_lwjgl_opengl_WindowsDisplay + * Method: nSwitchDisplayMode + * Signature: (Lorg/lwjgl/opengl/DisplayMode;)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nSwitchDisplayMode + (JNIEnv *, jclass, jobject); + +/* + * Class: org_lwjgl_opengl_WindowsDisplay + * Method: showWindow + * Signature: (JI)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_showWindow + (JNIEnv *, jclass, jlong, jint); + +/* + * Class: org_lwjgl_opengl_WindowsDisplay + * Method: setForegroundWindow + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_setForegroundWindow + (JNIEnv *, jclass, jlong); + +/* + * Class: org_lwjgl_opengl_WindowsDisplay + * Method: setFocus + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_setFocus + (JNIEnv *, jclass, jlong); + +/* + * Class: org_lwjgl_opengl_WindowsDisplay + * Method: nResetDisplayMode + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nResetDisplayMode + (JNIEnv *, jclass); + +/* + * Class: org_lwjgl_opengl_WindowsDisplay + * Method: convertToNativeRamp + * Signature: (Ljava/nio/FloatBuffer;)Ljava/nio/ByteBuffer; + */ +JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_WindowsDisplay_convertToNativeRamp + (JNIEnv *, jclass, jobject); + +/* + * Class: org_lwjgl_opengl_WindowsDisplay + * Method: getCurrentGammaRamp + * Signature: ()Ljava/nio/ByteBuffer; + */ +JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_WindowsDisplay_getCurrentGammaRamp + (JNIEnv *, jclass); + +/* + * Class: org_lwjgl_opengl_WindowsDisplay + * Method: nSetGammaRamp + * Signature: (Ljava/nio/ByteBuffer;)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nSetGammaRamp + (JNIEnv *, jclass, jobject); + +/* + * Class: org_lwjgl_opengl_WindowsDisplay + * Method: nGetVersion + * Signature: (Ljava/lang/String;)Lorg/lwjgl/opengl/WindowsFileVersion; + */ +JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nGetVersion + (JNIEnv *, jobject, jstring); + +/* + * Class: org_lwjgl_opengl_WindowsDisplay + * Method: getCurrentDisplayMode + * Signature: ()Lorg/lwjgl/opengl/DisplayMode; + */ +JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_WindowsDisplay_getCurrentDisplayMode + (JNIEnv *, jclass); + +/* + * Class: org_lwjgl_opengl_WindowsDisplay + * Method: nSetTitle + * Signature: (JJ)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nSetTitle + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: org_lwjgl_opengl_WindowsDisplay + * Method: nUpdate + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nUpdate + (JNIEnv *, jclass); + +/* + * Class: org_lwjgl_opengl_WindowsDisplay + * Method: nReshape + * Signature: (JIIIIZZ)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nReshape + (JNIEnv *, jclass, jlong, jint, jint, jint, jint, jboolean, jboolean); + +/* + * Class: org_lwjgl_opengl_WindowsDisplay + * Method: getAvailableDisplayModes + * Signature: ()[Lorg/lwjgl/opengl/DisplayMode; + */ +JNIEXPORT jobjectArray JNICALL Java_org_lwjgl_opengl_WindowsDisplay_getAvailableDisplayModes + (JNIEnv *, jobject); + +/* + * Class: org_lwjgl_opengl_WindowsDisplay + * Method: nSetCursorPosition + * Signature: (II)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nSetCursorPosition + (JNIEnv *, jclass, jint, jint); + +/* + * Class: org_lwjgl_opengl_WindowsDisplay + * Method: nSetNativeCursor + * Signature: (JLjava/lang/Object;)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nSetNativeCursor + (JNIEnv *, jclass, jlong, jobject); + +/* + * Class: org_lwjgl_opengl_WindowsDisplay + * Method: getSystemMetrics + * Signature: (I)I + */ +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_WindowsDisplay_getSystemMetrics + (JNIEnv *, jclass, jint); + +/* + * Class: org_lwjgl_opengl_WindowsDisplay + * Method: getDllInstance + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsDisplay_getDllInstance + (JNIEnv *, jclass); + +/* + * Class: org_lwjgl_opengl_WindowsDisplay + * Method: getDC + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsDisplay_getDC + (JNIEnv *, jclass, jlong); + +/* + * Class: org_lwjgl_opengl_WindowsDisplay + * Method: getDesktopWindow + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsDisplay_getDesktopWindow + (JNIEnv *, jclass); + +/* + * Class: org_lwjgl_opengl_WindowsDisplay + * Method: getForegroundWindow + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsDisplay_getForegroundWindow + (JNIEnv *, jclass); + +/* + * Class: org_lwjgl_opengl_WindowsDisplay + * Method: nCreateCursor + * Signature: (IIIIILjava/nio/IntBuffer;ILjava/nio/IntBuffer;I)Ljava/nio/ByteBuffer; + */ +JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nCreateCursor + (JNIEnv *, jclass, jint, jint, jint, jint, jint, jobject, jint, jobject, jint); + +/* + * Class: org_lwjgl_opengl_WindowsDisplay + * Method: doDestroyCursor + * Signature: (Ljava/lang/Object;)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_doDestroyCursor + (JNIEnv *, jclass, jobject); + +/* + * Class: org_lwjgl_opengl_WindowsDisplay + * Method: nGetPbufferCapabilities + * Signature: (Lorg/lwjgl/opengl/PixelFormat;)I + */ +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nGetPbufferCapabilities + (JNIEnv *, jobject, jobject); + +/* + * Class: org_lwjgl_opengl_WindowsDisplay + * Method: createIcon + * Signature: (IILjava/nio/IntBuffer;)J + */ +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsDisplay_createIcon + (JNIEnv *, jclass, jint, jint, jobject); + +/* + * Class: org_lwjgl_opengl_WindowsDisplay + * Method: destroyIcon + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_destroyIcon + (JNIEnv *, jclass, jlong); + +/* + * Class: org_lwjgl_opengl_WindowsDisplay + * Method: sendMessage + * Signature: (JJJJ)J + */ +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsDisplay_sendMessage + (JNIEnv *, jclass, jlong, jlong, jlong, jlong); + +/* + * Class: org_lwjgl_opengl_WindowsDisplay + * Method: setWindowLongPtr + * Signature: (JIJ)J + */ +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsDisplay_setWindowLongPtr + (JNIEnv *, jclass, jlong, jint, jlong); + +/* + * Class: org_lwjgl_opengl_WindowsDisplay + * Method: getWindowLongPtr + * Signature: (JI)J + */ +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsDisplay_getWindowLongPtr + (JNIEnv *, jclass, jlong, jint); + +/* + * Class: org_lwjgl_opengl_WindowsDisplay + * Method: setWindowPos + * Signature: (JJIIIIJ)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_WindowsDisplay_setWindowPos + (JNIEnv *, jclass, jlong, jlong, jint, jint, jint, jint, jlong); + +/* + * Class: org_lwjgl_opengl_WindowsDisplay + * Method: nSetCapture + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nSetCapture + (JNIEnv *, jclass, jlong); + +/* + * Class: org_lwjgl_opengl_WindowsDisplay + * Method: nReleaseCapture + * Signature: ()Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nReleaseCapture + (JNIEnv *, jclass); + +/* + * Class: org_lwjgl_opengl_WindowsDisplay + * Method: getClientRect + * Signature: (JLjava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_getClientRect + (JNIEnv *, jclass, jlong, jobject); + +/* + * Class: org_lwjgl_opengl_WindowsDisplay + * Method: clientToScreen + * Signature: (JLjava/nio/IntBuffer;)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_clientToScreen + (JNIEnv *, jclass, jlong, jobject); + +/* + * Class: org_lwjgl_opengl_WindowsDisplay + * Method: setWindowProc + * Signature: (Ljava/lang/reflect/Method;)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplay_setWindowProc + (JNIEnv *, jclass, jobject); + +/* + * Class: org_lwjgl_opengl_WindowsDisplay + * Method: defWindowProc + * Signature: (JIJJ)J + */ +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsDisplay_defWindowProc + (JNIEnv *, jclass, jlong, jint, jlong, jlong); + +/* + * Class: org_lwjgl_opengl_WindowsDisplay + * Method: getWindowRect + * Signature: (JLjava/nio/IntBuffer;)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_WindowsDisplay_getWindowRect + (JNIEnv *, jobject, jlong, jobject); + +/* + * Class: org_lwjgl_opengl_WindowsDisplay + * Method: nTrackMouseEvent + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nTrackMouseEvent + (JNIEnv *, jobject, jlong); + +/* + * Class: org_lwjgl_opengl_WindowsDisplay + * Method: adjustWindowRectEx + * Signature: (Ljava/nio/IntBuffer;IZI)Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_WindowsDisplay_adjustWindowRectEx + (JNIEnv *, jobject, jobject, jint, jboolean, jint); + +#ifdef __cplusplus +} +#endif +#endif diff -Nru lwjgl-2.7.1+dfsg/src/native/windows/org_lwjgl_opengl_WindowsDisplayPeerInfo.c lwjgl-2.9.3+dfsg/src/native/windows/org_lwjgl_opengl_WindowsDisplayPeerInfo.c --- lwjgl-2.7.1+dfsg/src/native/windows/org_lwjgl_opengl_WindowsDisplayPeerInfo.c 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/windows/org_lwjgl_opengl_WindowsDisplayPeerInfo.c 2016-04-09 16:26:57.000000000 +0000 @@ -31,10 +31,10 @@ */ /** - * $Id: org_lwjgl_opengl_WindowsDisplayPeerInfo.c 3057 2008-04-30 16:01:25Z elias_naur $ + * $Id$ * * @author elias_naur - * @version $Revision: 3057 $ + * @version $Revision$ */ #include diff -Nru lwjgl-2.7.1+dfsg/src/native/windows/org_lwjgl_opengl_WindowsDisplayPeerInfo.h lwjgl-2.9.3+dfsg/src/native/windows/org_lwjgl_opengl_WindowsDisplayPeerInfo.h --- lwjgl-2.7.1+dfsg/src/native/windows/org_lwjgl_opengl_WindowsDisplayPeerInfo.h 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/windows/org_lwjgl_opengl_WindowsDisplayPeerInfo.h 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,21 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_lwjgl_opengl_WindowsDisplayPeerInfo */ + +#ifndef _Included_org_lwjgl_opengl_WindowsDisplayPeerInfo +#define _Included_org_lwjgl_opengl_WindowsDisplayPeerInfo +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: org_lwjgl_opengl_WindowsDisplayPeerInfo + * Method: nInitDC + * Signature: (Ljava/nio/ByteBuffer;JJ)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsDisplayPeerInfo_nInitDC + (JNIEnv *, jclass, jobject, jlong, jlong); + +#ifdef __cplusplus +} +#endif +#endif diff -Nru lwjgl-2.7.1+dfsg/src/native/windows/org_lwjgl_opengl_WindowsDisplay_Rect.h lwjgl-2.9.3+dfsg/src/native/windows/org_lwjgl_opengl_WindowsDisplay_Rect.h --- lwjgl-2.7.1+dfsg/src/native/windows/org_lwjgl_opengl_WindowsDisplay_Rect.h 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/windows/org_lwjgl_opengl_WindowsDisplay_Rect.h 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,13 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_lwjgl_opengl_WindowsDisplay_Rect */ + +#ifndef _Included_org_lwjgl_opengl_WindowsDisplay_Rect +#define _Included_org_lwjgl_opengl_WindowsDisplay_Rect +#ifdef __cplusplus +extern "C" { +#endif +#ifdef __cplusplus +} +#endif +#endif diff -Nru lwjgl-2.7.1+dfsg/src/native/windows/org_lwjgl_opengl_WindowsKeyboard.c lwjgl-2.9.3+dfsg/src/native/windows/org_lwjgl_opengl_WindowsKeyboard.c --- lwjgl-2.7.1+dfsg/src/native/windows/org_lwjgl_opengl_WindowsKeyboard.c 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/windows/org_lwjgl_opengl_WindowsKeyboard.c 2016-04-09 16:26:57.000000000 +0000 @@ -41,10 +41,14 @@ #include #include "org_lwjgl_opengl_WindowsKeyboard.h" -JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_WindowsKeyboard_GetKeyState(JNIEnv *env, jclass unused, jint virt_key) { +JNIEXPORT jshort JNICALL Java_org_lwjgl_opengl_WindowsKeyboard_GetKeyState(JNIEnv *env, jclass unused, jint virt_key) { return GetKeyState(virt_key); } +JNIEXPORT jshort JNICALL Java_org_lwjgl_opengl_WindowsKeyboard_GetAsyncKeyState(JNIEnv *env, jclass unused, jint virt_key) { + return GetAsyncKeyState(virt_key); +} + JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_WindowsKeyboard_MapVirtualKey(JNIEnv *env, jclass unused, jint uCode, jint uMapType) { return MapVirtualKey(uCode, uMapType); } diff -Nru lwjgl-2.7.1+dfsg/src/native/windows/org_lwjgl_opengl_WindowsKeyboard.h lwjgl-2.9.3+dfsg/src/native/windows/org_lwjgl_opengl_WindowsKeyboard.h --- lwjgl-2.7.1+dfsg/src/native/windows/org_lwjgl_opengl_WindowsKeyboard.h 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/windows/org_lwjgl_opengl_WindowsKeyboard.h 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,69 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_lwjgl_opengl_WindowsKeyboard */ + +#ifndef _Included_org_lwjgl_opengl_WindowsKeyboard +#define _Included_org_lwjgl_opengl_WindowsKeyboard +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: org_lwjgl_opengl_WindowsKeyboard + * Method: isWindowsNT + * Signature: ()Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_WindowsKeyboard_isWindowsNT + (JNIEnv *, jclass); + +/* + * Class: org_lwjgl_opengl_WindowsKeyboard + * Method: MapVirtualKey + * Signature: (II)I + */ +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_WindowsKeyboard_MapVirtualKey + (JNIEnv *, jclass, jint, jint); + +/* + * Class: org_lwjgl_opengl_WindowsKeyboard + * Method: ToUnicode + * Signature: (IILjava/nio/ByteBuffer;Ljava/nio/CharBuffer;II)I + */ +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_WindowsKeyboard_ToUnicode + (JNIEnv *, jclass, jint, jint, jobject, jobject, jint, jint); + +/* + * Class: org_lwjgl_opengl_WindowsKeyboard + * Method: ToAscii + * Signature: (IILjava/nio/ByteBuffer;Ljava/nio/ByteBuffer;I)I + */ +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_WindowsKeyboard_ToAscii + (JNIEnv *, jclass, jint, jint, jobject, jobject, jint); + +/* + * Class: org_lwjgl_opengl_WindowsKeyboard + * Method: GetKeyboardState + * Signature: (Ljava/nio/ByteBuffer;)I + */ +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_WindowsKeyboard_GetKeyboardState + (JNIEnv *, jclass, jobject); + +/* + * Class: org_lwjgl_opengl_WindowsKeyboard + * Method: GetKeyState + * Signature: (I)S + */ +JNIEXPORT jshort JNICALL Java_org_lwjgl_opengl_WindowsKeyboard_GetKeyState + (JNIEnv *, jclass, jint); + +/* + * Class: org_lwjgl_opengl_WindowsKeyboard + * Method: GetAsyncKeyState + * Signature: (I)S + */ +JNIEXPORT jshort JNICALL Java_org_lwjgl_opengl_WindowsKeyboard_GetAsyncKeyState + (JNIEnv *, jclass, jint); + +#ifdef __cplusplus +} +#endif +#endif diff -Nru lwjgl-2.7.1+dfsg/src/native/windows/org_lwjgl_opengl_WindowsPeerInfo.c lwjgl-2.9.3+dfsg/src/native/windows/org_lwjgl_opengl_WindowsPeerInfo.c --- lwjgl-2.7.1+dfsg/src/native/windows/org_lwjgl_opengl_WindowsPeerInfo.c 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/windows/org_lwjgl_opengl_WindowsPeerInfo.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2002-2008 LWJGL Project - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of 'LWJGL' nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/** - * $Id: org_lwjgl_opengl_WindowsPeerInfo.c 3358 2010-06-03 15:49:26Z spasi $ - * - * @author elias_naur - * @version $Revision: 3358 $ - */ - -#include -#include "org_lwjgl_opengl_WindowsPeerInfo.h" -#include "context.h" -#include "common_tools.h" - -JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_WindowsPeerInfo_createHandle(JNIEnv *env, jclass clazz) { - return newJavaManagedByteBuffer(env, sizeof(WindowsPeerInfo)); -} - -JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_WindowsPeerInfo_nChoosePixelFormat - (JNIEnv *env, jclass clazz, jlong hdc_ptr, jint origin_x, jint origin_y, jobject pixel_format, jobject pixel_format_caps, jboolean use_hdc_bpp, jboolean window, jboolean pbuffer, jboolean double_buffer) { - HDC hdc = (HDC)(INT_PTR)hdc_ptr; - return findPixelFormatOnDC(env, hdc, origin_x, origin_y, pixel_format, pixel_format_caps, use_hdc_bpp, window, pbuffer, double_buffer); -} - -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsPeerInfo_setPixelFormat - (JNIEnv *env, jclass clazz, jlong hdc_ptr, jint pixel_format) { - HDC hdc = (HDC)(INT_PTR)hdc_ptr; - applyPixelFormat(env, hdc, pixel_format); -} - -JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsPeerInfo_nGetHdc(JNIEnv *env, jclass unused, jobject peer_info_handle) { - WindowsPeerInfo *peer_info = (WindowsPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); - return (intptr_t)peer_info->drawable_hdc; -} - -JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsPeerInfo_nGetHwnd(JNIEnv *env, jclass unused, jobject peer_info_handle) { - WindowsPeerInfo *peer_info = (WindowsPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); - return (intptr_t)peer_info->u.hwnd; -} diff -Nru lwjgl-2.7.1+dfsg/src/native/windows/org_lwjgl_opengl_WindowsRegistry.c lwjgl-2.9.3+dfsg/src/native/windows/org_lwjgl_opengl_WindowsRegistry.c --- lwjgl-2.7.1+dfsg/src/native/windows/org_lwjgl_opengl_WindowsRegistry.c 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/windows/org_lwjgl_opengl_WindowsRegistry.c 2016-04-09 16:26:57.000000000 +0000 @@ -31,10 +31,10 @@ */ /** - * $Id: org_lwjgl_opengl_WindowsRegistry.c 2985 2008-04-07 18:42:36Z matzon $ + * $Id$ * * @author elias_naur - * @version $Revision: 2985 $ + * @version $Revision$ */ #include @@ -93,7 +93,7 @@ return NULL; } result[buf_size - 1] = '\0'; - java_result = NewStringNativeWithLength(env, result, strlen(result)); + java_result = NewStringNativeWithLength(env, result, (jsize)strlen(result)); free(result); return java_result; } diff -Nru lwjgl-2.7.1+dfsg/src/native/windows/org_lwjgl_opengl_WindowsRegistry.h lwjgl-2.9.3+dfsg/src/native/windows/org_lwjgl_opengl_WindowsRegistry.h --- lwjgl-2.7.1+dfsg/src/native/windows/org_lwjgl_opengl_WindowsRegistry.h 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/windows/org_lwjgl_opengl_WindowsRegistry.h 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,29 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_lwjgl_opengl_WindowsRegistry */ + +#ifndef _Included_org_lwjgl_opengl_WindowsRegistry +#define _Included_org_lwjgl_opengl_WindowsRegistry +#ifdef __cplusplus +extern "C" { +#endif +#undef org_lwjgl_opengl_WindowsRegistry_HKEY_CLASSES_ROOT +#define org_lwjgl_opengl_WindowsRegistry_HKEY_CLASSES_ROOT 1L +#undef org_lwjgl_opengl_WindowsRegistry_HKEY_CURRENT_USER +#define org_lwjgl_opengl_WindowsRegistry_HKEY_CURRENT_USER 2L +#undef org_lwjgl_opengl_WindowsRegistry_HKEY_LOCAL_MACHINE +#define org_lwjgl_opengl_WindowsRegistry_HKEY_LOCAL_MACHINE 3L +#undef org_lwjgl_opengl_WindowsRegistry_HKEY_USERS +#define org_lwjgl_opengl_WindowsRegistry_HKEY_USERS 4L +/* + * Class: org_lwjgl_opengl_WindowsRegistry + * Method: nQueryRegistrationKey + * Signature: (ILjava/lang/String;Ljava/lang/String;)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_org_lwjgl_opengl_WindowsRegistry_nQueryRegistrationKey + (JNIEnv *, jclass, jint, jstring, jstring); + +#ifdef __cplusplus +} +#endif +#endif diff -Nru lwjgl-2.7.1+dfsg/src/native/windows/org_lwjgl_Sys.c lwjgl-2.9.3+dfsg/src/native/windows/org_lwjgl_Sys.c --- lwjgl-2.7.1+dfsg/src/native/windows/org_lwjgl_Sys.c 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/windows/org_lwjgl_Sys.c 2016-04-09 16:26:57.000000000 +0000 @@ -1,42 +1,42 @@ -/* +/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are + * modification, are permitted provided that the following conditions are * met: - * - * * Redistributions of source code must retain the above copyright + * + * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * * Neither the name of 'LWJGL' nor the names of - * its contributors may be used to endorse or promote products derived + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + /** - * $Id: org_lwjgl_Sys.c 3259 2009-12-02 23:11:14Z matzon $ + * $Id$ * * Windows system library. * * @author cix_foo - * @version $Revision: 3259 $ + * @version $Revision$ */ #include "Window.h" @@ -56,16 +56,9 @@ return time; } -JNIEXPORT void JNICALL Java_org_lwjgl_WindowsSysImplementation_nAlert(JNIEnv * env, jclass unused, jlong hwnd_ptr, jstring title, jstring message) { +JNIEXPORT void JNICALL Java_org_lwjgl_WindowsSysImplementation_nAlert(JNIEnv * env, jclass unused, jlong hwnd_ptr, jlong title, jlong message) { HWND hwnd = (HWND)(INT_PTR)hwnd_ptr; - char * eMessageText = GetStringNativeChars(env, message); - char * cTitleBarText = GetStringNativeChars(env, title); - MessageBox(hwnd, eMessageText, cTitleBarText, MB_OK | MB_TOPMOST); - - printfDebugJava(env, "*** Alert ***%s\n%s\n", cTitleBarText, eMessageText); - - free(eMessageText); - free(cTitleBarText); + MessageBox(hwnd, (LPCTSTR)(intptr_t)message, (LPCTSTR)(intptr_t)title, MB_OK | MB_TOPMOST); } JNIEXPORT void JNICALL Java_org_lwjgl_WindowsSysImplementation_initCommonControls(JNIEnv * env, jclass unused) { @@ -97,7 +90,7 @@ return NULL; } str = (const wchar_t *)clipboard_data; - ret = (*env)->NewString(env, str, wcslen(str)); + ret = (*env)->NewString(env, str, (jsize)wcslen(str)); } else if (textAvailable) { if (!OpenClipboard(NULL)) return NULL; @@ -111,7 +104,7 @@ CloseClipboard(); return NULL; } - ret = NewStringNativeWithLength(env, (const char *) clipboard_data, strlen(clipboard_data)); + ret = NewStringNativeWithLength(env, (const char *) clipboard_data, (jsize)strlen(clipboard_data)); } else { return NULL; } diff -Nru lwjgl-2.7.1+dfsg/src/native/windows/org_lwjgl_WindowsSysImplementation.h lwjgl-2.9.3+dfsg/src/native/windows/org_lwjgl_WindowsSysImplementation.h --- lwjgl-2.7.1+dfsg/src/native/windows/org_lwjgl_WindowsSysImplementation.h 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/windows/org_lwjgl_WindowsSysImplementation.h 2016-04-09 16:26:57.000000000 +0000 @@ -0,0 +1,47 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_lwjgl_WindowsSysImplementation */ + +#ifndef _Included_org_lwjgl_WindowsSysImplementation +#define _Included_org_lwjgl_WindowsSysImplementation +#ifdef __cplusplus +extern "C" { +#endif +#undef org_lwjgl_WindowsSysImplementation_JNI_VERSION +#define org_lwjgl_WindowsSysImplementation_JNI_VERSION 24L +/* + * Class: org_lwjgl_WindowsSysImplementation + * Method: nGetTime + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_org_lwjgl_WindowsSysImplementation_nGetTime + (JNIEnv *, jclass); + +/* + * Class: org_lwjgl_WindowsSysImplementation + * Method: nAlert + * Signature: (JJJ)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_WindowsSysImplementation_nAlert + (JNIEnv *, jclass, jlong, jlong, jlong); + +/* + * Class: org_lwjgl_WindowsSysImplementation + * Method: initCommonControls + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_WindowsSysImplementation_initCommonControls + (JNIEnv *, jclass); + +/* + * Class: org_lwjgl_WindowsSysImplementation + * Method: nGetClipboard + * Signature: ()Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_org_lwjgl_WindowsSysImplementation_nGetClipboard + (JNIEnv *, jclass); + +#ifdef __cplusplus +} +#endif +#endif diff -Nru lwjgl-2.7.1+dfsg/src/native/windows/Window.h lwjgl-2.9.3+dfsg/src/native/windows/Window.h --- lwjgl-2.7.1+dfsg/src/native/windows/Window.h 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/windows/Window.h 2016-04-09 16:26:57.000000000 +0000 @@ -1,42 +1,42 @@ -/* +/* * Copyright (c) 2002-2008 LWJGL Project * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are + * modification, are permitted provided that the following conditions are * met: - * - * * Redistributions of source code must retain the above copyright + * + * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * * Neither the name of 'LWJGL' nor the names of - * its contributors may be used to endorse or promote products derived + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + /** - * $Id: Window.h 3227 2009-07-07 19:47:55Z matzon $ + * $Id$ * * Include file to access public window features * * @author cix_foo - * @version $Revision: 3227 $ + * @version $Revision$ */ #ifndef _LWJGL_WINDOW_H_INCLUDED_ #define _LWJGL_WINDOW_H_INCLUDED_ @@ -52,6 +52,10 @@ #define _WIN32_WINNT 0x0400 #endif + #define _UNICODE + #include + + #define UNICODE #include #include #include "common_tools.h" diff -Nru lwjgl-2.7.1+dfsg/src/native/windows/windows_al.c lwjgl-2.9.3+dfsg/src/native/windows/windows_al.c --- lwjgl-2.7.1+dfsg/src/native/windows/windows_al.c 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/native/windows/windows_al.c 2016-04-09 16:26:57.000000000 +0000 @@ -37,12 +37,12 @@ #include "common_tools.h" /** - * $Id: windows_al.c 3412 2010-09-26 23:43:24Z spasi $ + * $Id$ * * This file contains the AL extension assigning mechanism * * @author Brian Matzon - * @version $Revision: 3412 $ + * @version $Revision$ */ /* Handle to OpenAL Library */ static HMODULE handleOAL; diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/openal/AL10.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/openal/AL10.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/openal/AL10.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/openal/AL10.java 2016-04-09 16:26:56.000000000 +0000 @@ -45,8 +45,8 @@ * AL.h version 1.0 * * @author Brian Matzon - * @version $Revision: 3412 $ - * $Id: AL10.java 3412 2010-09-26 23:43:24Z spasi $ + * @version $Revision$ + * $Id$ */ public interface AL10 { /** Bad value */ diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opencl/AMD_bus_addressable_memory.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opencl/AMD_bus_addressable_memory.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opencl/AMD_bus_addressable_memory.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opencl/AMD_bus_addressable_memory.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2002-2012 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opencl; + +import org.lwjgl.PointerBuffer; +import org.lwjgl.util.generator.*; +import org.lwjgl.util.generator.opencl.CLDeviceExtension; +import org.lwjgl.util.generator.opencl.cl_int; +import org.lwjgl.util.generator.opencl.cl_uint; +import org.lwjgl.util.generator.opencl.cl_ulong; + +@CLDeviceExtension +public interface AMD_bus_addressable_memory { + + /** cl_mem flag - bitfield */ + int CL_MEM_BUS_ADDRESSABLE_AMD = (1 << 30), + CL_MEM_EXTERNAL_PHYSICAL_AMD = (1 << 31); + + int CL_COMMAND_WAIT_SIGNAL_AMD = 0x4080, + CL_COMMAND_WRITE_SIGNAL_AMD = 0x4081, + CL_COMMAND_MAKE_BUFFERS_RESIDENT_AMD = 0x4082; + + /* + @Code(javaAfterNative = "\t\tif ( __result == CL_SUCCESS ) command_queue.registerCLEvent(event);") + @cl_int + int clEnqueueWaitSignalAMD( + @PointerWrapper("cl_command_queue") CLCommandQueue command_queue, + @PointerWrapper("cl_mem") CLMem mem_object, + @cl_uint int value, + @AutoSize(value = "event_wait_list", canBeNull = true) @cl_uint int num_events, + @Check(canBeNull = true) @Const @NativeType("cl_event") PointerBuffer event_wait_list, + @OutParameter @Check(value = "1", canBeNull = true) @NativeType("cl_event") PointerBuffer event + ); + + @Code(javaAfterNative = "\t\tif ( __result == CL_SUCCESS ) command_queue.registerCLEvent(event);") + @cl_int + int clEnqueueWriteSignalAMD( + @PointerWrapper("cl_command_queue") CLCommandQueue command_queue, + @PointerWrapper("cl_mem") CLMem mem_object, + @cl_uint int value, + @cl_ulong long offset, + @AutoSize(value = "event_wait_list", canBeNull = true) @cl_uint int num_events, + @Check(canBeNull = true) @Const @NativeType("cl_event") PointerBuffer event_wait_list, + @OutParameter @Check(value = "1", canBeNull = true) @NativeType("cl_event") PointerBuffer event + ); + + // TODO: Implement + int clEnqueueMakeBuffersResidentAMD(); + */ + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opencl/AMD_device_memory_flags.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opencl/AMD_device_memory_flags.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opencl/AMD_device_memory_flags.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opencl/AMD_device_memory_flags.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2002-2010 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opencl; + +import org.lwjgl.util.generator.opencl.CLDeviceExtension; + +@CLDeviceExtension +public interface AMD_device_memory_flags { + + /** Alloc from GPU's CPU visible heap. */ + int CL_MEM_USE_PERSISTENT_MEM_AMD = (1 << 6); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opencl/AMD_media_ops2.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opencl/AMD_media_ops2.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opencl/AMD_media_ops2.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opencl/AMD_media_ops2.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2002-2010 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opencl; + +import org.lwjgl.util.generator.opencl.CLDeviceExtension; + +@CLDeviceExtension +public interface AMD_media_ops2 { + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opencl/AMD_offline_devices.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opencl/AMD_offline_devices.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opencl/AMD_offline_devices.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opencl/AMD_offline_devices.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2002-2010 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opencl; + +import org.lwjgl.util.generator.opencl.CLDeviceExtension; + +@CLDeviceExtension +public interface AMD_offline_devices { + + int CL_CONTEXT_OFFLINE_DEVICES_AMD = 0x403F; + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opencl/AMD_popcnt.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opencl/AMD_popcnt.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opencl/AMD_popcnt.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opencl/AMD_popcnt.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2002-2010 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opencl; + +import org.lwjgl.util.generator.opencl.CLDeviceExtension; + +@CLDeviceExtension +public interface AMD_popcnt { + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opencl/AMD_vec3.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opencl/AMD_vec3.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opencl/AMD_vec3.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opencl/AMD_vec3.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opencl; + +import org.lwjgl.util.generator.opencl.CLDeviceExtension; + +@CLDeviceExtension +public interface AMD_vec3 { + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opencl/APPLE_ContextLoggingFunctions.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opencl/APPLE_ContextLoggingFunctions.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opencl/APPLE_ContextLoggingFunctions.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opencl/APPLE_ContextLoggingFunctions.java 2016-04-09 16:26:56.000000000 +0000 @@ -32,15 +32,14 @@ package org.lwjgl.opencl; import org.lwjgl.util.generator.*; -import org.lwjgl.util.generator.opencl.CLDeviceExtension; -import org.lwjgl.util.generator.opencl.cl_char; -import org.lwjgl.util.generator.opencl.cl_void; -import org.lwjgl.util.generator.opencl.size_t; +import org.lwjgl.util.generator.opencl.*; import java.nio.ByteBuffer; @Private +@CLPlatformExtension @CLDeviceExtension +@Extension(postfix = "APPLE", nativeName = "cl_APPLE_ContextLoggingFunctions") public interface APPLE_ContextLoggingFunctions { @Extern diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opencl/APPLE_gl_sharing.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opencl/APPLE_gl_sharing.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opencl/APPLE_gl_sharing.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opencl/APPLE_gl_sharing.java 2016-04-09 16:26:56.000000000 +0000 @@ -33,15 +33,13 @@ import org.lwjgl.PointerBuffer; import org.lwjgl.util.generator.*; -import org.lwjgl.util.generator.opencl.CLDeviceExtension; -import org.lwjgl.util.generator.opencl.cl_int; -import org.lwjgl.util.generator.opencl.cl_void; -import org.lwjgl.util.generator.opencl.size_t; +import org.lwjgl.util.generator.opencl.*; import java.nio.ByteBuffer; +@CLPlatformExtension @CLDeviceExtension -@Extension(postfix = "APPLE", className = "APPLEGLSharing") +@Extension(postfix = "APPLE", className = "APPLEGLSharing", nativeName = "cl_APPLE_gl_sharing") public interface APPLE_gl_sharing { /** diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opencl/APPLE_SetMemObjectDestructor.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opencl/APPLE_SetMemObjectDestructor.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opencl/APPLE_SetMemObjectDestructor.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opencl/APPLE_SetMemObjectDestructor.java 2016-04-09 16:26:56.000000000 +0000 @@ -33,11 +33,15 @@ import org.lwjgl.util.generator.Code; import org.lwjgl.util.generator.Constant; +import org.lwjgl.util.generator.Extension; import org.lwjgl.util.generator.PointerWrapper; import org.lwjgl.util.generator.opencl.CLDeviceExtension; +import org.lwjgl.util.generator.opencl.CLPlatformExtension; import org.lwjgl.util.generator.opencl.cl_int; +@CLPlatformExtension @CLDeviceExtension +@Extension(postfix = "APPLE", nativeName = "cl_APPLE_SetMemObjectDestructor") public interface APPLE_SetMemObjectDestructor { @Code( diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opencl/CL10GL.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opencl/CL10GL.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opencl/CL10GL.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opencl/CL10GL.java 2016-04-09 16:26:56.000000000 +0000 @@ -112,7 +112,7 @@ @cl_int int clEnqueueAcquireGLObjects(@PointerWrapper("cl_command_queue") CLCommandQueue command_queue, @Constant("1") @cl_uint int num_objects, - @Constant(value = "APIUtil.getBufferPointer().put(0, mem_object).getBuffer(), 0", keepParam = true) CLMem mem_object, + @Constant(value = "APIUtil.getPointer(mem_object)", keepParam = true) CLMem mem_object, @AutoSize(value = "event_wait_list", canBeNull = true) @cl_uint int num_events_in_wait_list, @Check(canBeNull = true) @Const @NativeType("cl_event") PointerBuffer event_wait_list, @OutParameter @Check(value = "1", canBeNull = true) @NativeType("cl_event") PointerBuffer event); @@ -131,7 +131,7 @@ @cl_int int clEnqueueReleaseGLObjects(@PointerWrapper("cl_command_queue") CLCommandQueue command_queue, @Constant("1") @cl_uint int num_objects, - @Constant(value = "APIUtil.getBufferPointer().put(0, mem_object).getBuffer(), 0", keepParam = true) CLMem mem_object, + @Constant(value = "APIUtil.getPointer(mem_object)", keepParam = true) CLMem mem_object, @AutoSize(value = "event_wait_list", canBeNull = true) @cl_uint int num_events_in_wait_list, @Check(canBeNull = true) @Const @NativeType("cl_event") PointerBuffer event_wait_list, @OutParameter @Check(value = "1", canBeNull = true) @NativeType("cl_event") PointerBuffer event); diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opencl/CL10.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opencl/CL10.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opencl/CL10.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opencl/CL10.java 2016-04-09 16:26:56.000000000 +0000 @@ -399,7 +399,7 @@ // Create a GlobalRef to the callback object. javaBeforeNative = "\t\tlong user_data = pfn_notify == null || pfn_notify.isCustom() ? 0 : CallbackUtil.createGlobalRef(pfn_notify);", // Associate context with the GlobalRef, so we can delete it later. - javaFinally = "\t\t\tCallbackUtil.registerCallback(__result, user_data);" + javaFinally = "\t\t\tif ( __result != null ) __result.setContextCallback(user_data);" ) @Check(value = "errcode_ret", canBeNull = true) @PointerWrapper(value = "cl_context", params = "APIUtil.getCLPlatform(properties)") @@ -417,13 +417,13 @@ // Create a GlobalRef to the callback object. javaBeforeNative = "\t\tlong user_data = pfn_notify == null || pfn_notify.isCustom() ? 0 : CallbackUtil.createGlobalRef(pfn_notify);", // Associate context with the GlobalRef, so we can delete it later. - javaFinally = "\t\t\tCallbackUtil.registerCallback(__result, user_data);" + javaFinally = "\t\t\tif ( __result != null ) __result.setContextCallback(user_data);" ) @Check(value = "errcode_ret", canBeNull = true) @PointerWrapper(value = "cl_context", params = "APIUtil.getCLPlatform(properties)") CLContext clCreateContext(@NullTerminated @Check("3") @Const @NativeType("cl_context_properties") PointerBuffer properties, @Constant("1") @cl_uint int num_devices, - @Constant(value = "APIUtil.getBufferPointer().put(0, device).getBuffer(), 0", keepParam = true) CLDevice device, + @Constant(value = "APIUtil.getPointer(device)", keepParam = true) CLDevice device, @PointerWrapper(value = "cl_create_context_callback", canBeNull = true) CLContextCallback pfn_notify, @Constant("user_data") @PointerWrapper("void *") long user_data, @OutParameter @Check(value = "1", canBeNull = true) @cl_int IntBuffer errcode_ret); @@ -432,9 +432,9 @@ @Code( tryBlock = true, // Create a GlobalRef to the callback object. - javaBeforeNative = "\t\tlong user_data = CallbackUtil.createGlobalRef(pfn_notify);", + javaBeforeNative = "\t\tlong user_data = pfn_notify == null || pfn_notify.isCustom() ? 0 : CallbackUtil.createGlobalRef(pfn_notify);", // Associate context with the GlobalRef, so we can delete it later. - javaFinally = "\t\t\tCallbackUtil.registerCallback(__result, user_data);" + javaFinally = "\t\t\tif ( __result != null ) __result.setContextCallback(user_data);" ) @Check(value = "errcode_ret", canBeNull = true) @PointerWrapper(value = "cl_context", params = "APIUtil.getCLPlatform(properties)") @@ -450,7 +450,7 @@ @Code( javaBeforeNative = "\t\tAPIUtil.releaseObjects(context);", - javaAfterNative = "\t\tif ( __result == CL_SUCCESS ) CallbackUtil.unregisterCallback(context);" + javaAfterNative = "\t\tif ( __result == CL_SUCCESS ) context.releaseImpl();" ) @cl_int int clReleaseContext(@PointerWrapper("cl_context") CLContext context); @@ -511,7 +511,7 @@ @PointerWrapper("cl_mem") CLMem buffer, @cl_bool int blocking_read, @size_t long offset, - @AutoSize("ptr") @size_t long cb, + @AutoSize("ptr") @size_t long size, @OutParameter @cl_byte @cl_short @@ -529,7 +529,7 @@ @PointerWrapper("cl_mem") CLMem buffer, @cl_bool int blocking_write, @size_t long offset, - @AutoSize("ptr") @size_t long cb, + @AutoSize("ptr") @size_t long size, @Const @cl_byte @cl_short @@ -548,7 +548,7 @@ @PointerWrapper("cl_mem") CLMem dst_buffer, @size_t long src_offset, @size_t long dst_offset, - @size_t long cb, + @size_t long size, @AutoSize(value = "event_wait_list", canBeNull = true) @cl_uint int num_events_in_wait_list, @Check(canBeNull = true) @Const @NativeType("cl_event") PointerBuffer event_wait_list, @OutParameter @Check(value = "1", canBeNull = true) @NativeType("cl_event") PointerBuffer event); @@ -556,13 +556,13 @@ @Code(javaAfterNative = "\t\tif ( __result != null ) command_queue.registerCLEvent(event);") @Check(value = "errcode_ret", canBeNull = true) @cl_void - @AutoSize("cb") + @AutoSize("size") ByteBuffer clEnqueueMapBuffer(@PointerWrapper("cl_command_queue") CLCommandQueue command_queue, @PointerWrapper("cl_mem") CLMem buffer, @cl_bool int blocking_map, @NativeType("cl_map_flags") long map_flags, @size_t long offset, - @size_t long cb, + @size_t long size, @AutoSize(value = "event_wait_list", canBeNull = true) @cl_uint int num_events_in_wait_list, @Check(canBeNull = true) @Const @NativeType("cl_event") PointerBuffer event_wait_list, @OutParameter @Check(value = "1", canBeNull = true) @NativeType("cl_event") PointerBuffer event, @@ -683,7 +683,7 @@ @Code(javaAfterNative = "\t\tif ( __result != null ) command_queue.registerCLEvent(event);") @Check(value = "errcode_ret", canBeNull = true) @cl_void - @AutoSize(value = "extcl_CalculateImageSize(region_address, *image_row_pitch_address, image_slice_pitch == NULL ? 0 : *image_slice_pitch_address)", isNative = true) + @AutoSize(value = "extcl_CalculateImageSize(region_address, *image_row_pitch_address, image_slice_pitch_address == NULL ? 0 : *image_slice_pitch_address)", isNative = true) ByteBuffer clEnqueueMapImage(@PointerWrapper("cl_command_queue") CLCommandQueue command_queue, @PointerWrapper("cl_mem") CLMem image, @cl_bool int blocking_map, @@ -776,7 +776,7 @@ CLProgram clCreateProgramWithSource3(@PointerWrapper("cl_context") CLContext context, @Constant("strings.length") @cl_uint int count, @Check("1") @PointerArray(value = "count") @Const @NativeType("cl_char") ByteBuffer[] strings, - @Constant("APIUtil.getLengths(strings).getBuffer(), 0") @Const @NativeType("size_t") PointerBuffer lengths, + @Constant("APIUtil.getLengths(strings)") @Const @NativeType("size_t") PointerBuffer lengths, @OutParameter @Check(value = "1", canBeNull = true) @cl_int IntBuffer errcode_ret); @Alternate("clCreateProgramWithSource") @@ -794,7 +794,7 @@ CLProgram clCreateProgramWithSource4(@PointerWrapper("cl_context") CLContext context, @Constant("strings.length") @cl_uint int count, @Const @PointerArray(value = "count", lengths = "lengths") CharSequence[] strings, - @Constant("APIUtil.getLengths(strings).getBuffer(), 0") @Const @NativeType("size_t") PointerBuffer lengths, + @Constant("APIUtil.getLengths(strings)") @Const @NativeType("size_t") PointerBuffer lengths, @OutParameter @Check(value = "1", canBeNull = true) @cl_int IntBuffer errcode_ret); // ------[ clCreateProgramWithBinary ]------ @@ -826,7 +826,7 @@ CLProgram clCreateProgramWithBinary3(@PointerWrapper("cl_context") CLContext context, @Constant("binaries.length") @cl_uint int num_devices, @Check("binaries.length") @Const @NativeType("cl_device_id") PointerBuffer device_list, - @Constant("APIUtil.getLengths(binaries).getBuffer(), 0") @Const @NativeType("size_t") PointerBuffer lengths, + @Constant("APIUtil.getLengths(binaries)") @Const @NativeType("size_t") PointerBuffer lengths, @Check("1") @PointerArray("num_devices") @Const @NativeType("cl_uchar") ByteBuffer[] binaries, @OutParameter @Check("binaries.length") @cl_int IntBuffer binary_status, @OutParameter @Check(value = "1", canBeNull = true) @cl_int IntBuffer errcode_ret); @@ -845,7 +845,8 @@ @Code( tryBlock = true, // Create a GlobalRef to the callback object. - javaBeforeNative = "\t\tlong user_data = CallbackUtil.createGlobalRef(pfn_notify);", + javaBeforeNative = "\t\tlong user_data = CallbackUtil.createGlobalRef(pfn_notify);\n" + + "\t\tif ( pfn_notify != null ) pfn_notify.setContext(program.getParent());", // Check if we need to delete the GlobalRef. javaFinally = "\t\t\tCallbackUtil.checkCallback(__result, user_data);" ) @@ -854,14 +855,15 @@ @AutoSize(value = "device_list", canBeNull = true) @cl_uint int num_devices, @Check(canBeNull = true) @Const @NativeType("cl_device_id") PointerBuffer device_list, @Check @NullTerminated @Const @cl_char ByteBuffer options, - @PointerWrapper(value = "cl_build_program_callback", canBeNull = true) CLBuildProgramCallback pfn_notify, + @PointerWrapper(value = "cl_program_callback", canBeNull = true) CLBuildProgramCallback pfn_notify, @Constant("user_data") @PointerWrapper("void *") long user_data); @Alternate("clBuildProgram") @Code( tryBlock = true, // Create a GlobalRef to the callback object. - javaBeforeNative = "\t\tlong user_data = CallbackUtil.createGlobalRef(pfn_notify);", + javaBeforeNative = "\t\tlong user_data = CallbackUtil.createGlobalRef(pfn_notify);\n" + + "\t\tif ( pfn_notify != null ) pfn_notify.setContext(program.getParent());", // Check if we need to delete the GlobalRef. javaFinally = "\t\t\tCallbackUtil.checkCallback(__result, user_data);" ) @@ -870,23 +872,24 @@ @AutoSize(value = "device_list", canBeNull = true) @cl_uint int num_devices, @Check(canBeNull = true) @Const @NativeType("cl_device_id") PointerBuffer device_list, @NullTerminated @Const CharSequence options, - @PointerWrapper(value = "cl_build_program_callback", canBeNull = true) CLBuildProgramCallback pfn_notify, + @PointerWrapper(value = "cl_program_callback", canBeNull = true) CLBuildProgramCallback pfn_notify, @Constant("user_data") @PointerWrapper("void *") long user_data); @Alternate("clBuildProgram") @Code( tryBlock = true, // Create a GlobalRef to the callback object. - javaBeforeNative = "\t\tlong user_data = CallbackUtil.createGlobalRef(pfn_notify);", + javaBeforeNative = "\t\tlong user_data = CallbackUtil.createGlobalRef(pfn_notify);\n" + + "\t\tif ( pfn_notify != null ) pfn_notify.setContext(program.getParent());", // Check if we need to delete the GlobalRef. javaFinally = "\t\t\tCallbackUtil.checkCallback(__result, user_data);" ) @cl_int int clBuildProgram(@PointerWrapper("cl_program") CLProgram program, @Constant("1") @cl_uint int num_devices, - @Constant(value = "APIUtil.getBufferPointer().put(0, device).getBuffer(), 0", keepParam = true) CLDevice device, + @Constant(value = "APIUtil.getPointer(device)", keepParam = true) CLDevice device, @NullTerminated @Const CharSequence options, - @PointerWrapper(value = "cl_build_program_callback", canBeNull = true) CLBuildProgramCallback pfn_notify, + @PointerWrapper(value = "cl_program_callback", canBeNull = true) CLBuildProgramCallback pfn_notify, @Constant("user_data") @PointerWrapper("void *") long user_data); @cl_int @@ -915,9 +918,10 @@ @cl_int int clGetProgramInfo2(@PointerWrapper("cl_program") CLProgram program, @Constant("CL_PROGRAM_BINARIES") @NativeType("cl_program_info") int param_name, - @Constant("sizes.remainingByte()") @size_t long param_value_size, + @Constant(value = "sizes_len * sizeof(cl_uchar *)", isNative = true) @size_t long param_value_size, + @Constant("sizes.remaining()") @Helper(passToNative = true) @size_t long sizes_len, @Helper(passToNative = true) @Check("1") @Const @NativeType("size_t") PointerBuffer sizes, - @OutParameter @Check("APIUtil.getSize(sizes)") @PointerArray(value = "param_value_size", lengths = "sizes") @NativeType("cl_uchar") ByteBuffer param_value, + @OutParameter @Check("APIUtil.getSize(sizes)") @PointerArray(value = "sizes_len", lengths = "sizes") @NativeType("cl_uchar") ByteBuffer param_value, @OutParameter @Check(value = "1", canBeNull = true) @NativeType("size_t") PointerBuffer param_value_size_ret); /** @@ -936,8 +940,9 @@ @cl_int int clGetProgramInfo3(@PointerWrapper("cl_program") CLProgram program, @Constant("CL_PROGRAM_BINARIES") @NativeType("cl_program_info") int param_name, - @Constant("param_value.length * PointerBuffer.getPointerSize()") @size_t long param_value_size, - @PointerArray("param_value_size") @NativeType("cl_uchar") ByteBuffer[] param_value, + @Constant(value = "param_value_len * sizeof(cl_uchar *)", isNative = true) @size_t long param_value_size, + @Constant("param_value.length") @Helper(passToNative = true) @size_t long param_value_len, + @PointerArray("param_value_len") @NativeType("cl_uchar") ByteBuffer[] param_value, @OutParameter @Check(value = "1", canBeNull = true) @NativeType("size_t") PointerBuffer param_value_size_ret); @cl_int @@ -976,6 +981,7 @@ @cl_int int clReleaseKernel(@PointerWrapper("cl_kernel") CLKernel kernel); + @GenerateAutos @cl_int int clSetKernelArg(@PointerWrapper("cl_kernel") CLKernel kernel, @cl_uint int arg_index, @@ -994,15 +1000,7 @@ @cl_uint int arg_index, @Constant("PointerBuffer.getPointerSize()") @size_t long arg_size, @Check(canBeNull = true) @Const - @Constant(value = "APIUtil.getBufferPointer().put(0, arg_value == null ? 0 : arg_value.getPointer()).getBuffer(), 0", keepParam = true) CLObject arg_value); - - /** Sets the size of a __local kernel argument at the specified index. */ - @Alternate("clSetKernelArg") - @cl_int - int clSetKernelArg2(@PointerWrapper("cl_kernel") CLKernel kernel, - @cl_uint int arg_index, - @size_t long arg_size, - @Constant("null, 0") Buffer arg_value); + @Constant(value = "APIUtil.getPointerSafe(arg_value)", keepParam = true) CLObject arg_value); // This is used by CLKernelUtil. Assumes arg_value.position() == 0. @@ -1012,7 +1010,7 @@ int clSetKernelArg3(@PointerWrapper("cl_kernel") CLKernel kernel, @cl_uint int arg_index, @size_t long arg_size, - @Constant(value = "arg_value, 0", keepParam = true) Buffer arg_value); + @Constant(value = "MemoryUtil.getAddress0(arg_value)", keepParam = true) Buffer arg_value); @cl_int int clGetKernelInfo(@PointerWrapper("cl_kernel") CLKernel kernel, @@ -1077,7 +1075,7 @@ nativeAfterVars = "\tvoid **args_mem_loc = num_mem_objects == 0 ? NULL : (void **)malloc(num_mem_objects * sizeof(void *));", nativeBeforeCall = "\t_ptr_i = 0;\n" + "\twhile ( _ptr_i < num_mem_objects ) {\n" + - "\t\targs_mem_loc[_ptr_i] = (cl_void *)((char *)args_address + (4 + _ptr_i * (4 + sizeof(void *))));\n" + + "\t\targs_mem_loc[_ptr_i] = (cl_void *)((char *)args_address + (12 + 4 + _ptr_i * (4 + sizeof(void *))));\n" + "\t\t_ptr_i++;\n" + "\t}", nativeAfterCall = "\tfree(args_mem_loc);" @@ -1085,7 +1083,7 @@ @cl_int int clEnqueueNativeKernel(@PointerWrapper("cl_command_queue") CLCommandQueue command_queue, @PointerWrapper("cl_native_kernel_func") CLNativeKernel user_func, - @Constant("args, 0") @cl_void ByteBuffer args, + @Constant("MemoryUtil.getAddress0(args)") @cl_void ByteBuffer args, @AutoSize("args") @size_t long cb_args, @Constant("mem_list == null ? 0 : mem_list.length") @cl_uint int num_mem_objects, @Check(value = "1", canBeNull = true) @PointerArray("num_mem_objects") @Const @NativeType("cl_mem") CLMem[] mem_list, @@ -1102,7 +1100,7 @@ @Alternate("clWaitForEvents") @cl_int int clWaitForEvents(@Constant("1") @cl_uint int num_events, - @Constant(value = "APIUtil.getBufferPointer().put(0, event).getBuffer(), 0", keepParam = true) CLEvent event); + @Constant(value = "APIUtil.getPointer(event)", keepParam = true) CLEvent event); @cl_int int clGetEventInfo(@PointerWrapper("cl_event") CLEvent event, @@ -1136,7 +1134,7 @@ @cl_int int clEnqueueWaitForEvents(@PointerWrapper("cl_command_queue") CLCommandQueue command_queue, @Constant("1") @cl_uint int num_events, - @Constant(value = "APIUtil.getBufferPointer().put(0, event).getBuffer(), 0", keepParam = true) CLEvent event); + @Constant(value = "APIUtil.getPointer(event)", keepParam = true) CLEvent event); @cl_int int clGetEventProfilingInfo(@PointerWrapper("cl_event") CLEvent event, @@ -1153,11 +1151,11 @@ @Private @PointerWrapper("void *") - CLFunctionAddress clGetExtensionFunctionAddress(@Check("1") @Const @cl_char ByteBuffer func_name); + CLFunctionAddress clGetExtensionFunctionAddress(@NullTerminated @Const @cl_char ByteBuffer func_name); @Alternate("clGetExtensionFunctionAddress") @Private @PointerWrapper("void *") - CLFunctionAddress clGetExtensionFunctionAddress(CharSequence func_name); + CLFunctionAddress clGetExtensionFunctionAddress(@NullTerminated CharSequence func_name); } \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opencl/CL11.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opencl/CL11.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opencl/CL11.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opencl/CL11.java 2016-04-09 16:26:56.000000000 +0000 @@ -121,14 +121,14 @@ int clEnqueueReadBufferRect(@PointerWrapper("cl_command_queue") CLCommandQueue command_queue, @PointerWrapper("cl_mem") CLMem buffer, @cl_bool int blocking_read, - @Const @Check("3") @NativeType("size_t") PointerBuffer buffer_origin, - @Const @Check("3") @NativeType("size_t") PointerBuffer host_origin, + @Const @Check("3") @NativeType("size_t") PointerBuffer buffer_offset, + @Const @Check("3") @NativeType("size_t") PointerBuffer host_offset, @Const @Check("3") @NativeType("size_t") PointerBuffer region, @size_t long buffer_row_pitch, @size_t long buffer_slice_pitch, @size_t long host_row_pitch, @size_t long host_slice_pitch, - @OutParameter @Check("CLChecks.calculateBufferRectSize(host_origin, region, host_row_pitch, host_slice_pitch)") + @OutParameter @Check("CLChecks.calculateBufferRectSize(host_offset, region, host_row_pitch, host_slice_pitch)") @cl_byte @cl_short @cl_int @@ -144,14 +144,14 @@ int clEnqueueWriteBufferRect(@PointerWrapper("cl_command_queue") CLCommandQueue command_queue, @PointerWrapper("cl_mem") CLMem buffer, @cl_bool int blocking_write, - @Const @Check("3") @NativeType("size_t") PointerBuffer buffer_origin, - @Const @Check("3") @NativeType("size_t") PointerBuffer host_origin, + @Const @Check("3") @NativeType("size_t") PointerBuffer buffer_offset, + @Const @Check("3") @NativeType("size_t") PointerBuffer host_offset, @Const @Check("3") @NativeType("size_t") PointerBuffer region, @size_t long buffer_row_pitch, @size_t long buffer_slice_pitch, @size_t long host_row_pitch, @size_t long host_slice_pitch, - @Const @Check("CLChecks.calculateBufferRectSize(host_origin, region, host_row_pitch, host_slice_pitch)") + @Const @Check("CLChecks.calculateBufferRectSize(host_offset, region, host_row_pitch, host_slice_pitch)") @cl_byte @cl_short @cl_int @@ -190,7 +190,8 @@ @Code( tryBlock = true, // Create a GlobalRef to the callback object. - javaBeforeNative = "\t\tlong user_data = CallbackUtil.createGlobalRef(pfn_notify);", + javaBeforeNative = "\t\tlong user_data = CallbackUtil.createGlobalRef(pfn_notify);\n" + + "\t\tpfn_notify.setRegistry(event.getParentRegistry());", // Check if we need to delete the GlobalRef. javaFinally = "\t\t\tCallbackUtil.checkCallback(__result, user_data);" ) diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opencl/CL12GL.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opencl/CL12GL.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opencl/CL12GL.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opencl/CL12GL.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opencl; + +import org.lwjgl.util.generator.Check; +import org.lwjgl.util.generator.NativeType; +import org.lwjgl.util.generator.OutParameter; +import org.lwjgl.util.generator.PointerWrapper; +import org.lwjgl.util.generator.opencl.cl_int; + +import java.nio.IntBuffer; + +/** The core OpenCL 1.2 OpenGL interrop functionality. */ +public interface CL12GL { + + /* cl_gl_object_type */ + int CL_GL_OBJECT_TEXTURE2D_ARRAY = 0x200E, + CL_GL_OBJECT_TEXTURE1D = 0x200F, + CL_GL_OBJECT_TEXTURE1D_ARRAY = 0x2010, + CL_GL_OBJECT_TEXTURE_BUFFER = 0x2011; + + @Check(value = "errcode_ret", canBeNull = true) + @PointerWrapper(value = "cl_mem", params = "context") + CLMem clCreateFromGLTexture(@PointerWrapper("cl_context") CLContext context, + @NativeType("cl_mem_flags") long flags, + @NativeType("GLenum") int target, + @NativeType("GLint") int miplevel, + @NativeType("GLuint") int texture, + @OutParameter @Check(value = "1", canBeNull = true) @cl_int IntBuffer errcode_ret); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opencl/CL12.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opencl/CL12.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opencl/CL12.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opencl/CL12.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,454 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opencl; + +import org.lwjgl.PointerBuffer; +import org.lwjgl.util.generator.*; +import org.lwjgl.util.generator.opencl.*; + +import java.nio.Buffer; +import java.nio.ByteBuffer; +import java.nio.IntBuffer; +import java.nio.LongBuffer; + +/** The core OpenCL 1.1 API */ +public interface CL12 { + + /** Error Codes */ + int CL_COMPILE_PROGRAM_FAILURE = -15, + CL_LINKER_NOT_AVAILABLE = -16, + CL_LINK_PROGRAM_FAILURE = -17, + CL_DEVICE_PARTITION_FAILED = -18, + CL_KERNEL_ARG_INFO_NOT_AVAILABLE = -19, + CL_INVALID_IMAGE_DESCRIPTOR = -65, + CL_INVALID_COMPILER_OPTIONS = -66, + CL_INVALID_LINKER_OPTIONS = -67, + CL_INVALID_DEVICE_PARTITION_COUNT = -68; + + /** OpenCL Version */ + int CL_VERSION_1_2 = 1; + + /** cl_bool */ + int CL_BLOCKING = CL10.CL_TRUE, + CL_NON_BLOCKING = CL10.CL_FALSE; + + /** cl_device_type - bitfield */ + int CL_DEVICE_TYPE_CUSTOM = (1 << 4); + + /* cl_device_info */ + int CL_DEVICE_DOUBLE_FP_CONFIG = 0x1032, + CL_DEVICE_LINKER_AVAILABLE = 0x103E, + CL_DEVICE_BUILT_IN_KERNELS = 0x103F, + CL_DEVICE_IMAGE_MAX_BUFFER_SIZE = 0x1040, + CL_DEVICE_IMAGE_MAX_ARRAY_SIZE = 0x1041, + CL_DEVICE_PARENT_DEVICE = 0x1042, + CL_DEVICE_PARTITION_MAX_SUB_DEVICES = 0x1043, + CL_DEVICE_PARTITION_PROPERTIES = 0x1044, + CL_DEVICE_PARTITION_AFFINITY_DOMAIN = 0x1045, + CL_DEVICE_PARTITION_TYPE = 0x1046, + CL_DEVICE_REFERENCE_COUNT = 0x1047, + CL_DEVICE_PREFERRED_INTEROP_USER_SYNC = 0x1048, + CL_DEVICE_PRINTF_BUFFER_SIZE = 0x1049; + + /* cl_device_fp_config - bitfield */ + int CL_FP_CORRECTLY_ROUNDED_DIVIDE_SQRT = (1 << 7); + + /* cl_context_properties */ + int CL_CONTEXT_INTEROP_USER_SYNC = 0x1085; + + /* cl_device_partition_property */ + int CL_DEVICE_PARTITION_EQUALLY = 0x1086, + CL_DEVICE_PARTITION_BY_COUNTS = 0x1087, + CL_DEVICE_PARTITION_BY_COUNTS_LIST_END = 0x0, + CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN = 0x1088; + + /* cl_device_affinity_domain */ + int CL_DEVICE_AFFINITY_DOMAIN_NUMA = (1 << 0), + CL_DEVICE_AFFINITY_DOMAIN_L4_CACHE = (1 << 1), + CL_DEVICE_AFFINITY_DOMAIN_L3_CACHE = (1 << 2), + CL_DEVICE_AFFINITY_DOMAIN_L2_CACHE = (1 << 3), + CL_DEVICE_AFFINITY_DOMAIN_L1_CACHE = (1 << 4), + CL_DEVICE_AFFINITY_DOMAIN_NEXT_PARTITIONABLE = (1 << 5); + + /* cl_mem_flags - bitfield */ + int CL_MEM_HOST_WRITE_ONLY = (1 << 7), + CL_MEM_HOST_READ_ONLY = (1 << 8), + CL_MEM_HOST_NO_ACCESS = (1 << 9); + + /* cl_mem_migration_flags - bitfield */ + int CL_MIGRATE_MEM_OBJECT_HOST = (1 << 0), + CL_MIGRATE_MEM_OBJECT_CONTENT_UNDEFINED = (1 << 1); + + /* cl_mem_object_type */ + int CL_MEM_OBJECT_IMAGE2D_ARRAY = 0x10F3, + CL_MEM_OBJECT_IMAGE1D = 0x10F4, + CL_MEM_OBJECT_IMAGE1D_ARRAY = 0x10F5, + CL_MEM_OBJECT_IMAGE1D_BUFFER = 0x10F6; + + /* cl_image_info */ + int CL_IMAGE_ARRAY_SIZE = 0x1117, + CL_IMAGE_BUFFER = 0x1118, + CL_IMAGE_NUM_MIP_LEVELS = 0x1119, + CL_IMAGE_NUM_SAMPLES = 0x111A; + + /* cl_map_flags - bitfield */ + int CL_MAP_WRITE_INVALIDATE_REGION = (1 << 2); + + /* cl_program_info */ + int CL_PROGRAM_NUM_KERNELS = 0x1167, + CL_PROGRAM_KERNEL_NAMES = 0x1168; + + /* cl_program_build_info */ + int CL_PROGRAM_BINARY_TYPE = 0x1184; + + /* cl_program_binary_type */ + int CL_PROGRAM_BINARY_TYPE_NONE = 0x0, + CL_PROGRAM_BINARY_TYPE_COMPILED_OBJECT = 0x1, + CL_PROGRAM_BINARY_TYPE_LIBRARY = 0x2, + CL_PROGRAM_BINARY_TYPE_EXECUTABLE = 0x4; + + /* cl_kernel_info */ + int CL_KERNEL_ATTRIBUTES = 0x1195; + + /* cl_kernel_arg_info */ + int CL_KERNEL_ARG_ADDRESS_QUALIFIER = 0x1196, + CL_KERNEL_ARG_ACCESS_QUALIFIER = 0x1197, + CL_KERNEL_ARG_TYPE_NAME = 0x1198, + CL_KERNEL_ARG_TYPE_QUALIFIER = 0x1199, + CL_KERNEL_ARG_NAME = 0x119A; + + /* cl_kernel_arg_address_qualifier */ + int CL_KERNEL_ARG_ADDRESS_GLOBAL = 0x119A, + CL_KERNEL_ARG_ADDRESS_LOCAL = 0x119B, + CL_KERNEL_ARG_ADDRESS_CONSTANT = 0x119C, + CL_KERNEL_ARG_ADDRESS_PRIVATE = 0x119D; + + /* cl_kernel_arg_access_qualifier */ + int CL_KERNEL_ARG_ACCESS_READ_ONLY = 0x11A0, + CL_KERNEL_ARG_ACCESS_WRITE_ONLY = 0x11A1, + CL_KERNEL_ARG_ACCESS_READ_WRITE = 0x11A2, + CL_KERNEL_ARG_ACCESS_NONE = 0x11A3; + + /* cl_kernel_arg_type_qualifer */ + int CL_KERNEL_ARG_TYPE_NONE = 0, + CL_KERNEL_ARG_TYPE_CONST = (1 << 0), + CL_KERNEL_ARG_TYPE_RESTRICT = (1 << 1), + CL_KERNEL_ARG_TYPE_VOLATILE = (1 << 2); + + /* cl_kernel_work_group_info */ + int CL_KERNEL_GLOBAL_WORK_SIZE = 0x11B5; + + /* cl_command_type */ + int CL_COMMAND_BARRIER = 0x1205, + CL_COMMAND_MIGRATE_MEM_OBJECTS = 0x1206, + CL_COMMAND_FILL_BUFFER = 0x1207, + CL_COMMAND_FILL_IMAGE = 0x1208; + + @Code(javaAfterNative = "\t\tif ( __result == CL10.CL_SUCCESS ) device.retain();") + @cl_int + int clRetainDevice(@PointerWrapper("cl_device_id") CLDevice device); + + /** + * Warning: LWJGL will not automatically release any objects associated with sub-devices. + * The user is responsible for tracking and releasing everything prior to calling this method. + * + * @param device the parent CLDevice + * + * @return the error code + */ + @Code( + javaBeforeNative = "\t\tAPIUtil.releaseObjects(device);", + javaAfterNative = "\t\tif ( __result == CL10.CL_SUCCESS ) device.release();" + ) + @cl_int + int clReleaseDevice(@PointerWrapper("cl_device_id") CLDevice device); + + @Code(javaAfterNative = "\t\tif ( __result == CL10.CL_SUCCESS && out_devices != null ) in_device.registerSubCLDevices(out_devices);") + @cl_int + int clCreateSubDevices( + @PointerWrapper("cl_device_id") CLDevice in_device, + @NullTerminated @Const @NativeType("cl_device_partition_property") LongBuffer properties, + @AutoSize(value = "out_devices", canBeNull = true) @cl_uint int num_devices, + @OutParameter @Check(canBeNull = true) @NativeType("cl_device_id") PointerBuffer out_devices, + @OutParameter @Check(value = "1", canBeNull = true) @cl_uint IntBuffer num_devices_ret); + + @Check(value = "errcode_ret", canBeNull = true) + @PointerWrapper(value = "cl_mem", params = "context") + CLMem clCreateImage(@PointerWrapper("cl_context") CLContext context, + @NativeType("cl_mem_flags") long flags, + @Check("2 * 4") @Const @NativeType("cl_image_format") ByteBuffer image_format, + // On x64 there's 4 byte padding after image_type (to align image_width) + @Check("7 * PointerBuffer.getPointerSize() + 2 * 4 + PointerBuffer.getPointerSize()") @Const @NativeType("cl_image_desc") ByteBuffer image_desc, + @Check(canBeNull = true) + @cl_byte + @cl_short + @cl_int + @cl_float Buffer host_ptr, + @OutParameter @Check(value = "1", canBeNull = true) @cl_int IntBuffer errcode_ret); + + @Check(value = "errcode_ret", canBeNull = true) + @PointerWrapper(value = "cl_program", params = "context") + CLProgram clCreateProgramWithBuiltInKernels(@PointerWrapper("cl_context") CLContext context, + @AutoSize("device_list") @cl_uint int num_devices, + @Check("1") @Const @NativeType("cl_device_id") PointerBuffer device_list, + @Check @Const @cl_char ByteBuffer kernel_names, + @OutParameter @Check(value = "1", canBeNull = true) @cl_int IntBuffer errcode_ret); + + @Alternate("clCreateProgramWithBuiltInKernels") + @Check(value = "errcode_ret", canBeNull = true) + @PointerWrapper(value = "cl_program", params = "context") + CLProgram clCreateProgramWithBuiltInKernels(@PointerWrapper("cl_context") CLContext context, + @AutoSize("device_list") @cl_uint int num_devices, + @Check("1") @Const @NativeType("cl_device_id") PointerBuffer device_list, + CharSequence kernel_names, + @OutParameter @Check(value = "1", canBeNull = true) @cl_int IntBuffer errcode_ret); + + /** Single null-terminated header include name. */ + @Code( + tryBlock = true, + // Create a GlobalRef to the callback object. + javaBeforeNative = "\t\tlong user_data = CallbackUtil.createGlobalRef(pfn_notify);\n" + + "\t\tif ( pfn_notify != null ) pfn_notify.setContext(program.getParent());", + // Check if we need to delete the GlobalRef. + javaFinally = "\t\t\tCallbackUtil.checkCallback(__result, user_data);" + ) + @cl_int + int clCompileProgram(@PointerWrapper("cl_program") CLProgram program, + @AutoSize(value = "device_list", canBeNull = true) @cl_uint int num_devices, + @Check(canBeNull = true) @Const @NativeType("cl_device_id") PointerBuffer device_list, + @Check @NullTerminated @Const @cl_char ByteBuffer options, + @Constant("1") @cl_uint int num_input_headers, + @Check("1") @Const @NativeType("cl_program") PointerBuffer input_header, + @NullTerminated @Check @Const @cl_char @Indirect ByteBuffer header_include_name, + @PointerWrapper(value = "cl_program_callback", canBeNull = true) CLCompileProgramCallback pfn_notify, + @Constant("user_data") @PointerWrapper("void *") long user_data); + + /** Multiple null-terminated header include names, one after the other. */ + @Alternate(value = "clCompileProgram", nativeAlt = true, javaAlt = true) + @Code( + tryBlock = true, + // Create a GlobalRef to the callback object. + javaBeforeNative = "\t\tlong user_data = CallbackUtil.createGlobalRef(pfn_notify);\n" + + "\t\tif ( pfn_notify != null ) pfn_notify.setContext(program.getParent());", + // Check if we need to delete the GlobalRef. + javaFinally = "\t\t\tCallbackUtil.checkCallback(__result, user_data);" + ) + @cl_int + int clCompileProgramMulti(@PointerWrapper("cl_program") CLProgram program, + @AutoSize(value = "device_list", canBeNull = true) @cl_uint int num_devices, + @Check(canBeNull = true) @Const @NativeType("cl_device_id") PointerBuffer device_list, + @Check @NullTerminated @Const @cl_char ByteBuffer options, + @AutoSize("input_headers") @cl_uint int num_input_headers, + @Check("1") @Const @NativeType("cl_program") PointerBuffer input_headers, + @NullTerminated("input_headers.remaining()") @Check @Const @Indirect @cl_char @PointerArray("num_input_headers") ByteBuffer header_include_names, + @PointerWrapper(value = "cl_program_callback", canBeNull = true) CLCompileProgramCallback pfn_notify, + @Constant("user_data") @PointerWrapper("void *") long user_data); + + @Alternate(value = "clCompileProgram", nativeAlt = true) + @Code( + tryBlock = true, + // Create a GlobalRef to the callback object. + javaBeforeNative = "\t\tlong user_data = CallbackUtil.createGlobalRef(pfn_notify);\n" + + "\t\tif ( pfn_notify != null ) pfn_notify.setContext(program.getParent());", + // Check if we need to delete the GlobalRef. + javaFinally = "\t\t\tCallbackUtil.checkCallback(__result, user_data);" + ) + @cl_int + int clCompileProgram3(@PointerWrapper("cl_program") CLProgram program, + @AutoSize(value = "device_list", canBeNull = true) @cl_uint int num_devices, + @Check(canBeNull = true) @Const @NativeType("cl_device_id") PointerBuffer device_list, + @Check @NullTerminated @Const @cl_char ByteBuffer options, + @Constant("header_include_names.length") @cl_uint int num_input_headers, + @Check("header_include_names.length") @Const @NativeType("cl_program") PointerBuffer input_headers, + @NullTerminated @Check("1") @PointerArray(value = "num_input_headers") @Const @NativeType("cl_char") ByteBuffer[] header_include_names, + @PointerWrapper(value = "cl_program_callback", canBeNull = true) CLCompileProgramCallback pfn_notify, + @Constant("user_data") @PointerWrapper("void *") long user_data); + + @Alternate("clCompileProgram") + @Code( + tryBlock = true, + // Create a GlobalRef to the callback object. + javaBeforeNative = "\t\tlong user_data = CallbackUtil.createGlobalRef(pfn_notify);\n" + + "\t\tif ( pfn_notify != null ) pfn_notify.setContext(program.getParent());", + // Check if we need to delete the GlobalRef. + javaFinally = "\t\t\tCallbackUtil.checkCallback(__result, user_data);" + ) + @cl_int + int clCompileProgram(@PointerWrapper("cl_program") CLProgram program, + @AutoSize(value = "device_list", canBeNull = true) @cl_uint int num_devices, + @Check(canBeNull = true) @Const @NativeType("cl_device_id") PointerBuffer device_list, + @NullTerminated CharSequence options, + @Constant("1") @cl_uint int num_input_headers, + @Check("1") @Const @NativeType("cl_program") PointerBuffer input_header, + @NullTerminated @Const CharSequence header_include_name, + @PointerWrapper(value = "cl_program_callback", canBeNull = true) CLCompileProgramCallback pfn_notify, + @Constant("user_data") @PointerWrapper("void *") long user_data); + + @Alternate(value = "clCompileProgram", nativeAlt = true, skipNative = true) + @Code( + tryBlock = true, + // Create a GlobalRef to the callback object. + javaBeforeNative = "\t\tlong user_data = CallbackUtil.createGlobalRef(pfn_notify);\n" + + "\t\tif ( pfn_notify != null ) pfn_notify.setContext(program.getParent());", + // Check if we need to delete the GlobalRef. + javaFinally = "\t\t\tCallbackUtil.checkCallback(__result, user_data);" + ) + @cl_int + int clCompileProgramMulti(@PointerWrapper("cl_program") CLProgram program, + @AutoSize(value = "device_list", canBeNull = true) @cl_uint int num_devices, + @Check(canBeNull = true) @Const @NativeType("cl_device_id") PointerBuffer device_list, + @NullTerminated CharSequence options, + @AutoSize("input_header") @cl_uint int num_input_headers, + @Check("1") @Const @NativeType("cl_program") PointerBuffer input_header, + @NullTerminated @PointerArray(value = "num_input_headers") @Const CharSequence[] header_include_name, + @PointerWrapper(value = "cl_program_callback", canBeNull = true) CLCompileProgramCallback pfn_notify, + @Constant("user_data") @PointerWrapper("void *") long user_data); + + @Code( + tryBlock = true, + // Create a GlobalRef to the callback object. + javaBeforeNative = "\t\tlong user_data = CallbackUtil.createGlobalRef(pfn_notify);\n" + + "\t\tif ( pfn_notify != null ) pfn_notify.setContext(context);", + // Check if we need to delete the GlobalRef. + javaFinally = "\t\t\tCallbackUtil.checkCallback(errcode_ret.get(errcode_ret.position()), user_data);" + ) + @Check(value = "errcode_ret", canBeNull = true) + @PointerWrapper(value = "cl_program", params = "context") + CLProgram clLinkProgram(@PointerWrapper("cl_context") CLContext context, + @AutoSize(value = "device_list", canBeNull = true) @cl_uint int num_devices, + @Check(canBeNull = true) @Const @NativeType("cl_device_id") PointerBuffer device_list, + @NullTerminated @Check @Const @cl_char ByteBuffer options, + @AutoSize("input_programs") @cl_uint int num_input_programs, + @Check @Const @NativeType("cl_program") PointerBuffer input_programs, + @PointerWrapper(value = "cl_program_callback", canBeNull = true) CLLinkProgramCallback pfn_notify, + @Constant("user_data") @PointerWrapper("void *") long user_data, + @OutParameter @Check("1") @cl_int IntBuffer errcode_ret); + + @Alternate("clLinkProgram") + @Code( + tryBlock = true, + // Create a GlobalRef to the callback object. + javaBeforeNative = "\t\tlong user_data = CallbackUtil.createGlobalRef(pfn_notify);\n" + + "\t\tif ( pfn_notify != null ) pfn_notify.setContext(context);", + // Check if we need to delete the GlobalRef. + javaFinally = "\t\t\tCallbackUtil.checkCallback(errcode_ret.get(errcode_ret.position()), user_data);" + ) + @Check(value = "errcode_ret", canBeNull = true) + @PointerWrapper(value = "cl_program", params = "context") + CLProgram clLinkProgram(@PointerWrapper("cl_context") CLContext context, + @AutoSize(value = "device_list", canBeNull = true) @cl_uint int num_devices, + @Check(canBeNull = true) @Const @NativeType("cl_device_id") PointerBuffer device_list, + @NullTerminated CharSequence options, + @AutoSize("input_programs") @cl_uint int num_input_programs, + @Check @Const @NativeType("cl_program") PointerBuffer input_programs, + @PointerWrapper(value = "cl_program_callback", canBeNull = true) CLLinkProgramCallback pfn_notify, + @Constant("user_data") @PointerWrapper("void *") long user_data, + @OutParameter @Check("1") @cl_int IntBuffer errcode_ret); + + @cl_int + int clUnloadPlatformCompiler(@PointerWrapper("cl_platform_id") CLPlatform platform); + + @cl_int + int clGetKernelArgInfo(@PointerWrapper("cl_kernel") CLKernel kernel, + @cl_uint int arg_indx, + @NativeType("cl_kernel_arg_info") int param_name, + @AutoSize(value = "param_value", canBeNull = true) @size_t long param_value_size, + @OutParameter @Check(canBeNull = true) @cl_void ByteBuffer param_value, + @OutParameter @Check(value = "1", canBeNull = true) @NativeType("size_t") PointerBuffer param_value_size_ret); + + @cl_int + int clEnqueueFillBuffer(@PointerWrapper("cl_command_queue") CLCommandQueue command_queue, + @PointerWrapper("cl_mem") CLMem buffer, + @Check @Const @cl_void ByteBuffer pattern, + @AutoSize("pattern") @size_t long pattern_size, + @size_t long offset, + @size_t long size, + @AutoSize(value = "event_wait_list", canBeNull = true) @cl_uint int num_events_in_wait_list, + @Check(canBeNull = true) @Const @NativeType("cl_event") PointerBuffer event_wait_list, + @OutParameter @Check(value = "1", canBeNull = true) @NativeType("cl_event") PointerBuffer event); + + @cl_int + int clEnqueueFillImage(@PointerWrapper("cl_command_queue") CLCommandQueue command_queue, + @PointerWrapper("cl_mem") CLMem image, + @Check("4 * 4") @Const @cl_void ByteBuffer fill_color, + @Check("3") @Const @NativeType("size_t") PointerBuffer origin, + @Check("3") @Const @NativeType("size_t") PointerBuffer region, + @AutoSize(value = "event_wait_list", canBeNull = true) @cl_uint int num_events_in_wait_list, + @Check(canBeNull = true) @Const @NativeType("cl_event") PointerBuffer event_wait_list, + @OutParameter @Check(value = "1", canBeNull = true) @NativeType("cl_event") PointerBuffer event); + + @cl_int + int clEnqueueMigrateMemObjects(@PointerWrapper("cl_command_queue") CLCommandQueue command_queue, + @AutoSize("mem_objects") @cl_uint int num_mem_objects, + @Check @Const @NativeType("cl_mem") PointerBuffer mem_objects, + @NativeType("cl_mem_migration_flags") long flags, + @AutoSize(value = "event_wait_list", canBeNull = true) @cl_uint int num_events_in_wait_list, + @Check(canBeNull = true) @Const @NativeType("cl_event") PointerBuffer event_wait_list, + @OutParameter @Check(value = "1", canBeNull = true) @NativeType("cl_event") PointerBuffer event); + + @cl_int + int clEnqueueMarkerWithWaitList(@PointerWrapper("cl_command_queue") CLCommandQueue command_queue, + @AutoSize(value = "event_wait_list", canBeNull = true) @cl_uint int num_events_in_wait_list, + @Check(canBeNull = true) @Const @NativeType("cl_event") PointerBuffer event_wait_list, + @OutParameter @Check(value = "1", canBeNull = true) @NativeType("cl_event") PointerBuffer event); + + @cl_int + int clEnqueueBarrierWithWaitList(@PointerWrapper("cl_command_queue") CLCommandQueue command_queue, + @AutoSize(value = "event_wait_list", canBeNull = true) @cl_uint int num_events_in_wait_list, + @Check(canBeNull = true) @Const @NativeType("cl_event") PointerBuffer event_wait_list, + @OutParameter @Check(value = "1", canBeNull = true) @NativeType("cl_event") PointerBuffer event); + + @Optional(reason = "Missing from AMD CL 1.2 preview drivers.") + @Code( + tryBlock = true, + // Create a GlobalRef to the callback object. + javaBeforeNative = "\t\tlong user_data = CallbackUtil.createGlobalRef(pfn_notify);", + // Check if we need to delete the GlobalRef. + javaFinally = "\t\t\tcontext.setPrintfCallback(user_data, __result);" + ) + @cl_int + int clSetPrintfCallback(@PointerWrapper("cl_context") CLContext context, + @PointerWrapper("cl_printf_callback") CLPrintfCallback pfn_notify, + @Constant("user_data") @PointerWrapper("void *") long user_data); + + @Private + @PointerWrapper("void *") + CLFunctionAddress clGetExtensionFunctionAddressForPlatform(@PointerWrapper("cl_platform_id") CLPlatform platform, + @NullTerminated @Const @cl_char ByteBuffer func_name); + + @Alternate("clGetExtensionFunctionAddressForPlatform") + @Private + @PointerWrapper("void *") + CLFunctionAddress clGetExtensionFunctionAddressForPlatform(@PointerWrapper("cl_platform_id") CLPlatform platform, + @NullTerminated CharSequence func_name); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opencl/EXT_atomic_counters_32.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opencl/EXT_atomic_counters_32.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opencl/EXT_atomic_counters_32.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opencl/EXT_atomic_counters_32.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2002-2010 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opencl; + +import org.lwjgl.util.generator.opencl.CLDeviceExtension; + +@CLDeviceExtension +public interface EXT_atomic_counters_32 { + + /** CLDevice query: Max number of atomic counters that can be used by a kernel. */ + int CL_DEVICE_MAX_ATOMIC_COUNTERS_EXT = 0x4032; + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opencl/EXT_atomic_counters_64.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opencl/EXT_atomic_counters_64.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opencl/EXT_atomic_counters_64.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opencl/EXT_atomic_counters_64.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2002-2010 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opencl; + +import org.lwjgl.util.generator.opencl.CLDeviceExtension; + +@CLDeviceExtension +public interface EXT_atomic_counters_64 { + + /** CLDevice query: Max number of atomic counters that can be used by a kernel. */ + int CL_DEVICE_MAX_ATOMIC_COUNTERS_EXT = 0x4032; + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opencl/EXT_device_fission.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opencl/EXT_device_fission.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opencl/EXT_device_fission.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opencl/EXT_device_fission.java 2016-04-09 16:26:56.000000000 +0000 @@ -135,7 +135,6 @@ @cl_int int clCreateSubDevicesEXT( @PointerWrapper("cl_device_id") CLDevice in_device, - // TODO: cl_device_partition_property_ext is a cl_bitfield (ulong), but the spec says properties is a {property-value, cl_int[]} list... @NullTerminated @Const @NativeType("cl_device_partition_property_ext") LongBuffer properties, @AutoSize(value = "out_devices", canBeNull = true) @cl_uint int num_entries, @OutParameter @Check(canBeNull = true) @NativeType("cl_device_id") PointerBuffer out_devices, diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opencl/EXT_migrate_memobject.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opencl/EXT_migrate_memobject.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opencl/EXT_migrate_memobject.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opencl/EXT_migrate_memobject.java 2016-04-09 16:26:56.000000000 +0000 @@ -68,7 +68,7 @@ @cl_int int clEnqueueMigrateMemObjectEXT(@PointerWrapper("cl_command_queue") CLCommandQueue command_queue, @Constant("1") @cl_uint int num_mem_objects, - @Constant(value = "APIUtil.getBufferPointer().put(0, mem_object).getBuffer(), 0", keepParam = true) CLMem mem_object, + @Constant(value = "APIUtil.getPointer(mem_object)", keepParam = true) CLMem mem_object, @cl_bitfield @NativeType("cl_mem_migration_flags_ext") long flags, @AutoSize(value = "event_wait_list", canBeNull = true) @cl_uint int num_events_in_wait_list, @Check(canBeNull = true) @Const @NativeType("cl_event") PointerBuffer event_wait_list, diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opencl/INTEL_immediate_execution.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opencl/INTEL_immediate_execution.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opencl/INTEL_immediate_execution.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opencl/INTEL_immediate_execution.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2002-2010 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opencl; + +import org.lwjgl.util.generator.opencl.CLDeviceExtension; + +@CLDeviceExtension +public interface INTEL_immediate_execution { + + // TODO: Update when spec is released publicly. + + /** cl_command_queue_properties - bitfield */ + int CL_QUEUE_IMMEDIATE_EXECUTION_ENABLE_INTEL = (1 << 2); + + /** cl_device_exec_capabilities - bitfield */ + int CL_EXEC_IMMEDIATE_EXECUTION_INTEL = (1 << 2); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opencl/INTEL_printf.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opencl/INTEL_printf.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opencl/INTEL_printf.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opencl/INTEL_printf.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2002-2010 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opencl; + +import org.lwjgl.util.generator.opencl.CLDeviceExtension; + +@CLDeviceExtension +public interface INTEL_printf { + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opencl/INTEL_thread_local_exec.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opencl/INTEL_thread_local_exec.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opencl/INTEL_thread_local_exec.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opencl/INTEL_thread_local_exec.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2002-2012 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opencl; + +import org.lwjgl.util.generator.opencl.CLDeviceExtension; + +@CLDeviceExtension +public interface INTEL_thread_local_exec { + + /** + * Allows the user to execute OpenCL tasks and kernels with + * the user application's threads. This token that can + * be passed to clCreateCommandQueue, creating a queue with the "thread + * local exec" capability. + *

        + * All enqueue APIs (e.g., clEnqueueRead) submitted to such a queue + * never enqueue commands. An Enqueue API call is executed by the + * caller host-thread itself without involving any of the OpenCL + * runtime threads, much like function calls. + */ + int CL_QUEUE_THREAD_LOCAL_EXEC_ENABLE_INTEL = (1 << 31); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opencl/KHR_depth_images.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opencl/KHR_depth_images.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opencl/KHR_depth_images.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opencl/KHR_depth_images.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2002-2012 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opencl; + +import org.lwjgl.util.generator.opencl.CLDeviceExtension; + +@CLDeviceExtension +public interface KHR_depth_images { + + /** cl_channel_order */ + int CL_DEPTH = 0x10BD; + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opencl/KHR_gl_depth_images.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opencl/KHR_gl_depth_images.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opencl/KHR_gl_depth_images.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opencl/KHR_gl_depth_images.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2002-2012 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opencl; + +import org.lwjgl.util.generator.Extension; +import org.lwjgl.util.generator.opencl.CLDeviceExtension; + +@CLDeviceExtension +@Extension(postfix = "KHR", className = "KHRGLDepthImages") +public interface KHR_gl_depth_images { + + /** cl_channel_order */ + int CL_DEPTH_STENCIL = 0x10BE; + + /** cl_channel_type */ + int CL_UNORM_INT24 = 0x10DF; + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opencl/KHR_gl_msaa_sharing.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opencl/KHR_gl_msaa_sharing.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opencl/KHR_gl_msaa_sharing.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opencl/KHR_gl_msaa_sharing.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2002-2012 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opencl; + +import org.lwjgl.util.generator.Extension; +import org.lwjgl.util.generator.opencl.CLDeviceExtension; + +@CLDeviceExtension +@Extension(postfix = "KHR", className = "KHRGLMsaaSharing") +public interface KHR_gl_msaa_sharing { + + /** cl_gl_texture_info */ + int CL_GL_NUM_SAMPLES = 0x2012; + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opencl/KHR_icd.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opencl/KHR_icd.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opencl/KHR_icd.java 2011-03-26 18:15:36.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opencl/KHR_icd.java 2016-04-09 16:26:56.000000000 +0000 @@ -49,7 +49,7 @@ /** Returned by clGetPlatformIDs when no platforms are found */ int CL_PLATFORM_NOT_FOUND_KHR = -1001; - @Optional(reason = "AMD Stream does not expose this (version tested: 2.2)") + @Optional(reason = "AMD Stream does not expose this (version tested: 2.5)") @cl_int int clIcdGetPlatformIDsKHR(@AutoSize(value = "platforms", canBeNull = true) @cl_uint int num_entries, @OutParameter @Check(canBeNull = true) @NativeType("cl_platform_id") PointerBuffer platforms, diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opencl/KHR_image2d_from_buffer.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opencl/KHR_image2d_from_buffer.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opencl/KHR_image2d_from_buffer.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opencl/KHR_image2d_from_buffer.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2002-2012 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opencl; + +import org.lwjgl.util.generator.Extension; +import org.lwjgl.util.generator.opencl.CLDeviceExtension; + +@CLDeviceExtension +@Extension(postfix = "KHR", className = "KHRImage2DFromBuffer") +public interface KHR_image2d_from_buffer { + + /** cl_device_info */ + int CL_DEVICE_IMAGE_PITCH_ALIGNMENT = 0x104A, + CL_DEVICE_IMAGE_BASE_ADDRESS_ALIGNMENT = 0x104B; + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opencl/KHR_initialize_memory.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opencl/KHR_initialize_memory.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opencl/KHR_initialize_memory.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opencl/KHR_initialize_memory.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2002-2012 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opencl; + +import org.lwjgl.util.generator.opencl.CLDeviceExtension; + +@CLDeviceExtension +public interface KHR_initialize_memory { + + /** cl_context_properties */ + int CL_CONTEXT_MEMORY_INITIALIZE_KHR = 0x200E; + + /** */ + int CL_CONTEXT_MEMORY_INITIALIZE_LOCAL_KHR = 0x1, // TODO: Find value + CL_CONTEXT_MEMORY_INITIALIZE_PRIVATE_KHR = 0x2; // TODO: Find value + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opencl/KHR_mipmap_image.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opencl/KHR_mipmap_image.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opencl/KHR_mipmap_image.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opencl/KHR_mipmap_image.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2002-2013 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opencl; + +import org.lwjgl.util.generator.opencl.CLDeviceExtension; + +@CLDeviceExtension +public interface KHR_mipmap_image { + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opencl/KHR_mipmap_image_writes.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opencl/KHR_mipmap_image_writes.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opencl/KHR_mipmap_image_writes.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opencl/KHR_mipmap_image_writes.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2002-2013 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opencl; + +import org.lwjgl.util.generator.opencl.CLDeviceExtension; + +@CLDeviceExtension +public interface KHR_mipmap_image_writes { + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opencl/KHR_spir.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opencl/KHR_spir.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opencl/KHR_spir.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opencl/KHR_spir.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2002-2012 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opencl; + +import org.lwjgl.util.generator.Extension; +import org.lwjgl.util.generator.opencl.CLDeviceExtension; + +@CLDeviceExtension +@Extension(postfix = "KHR", className = "KHRSPIR") +public interface KHR_spir { +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opencl/KHR_srgb_image_writes.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opencl/KHR_srgb_image_writes.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opencl/KHR_srgb_image_writes.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opencl/KHR_srgb_image_writes.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2002-2013 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opencl; + +import org.lwjgl.util.generator.opencl.CLDeviceExtension; + +@CLDeviceExtension +public interface KHR_srgb_image_writes { + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opencl/KHR_subgroups.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opencl/KHR_subgroups.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opencl/KHR_subgroups.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opencl/KHR_subgroups.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2002-2013 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opencl; + +import org.lwjgl.PointerBuffer; +import org.lwjgl.util.generator.*; +import org.lwjgl.util.generator.opencl.CLDeviceExtension; +import org.lwjgl.util.generator.opencl.cl_int; +import org.lwjgl.util.generator.opencl.cl_void; +import org.lwjgl.util.generator.opencl.size_t; + +import java.nio.ByteBuffer; + +@CLDeviceExtension +public interface KHR_subgroups { + + @cl_int + int clGetKernelSubGroupInfoKHR(@PointerWrapper("cl_kernel") CLKernel kernel, + @PointerWrapper(value = "cl_device_id", canBeNull = true) CLDevice device, + @NativeType("cl_kernel_sub_group_info") int param_name, + @AutoSize(value = "input_value", canBeNull = true) @size_t long input_value_size, + @Check(canBeNull = true) @Const @cl_void ByteBuffer input_value, + @AutoSize(value = "param_value", canBeNull = true) @size_t long param_value_size, + @OutParameter @Check(canBeNull = true) @cl_void ByteBuffer param_value, + @OutParameter @Check(value = "1", canBeNull = true) @NativeType("size_t") PointerBuffer param_value_size_ret); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opencl/KHR_terminate_context.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opencl/KHR_terminate_context.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opencl/KHR_terminate_context.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opencl/KHR_terminate_context.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2002-2012 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opencl; + +import org.lwjgl.util.generator.PointerWrapper; +import org.lwjgl.util.generator.opencl.CLDeviceExtension; +import org.lwjgl.util.generator.opencl.cl_int; + +@CLDeviceExtension +public interface KHR_terminate_context { + + int CL_DEVICE_TERMINATE_CAPABILITY_KHR = 0x200F, + CL_CONTEXT_TERMINATE_KHR = 0x2010; + + @cl_int + int clTerminateContextKHR(@PointerWrapper("cl_context") CLContext context); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/AMD_blend_minmax_factor.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/AMD_blend_minmax_factor.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/AMD_blend_minmax_factor.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/AMD_blend_minmax_factor.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2002-2010 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +public interface AMD_blend_minmax_factor { + + /** + * Accepted by the <mode> parameter of BlendEquation and BlendEquationi, and by + * the <modeRGB> and <modeAlpha> parameters of BlendEquationSeparate and + * BlendEquationSeparatei: + */ + int GL_FACTOR_MIN_AMD = 0x901C, + GL_FACTOR_MAX_AMD = 0x901D; + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/AMD_interleaved_elements.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/AMD_interleaved_elements.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/AMD_interleaved_elements.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/AMD_interleaved_elements.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +import org.lwjgl.util.generator.opengl.GLenum; +import org.lwjgl.util.generator.opengl.GLuint; + +public interface AMD_interleaved_elements { + + /** + * Accepted by the <pname> parameter of VertexAttribParameteriAMD and + * GetVertexAttrib{iv|dv|fv|Iiv|Iuiv|Ldv}: + */ + int GL_VERTEX_ELEMENT_SWIZZLE_AMD = 0x91A4; + + /** Selected by the <pname> parameter of ProgramParameteri and GetProgramiv: */ + int GL_VERTEX_ID_SWIZZLE_AMD = 0x91A5; + + void glVertexAttribParameteriAMD(@GLuint int index, @GLenum int pname, int param); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/AMD_multi_draw_indirect.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/AMD_multi_draw_indirect.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/AMD_multi_draw_indirect.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/AMD_multi_draw_indirect.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +import org.lwjgl.util.generator.*; +import org.lwjgl.util.generator.opengl.GLenum; +import org.lwjgl.util.generator.opengl.GLsizei; +import org.lwjgl.util.generator.opengl.GLvoid; + +import java.nio.ByteBuffer; +import java.nio.IntBuffer; + +import javax.lang.model.type.TypeKind; + +public interface AMD_multi_draw_indirect { + + void glMultiDrawArraysIndirectAMD(@GLenum int mode, + @BufferObject(BufferKind.IndirectBO) @Check("(stride == 0 ? 4 * 4 : stride) * primcount") @Const @GLvoid ByteBuffer indirect, + @GLsizei int primcount, + @GLsizei int stride); + + @Alternate("glMultiDrawArraysIndirectAMD") + void glMultiDrawArraysIndirectAMD(@GLenum int mode, + @BufferObject(BufferKind.IndirectBO) @Check("(stride == 0 ? 4 : stride >> 2) * primcount") @Const @GLvoid(TypeKind.INT) IntBuffer indirect, + @GLsizei int primcount, + @GLsizei int stride); + + void glMultiDrawElementsIndirectAMD(@GLenum int mode, + @GLenum int type, + @BufferObject(BufferKind.IndirectBO) @Check("(stride == 0 ? 5 * 4 : stride) * primcount") @Const @GLvoid ByteBuffer indirect, + @GLsizei int primcount, + @GLsizei int stride); + + @Alternate("glMultiDrawElementsIndirectAMD") + void glMultiDrawElementsIndirectAMD(@GLenum int mode, + @GLenum int type, + @BufferObject(BufferKind.IndirectBO) @Check("(stride == 0 ? 5 : stride >> 2) * primcount") @Const @GLvoid(TypeKind.INT) IntBuffer indirect, + @GLsizei int primcount, + @GLsizei int stride); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/AMD_name_gen_delete.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/AMD_name_gen_delete.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/AMD_name_gen_delete.java 2011-03-26 18:15:37.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/AMD_name_gen_delete.java 2016-04-09 16:26:56.000000000 +0000 @@ -58,7 +58,7 @@ void glDeleteNamesAMD(@GLenum int identifier, @AutoSize("names") @GLsizei int num, @Const @GLuint IntBuffer names); @Alternate("glDeleteNamesAMD") - void glDeleteNamesAMD(@GLenum int identifier, @Constant("1") @GLsizei int num, @Constant(value = "APIUtil.getBufferInt().put(0, name), 0", keepParam = true) int name); + void glDeleteNamesAMD(@GLenum int identifier, @Constant("1") @GLsizei int num, @Constant(value = "APIUtil.getInt(caps, name)", keepParam = true) int name); boolean glIsNameAMD(@GLenum int identifier, @GLuint int name); diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/AMD_performance_monitor.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/AMD_performance_monitor.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/AMD_performance_monitor.java 2011-03-26 18:15:37.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/AMD_performance_monitor.java 2016-04-09 16:26:56.000000000 +0000 @@ -32,7 +32,6 @@ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; -import org.lwjgl.util.generator.Alternate; import org.lwjgl.util.generator.opengl.*; import java.nio.ByteBuffer; @@ -41,23 +40,20 @@ public interface AMD_performance_monitor { /** Accepted by the <pame> parameter of GetPerfMonitorCounterInfoAMD */ - int GL_COUNTER_TYPE_AMD = 0x8BC0; - int GL_COUNTER_RANGE_AMD = 0x8BC1; + int GL_COUNTER_TYPE_AMD = 0x8BC0, + GL_COUNTER_RANGE_AMD = 0x8BC1; /** * Returned as a valid value in <data> parameter of * GetPerfMonitorCounterInfoAMD if <pname> = COUNTER_TYPE_AMD */ - int GL_UNSIGNED_INT = 0x1405; - int GL_FLOAT = 0x1406; - int GL_UNSIGNED_INT64_AMD = 0x8BC2; - int GL_PERCENTAGE_AMD = 0x8BC3; + int GL_UNSIGNED_INT64_AMD = 0x8BC2, + GL_PERCENTAGE_AMD = 0x8BC3; /** Accepted by the <pname> parameter of GetPerfMonitorCounterDataAMD */ - - int GL_PERFMON_RESULT_AVAILABLE_AMD = 0x8BC4; - int GL_PERFMON_RESULT_SIZE_AMD = 0x8BC5; - int GL_PERFMON_RESULT_AMD = 0x8BC6; + int GL_PERFMON_RESULT_AVAILABLE_AMD = 0x8BC4, + GL_PERFMON_RESULT_SIZE_AMD = 0x8BC5, + GL_PERFMON_RESULT_AMD = 0x8BC6; void glGetPerfMonitorGroupsAMD(@OutParameter @Check(value = "1", canBeNull = true) @GLint IntBuffer numGroups, @AutoSize("groups") @GLsizei int groupsSize, @GLuint IntBuffer groups); @@ -65,29 +61,29 @@ void glGetPerfMonitorCountersAMD(@GLuint int group, @OutParameter @Check(value = "1") @GLint IntBuffer numCounters, @OutParameter @Check(value = "1") @GLint IntBuffer maxActiveCounters, - @AutoSize("counters") @GLsizei int countersSize, - @GLuint IntBuffer counters); + @AutoSize(value = "counters", canBeNull = true) @GLsizei int countersSize, + @Check(canBeNull = true) @GLuint IntBuffer counters); void glGetPerfMonitorGroupStringAMD(@GLuint int group, - @AutoSize("groupString") @GLsizei int bufSize, + @AutoSize(value = "groupString", canBeNull = true) @GLsizei int bufSize, @OutParameter @GLsizei @Check(value = "1", canBeNull = true) IntBuffer length, - @OutParameter @GLchar ByteBuffer groupString); + @Check(canBeNull = true) @OutParameter @GLchar ByteBuffer groupString); @Alternate("glGetPerfMonitorGroupStringAMD") @GLreturn(value = "groupString", maxLength = "bufSize") void glGetPerfMonitorGroupStringAMD2(@GLuint int group, @GLsizei int bufSize, - @OutParameter @GLsizei @Constant("groupString_length, 0") IntBuffer length, - @OutParameter @GLchar ByteBuffer groupString); + @OutParameter @GLsizei @Constant("MemoryUtil.getAddress0(groupString_length)") IntBuffer length, + @OutParameter @GLchar ByteBuffer groupString); - void glGetPerfMonitorCounterStringAMD(@GLuint int group, @GLuint int counter, @AutoSize("counterString") @GLsizei int bufSize, + void glGetPerfMonitorCounterStringAMD(@GLuint int group, @GLuint int counter, @AutoSize(value = "counterString", canBeNull = true) @GLsizei int bufSize, @OutParameter @GLsizei @Check(value = "1", canBeNull = true) IntBuffer length, - @OutParameter @GLchar ByteBuffer counterString); + @Check(canBeNull = true) @OutParameter @GLchar ByteBuffer counterString); @Alternate("glGetPerfMonitorCounterStringAMD") @GLreturn(value = "counterString", maxLength = "bufSize") void glGetPerfMonitorCounterStringAMD2(@GLuint int group, @GLuint int counter, @GLsizei int bufSize, - @OutParameter @GLsizei @Constant("counterString_length, 0") IntBuffer length, - @OutParameter @GLchar ByteBuffer counterString); + @OutParameter @GLsizei @Constant("MemoryUtil.getAddress0(counterString_length)") IntBuffer length, + @OutParameter @GLchar ByteBuffer counterString); void glGetPerfMonitorCounterInfoAMD(@GLuint int group, @GLuint int counter, @GLenum int pname, @Check(value = "16") @GLvoid ByteBuffer data); @@ -100,12 +96,12 @@ void glDeletePerfMonitorsAMD(@AutoSize("monitors") @GLsizei int n, @GLuint IntBuffer monitors); @Alternate("glDeletePerfMonitorsAMD") - void glDeletePerfMonitorsAMD(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getBufferInt().put(0, monitor), 0", keepParam = true) int monitor); + void glDeletePerfMonitorsAMD(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getInt(caps, monitor)", keepParam = true) int monitor); void glSelectPerfMonitorCountersAMD(@GLuint int monitor, boolean enable, @GLuint int group, @AutoSize("counterList") int numCounters, @GLuint IntBuffer counterList); @Alternate("glSelectPerfMonitorCountersAMD") - void glSelectPerfMonitorCountersAMD(@GLuint int monitor, boolean enable, @GLuint int group, @Constant("1") int numCounters, @Constant(value = "APIUtil.getBufferInt().put(0, counter), 0", keepParam = true) int counter); + void glSelectPerfMonitorCountersAMD(@GLuint int monitor, boolean enable, @GLuint int group, @Constant("1") int numCounters, @Constant(value = "APIUtil.getInt(caps, counter)", keepParam = true) int counter); void glBeginPerfMonitorAMD(@GLuint int monitor); @@ -119,6 +115,6 @@ @GLreturn("data") void glGetPerfMonitorCounterDataAMD2(@GLuint int monitor, @GLenum int pname, @Constant("4") @GLsizei int dataSize, @OutParameter @GLuint IntBuffer data, - @OutParameter @GLint @Constant("null, 0") IntBuffer bytesWritten); + @OutParameter @GLint @Constant("0L") IntBuffer bytesWritten); } \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/AMD_pinned_memory.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/AMD_pinned_memory.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/AMD_pinned_memory.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/AMD_pinned_memory.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +public interface AMD_pinned_memory { + + /** + * Accepted by the <target> parameters of BindBuffer, BufferData, + * BufferSubData, MapBuffer, UnmapBuffer, GetBufferSubData, + * GetBufferParameteriv, GetBufferPointerv, MapBufferRange: + */ + int GL_EXTERNAL_VIRTUAL_MEMORY_BUFFER_AMD = 0x9160; + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/AMD_query_buffer_object.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/AMD_query_buffer_object.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/AMD_query_buffer_object.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/AMD_query_buffer_object.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2002-2010 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +public interface AMD_query_buffer_object { + + /** + * Accepted by the <pname> parameter of GetQueryObjectiv, GetQueryObjectuiv, + * GetQueryObjecti64v and GetQueryObjectui64v: + */ + int GL_QUERY_RESULT_NO_WAIT_AMD = 0x9194; + + /** + * Accepted by the <target> parameters of BindBuffer, BufferData, + * BufferSubData, MapBuffer, UnmapBuffer, MapBufferRange, GetBufferSubData, + * GetBufferParameteriv + * and GetBufferPointerv: + */ + int GL_QUERY_BUFFER_AMD = 0x9192; + + /** + * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, + * and GetDoublev: + */ + int GL_QUERY_BUFFER_BINDING_AMD = 0x9193; + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/AMD_sample_positions.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/AMD_sample_positions.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/AMD_sample_positions.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/AMD_sample_positions.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +import org.lwjgl.util.generator.Check; +import org.lwjgl.util.generator.Const; +import org.lwjgl.util.generator.StripPostfix; +import org.lwjgl.util.generator.opengl.GLenum; +import org.lwjgl.util.generator.opengl.GLuint; + +import java.nio.FloatBuffer; + +public interface AMD_sample_positions { + + /** Accepted by the <pname> parameter of GetFloatv: */ + int GL_SUBSAMPLE_DISTANCE_AMD = 0x883F; + + @StripPostfix("val") + void glSetMultisamplefvAMD(@GLenum int pname, @GLuint int index, @Check("2") @Const FloatBuffer val); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/AMD_shader_atomic_counter_ops.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/AMD_shader_atomic_counter_ops.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/AMD_shader_atomic_counter_ops.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/AMD_shader_atomic_counter_ops.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2002-2013 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +public interface AMD_shader_atomic_counter_ops { + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/AMD_shader_trinary_minmax.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/AMD_shader_trinary_minmax.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/AMD_shader_trinary_minmax.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/AMD_shader_trinary_minmax.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2002-2012 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +public interface AMD_shader_trinary_minmax { +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/AMD_sparse_texture.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/AMD_sparse_texture.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/AMD_sparse_texture.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/AMD_sparse_texture.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +import org.lwjgl.util.generator.opengl.GLbitfield; +import org.lwjgl.util.generator.opengl.GLenum; +import org.lwjgl.util.generator.opengl.GLsizei; +import org.lwjgl.util.generator.opengl.GLuint; + +public interface AMD_sparse_texture { + + /** Accepted by the <flags> parameter to TexStorageSparseAMD and TextureStorageSparseAMD: */ + int GL_TEXTURE_STORAGE_SPARSE_BIT_AMD = 0x00000001; + + /** Accepted by the <pname> parameter to GetInternalformativ: */ + int GL_VIRTUAL_PAGE_SIZE_X_AMD = 0x9195, + GL_VIRTUAL_PAGE_SIZE_Y_AMD = 0x9196, + GL_VIRTUAL_PAGE_SIZE_Z_AMD = 0x9197; + + /** + * Accepted by the <pname> parameter to GetIntegerv, GetFloatv, GetDoublev, + * GetInteger64v, and GetBooleanv: + */ + int GL_MAX_SPARSE_TEXTURE_SIZE_AMD = 0x9198, + GL_MAX_SPARSE_3D_TEXTURE_SIZE_AMD = 0x9199, + GL_MAX_SPARSE_ARRAY_TEXTURE_LAYERS = 0x919A; + + /** Accepted by the <pname> parameter of GetTexParameter{if}v: */ + int GL_MIN_SPARSE_LEVEL_AMD = 0x919B; + + /** + * Accepted by the <pname> parameter of TexParameter{if}{v} and + * GetTexParameter{if}v: + */ + int GL_MIN_LOD_WARNING_AMD = 0x919C; + + void glTexStorageSparseAMD(@GLenum int target, + @GLenum int internalFormat, + @GLsizei int width, + @GLsizei int height, + @GLsizei int depth, + @GLsizei int layers, + @GLbitfield int flags); + + void glTextureStorageSparseAMD(@GLuint int texture, + @GLenum int target, + @GLenum int internalFormat, + @GLsizei int width, + @GLsizei int height, + @GLsizei int depth, + @GLsizei int layers, + @GLbitfield int flags); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/AMD_stencil_operation_extended.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/AMD_stencil_operation_extended.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/AMD_stencil_operation_extended.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/AMD_stencil_operation_extended.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2002-2012 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +import org.lwjgl.util.generator.opengl.GLenum; +import org.lwjgl.util.generator.opengl.GLuint; + +public interface AMD_stencil_operation_extended { + + /** + * Accepted by the <sfail>, <dpfail> and <dppass> parameters of StencilOp + * and StencilOpSeparate: + */ + int GL_SET_AMD = 0x874A, + GL_REPLACE_VALUE_AMD = 0x874B; + + /** + * Accepted by the <param> parameter of GetIntegerv, GetFloatv, GetBooleanv + * GetDoublev and GetInteger64v: + */ + int GL_STENCIL_OP_VALUE_AMD = 0x874C, + GL_STENCIL_BACK_OP_VALUE_AMD = 0x874D; + + void glStencilOpValueAMD(@GLenum int face, @GLuint int value); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/AMD_vertex_shader_layer.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/AMD_vertex_shader_layer.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/AMD_vertex_shader_layer.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/AMD_vertex_shader_layer.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2002-2012 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +public interface AMD_vertex_shader_layer { +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/AMD_vertex_shader_viewport_index.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/AMD_vertex_shader_viewport_index.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/AMD_vertex_shader_viewport_index.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/AMD_vertex_shader_viewport_index.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2002-2012 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +public interface AMD_vertex_shader_viewport_index { +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/APPLE_fence.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/APPLE_fence.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/APPLE_fence.java 2011-03-26 18:15:37.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/APPLE_fence.java 2016-04-09 16:26:56.000000000 +0000 @@ -55,7 +55,7 @@ void glDeleteFencesAPPLE(@AutoSize("fences") @GLsizei int n, @Const @GLuint IntBuffer fences); @Alternate("glDeleteFencesAPPLE") - void glDeleteFencesAPPLE(@Constant("1") @GLsizei int n, @Const @GLuint @Constant(value = "APIUtil.getBufferInt().put(0, fence), 0", keepParam = true) int fence); + void glDeleteFencesAPPLE(@Constant("1") @GLsizei int n, @Const @GLuint @Constant(value = "APIUtil.getInt(caps, fence)", keepParam = true) int fence); void glSetFenceAPPLE(@GLuint int fence); diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/APPLE_object_purgeable.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/APPLE_object_purgeable.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/APPLE_object_purgeable.java 2011-03-26 18:15:37.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/APPLE_object_purgeable.java 2016-04-09 16:26:56.000000000 +0000 @@ -75,7 +75,7 @@ @Alternate("glGetObjectParameterivAPPLE") @GLreturn("params") - @StripPostfix("params") + @StripPostfix(value = "params", hasPostfix = false) void glGetObjectParameterivAPPLE2(@GLenum int objectType, @GLuint int name, @GLenum int pname, @OutParameter IntBuffer params); } \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/APPLE_vertex_array_object.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/APPLE_vertex_array_object.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/APPLE_vertex_array_object.java 2011-03-26 18:15:37.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/APPLE_vertex_array_object.java 2016-04-09 16:26:56.000000000 +0000 @@ -52,7 +52,7 @@ void glDeleteVertexArraysAPPLE(@AutoSize("arrays") @GLsizei int n, @Const @GLuint IntBuffer arrays); @Alternate("glDeleteVertexArraysAPPLE") - void glDeleteVertexArraysAPPLE(@Constant("1") @GLsizei int n, @Const @GLuint @Constant(value = "APIUtil.getBufferInt().put(0, array), 0", keepParam = true) int array); + void glDeleteVertexArraysAPPLE(@Constant("1") @GLsizei int n, @Const @GLuint @Constant(value = "APIUtil.getInt(caps, array)", keepParam = true) int array); void glGenVertexArraysAPPLE(@AutoSize("arrays") @GLsizei int n, @OutParameter @GLuint IntBuffer arrays); diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_arrays_of_arrays.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_arrays_of_arrays.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_arrays_of_arrays.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_arrays_of_arrays.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2002-2012 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +public interface ARB_arrays_of_arrays { +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_base_instance.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_base_instance.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_base_instance.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_base_instance.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +import org.lwjgl.util.generator.*; +import org.lwjgl.util.generator.opengl.*; + +import java.nio.Buffer; + +public interface ARB_base_instance { + + @Reuse("GL42") + void glDrawArraysInstancedBaseInstance(@GLenum int mode, + int first, + @GLsizei int count, + @GLsizei int primcount, + @GLuint int baseinstance); + + @Reuse("GL42") + void glDrawElementsInstancedBaseInstance(@GLenum int mode, + @AutoSize("indices") @GLsizei int count, + @AutoType("indices") @GLenum int type, + @Const + @BufferObject(BufferKind.ElementVBO) + @GLubyte + @GLushort + @GLuint Buffer indices, + @GLsizei int primcount, + @GLuint int baseinstance); + + @Reuse("GL42") + void glDrawElementsInstancedBaseVertexBaseInstance(@GLenum int mode, + @AutoSize("indices") @GLsizei int count, + @AutoType("indices") @GLenum int type, + @Const + @BufferObject(BufferKind.ElementVBO) + @GLubyte + @GLushort + @GLuint Buffer indices, + @GLsizei int primcount, + int basevertex, + @GLuint int baseinstance); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_bindless_texture.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_bindless_texture.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_bindless_texture.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_bindless_texture.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2002-2013 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +import org.lwjgl.util.generator.AutoSize; +import org.lwjgl.util.generator.Check; +import org.lwjgl.util.generator.Const; +import org.lwjgl.util.generator.StripPostfix; +import org.lwjgl.util.generator.opengl.*; + +import java.nio.LongBuffer; + +public interface ARB_bindless_texture { + + /** Accepted by the <type> parameter of VertexAttribLPointer: */ + int GL_UNSIGNED_INT64_ARB = 0x140F; + + @GLuint64 + long glGetTextureHandleARB(@GLuint int texture); + + @GLuint64 + long glGetTextureSamplerHandleARB(@GLuint int texture, @GLuint int sampler); + + void glMakeTextureHandleResidentARB(@GLuint64 long handle); + + void glMakeTextureHandleNonResidentARB(@GLuint64 long handle); + + @GLuint64 + long glGetImageHandleARB(@GLuint int texture, int level, boolean layered, int layer, @GLenum int format); + + void glMakeImageHandleResidentARB(@GLuint64 long handle, @GLenum int access); + + void glMakeImageHandleNonResidentARB(@GLuint64 long handle); + + void glUniformHandleui64ARB(int location, @GLuint64 long value); + + @StripPostfix("value") + void glUniformHandleui64vARB(int location, @AutoSize("value") @GLsizei int count, @Const @GLuint64 LongBuffer value); + + void glProgramUniformHandleui64ARB(@GLuint int program, int location, @GLuint64 long value); + + @StripPostfix("values") + void glProgramUniformHandleui64vARB(@GLuint int program, int location, @AutoSize("values") @GLsizei int count, @Const @GLuint64 LongBuffer values); + + boolean glIsTextureHandleResidentARB(@GLuint64 long handle); + + boolean glIsImageHandleResidentARB(@GLuint64 long handle); + + void glVertexAttribL1ui64ARB(@GLuint int index, @GLuint64EXT long x); + + @StripPostfix("v") + void glVertexAttribL1ui64vARB(@GLuint int index, @Check("1") @Const @GLuint64EXT LongBuffer v); + + @StripPostfix("params") + void glGetVertexAttribLui64vARB(@GLuint int index, @GLenum int pname, @Check("4") @GLuint64EXT LongBuffer params); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_buffer_object.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_buffer_object.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_buffer_object.java 2011-03-26 18:15:37.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_buffer_object.java 2016-04-09 16:26:56.000000000 +0000 @@ -71,7 +71,7 @@ void glDeleteBuffersARB(@AutoSize("buffers") @GLsizei int n, @Const @GLuint IntBuffer buffers); @Alternate("glDeleteBuffersARB") - void glDeleteBuffersARB(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getBufferInt().put(0, buffer), 0", keepParam = true) int buffer); + void glDeleteBuffersARB(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getInt(caps, buffer)", keepParam = true) int buffer); void glGenBuffersARB(@AutoSize("buffers") @GLsizei int n, @OutParameter @GLuint IntBuffer buffers); @@ -83,6 +83,7 @@ @GenerateAutos void glBufferDataARB(@GLenum int target, @AutoSize("data") @GLsizeiptrARB long size, + @Check @Const @GLbyte @GLshort @@ -133,7 +134,7 @@ */ @CachedResult @GLvoid - @AutoSize("GLChecks.getBufferObjectSizeARB(caps, target)") + @AutoSize("glGetBufferParameteriARB(target, GL_BUFFER_SIZE_ARB)") ByteBuffer glMapBufferARB(@GLenum int target, @GLenum int access); boolean glUnmapBufferARB(@GLenum int target); @@ -141,12 +142,20 @@ @StripPostfix("params") void glGetBufferParameterivARB(@GLenum int target, @GLenum int pname, @OutParameter @Check("4") IntBuffer params); + /** @deprecated Will be removed in 3.0. Use {@link #glGetBufferParameteriARB} instead. */ @Alternate("glGetBufferParameterivARB") @GLreturn("params") @StripPostfix("params") + @Reuse(value = "ARBBufferObject", method = "glGetBufferParameteriARB") + @Deprecated void glGetBufferParameterivARB2(@GLenum int target, @GLenum int pname, @OutParameter IntBuffer params); + @Alternate("glGetBufferParameterivARB") + @GLreturn("params") + @StripPostfix(value = "params", hasPostfix = false) + void glGetBufferParameterivARB3(@GLenum int target, @GLenum int pname, @OutParameter IntBuffer params); + @StripPostfix("pointer") - @AutoSize("GLChecks.getBufferObjectSizeARB(caps, target)") + @AutoSize("glGetBufferParameteriARB(target, GL_BUFFER_SIZE_ARB)") void glGetBufferPointervARB(@GLenum int target, @GLenum int pname, @Result @GLvoid ByteBuffer pointer); } diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_buffer_storage.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_buffer_storage.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_buffer_storage.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_buffer_storage.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,97 @@ +/* + * Copyright (c) 2002-2013 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +import org.lwjgl.util.generator.*; +import org.lwjgl.util.generator.opengl.*; + +import java.nio.Buffer; + +@Dependent +public interface ARB_buffer_storage { + + /** + * Accepted in the <flags> parameter of BufferStorage and + * NamedBufferStorageEXT: + */ + int GL_MAP_PERSISTENT_BIT = 0x0040, + GL_MAP_COHERENT_BIT = 0x0080, + GL_DYNAMIC_STORAGE_BIT = 0x0100, + GL_CLIENT_STORAGE_BIT = 0x0200; + + /** Accepted by the <pname> parameter of GetBufferParameter{i|i64}v:\ */ + + int GL_BUFFER_IMMUTABLE_STORAGE = 0x821F, + GL_BUFFER_STORAGE_FLAGS = 0x8220; + + /** Accepted by the <barriers> parameter of MemoryBarrier: */ + int GL_CLIENT_MAPPED_BUFFER_BARRIER_BIT = 0x00004000; + + @Reuse("GL44") + void glBufferStorage(@GLenum int target, + @AutoSize("data") @GLsizeiptr long size, + @Const + @GLbyte + @GLshort + @GLint + @GLuint64 + @GLfloat + @GLdouble Buffer data, + @GLbitfield int flags); + + @Reuse("GL44") + @Alternate("glBufferStorage") + void glBufferStorage2(@GLenum int target, + @GLsizeiptr long size, + @Constant("0L") @Const Buffer data, + @GLbitfield int flags); + + @Dependent("GL_EXT_direct_state_access") + void glNamedBufferStorageEXT(@GLuint int buffer, + @AutoSize("data") @GLsizeiptr long size, + @Const + @GLbyte + @GLshort + @GLint + @GLuint64 + @GLfloat + @GLdouble Buffer data, + @GLbitfield int flags); + + @Dependent("GL_EXT_direct_state_access") + @Alternate("glNamedBufferStorageEXT") + void glNamedBufferStorageEXT2(@GLuint int buffer, + @GLsizeiptr long size, + @Constant("0L") @Const Buffer data, + @GLbitfield int flags); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_clear_buffer_object.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_clear_buffer_object.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_clear_buffer_object.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_clear_buffer_object.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2002-2012 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +import org.lwjgl.util.generator.*; +import org.lwjgl.util.generator.opengl.*; + +import java.nio.ByteBuffer; + +@Dependent +public interface ARB_clear_buffer_object { + + @Reuse("GL43") + void glClearBufferData(@GLenum int target, + @GLenum int internalformat, + @GLenum int format, + @GLenum int type, + @Check("1") @Const @GLvoid ByteBuffer data); + + @Reuse("GL43") + void glClearBufferSubData(@GLenum int target, + @GLenum int internalformat, + @GLintptr long offset, + @GLsizeiptr long size, + @GLenum int format, + @GLenum int type, + @Check("1") @Const @GLvoid ByteBuffer data); + + @Dependent("GL_EXT_direct_state_access") + void glClearNamedBufferDataEXT(@GLuint int buffer, + @GLenum int internalformat, + @GLenum int format, + @GLenum int type, + @Check("1") @Const @GLvoid ByteBuffer data); + + @Dependent("GL_EXT_direct_state_access") + void glClearNamedBufferSubDataEXT(@GLuint int buffer, + @GLenum int internalformat, + @GLintptr long offset, + @GLsizeiptr long size, + @GLenum int format, + @GLenum int type, + @Check("1") @GLvoid ByteBuffer data); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_clear_texture.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_clear_texture.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_clear_texture.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_clear_texture.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2002-2013 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +import org.lwjgl.util.generator.Check; +import org.lwjgl.util.generator.Const; +import org.lwjgl.util.generator.Reuse; +import org.lwjgl.util.generator.opengl.*; + +import java.nio.Buffer; + +public interface ARB_clear_texture { + + /** + * Accepted by the <pname> parameter for GetInternalformativ and + * GetInternalformati64v: + */ + int GL_CLEAR_TEXTURE = 0x9365; + + @Reuse("GL44") + void glClearTexImage(@GLuint int texture, int level, + @GLenum int format, @GLenum int type, + @Check(value = "1", canBeNull = true) + @Const + @GLbyte + @GLshort + @GLint + @GLuint64 + @GLfloat + @GLdouble Buffer data); + + @Reuse("GL44") + void glClearTexSubImage(@GLuint int texture, int level, + int xoffset, int yoffset, int zoffset, + @GLsizei int width, @GLsizei int height, @GLsizei int depth, + @GLenum int format, @GLenum int type, + @Check(value = "1", canBeNull = true) + @Const + @GLbyte + @GLshort + @GLint + @GLuint64 + @GLfloat + @GLdouble Buffer data); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_clip_control.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_clip_control.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_clip_control.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_clip_control.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2002-2014 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +import org.lwjgl.util.generator.Reuse; +import org.lwjgl.util.generator.opengl.GLenum; + +public interface ARB_clip_control { + + /** Accepted by the <origin> parameter of ClipControl: */ + int GL_LOWER_LEFT = 0x8CA1, + GL_UPPER_LEFT = 0x8CA2; + + /** Accepted by the <depth> parameter of ClipControl: */ + int GL_NEGATIVE_ONE_TO_ONE = 0x935E, + GL_ZERO_TO_ONE = 0x935F; + + /** + * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, + * GetFloatv, and GetDoublev: + */ + int GL_CLIP_ORIGIN = 0x935C, + GL_CLIP_DEPTH_MODE = 0x935D; + + @Reuse("GL45") + void glClipControl(@GLenum int origin, @GLenum int depth); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_compressed_texture_pixel_storage.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_compressed_texture_pixel_storage.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_compressed_texture_pixel_storage.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_compressed_texture_pixel_storage.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +public interface ARB_compressed_texture_pixel_storage { + + /** + * Accepted by the <pname> parameter of PixelStore[fi], GetBooleanv, + * GetIntegerv, GetInteger64v, GetFloatv, and GetDoublev: + */ + int GL_UNPACK_COMPRESSED_BLOCK_WIDTH = 0x9127, + GL_UNPACK_COMPRESSED_BLOCK_HEIGHT = 0x9128, + GL_UNPACK_COMPRESSED_BLOCK_DEPTH = 0x9129, + GL_UNPACK_COMPRESSED_BLOCK_SIZE = 0x912A, + GL_PACK_COMPRESSED_BLOCK_WIDTH = 0x912B, + GL_PACK_COMPRESSED_BLOCK_HEIGHT = 0x912C, + GL_PACK_COMPRESSED_BLOCK_DEPTH = 0x912D, + GL_PACK_COMPRESSED_BLOCK_SIZE = 0x912E; + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_compute_shader.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_compute_shader.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_compute_shader.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_compute_shader.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,101 @@ +/* + * Copyright (c) 2002-2012 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +import org.lwjgl.util.generator.Reuse; +import org.lwjgl.util.generator.opengl.GLintptr; +import org.lwjgl.util.generator.opengl.GLuint; + +public interface ARB_compute_shader { + + /** + * Accepted by the <type> parameter of CreateShader and returned in the + * <params> parameter by GetShaderiv: + */ + int GL_COMPUTE_SHADER = 0x91B9; + + /** + * Accepted by the <pname> parameter of GetIntegerv, GetBooleanv, GetFloatv, + * GetDoublev and GetInteger64v: + */ + int GL_MAX_COMPUTE_UNIFORM_BLOCKS = 0x91BB, + GL_MAX_COMPUTE_TEXTURE_IMAGE_UNITS = 0x91BC, + GL_MAX_COMPUTE_IMAGE_UNIFORMS = 0x91BD, + GL_MAX_COMPUTE_SHARED_MEMORY_SIZE = 0x8262, + GL_MAX_COMPUTE_UNIFORM_COMPONENTS = 0x8263, + GL_MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS = 0x8264, + GL_MAX_COMPUTE_ATOMIC_COUNTERS = 0x8265, + GL_MAX_COMBINED_COMPUTE_UNIFORM_COMPONENTS = 0x8266, + GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS = 0x90EB; + + /** + * Accepted by the <pname> parameter of GetIntegeri_v, GetBooleani_v, + * GetFloati_v, GetDoublei_v and GetInteger64i_v: + */ + + int GL_MAX_COMPUTE_WORK_GROUP_COUNT = 0x91BE, + GL_MAX_COMPUTE_WORK_GROUP_SIZE = 0x91BF; + + /** Accepted by the <pname> parameter of GetProgramiv: */ + int GL_COMPUTE_WORK_GROUP_SIZE = 0x8267; + + /** Accepted by the <pname> parameter of GetActiveUniformBlockiv: */ + int GL_UNIFORM_BLOCK_REFERENCED_BY_COMPUTE_SHADER = 0x90EC; + + /** Accepted by the <pname> parameter of GetActiveAtomicCounterBufferiv: */ + int GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_COMPUTE_SHADER = 0x90ED; + + /** + * Accepted by the <target> parameters of BindBuffer, BufferData, + * BufferSubData, MapBuffer, UnmapBuffer, GetBufferSubData, and + * GetBufferPointerv: + */ + int GL_DISPATCH_INDIRECT_BUFFER = 0x90EE; + + /** + * Accepted by the <value> parameter of GetIntegerv, GetBooleanv, + * GetInteger64v, GetFloatv, and GetDoublev: + */ + int GL_DISPATCH_INDIRECT_BUFFER_BINDING = 0x90EF; + + /** Accepted by the <stages> parameter of UseProgramStages: */ + int GL_COMPUTE_SHADER_BIT = 0x00000020; + + @Reuse("GL43") + void glDispatchCompute(@GLuint int num_groups_x, + @GLuint int num_groups_y, + @GLuint int num_groups_z); + + @Reuse("GL43") + void glDispatchComputeIndirect(@GLintptr long indirect); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_compute_variable_group_size.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_compute_variable_group_size.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_compute_variable_group_size.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_compute_variable_group_size.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2002-2013 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +import org.lwjgl.util.generator.opengl.GLuint; + +public interface ARB_compute_variable_group_size { + + /** + * Accepted by the <pname> parameter of GetIntegerv, GetBooleanv, GetFloatv, + * GetDoublev and GetInteger64v: + */ + int GL_MAX_COMPUTE_VARIABLE_GROUP_INVOCATIONS_ARB = 0x9344, + GL_MAX_COMPUTE_FIXED_GROUP_INVOCATIONS_ARB = 0x90EB; + /** + * Accepted by the <pname> parameter of GetIntegeri_v, GetBooleani_v, + * GetFloati_v, GetDoublei_v and GetInteger64i_v: + */ + int GL_MAX_COMPUTE_VARIABLE_GROUP_SIZE_ARB = 0x9345, + GL_MAX_COMPUTE_FIXED_GROUP_SIZE_ARB = 0x91BF; + + void glDispatchComputeGroupSizeARB(@GLuint int num_groups_x, @GLuint int num_groups_y, + @GLuint int num_groups_z, @GLuint int group_size_x, + @GLuint int group_size_y, @GLuint int group_size_z); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_conditional_render_inverted.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_conditional_render_inverted.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_conditional_render_inverted.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_conditional_render_inverted.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2002-2014 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +public interface ARB_conditional_render_inverted { + + /** Accepted by the <mode> parameter of BeginConditionalRender: */ + int GL_QUERY_WAIT_INVERTED = 0x8E17, + GL_QUERY_NO_WAIT_INVERTED = 0x8E18, + GL_QUERY_BY_REGION_WAIT_INVERTED = 0x8E19, + GL_QUERY_BY_REGION_NO_WAIT_INVERTED = 0x8E1A; + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_conservative_depth.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_conservative_depth.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_conservative_depth.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_conservative_depth.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +public interface ARB_conservative_depth { +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_copy_image.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_copy_image.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_copy_image.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_copy_image.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2002-2012 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +import org.lwjgl.util.generator.Reuse; +import org.lwjgl.util.generator.opengl.GLenum; +import org.lwjgl.util.generator.opengl.GLsizei; +import org.lwjgl.util.generator.opengl.GLuint; + +public interface ARB_copy_image { + + @Reuse("GL43") + void glCopyImageSubData( + @GLuint int srcName, @GLenum int srcTarget, int srcLevel, + int srcX, int srcY, int srcZ, + @GLuint int dstName, @GLenum int dstTarget, int dstLevel, + int dstX, int dstY, int dstZ, + @GLsizei int srcWidth, @GLsizei int srcHeight, @GLsizei int srcDepth); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_cull_distance.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_cull_distance.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_cull_distance.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_cull_distance.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2002-2014 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +public interface ARB_cull_distance { + + /** Accepted by the <pname> parameter of GetBooeleanv, GetDoublev, GetFloatv GetIntegerv, and GetInteger64v: */ + int GL_MAX_CULL_DISTANCES = 0x82F9, + GL_MAX_COMBINED_CLIP_AND_CULL_DISTANCES = 0x82FA; + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_derivative_control.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_derivative_control.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_derivative_control.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_derivative_control.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2002-2014 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +public interface ARB_derivative_control { +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_direct_state_access.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_direct_state_access.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_direct_state_access.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_direct_state_access.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,638 @@ +/* + * Copyright (c) 2002-2014 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +import org.lwjgl.PointerBuffer; +import org.lwjgl.util.generator.*; +import org.lwjgl.util.generator.opengl.*; + +import java.nio.*; + +@Extension(postfix = "") +public interface ARB_direct_state_access { + + /** + * Accepted by the <pname> parameter of GetTextureParameter{if}v and + * GetTextureParameterI{i ui}v: + */ + int GL_TEXTURE_TARGET = 0x1006; + + /** Accepted by the <pname> parameter of GetQueryObjectiv: */ + int GL_QUERY_TARGET = 0x82EA; + + /** Accepted by the <pname> parameter of GetIntegeri_v: */ + int GL_TEXTURE_BINDING = 0x82EB; + + // Transform Feedback object functions + + @Reuse("GL45") + void glCreateTransformFeedbacks(@AutoSize("ids") @GLsizei int n, @OutParameter @GLuint IntBuffer ids); + + @Alternate("glCreateTransformFeedbacks") + @GLreturn("ids") + @Reuse("GL45") + void glCreateTransformFeedbacks2(@Constant("1") @GLsizei int n, @OutParameter @GLuint IntBuffer ids); + + @Reuse("GL45") + void glTransformFeedbackBufferBase(@GLuint int xfb, @GLuint int index, @GLuint int buffer); + + @Reuse("GL45") + void glTransformFeedbackBufferRange(@GLuint int xfb, @GLuint int index, @GLuint int buffer, @GLintptr long offset, @GLsizeiptr long size); + + @StripPostfix("param") + @Reuse("GL45") + void glGetTransformFeedbackiv(@GLuint int xfb, @GLenum int pname, @OutParameter @Check("1") IntBuffer param); + + @Alternate("glGetTransformFeedbackiv") + @GLreturn("param") + @StripPostfix(value = "param", hasPostfix = false) + @Reuse("GL45") + void glGetTransformFeedbackiv2(@GLuint int xfb, @GLenum int pname, @OutParameter IntBuffer param); + + @StripPostfix("param") + @Reuse("GL45") + void glGetTransformFeedbacki_v(@GLuint int xfb, @GLenum int pname, @GLuint int index, @OutParameter @Check("1") IntBuffer param); + + @Alternate("glGetTransformFeedbacki_v") + @GLreturn("param") + @StripPostfix(value = "param", postfix = "_v") + @Reuse("GL45") + void glGetTransformFeedbacki_v2(@GLuint int xfb, @GLenum int pname, @GLuint int index, @OutParameter IntBuffer param); + + @StripPostfix("param") + @Reuse("GL45") + void glGetTransformFeedbacki64_v(@GLuint int xfb, @GLenum int pname, @GLuint int index, @OutParameter @Check("1") @GLint64 LongBuffer param); + + @Alternate("glGetTransformFeedbacki64_v") + @GLreturn("param") + @StripPostfix(value = "param", postfix = "_v") + @Reuse("GL45") + void glGetTransformFeedbacki64_v2(@GLuint int xfb, @GLenum int pname, @GLuint int index, @OutParameter @GLint64 LongBuffer param); + + // Buffer object functions + + @Reuse("GL45") + void glCreateBuffers(@AutoSize("buffers") @GLsizei int n, @OutParameter @GLuint IntBuffer buffers); + + @Alternate("glCreateBuffers") + @GLreturn("buffers") + @Reuse("GL45") + void glCreateBuffers2(@Constant("1") @GLsizei int n, @OutParameter @GLuint IntBuffer buffers); + + @Reuse("GL45") + void glNamedBufferStorage(@GLuint int buffer, @AutoSize("data") @GLsizeiptr long size, + @Const + @GLbyte + @GLshort + @GLint + @GLuint64 + @GLfloat + @GLdouble Buffer data, + @GLbitfield int flags); + + @Alternate("glNamedBufferStorage") + @Reuse("GL45") + void glNamedBufferStorage2(@GLuint int buffer, @GLsizeiptr long size, @Constant("0L") @Const Buffer data, @GLbitfield int flags); + + @GenerateAutos + @Reuse("GL45") + void glNamedBufferData(@GLuint int buffer, @AutoSize("data") @GLsizeiptr long size, + @Check + @Const + @GLbyte + @GLshort + @GLint + @GLfloat + @GLdouble Buffer data, + @GLenum int usage); + + @Reuse("GL45") + void glNamedBufferSubData(@GLuint int buffer, @GLintptr long offset, @AutoSize("data") @GLsizeiptr long size, + @Check + @Const + @GLbyte + @GLshort + @GLint + @GLfloat + @GLdouble Buffer data); + + @Reuse("GL45") + void glCopyNamedBufferSubData(@GLuint int readBuffer, @GLuint int writeBuffer, @GLintptr long readOffset, @GLintptr long writeOffset, @GLsizeiptr long size); + + @Reuse("GL45") + void glClearNamedBufferData(@GLuint int buffer, @GLenum int internalformat, @GLenum int format, @GLenum int type, @Check("1") @Const @GLvoid ByteBuffer data); + + @Reuse("GL45") + void glClearNamedBufferSubData(@GLuint int buffer, @GLenum int internalformat, @GLintptr long offset, @GLsizeiptr long size, @GLenum int format, @GLenum int type, @Check("1") @Const @GLvoid ByteBuffer data); + + /** + * Maps a buffer object's data store. + *

        + * LWJGL note: This method comes in 2 flavors: + *

          + *
        1. {@link #glMapNamedBuffer(int, int, ByteBuffer)} - Calls {@link #glGetNamedBufferParameteri} to retrieve the buffer size and the {@code old_buffer} parameter is reused if the returned size and pointer match the buffer capacity and address, respectively.
        2. + *
        3. {@link #glMapNamedBuffer(int, int, int, ByteBuffer)} - The buffer size is explicitly specified and the {@code old_buffer} parameter is reused if {@code size} and the returned pointer match the buffer capacity and address, respectively. This is the most efficient method.
        4. + *
        + * + * @param buffer the buffer object being mapped + * @param access the access policy, indicating whether it will be possible to read from, write to, or both read from and write to the buffer object's mapped data store + */ + @CachedResult + @GLvoid + @AutoSize("glGetNamedBufferParameteri(buffer, GL15.GL_BUFFER_SIZE)") + @Reuse("GL45") + ByteBuffer glMapNamedBuffer(@GLuint int buffer, @GLenum int access); + + @CachedResult(isRange = true) + @GLvoid + @AutoSize("length") + @Reuse("GL45") + ByteBuffer glMapNamedBufferRange(@GLuint int buffer, @GLintptr long offset, @GLsizeiptr long length, @GLbitfield int access); + + @Reuse("GL45") + boolean glUnmapNamedBuffer(@GLuint int buffer); + + @Reuse("GL45") + void glFlushMappedNamedBufferRange(@GLuint int buffer, @GLintptr long offset, @GLsizeiptr long length); + + @StripPostfix("params") + @Reuse("GL45") + void glGetNamedBufferParameteriv(@GLuint int buffer, @GLenum int pname, @OutParameter @Check IntBuffer params); + + @Alternate("glGetNamedBufferParameteriv") + @GLreturn("params") + @StripPostfix(value = "params", hasPostfix = false) + @Reuse("GL45") + void glGetNamedBufferParameteriv2(@GLuint int buffer, @GLenum int pname, @OutParameter IntBuffer params); + + @StripPostfix("params") + @Reuse("GL45") + void glGetNamedBufferParameteri64v(@GLuint int buffer, @GLenum int pname, @OutParameter @Check("1") @GLint64 LongBuffer params); + + @Alternate("glGetNamedBufferParameteri64v") + @GLreturn("params") + @StripPostfix(value = "params", hasPostfix = false) + @Reuse("GL45") + void glGetNamedBufferParameteri64v2(@GLuint int buffer, @GLenum int pname, @OutParameter @GLint64 LongBuffer params); + + @StripPostfix("params") + @AutoSize("glGetNamedBufferParameteri(buffer, GL15.GL_BUFFER_SIZE)") + @Reuse("GL45") + void glGetNamedBufferPointerv(@GLuint int buffer, @GLenum int pname, @Result @GLvoid ByteBuffer params); + + @Reuse("GL45") + void glGetNamedBufferSubData(@GLuint int buffer, @GLintptr long offset, @AutoSize("data") @GLsizeiptr long size, + @OutParameter + @Check + @GLbyte + @GLshort + @GLint + @GLfloat + @GLdouble Buffer data); + + // Framebuffer object functions + + @Reuse("GL45") + void glCreateFramebuffers(@AutoSize("framebuffers") @GLsizei int n, @OutParameter @GLuint IntBuffer framebuffers); + + @Alternate("glCreateFramebuffers") + @GLreturn("framebuffers") + @Reuse("GL45") + void glCreateFramebuffers2(@Constant("1") @GLsizei int n, @OutParameter @GLuint IntBuffer framebuffers); + + @Reuse("GL45") + void glNamedFramebufferRenderbuffer(@GLuint int framebuffer, @GLenum int attachment, @GLenum int renderbuffertarget, @GLuint int renderbuffer); + + @Reuse("GL45") + void glNamedFramebufferParameteri(@GLuint int framebuffer, @GLenum int pname, int param); + + @Reuse("GL45") + void glNamedFramebufferTexture(@GLuint int framebuffer, @GLenum int attachment, @GLuint int texture, int level); + + @Reuse("GL45") + void glNamedFramebufferTextureLayer(@GLuint int framebuffer, @GLenum int attachment, @GLuint int texture, int level, int layer); + + @Reuse("GL45") + void glNamedFramebufferDrawBuffer(@GLuint int framebuffer, @GLenum int mode); + + @Reuse("GL45") + void glNamedFramebufferDrawBuffers(@GLuint int framebuffer, @AutoSize("bufs") @GLsizei int n, @Const @GLenum IntBuffer bufs); + + @Reuse("GL45") + void glNamedFramebufferReadBuffer(@GLuint int framebuffer, @GLenum int mode); + + @Reuse("GL45") + void glInvalidateNamedFramebufferData(@GLuint int framebuffer, @AutoSize("attachments") @GLsizei int numAttachments, @Const @GLenum IntBuffer attachments); + + @Reuse("GL45") + void glInvalidateNamedFramebufferSubData(@GLuint int framebuffer, @AutoSize("attachments") @GLsizei int numAttachments, @Const @GLenum IntBuffer attachments, int x, int y, @GLsizei int width, @GLsizei int height); + + @StripPostfix("value") + @Reuse("GL45") + void glClearNamedFramebufferiv(@GLuint int framebuffer, @GLenum int buffer, int drawbuffer, @Const @Check("1") IntBuffer value); + + @StripPostfix("value") + @Reuse("GL45") + void glClearNamedFramebufferuiv(@GLuint int framebuffer, @GLenum int buffer, int drawbuffer, @Const @Check("4") @GLuint IntBuffer value); + + @StripPostfix("value") + @Reuse("GL45") + void glClearNamedFramebufferfv(@GLuint int framebuffer, @GLenum int buffer, int drawbuffer, @Const @Check("1") FloatBuffer value); + + @Reuse("GL45") + void glClearNamedFramebufferfi(@GLuint int framebuffer, @GLenum int buffer, float depth, int stencil); + + @Reuse("GL45") + void glBlitNamedFramebuffer( + @GLuint int readFramebuffer, @GLuint int drawFramebuffer, + int srcX0, int srcY0, int srcX1, int srcY1, + int dstX0, int dstY0, int dstX1, int dstY1, + @GLbitfield int mask, @GLenum int filter); + + @GLenum + @Reuse("GL45") + int glCheckNamedFramebufferStatus(@GLuint int framebuffer, @GLenum int target); + + @StripPostfix("params") + @Reuse("GL45") + void glGetNamedFramebufferParameteriv(@GLuint int framebuffer, @GLenum int pname, @OutParameter @Check("1") IntBuffer params); + + @Alternate("glGetNamedFramebufferParameteriv") + @GLreturn("params") + @StripPostfix("params") + @Reuse("GL45") + void glGetNamedFramebufferParameteriv2(@GLuint int framebuffer, @GLenum int pname, @OutParameter IntBuffer params); + + @StripPostfix("params") + @Reuse("GL45") + void glGetNamedFramebufferAttachmentParameteriv(@GLuint int framebuffer, @GLenum int attachment, @GLenum int pname, @OutParameter @Check("1") IntBuffer params); + + @Alternate("glGetNamedFramebufferAttachmentParameteriv") + @GLreturn("params") + @StripPostfix("params") + @Reuse("GL45") + void glGetNamedFramebufferAttachmentParameteriv2(@GLuint int framebuffer, @GLenum int attachment, @GLenum int pname, @OutParameter IntBuffer params); + + // Renderbuffer object functions + + @Reuse("GL45") + void glCreateRenderbuffers(@AutoSize("renderbuffers") @GLsizei int n, @OutParameter @GLuint IntBuffer renderbuffers); + + @Alternate("glCreateRenderbuffers") + @GLreturn("renderbuffers") + @Reuse("GL45") + void glCreateRenderbuffers2(@Constant("1") @GLsizei int n, @OutParameter @GLuint IntBuffer renderbuffers); + + @Reuse("GL45") + void glNamedRenderbufferStorage(@GLuint int renderbuffer, @GLenum int internalformat, @GLsizei int width, @GLsizei int height); + + @Reuse("GL45") + void glNamedRenderbufferStorageMultisample(@GLuint int renderbuffer, @GLsizei int samples, @GLenum int internalformat, @GLsizei int width, @GLsizei int height); + + @StripPostfix("params") + @Reuse("GL45") + void glGetNamedRenderbufferParameteriv(@GLuint int renderbuffer, @GLenum int pname, @OutParameter @Check("1") IntBuffer params); + + @Alternate("glGetNamedRenderbufferParameteriv") + @GLreturn("params") + @StripPostfix("params") + @Reuse("GL45") + void glGetNamedRenderbufferParameteriv2(@GLuint int renderbuffer, @GLenum int pname, @OutParameter IntBuffer params); + + // Texture object functions + + @Reuse("GL45") + void glCreateTextures(@GLenum int target, @AutoSize("textures") @GLsizei int n, @OutParameter @GLuint IntBuffer textures); + + @Alternate("glCreateTextures") + @GLreturn("textures") + @Reuse("GL45") + void glCreateTextures2(@GLenum int target, @Constant("1") @GLsizei int n, @OutParameter @GLuint IntBuffer textures); + + @Reuse("GL45") + void glTextureBuffer(@GLuint int texture, @GLenum int internalformat, @GLuint int buffer); + + @Reuse("GL45") + void glTextureBufferRange(@GLuint int texture, @GLenum int internalformat, @GLuint int buffer, @GLintptr long offset, @GLsizeiptr long size); + + @Reuse("GL45") + void glTextureStorage1D(@GLuint int texture, @GLsizei int levels, @GLenum int internalformat, @GLsizei int width); + + @Reuse("GL45") + void glTextureStorage2D(@GLuint int texture, @GLsizei int levels, @GLenum int internalformat, @GLsizei int width, @GLsizei int height); + + @Reuse("GL45") + void glTextureStorage3D(@GLuint int texture, @GLsizei int levels, @GLenum int internalformat, @GLsizei int width, @GLsizei int height, @GLsizei int depth); + + @Reuse("GL45") + void glTextureStorage2DMultisample(@GLuint int texture, @GLsizei int samples, @GLenum int internalformat, @GLsizei int width, @GLsizei int height, boolean fixedsamplelocations); + + @Reuse("GL45") + void glTextureStorage3DMultisample(@GLuint int texture, @GLsizei int samples, @GLenum int internalformat, @GLsizei int width, @GLsizei int height, @GLsizei int depth, boolean fixedsamplelocations); + + @Reuse("GL45") + void glTextureSubImage1D(@GLuint int texture, int level, int xoffset, @GLsizei int width, @GLenum int format, @GLenum int type, + @BufferObject(BufferKind.UnpackPBO) + @Check("GLChecks.calculateImageStorage(pixels, format, type, width, 1, 1)") + @Const + @GLbyte + @GLshort + @GLint + @GLfloat + @GLdouble Buffer pixels); + + @Reuse("GL45") + void glTextureSubImage2D(@GLuint int texture, int level, int xoffset, int yoffset, @GLsizei int width, @GLsizei int height, @GLenum int format, @GLenum int type, + @BufferObject(BufferKind.UnpackPBO) + @Check("GLChecks.calculateImageStorage(pixels, format, type, width, height, 1)") + @Const + @GLbyte + @GLshort + @GLint + @GLfloat + @GLdouble Buffer pixels); + + @Reuse("GL45") + void glTextureSubImage3D(@GLuint int texture, int level, int xoffset, int yoffset, int zoffset, @GLsizei int width, @GLsizei int height, @GLsizei int depth, @GLenum int format, @GLenum int type, + @BufferObject(BufferKind.UnpackPBO) + @Check("GLChecks.calculateImageStorage(pixels, format, type, width, height, depth)") + @Const + @GLbyte + @GLshort + @GLint + @GLfloat + @GLdouble Buffer pixels); + + @Reuse("GL45") + void glCompressedTextureSubImage1D(@GLuint int texture, int level, int xoffset, @GLsizei int width, @GLenum int format, @AutoSize("data") @GLsizei int imageSize, + @BufferObject(BufferKind.UnpackPBO) + @Check + @Const + @GLvoid + ByteBuffer data); + + @Reuse("GL45") + void glCompressedTextureSubImage2D(@GLuint int texture, int level, int xoffset, int yoffset, @GLsizei int width, @GLsizei int height, @GLenum int format, @AutoSize("data") @GLsizei int imageSize, + @BufferObject(BufferKind.UnpackPBO) + @Check + @Const + @GLvoid + ByteBuffer data); + + @Reuse("GL45") + void glCompressedTextureSubImage3D(@GLuint int texture, int level, int xoffset, int yoffset, int zoffset, @GLsizei int width, @GLsizei int height, @GLsizei int depth, @GLenum int format, @GLsizei int imageSize, + @BufferObject(BufferKind.UnpackPBO) + @Check + @Const + @GLvoid + ByteBuffer data); + + @Reuse("GL45") + void glCopyTextureSubImage1D(@GLuint int texture, int level, int xoffset, int x, int y, @GLsizei int width); + + @Reuse("GL45") + void glCopyTextureSubImage2D(@GLuint int texture, int level, int xoffset, int yoffset, int x, int y, @GLsizei int width, @GLsizei int height); + + @Reuse("GL45") + void glCopyTextureSubImage3D(@GLuint int texture, int level, int xoffset, int yoffset, int zoffset, int x, int y, @GLsizei int width, @GLsizei int height); + + @Reuse("GL45") + void glTextureParameterf(@GLuint int texture, @GLenum int pname, float param); + + @StripPostfix("params") + @Reuse("GL45") + void glTextureParameterfv(@GLuint int texture, @GLenum int pname, @Const @Check("4") FloatBuffer params); + + @Reuse("GL45") + void glTextureParameteri(@GLuint int texture, @GLenum int pname, int param); + + @StripPostfix("params") + @Reuse("GL45") + void glTextureParameterIiv(@GLuint int texture, @GLenum int pname, @Const @Check("1") IntBuffer params); + + @StripPostfix("params") + @Reuse("GL45") + void glTextureParameterIuiv(@GLuint int texture, @GLenum int pname, @Const @Check("1") @GLuint IntBuffer params); + + @StripPostfix("params") + @Reuse("GL45") + void glTextureParameteriv(@GLuint int texture, @GLenum int pname, @Const @Check("4") IntBuffer params); + + @Reuse("GL45") + void glGenerateTextureMipmap(@GLuint int texture); + + @Reuse("GL45") + void glBindTextureUnit(@GLuint int unit, @GLuint int texture); + + @Reuse("GL45") + void glGetTextureImage(@GLuint int texture, int level, @GLenum int format, @GLenum int type, @AutoSize("pixels") @GLsizei int bufSize, + @OutParameter + @BufferObject(BufferKind.PackPBO) + @GLbyte + @GLshort + @GLint + @GLfloat + @GLdouble Buffer pixels); + + @Reuse("GL45") + void glGetCompressedTextureImage(@GLuint int texture, int level, @AutoSize("pixels") @GLsizei int bufSize, + @OutParameter + @BufferObject(BufferKind.PackPBO) + @Check + @GLbyte + @GLshort + @GLint Buffer pixels); + + @StripPostfix("params") + @Reuse("GL45") + void glGetTextureLevelParameterfv(@GLuint int texture, int level, @GLenum int pname, @OutParameter @Check("1") FloatBuffer params); + + @Alternate("glGetTextureLevelParameterfv") + @GLreturn("params") + @StripPostfix(value = "params", hasPostfix = false) + @Reuse("GL45") + void glGetTextureLevelParameterfv2(@GLuint int texture, int level, @GLenum int pname, @OutParameter FloatBuffer params); + + @StripPostfix("params") + @Reuse("GL45") + void glGetTextureLevelParameteriv(@GLuint int texture, int level, @GLenum int pname, @OutParameter @Check("1") IntBuffer params); + + @Alternate("glGetTextureLevelParameteriv") + @GLreturn("params") + @StripPostfix(value = "params", hasPostfix = false) + @Reuse("GL45") + void glGetTextureLevelParameteriv2(@GLuint int texture, int level, @GLenum int pname, @OutParameter IntBuffer params); + + @StripPostfix("params") + @Reuse("GL45") + void glGetTextureParameterfv(@GLuint int texture, @GLenum int pname, @OutParameter @Check("1") FloatBuffer params); + + @Alternate("glGetTextureParameterfv") + @GLreturn("params") + @StripPostfix(value = "params", hasPostfix = false) + @Reuse("GL45") + void glGetTextureParameterfv2(@GLuint int texture, @GLenum int pname, @OutParameter FloatBuffer params); + + @StripPostfix("params") + @Reuse("GL45") + void glGetTextureParameterIiv(@GLuint int texture, @GLenum int pname, @OutParameter @Check("1") IntBuffer params); + + @Alternate("glGetTextureParameterIiv") + @GLreturn("params") + @StripPostfix(value = "params", hasPostfix = false) + @Reuse("GL45") + void glGetTextureParameterIiv2(@GLuint int texture, @GLenum int pname, @OutParameter IntBuffer params); + + @StripPostfix("params") + @Reuse("GL45") + void glGetTextureParameterIuiv(@GLuint int texture, @GLenum int pname, @OutParameter @Check("1") @GLuint IntBuffer params); + + @Alternate("glGetTextureParameterIuiv") + @GLreturn("params") + @StripPostfix(value = "params", hasPostfix = false) + @Reuse("GL45") + void glGetTextureParameterIuiv2(@GLuint int texture, @GLenum int pname, @OutParameter @GLuint IntBuffer params); + + @StripPostfix("params") + @Reuse("GL45") + void glGetTextureParameteriv(@GLuint int texture, @GLenum int pname, @OutParameter @Check("1") IntBuffer params); + + @Alternate("glGetTextureParameteriv") + @GLreturn("params") + @StripPostfix(value = "params", hasPostfix = false) + @Reuse("GL45") + void glGetTextureParameteriv2(@GLuint int texture, @GLenum int pname, @OutParameter IntBuffer params); + + // Vertex Array object functions + + @Reuse("GL45") + void glCreateVertexArrays(@AutoSize("arrays") @GLsizei int n, @OutParameter @GLuint IntBuffer arrays); + + @Alternate("glCreateVertexArrays") + @GLreturn("arrays") + @Reuse("GL45") + void glCreateVertexArrays2(@Constant("1") @GLsizei int n, @OutParameter @GLuint IntBuffer arrays); + + @Reuse("GL45") + void glDisableVertexArrayAttrib(@GLuint int vaobj, @GLuint int index); + + @Reuse("GL45") + void glEnableVertexArrayAttrib(@GLuint int vaobj, @GLuint int index); + + @Reuse("GL45") + void glVertexArrayElementBuffer(@GLuint int vaobj, @GLuint int buffer); + + @Reuse("GL45") + void glVertexArrayVertexBuffer(@GLuint int vaobj, @GLuint int bindingindex, @GLuint int buffer, @GLintptr long offset, @GLsizei int stride); + + @Reuse("GL45") + void glVertexArrayVertexBuffers(@GLuint int vaobj, @GLuint int first, @GLsizei int count, + @Check(value = "count", canBeNull = true) @Const @GLuint IntBuffer buffers, + @Check(value = "count", canBeNull = true) @Const @GLintptr PointerBuffer offsets, + @Check(value = "count", canBeNull = true) @Const @GLsizei IntBuffer strides); + + @Reuse("GL45") + void glVertexArrayAttribFormat(@GLuint int vaobj, @GLuint int attribindex, int size, @GLenum int type, boolean normalized, @GLuint int relativeoffset); + + @Reuse("GL45") + void glVertexArrayAttribIFormat(@GLuint int vaobj, @GLuint int attribindex, int size, @GLenum int type, @GLuint int relativeoffset); + + @Reuse("GL45") + void glVertexArrayAttribLFormat(@GLuint int vaobj, @GLuint int attribindex, int size, @GLenum int type, @GLuint int relativeoffset); + + @Reuse("GL45") + void glVertexArrayAttribBinding(@GLuint int vaobj, @GLuint int attribindex, @GLuint int bindingindex); + + @Reuse("GL45") + void glVertexArrayBindingDivisor(@GLuint int vaobj, @GLuint int bindingindex, @GLuint int divisor); + + @StripPostfix("param") + @Reuse("GL45") + void glGetVertexArrayiv(@GLuint int vaobj, @GLenum int pname, @OutParameter @Check("1") IntBuffer param); + + @Alternate("glGetVertexArrayiv") + @GLreturn("param") + @StripPostfix("param") + @Reuse("GL45") + void glGetVertexArrayiv2(@GLuint int vaobj, @GLenum int pname, @OutParameter IntBuffer param); + + @StripPostfix("param") + @Reuse("GL45") + void glGetVertexArrayIndexediv(@GLuint int vaobj, @GLuint int index, @GLenum int pname, @OutParameter @Check("1") IntBuffer param); + + @Alternate("glGetVertexArrayIndexediv") + @GLreturn("param") + @StripPostfix("param") + @Reuse("GL45") + void glGetVertexArrayIndexediv2(@GLuint int vaobj, @GLuint int index, @GLenum int pname, @OutParameter IntBuffer param); + + @StripPostfix("param") + @Reuse("GL45") + void glGetVertexArrayIndexed64iv(@GLuint int vaobj, @GLuint int index, @GLenum int pname, @OutParameter @Check("1") @GLint64 LongBuffer param); + + @Alternate("glGetVertexArrayIndexed64iv") + @GLreturn("param") + @StripPostfix("param") + @Reuse("GL45") + void glGetVertexArrayIndexed64iv2(@GLuint int vaobj, @GLuint int index, @GLenum int pname, @OutParameter @GLint64 LongBuffer param); + + // Sampler object functions + + @Reuse("GL45") + void glCreateSamplers(@AutoSize("samplers") @GLsizei int n, @OutParameter @GLuint IntBuffer samplers); + + @Alternate("glCreateSamplers") + @GLreturn("samplers") + @Reuse("GL45") + void glCreateSamplers2(@Constant("1") @GLsizei int n, @OutParameter @GLuint IntBuffer samplers); + + // Program Pipeline object functions + + @Reuse("GL45") + void glCreateProgramPipelines(@AutoSize("pipelines") @GLsizei int n, @OutParameter @GLuint IntBuffer pipelines); + + @Alternate("glCreateProgramPipelines") + @GLreturn("pipelines") + @Reuse("GL45") + void glCreateProgramPipelines2(@Constant("1") @GLsizei int n, @OutParameter @GLuint IntBuffer pipelines); + + // Query object functions + + @Reuse("GL45") + void glCreateQueries(@GLenum int target, @AutoSize("ids") @GLsizei int n, @OutParameter @GLuint IntBuffer ids); + + @Alternate("glCreateQueries") + @GLreturn("ids") + @Reuse("GL45") + void glCreateQueries2(@GLenum int target, @Constant("1") @GLsizei int n, @OutParameter @GLuint IntBuffer ids); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_draw_buffers.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_draw_buffers.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_draw_buffers.java 2011-03-26 18:15:37.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_draw_buffers.java 2016-04-09 16:26:56.000000000 +0000 @@ -65,5 +65,5 @@ void glDrawBuffersARB(@AutoSize("buffers") @GLsizei int size, @Const @GLenum IntBuffer buffers); @Alternate("glDrawBuffersARB") - void glDrawBuffersARB(@Constant("1") @GLsizei int size, @Constant(value = "APIUtil.getBufferInt().put(0, buffer), 0", keepParam = true) int buffer); + void glDrawBuffersARB(@Constant("1") @GLsizei int size, @Constant(value = "APIUtil.getInt(caps, buffer)", keepParam = true) int buffer); } diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_draw_indirect.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_draw_indirect.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_draw_indirect.java 2011-03-26 18:15:37.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_draw_indirect.java 2016-04-09 16:26:56.000000000 +0000 @@ -35,9 +35,10 @@ import org.lwjgl.util.generator.opengl.GLenum; import org.lwjgl.util.generator.opengl.GLvoid; +import java.nio.ByteBuffer; import java.nio.IntBuffer; -import com.sun.mirror.type.PrimitiveType; +import javax.lang.model.type.TypeKind; public interface ARB_draw_indirect { @@ -57,9 +58,17 @@ int GL_DRAW_INDIRECT_BUFFER_BINDING = 0x8F43; @Reuse("GL40") - void glDrawArraysIndirect(@GLenum int mode, @BufferObject(BufferKind.IndirectBO) @Check("4") @NullTerminated @Const @GLvoid(PrimitiveType.Kind.INT) IntBuffer indirect); + void glDrawArraysIndirect(@GLenum int mode, @BufferObject(BufferKind.IndirectBO) @Check("4 * 4") @Const @GLvoid ByteBuffer indirect); @Reuse("GL40") - void glDrawElementsIndirect(@GLenum int mode, @GLenum int type, @BufferObject(BufferKind.IndirectBO) @Check("5") @NullTerminated @Const @GLvoid(PrimitiveType.Kind.INT) IntBuffer indirect); + @Alternate("glDrawArraysIndirect") + void glDrawArraysIndirect(@GLenum int mode, @BufferObject(BufferKind.IndirectBO) @Check("4") @Const @GLvoid(TypeKind.INT) IntBuffer indirect); + + @Reuse("GL40") + void glDrawElementsIndirect(@GLenum int mode, @GLenum int type, @BufferObject(BufferKind.IndirectBO) @Check("5 * 4") @Const @GLvoid ByteBuffer indirect); + + @Reuse("GL40") + @Alternate("glDrawElementsIndirect") + void glDrawElementsIndirect(@GLenum int mode, @GLenum int type, @BufferObject(BufferKind.IndirectBO) @Check("5") @Const @GLvoid(TypeKind.INT) IntBuffer indirect); } \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_enhanced_layouts.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_enhanced_layouts.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_enhanced_layouts.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_enhanced_layouts.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2002-2013 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +public interface ARB_enhanced_layouts { + + /** Accepted in the <props> array of GetProgramResourceiv: */ + int GL_LOCATION_COMPONENT = 0x934A, + GL_TRANSFORM_FEEDBACK_BUFFER_INDEX = 0x934B, + GL_TRANSFORM_FEEDBACK_BUFFER_STRIDE = 0x934C; + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_ES2_compatibility.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_ES2_compatibility.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_ES2_compatibility.java 2011-03-26 18:15:37.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_ES2_compatibility.java 2016-04-09 16:26:56.000000000 +0000 @@ -65,6 +65,9 @@ GL_MEDIUM_INT = 0x8DF4, GL_HIGH_INT = 0x8DF5; + /** Accepted by the <format> parameter of most commands taking sized internal formats: */ + int GL_RGB565 = 0x8D62; + @Reuse("GL41") void glReleaseShaderCompiler(); diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_ES3_1_compatibility.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_ES3_1_compatibility.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_ES3_1_compatibility.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_ES3_1_compatibility.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2002-2014 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +import org.lwjgl.util.generator.Reuse; +import org.lwjgl.util.generator.opengl.GLbitfield; + +public interface ARB_ES3_1_compatibility { + + @Reuse("GL45") + void glMemoryBarrierByRegion(@GLbitfield int barriers); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_ES3_compatibility.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_ES3_compatibility.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_ES3_compatibility.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_ES3_compatibility.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2002-2012 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +public interface ARB_ES3_compatibility { + + /** Accepted by the <internalformat> parameter of CompressedTexImage2D */ + int GL_COMPRESSED_RGB8_ETC2 = 0x9274, + GL_COMPRESSED_SRGB8_ETC2 = 0x9275, + GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 0x9276, + GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 0x9277, + GL_COMPRESSED_RGBA8_ETC2_EAC = 0x9278, + GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC = 0x9279, + GL_COMPRESSED_R11_EAC = 0x9270, + GL_COMPRESSED_SIGNED_R11_EAC = 0x9271, + GL_COMPRESSED_RG11_EAC = 0x9272, + GL_COMPRESSED_SIGNED_RG11_EAC = 0x9273; + + /** Accepted by the <target> parameter of Enable and Disable: */ + int GL_PRIMITIVE_RESTART_FIXED_INDEX = 0x8D69; + + /** + * Accepted by the <target> parameter of BeginQuery, EndQuery, + * GetQueryIndexediv and GetQueryiv: + */ + int GL_ANY_SAMPLES_PASSED_CONSERVATIVE = 0x8D6A; + + /** Accepted by the <value> parameter of the GetInteger* functions: */ + int GL_MAX_ELEMENT_INDEX = 0x8D6B; + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_explicit_uniform_location.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_explicit_uniform_location.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_explicit_uniform_location.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_explicit_uniform_location.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2002-2012 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +public interface ARB_explicit_uniform_location { + + /** + * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, + * GetFloatv, GetDoublev, and GetInteger64v: + */ + int GL_MAX_UNIFORM_LOCATIONS = 0x826E; + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_fragment_layer_viewport.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_fragment_layer_viewport.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_fragment_layer_viewport.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_fragment_layer_viewport.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2002-2012 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +public interface ARB_fragment_layer_viewport { +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_framebuffer_no_attachments.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_framebuffer_no_attachments.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_framebuffer_no_attachments.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_framebuffer_no_attachments.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,94 @@ +/* + * Copyright (c) 2002-2012 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +import org.lwjgl.util.generator.*; +import org.lwjgl.util.generator.opengl.GLenum; +import org.lwjgl.util.generator.opengl.GLreturn; +import org.lwjgl.util.generator.opengl.GLuint; + +import java.nio.IntBuffer; + +@Dependent +@Extension(postfix = "") +public interface ARB_framebuffer_no_attachments { + + /** + * Accepted by the <pname> parameter of FramebufferParameteri, + * GetFramebufferParameteriv, NamedFramebufferParameteriEXT, and + * GetNamedFramebufferParameterivEXT: + */ + int GL_FRAMEBUFFER_DEFAULT_WIDTH = 0x9310, + GL_FRAMEBUFFER_DEFAULT_HEIGHT = 0x9311, + GL_FRAMEBUFFER_DEFAULT_LAYERS = 0x9312, + GL_FRAMEBUFFER_DEFAULT_SAMPLES = 0x9313, + GL_FRAMEBUFFER_DEFAULT_FIXED_SAMPLE_LOCATIONS = 0x9314; + + /** + * Accepted by the <pname> parameter of GetIntegerv, GetBooleanv, + * GetInteger64v, GetFloatv, and GetDoublev: + */ + int GL_MAX_FRAMEBUFFER_WIDTH = 0x9315, + GL_MAX_FRAMEBUFFER_HEIGHT = 0x9316, + GL_MAX_FRAMEBUFFER_LAYERS = 0x9317, + GL_MAX_FRAMEBUFFER_SAMPLES = 0x9318; + + @Reuse("GL43") + void glFramebufferParameteri(@GLenum int target, @GLenum int pname, int param); + + @Reuse("GL43") + @StripPostfix("params") + void glGetFramebufferParameteriv(@GLenum int target, @GLenum int pname, @OutParameter @Check("1") IntBuffer params); + + @Reuse("GL43") + @Alternate("glGetFramebufferParameteriv") + @GLreturn("params") + @StripPostfix(value = "params", hasPostfix = false) + void glGetFramebufferParameteriv2(@GLenum int target, @GLenum int pname, @OutParameter IntBuffer params); + + @Dependent("GL_EXT_direct_state_access") + void glNamedFramebufferParameteriEXT(@GLuint int framebuffer, @GLenum int pname, + int param); + + @Dependent("GL_EXT_direct_state_access") + @StripPostfix(value = "params", extension = "EXT") + void glGetNamedFramebufferParameterivEXT(@GLuint int framebuffer, @GLenum int pname, + @OutParameter @Check("1") IntBuffer params); + + @Alternate("glGetNamedFramebufferParameterivEXT") + @GLreturn("params") + @Dependent("GL_EXT_direct_state_access") + @StripPostfix(value = "params", extension = "EXT") + void glGetNamedFramebufferParameterivEXT2(@GLuint int framebuffer, @GLenum int pname, + @OutParameter IntBuffer params); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_framebuffer_object.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_framebuffer_object.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_framebuffer_object.java 2011-03-26 18:15:37.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_framebuffer_object.java 2016-04-09 16:26:56.000000000 +0000 @@ -197,7 +197,7 @@ @Reuse("GL30") @Alternate("glDeleteRenderbuffers") - void glDeleteRenderbuffers(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getBufferInt().put(0, renderbuffer), 0", keepParam = true) int renderbuffer); + void glDeleteRenderbuffers(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getInt(caps, renderbuffer)", keepParam = true) int renderbuffer); @Reuse("GL30") void glGenRenderbuffers(@AutoSize("renderbuffers") @GLsizei int n, @OutParameter @GLuint IntBuffer renderbuffers); @@ -220,13 +220,21 @@ @StripPostfix("params") void glGetRenderbufferParameteriv(@GLenum int target, @GLenum int pname, @Check("4") @OutParameter IntBuffer params); - @Reuse("GL30") + /** @deprecated Will be removed in 3.0. Use {@link #glGetRenderbufferParameteri} instead. */ @Alternate("glGetRenderbufferParameteriv") @GLreturn("params") @StripPostfix("params") + @Reuse(value = "ARBFramebufferObject", method = "glGetRenderbufferParameteri") + @Deprecated void glGetRenderbufferParameteriv2(@GLenum int target, @GLenum int pname, @OutParameter IntBuffer params); @Reuse("GL30") + @Alternate("glGetRenderbufferParameteriv") + @GLreturn("params") + @StripPostfix(value = "params", hasPostfix = false) + void glGetRenderbufferParameteriv3(@GLenum int target, @GLenum int pname, @OutParameter IntBuffer params); + + @Reuse("GL30") boolean glIsFramebuffer(@GLuint int framebuffer); @Reuse("GL30") @@ -237,7 +245,7 @@ @Reuse("GL30") @Alternate("glDeleteFramebuffers") - void glDeleteFramebuffers(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getBufferInt().put(0, framebuffer), 0", keepParam = true) int framebuffer); + void glDeleteFramebuffers(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getInt(caps, framebuffer)", keepParam = true) int framebuffer); @Reuse("GL30") void glGenFramebuffers(@AutoSize("framebuffers") @GLsizei int n, @OutParameter @GLuint IntBuffer framebuffers); @@ -277,14 +285,23 @@ void glGetFramebufferAttachmentParameteriv(@GLenum int target, @GLenum int attachment, @GLenum int pname, @Check("4") @OutParameter IntBuffer params); - @Reuse("GL30") + /** @deprecated Will be removed in 3.0. Use {@link #glGetFramebufferAttachmentParameteri} instead. */ @Alternate("glGetFramebufferAttachmentParameteriv") @GLreturn("params") @StripPostfix("params") + @Reuse(value = "GL30", method = "glGetFramebufferAttachmentParameteri") + @Deprecated void glGetFramebufferAttachmentParameteriv2(@GLenum int target, @GLenum int attachment, @GLenum int pname, @OutParameter IntBuffer params); @Reuse("GL30") + @Alternate("glGetFramebufferAttachmentParameteriv") + @GLreturn("params") + @StripPostfix(value = "params", hasPostfix = false) + void glGetFramebufferAttachmentParameteriv3(@GLenum int target, @GLenum int attachment, + @GLenum int pname, @OutParameter IntBuffer params); + + @Reuse("GL30") void glBlitFramebuffer(int srcX0, int srcY0, int srcX1, int srcY1, int dstX0, int dstY0, int dstX1, int dstY1, @GLbitfield int mask, @GLenum int filter); diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_get_texture_sub_image.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_get_texture_sub_image.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_get_texture_sub_image.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_get_texture_sub_image.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2002-2014 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +import org.lwjgl.util.generator.*; +import org.lwjgl.util.generator.opengl.*; + +import java.nio.Buffer; + +public interface ARB_get_texture_sub_image { + + @Reuse("GL45") + void glGetTextureSubImage( + @GLuint int texture, int level, int xoffset, int yoffset, int zoffset, + @GLsizei int width, @GLsizei int height, @GLsizei int depth, + @GLenum int format, @GLenum int type, + @AutoSize("pixels") @GLsizei int bufSize, + @OutParameter + @BufferObject(BufferKind.PackPBO) + @GLbyte + @GLshort + @GLint + @GLfloat + @GLdouble Buffer pixels + ); + + @Reuse("GL45") + void glGetCompressedTextureSubImage( + @GLuint int texture, int level, int xoffset, int yoffset, int zoffset, + @GLsizei int width, @GLsizei int height, @GLsizei int depth, + @AutoSize("pixels") @GLsizei int bufSize, + @OutParameter + @BufferObject(BufferKind.PackPBO) + @GLbyte + @GLshort + @GLint + @GLfloat + @GLdouble Buffer pixels + ); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_gpu_shader_fp64.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_gpu_shader_fp64.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_gpu_shader_fp64.java 2011-03-26 18:15:37.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_gpu_shader_fp64.java 2016-04-09 16:26:56.000000000 +0000 @@ -45,7 +45,6 @@ * Returned in the <type> parameter of GetActiveUniform, and * GetTransformFeedbackVarying: */ - int GL_DOUBLE = GL11.GL_DOUBLE; int GL_DOUBLE_VEC2 = 0x8FFC; int GL_DOUBLE_VEC3 = 0x8FFD; int GL_DOUBLE_VEC4 = 0x8FFE; diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_imaging.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_imaging.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_imaging.java 2011-03-26 18:15:37.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_imaging.java 2016-04-09 16:26:56.000000000 +0000 @@ -41,18 +41,14 @@ * The GL12 imaging subset extension. * * @author cix_foo - * @version $Revision: 3412 $ - * $Id: ARB_imaging.java 3412 2010-09-26 23:43:24Z spasi $ + * @version $Revision$ + * $Id$ */ @Extension(postfix = "") @DeprecatedGL public interface ARB_imaging { - int GL_CONSTANT_COLOR = 0x8001; - int GL_ONE_MINUS_CONSTANT_COLOR = 0x8002; - int GL_CONSTANT_ALPHA = 0x8003; - int GL_ONE_MINUS_CONSTANT_ALPHA = 0x8004; int GL_BLEND_COLOR = 0x8005; int GL_FUNC_ADD = 0x8006; int GL_MIN = 0x8007; diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_indirect_parameters.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_indirect_parameters.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_indirect_parameters.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_indirect_parameters.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2002-2013 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +import org.lwjgl.util.generator.*; +import org.lwjgl.util.generator.opengl.GLenum; +import org.lwjgl.util.generator.opengl.GLintptr; +import org.lwjgl.util.generator.opengl.GLsizei; +import org.lwjgl.util.generator.opengl.GLvoid; + +import java.nio.ByteBuffer; +import java.nio.IntBuffer; + +import javax.lang.model.type.TypeKind; + +public interface ARB_indirect_parameters { + + /** + * Accepted by the <target> parameters of BindBuffer, BufferData, + * BufferSubData, MapBuffer, UnmapBuffer, GetBufferSubData, + * GetBufferPointerv, MapBufferRange, FlushMappedBufferRange, + * GetBufferParameteriv, and CopyBufferSubData: + */ + int GL_PARAMETER_BUFFER_ARB = 0x80EE; + + /** + * Accepted by the <value> parameter of GetIntegerv, GetBooleanv, GetFloatv, + * and GetDoublev: + */ + int GL_PARAMETER_BUFFER_BINDING_ARB = 0x80EF; + + void glMultiDrawArraysIndirectCountARB(@GLenum int mode, + @BufferObject(BufferKind.IndirectBO) @Check("(stride == 0 ? 4 * 4 : stride) * maxdrawcount") @Const @GLvoid ByteBuffer indirect, + @GLintptr long drawcount, + @GLsizei int maxdrawcount, + @GLsizei int stride); + + @Alternate("glMultiDrawArraysIndirectCountARB") + void glMultiDrawArraysIndirectCountARB(@GLenum int mode, + @BufferObject(BufferKind.IndirectBO) @Check("(stride == 0 ? 4 : stride >> 2) * maxdrawcount") @Const @GLvoid(TypeKind.INT) IntBuffer indirect, + @GLintptr long drawcount, + @GLsizei int maxdrawcount, + @GLsizei int stride); + + void glMultiDrawElementsIndirectCountARB(@GLenum int mode, + @GLenum int type, + @BufferObject(BufferKind.IndirectBO) @Check("(stride == 0 ? 5 * 4 : stride) * maxdrawcount") @Const @GLvoid ByteBuffer indirect, + @GLintptr long drawcount, + @GLsizei int maxdrawcount, + @GLsizei int stride); + + @Alternate("glMultiDrawElementsIndirectCountARB") + void glMultiDrawElementsIndirectCountARB(@GLenum int mode, + @GLenum int type, + @BufferObject(BufferKind.IndirectBO) @Check("(stride == 0 ? 5 : stride >> 2) * maxdrawcount") @Const @GLvoid(TypeKind.INT) IntBuffer indirect, + @GLintptr long drawcount, + @GLsizei int maxdrawcount, + @GLsizei int stride); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_internalformat_query2.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_internalformat_query2.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_internalformat_query2.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_internalformat_query2.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,181 @@ +/* + * Copyright (c) 2002-2012 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +import org.lwjgl.util.generator.*; +import org.lwjgl.util.generator.opengl.GLenum; +import org.lwjgl.util.generator.opengl.GLint64; +import org.lwjgl.util.generator.opengl.GLreturn; +import org.lwjgl.util.generator.opengl.GLsizei; + +import java.nio.LongBuffer; + +@Extension(postfix = "") +public interface ARB_internalformat_query2 { + + /** + * Accepted by the <target> parameter of GetInternalformativ + * and GetInternalformati64v: + */ + int GL_TEXTURE_1D_ARRAY = 0x8C18, + GL_TEXTURE_2D_ARRAY = 0x8C1A, + GL_TEXTURE_CUBE_MAP_ARRAY = 0x9009, + GL_TEXTURE_RECTANGLE = 0x84F5, + GL_TEXTURE_BUFFER = 0x8C2A, + GL_RENDERBUFFER = 0x8D41, + GL_TEXTURE_2D_MULTISAMPLE = 0x9100, + GL_TEXTURE_2D_MULTISAMPLE_ARRAY = 0x9102; + + /** + * Accepted by the <pname> parameter of GetInternalformativ + * and GetInternalformati64v: + */ + int GL_NUM_SAMPLE_COUNTS = 0x9380, + GL_INTERNALFORMAT_SUPPORTED = 0x826F, + GL_INTERNALFORMAT_PREFERRED = 0x8270, + GL_INTERNALFORMAT_RED_SIZE = 0x8271, + GL_INTERNALFORMAT_GREEN_SIZE = 0x8272, + GL_INTERNALFORMAT_BLUE_SIZE = 0x8273, + GL_INTERNALFORMAT_ALPHA_SIZE = 0x8274, + GL_INTERNALFORMAT_DEPTH_SIZE = 0x8275, + GL_INTERNALFORMAT_STENCIL_SIZE = 0x8276, + GL_INTERNALFORMAT_SHARED_SIZE = 0x8277, + GL_INTERNALFORMAT_RED_TYPE = 0x8278, + GL_INTERNALFORMAT_GREEN_TYPE = 0x8279, + GL_INTERNALFORMAT_BLUE_TYPE = 0x827A, + GL_INTERNALFORMAT_ALPHA_TYPE = 0x827B, + GL_INTERNALFORMAT_DEPTH_TYPE = 0x827C, + GL_INTERNALFORMAT_STENCIL_TYPE = 0x827D, + GL_MAX_WIDTH = 0x827E, + GL_MAX_HEIGHT = 0x827F, + GL_MAX_DEPTH = 0x8280, + GL_MAX_LAYERS = 0x8281, + GL_MAX_COMBINED_DIMENSIONS = 0x8282, + GL_COLOR_COMPONENTS = 0x8283, + GL_DEPTH_COMPONENTS = 0x8284, + GL_STENCIL_COMPONENTS = 0x8285, + GL_COLOR_RENDERABLE = 0x8286, + GL_DEPTH_RENDERABLE = 0x8287, + GL_STENCIL_RENDERABLE = 0x8288, + GL_FRAMEBUFFER_RENDERABLE = 0x8289, + GL_FRAMEBUFFER_RENDERABLE_LAYERED = 0x828A, + GL_FRAMEBUFFER_BLEND = 0x828B, + GL_READ_PIXELS = 0x828C, + GL_READ_PIXELS_FORMAT = 0x828D, + GL_READ_PIXELS_TYPE = 0x828E, + GL_TEXTURE_IMAGE_FORMAT = 0x828F, + GL_TEXTURE_IMAGE_TYPE = 0x8290, + GL_GET_TEXTURE_IMAGE_FORMAT = 0x8291, + GL_GET_TEXTURE_IMAGE_TYPE = 0x8292, + GL_MIPMAP = 0x8293, + GL_MANUAL_GENERATE_MIPMAP = 0x8294, + GL_AUTO_GENERATE_MIPMAP = 0x8295, + GL_COLOR_ENCODING = 0x8296, + GL_SRGB_READ = 0x8297, + GL_SRGB_WRITE = 0x8298, + GL_SRGB_DECODE_ARB = 0x8299, + GL_FILTER = 0x829A, + GL_VERTEX_TEXTURE = 0x829B, + GL_TESS_CONTROL_TEXTURE = 0x829C, + GL_TESS_EVALUATION_TEXTURE = 0x829D, + GL_GEOMETRY_TEXTURE = 0x829E, + GL_FRAGMENT_TEXTURE = 0x829F, + GL_COMPUTE_TEXTURE = 0x82A0, + GL_TEXTURE_SHADOW = 0x82A1, + GL_TEXTURE_GATHER = 0x82A2, + GL_TEXTURE_GATHER_SHADOW = 0x82A3, + GL_SHADER_IMAGE_LOAD = 0x82A4, + GL_SHADER_IMAGE_STORE = 0x82A5, + GL_SHADER_IMAGE_ATOMIC = 0x82A6, + GL_IMAGE_TEXEL_SIZE = 0x82A7, + GL_IMAGE_COMPATIBILITY_CLASS = 0x82A8, + GL_IMAGE_PIXEL_FORMAT = 0x82A9, + GL_IMAGE_PIXEL_TYPE = 0x82AA, + GL_IMAGE_FORMAT_COMPATIBILITY_TYPE = 0x90C7, + GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_TEST = 0x82AC, + GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_TEST = 0x82AD, + GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_WRITE = 0x82AE, + GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_WRITE = 0x82AF, + GL_TEXTURE_COMPRESSED_BLOCK_WIDTH = 0x82B1, + GL_TEXTURE_COMPRESSED_BLOCK_HEIGHT = 0x82B2, + GL_TEXTURE_COMPRESSED_BLOCK_SIZE = 0x82B3, + GL_CLEAR_BUFFER = 0x82B4, + GL_TEXTURE_VIEW = 0x82B5, + GL_VIEW_COMPATIBILITY_CLASS = 0x82B6; + + /** + * Returned as possible responses for various <pname> queries + * to GetInternalformativ and GetInternalformati64v + */ + int GL_FULL_SUPPORT = 0x82B7, + GL_CAVEAT_SUPPORT = 0x82B8, + GL_IMAGE_CLASS_4_X_32 = 0x82B9, + GL_IMAGE_CLASS_2_X_32 = 0x82BA, + GL_IMAGE_CLASS_1_X_32 = 0x82BB, + GL_IMAGE_CLASS_4_X_16 = 0x82BC, + GL_IMAGE_CLASS_2_X_16 = 0x82BD, + GL_IMAGE_CLASS_1_X_16 = 0x82BE, + GL_IMAGE_CLASS_4_X_8 = 0x82BF, + GL_IMAGE_CLASS_2_X_8 = 0x82C0, + GL_IMAGE_CLASS_1_X_8 = 0x82C1, + GL_IMAGE_CLASS_11_11_10 = 0x82C2, + GL_IMAGE_CLASS_10_10_10_2 = 0x82C3, + GL_VIEW_CLASS_128_BITS = 0x82C4, + GL_VIEW_CLASS_96_BITS = 0x82C5, + GL_VIEW_CLASS_64_BITS = 0x82C6, + GL_VIEW_CLASS_48_BITS = 0x82C7, + GL_VIEW_CLASS_32_BITS = 0x82C8, + GL_VIEW_CLASS_24_BITS = 0x82C9, + GL_VIEW_CLASS_16_BITS = 0x82CA, + GL_VIEW_CLASS_8_BITS = 0x82CB, + GL_VIEW_CLASS_S3TC_DXT1_RGB = 0x82CC, + GL_VIEW_CLASS_S3TC_DXT1_RGBA = 0x82CD, + GL_VIEW_CLASS_S3TC_DXT3_RGBA = 0x82CE, + GL_VIEW_CLASS_S3TC_DXT5_RGBA = 0x82CF, + GL_VIEW_CLASS_RGTC1_RED = 0x82D0, + GL_VIEW_CLASS_RGTC2_RG = 0x82D1, + GL_VIEW_CLASS_BPTC_UNORM = 0x82D2, + GL_VIEW_CLASS_BPTC_FLOAT = 0x82D3; + + @Reuse("GL43") + @StripPostfix("params") + void glGetInternalformati64v(@GLenum int target, @GLenum int internalformat, + @GLenum int pname, @AutoSize("params") @GLsizei int bufSize, @OutParameter @GLint64 LongBuffer params); + + @Reuse("GL43") + @Alternate("glGetInternalformati64v") + @GLreturn("params") + @StripPostfix(value = "params", hasPostfix = false) + void glGetInternalformati64v2(@GLenum int target, @GLenum int internalformat, + @GLenum int pname, @Constant("1") @GLsizei int bufSize, @OutParameter @GLint64 LongBuffer params); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_internalformat_query.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_internalformat_query.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_internalformat_query.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_internalformat_query.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +import org.lwjgl.util.generator.*; +import org.lwjgl.util.generator.opengl.GLenum; +import org.lwjgl.util.generator.opengl.GLreturn; +import org.lwjgl.util.generator.opengl.GLsizei; + +import java.nio.IntBuffer; + +@Extension(postfix = "") +public interface ARB_internalformat_query { + + /** Accepted by the <pname> parameter of GetInternalformativ: */ + int GL_NUM_SAMPLE_COUNTS = 0x9380; + + @StripPostfix("params") + @Reuse("GL42") + void glGetInternalformativ(@GLenum int target, @GLenum int internalformat, + @GLenum int pname, @AutoSize("params") @GLsizei int bufSize, @OutParameter IntBuffer params); + + @Alternate("glGetInternalformativ") + @StripPostfix("params") + @GLreturn("params") + @Reuse("GL42") + void glGetInternalformativ2(@GLenum int target, @GLenum int internalformat, + @GLenum int pname, @Constant("1") @GLsizei int bufSize, @OutParameter IntBuffer params); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_invalidate_subdata.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_invalidate_subdata.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_invalidate_subdata.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_invalidate_subdata.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2002-2012 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +import org.lwjgl.util.generator.AutoSize; +import org.lwjgl.util.generator.Const; +import org.lwjgl.util.generator.Reuse; +import org.lwjgl.util.generator.opengl.*; + +import java.nio.IntBuffer; + +public interface ARB_invalidate_subdata { + + @Reuse("GL43") + void glInvalidateTexSubImage(@GLuint int texture, int level, + int xoffset, int yoffset, int zoffset, + @GLsizei int width, @GLsizei int height, @GLsizei int depth); + + @Reuse("GL43") + void glInvalidateTexImage(@GLuint int texture, int level); + + @Reuse("GL43") + void glInvalidateBufferSubData(@GLuint int buffer, @GLintptr long offset, @GLsizeiptr long length); + + @Reuse("GL43") + void glInvalidateBufferData(@GLuint int buffer); + + @Reuse("GL43") + void glInvalidateFramebuffer(@GLenum int target, + @AutoSize("attachments") @GLsizei int numAttachments, + @Const @GLenum IntBuffer attachments); + + @Reuse("GL43") + void glInvalidateSubFramebuffer(@GLenum int target, + @AutoSize("attachments") @GLsizei int numAttachments, + @Const @GLenum IntBuffer attachments, + int x, int y, @GLsizei int width, @GLsizei int height); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_map_buffer_alignment.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_map_buffer_alignment.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_map_buffer_alignment.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_map_buffer_alignment.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +public interface ARB_map_buffer_alignment { + + /** + * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, + * GetInteger64v, GetFloatv, and GetDoublev: + */ + int GL_MIN_MAP_BUFFER_ALIGNMENT = 0x90BC; + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_multi_bind.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_multi_bind.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_multi_bind.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_multi_bind.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2002-2013 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +import org.lwjgl.PointerBuffer; +import org.lwjgl.util.generator.Check; +import org.lwjgl.util.generator.Const; +import org.lwjgl.util.generator.Reuse; +import org.lwjgl.util.generator.opengl.*; + +import java.nio.IntBuffer; + +public interface ARB_multi_bind { + + @Reuse("GL44") + void glBindBuffersBase(@GLenum int target, @GLuint int first, @GLsizei int count, @Check(value = "count", canBeNull = true) @Const @GLuint IntBuffer buffers); + + @Reuse("GL44") + void glBindBuffersRange(@GLenum int target, @GLuint int first, @GLsizei int count, + @Check(value = "count", canBeNull = true) @Const @GLuint IntBuffer buffers, + @Check(value = "count", canBeNull = true) @Const @GLintptr PointerBuffer offsets, + @Check(value = "count", canBeNull = true) @Const @GLsizeiptr PointerBuffer sizes); + + @Reuse("GL44") + void glBindTextures(@GLuint int first, @GLsizei int count, @Check(value = "count", canBeNull = true) @Const @GLuint IntBuffer textures); + + @Reuse("GL44") + void glBindSamplers(@GLuint int first, @GLsizei int count, @Check(value = "count", canBeNull = true) @Const @GLuint IntBuffer samplers); + + @Reuse("GL44") + void glBindImageTextures(@GLuint int first, @GLsizei int count, @Check(value = "count", canBeNull = true) @Const @GLuint IntBuffer textures); + + @Reuse("GL44") + void glBindVertexBuffers(@GLuint int first, @GLsizei int count, + @Check(value = "count", canBeNull = true) @Const @GLuint IntBuffer buffers, + @Check(value = "count", canBeNull = true) @Const @GLintptr PointerBuffer offsets, + @Check(value = "count", canBeNull = true) @Const @GLsizei IntBuffer strides); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_multi_draw_indirect.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_multi_draw_indirect.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_multi_draw_indirect.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_multi_draw_indirect.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2002-2012 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +import org.lwjgl.util.generator.*; +import org.lwjgl.util.generator.opengl.GLenum; +import org.lwjgl.util.generator.opengl.GLsizei; +import org.lwjgl.util.generator.opengl.GLvoid; + +import java.nio.ByteBuffer; +import java.nio.IntBuffer; + +import javax.lang.model.type.TypeKind; + +public interface ARB_multi_draw_indirect { + + @Reuse("GL43") + void glMultiDrawArraysIndirect(@GLenum int mode, + @BufferObject(BufferKind.IndirectBO) @Check("(stride == 0 ? 4 * 4 : stride) * primcount") @Const @GLvoid ByteBuffer indirect, + @GLsizei int primcount, + @GLsizei int stride); + + @Reuse("GL43") + @Alternate("glMultiDrawArraysIndirect") + void glMultiDrawArraysIndirect(@GLenum int mode, + @BufferObject(BufferKind.IndirectBO) @Check("(stride == 0 ? 4 : stride >> 2) * primcount") @Const @GLvoid(TypeKind.INT) IntBuffer indirect, + @GLsizei int primcount, + @GLsizei int stride); + + @Reuse("GL43") + void glMultiDrawElementsIndirect(@GLenum int mode, + @GLenum int type, + @BufferObject(BufferKind.IndirectBO) @Check("(stride == 0 ? 5 * 4 : stride) * primcount") @Const @GLvoid ByteBuffer indirect, + @GLsizei int primcount, + @GLsizei int stride); + + @Reuse("GL43") + @Alternate("glMultiDrawElementsIndirect") + void glMultiDrawElementsIndirect(@GLenum int mode, + @GLenum int type, + @BufferObject(BufferKind.IndirectBO) @Check("(stride == 0 ? 5 : stride >> 2) * primcount") @Const @GLvoid(TypeKind.INT) IntBuffer indirect, + @GLsizei int primcount, + @GLsizei int stride); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_occlusion_query.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_occlusion_query.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_occlusion_query.java 2011-03-26 18:15:37.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_occlusion_query.java 2016-04-09 16:26:56.000000000 +0000 @@ -68,7 +68,7 @@ void glDeleteQueriesARB(@AutoSize("ids") @GLsizei int n, @GLuint IntBuffer ids); @Alternate("glDeleteQueriesARB") - void glDeleteQueriesARB(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getBufferInt().put(0, id), 0", keepParam = true) int id); + void glDeleteQueriesARB(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getInt(caps, id)", keepParam = true) int id); boolean glIsQueryARB(@GLuint int id); @@ -79,17 +79,25 @@ @StripPostfix("params") void glGetQueryivARB(@GLenum int target, @GLenum int pname, @OutParameter @Check("1") IntBuffer params); + /** @deprecated Will be removed in 3.0. Use {@link #glGetQueryiARB} instead. */ @Alternate("glGetQueryivARB") @GLreturn("params") @StripPostfix("params") + @Reuse(value = "ARBOcclusionQuery", method = "glGetQueryiARB") + @Deprecated void glGetQueryivARB2(@GLenum int target, @GLenum int pname, @OutParameter IntBuffer params); + @Alternate("glGetQueryivARB") + @GLreturn("params") + @StripPostfix(value = "params", hasPostfix = false) + void glGetQueryivARB3(@GLenum int target, @GLenum int pname, @OutParameter IntBuffer params); + @StripPostfix("params") void glGetQueryObjectivARB(@GLuint int id, @GLenum int pname, @OutParameter @Check("1") IntBuffer params); @Alternate("glGetQueryObjectivARB") @GLreturn("params") - @StripPostfix(value = "params", postfix = "v") + @StripPostfix(value = "params", hasPostfix = false) void glGetQueryObjectivARB2(@GLuint int id, @GLenum int pname, @OutParameter IntBuffer params); @StripPostfix("params") @@ -97,6 +105,6 @@ @Alternate("glGetQueryObjectuivARB") @GLreturn("params") - @StripPostfix(value = "params", postfix = "v") + @StripPostfix(value = "params", hasPostfix = false) void glGetQueryObjectuivARB2(@GLuint int id, @GLenum int pname, @OutParameter IntBuffer params); } diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_pipeline_statistics_query.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_pipeline_statistics_query.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_pipeline_statistics_query.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_pipeline_statistics_query.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2002-2014 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +public interface ARB_pipeline_statistics_query { + + /** + * Accepted by the <target> parameter of BeginQuery, EndQuery, GetQueryiv, + * BeginQueryIndexed, EndQueryIndexed and GetQueryIndexediv: + */ + int GL_VERTICES_SUBMITTED_ARB = 0x82EE, + GL_PRIMITIVES_SUBMITTED_ARB = 0x82EF, + GL_VERTEX_SHADER_INVOCATIONS_ARB = 0x82F0, + GL_TESS_CONTROL_SHADER_PATCHES_ARB = 0x82F1, + GL_TESS_EVALUATION_SHADER_INVOCATIONS_ARB = 0x82F2, + GL_GEOMETRY_SHADER_INVOCATIONS = 0x887F, + GL_GEOMETRY_SHADER_PRIMITIVES_EMITTED_ARB = 0x82F3, + GL_FRAGMENT_SHADER_INVOCATIONS_ARB = 0x82F4, + GL_COMPUTE_SHADER_INVOCATIONS_ARB = 0x82F5, + GL_CLIPPING_INPUT_PRIMITIVES_ARB = 0x82F6, + GL_CLIPPING_OUTPUT_PRIMITIVES_ARB = 0x82F7; + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_program_interface_query.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_program_interface_query.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_program_interface_query.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_program_interface_query.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,161 @@ +/* + * Copyright (c) 2002-2012 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +import org.lwjgl.util.generator.*; +import org.lwjgl.util.generator.opengl.*; + +import java.nio.ByteBuffer; +import java.nio.IntBuffer; + +@Extension(postfix = "") +public interface ARB_program_interface_query { + + /** + * Accepted by the <programInterface> parameter of GetProgramInterfaceiv, + * GetProgramResourceIndex, GetProgramResourceName, GetProgramResourceiv, + * GetProgramResourceLocation, and GetProgramResourceLocationIndex: + */ + int GL_UNIFORM = 0x92E1, + GL_UNIFORM_BLOCK = 0x92E2, + GL_PROGRAM_INPUT = 0x92E3, + GL_PROGRAM_OUTPUT = 0x92E4, + GL_BUFFER_VARIABLE = 0x92E5, + GL_SHADER_STORAGE_BLOCK = 0x92E6, + GL_VERTEX_SUBROUTINE = 0x92E8, + GL_TESS_CONTROL_SUBROUTINE = 0x92E9, + GL_TESS_EVALUATION_SUBROUTINE = 0x92EA, + GL_GEOMETRY_SUBROUTINE = 0x92EB, + GL_FRAGMENT_SUBROUTINE = 0x92EC, + GL_COMPUTE_SUBROUTINE = 0x92ED, + GL_VERTEX_SUBROUTINE_UNIFORM = 0x92EE, + GL_TESS_CONTROL_SUBROUTINE_UNIFORM = 0x92EF, + GL_TESS_EVALUATION_SUBROUTINE_UNIFORM = 0x92F0, + GL_GEOMETRY_SUBROUTINE_UNIFORM = 0x92F1, + GL_FRAGMENT_SUBROUTINE_UNIFORM = 0x92F2, + GL_COMPUTE_SUBROUTINE_UNIFORM = 0x92F3, + GL_TRANSFORM_FEEDBACK_VARYING = 0x92F4; + + /** Accepted by the <pname> parameter of GetProgramInterfaceiv: */ + int GL_ACTIVE_RESOURCES = 0x92F5, + GL_MAX_NAME_LENGTH = 0x92F6, + GL_MAX_NUM_ACTIVE_VARIABLES = 0x92F7, + GL_MAX_NUM_COMPATIBLE_SUBROUTINES = 0x92F8; + + /** Accepted in the <props> array of GetProgramResourceiv: */ + int GL_NAME_LENGTH = 0x92F9, + GL_TYPE = 0x92FA, + GL_ARRAY_SIZE = 0x92FB, + GL_OFFSET = 0x92FC, + GL_BLOCK_INDEX = 0x92FD, + GL_ARRAY_STRIDE = 0x92FE, + GL_MATRIX_STRIDE = 0x92FF, + GL_IS_ROW_MAJOR = 0x9300, + GL_ATOMIC_COUNTER_BUFFER_INDEX = 0x9301, + GL_BUFFER_BINDING = 0x9302, + GL_BUFFER_DATA_SIZE = 0x9303, + GL_NUM_ACTIVE_VARIABLES = 0x9304, + GL_ACTIVE_VARIABLES = 0x9305, + GL_REFERENCED_BY_VERTEX_SHADER = 0x9306, + GL_REFERENCED_BY_TESS_CONTROL_SHADER = 0x9307, + GL_REFERENCED_BY_TESS_EVALUATION_SHADER = 0x9308, + GL_REFERENCED_BY_GEOMETRY_SHADER = 0x9309, + GL_REFERENCED_BY_FRAGMENT_SHADER = 0x930A, + GL_REFERENCED_BY_COMPUTE_SHADER = 0x930B, + GL_TOP_LEVEL_ARRAY_SIZE = 0x930C, + GL_TOP_LEVEL_ARRAY_STRIDE = 0x930D, + GL_LOCATION = 0x930E, + GL_LOCATION_INDEX = 0x930F, + GL_IS_PER_PATCH = 0x92E7; + + @Reuse("GL43") + @StripPostfix("params") + void glGetProgramInterfaceiv(@GLuint int program, @GLenum int programInterface, + @GLenum int pname, @Check("1") @OutParameter IntBuffer params); + + @Reuse("GL43") + @Alternate("glGetProgramInterfaceiv") + @GLreturn("params") + @StripPostfix(value = "params", hasPostfix = false) + void glGetProgramInterfaceiv2(@GLuint int program, @GLenum int programInterface, + @GLenum int pname, @OutParameter IntBuffer params); + + @Reuse("GL43") + @GLuint + int glGetProgramResourceIndex(@GLuint int program, @GLenum int programInterface, + @NullTerminated @Const @GLchar ByteBuffer name); + + @Reuse("GL43") + @Alternate("glGetProgramResourceIndex") + @GLuint + int glGetProgramResourceIndex(@GLuint int program, @GLenum int programInterface, + @NullTerminated CharSequence name); + + @Reuse("GL43") + void glGetProgramResourceName(@GLuint int program, @GLenum int programInterface, + @GLuint int index, @AutoSize(value = "name", canBeNull = true) @GLsizei int bufSize, @Check(value = "1", canBeNull = true) @OutParameter @GLsizei IntBuffer length, + @Check(canBeNull = true) @OutParameter @GLchar ByteBuffer name); + + @Reuse("GL43") + @Alternate("glGetProgramResourceName") + @GLreturn(value = "name", maxLength = "bufSize") + void glGetProgramResourceName2(@GLuint int program, @GLenum int programInterface, + @GLuint int index, @GLsizei int bufSize, + @OutParameter @GLsizei @Constant("MemoryUtil.getAddress0(name_length)") IntBuffer length, + @OutParameter @GLchar ByteBuffer name); + + @Reuse("GL43") + @StripPostfix("params") + void glGetProgramResourceiv(@GLuint int program, @GLenum int programInterface, + @GLuint int index, @AutoSize("props") @GLsizei int propCount, + @Const @GLenum IntBuffer props, @AutoSize("params") @GLsizei int bufSize, + @Check(value = "1", canBeNull = true) @OutParameter @GLsizei IntBuffer length, @OutParameter IntBuffer params); + + @Reuse("GL43") + int glGetProgramResourceLocation(@GLuint int program, @GLenum int programInterface, + @NullTerminated @Const @GLchar ByteBuffer name); + + @Reuse("GL43") + @Alternate("glGetProgramResourceLocation") + int glGetProgramResourceLocation(@GLuint int program, @GLenum int programInterface, + @NullTerminated CharSequence name); + + @Reuse("GL43") + int glGetProgramResourceLocationIndex(@GLuint int program, @GLenum int programInterface, + @NullTerminated @Const @GLchar ByteBuffer name); + + @Reuse("GL43") + @Alternate("glGetProgramResourceLocationIndex") + int glGetProgramResourceLocationIndex(@GLuint int program, @GLenum int programInterface, + @NullTerminated CharSequence name); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_program.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_program.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_program.java 2011-03-26 18:15:37.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_program.java 2016-04-09 16:26:56.000000000 +0000 @@ -128,7 +128,7 @@ void glDeleteProgramsARB(@AutoSize("programs") @GLsizei int n, @Const @GLuint IntBuffer programs); @Alternate("glDeleteProgramsARB") - void glDeleteProgramsARB(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getBufferInt().put(0, program), 0", keepParam = true) int program); + void glDeleteProgramsARB(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getInt(caps, program)", keepParam = true) int program); void glGenProgramsARB(@AutoSize("programs") @GLsizei int n, @OutParameter @GLuint IntBuffer programs); @@ -171,15 +171,23 @@ @StripPostfix("params") void glGetProgramivARB(@GLenum int target, @GLenum int parameterName, @OutParameter @Check("4") IntBuffer params); + /** @deprecated Will be removed in 3.0. Use {@link #glGetProgramiARB} instead. */ @Alternate("glGetProgramivARB") @GLreturn("params") @StripPostfix("params") + @Reuse(value = "ARBProgram", method = "glGetProgramiARB") + @Deprecated void glGetProgramivARB2(@GLenum int target, @GLenum int parameterName, @OutParameter IntBuffer params); + @Alternate("glGetProgramivARB") + @GLreturn("params") + @StripPostfix(value = "params", hasPostfix = false) + void glGetProgramivARB3(@GLenum int target, @GLenum int parameterName, @OutParameter IntBuffer params); + void glGetProgramStringARB(@GLenum int target, @GLenum int parameterName, @OutParameter @Check @GLbyte Buffer paramString); @Alternate("glGetProgramStringARB") - @Code("\t\tint programLength = glGetProgramARB(target, GL_PROGRAM_LENGTH_ARB);") + @Code("\t\tint programLength = glGetProgramiARB(target, GL_PROGRAM_LENGTH_ARB);") @GLreturn(value="paramString", maxLength = "programLength", forceMaxLength = true) void glGetProgramStringARB2(@GLenum int target, @GLenum int parameterName, @OutParameter @GLchar ByteBuffer paramString); diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_query_buffer_object.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_query_buffer_object.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_query_buffer_object.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_query_buffer_object.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2002-2013 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +public interface ARB_query_buffer_object { + + /** + * Accepted by the <pname> parameter of GetQueryObjectiv, GetQueryObjectuiv, + * GetQueryObjecti64v and GetQueryObjectui64v: + */ + int GL_QUERY_RESULT_NO_WAIT = 0x9194; + + /** + * Accepted by the <target> parameter of BindBuffer, BufferData, + * BufferSubData, MapBuffer, UnmapBuffer, MapBufferRange, GetBufferSubData, + * GetBufferParameteriv, GetBufferParameteri64v, GetBufferPointerv, + * ClearBufferSubData, and the <readtarget> and <writetarget> parameters of + * CopyBufferSubData: + */ + int GL_QUERY_BUFFER = 0x9192; + + /** + * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, + * and GetDoublev: + */ + int GL_QUERY_BUFFER_BINDING = 0x9193; + + /** Accepted in the <barriers> bitfield in MemoryBarrier: */ + int GL_QUERY_BUFFER_BARRIER_BIT = 0x00008000; + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_robust_buffer_access_behavior.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_robust_buffer_access_behavior.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_robust_buffer_access_behavior.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_robust_buffer_access_behavior.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2002-2012 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +public interface ARB_robust_buffer_access_behavior { +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_robustness_isolation.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_robustness_isolation.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_robustness_isolation.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_robustness_isolation.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2002-2012 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +public interface ARB_robustness_isolation { +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_robustness.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_robustness.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_robustness.java 2011-03-26 18:15:37.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_robustness.java 2016-04-09 16:26:56.000000000 +0000 @@ -41,8 +41,7 @@ public interface ARB_robustness { /** Returned by GetGraphicsResetStatusARB: */ - int GL_NO_ERROR = 0x0000, - GL_GUILTY_CONTEXT_RESET_ARB = 0x8253, + int GL_GUILTY_CONTEXT_RESET_ARB = 0x8253, GL_INNOCENT_CONTEXT_RESET_ARB = 0x8254, GL_UNKNOWN_CONTEXT_RESET_ARB = 0x8255; diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_sampler_objects.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_sampler_objects.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_sampler_objects.java 2011-03-26 18:15:37.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_sampler_objects.java 2016-04-09 16:26:56.000000000 +0000 @@ -63,7 +63,7 @@ @Reuse("GL33") @Alternate("glDeleteSamplers") - void glDeleteSamplers(@Constant("1") @GLsizei int count, @Constant(value = "APIUtil.getBufferInt().put(0, sampler), 0", keepParam = true) int sampler); + void glDeleteSamplers(@Constant("1") @GLsizei int count, @Constant(value = "APIUtil.getInt(caps, sampler)", keepParam = true) int sampler); @Reuse("GL33") boolean glIsSampler(@GLuint int sampler); @@ -100,7 +100,7 @@ @Reuse("GL33") @Alternate("glGetSamplerParameteriv") @GLreturn("params") - @StripPostfix(value = "params", postfix = "v") + @StripPostfix(value = "params", hasPostfix = false) void glGetSamplerParameteriv2(@GLuint int sampler, @GLenum int pname, @OutParameter IntBuffer params); @Reuse("GL33") @@ -110,7 +110,7 @@ @Reuse("GL33") @Alternate("glGetSamplerParameterfv") @GLreturn("params") - @StripPostfix(value = "params", postfix = "v") + @StripPostfix(value = "params", hasPostfix = false) void glGetSamplerParameterfv2(@GLuint int sampler, @GLenum int pname, @OutParameter FloatBuffer params); @Reuse("GL33") @@ -120,7 +120,7 @@ @Reuse("GL33") @Alternate("glGetSamplerParameterIiv") @GLreturn("params") - @StripPostfix(value = "params", postfix = "v") + @StripPostfix(value = "params", hasPostfix = false) void glGetSamplerParameterIiv2(@GLuint int sampler, @GLenum int pname, @OutParameter IntBuffer params); @Reuse("GL33") @@ -130,7 +130,7 @@ @Reuse("GL33") @Alternate("glGetSamplerParameterIuiv") @GLreturn("params") - @StripPostfix(value = "params", postfix = "v") + @StripPostfix(value = "params", hasPostfix = false) void glGetSamplerParameterIuiv2(@GLuint int sampler, @GLenum int pname, @OutParameter IntBuffer params); } \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_seamless_cubemap_per_texture.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_seamless_cubemap_per_texture.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_seamless_cubemap_per_texture.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_seamless_cubemap_per_texture.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2002-2013 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +public interface ARB_seamless_cubemap_per_texture { + + /** + * Accepted by the <pname> parameter of TexParameter{if}, + * TexParameter{if}v, GetTexParameter{if}v, SamplerParameter{if}, + * SamplerParameter{if}v, and GetSamplerParameter{if}v: + */ + int GL_TEXTURE_CUBE_MAP_SEAMLESS = 0x884F; + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_separate_shader_objects.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_separate_shader_objects.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_separate_shader_objects.java 2011-03-26 18:15:37.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_separate_shader_objects.java 2016-04-09 16:26:56.000000000 +0000 @@ -32,7 +32,6 @@ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; -import org.lwjgl.util.generator.Alternate; import org.lwjgl.util.generator.opengl.*; import java.nio.ByteBuffer; @@ -44,12 +43,12 @@ public interface ARB_separate_shader_objects { /** Accepted by <stages> parameter to UseProgramStages: */ - int GL_VERTEX_SHADER_BIT = 0x00000001, - GL_FRAGMENT_SHADER_BIT = 0x00000002, - GL_GEOMETRY_SHADER_BIT = 0x00000004, - GL_TESS_CONTROL_SHADER_BIT = 0x00000008, + int GL_VERTEX_SHADER_BIT = 0x00000001, + GL_FRAGMENT_SHADER_BIT = 0x00000002, + GL_GEOMETRY_SHADER_BIT = 0x00000004, + GL_TESS_CONTROL_SHADER_BIT = 0x00000008, GL_TESS_EVALUATION_SHADER_BIT = 0x00000010, - GL_ALL_SHADER_BITS = 0xFFFFFFFF; + GL_ALL_SHADER_BITS = 0xFFFFFFFF; /** * Accepted by the <pname> parameter of ProgramParameteri and @@ -72,23 +71,37 @@ @Reuse("GL41") void glActiveShaderProgram(@GLuint int pipeline, @GLuint int program); + /** Single null-terminated source code string. */ @Reuse("GL41") - @StripPostfix(value = "strings", postfix = "v") + @StripPostfix(value = "string", hasPostfix = false) @GLuint - int glCreateShaderProgramv(@GLenum int type, @GLsizei int count, @Check @Const @Indirect @GLchar ByteBuffer strings); + int glCreateShaderProgramv(@GLenum int type, @Constant("1") @GLsizei int count, @NullTerminated @Check @Const @Indirect @GLchar ByteBuffer string); + + /** Multiple null-terminated source code strings, one after the other. */ + @Reuse("GL41") + @Alternate(value = "glCreateShaderProgramv", nativeAlt = true) + @StripPostfix(value = "strings", hasPostfix = false) + @GLuint + int glCreateShaderProgramv2(@GLenum int type, @GLsizei int count, @NullTerminated("count") @Check @Const @Indirect @GLchar @PointerArray("count") ByteBuffer strings); + + @Reuse("GL41") + @Alternate(value = "glCreateShaderProgramv", nativeAlt = true) + @StripPostfix(value = "strings", hasPostfix = false) + @GLuint + int glCreateShaderProgramv3(@GLenum int type, @Constant("strings.length") @GLsizei int count, @NullTerminated @Check("1") @PointerArray(value = "count") @Const @NativeType("GLchar") ByteBuffer[] strings); @Reuse("GL41") @Alternate("glCreateShaderProgramv") - @StripPostfix(value = "string", postfix = "v") + @StripPostfix(value = "string", hasPostfix = false) @GLuint int glCreateShaderProgramv(@GLenum int type, @Constant("1") @GLsizei int count, @NullTerminated CharSequence string); @Reuse("GL41") - @Alternate("glCreateShaderProgramv") - @StripPostfix(value = "strings", postfix = "v") + @Alternate(value = "glCreateShaderProgramv", nativeAlt = true, skipNative = true) + @StripPostfix(value = "strings", hasPostfix = false) @GLuint - int glCreateShaderProgramv(@GLenum int type, @Constant("strings.length") @GLsizei int count, - @Const @NullTerminated @PointerArray(value = "count") CharSequence[] strings); + int glCreateShaderProgramv2(@GLenum int type, @Constant("strings.length") @GLsizei int count, + @Const @NullTerminated @PointerArray(value = "count") CharSequence[] strings); @Reuse("GL41") void glBindProgramPipeline(@GLuint int pipeline); @@ -98,7 +111,7 @@ @Reuse("GL41") @Alternate("glDeleteProgramPipelines") - void glDeleteProgramPipelines(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getBufferInt().put(0, pipeline), 0", keepParam = true) int pipeline); + void glDeleteProgramPipelines(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getInt(caps, pipeline)", keepParam = true) int pipeline); @Reuse("GL41") void glGenProgramPipelines(@AutoSize("pipelines") @GLsizei int n, @OutParameter @GLuint IntBuffer pipelines); @@ -121,7 +134,7 @@ @Reuse("GL41") @Alternate("glGetProgramPipelineiv") @GLreturn("params") - @StripPostfix("params") + @StripPostfix(value = "params", hasPostfix = false) void glGetProgramPipelineiv2(@GLuint int pipeline, @GLenum int pname, @OutParameter IntBuffer params); @Reuse("GL41") @@ -332,7 +345,7 @@ @Alternate("glGetProgramPipelineInfoLog") @GLreturn(value = "infoLog", maxLength = "bufSize") void glGetProgramPipelineInfoLog2(@GLuint int pipeline, @GLsizei int bufSize, - @OutParameter @GLsizei @Constant("infoLog_length, 0") IntBuffer length, + @OutParameter @GLsizei @Constant("MemoryUtil.getAddress0(infoLog_length)") IntBuffer length, @OutParameter @GLchar ByteBuffer infoLog); } \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_shader_atomic_counters.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_shader_atomic_counters.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_shader_atomic_counters.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_shader_atomic_counters.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,106 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +import org.lwjgl.util.generator.*; +import org.lwjgl.util.generator.opengl.GLenum; +import org.lwjgl.util.generator.opengl.GLreturn; +import org.lwjgl.util.generator.opengl.GLuint; + +import java.nio.IntBuffer; + +@Extension(postfix = "") +public interface ARB_shader_atomic_counters { + + /** Accepted by the <target> parameter of BindBufferBase and BindBufferRange: */ + int GL_ATOMIC_COUNTER_BUFFER = 0x92C0; + + /** + * Accepted by the <pname> parameter of GetBooleani_v, GetIntegeri_v, + * GetFloati_v, GetDoublei_v, GetInteger64i_v, GetBooleanv, GetIntegerv, + * GetInteger64v, GetFloatv, GetDoublev, and GetActiveAtomicCounterBufferiv: + */ + int GL_ATOMIC_COUNTER_BUFFER_BINDING = 0x92C1; + + /** Accepted by the <pname> parameter of GetIntegeri_64v: */ + int GL_ATOMIC_COUNTER_BUFFER_START = 0x92C2, + GL_ATOMIC_COUNTER_BUFFER_SIZE = 0x92C3; + + /** Accepted by the <pname> parameter of GetActiveAtomicCounterBufferiv: */ + int GL_ATOMIC_COUNTER_BUFFER_DATA_SIZE = 0x92C4, + GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTERS = 0x92C5, + GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTER_INDICES = 0x92C6, + GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_VERTEX_SHADER = 0x92C7, + GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_CONTROL_SHADER = 0x92C8, + GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_EVALUATION_SHADER = 0x92C9, + GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_GEOMETRY_SHADER = 0x92CA, + GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_FRAGMENT_SHADER = 0x92CB; + + /** + * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, + * GetInteger64v, GetFloatv, and GetDoublev: + */ + int GL_MAX_VERTEX_ATOMIC_COUNTER_BUFFERS = 0x92CC, + GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS = 0x92CD, + GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS = 0x92CE, + GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS = 0x92CF, + GL_MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS = 0x92D0, + GL_MAX_COMBINED_ATOMIC_COUNTER_BUFFERS = 0x92D1, + GL_MAX_VERTEX_ATOMIC_COUNTERS = 0x92D2, + GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS = 0x92D3, + GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS = 0x92D4, + GL_MAX_GEOMETRY_ATOMIC_COUNTERS = 0x92D5, + GL_MAX_FRAGMENT_ATOMIC_COUNTERS = 0x92D6, + GL_MAX_COMBINED_ATOMIC_COUNTERS = 0x92D7, + GL_MAX_ATOMIC_COUNTER_BUFFER_SIZE = 0x92D8, + GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS = 0x92DC; + + /** Accepted by the <pname> parameter of GetProgramiv: */ + int GL_ACTIVE_ATOMIC_COUNTER_BUFFERS = 0x92D9; + + /** Accepted by the <pname> parameter of GetActiveUniformsiv: */ + int GL_UNIFORM_ATOMIC_COUNTER_BUFFER_INDEX = 0x92DA; + + /** Returned in <params> by GetActiveUniform and GetActiveUniformsiv: */ + int GL_UNSIGNED_INT_ATOMIC_COUNTER = 0x92DB; + + @StripPostfix("params") + @Reuse("GL42") + void glGetActiveAtomicCounterBufferiv(@GLuint int program, @GLuint int bufferIndex, @GLenum int pname, @Check("1") @OutParameter IntBuffer params); + + @Alternate("glGetActiveAtomicCounterBufferiv") + @StripPostfix("params") + @GLreturn("params") + @Reuse("GL42") + void glGetActiveAtomicCounterBufferiv2(@GLuint int program, @GLuint int bufferIndex, @GLenum int pname, @OutParameter IntBuffer params); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_shader_draw_parameters.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_shader_draw_parameters.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_shader_draw_parameters.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_shader_draw_parameters.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2002-2013 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +public interface ARB_shader_draw_parameters { + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_shader_group_vote.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_shader_group_vote.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_shader_group_vote.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_shader_group_vote.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2002-2013 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +public interface ARB_shader_group_vote { + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_shader_image_load_store.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_shader_image_load_store.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_shader_image_load_store.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_shader_image_load_store.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,135 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +import org.lwjgl.util.generator.Reuse; +import org.lwjgl.util.generator.opengl.GLbitfield; +import org.lwjgl.util.generator.opengl.GLenum; +import org.lwjgl.util.generator.opengl.GLuint; + +public interface ARB_shader_image_load_store { + + /** + * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, + * GetFloatv, GetDoublev, and GetInteger64v: + */ + int GL_MAX_IMAGE_UNITS = 0x8F38, + GL_MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS = 0x8F39, + GL_MAX_IMAGE_SAMPLES = 0x906D, + GL_MAX_VERTEX_IMAGE_UNIFORMS = 0x90CA, + GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS = 0x90CB, + GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS = 0x90CC, + GL_MAX_GEOMETRY_IMAGE_UNIFORMS = 0x90CD, + GL_MAX_FRAGMENT_IMAGE_UNIFORMS = 0x90CE, + GL_MAX_COMBINED_IMAGE_UNIFORMS = 0x90CF; + + /** Accepted by the <target> parameter of GetIntegeri_v and GetBooleani_v: */ + int GL_IMAGE_BINDING_NAME = 0x8F3A, + GL_IMAGE_BINDING_LEVEL = 0x8F3B, + GL_IMAGE_BINDING_LAYERED = 0x8F3C, + GL_IMAGE_BINDING_LAYER = 0x8F3D, + GL_IMAGE_BINDING_ACCESS = 0x8F3E, + GL_IMAGE_BINDING_FORMAT = 0x906E; + + /** Accepted by the <barriers> parameter of MemoryBarrier: */ + int GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT = 0x00000001, + GL_ELEMENT_ARRAY_BARRIER_BIT = 0x00000002, + GL_UNIFORM_BARRIER_BIT = 0x00000004, + GL_TEXTURE_FETCH_BARRIER_BIT = 0x00000008, + GL_SHADER_IMAGE_ACCESS_BARRIER_BIT = 0x00000020, + GL_COMMAND_BARRIER_BIT = 0x00000040, + GL_PIXEL_BUFFER_BARRIER_BIT = 0x00000080, + GL_TEXTURE_UPDATE_BARRIER_BIT = 0x00000100, + GL_BUFFER_UPDATE_BARRIER_BIT = 0x00000200, + GL_FRAMEBUFFER_BARRIER_BIT = 0x00000400, + GL_TRANSFORM_FEEDBACK_BARRIER_BIT = 0x00000800, + GL_ATOMIC_COUNTER_BARRIER_BIT = 0x00001000, + GL_ALL_BARRIER_BITS = 0xFFFFFFFF; + + /** Returned by the <type> parameter of GetActiveUniform: */ + int GL_IMAGE_1D = 0x904C, + GL_IMAGE_2D = 0x904D, + GL_IMAGE_3D = 0x904E, + GL_IMAGE_2D_RECT = 0x904F, + GL_IMAGE_CUBE = 0x9050, + GL_IMAGE_BUFFER = 0x9051, + GL_IMAGE_1D_ARRAY = 0x9052, + GL_IMAGE_2D_ARRAY = 0x9053, + GL_IMAGE_CUBE_MAP_ARRAY = 0x9054, + GL_IMAGE_2D_MULTISAMPLE = 0x9055, + GL_IMAGE_2D_MULTISAMPLE_ARRAY = 0x9056, + GL_INT_IMAGE_1D = 0x9057, + GL_INT_IMAGE_2D = 0x9058, + GL_INT_IMAGE_3D = 0x9059, + GL_INT_IMAGE_2D_RECT = 0x905A, + GL_INT_IMAGE_CUBE = 0x905B, + GL_INT_IMAGE_BUFFER = 0x905C, + GL_INT_IMAGE_1D_ARRAY = 0x905D, + GL_INT_IMAGE_2D_ARRAY = 0x905E, + GL_INT_IMAGE_CUBE_MAP_ARRAY = 0x905F, + GL_INT_IMAGE_2D_MULTISAMPLE = 0x9060, + GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY = 0x9061, + GL_UNSIGNED_INT_IMAGE_1D = 0x9062, + GL_UNSIGNED_INT_IMAGE_2D = 0x9063, + GL_UNSIGNED_INT_IMAGE_3D = 0x9064, + GL_UNSIGNED_INT_IMAGE_2D_RECT = 0x9065, + GL_UNSIGNED_INT_IMAGE_CUBE = 0x9066, + GL_UNSIGNED_INT_IMAGE_BUFFER = 0x9067, + GL_UNSIGNED_INT_IMAGE_1D_ARRAY = 0x9068, + GL_UNSIGNED_INT_IMAGE_2D_ARRAY = 0x9069, + GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY = 0x906A, + GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE = 0x906B, + GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY = 0x906C; + + /** + * Accepted by the <value> parameter of GetTexParameteriv, GetTexParameterfv, + * GetTexParameterIiv, and GetTexParameterIuiv: + */ + int GL_IMAGE_FORMAT_COMPATIBILITY_TYPE = 0x90C7; + + /** + * Returned in the <data> parameter of GetTexParameteriv, GetTexParameterfv, + * GetTexParameterIiv, and GetTexParameterIuiv when <value> is + * IMAGE_FORMAT_COMPATIBILITY_TYPE: + */ + int GL_IMAGE_FORMAT_COMPATIBILITY_BY_SIZE = 0x90C8, + IMAGE_FORMAT_COMPATIBILITY_BY_CLASS = 0x90C9; + + @Reuse("GL42") + void glBindImageTexture(@GLuint int unit, @GLuint int texture, int level, + boolean layered, int layer, @GLenum int access, + @GLenum int format); + + @Reuse("GL42") + void glMemoryBarrier(@GLbitfield int barriers); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_shader_image_size.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_shader_image_size.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_shader_image_size.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_shader_image_size.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2002-2012 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +public interface ARB_shader_image_size { +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_shader_objects.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_shader_objects.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_shader_objects.java 2011-03-26 18:15:37.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_shader_objects.java 2016-04-09 16:26:56.000000000 +0000 @@ -61,11 +61,9 @@ int GL_SHADER_OBJECT_ARB = 0x8B48; /** Returned by the <type> parameter of GetActiveUniformARB: */ - int GL_FLOAT = 0x1406; int GL_FLOAT_VEC2_ARB = 0x8B50; int GL_FLOAT_VEC3_ARB = 0x8B51; int GL_FLOAT_VEC4_ARB = 0x8B52; - int GL_INT = 0x1404; int GL_INT_VEC2_ARB = 0x8B53; int GL_INT_VEC3_ARB = 0x8B54; int GL_INT_VEC4_ARB = 0x8B55; @@ -110,7 +108,7 @@ @Alternate(value = "glShaderSourceARB", nativeAlt = true) void glShaderSourceARB3(@GLhandleARB int shader, @Constant("strings.length") @GLsizei int count, @Const @PointerArray(value = "count", lengths = "length") CharSequence[] strings, - @Constant("APIUtil.getLengths(strings), 0") @Const IntBuffer length); + @Constant("APIUtil.getLengths(caps, strings)") @Const IntBuffer length); void glCompileShaderARB(@GLhandleARB int shaderObj); @@ -179,7 +177,7 @@ @Alternate("glGetObjectParameterfvARB") @GLreturn("params") - @StripPostfix(value = "params", postfix = "v") + @StripPostfix(value = "params", hasPostfix = false) void glGetObjectParameterfvARB2(@GLhandleARB int obj, @GLenum int pname, @OutParameter FloatBuffer params); @StripPostfix("params") @@ -187,7 +185,7 @@ @Alternate("glGetObjectParameterivARB") @GLreturn("params") - @StripPostfix(value = "params", postfix = "v") + @StripPostfix(value = "params", hasPostfix = false) void glGetObjectParameterivARB2(@GLhandleARB int obj, @GLenum int pname, @OutParameter IntBuffer params); void glGetInfoLogARB(@GLhandleARB int obj, @AutoSize("infoLog") @GLsizei int maxLength, @@ -197,7 +195,7 @@ @Alternate("glGetInfoLogARB") @GLreturn(value = "infoLog", maxLength = "maxLength") void glGetInfoLogARB2(@GLhandleARB int obj, @GLsizei int maxLength, - @OutParameter @GLsizei @Constant("infoLog_length, 0") IntBuffer length, + @OutParameter @GLsizei @Constant("MemoryUtil.getAddress0(infoLog_length)") IntBuffer length, @OutParameter @GLcharARB ByteBuffer infoLog); void glGetAttachedObjectsARB(@GLhandleARB int containerObj, @AutoSize("obj") @GLsizei int maxCount, @@ -225,35 +223,35 @@ @Alternate("glGetActiveUniformARB") @GLreturn(value = "name", maxLength = "maxLength") void glGetActiveUniformARB2(@GLhandleARB int programObj, @GLuint int index, @GLsizei int maxLength, - @OutParameter @GLsizei @Constant("name_length, 0") IntBuffer length, + @OutParameter @GLsizei @Constant("MemoryUtil.getAddress0(name_length)") IntBuffer length, @OutParameter @Check("2") IntBuffer sizeType, - @OutParameter @GLenum @Constant("sizeType, sizeType.position() + 1") IntBuffer type, + @OutParameter @GLenum @Constant("MemoryUtil.getAddress(sizeType, sizeType.position() + 1)") IntBuffer type, @OutParameter @GLcharARB ByteBuffer name); /** Overloads glGetActiveUniformARB. This version returns only the uniform name. */ @Alternate(value = "glGetActiveUniformARB", javaAlt = true) @GLreturn(value = "name", maxLength = "maxLength") void glGetActiveUniformARB(@GLhandleARB int programObj, @GLuint int index, @GLsizei int maxLength, - @OutParameter @GLsizei @Constant("name_length, 0, APIUtil.getBufferInt(), 0, APIUtil.getBufferInt(), 1") IntBuffer length, + @OutParameter @GLsizei @Constant("MemoryUtil.getAddress0(name_length), MemoryUtil.getAddress0(APIUtil.getBufferInt(caps)), MemoryUtil.getAddress(APIUtil.getBufferInt(caps), 1)") IntBuffer length, @OutParameter @GLcharARB ByteBuffer name); /** Overloads glGetActiveUniformARB. This version returns only the uniform size. */ @Alternate(value = "glGetActiveUniformARB", javaAlt = true) @GLreturn(value = "size") void glGetActiveUniformSizeARB(@GLhandleARB int programObj, @GLuint int index, @Constant("0") @GLsizei int maxLength, - @OutParameter @GLsizei @Constant("null, 0") IntBuffer length, + @OutParameter @GLsizei @Constant("0L") IntBuffer length, @OutParameter IntBuffer size, - @OutParameter @GLenum @Constant("size, 1") IntBuffer type, // Reuse size buffer and ignore - @OutParameter @GLcharARB @Constant("APIUtil.getBufferByte(0), 0") ByteBuffer name); + @OutParameter @GLenum @Constant("MemoryUtil.getAddress(size, 1)") IntBuffer type, // Reuse size buffer and ignore + @OutParameter @GLcharARB @Constant("APIUtil.getBufferByte0(caps)") ByteBuffer name); /** Overloads glGetActiveUniformARB. This version returns only the uniform type. */ @Alternate(value = "glGetActiveUniformARB", javaAlt = true) @GLreturn(value = "type") void glGetActiveUniformTypeARB(@GLhandleARB int programObj, @GLuint int index, @Constant("0") @GLsizei int maxLength, - @OutParameter @GLsizei @Constant("null, 0") IntBuffer length, - @OutParameter @Constant("type, 1") IntBuffer size, // Reuse type buffer and ignore + @OutParameter @GLsizei @Constant("0L") IntBuffer length, + @OutParameter @Constant("MemoryUtil.getAddress(type, 1)") IntBuffer size, // Reuse type buffer and ignore @OutParameter @GLenum IntBuffer type, - @OutParameter @GLcharARB @Constant("APIUtil.getBufferByte(0), 0") ByteBuffer name); + @OutParameter @GLcharARB @Constant("APIUtil.getBufferByte0(caps)") ByteBuffer name); @StripPostfix("params") void glGetUniformfvARB(@GLhandleARB int programObj, int location, @OutParameter @Check FloatBuffer params); @@ -268,7 +266,7 @@ @Alternate("glGetShaderSourceARB") @GLreturn(value = "source", maxLength = "maxLength") void glGetShaderSourceARB2(@GLhandleARB int obj, @GLsizei int maxLength, - @OutParameter @GLsizei @Constant("source_length, 0") IntBuffer length, + @OutParameter @GLsizei @Constant("MemoryUtil.getAddress0(source_length)") IntBuffer length, @OutParameter @GLcharARB ByteBuffer source); } diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_shader_storage_buffer_object.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_shader_storage_buffer_object.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_shader_storage_buffer_object.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_shader_storage_buffer_object.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2002-2012 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +import org.lwjgl.util.generator.Reuse; +import org.lwjgl.util.generator.opengl.GLuint; + +public interface ARB_shader_storage_buffer_object { + + /** + * Accepted by the <target> parameters of BindBuffer, BufferData, + * BufferSubData, MapBuffer, UnmapBuffer, GetBufferSubData, and + * GetBufferPointerv: + */ + int GL_SHADER_STORAGE_BUFFER = 0x90D2; + + /** + * Accepted by the <pname> parameter of GetIntegerv, GetIntegeri_v, + * GetBooleanv, GetInteger64v, GetFloatv, GetDoublev, GetBooleani_v, + * GetIntegeri_v, GetFloati_v, GetDoublei_v, and GetInteger64i_v: + */ + int GL_SHADER_STORAGE_BUFFER_BINDING = 0x90D3; + + /** + * Accepted by the <pname> parameter of GetIntegeri_v, GetBooleani_v, + * GetIntegeri_v, GetFloati_v, GetDoublei_v, and GetInteger64i_v: + */ + int GL_SHADER_STORAGE_BUFFER_START = 0x90D4, + GL_SHADER_STORAGE_BUFFER_SIZE = 0x90D5; + + /** + * Accepted by the <pname> parameter of GetIntegerv, GetBooleanv, + * GetInteger64v, GetFloatv, and GetDoublev: + */ + int GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS = 0x90D6, + GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS = 0x90D7, + GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS = 0x90D8, + GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS = 0x90D9, + GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS = 0x90DA, + GL_MAX_COMPUTE_SHADER_STORAGE_BLOCKS = 0x90DB, + GL_MAX_COMBINED_SHADER_STORAGE_BLOCKS = 0x90DC, + GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS = 0x90DD, + GL_MAX_SHADER_STORAGE_BLOCK_SIZE = 0x90DE, + GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT = 0x90DF; + + /** Accepted in the <barriers> bitfield in glMemoryBarrier: */ + int GL_SHADER_STORAGE_BARRIER_BIT = 0x2000; + + /** + * Alias for the existing token + * MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS: + */ + int GL_MAX_COMBINED_SHADER_OUTPUT_RESOURCES = 0x8F39; + + @Reuse("GL43") + void glShaderStorageBlockBinding(@GLuint int program, @GLuint int storageBlockIndex, + @GLuint int storageBlockBinding); +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_shader_subroutine.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_shader_subroutine.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_shader_subroutine.java 2011-03-26 18:15:37.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_shader_subroutine.java 2016-04-09 16:26:56.000000000 +0000 @@ -58,16 +58,22 @@ /** Accepted by the <pname> parameter of GetActiveSubroutineUniformiv: */ int GL_NUM_COMPATIBLE_SUBROUTINES = 0x8E4A; int GL_COMPATIBLE_SUBROUTINES = 0x8E4B; - int GL_UNIFORM_SIZE = GL31.GL_UNIFORM_SIZE; - int GL_UNIFORM_NAME_LENGTH = GL31.GL_UNIFORM_NAME_LENGTH; @Reuse("GL40") int glGetSubroutineUniformLocation(@GLuint int program, @GLenum int shadertype, @Const @NullTerminated ByteBuffer name); + @Alternate("glGetSubroutineUniformLocation") + @Reuse("GL40") + int glGetSubroutineUniformLocation(@GLuint int program, @GLenum int shadertype, @NullTerminated CharSequence name); + @Reuse("GL40") @GLuint int glGetSubroutineIndex(@GLuint int program, @GLenum int shadertype, @Const @NullTerminated ByteBuffer name); + @Alternate("glGetSubroutineIndex") + @Reuse("GL40") + int glGetSubroutineIndex(@GLuint int program, @GLenum int shadertype, @NullTerminated CharSequence name); + @Reuse("GL40") @StripPostfix("values") void glGetActiveSubroutineUniformiv(@GLuint int program, @GLenum int shadertype, @GLuint int index, @GLenum int pname, @@ -76,7 +82,7 @@ @Reuse("GL40") @Alternate("glGetActiveSubroutineUniformiv") @GLreturn("values") - @StripPostfix("values") + @StripPostfix(value = "values", hasPostfix = false) void glGetActiveSubroutineUniformiv2(@GLuint int program, @GLenum int shadertype, @GLuint int index, @GLenum int pname, @OutParameter IntBuffer values); @@ -89,7 +95,7 @@ @Alternate("glGetActiveSubroutineUniformName") @GLreturn(value = "name", maxLength = "bufsize") void glGetActiveSubroutineUniformName2(@GLuint int program, @GLenum int shadertype, @GLuint int index, @GLsizei int bufsize, - @OutParameter @Constant("name_length, 0") @GLsizei IntBuffer length, + @OutParameter @Constant("MemoryUtil.getAddress0(name_length)") @GLsizei IntBuffer length, @OutParameter @GLchar ByteBuffer name); @Reuse("GL40") @@ -101,7 +107,7 @@ @Alternate("glGetActiveSubroutineName") @GLreturn(value = "name", maxLength = "bufsize") void glGetActiveSubroutineName2(@GLuint int program, @GLenum int shadertype, @GLuint int index, @GLsizei int bufsize, - @OutParameter @Constant("name_length, 0") @GLsizei IntBuffer length, + @OutParameter @Constant("MemoryUtil.getAddress0(name_length)") @GLsizei IntBuffer length, @OutParameter @GLchar ByteBuffer name); @Reuse("GL40") @@ -115,7 +121,7 @@ @Reuse("GL40") @Alternate("glGetUniformSubroutineuiv") @GLreturn("params") - @StripPostfix("params") + @StripPostfix(value = "params", hasPostfix = false) void glGetUniformSubroutineuiv2(@GLenum int shadertype, int location, @OutParameter @GLuint IntBuffer params); @Reuse("GL40") @@ -125,7 +131,7 @@ @Reuse("GL40") @Alternate("glGetProgramStageiv") @GLreturn("values") - @StripPostfix("values") + @StripPostfix(value = "values", hasPostfix = false) void glGetProgramStageiv2(@GLuint int program, @GLenum int shadertype, @GLenum int pname, @OutParameter IntBuffer values); } \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_shader_texture_image_samples.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_shader_texture_image_samples.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_shader_texture_image_samples.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_shader_texture_image_samples.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2002-2014 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +public interface ARB_shader_texture_image_samples { +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_shading_language_420pack.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_shading_language_420pack.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_shading_language_420pack.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_shading_language_420pack.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +public interface ARB_shading_language_420pack { + +} diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_shading_language_include.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_shading_language_include.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_shading_language_include.java 2011-03-26 18:15:37.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_shading_language_include.java 2016-04-09 16:26:56.000000000 +0000 @@ -63,12 +63,12 @@ void glCompileShaderIncludeARB(@GLuint int shader, @GLsizei int count, @Const @NullTerminated("count") @PointerArray("count") @GLchar ByteBuffer path, - @Constant("null, 0") @Const IntBuffer length); + @Constant("0L") @Const IntBuffer length); @Alternate(value = "glCompileShaderIncludeARB", nativeAlt = true) void glCompileShaderIncludeARB2(@GLuint int shader, @Constant("path.length") @GLsizei int count, @Const @PointerArray(value = "count", lengths = "length") CharSequence[] path, - @Constant("APIUtil.getLengths(path), 0") @Const IntBuffer length); + @Constant("APIUtil.getLengths(caps, path)") @Const IntBuffer length); boolean glIsNamedStringARB(@AutoSize("name") int namelen, @Const @GLchar ByteBuffer name); @@ -90,19 +90,19 @@ @GLreturn(value = "string", maxLength = "bufSize") void glGetNamedStringARB2(@Constant("name.length()") int namelen, CharSequence name, @GLsizei int bufSize, - @OutParameter @Constant("string_length, 0") IntBuffer stringlen, + @OutParameter @Constant("MemoryUtil.getAddress0(string_length)") IntBuffer stringlen, @OutParameter @GLchar ByteBuffer string); @StripPostfix("params") void glGetNamedStringivARB(@AutoSize("name") int namelen, @Const @GLchar ByteBuffer name, @GLenum int pname, @OutParameter @Check("1") IntBuffer params); @Alternate("glGetNamedStringivARB") - @StripPostfix(value = "params", postfix = "v") + @StripPostfix(value = "params", hasPostfix = false) void glGetNamedStringivARB(@Constant("name.length()") int namelen, CharSequence name, @GLenum int pname, @OutParameter @Check("1") IntBuffer params); @Alternate("glGetNamedStringivARB") @GLreturn("params") - @StripPostfix(value = "params", postfix = "v") + @StripPostfix(value = "params", hasPostfix = false) void glGetNamedStringivARB2(@Constant("name.length()") int namelen, CharSequence name, @GLenum int pname, @OutParameter IntBuffer params); } \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_shading_language_packing.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_shading_language_packing.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_shading_language_packing.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_shading_language_packing.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +public interface ARB_shading_language_packing { + +} diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_sparse_buffer.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_sparse_buffer.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_sparse_buffer.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_sparse_buffer.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2002-2014 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +import org.lwjgl.util.generator.opengl.GLenum; +import org.lwjgl.util.generator.opengl.GLintptr; +import org.lwjgl.util.generator.opengl.GLsizeiptr; + +public interface ARB_sparse_buffer { + + /** Accepted as part of the the <flags> parameter to BufferStorage */ + int GL_SPARSE_STORAGE_BIT_ARB = 0x0400; + + /** + * Accepted by the <pname> parameter of GetBooleanv, GetDoublev, GetFloatv, + * GetIntegerv, and GetInteger64v: + */ + int GL_SPARSE_BUFFER_PAGE_SIZE_ARB = 0x82F8; + + void glBufferPageCommitmentARB(@GLenum int target, @GLintptr long offset, @GLsizeiptr long size, boolean commit); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_sparse_texture.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_sparse_texture.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_sparse_texture.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_sparse_texture.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2002-2013 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +import org.lwjgl.util.generator.Dependent; +import org.lwjgl.util.generator.opengl.GLenum; +import org.lwjgl.util.generator.opengl.GLsizei; +import org.lwjgl.util.generator.opengl.GLuint; + +@Dependent +public interface ARB_sparse_texture { + + /** + * Accepted by the <pname> parameter to TexParameter{i f}{v}, + * TexParameterI{u}v, GetTexParameter{if}v and GetTexParameterIi{u}v: + */ + int GL_TEXTURE_SPARSE_ARB = 0x91A6, + GL_VIRTUAL_PAGE_SIZE_INDEX_ARB = 0x91A7; + + /** + * Accepted by the <pname> parameter of GetTexParameter{if}v and + * GetTexParameterIi{u}v: + */ + int GL_NUM_SPARSE_LEVELS_ARB = 0x91AA; + + /** Accepted by the <pname> parameter to GetInternalformativ: */ + int GL_NUM_VIRTUAL_PAGE_SIZES_ARB = 0x91A8, + GL_VIRTUAL_PAGE_SIZE_X_ARB = 0x9195, + GL_VIRTUAL_PAGE_SIZE_Y_ARB = 0x9196, + GL_VIRTUAL_PAGE_SIZE_Z_ARB = 0x9197; + + /** + * Accepted by the <pname> parameter to GetIntegerv, GetFloatv, GetDoublev, + * GetInteger64v, and GetBooleanv: + */ + int GL_MAX_SPARSE_TEXTURE_SIZE_ARB = 0x9198, + GL_MAX_SPARSE_3D_TEXTURE_SIZE_ARB = 0x9199, + GL_MAX_SPARSE_ARRAY_TEXTURE_LAYERS_ARB = 0x919A, + GL_SPARSE_TEXTURE_FULL_ARRAY_CUBE_MIPMAPS_ARB = 0x91A9; + + void glTexPageCommitmentARB(@GLenum int target, + int level, + int xoffset, + int yoffset, + int zoffset, + @GLsizei int width, + @GLsizei int height, + @GLsizei int depth, + boolean commit); + + @Dependent("GL_EXT_direct_state_access") + void glTexturePageCommitmentEXT(@GLuint int texture, + @GLenum int target, + int level, + int xoffset, + int yoffset, + int zoffset, + @GLsizei int width, + @GLsizei int height, + @GLsizei int depth, + boolean commit); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_stencil_texturing.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_stencil_texturing.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_stencil_texturing.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_stencil_texturing.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2002-2012 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +public interface ARB_stencil_texturing { + + /** Accepted by the <pname> parameter of TexParameter* and GetTexParameter*: */ + int GL_DEPTH_STENCIL_TEXTURE_MODE = 0x90EA; + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_sync.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_sync.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_sync.java 2011-03-26 18:15:37.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_sync.java 2016-04-09 16:26:56.000000000 +0000 @@ -97,7 +97,7 @@ @Reuse("GL32") @Alternate("glGetInteger64v") @GLreturn("params") - @StripPostfix("params") + @StripPostfix(value = "params", hasPostfix = false) void glGetInteger64v2(@GLenum int pname, @OutParameter @GLint64 LongBuffer params); @Reuse("GL32") @@ -106,11 +106,21 @@ @OutParameter @GLsizei @Check(value = "1", canBeNull = true) IntBuffer length, @OutParameter IntBuffer values); - @Reuse("GL32") + /** @deprecated Will be removed in 3.0. Use {@link #glGetSynci} instead. */ @Alternate("glGetSynciv") @GLreturn("values") @StripPostfix("values") + @Reuse(value = "GL32", method = "glGetSynci") + @Deprecated void glGetSynciv2(@PointerWrapper("GLsync") GLSync sync, @GLenum int pname, @Constant("1") @GLsizei int bufSize, - @OutParameter @GLsizei @Constant("null, 0") IntBuffer length, + @OutParameter @GLsizei @Constant("0L") IntBuffer length, + @OutParameter IntBuffer values); + + @Reuse("GL32") + @Alternate("glGetSynciv") + @GLreturn("values") + @StripPostfix(value = "values", hasPostfix = false) + void glGetSynciv3(@PointerWrapper("GLsync") GLSync sync, @GLenum int pname, @Constant("1") @GLsizei int bufSize, + @OutParameter @GLsizei @Constant("0L") IntBuffer length, @OutParameter IntBuffer values); } \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_tessellation_shader.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_tessellation_shader.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_tessellation_shader.java 2011-03-26 18:15:37.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_tessellation_shader.java 2016-04-09 16:26:56.000000000 +0000 @@ -66,23 +66,12 @@ int GL_TESS_GEN_POINT_MODE = 0x8E79; /** Returned by GetProgramiv when <pname> is TESS_GEN_MODE: */ - int GL_TRIANGLES = GL11.GL_TRIANGLES; - int GL_QUADS = GL11.GL_QUADS; int GL_ISOLINES = 0x8E7A; /** Returned by GetProgramiv when <pname> is TESS_GEN_SPACING: */ - int GL_EQUAL = GL11.GL_EQUAL; int GL_FRACTIONAL_ODD = 0x8E7B; int GL_FRACTIONAL_EVEN = 0x8E7C; - /** Returned by GetProgramiv when <pname> is TESS_GEN_VERTEX_ORDER: */ - int GL_CCW = GL11.GL_CCW; - int GL_CW = GL11.GL_CW; - - /** Returned by GetProgramiv when <pname> is TESS_GEN_POINT_MODE: */ - int GL_FALSE = GL11.GL_FALSE; - int GL_TRUE = GL11.GL_TRUE; - /** * Accepted by the <pname> parameter of GetBooleanv, GetDoublev, GetFloatv, * GetIntegerv, and GetInteger64v: diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_texture_barrier.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_texture_barrier.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_texture_barrier.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_texture_barrier.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2002-2014 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +import org.lwjgl.util.generator.Reuse; + +public interface ARB_texture_barrier { + + @Reuse("GL45") + void glTextureBarrier(); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_texture_buffer_range.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_texture_buffer_range.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_texture_buffer_range.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_texture_buffer_range.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2002-2012 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +import org.lwjgl.util.generator.Dependent; +import org.lwjgl.util.generator.Reuse; +import org.lwjgl.util.generator.opengl.GLenum; +import org.lwjgl.util.generator.opengl.GLintptr; +import org.lwjgl.util.generator.opengl.GLsizeiptr; +import org.lwjgl.util.generator.opengl.GLuint; + +@Dependent +public interface ARB_texture_buffer_range { + + /** Accepted by the <pname> parameter of GetTexLevelParameter: */ + int GL_TEXTURE_BUFFER_OFFSET = 0x919D, + GL_TEXTURE_BUFFER_SIZE = 0x919E; + + /** + * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, + * and GetDoublev: + */ + int GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT = 0x919F; + + @Reuse("GL43") + void glTexBufferRange(@GLenum int target, + @GLenum int internalformat, + @GLuint int buffer, + @GLintptr long offset, + @GLsizeiptr long size); + + @Dependent("GL_EXT_direct_state_access") + void glTextureBufferRangeEXT(@GLuint int texture, + @GLenum int target, + @GLenum int internalformat, + @GLuint int buffer, + @GLintptr long offset, + @GLsizeiptr long size); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_texture_compression_rgtc.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_texture_compression_rgtc.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_texture_compression_rgtc.java 2011-03-26 18:15:37.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_texture_compression_rgtc.java 2016-04-09 16:26:56.000000000 +0000 @@ -41,9 +41,9 @@ * CopyTexImage2D, and CompressedTexImage2D and the <format> parameter * of CompressedTexSubImage2D: */ - int GL_COMPRESSED_RED_RGTC1 = 0x8DBB; - int GL_COMPRESSED_SIGNED_RED_RGTC1 = 0x8DBC; - int GL_COMPRESSED_RED_GREEN_RGTC2 = 0x8DBD; - int GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2 = 0x8DBE; + int GL_COMPRESSED_RED_RGTC1 = 0x8DBB, + GL_COMPRESSED_SIGNED_RED_RGTC1 = 0x8DBC, + GL_COMPRESSED_RG_RGTC2 = 0x8DBD, + GL_COMPRESSED_SIGNED_RG_RGTC2 = 0x8DBE; } \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_texture_mirror_clamp_to_edge.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_texture_mirror_clamp_to_edge.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_texture_mirror_clamp_to_edge.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_texture_mirror_clamp_to_edge.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2002-2013 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +public interface ARB_texture_mirror_clamp_to_edge { + + /** + * Accepted by the <param> parameter of TexParameter{if}, SamplerParameter{if} + * and SamplerParameter{if}v, and by the <params> parameter of + * TexParameter{if}v, TexParameterI{i ui}v and SamplerParameterI{i ui}v when + * their <pname> parameter is TEXTURE_WRAP_S, TEXTURE_WRAP_T, or + * TEXTURE_WRAP_R: + */ + int GL_MIRROR_CLAMP_TO_EDGE = 0x8743; + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_texture_query_levels.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_texture_query_levels.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_texture_query_levels.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_texture_query_levels.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2002-2012 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +public interface ARB_texture_query_levels { +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_texture_rg.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_texture_rg.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_texture_rg.java 2011-03-26 18:15:37.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_texture_rg.java 2016-04-09 16:26:56.000000000 +0000 @@ -71,10 +71,4 @@ int GL_RG = 0x8227; int GL_RG_INTEGER = 0x8228; - /** - * Accepted by the <param> parameter of the TexParameter{if}* - * functions when <pname> is DEPTH_TEXTURE_MODE: - */ - int GL_RED = 0x1903; - } \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_texture_stencil8.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_texture_stencil8.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_texture_stencil8.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_texture_stencil8.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2002-2013 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +public interface ARB_texture_stencil8 { + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_texture_storage.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_texture_storage.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_texture_storage.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_texture_storage.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +import org.lwjgl.util.generator.Alias; +import org.lwjgl.util.generator.Dependent; +import org.lwjgl.util.generator.Reuse; +import org.lwjgl.util.generator.opengl.GLenum; +import org.lwjgl.util.generator.opengl.GLsizei; +import org.lwjgl.util.generator.opengl.GLuint; + +@Dependent +@Alias(value = "EXT_texture_storage", postfix = "EXT") +public interface ARB_texture_storage { + + /** Accepted by the <value> parameter of GetTexParameter{if}v: */ + int GL_TEXTURE_IMMUTABLE_FORMAT = 0x912F; + + @Reuse("GL42") + void glTexStorage1D(@GLenum int target, @GLsizei int levels, + @GLenum int internalformat, + @GLsizei int width); + + @Reuse("GL42") + void glTexStorage2D(@GLenum int target, @GLsizei int levels, + @GLenum int internalformat, + @GLsizei int width, @GLsizei int height); + + @Reuse("GL42") + void glTexStorage3D(@GLenum int target, @GLsizei int levels, + @GLenum int internalformat, + @GLsizei int width, @GLsizei int height, @GLsizei int depth); + + @Dependent("GL_EXT_direct_state_access") + void glTextureStorage1DEXT(@GLuint int texture, @GLenum int target, @GLsizei int levels, + @GLenum int internalformat, + @GLsizei int width); + + @Dependent("GL_EXT_direct_state_access") + void glTextureStorage2DEXT(@GLuint int texture, @GLenum int target, @GLsizei int levels, + @GLenum int internalformat, + @GLsizei int width, @GLsizei int height); + + @Dependent("GL_EXT_direct_state_access") + void glTextureStorage3DEXT(@GLuint int texture, @GLenum int target, @GLsizei int levels, + @GLenum int internalformat, + @GLsizei int width, @GLsizei int height, @GLsizei int depth); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_texture_storage_multisample.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_texture_storage_multisample.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_texture_storage_multisample.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_texture_storage_multisample.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2002-2012 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +import org.lwjgl.util.generator.Dependent; +import org.lwjgl.util.generator.Reuse; +import org.lwjgl.util.generator.opengl.GLenum; +import org.lwjgl.util.generator.opengl.GLsizei; +import org.lwjgl.util.generator.opengl.GLuint; + +@Dependent +public interface ARB_texture_storage_multisample { + + @Reuse("GL43") + void glTexStorage2DMultisample(@GLenum int target, + @GLsizei int samples, + @GLenum int internalformat, + @GLsizei int width, + @GLsizei int height, + boolean fixedsamplelocations); + + @Reuse("GL43") + void glTexStorage3DMultisample(@GLenum int target, + @GLsizei int samples, + @GLenum int internalformat, + @GLsizei int width, + @GLsizei int height, + @GLsizei int depth, + boolean fixedsamplelocations); + + @Dependent("GL_EXT_direct_state_access") + void glTextureStorage2DMultisampleEXT(@GLuint int texture, + @GLenum int target, + @GLsizei int samples, + @GLenum int internalformat, + @GLsizei int width, + @GLsizei int height, + boolean fixedsamplelocations); + + @Dependent("GL_EXT_direct_state_access") + void glTextureStorage3DMultisampleEXT(@GLuint int texture, + @GLenum int target, + @GLsizei int samples, + @GLenum int internalformat, + @GLsizei int width, + @GLsizei int height, + @GLsizei int depth, + boolean fixedsamplelocations); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_texture_view.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_texture_view.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_texture_view.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_texture_view.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2002-2012 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +import org.lwjgl.util.generator.Reuse; +import org.lwjgl.util.generator.opengl.GLenum; +import org.lwjgl.util.generator.opengl.GLuint; + +public interface ARB_texture_view { + + /** + * Accepted by the <pname> parameters of GetTexParameterfv and + * GetTexParameteriv: + */ + int GL_TEXTURE_VIEW_MIN_LEVEL = 0x82DB, + GL_TEXTURE_VIEW_NUM_LEVELS = 0x82DC, + GL_TEXTURE_VIEW_MIN_LAYER = 0x82DD, + GL_TEXTURE_VIEW_NUM_LAYERS = 0x82DE, + GL_TEXTURE_IMMUTABLE_LEVELS = 0x82DF; + + @Reuse("GL43") + void glTextureView(@GLuint int texture, @GLenum int target, @GLuint int origtexture, + @GLenum int internalformat, + @GLuint int minlevel, @GLuint int numlevels, + @GLuint int minlayer, @GLuint int numlayers); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_timer_query.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_timer_query.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_timer_query.java 2011-03-26 18:15:37.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_timer_query.java 2016-04-09 16:26:56.000000000 +0000 @@ -63,7 +63,7 @@ @Reuse("GL33") @Alternate("glGetQueryObjecti64v") @GLreturn("params") - @StripPostfix("params") + @StripPostfix(value = "params", hasPostfix = false) void glGetQueryObjecti64v2(@GLuint int id, @GLenum int pname, @OutParameter @GLint64 LongBuffer params); @Reuse("GL33") @@ -73,7 +73,7 @@ @Reuse("GL33") @Alternate("glGetQueryObjectui64v") @GLreturn("params") - @StripPostfix("params") + @StripPostfix(value = "params", hasPostfix = false) void glGetQueryObjectui64v2(@GLuint int id, @GLenum int pname, @OutParameter @GLuint64 LongBuffer params); } \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_transform_feedback2.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_transform_feedback2.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_transform_feedback2.java 2011-03-26 18:15:37.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_transform_feedback2.java 2016-04-09 16:26:56.000000000 +0000 @@ -61,7 +61,7 @@ @Reuse("GL40") @Alternate("glDeleteTransformFeedbacks") - void glDeleteTransformFeedbacks(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getBufferInt().put(0, id), 0", keepParam = true) int id); + void glDeleteTransformFeedbacks(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getInt(caps, id)", keepParam = true) int id); @Reuse("GL40") void glGenTransformFeedbacks(@AutoSize("ids") @GLsizei int n, @OutParameter @GLuint IntBuffer ids); diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_transform_feedback3.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_transform_feedback3.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_transform_feedback3.java 2011-03-26 18:15:37.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_transform_feedback3.java 2016-04-09 16:26:56.000000000 +0000 @@ -65,7 +65,7 @@ @Reuse("GL40") @Alternate("glGetQueryIndexediv") @GLreturn("params") - @StripPostfix("params") + @StripPostfix(value = "params", hasPostfix = false) void glGetQueryIndexediv2(@GLenum int target, @GLuint int index, @GLenum int pname, @OutParameter IntBuffer params); } \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_transform_feedback_instanced.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_transform_feedback_instanced.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_transform_feedback_instanced.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_transform_feedback_instanced.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +import org.lwjgl.util.generator.Reuse; +import org.lwjgl.util.generator.opengl.GLenum; +import org.lwjgl.util.generator.opengl.GLsizei; +import org.lwjgl.util.generator.opengl.GLuint; + +public interface ARB_transform_feedback_instanced { + + @Reuse("GL42") + void glDrawTransformFeedbackInstanced(@GLenum int mode, @GLuint int id, @GLsizei int primcount); + + @Reuse("GL42") + void glDrawTransformFeedbackStreamInstanced(@GLenum int mode, @GLuint int id, @GLuint int stream, @GLsizei int primcount); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_transform_feedback_overflow_query.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_transform_feedback_overflow_query.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_transform_feedback_overflow_query.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_transform_feedback_overflow_query.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2002-2014 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +public interface ARB_transform_feedback_overflow_query { + + /** + * Accepted by the <target> parameter of BeginQuery, EndQuery, + * BeginQueryIndexed, EndQueryIndexed, GetQueryiv, and GetQueryIndexediv: + */ + int GL_TRANSFORM_FEEDBACK_OVERFLOW_ARB = 0x82EC, + GL_TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB = 0x82ED; + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_uniform_buffer_object.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_uniform_buffer_object.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_uniform_buffer_object.java 2011-03-26 18:15:37.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_uniform_buffer_object.java 2016-04-09 16:26:56.000000000 +0000 @@ -118,16 +118,27 @@ @GLenum int pname, @OutParameter @Check("uniformIndices.remaining()") @GLint IntBuffer params); - @Reuse("GL31") + /** @deprecated Will be removed in 3.0. Use {@link #glGetActiveUniformsi} instead. */ @Alternate("glGetActiveUniformsiv") @GLreturn("params") @StripPostfix("params") + @Reuse(value = "GL31", method = "glGetActiveUniformsi") + @Deprecated void glGetActiveUniformsiv(@GLuint int program, @Constant("1") @GLsizei int uniformCount, @Constant(value = "params.put(1, uniformIndex), 1", keepParam = true) int uniformIndex, // Reuse params buffer @GLenum int pname, @OutParameter @GLint IntBuffer params); @Reuse("GL31") + @Alternate("glGetActiveUniformsiv") + @GLreturn("params") + @StripPostfix(value = "params", hasPostfix = false) + void glGetActiveUniformsiv2(@GLuint int program, @Constant("1") @GLsizei int uniformCount, + @Constant(value = "params.put(1, uniformIndex), 1", keepParam = true) int uniformIndex, // Reuse params buffer + @GLenum int pname, + @OutParameter @GLint IntBuffer params); + + @Reuse("GL31") void glGetActiveUniformName(@GLuint int program, @GLuint int uniformIndex, @AutoSize("uniformName") @GLsizei int bufSize, @OutParameter @GLsizei @Check(value = "1", canBeNull = true) IntBuffer length, @OutParameter @GLchar ByteBuffer uniformName); @@ -136,7 +147,7 @@ @Alternate("glGetActiveUniformName") @GLreturn(value = "uniformName", maxLength = "bufSize") void glGetActiveUniformName2(@GLuint int program, @GLuint int uniformIndex, @GLsizei int bufSize, - @OutParameter @GLsizei @Constant("uniformName_length, 0") IntBuffer length, + @OutParameter @GLsizei @Constant("MemoryUtil.getAddress0(uniformName_length)") IntBuffer length, @OutParameter @GLchar ByteBuffer uniformName); @Reuse("GL31") @@ -153,14 +164,23 @@ void glGetActiveUniformBlockiv(@GLuint int program, @GLuint int uniformBlockIndex, @GLenum int pname, @OutParameter @Check(value = "16") @GLint IntBuffer params); - @Reuse("GL31") + /** @deprecated Will be removed in 3.0. Use {@link #glGetActiveUniformBlocki} instead. */ @Alternate("glGetActiveUniformBlockiv") @GLreturn("params") @StripPostfix("params") + @Reuse(value = "GL31", method = "glGetActiveUniformBlocki") + @Deprecated void glGetActiveUniformBlockiv2(@GLuint int program, @GLuint int uniformBlockIndex, @GLenum int pname, @OutParameter @GLint IntBuffer params); @Reuse("GL31") + @Alternate("glGetActiveUniformBlockiv") + @GLreturn("params") + @StripPostfix(value = "params", hasPostfix = false) + void glGetActiveUniformBlockiv3(@GLuint int program, @GLuint int uniformBlockIndex, @GLenum int pname, + @OutParameter @GLint IntBuffer params); + + @Reuse("GL31") void glGetActiveUniformBlockName(@GLuint int program, @GLuint int uniformBlockIndex, @AutoSize("uniformBlockName") @GLsizei int bufSize, @OutParameter @GLsizei @Check(value = "1", canBeNull = true) IntBuffer length, @OutParameter @GLchar ByteBuffer uniformBlockName); @@ -169,7 +189,7 @@ @Alternate("glGetActiveUniformBlockName") @GLreturn(value = "uniformBlockName", maxLength = "bufSize") void glGetActiveUniformBlockName2(@GLuint int program, @GLuint int uniformBlockIndex, @GLsizei int bufSize, - @OutParameter @GLsizei @Constant("uniformBlockName_length, 0") IntBuffer length, + @OutParameter @GLsizei @Constant("MemoryUtil.getAddress0(uniformBlockName_length)") IntBuffer length, @OutParameter @GLchar ByteBuffer uniformBlockName); @Reuse("GL30") diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_vertex_array_object.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_vertex_array_object.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_vertex_array_object.java 2011-03-26 18:15:37.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_vertex_array_object.java 2016-04-09 16:26:56.000000000 +0000 @@ -55,7 +55,7 @@ @Reuse("GL30") @Alternate("glDeleteVertexArrays") - void glDeleteVertexArrays(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getBufferInt().put(0, array), 0", keepParam = true) int array); + void glDeleteVertexArrays(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getInt(caps, array)", keepParam = true) int array); @Reuse("GL30") void glGenVertexArrays(@AutoSize("arrays") @GLsizei int n, @OutParameter @GLuint IntBuffer arrays); diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_vertex_attrib_64bit.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_vertex_attrib_64bit.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_vertex_attrib_64bit.java 2011-03-26 18:15:37.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_vertex_attrib_64bit.java 2016-04-09 16:26:56.000000000 +0000 @@ -93,7 +93,7 @@ @StripPostfix("params") void glGetVertexAttribLdv(@GLuint int index, @GLenum int pname, @OutParameter @Check("4") DoubleBuffer params); - @Dependent("EXT_direct_state_access") + @Dependent("GL_EXT_direct_state_access") void glVertexArrayVertexAttribLOffsetEXT(@GLuint int vaobj, @GLuint int buffer, @GLuint int index, int size, @GLenum int type, @GLsizei int stride, @GLintptr long offset); } \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_vertex_attrib_binding.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_vertex_attrib_binding.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_vertex_attrib_binding.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_vertex_attrib_binding.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2002-2012 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +import org.lwjgl.util.generator.Reuse; +import org.lwjgl.util.generator.opengl.GLenum; +import org.lwjgl.util.generator.opengl.GLintptr; +import org.lwjgl.util.generator.opengl.GLsizei; +import org.lwjgl.util.generator.opengl.GLuint; + +public interface ARB_vertex_attrib_binding { + + /** Accepted by the <pname> parameter of GetVertexAttrib*v: */ + int GL_VERTEX_ATTRIB_BINDING = 0x82D4, + GL_VERTEX_ATTRIB_RELATIVE_OFFSET = 0x82D5; + + /** + * Accepted by the <target> parameter of GetBooleani_v, GetIntegeri_v, + * GetFloati_v, GetDoublei_v, and GetInteger64i_v: + */ + int GL_VERTEX_BINDING_DIVISOR = 0x82D6, + GL_VERTEX_BINDING_OFFSET = 0x82D7, + GL_VERTEX_BINDING_STRIDE = 0x82D8; + + /** Accepted by the <pname> parameter of GetIntegerv, ... */ + int GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET = 0x82D9, + GL_MAX_VERTEX_ATTRIB_BINDINGS = 0x82DA; + + @Reuse("GL43") + void glBindVertexBuffer(@GLuint int bindingindex, @GLuint int buffer, @GLintptr long offset, + @GLsizei int stride); + + @Reuse("GL43") + void glVertexAttribFormat(@GLuint int attribindex, int size, @GLenum int type, + boolean normalized, @GLuint int relativeoffset); + + @Reuse("GL43") + void glVertexAttribIFormat(@GLuint int attribindex, int size, @GLenum int type, + @GLuint int relativeoffset); + + @Reuse("GL43") + void glVertexAttribLFormat(@GLuint int attribindex, int size, @GLenum int type, + @GLuint int relativeoffset); + + @Reuse("GL43") + void glVertexAttribBinding(@GLuint int attribindex, @GLuint int bindingindex); + + @Reuse("GL43") + void glVertexBindingDivisor(@GLuint int bindingindex, @GLuint int divisor); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_vertex_shader.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_vertex_shader.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_vertex_shader.java 2011-03-26 18:15:37.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_vertex_shader.java 2016-04-09 16:26:56.000000000 +0000 @@ -32,7 +32,6 @@ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; -import org.lwjgl.util.generator.Alternate; import org.lwjgl.util.generator.opengl.*; import java.nio.*; @@ -49,13 +48,13 @@ * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, * GetFloatv, and GetDoublev: */ - int GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB = 0x8B4A; - int GL_MAX_VARYING_FLOATS_ARB = 0x8B4B; - int GL_MAX_VERTEX_ATTRIBS_ARB = 0x8869; - int GL_MAX_TEXTURE_IMAGE_UNITS_ARB = 0x8872; - int GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB = 0x8B4C; + int GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB = 0x8B4A; + int GL_MAX_VARYING_FLOATS_ARB = 0x8B4B; + int GL_MAX_VERTEX_ATTRIBS_ARB = 0x8869; + int GL_MAX_TEXTURE_IMAGE_UNITS_ARB = 0x8872; + int GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB = 0x8B4C; int GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB = 0x8B4D; - int GL_MAX_TEXTURE_COORDS_ARB = 0x8871; + int GL_MAX_TEXTURE_COORDS_ARB = 0x8871; /** * Accepted by the <cap> parameter of Disable, Enable, and IsEnabled, and @@ -63,25 +62,24 @@ * GetDoublev: */ int GL_VERTEX_PROGRAM_POINT_SIZE_ARB = 0x8642; - int GL_VERTEX_PROGRAM_TWO_SIDE_ARB = 0x8643; + int GL_VERTEX_PROGRAM_TWO_SIDE_ARB = 0x8643; /** Accepted by the <pname> parameter GetObjectParameter{if}vARB: */ - int GL_OBJECT_ACTIVE_ATTRIBUTES_ARB = 0x8B89; + int GL_OBJECT_ACTIVE_ATTRIBUTES_ARB = 0x8B89; int GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB = 0x8B8A; /** Accepted by the <pname> parameter of GetVertexAttrib{dfi}vARB: */ - int GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB = 0x8622; - int GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB = 0x8623; - int GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB = 0x8624; - int GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB = 0x8625; + int GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB = 0x8622; + int GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB = 0x8623; + int GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB = 0x8624; + int GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB = 0x8625; int GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB = 0x886A; - int GL_CURRENT_VERTEX_ATTRIB_ARB = 0x8626; + int GL_CURRENT_VERTEX_ATTRIB_ARB = 0x8626; /** Accepted by the <pname> parameter of GetVertexAttribPointervARB: */ int GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB = 0x8645; /** Returned by the <type> parameter of GetActiveAttribARB: */ - int GL_FLOAT = 0x1406; int GL_FLOAT_VEC2_ARB = 0x8B50; int GL_FLOAT_VEC3_ARB = 0x8B51; int GL_FLOAT_VEC4_ARB = 0x8B52; @@ -142,6 +140,13 @@ @GLfloat @GLdouble Buffer buffer); + @Alternate("glVertexAttribPointerARB") + void glVertexAttribPointerARB(@GLuint int index, int size, @GLenum int type, boolean normalized, @GLsizei int stride, + @CachedReference(index = "index", name = "glVertexAttribPointer_buffer") + @BufferObject(BufferKind.ArrayVBO) + @Check + @Const ByteBuffer buffer); + void glEnableVertexAttribArrayARB(@GLuint int index); void glDisableVertexAttribArrayARB(@GLuint int index); @@ -161,35 +166,35 @@ @Alternate("glGetActiveAttribARB") @GLreturn(value = "name", maxLength = "maxLength") void glGetActiveAttribARB2(@GLhandleARB int programObj, @GLuint int index, @GLsizei int maxLength, - @OutParameter @GLsizei @Constant("name_length, 0") IntBuffer length, + @OutParameter @GLsizei @Constant("MemoryUtil.getAddress0(name_length)") IntBuffer length, @OutParameter @Check("2") IntBuffer sizeType, - @OutParameter @GLenum @Constant("sizeType, sizeType.position() + 1") IntBuffer type, + @OutParameter @GLenum @Constant("MemoryUtil.getAddress(sizeType, sizeType.position() + 1)") IntBuffer type, @OutParameter @GLcharARB ByteBuffer name); /** Overloads glGetActiveAttribARB. This version returns only the attrib name. */ @Alternate(value = "glGetActiveAttribARB", javaAlt = true) @GLreturn(value = "name", maxLength = "maxLength") void glGetActiveAttribARB(@GLhandleARB int programObj, @GLuint int index, @GLsizei int maxLength, - @OutParameter @GLsizei @Constant("name_length, 0, APIUtil.getBufferInt(), 0, APIUtil.getBufferInt(), 1") IntBuffer length, + @OutParameter @GLsizei @Constant("MemoryUtil.getAddress0(name_length), MemoryUtil.getAddress0(APIUtil.getBufferInt(caps)), MemoryUtil.getAddress(APIUtil.getBufferInt(caps), 1)") IntBuffer length, @OutParameter @GLcharARB ByteBuffer name); /** Overloads glGetActiveAttribARB. This version returns only the attrib size. */ @Alternate(value = "glGetActiveAttribARB", javaAlt = true) @GLreturn(value = "size") void glGetActiveAttribSizeARB(@GLhandleARB int programObj, @GLuint int index, @Constant("0") @GLsizei int maxLength, - @OutParameter @GLsizei @Constant("null, 0") IntBuffer length, + @OutParameter @GLsizei @Constant("0L") IntBuffer length, @OutParameter IntBuffer size, - @OutParameter @GLenum @Constant("size, 1") IntBuffer type, // Reuse size buffer and ignore - @OutParameter @GLcharARB @Constant("APIUtil.getBufferByte(0), 0") ByteBuffer name); + @OutParameter @GLenum @Constant("MemoryUtil.getAddress(size, 1)") IntBuffer type, // Reuse size buffer and ignore + @OutParameter @GLcharARB @Constant("APIUtil.getBufferByte0(caps)") ByteBuffer name); /** Overloads glGetActiveAttribARB. This version returns only the attrib type. */ @Alternate(value = "glGetActiveAttribARB", javaAlt = true) @GLreturn(value = "type") void glGetActiveAttribTypeARB(@GLhandleARB int programObj, @GLuint int index, @Constant("0") @GLsizei int maxLength, - @OutParameter @GLsizei @Constant("null, 0") IntBuffer length, - @OutParameter @Constant("type, 1") IntBuffer size, // Reuse type buffer and ignore + @OutParameter @GLsizei @Constant("0L") IntBuffer length, + @OutParameter @Constant("MemoryUtil.getAddress(type, 1)") IntBuffer size, // Reuse type buffer and ignore @OutParameter @GLenum IntBuffer type, - @OutParameter @GLcharARB @Constant("APIUtil.getBufferByte(0), 0") ByteBuffer name); + @OutParameter @GLcharARB @Constant("APIUtil.getBufferByte0(caps)") ByteBuffer name); int glGetAttribLocationARB(@GLhandleARB int programObj, @NullTerminated @Const @GLcharARB ByteBuffer name); diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_vertex_type_10f_11f_11f_rev.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_vertex_type_10f_11f_11f_rev.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_vertex_type_10f_11f_11f_rev.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_vertex_type_10f_11f_11f_rev.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2002-2013 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +public interface ARB_vertex_type_10f_11f_11f_rev { + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_viewport_array.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_viewport_array.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ARB_viewport_array.java 2011-03-26 18:15:37.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ARB_viewport_array.java 2016-04-09 16:26:56.000000000 +0000 @@ -52,18 +52,6 @@ GL_LAYER_PROVOKING_VERTEX = 0x825E, GL_VIEWPORT_INDEX_PROVOKING_VERTEX = 0x825F; - /** Accepted by the <pname> parameter of GetIntegeri_v: */ - int GL_SCISSOR_BOX = 0x0C10; - - /** Accepted by the <pname> parameter of GetFloati_v: */ - int GL_VIEWPORT = 0x0BA2; - - /** Accepted by the <pname> parameter of GetDoublei_v: */ - int GL_DEPTH_RANGE = 0x0B70; - - /** Accepted by the <pname> parameter of Enablei, Disablei, and IsEnabledi: */ - int GL_SCISSOR_TEST = 0x0C11; - /** * Returned in the <data> parameter from a Get query with a <pname> of * LAYER_PROVOKING_VERTEX or VIEWPORT_INDEX_PROVOKING_VERTEX: diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ATI_draw_buffers.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ATI_draw_buffers.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ATI_draw_buffers.java 2011-03-26 18:15:37.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ATI_draw_buffers.java 2016-04-09 16:26:56.000000000 +0000 @@ -65,5 +65,5 @@ void glDrawBuffersATI(@AutoSize("buffers") @GLsizei int size, @Const @GLenum IntBuffer buffers); @Alternate("glDrawBuffersATI") - void glDrawBuffersATI(@Constant("1") @GLsizei int size, @Constant(value = "APIUtil.getBufferInt().put(0, buffer), 0", keepParam = true) int buffer); + void glDrawBuffersATI(@Constant("1") @GLsizei int size, @Constant(value = "APIUtil.getInt(caps, buffer)", keepParam = true) int buffer); } diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ATI_map_object_buffer.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ATI_map_object_buffer.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ATI_map_object_buffer.java 2011-03-26 18:15:37.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ATI_map_object_buffer.java 2016-04-09 16:26:56.000000000 +0000 @@ -64,7 +64,7 @@ */ @CachedResult @GLvoid - @AutoSize("GLChecks.getBufferObjectSizeATI(caps, buffer)") + @AutoSize("ATIVertexArrayObject.glGetObjectBufferiATI(buffer, ATIVertexArrayObject.GL_OBJECT_BUFFER_SIZE_ATI)") ByteBuffer glMapObjectBufferATI(@GLuint int buffer); void glUnmapObjectBufferATI(@GLuint int buffer); diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ATI_vertex_array_object.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ATI_vertex_array_object.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/ATI_vertex_array_object.java 2011-03-26 18:15:37.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/ATI_vertex_array_object.java 2016-04-09 16:26:56.000000000 +0000 @@ -75,7 +75,7 @@ @Alternate("glGetObjectBufferivATI") @GLreturn("params") - @StripPostfix("params") + @StripPostfix(value = "params", hasPostfix = false) void glGetObjectBufferivATI2(@GLuint int buffer, @GLenum int pname, @OutParameter IntBuffer params); void glFreeObjectBufferATI(@GLuint int buffer); diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/EXT_cg_shader.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/EXT_cg_shader.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/EXT_cg_shader.java 2011-03-26 18:15:37.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/EXT_cg_shader.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2002-2008 LWJGL Project - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of 'LWJGL' nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package org.lwjgl.opengl; - -public interface EXT_Cg_shader { - - /** - * You can pass GL_CG_VERTEX_SHADER_EXT to glCreateShaderARB instead of GL_VERTEX_SHADER_ARB to create a vertex shader object - * that will parse and compile its shader source with the Cg compiler front-end rather than the GLSL front-end. Likewise, you - * can pass GL_CG_FRAGMENT_SHADER_EXT to glCreateShaderARB instead of GL_FRAGMENT_SHADER_ARB to create a fragment shader object - * that will parse and compile its shader source with the Cg front-end rather than the GLSL front-end. - */ - int GL_CG_VERTEX_SHADER_EXT = 0x890E; - int GL_CG_FRAGMENT_SHADER_EXT = 0x890F; -} diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/EXT_Cg_shader.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/EXT_Cg_shader.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/EXT_Cg_shader.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/EXT_Cg_shader.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +public interface EXT_Cg_shader { + + /** + * You can pass GL_CG_VERTEX_SHADER_EXT to glCreateShaderARB instead of GL_VERTEX_SHADER_ARB to create a vertex shader object + * that will parse and compile its shader source with the Cg compiler front-end rather than the GLSL front-end. Likewise, you + * can pass GL_CG_FRAGMENT_SHADER_EXT to glCreateShaderARB instead of GL_FRAGMENT_SHADER_ARB to create a fragment shader object + * that will parse and compile its shader source with the Cg front-end rather than the GLSL front-end. + */ + int GL_CG_VERTEX_SHADER_EXT = 0x890E; + int GL_CG_FRAGMENT_SHADER_EXT = 0x890F; +} diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/EXT_direct_state_access.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/EXT_direct_state_access.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/EXT_direct_state_access.java 2011-03-26 18:15:37.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/EXT_direct_state_access.java 2016-04-09 16:26:56.000000000 +0000 @@ -198,7 +198,7 @@ @Alternate("glGetTextureParameterfvEXT") @GLreturn("params") - @StripPostfix(value = "params", postfix = "v") + @StripPostfix(value = "params", hasPostfix = false) void glGetTextureParameterfvEXT2(@GLuint int texture, @GLenum int target, @GLenum int pname, @OutParameter FloatBuffer params); @StripPostfix("params") @@ -206,7 +206,7 @@ @Alternate("glGetTextureParameterivEXT") @GLreturn("params") - @StripPostfix(value = "params", postfix = "v") + @StripPostfix(value = "params", hasPostfix = false) void glGetTextureParameterivEXT2(@GLuint int texture, @GLenum int target, @GLenum int pname, @OutParameter IntBuffer params); @StripPostfix("params") @@ -214,7 +214,7 @@ @Alternate("glGetTextureLevelParameterfvEXT") @GLreturn("params") - @StripPostfix(value = "params", postfix = "v") + @StripPostfix(value = "params", hasPostfix = false) void glGetTextureLevelParameterfvEXT2(@GLuint int texture, @GLenum int target, int level, @GLenum int pname, @OutParameter FloatBuffer params); @StripPostfix("params") @@ -222,7 +222,7 @@ @Alternate("glGetTextureLevelParameterivEXT") @GLreturn("params") - @StripPostfix(value = "params", postfix = "v") + @StripPostfix(value = "params", hasPostfix = false) void glGetTextureLevelParameterivEXT2(@GLuint int texture, @GLenum int target, int level, @GLenum int pname, @OutParameter IntBuffer params); /* @@ -438,7 +438,7 @@ @Alternate("glGetMultiTexParameterfvEXT") @GLreturn("params") - @StripPostfix(value = "params", postfix = "v") + @StripPostfix(value = "params", hasPostfix = false) void glGetMultiTexParameterfvEXT2(@GLenum int texunit, @GLenum int target, @GLenum int pname, @OutParameter FloatBuffer params); @Dependent("OpenGL13") @@ -448,7 +448,7 @@ @Alternate("glGetMultiTexParameterivEXT") @GLreturn("params") @Dependent("OpenGL13") - @StripPostfix(value = "params", postfix = "v") + @StripPostfix(value = "params", hasPostfix = false) void glGetMultiTexParameterivEXT2(@GLenum int texunit, @GLenum int target, @GLenum int pname, @OutParameter IntBuffer params); @Dependent("OpenGL13") @@ -458,7 +458,7 @@ @Alternate("glGetMultiTexLevelParameterfvEXT") @GLreturn("params") @Dependent("OpenGL13") - @StripPostfix(value = "params", postfix = "v") + @StripPostfix(value = "params", hasPostfix = false) void glGetMultiTexLevelParameterfvEXT2(@GLenum int texunit, @GLenum int target, int level, @GLenum int pname, @OutParameter FloatBuffer params); @Dependent("OpenGL13") @@ -468,7 +468,7 @@ @Alternate("glGetMultiTexLevelParameterivEXT") @GLreturn("params") @Dependent("OpenGL13") - @StripPostfix(value = "params", postfix = "v") + @StripPostfix(value = "params", hasPostfix = false) void glGetMultiTexLevelParameterivEXT2(@GLenum int texunit, @GLenum int target, int level, @GLenum int pname, @OutParameter IntBuffer params); @Dependent("OpenGL13") @@ -520,11 +520,11 @@ value parameters */ - @Optional(reason = "AMD does not expose this (last driver checked: 10.9)") + @Optional(reason = "AMD does not expose this (last driver checked: 14.7)") @Dependent("OpenGL30") void glEnableClientStateiEXT(@GLenum int array, @GLuint int index); - @Optional(reason = "AMD does not expose this (last driver checked: 10.9)") + @Optional(reason = "AMD does not expose this (last driver checked: 14.7)") @Dependent("OpenGL30") void glDisableClientStateiEXT(@GLenum int array, @GLuint int index); @@ -566,7 +566,7 @@ and before state value parameters */ - @Optional(reason = "AMD does not expose this (last driver checked: 10.9)") + @Optional(reason = "AMD does not expose this (last driver checked: 14.7)") @Dependent("OpenGL30") @StripPostfix("params") void glGetFloati_vEXT(@GLenum int pname, @GLuint int index, @OutParameter @Check("16") FloatBuffer params); @@ -577,7 +577,7 @@ @StripPostfix("params") void glGetFloati_vEXT2(@GLenum int pname, @GLuint int index, @OutParameter FloatBuffer params); - @Optional(reason = "AMD does not expose this (last driver checked: 10.9)") + @Optional(reason = "AMD does not expose this (last driver checked: 14.7)") @Dependent("OpenGL30") @StripPostfix("params") void glGetDoublei_vEXT(@GLenum int pname, @GLuint int index, @OutParameter @Check("16") DoubleBuffer params); @@ -588,9 +588,9 @@ @StripPostfix("params") void glGetDoublei_vEXT2(@GLenum int pname, @GLuint int index, @OutParameter DoubleBuffer params); - @Optional(reason = "AMD does not expose this (last driver checked: 10.9)") + @Optional(reason = "AMD does not expose this (last driver checked: 14.7)") @Dependent("OpenGL30") - @StripPostfix(value = "params", hasPostfix = false) + @StripPostfix(value = "params", postfix = "i_v") void glGetPointeri_vEXT(@GLenum int pname, @GLuint int index, @Result @GLvoid ByteBuffer params); /* @@ -862,6 +862,7 @@ @Dependent("OpenGL15") @GenerateAutos void glNamedBufferDataEXT(@GLuint int buffer, @AutoSize("data") @GLsizeiptr long size, + @Check @Const @GLbyte @GLshort @@ -905,7 +906,7 @@ @Dependent("OpenGL15") @CachedResult @GLvoid - @AutoSize("GLChecks.getNamedBufferObjectSize(caps, buffer)") + @AutoSize("glGetNamedBufferParameterEXT(buffer, GL15.GL_BUFFER_SIZE)") ByteBuffer glMapNamedBufferEXT(@GLuint int buffer, @GLenum int access); @Dependent("OpenGL15") @@ -923,7 +924,7 @@ @Dependent("OpenGL15") @StripPostfix("params") - @AutoSize("GLChecks.getNamedBufferObjectSize(caps, buffer)") + @AutoSize("glGetNamedBufferParameterEXT(buffer, GL15.GL_BUFFER_SIZE)") void glGetNamedBufferPointervEXT(@GLuint int buffer, @GLenum int pname, @OutParameter @Result @GLvoid ByteBuffer params); @Dependent("OpenGL15") @@ -1075,7 +1076,7 @@ @Alternate("glTextureParameterIivEXT") @Dependent("GL_EXT_texture_integer") @StripPostfix("param") - void glTextureParameterIivEXT(@GLuint int texture, @GLenum int target, @GLenum int pname, @Constant(value = "APIUtil.getBufferInt().put(0, param), 0", keepParam = true) int param); + void glTextureParameterIivEXT(@GLuint int texture, @GLenum int target, @GLenum int pname, @Constant(value = "APIUtil.getInt(caps, param)", keepParam = true) int param); @Dependent("GL_EXT_texture_integer") @StripPostfix("params") @@ -1084,7 +1085,7 @@ @Alternate("glTextureParameterIuivEXT") @Dependent("GL_EXT_texture_integer") @StripPostfix("param") - void glTextureParameterIuivEXT(@GLuint int texture, @GLenum int target, @GLenum int pname, @Constant(value = "APIUtil.getBufferInt().put(0, param), 0", keepParam = true) @GLuint int param); + void glTextureParameterIuivEXT(@GLuint int texture, @GLenum int target, @GLenum int pname, @Constant(value = "APIUtil.getInt(caps, param)", keepParam = true) @GLuint int param); @Dependent("GL_EXT_texture_integer") @StripPostfix("params") @@ -1093,7 +1094,7 @@ @Alternate("glGetTextureParameterIivEXT") @GLreturn("params") @Dependent("GL_EXT_texture_integer") - @StripPostfix(value = "params", postfix = "v") + @StripPostfix(value = "params", hasPostfix = false) void glGetTextureParameterIivEXT2(@GLuint int texture, @GLenum int target, @GLenum int pname, @OutParameter IntBuffer params); @Dependent("GL_EXT_texture_integer") @@ -1103,7 +1104,7 @@ @Alternate("glGetTextureParameterIuivEXT") @GLreturn("params") @Dependent("GL_EXT_texture_integer") - @StripPostfix(value = "params", postfix = "v") + @StripPostfix(value = "params", hasPostfix = false) void glGetTextureParameterIuivEXT2(@GLuint int texture, @GLenum int target, @GLenum int pname, @OutParameter @GLuint IntBuffer params); /* @@ -1119,7 +1120,7 @@ @Alternate("glMultiTexParameterIivEXT") @Dependent("GL_EXT_texture_integer") @StripPostfix("param") - void glMultiTexParameterIivEXT(@GLenum int texunit, @GLenum int target, @GLenum int pname, @Constant(value = "APIUtil.getBufferInt().put(0, param), 0", keepParam = true) int param); + void glMultiTexParameterIivEXT(@GLenum int texunit, @GLenum int target, @GLenum int pname, @Constant(value = "APIUtil.getInt(caps, param)", keepParam = true) int param); @Dependent("GL_EXT_texture_integer") @StripPostfix("params") @@ -1128,7 +1129,7 @@ @Alternate("glMultiTexParameterIuivEXT") @Dependent("GL_EXT_texture_integer") @StripPostfix("param") - void glMultiTexParameterIuivEXT(@GLenum int texunit, @GLenum int target, @GLenum int pname, @Constant(value = "APIUtil.getBufferInt().put(0, param), 0", keepParam = true) int param); + void glMultiTexParameterIuivEXT(@GLenum int texunit, @GLenum int target, @GLenum int pname, @Constant(value = "APIUtil.getInt(caps, param)", keepParam = true) int param); @Dependent("GL_EXT_texture_integer") @StripPostfix("params") @@ -1137,7 +1138,7 @@ @Alternate("glGetMultiTexParameterIivEXT") @GLreturn("params") @Dependent("GL_EXT_texture_integer") - @StripPostfix(value = "params", postfix = "v") + @StripPostfix(value = "params", hasPostfix = false) void glGetMultiTexParameterIivEXT2(@GLenum int texunit, @GLenum int target, @GLenum int pname, @OutParameter IntBuffer params); @Dependent("GL_EXT_texture_integer") @@ -1147,7 +1148,7 @@ @Alternate("glGetMultiTexParameterIuivEXT") @GLreturn("params") @Dependent("GL_EXT_texture_integer") - @StripPostfix(value = "params", postfix = "v") + @StripPostfix(value = "params", hasPostfix = false) void glGetMultiTexParameterIuivEXT2(@GLenum int texunit, @GLenum int target, @GLenum int pname, @OutParameter @GLuint IntBuffer params); /* @@ -1352,13 +1353,13 @@ framebuffer" */ - @Dependent("GL_EXT_geometry_shader4,NV_geometry_program4") + @Dependent("GL_EXT_geometry_shader4,GL_NV_geometry_program4") void glNamedFramebufferTextureEXT(@GLuint int framebuffer, @GLenum int attachment, @GLuint int texture, int level); - @Dependent("GL_EXT_geometry_shader4,NV_geometry_program4") + @Dependent("GL_EXT_geometry_shader4,GL_NV_geometry_program4") void glNamedFramebufferTextureLayerEXT(@GLuint int framebuffer, @GLenum int attachment, @GLuint int texture, int level, int layer); - @Dependent("GL_EXT_geometry_shader4,NV_geometry_program4") + @Dependent("GL_EXT_geometry_shader4,GL_NV_geometry_program4") void glNamedFramebufferTextureFaceEXT(@GLuint int framebuffer, @GLenum int attachment, @GLuint int texture, int level, @GLenum int face); /* @@ -1480,7 +1481,7 @@ void glGetVertexArrayIntegeri_vEXT2(@GLuint int vaobj, @GLuint int index, @GLenum int pname, @OutParameter IntBuffer param); @Dependent("OpenGL30") - @StripPostfix(value = "param") + @StripPostfix(value = "param", postfix = "i_v") void glGetVertexArrayPointeri_vEXT(@GLuint int vaobj, @GLuint int index, @GLenum int pname, @Result @GLvoid ByteBuffer param); /* diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/EXT_framebuffer_multisample_blit_scaled.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/EXT_framebuffer_multisample_blit_scaled.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/EXT_framebuffer_multisample_blit_scaled.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/EXT_framebuffer_multisample_blit_scaled.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +public interface EXT_framebuffer_multisample_blit_scaled { + + /** Accepted by the <filter> parameter of BlitFramebuffer: */ + int GL_SCALED_RESOLVE_FASTEST_EXT = 0x90BA, + GL_SCALED_RESOLVE_NICEST_EXT = 0x90BB; + +} diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/EXT_framebuffer_object.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/EXT_framebuffer_object.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/EXT_framebuffer_object.java 2011-03-26 18:15:37.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/EXT_framebuffer_object.java 2016-04-09 16:26:56.000000000 +0000 @@ -136,7 +136,7 @@ void glDeleteRenderbuffersEXT(@AutoSize("renderbuffers") int n, @Const @GLuint IntBuffer renderbuffers); @Alternate("glDeleteRenderbuffersEXT") - void glDeleteRenderbuffersEXT(@Constant("1") int n, @Constant(value = "APIUtil.getBufferInt().put(0, renderbuffer), 0", keepParam = true) int renderbuffer); + void glDeleteRenderbuffersEXT(@Constant("1") int n, @Constant(value = "APIUtil.getInt(caps, renderbuffer)", keepParam = true) int renderbuffer); void glGenRenderbuffersEXT(@AutoSize("renderbuffers") int n, @OutParameter @GLuint IntBuffer renderbuffers); @@ -149,11 +149,19 @@ @StripPostfix("params") void glGetRenderbufferParameterivEXT(@GLenum int target, @GLenum int pname, @OutParameter @Check("4") IntBuffer params); + /** @deprecated Will be removed in 3.0. Use {@link #glGetRenderbufferParameteriEXT} instead. */ @Alternate("glGetRenderbufferParameterivEXT") @GLreturn("params") @StripPostfix("params") + @Reuse(value = "EXTFramebufferObject", method = "glGetRenderbufferParameteriEXT") + @Deprecated void glGetRenderbufferParameterivEXT2(@GLenum int target, @GLenum int pname, @OutParameter IntBuffer params); + @Alternate("glGetRenderbufferParameterivEXT") + @GLreturn("params") + @StripPostfix(value = "params", hasPostfix = false) + void glGetRenderbufferParameterivEXT3(@GLenum int target, @GLenum int pname, @OutParameter IntBuffer params); + boolean glIsFramebufferEXT(@GLuint int framebuffer); void glBindFramebufferEXT(@GLenum int target, @GLuint int framebuffer); @@ -161,7 +169,7 @@ void glDeleteFramebuffersEXT(@AutoSize("framebuffers") int n, @Const @GLuint IntBuffer framebuffers); @Alternate("glDeleteFramebuffersEXT") - void glDeleteFramebuffersEXT(@Constant("1") int n, @Constant(value = "APIUtil.getBufferInt().put(0, framebuffer), 0", keepParam = true) int framebuffer); + void glDeleteFramebuffersEXT(@Constant("1") int n, @Constant(value = "APIUtil.getInt(caps, framebuffer)", keepParam = true) int framebuffer); void glGenFramebuffersEXT(@AutoSize("framebuffers") int n, @OutParameter @GLuint IntBuffer framebuffers); @@ -183,10 +191,18 @@ @StripPostfix("params") void glGetFramebufferAttachmentParameterivEXT(@GLenum int target, @GLenum int attachment, @GLenum int pname, @OutParameter @Check("4") IntBuffer params); + /** @deprecated Will be removed in 3.0. Use {@link #glGetFramebufferAttachmentParameteriEXT} instead. */ @Alternate("glGetFramebufferAttachmentParameterivEXT") @GLreturn("params") @StripPostfix("params") + @Reuse(value = "EXTFramebufferObject", method = "glGetFramebufferAttachmentParameteriEXT") + @Deprecated void glGetFramebufferAttachmentParameterivEXT2(@GLenum int target, @GLenum int attachment, @GLenum int pname, @OutParameter IntBuffer params); + @Alternate("glGetFramebufferAttachmentParameterivEXT") + @GLreturn("params") + @StripPostfix(value = "params", hasPostfix = false) + void glGetFramebufferAttachmentParameterivEXT3(@GLenum int target, @GLenum int attachment, @GLenum int pname, @OutParameter IntBuffer params); + void glGenerateMipmapEXT(@GLenum int target); } diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/EXT_gpu_shader4.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/EXT_gpu_shader4.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/EXT_gpu_shader4.java 2011-03-26 18:15:37.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/EXT_gpu_shader4.java 2016-04-09 16:26:56.000000000 +0000 @@ -57,7 +57,6 @@ int GL_SAMPLER_1D_ARRAY_SHADOW_EXT = 0x8DC3; int GL_SAMPLER_2D_ARRAY_SHADOW_EXT = 0x8DC4; int GL_SAMPLER_CUBE_SHADOW_EXT = 0x8DC5; - int GL_UNSIGNED_INT = 0x1405; int GL_UNSIGNED_INT_VEC2_EXT = 0x8DC6; int GL_UNSIGNED_INT_VEC3_EXT = 0x8DC7; int GL_UNSIGNED_INT_VEC4_EXT = 0x8DC8; @@ -158,7 +157,7 @@ void glVertexAttribI4usvEXT(@GLuint int index, @Check("4") @Const @GLushort ShortBuffer v); void glVertexAttribIPointerEXT(@GLuint int index, int size, @GLenum int type, @GLsizei int stride, - @CachedReference + @CachedReference(index = "index", name = "glVertexAttribPointer_buffer") @BufferObject(BufferKind.ArrayVBO) @Check @Const diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/EXT_texture_integer.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/EXT_texture_integer.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/EXT_texture_integer.java 2011-03-26 18:15:37.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/EXT_texture_integer.java 2016-04-09 16:26:56.000000000 +0000 @@ -117,22 +117,22 @@ void glTexParameterIivEXT(@GLenum int target, @GLenum int pname, @Check("4") IntBuffer params); @Alternate("glTexParameterIivEXT") - @StripPostfix(value = "param", postfix = "v") - void glTexParameterIivEXT(@GLenum int target, @GLenum int pname, @Constant(value = "APIUtil.getBufferInt().put(0, param), 0", keepParam = true) int param); + @StripPostfix(value = "param", hasPostfix = false) + void glTexParameterIivEXT(@GLenum int target, @GLenum int pname, @Constant(value = "APIUtil.getInt(caps, param)", keepParam = true) int param); @StripPostfix("params") void glTexParameterIuivEXT(@GLenum int target, @GLenum int pname, @Check("4") @GLuint IntBuffer params); @Alternate("glTexParameterIuivEXT") - @StripPostfix(value = "param", postfix = "v") - void glTexParameterIuivEXT(@GLenum int target, @GLenum int pname, @Constant(value = "APIUtil.getBufferInt().put(0, param), 0", keepParam = true) int param); + @StripPostfix(value = "param", hasPostfix = false) + void glTexParameterIuivEXT(@GLenum int target, @GLenum int pname, @Constant(value = "APIUtil.getInt(caps, param)", keepParam = true) int param); @StripPostfix("params") void glGetTexParameterIivEXT(@GLenum int target, @GLenum int pname, @OutParameter @Check("4") IntBuffer params); @Alternate("glGetTexParameterIivEXT") @GLreturn("params") - @StripPostfix(value = "params", postfix = "v") + @StripPostfix(value = "params", hasPostfix = false) void glGetTexParameterIivEXT2(@GLenum int target, @GLenum int pname, @OutParameter IntBuffer params); @StripPostfix("params") @@ -140,7 +140,7 @@ @Alternate("glGetTexParameterIuivEXT") @GLreturn("params") - @StripPostfix(value = "params", postfix = "v") + @StripPostfix(value = "params", hasPostfix = false) void glGetTexParameterIuivEXT2(@GLenum int target, @GLenum int pname, @OutParameter @GLuint IntBuffer params); } diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/EXT_texture_lod_bias.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/EXT_texture_lod_bias.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/EXT_texture_lod_bias.java 2011-03-26 18:15:37.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/EXT_texture_lod_bias.java 2016-04-09 16:26:56.000000000 +0000 @@ -31,11 +31,28 @@ */ package org.lwjgl.opengl; -import org.lwjgl.util.generator.*; +import org.lwjgl.util.generator.Extension; @Extension(postfix = "EXT", className = "EXTTextureLODBias") public interface EXT_texture_lod_bias { + + /** + * Accepted by the <target> parameters of GetTexEnvfv, GetTexEnviv, + * TexEnvi, TexEnvf, Texenviv, and TexEnvfv: + */ int GL_TEXTURE_FILTER_CONTROL_EXT = 0x8500; + + /** + * When the <target> parameter of GetTexEnvfv, GetTexEnviv, TexEnvi, + * TexEnvf, TexEnviv, and TexEnvfv is TEXTURE_FILTER_CONTROL_EXT, then + * the value of <pname> may be: + */ int GL_TEXTURE_LOD_BIAS_EXT = 0x8501; + + /** + * Accepted by the <pname> parameters of GetBooleanv, GetIntegerv, + * GetFloatv, and GetDoublev: + */ int GL_MAX_TEXTURE_LOD_BIAS_EXT = 0x84FD; -} + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/EXT_transform_feedback.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/EXT_transform_feedback.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/EXT_transform_feedback.java 2011-03-26 18:15:37.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/EXT_transform_feedback.java 2016-04-09 16:26:56.000000000 +0000 @@ -121,7 +121,7 @@ @Alternate("glGetTransformFeedbackVaryingEXT") @GLreturn(value = "name", maxLength = "bufSize") void glGetTransformFeedbackVaryingEXT2(@GLuint int program, @GLuint int index, @GLsizei int bufSize, - @OutParameter @GLsizei @Constant("name_length, 0") IntBuffer length, + @OutParameter @GLsizei @Constant("MemoryUtil.getAddress0(name_length)") IntBuffer length, @OutParameter @GLsizei @Check("1") IntBuffer size, @OutParameter @GLenum @Check("1") IntBuffer type, @OutParameter @GLchar ByteBuffer name); diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/EXT_vertex_attrib_64bit.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/EXT_vertex_attrib_64bit.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/EXT_vertex_attrib_64bit.java 2011-03-26 18:15:37.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/EXT_vertex_attrib_64bit.java 2016-04-09 16:26:56.000000000 +0000 @@ -83,7 +83,7 @@ void glGetVertexAttribLdvEXT(@GLuint int index, @GLenum int pname, @OutParameter @Check("4") DoubleBuffer params); @Reuse("ARBVertexAttrib64bit") - @Dependent("EXT_direct_state_access") + @Dependent("GL_EXT_direct_state_access") void glVertexArrayVertexAttribLOffsetEXT(@GLuint int vaobj, @GLuint int buffer, @GLuint int index, int size, @GLenum int type, @GLsizei int stride, @GLintptr long offset); } \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/GL11.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/GL11.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/GL11.java 2011-03-26 18:15:37.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/GL11.java 2016-04-09 16:26:56.000000000 +0000 @@ -32,7 +32,6 @@ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; -import org.lwjgl.util.generator.Alternate; import org.lwjgl.util.generator.opengl.*; import java.nio.*; @@ -41,8 +40,8 @@ * The core OpenGL1.1 API. * * @author cix_foo - * @version $Revision: 3460 $ - * $Id: GL11.java 3460 2010-11-29 18:25:28Z spasi $ + * @version $Revision$ + * $Id$ */ @DeprecatedGL public interface GL11 { @@ -719,9 +718,9 @@ void glAccum(@GLenum int op, float value); @DeprecatedGL - void glAlphaFunc(@GLenum int func, @GLclampf float ref); + void glAlphaFunc(@GLenum int func, float ref); - void glClearColor(@GLclampf float red, @GLclampf float green, @GLclampf float blue, @GLclampf float alpha); + void glClearColor(float red, float green, float blue, float alpha); @DeprecatedGL void glClearAccum(float red, float green, float blue, float alpha); @@ -743,7 +742,7 @@ @DeprecatedGL void glBitmap(@GLsizei int width, @GLsizei int height, float xorig, float yorig, float xmove, float ymove, @BufferObject(BufferKind.UnpackPBO) - @Check("(((width + 7)/8)*height)") + @Check(value = "(((width + 7)/8)*height)", canBeNull = true) @Const @GLubyte ByteBuffer bitmap); @@ -755,7 +754,7 @@ @GLuint IntBuffer textures, @Const @Check("textures.remaining()") - @GLclampf FloatBuffer priorities); + FloatBuffer priorities); @DeprecatedGL boolean glAreTexturesResident(@AutoSize("textures") @GLsizei int n, @@ -776,7 +775,7 @@ @NoErrorCheck void glArrayElement(int i); - void glClearDepth(@GLclampd double depth); + void glClearDepth(double depth); @DeprecatedGL void glDeleteLists(@GLuint int list, @GLsizei int range); @@ -784,7 +783,7 @@ void glDeleteTextures(@AutoSize("textures") @GLsizei int n, @Const @GLuint IntBuffer textures); @Alternate("glDeleteTextures") - void glDeleteTextures(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getBufferInt().put(0, texture), 0", keepParam = true) int texture); + void glDeleteTextures(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getInt(caps, texture)", keepParam = true) int texture); void glCullFace(@GLenum int mode); @@ -810,6 +809,14 @@ @GLbyte Buffer pointer); @DeprecatedGL + @Alternate("glColorPointer") + void glColorPointer(int size, @GLenum int type, @GLsizei int stride, + @CachedReference + @Check + @BufferObject(BufferKind.ArrayVBO) + @Const ByteBuffer pointer); + + @DeprecatedGL void glColorMaterial(@GLenum int face, @GLenum int mode); void glColorMask(boolean red, boolean green, boolean blue, boolean alpha); @@ -914,11 +921,14 @@ @GLushort @GLuint Buffer indices); + @Alternate("glDrawElements") + void glDrawElements(@GLenum int mode, @GLsizei int count, @GLenum int type, @BufferObject(BufferKind.ElementVBO) @Const @Check("count") ByteBuffer indices); + void glDrawBuffer(@GLenum int mode); void glDrawArrays(@GLenum int mode, int first, @GLsizei int count); - void glDepthRange(@GLclampd double zNear, @GLclampd double zFar); + void glDepthRange(double zNear, double zFar); void glDepthMask(boolean flag); @@ -1062,7 +1072,7 @@ @Alternate("glGetTexParameterfv") @GLreturn("params") - @StripPostfix(value = "params", postfix = "v") + @StripPostfix(value = "params", hasPostfix = false) void glGetTexParameterfv2(@GLenum int target, @GLenum int pname, @OutParameter FloatBuffer params); @StripPostfix("params") @@ -1070,7 +1080,7 @@ @Alternate("glGetTexParameteriv") @GLreturn("params") - @StripPostfix(value = "params", postfix = "v") + @StripPostfix(value = "params", hasPostfix = false) void glGetTexParameteriv2(@GLenum int target, @GLenum int pname, @OutParameter IntBuffer params); @StripPostfix("params") @@ -1078,7 +1088,7 @@ @Alternate("glGetTexLevelParameterfv") @GLreturn("params") - @StripPostfix(value = "params", postfix = "v") + @StripPostfix(value = "params", hasPostfix = false) void glGetTexLevelParameterfv2(@GLenum int target, int level, @GLenum int pname, @OutParameter FloatBuffer params); @StripPostfix("params") @@ -1086,7 +1096,7 @@ @Alternate("glGetTexLevelParameteriv") @GLreturn("params") - @StripPostfix(value = "params", postfix = "v") + @StripPostfix(value = "params", hasPostfix = false) void glGetTexLevelParameteriv2(@GLenum int target, int level, @GLenum int pname, @OutParameter IntBuffer params); void glGetTexImage(@GLenum int target, int level, @GLenum int format, @GLenum int type, @@ -1105,7 +1115,7 @@ @Alternate("glGetTexGeniv") @GLreturn("params") - @StripPostfix(value = "params", postfix = "v") + @StripPostfix(value = "params", hasPostfix = false) @DeprecatedGL void glGetTexGeniv2(@GLenum int coord, @GLenum int pname, @OutParameter IntBuffer params); @@ -1115,7 +1125,7 @@ @Alternate("glGetTexGenfv") @GLreturn("params") - @StripPostfix(value = "params", postfix = "v") + @StripPostfix(value = "params", hasPostfix = false) @DeprecatedGL void glGetTexGenfv2(@GLenum int coord, @GLenum int pname, @OutParameter FloatBuffer params); @@ -1125,7 +1135,7 @@ @Alternate("glGetTexGendv") @GLreturn("params") - @StripPostfix(value = "params", postfix = "v") + @StripPostfix(value = "params", hasPostfix = false) @DeprecatedGL void glGetTexGendv2(@GLenum int coord, @GLenum int pname, @OutParameter DoubleBuffer params); @@ -1134,7 +1144,7 @@ @Alternate("glGetTexEnviv") @GLreturn("params") - @StripPostfix(value = "params", postfix = "v") + @StripPostfix(value = "params", hasPostfix = false) void glGetTexEnviv2(@GLenum int coord, @GLenum int pname, @OutParameter IntBuffer params); @StripPostfix("params") @@ -1142,7 +1152,7 @@ @Alternate("glGetTexEnvfv") @GLreturn("params") - @StripPostfix(value = "params", postfix = "v") + @StripPostfix(value = "params", hasPostfix = false) void glGetTexEnvfv2(@GLenum int coord, @GLenum int pname, @OutParameter FloatBuffer params); @Const @@ -1304,6 +1314,14 @@ @GLfloat @GLdouble Buffer pointer); + @DeprecatedGL + @Alternate("glNormalPointer") + void glNormalPointer(@GLenum int type, @GLsizei int stride, + @CachedReference + @BufferObject(BufferKind.ArrayVBO) + @Check + @Const ByteBuffer pointer); + @NoErrorCheck @DeprecatedGL void glNormal3b(byte nx, byte ny, byte nz); @@ -1351,6 +1369,9 @@ void glRotatef(float angle, float x, float y, float z); @DeprecatedGL + void glRotated(double angle, double x, double y, double z); + + @DeprecatedGL int glRenderMode(@GLenum int mode); @DeprecatedGL @@ -1440,6 +1461,14 @@ @GLfloat @GLdouble Buffer pointer); + @DeprecatedGL + @Alternate("glVertexPointer") + void glVertexPointer(int size, @GLenum int type, @GLsizei int stride, + @CachedReference + @BufferObject(BufferKind.ArrayVBO) + @Check + @Const ByteBuffer pointer); + @NoErrorCheck @DeprecatedGL void glVertex2f(float x, float y); @@ -1574,6 +1603,14 @@ @GLfloat @GLdouble Buffer pointer); + @DeprecatedGL + @Alternate("glTexCoordPointer") + void glTexCoordPointer(int size, @GLenum int type, @GLsizei int stride, + @CachedReference(index = "StateTracker.getReferences(caps).glClientActiveTexture", name = "glTexCoordPointer_buffer") + @BufferObject(BufferKind.ArrayVBO) + @Check + @Const ByteBuffer pointer); + @NoErrorCheck @DeprecatedGL void glTexCoord1f(float s); diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/GL12.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/GL12.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/GL12.java 2011-03-26 18:15:37.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/GL12.java 2016-04-09 16:26:56.000000000 +0000 @@ -41,8 +41,8 @@ * The core OpenGL1.2.1 API, with the imaging subset. * * @author cix_foo - * @version $Revision: 3412 $ - * $Id: GL12.java 3412 2010-09-26 23:43:24Z spasi $ + * @version $Revision$ + * $Id$ */ public interface GL12 { diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/GL13.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/GL13.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/GL13.java 2011-03-26 18:15:37.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/GL13.java 2016-04-09 16:26:56.000000000 +0000 @@ -41,8 +41,8 @@ * The core OpenGL1.3 API. * * @author cix_foo - * @version $Revision: 3460 $ - * $Id: GL13.java 3460 2010-11-29 18:25:28Z spasi $ + * @version $Revision$ + * $Id$ */ @DeprecatedGL public interface GL13 { @@ -161,6 +161,15 @@ @GLvoid Buffer data); + @Alternate("glCompressedTexImage1D") + void glCompressedTexImage1D2(@GLenum int target, int level, @GLenum int internalformat, @GLsizei int width, int border, @GLsizei int imageSize, + @BufferObject(BufferKind.UnpackPBO) + @Check + @Const + @GLvoid + @Constant("0L") + Buffer data); + void glCompressedTexImage2D(@GLenum int target, int level, @GLenum int internalformat, @GLsizei int width, @GLsizei int height, int border, @AutoSize("data") @GLsizei int imageSize, @BufferObject(BufferKind.UnpackPBO) @Check @@ -168,6 +177,15 @@ @GLvoid ByteBuffer data); + @Alternate("glCompressedTexImage2D") + void glCompressedTexImage2D2(@GLenum int target, int level, @GLenum int internalformat, @GLsizei int width, @GLsizei int height, int border, @GLsizei int imageSize, + @BufferObject(BufferKind.UnpackPBO) + @Check + @Const + @GLvoid + @Constant("0L") + ByteBuffer data); + void glCompressedTexImage3D(@GLenum int target, int level, @GLenum int internalformat, @GLsizei int width, @GLsizei int height, @GLsizei int depth, int border, @AutoSize("data") @GLsizei int imageSize, @BufferObject(BufferKind.UnpackPBO) @Check @@ -175,6 +193,15 @@ @GLvoid ByteBuffer data); + @Alternate("glCompressedTexImage3D") + void glCompressedTexImage3D2(@GLenum int target, int level, @GLenum int internalformat, @GLsizei int width, @GLsizei int height, @GLsizei int depth, int border, @GLsizei int imageSize, + @BufferObject(BufferKind.UnpackPBO) + @Check + @Const + @GLvoid + @Constant("0L") + ByteBuffer data); + void glCompressedTexSubImage1D(@GLenum int target, int level, int xoffset, @GLsizei int width, @GLenum int format, @AutoSize("data") @GLsizei int imageSize, @BufferObject(BufferKind.UnpackPBO) @Check @@ -253,6 +280,6 @@ @DeprecatedGL void glMultTransposeMatrixd(@Check("16") @Const DoubleBuffer m); - void glSampleCoverage(@GLclampf float value, boolean invert); + void glSampleCoverage(float value, boolean invert); } diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/GL14.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/GL14.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/GL14.java 2011-03-26 18:15:37.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/GL14.java 2016-04-09 16:26:56.000000000 +0000 @@ -41,8 +41,8 @@ * The core OpenGL1.4 API. * * @author cix_foo - * @version $Revision: 3460 $ - * $Id: GL14.java 3460 2010-11-29 18:25:28Z spasi $ + * @version $Revision$ + * $Id$ */ @DeprecatedGL public interface GL14 { @@ -97,7 +97,7 @@ void glBlendEquation(@GLenum int mode); - void glBlendColor(@GLclampf float red, @GLclampf float green, @GLclampf float blue, @GLclampf float alpha); + void glBlendColor(float red, float green, float blue, float alpha); @DeprecatedGL void glFogCoordf(float coord); diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/GL15.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/GL15.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/GL15.java 2011-03-26 18:15:37.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/GL15.java 2016-04-09 16:26:56.000000000 +0000 @@ -32,7 +32,6 @@ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; -import org.lwjgl.util.generator.Alternate; import org.lwjgl.util.generator.opengl.*; import java.nio.Buffer; @@ -97,7 +96,7 @@ void glDeleteBuffers(@AutoSize("buffers") @GLsizei int n, @Const @GLuint IntBuffer buffers); @Alternate("glDeleteBuffers") - void glDeleteBuffers(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getBufferInt().put(0, buffer), 0", keepParam = true) int buffer); + void glDeleteBuffers(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getInt(caps, buffer)", keepParam = true) int buffer); void glGenBuffers(@AutoSize("buffers") @GLsizei int n, @OutParameter @GLuint IntBuffer buffers); @@ -109,6 +108,7 @@ @GenerateAutos void glBufferData(@GLenum int target, @AutoSize("data") @GLsizeiptr long size, + @Check @Const @GLbyte @GLshort @@ -158,7 +158,7 @@ */ @CachedResult @GLvoid - @AutoSize("GLChecks.getBufferObjectSize(caps, target)") + @AutoSize("glGetBufferParameteri(target, GL_BUFFER_SIZE)") ByteBuffer glMapBuffer(@GLenum int target, @GLenum int access); boolean glUnmapBuffer(@GLenum int target); @@ -166,13 +166,21 @@ @StripPostfix("params") void glGetBufferParameteriv(@GLenum int target, @GLenum int pname, @OutParameter @Check("4") IntBuffer params); + /** @deprecated Will be removed in 3.0. Use {@link #glGetBufferParameteri} instead. */ @Alternate("glGetBufferParameteriv") @GLreturn("params") @StripPostfix("params") + @Reuse(value = "GL15", method = "glGetBufferParameteri") + @Deprecated void glGetBufferParameteriv2(@GLenum int target, @GLenum int pname, @OutParameter IntBuffer params); + @Alternate("glGetBufferParameteriv") + @GLreturn("params") + @StripPostfix(value = "params", hasPostfix = false) + void glGetBufferParameteriv3(@GLenum int target, @GLenum int pname, @OutParameter IntBuffer params); + @StripPostfix("pointer") - @AutoSize("GLChecks.getBufferObjectSize(caps, target)") + @AutoSize("glGetBufferParameteri(target, GL_BUFFER_SIZE)") void glGetBufferPointerv(@GLenum int target, @GLenum int pname, @OutParameter @Result @GLvoid ByteBuffer pointer); // ----------------------------------------------------------------- @@ -205,7 +213,7 @@ void glDeleteQueries(@AutoSize("ids") @GLsizei int n, @GLuint IntBuffer ids); @Alternate("glDeleteQueries") - void glDeleteQueries(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getBufferInt().put(0, id), 0", keepParam = true) int id); + void glDeleteQueries(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getInt(caps, id)", keepParam = true) int id); boolean glIsQuery(@GLuint int id); @@ -216,17 +224,25 @@ @StripPostfix("params") void glGetQueryiv(@GLenum int target, @GLenum int pname, @OutParameter @Check("1") IntBuffer params); + /** @deprecated Will be removed in 3.0. Use {@link #glGetQueryi} instead. */ @Alternate("glGetQueryiv") @GLreturn("params") @StripPostfix("params") + @Reuse(value = "GL15", method = "glGetQueryi") + @Deprecated void glGetQueryiv2(@GLenum int target, @GLenum int pname, @OutParameter IntBuffer params); + @Alternate("glGetQueryiv") + @GLreturn("params") + @StripPostfix(value = "params", hasPostfix = false) + void glGetQueryiv3(@GLenum int target, @GLenum int pname, @OutParameter IntBuffer params); + @StripPostfix("params") void glGetQueryObjectiv(@GLenum int id, @GLenum int pname, @OutParameter @Check("1") @GLint IntBuffer params); @Alternate("glGetQueryObjectiv") @GLreturn("params") - @StripPostfix(value = "params", postfix = "v") + @StripPostfix(value = "params", hasPostfix = false) void glGetQueryObjectiv2(@GLenum int id, @GLenum int pname, @OutParameter @GLint IntBuffer params); @StripPostfix("params") @@ -234,6 +250,6 @@ @Alternate("glGetQueryObjectuiv") @GLreturn("params") - @StripPostfix(value = "params", postfix = "v") + @StripPostfix(value = "params", hasPostfix = false) void glGetQueryObjectuiv2(@GLenum int id, @GLenum int pname, @OutParameter @GLuint IntBuffer params); } diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/GL20.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/GL20.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/GL20.java 2011-03-26 18:15:37.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/GL20.java 2016-04-09 16:26:56.000000000 +0000 @@ -108,7 +108,7 @@ @Alternate(value = "glShaderSource", nativeAlt = true) void glShaderSource3(@GLuint int shader, @Constant("strings.length") @GLsizei int count, @Const @PointerArray(value = "count", lengths = "length") CharSequence[] strings, - @Constant("APIUtil.getLengths(strings), 0") @Const IntBuffer length); + @Constant("APIUtil.getLengths(caps, strings)") @Const IntBuffer length); int glCreateShader(@GLuint int type); @@ -189,19 +189,35 @@ @StripPostfix("params") void glGetShaderiv(@GLuint int shader, @GLenum int pname, @OutParameter @Check IntBuffer params); + /** @deprecated Will be removed in 3.0. Use {@link #glGetShaderi} instead. */ @Alternate("glGetShaderiv") @GLreturn("params") @StripPostfix("params") + @Reuse(value = "GL20", method = "glGetShaderi") + @Deprecated void glGetShaderiv2(@GLuint int shader, @GLenum int pname, @OutParameter IntBuffer params); + @Alternate("glGetShaderiv") + @GLreturn("params") + @StripPostfix(value = "params", hasPostfix = false) + void glGetShaderiv3(@GLuint int shader, @GLenum int pname, @OutParameter IntBuffer params); + @StripPostfix("params") void glGetProgramiv(@GLuint int program, @GLenum int pname, @OutParameter @Check IntBuffer params); + /** @deprecated Will be removed in 3.0. Use {@link #glGetProgrami} instead. */ @Alternate("glGetProgramiv") @GLreturn("params") @StripPostfix("params") + @Reuse(value = "GL20", method = "glGetProgrami") + @Deprecated void glGetProgramiv2(@GLuint int program, @GLenum int pname, @OutParameter IntBuffer params); + @Alternate("glGetProgramiv") + @GLreturn("params") + @StripPostfix(value = "params", hasPostfix = false) + void glGetProgramiv3(@GLuint int program, @GLenum int pname, @OutParameter IntBuffer params); + void glGetShaderInfoLog(@GLuint int shader, @AutoSize("infoLog") @GLsizei int maxLength, @OutParameter @GLsizei @Check(value = "1", canBeNull = true) IntBuffer length, @OutParameter @GLchar ByteBuffer infoLog); @@ -209,7 +225,7 @@ @Alternate("glGetShaderInfoLog") @GLreturn(value = "infoLog", maxLength = "maxLength") void glGetShaderInfoLog2(@GLuint int shader, @GLsizei int maxLength, - @OutParameter @GLsizei @Constant("infoLog_length, 0") IntBuffer length, + @OutParameter @GLsizei @Constant("MemoryUtil.getAddress0(infoLog_length)") IntBuffer length, @OutParameter @GLchar ByteBuffer infoLog); void glGetProgramInfoLog(@GLuint int program, @AutoSize("infoLog") @GLsizei int maxLength, @@ -219,7 +235,7 @@ @Alternate("glGetProgramInfoLog") @GLreturn(value = "infoLog", maxLength = "maxLength") void glGetProgramInfoLog2(@GLuint int program, @GLsizei int maxLength, - @OutParameter @GLsizei @Constant("infoLog_length, 0") IntBuffer length, + @OutParameter @GLsizei @Constant("MemoryUtil.getAddress0(infoLog_length)") IntBuffer length, @OutParameter @GLchar ByteBuffer infoLog); void glGetAttachedShaders(@GLuint int program, @AutoSize("shaders") @GLsizei int maxCount, @@ -248,35 +264,35 @@ @Alternate("glGetActiveUniform") @GLreturn(value = "name", maxLength = "maxLength") void glGetActiveUniform2(@GLuint int program, @GLuint int index, @GLsizei int maxLength, - @OutParameter @GLsizei @Constant("name_length, 0") IntBuffer length, + @OutParameter @GLsizei @Constant("MemoryUtil.getAddress0(name_length)") IntBuffer length, @OutParameter @Check("2") IntBuffer sizeType, - @OutParameter @GLenum @Constant("sizeType, sizeType.position() + 1") IntBuffer type, + @OutParameter @GLenum @Constant("MemoryUtil.getAddress(sizeType, sizeType.position() + 1)") IntBuffer type, @OutParameter @GLchar ByteBuffer name); /** Overloads glGetActiveUniformARB. This version returns only the uniform name. */ @Alternate(value = "glGetActiveUniform", javaAlt = true) @GLreturn(value = "name", maxLength = "maxLength") void glGetActiveUniform(@GLuint int program, @GLuint int index, @GLsizei int maxLength, - @OutParameter @GLsizei @Constant("name_length, 0, APIUtil.getBufferInt(), 0, APIUtil.getBufferInt(), 1") IntBuffer length, + @OutParameter @GLsizei @Constant("MemoryUtil.getAddress0(name_length), MemoryUtil.getAddress0(APIUtil.getBufferInt(caps)), MemoryUtil.getAddress(APIUtil.getBufferInt(caps), 1)") IntBuffer length, @OutParameter @GLchar ByteBuffer name); /** Overloads glGetActiveUniform. This version returns only the uniform size. */ @Alternate(value = "glGetActiveUniform", javaAlt = true) @GLreturn(value = "size") - void glGetActiveUniformSize(@GLuint int program, @GLuint int index, @Constant("0") @GLsizei int maxLength, - @OutParameter @GLsizei @Constant("null, 0") IntBuffer length, + void glGetActiveUniformSize(@GLuint int program, @GLuint int index, @Constant("1") @GLsizei int maxLength, + @OutParameter @GLsizei @Constant("0L") IntBuffer length, @OutParameter IntBuffer size, - @OutParameter @GLenum @Constant("size, 1") IntBuffer type, // Reuse size buffer and ignore - @OutParameter @GLchar @Constant("APIUtil.getBufferByte(0), 0") ByteBuffer name); + @OutParameter @GLenum @Constant("MemoryUtil.getAddress(size, 1)") IntBuffer type, // Reuse size buffer and ignore + @OutParameter @GLchar @Constant("APIUtil.getBufferByte0(caps)") ByteBuffer name); /** Overloads glGetActiveUniform. This version returns only the uniform type. */ @Alternate(value = "glGetActiveUniform", javaAlt = true) @GLreturn(value = "type") void glGetActiveUniformType(@GLuint int program, @GLuint int index, @Constant("0") @GLsizei int maxLength, - @OutParameter @GLsizei @Constant("null, 0") IntBuffer length, - @OutParameter @Constant("type, 1") IntBuffer size, // Reuse type buffer and ignore + @OutParameter @GLsizei @Constant("0L") IntBuffer length, + @OutParameter @Constant("MemoryUtil.getAddress(type, 1)") IntBuffer size, // Reuse type buffer and ignore @OutParameter @GLenum IntBuffer type, - @OutParameter @GLchar @Constant("APIUtil.getBufferByte(0), 0") ByteBuffer name); + @OutParameter @GLchar @Constant("APIUtil.getBufferByte0(caps)") ByteBuffer name); @StripPostfix("params") void glGetUniformfv(@GLuint int program, int location, @OutParameter @Check FloatBuffer params); @@ -291,7 +307,7 @@ @Alternate("glGetShaderSource") @GLreturn(value = "source", maxLength = "maxLength") void glGetShaderSource2(@GLuint int shader, @GLsizei int maxLength, - @OutParameter @GLsizei @Constant("source_length, 0") IntBuffer length, + @OutParameter @GLsizei @Constant("MemoryUtil.getAddress0(source_length)") IntBuffer length, @OutParameter @GLchar ByteBuffer source); // ------------------------------------------------------------------ @@ -351,6 +367,13 @@ @GLfloat @GLdouble Buffer buffer); + @Alternate("glVertexAttribPointer") + void glVertexAttribPointer(@GLuint int index, int size, @GLenum int type, boolean normalized, @GLsizei int stride, + @CachedReference(index = "index", name = "glVertexAttribPointer_buffer") + @BufferObject(BufferKind.ArrayVBO) + @Check + @Const ByteBuffer buffer); + void glEnableVertexAttribArray(@GLuint int index); void glDisableVertexAttribArray(@GLuint int index); @@ -367,6 +390,10 @@ @StripPostfix("pointer") void glGetVertexAttribPointerv(@GLuint int index, @GLenum int pname, @Result @GLvoid ByteBuffer pointer); + @Alternate(value = "glGetVertexAttribPointerv", nativeAlt = true) + @StripPostfix("pointer") + void glGetVertexAttribPointerv2(@GLuint int index, @GLenum int pname, @OutParameter @Check("PointerBuffer.getPointerSize()") @GLvoid ByteBuffer pointer); + // ----------------------------------------------------------------- // ----------------------[ ARB_vertex_shader ]---------------------- // ----------------------------------------------------------------- @@ -423,35 +450,35 @@ @Alternate("glGetActiveAttrib") @GLreturn(value = "name", maxLength = "maxLength") void glGetActiveAttrib2(@GLuint int program, @GLuint int index, @GLsizei int maxLength, - @OutParameter @GLsizei @Constant("name_length, 0") IntBuffer length, + @OutParameter @GLsizei @Constant("MemoryUtil.getAddress0(name_length)") IntBuffer length, @OutParameter @Check("2") IntBuffer sizeType, - @OutParameter @GLenum @Constant("sizeType, sizeType.position() + 1") IntBuffer type, + @OutParameter @GLenum @Constant("MemoryUtil.getAddress(sizeType, sizeType.position() + 1)") IntBuffer type, @OutParameter @GLchar ByteBuffer name); /** Overloads glGetActiveAttrib. This version returns only the attrib name. */ @Alternate(value = "glGetActiveAttrib", javaAlt = true) @GLreturn(value = "name", maxLength = "maxLength") void glGetActiveAttrib(@GLuint int program, @GLuint int index, @GLsizei int maxLength, - @OutParameter @GLsizei @Constant("name_length, 0, APIUtil.getBufferInt(), 0, APIUtil.getBufferInt(), 1") IntBuffer length, + @OutParameter @GLsizei @Constant("MemoryUtil.getAddress0(name_length), MemoryUtil.getAddress0(APIUtil.getBufferInt(caps)), MemoryUtil.getAddress(APIUtil.getBufferInt(caps), 1)") IntBuffer length, @OutParameter @GLchar ByteBuffer name); /** Overloads glGetActiveAttribARB. This version returns only the attrib size. */ @Alternate(value = "glGetActiveAttrib", javaAlt = true) @GLreturn(value = "size") void glGetActiveAttribSize(@GLuint int program, @GLuint int index, @Constant("0") @GLsizei int maxLength, - @OutParameter @GLsizei @Constant("null, 0") IntBuffer length, + @OutParameter @GLsizei @Constant("0L") IntBuffer length, @OutParameter IntBuffer size, - @OutParameter @GLenum @Constant("size, 1") IntBuffer type, // Reuse size buffer and ignore - @OutParameter @GLchar @Constant("APIUtil.getBufferByte(0), 0") ByteBuffer name); + @OutParameter @GLenum @Constant("MemoryUtil.getAddress(size, 1)") IntBuffer type, // Reuse size buffer and ignore + @OutParameter @GLchar @Constant("APIUtil.getBufferByte0(caps)") ByteBuffer name); /** Overloads glGetActiveAttrib. This version returns only the attrib type. */ @Alternate(value = "glGetActiveAttrib", javaAlt = true) @GLreturn(value = "type") void glGetActiveAttribType(@GLuint int program, @GLuint int index, @Constant("0") @GLsizei int maxLength, - @OutParameter @GLsizei @Constant("null, 0") IntBuffer length, - @OutParameter @Constant("type, 1") IntBuffer size, // Reuse type buffer and ignore + @OutParameter @GLsizei @Constant("0L") IntBuffer length, + @OutParameter @Constant("MemoryUtil.getAddress(type, 1)") IntBuffer size, // Reuse type buffer and ignore @OutParameter @GLenum IntBuffer type, - @OutParameter @GLchar @Constant("APIUtil.getBufferByte(0), 0") ByteBuffer name); + @OutParameter @GLchar @Constant("APIUtil.getBufferByte0(caps)") ByteBuffer name); int glGetAttribLocation(@GLuint int program, @NullTerminated @Const @GLchar ByteBuffer name); @@ -509,7 +536,7 @@ void glDrawBuffers(@AutoSize("buffers") @GLsizei int size, @Const @GLenum IntBuffer buffers); @Alternate("glDrawBuffers") - void glDrawBuffers(@Constant("1") @GLsizei int size, @Constant(value = "APIUtil.getBufferInt().put(0, buffer), 0", keepParam = true) int buffer); + void glDrawBuffers(@Constant("1") @GLsizei int size, @Constant(value = "APIUtil.getInt(caps, buffer)", keepParam = true) int buffer); // ---------------------------------------------------------------- // ----------------------[ ARB_point_sprite ]---------------------- diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/GL30.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/GL30.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/GL30.java 2011-03-26 18:15:37.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/GL30.java 2016-04-09 16:26:56.000000000 +0000 @@ -204,7 +204,7 @@ void glVertexAttribI4usv(@GLuint int index, @Check("4") @Const @GLushort ShortBuffer v); void glVertexAttribIPointer(@GLuint int index, int size, @GLenum int type, @GLsizei int stride, - @CachedReference + @CachedReference(index = "index", name = "glVertexAttribPointer_buffer") @BufferObject(BufferKind.ArrayVBO) @Check @Const @@ -319,7 +319,7 @@ void glClampColor(@GLenum int target, @GLenum int clamp); // ---------------------------------------------------------------------- - // ----------------------[ NV_depth_buffer_float ]---------------------- + // ----------------------[ ARB_depth_buffer_float ]---------------------- // ---------------------------------------------------------------------- /** @@ -328,8 +328,8 @@ * and returned in the <data> parameter of GetTexLevelParameter and * GetRenderbufferParameterivEXT: */ - int GL_DEPTH_COMPONENT32F = 0x8DAB; - int GL_DEPTH32F_STENCIL8 = 0x8DAC; + int GL_DEPTH_COMPONENT32F = 0x8CAC; + int GL_DEPTH32F_STENCIL8 = 0x8CAD; /** * Accepted by the <type> parameter of DrawPixels, ReadPixels, TexImage1D, @@ -528,7 +528,7 @@ void glDeleteRenderbuffers(@AutoSize("renderbuffers") int n, @Const @GLuint IntBuffer renderbuffers); @Alternate("glDeleteRenderbuffers") - void glDeleteRenderbuffers(@Constant("1") int n, @Constant(value = "APIUtil.getBufferInt().put(0, renderbuffer), 0", keepParam = true) int renderbuffer); + void glDeleteRenderbuffers(@Constant("1") int n, @Constant(value = "APIUtil.getInt(caps, renderbuffer)", keepParam = true) int renderbuffer); void glGenRenderbuffers(@AutoSize("renderbuffers") int n, @OutParameter @GLuint IntBuffer renderbuffers); @@ -541,11 +541,19 @@ @StripPostfix("params") void glGetRenderbufferParameteriv(@GLenum int target, @GLenum int pname, @OutParameter @Check("4") IntBuffer params); + /** @deprecated Will be removed in 3.0. Use {@link #glGetRenderbufferParameteri} instead. */ @Alternate("glGetRenderbufferParameteriv") @GLreturn("params") @StripPostfix("params") + @Reuse(value = "GL30", method = "glGetRenderbufferParameteri") + @Deprecated void glGetRenderbufferParameteriv2(@GLenum int target, @GLenum int pname, @OutParameter IntBuffer params); + @Alternate("glGetRenderbufferParameteriv") + @GLreturn("params") + @StripPostfix(value = "params", hasPostfix = false) + void glGetRenderbufferParameteriv3(@GLenum int target, @GLenum int pname, @OutParameter IntBuffer params); + boolean glIsFramebuffer(@GLuint int framebuffer); void glBindFramebuffer(@GLenum int target, @GLuint int framebuffer); @@ -553,7 +561,7 @@ void glDeleteFramebuffers(@AutoSize("framebuffers") int n, @Const @GLuint IntBuffer framebuffers); @Alternate("glDeleteFramebuffers") - void glDeleteFramebuffers(@Constant("1") int n, @Constant(value = "APIUtil.getBufferInt().put(0, framebuffer), 0", keepParam = true) int framebuffer); + void glDeleteFramebuffers(@Constant("1") int n, @Constant(value = "APIUtil.getInt(caps, framebuffer)", keepParam = true) int framebuffer); void glGenFramebuffers(@AutoSize("framebuffers") int n, @OutParameter @GLuint IntBuffer framebuffers); @@ -575,11 +583,19 @@ @StripPostfix("params") void glGetFramebufferAttachmentParameteriv(@GLenum int target, @GLenum int attachment, @GLenum int pname, @OutParameter @Check("4") IntBuffer params); + /** @deprecated Will be removed in 3.0. Use {@link #glGetFramebufferAttachmentParameteri} instead. */ @Alternate("glGetFramebufferAttachmentParameteriv") @GLreturn("params") @StripPostfix("params") + @Reuse(value = "GL30", method = "glGetFramebufferAttachmentParameteri") + @Deprecated void glGetFramebufferAttachmentParameteriv2(@GLenum int target, @GLenum int attachment, @GLenum int pname, @OutParameter IntBuffer params); + @Alternate("glGetFramebufferAttachmentParameteriv") + @GLreturn("params") + @StripPostfix(value = "params", hasPostfix = false) + void glGetFramebufferAttachmentParameteriv3(@GLenum int target, @GLenum int attachment, @GLenum int pname, @OutParameter IntBuffer params); + void glGenerateMipmap(@GLenum int target); // -------------------------------------------------------------------------------------------- @@ -711,22 +727,22 @@ void glTexParameterIiv(@GLenum int target, @GLenum int pname, @Check("4") IntBuffer params); @Alternate("glTexParameterIiv") - @StripPostfix(value = "param", postfix = "v") - void glTexParameterIiv(@GLenum int target, @GLenum int pname, @Constant(value = "APIUtil.getBufferInt().put(0, param), 0", keepParam = true) int param); + @StripPostfix(value = "param", hasPostfix = false) + void glTexParameterIiv(@GLenum int target, @GLenum int pname, @Constant(value = "APIUtil.getInt(caps, param)", keepParam = true) int param); @StripPostfix("params") void glTexParameterIuiv(@GLenum int target, @GLenum int pname, @Check("4") @GLuint IntBuffer params); @Alternate("glTexParameterIuiv") - @StripPostfix(value = "param", postfix = "v") - void glTexParameterIuiv(@GLenum int target, @GLenum int pname, @Constant(value = "APIUtil.getBufferInt().put(0, param), 0", keepParam = true) int param); + @StripPostfix(value = "param", hasPostfix = false) + void glTexParameterIuiv(@GLenum int target, @GLenum int pname, @Constant(value = "APIUtil.getInt(caps, param)", keepParam = true) int param); @StripPostfix("params") void glGetTexParameterIiv(@GLenum int target, @GLenum int pname, @OutParameter @Check("4") IntBuffer params); @Alternate("glGetTexParameterIiv") @GLreturn("params") - @StripPostfix(value = "params", postfix = "v") + @StripPostfix(value = "params", hasPostfix = false) void glGetTexParameterIiv2(@GLenum int target, @GLenum int pname, @OutParameter IntBuffer params); @StripPostfix("params") @@ -734,7 +750,7 @@ @Alternate("glGetTexParameterIuiv") @GLreturn("params") - @StripPostfix(value = "params", postfix = "v") + @StripPostfix(value = "params", hasPostfix = false) void glGetTexParameterIuiv2(@GLenum int target, @GLenum int pname, @OutParameter @GLuint IntBuffer params); // ----------------------------------------------------------------- @@ -829,12 +845,12 @@ void glColorMaski(@GLuint int buf, boolean r, boolean g, boolean b, boolean a); - @StripPostfix(value = "data", hasPostfix = false) + @StripPostfix(value = "data") void glGetBooleani_v(@GLenum int value, @GLuint int index, @OutParameter @Check("4") @GLboolean ByteBuffer data); @Alternate("glGetBooleani_v") @GLreturn("data") - @StripPostfix(value = "data", hasPostfix = false) + @StripPostfix(value = "data") void glGetBooleani_v2(@GLenum int value, @GLuint int index, @OutParameter @GLboolean ByteBuffer data); @StripPostfix("data") @@ -860,10 +876,10 @@ * CopyTexImage2D, and CompressedTexImage2D and the <format> parameter * of CompressedTexSubImage2D: */ - int GL_COMPRESSED_RED_RGTC1 = 0x8DBB; - int GL_COMPRESSED_SIGNED_RED_RGTC1 = 0x8DBC; - int GL_COMPRESSED_RED_GREEN_RGTC2 = 0x8DBD; - int GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2 = 0x8DBE; + int GL_COMPRESSED_RED_RGTC1 = 0x8DBB, + GL_COMPRESSED_SIGNED_RED_RGTC1 = 0x8DBC, + GL_COMPRESSED_RG_RGTC2 = 0x8DBD, + GL_COMPRESSED_SIGNED_RG_RGTC2 = 0x8DBE; // -------------------------------------------------------------- // ----------------------[ ARB_texture_rg ]---------------------- @@ -907,12 +923,6 @@ int GL_RG = 0x8227; int GL_RG_INTEGER = 0x8228; - /** - * Accepted by the <param> parameter of the TexParameter{if}* - * functions when <pname> is DEPTH_TEXTURE_MODE: - */ - int GL_RED = 0x1903; - // ---------------------------------------------------------------------- // ----------------------[ EXT_transform_feedback ]---------------------- // ---------------------------------------------------------------------- @@ -996,7 +1006,7 @@ @Alternate("glGetTransformFeedbackVarying") @GLreturn(value = "name", maxLength = "bufSize") void glGetTransformFeedbackVarying2(@GLuint int program, @GLuint int index, @GLsizei int bufSize, - @OutParameter @GLsizei @Constant("name_length, 0") IntBuffer length, + @OutParameter @GLsizei @Constant("MemoryUtil.getAddress0(name_length)") IntBuffer length, @OutParameter @GLsizei @Check("1") IntBuffer size, @OutParameter @GLenum @Check("1") IntBuffer type, @OutParameter @GLchar ByteBuffer name); @@ -1019,7 +1029,7 @@ @Alternate("glDeleteVertexArrays") @Code(" StateTracker.deleteVAO(caps, array);") - void glDeleteVertexArrays(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getBufferInt().put(0, array), 0", keepParam = true) int array); + void glDeleteVertexArrays(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getInt(caps, array)", keepParam = true) int array); void glGenVertexArrays(@AutoSize("arrays") @GLsizei int n, @OutParameter @GLuint IntBuffer arrays); diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/GL31.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/GL31.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/GL31.java 2011-03-26 18:15:37.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/GL31.java 2016-04-09 16:26:56.000000000 +0000 @@ -76,8 +76,11 @@ // ----------------------[ EXT_copy_buffer ]---------------------- // --------------------------------------------------------------- - int GL_COPY_READ_BUFFER = 0x8F36; - int GL_COPY_WRITE_BUFFER = 0x8F37; + int GL_COPY_READ_BUFFER_BINDING = 0x8F36; + int GL_COPY_WRITE_BUFFER_BINDING = 0x8F37; + + int GL_COPY_READ_BUFFER = GL_COPY_READ_BUFFER_BINDING; + int GL_COPY_WRITE_BUFFER = GL_COPY_WRITE_BUFFER_BINDING; void glCopyBufferSubData(@GLenum int readtarget, @GLenum int writetarget, @GLintptr long readoffset, @GLintptr long writeoffset, @GLsizeiptr long size); @@ -248,14 +251,25 @@ @GLenum int pname, @OutParameter @Check("uniformIndices.remaining()") @GLint IntBuffer params); + /** @deprecated Will be removed in 3.0. Use {@link #glGetActiveUniformsi} instead. */ @Alternate("glGetActiveUniformsiv") @GLreturn("params") @StripPostfix("params") + @Reuse(value = "GL31", method = "glGetActiveUniformsi") + @Deprecated void glGetActiveUniformsiv(@GLuint int program, @Constant("1") @GLsizei int uniformCount, - @Constant(value = "params.put(1, uniformIndex), 1", keepParam = true) int uniformIndex, // Reuse params buffer + @Constant(value = "MemoryUtil.getAddress(params.put(1, uniformIndex), 1)", keepParam = true) int uniformIndex, // Reuse params buffer @GLenum int pname, @OutParameter @GLint IntBuffer params); + @Alternate("glGetActiveUniformsiv") + @GLreturn("params") + @StripPostfix(value = "params", hasPostfix = false) + void glGetActiveUniformsiv2(@GLuint int program, @Constant("1") @GLsizei int uniformCount, + @Constant(value = "MemoryUtil.getAddress(params.put(1, uniformIndex), 1)", keepParam = true) int uniformIndex, // Reuse params buffer + @GLenum int pname, + @OutParameter @GLint IntBuffer params); + void glGetActiveUniformName(@GLuint int program, @GLuint int uniformIndex, @AutoSize("uniformName") @GLsizei int bufSize, @OutParameter @GLsizei @Check(value = "1", canBeNull = true) IntBuffer length, @OutParameter @GLchar ByteBuffer uniformName); @@ -263,7 +277,7 @@ @Alternate("glGetActiveUniformName") @GLreturn(value = "uniformName", maxLength = "bufSize") void glGetActiveUniformName2(@GLuint int program, @GLuint int uniformIndex, @GLsizei int bufSize, - @OutParameter @GLsizei @Constant("uniformName_length, 0") IntBuffer length, + @OutParameter @GLsizei @Constant("MemoryUtil.getAddress0(uniformName_length)") IntBuffer length, @OutParameter @GLchar ByteBuffer uniformName); @GLuint @@ -277,12 +291,21 @@ void glGetActiveUniformBlockiv(@GLuint int program, @GLuint int uniformBlockIndex, @GLenum int pname, @OutParameter @Check(value = "16") @GLint IntBuffer params); + /** @deprecated Will be removed in 3.0. Use {@link #glGetActiveUniformBlocki} instead. */ @Alternate("glGetActiveUniformBlockiv") @GLreturn("params") @StripPostfix("params") + @Reuse(value = "GL31", method = "glGetActiveUniformBlocki") + @Deprecated void glGetActiveUniformBlockiv2(@GLuint int program, @GLuint int uniformBlockIndex, @GLenum int pname, @OutParameter @GLint IntBuffer params); + @Alternate("glGetActiveUniformBlockiv") + @GLreturn("params") + @StripPostfix(value = "params", hasPostfix = false) + void glGetActiveUniformBlockiv3(@GLuint int program, @GLuint int uniformBlockIndex, @GLenum int pname, + @OutParameter @GLint IntBuffer params); + void glGetActiveUniformBlockName(@GLuint int program, @GLuint int uniformBlockIndex, @AutoSize("uniformBlockName") @GLsizei int bufSize, @OutParameter @GLsizei @Check(value = "1", canBeNull = true) IntBuffer length, @OutParameter @GLchar ByteBuffer uniformBlockName); @@ -290,7 +313,7 @@ @Alternate("glGetActiveUniformBlockName") @GLreturn(value = "uniformBlockName", maxLength = "bufSize") void glGetActiveUniformBlockName2(@GLuint int program, @GLuint int uniformBlockIndex, @GLsizei int bufSize, - @OutParameter @GLsizei @Constant("uniformBlockName_length, 0") IntBuffer length, + @OutParameter @GLsizei @Constant("MemoryUtil.getAddress0(uniformBlockName_length)") IntBuffer length, @OutParameter @GLchar ByteBuffer uniformBlockName); void glUniformBlockBinding(@GLuint int program, @GLuint int uniformBlockIndex, @GLuint int uniformBlockBinding); diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/GL32.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/GL32.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/GL32.java 2011-03-26 18:15:37.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/GL32.java 2016-04-09 16:26:56.000000000 +0000 @@ -32,8 +32,6 @@ package org.lwjgl.opengl; import org.lwjgl.util.generator.*; -import org.lwjgl.util.generator.PointerWrapper; -import org.lwjgl.util.generator.Alternate; import org.lwjgl.util.generator.opengl.*; import java.nio.Buffer; @@ -47,20 +45,30 @@ // ----------------------[ OpenGL 3.2 ]---------------------- // ---------------------------------------------------------- - int GL_CONTEXT_PROFILE_MASK = 0x9126; - int GL_CONTEXT_CORE_PROFILE_BIT = 0x00000001; + int GL_CONTEXT_PROFILE_MASK = 0x9126; + int GL_CONTEXT_CORE_PROFILE_BIT = 0x00000001; int GL_CONTEXT_COMPATIBILITY_PROFILE_BIT = 0x00000002; - int GL_MAX_VERTEX_OUTPUT_COMPONENTS = 0x9122; - int GL_MAX_GEOMETRY_INPUT_COMPONENTS = 0x9123; + int GL_MAX_VERTEX_OUTPUT_COMPONENTS = 0x9122; + int GL_MAX_GEOMETRY_INPUT_COMPONENTS = 0x9123; int GL_MAX_GEOMETRY_OUTPUT_COMPONENTS = 0x9124; - int GL_MAX_FRAGMENT_INPUT_COMPONENTS = 0x9125; + int GL_MAX_FRAGMENT_INPUT_COMPONENTS = 0x9125; - // --------------------------------------------------------------------- - // ----------------------[ ARB_vertex_array_bgra ]---------------------- - // --------------------------------------------------------------------- + @StripPostfix("params") + void glGetBufferParameteri64v(@GLenum int target, @GLenum int pname, @OutParameter @Check("4") LongBuffer params); - int GL_BGRA = 0x80E1; + /** @deprecated Will be removed in 3.0. Use {@link #glGetBufferParameteri64} instead. */ + @Alternate("glGetBufferParameteri64v") + @GLreturn("params") + @StripPostfix("params") + @Reuse(value = "GL32", method = "glGetBufferParameteri64") + @Deprecated + void glGetBufferParameteri64v2(@GLenum int target, @GLenum int pname, @OutParameter LongBuffer params); + + @Alternate("glGetBufferParameteri64v") + @GLreturn("params") + @StripPostfix(value = "params", hasPostfix = false) + void glGetBufferParameteri64v3(@GLenum int target, @GLenum int pname, @OutParameter LongBuffer params); // ----------------------------------------------------------------------------- // ----------------------[ ARB_draw_elements_base_vertex ]---------------------- @@ -95,13 +103,13 @@ /** Accepted by the <mode> parameter of ProvokingVertex: */ int GL_FIRST_VERTEX_CONVENTION = 0x8E4D; - int GL_LAST_VERTEX_CONVENTION = 0x8E4E; + int GL_LAST_VERTEX_CONVENTION = 0x8E4E; /** * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, * GetFloatv, and GetDoublev: */ - int GL_PROVOKING_VERTEX = 0x8E4F; + int GL_PROVOKING_VERTEX = 0x8E4F; int GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION = 0x8E4C; void glProvokingVertex(@GLenum int mode); @@ -159,23 +167,23 @@ * Accepted by the <pname> parameter of GetBooleanv, GetDoublev, GetIntegerv, * and GetFloatv: */ - int GL_MAX_SAMPLE_MASK_WORDS = 0x8E59; - int GL_MAX_COLOR_TEXTURE_SAMPLES = 0x910E; - int GL_MAX_DEPTH_TEXTURE_SAMPLES = 0x910F; - int GL_MAX_INTEGER_SAMPLES = 0x9110; - int GL_TEXTURE_BINDING_2D_MULTISAMPLE = 0x9104; + int GL_MAX_SAMPLE_MASK_WORDS = 0x8E59; + int GL_MAX_COLOR_TEXTURE_SAMPLES = 0x910E; + int GL_MAX_DEPTH_TEXTURE_SAMPLES = 0x910F; + int GL_MAX_INTEGER_SAMPLES = 0x9110; + int GL_TEXTURE_BINDING_2D_MULTISAMPLE = 0x9104; int GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY = 0x9105; /** Accepted by the <pname> parameter of GetTexLevelParameter */ - int GL_TEXTURE_SAMPLES = 0x9106; + int GL_TEXTURE_SAMPLES = 0x9106; int GL_TEXTURE_FIXED_SAMPLE_LOCATIONS = 0x9107; /** Returned by the <type> parameter of GetActiveUniform: */ - int GL_SAMPLER_2D_MULTISAMPLE = 0x9108; - int GL_INT_SAMPLER_2D_MULTISAMPLE = 0x9109; - int GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE = 0x910A; - int GL_SAMPLER_2D_MULTISAMPLE_ARRAY = 0x910B; - int GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY = 0x910C; + int GL_SAMPLER_2D_MULTISAMPLE = 0x9108; + int GL_INT_SAMPLER_2D_MULTISAMPLE = 0x9109; + int GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE = 0x910A; + int GL_SAMPLER_2D_MULTISAMPLE_ARRAY = 0x910B; + int GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY = 0x910C; int GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY = 0x910D; void glTexImage2DMultisample(@GLenum int target, @GLsizei int samples, int internalformat, @@ -217,19 +225,18 @@ * GetProgramiv: */ int GL_GEOMETRY_VERTICES_OUT = 0x8DDA; - int GL_GEOMETRY_INPUT_TYPE = 0x8DDB; - int GL_GEOMETRY_OUTPUT_TYPE = 0x8DDC; + int GL_GEOMETRY_INPUT_TYPE = 0x8DDB; + int GL_GEOMETRY_OUTPUT_TYPE = 0x8DDC; /** * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, * GetFloatv, and GetDoublev: */ - int GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS = 0x8C29; + int GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS = 0x8C29; //int GL_MAX_GEOMETRY_VARYING_COMPONENTS = 0x8DDD; -- Missing from 3.2 spec //int GL_MAX_VERTEX_VARYING_COMPONENTS = 0x8DDE; -- Missing from 3.2 spec - int GL_MAX_VARYING_COMPONENTS = 0x8B4B; - int GL_MAX_GEOMETRY_UNIFORM_COMPONENTS = 0x8DDF; - int GL_MAX_GEOMETRY_OUTPUT_VERTICES = 0x8DE0; + int GL_MAX_GEOMETRY_UNIFORM_COMPONENTS = 0x8DDF; + int GL_MAX_GEOMETRY_OUTPUT_VERTICES = 0x8DE0; int GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS = 0x8DE1; /** @@ -237,21 +244,19 @@ * MultiDrawArrays, DrawElements, MultiDrawElements, and * DrawRangeElements: */ - int GL_LINES_ADJACENCY = 0xA; - int GL_LINE_STRIP_ADJACENCY = 0xB; - int GL_TRIANGLES_ADJACENCY = 0xC; + int GL_LINES_ADJACENCY = 0xA; + int GL_LINE_STRIP_ADJACENCY = 0xB; + int GL_TRIANGLES_ADJACENCY = 0xC; int GL_TRIANGLE_STRIP_ADJACENCY = 0xD; /** Returned by CheckFramebufferStatusEXT: */ int GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS = 0x8DA8; - int GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT = 0x8DA9; /** * Accepted by the <pname> parameter of GetFramebufferAttachment- * ParameterivEXT: */ - int GL_FRAMEBUFFER_ATTACHMENT_LAYERED = 0x8DA7; - int GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER = 0x8CD4; + int GL_FRAMEBUFFER_ATTACHMENT_LAYERED = 0x8DA7; /** * Accepted by the <cap> parameter of Enable, Disable, and IsEnabled, @@ -270,10 +275,10 @@ int GL_MAX_SERVER_WAIT_TIMEOUT = 0x9111; /** Accepted as the <pname> parameter of GetSynciv: */ - int GL_OBJECT_TYPE = 0x9112; + int GL_OBJECT_TYPE = 0x9112; int GL_SYNC_CONDITION = 0x9113; - int GL_SYNC_STATUS = 0x9114; - int GL_SYNC_FLAGS = 0x9115; + int GL_SYNC_STATUS = 0x9114; + int GL_SYNC_FLAGS = 0x9115; /** Returned in <values> for GetSynciv <pname> OBJECT_TYPE: */ int GL_SYNC_FENCE = 0x9116; @@ -283,7 +288,7 @@ /** Returned in <values> for GetSynciv <pname> SYNC_STATUS: */ int GL_UNSIGNALED = 0x9118; - int GL_SIGNALED = 0x9119; + int GL_SIGNALED = 0x9119; /** Accepted in the <flags> parameter of ClientWaitSync: */ int GL_SYNC_FLUSH_COMMANDS_BIT = 0x00000001; @@ -292,10 +297,10 @@ long GL_TIMEOUT_IGNORED = 0xFFFFFFFFFFFFFFFFl; /** Returned by ClientWaitSync: */ - int GL_ALREADY_SIGNALED = 0x911A; - int GL_TIMEOUT_EXPIRED = 0x911B; + int GL_ALREADY_SIGNALED = 0x911A; + int GL_TIMEOUT_EXPIRED = 0x911B; int GL_CONDITION_SATISFIED = 0x911C; - int GL_WAIT_FAILED = 0x911D; + int GL_WAIT_FAILED = 0x911D; @PointerWrapper("GLsync") GLSync glFenceSync(@GLenum int condition, @GLbitfield int flags); @@ -318,7 +323,6 @@ void glGetInteger64v2(@GLenum int pname, @OutParameter @GLint64 LongBuffer data); @StripPostfix("data") - @Optional(reason = "NV's 3.2 implementation does not expose this (last driver checked: 19?.??)") void glGetInteger64i_v(@GLenum int value, @GLuint int index, @OutParameter @Check("4") @GLint64 LongBuffer data); @Alternate("glGetInteger64i_v") @@ -331,10 +335,20 @@ @OutParameter @GLsizei @Check(value = "1", canBeNull = true) IntBuffer length, @OutParameter IntBuffer values); + /** @deprecated Will be removed in 3.0. Use {@link #glGetSynci} instead. */ @Alternate("glGetSynciv") @GLreturn("values") @StripPostfix("values") + @Reuse(value = "GL32", method = "glGetSynci") + @Deprecated void glGetSynciv2(@PointerWrapper("GLsync") GLSync sync, @GLenum int pname, @Constant("1") @GLsizei int bufSize, - @OutParameter @GLsizei @Constant("null, 0") IntBuffer length, + @OutParameter @GLsizei @Constant("0L") IntBuffer length, + @OutParameter IntBuffer values); + + @Alternate("glGetSynciv") + @GLreturn("values") + @StripPostfix(value = "values", hasPostfix = false) + void glGetSynciv3(@PointerWrapper("GLsync") GLSync sync, @GLenum int pname, @Constant("1") @GLsizei int bufSize, + @OutParameter @GLsizei @Constant("0L") IntBuffer length, @OutParameter IntBuffer values); } \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/GL33.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/GL33.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/GL33.java 2011-03-26 18:15:37.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/GL33.java 2016-04-09 16:26:56.000000000 +0000 @@ -53,7 +53,6 @@ * parameters of BlendFuncSeparate and BlendFuncSeparatei: */ int GL_SRC1_COLOR = 0x88F9; - int GL_SRC1_ALPHA = GL15.GL_SRC1_ALPHA; int GL_ONE_MINUS_SRC1_COLOR = 0x88FA; int GL_ONE_MINUS_SRC1_ALPHA = 0x88FB; @@ -102,7 +101,7 @@ void glDeleteSamplers(@AutoSize("samplers") @GLsizei int count, @Const @GLuint IntBuffer samplers); @Alternate("glDeleteSamplers") - void glDeleteSamplers(@Constant("1") @GLsizei int count, @Constant(value = "APIUtil.getBufferInt().put(0, sampler), 0", keepParam = true) int sampler); + void glDeleteSamplers(@Constant("1") @GLsizei int count, @Constant(value = "APIUtil.getInt(caps, sampler)", keepParam = true) int sampler); boolean glIsSampler(@GLuint int sampler); @@ -129,7 +128,7 @@ @Alternate("glGetSamplerParameteriv") @GLreturn("params") - @StripPostfix(value = "params", postfix = "v") + @StripPostfix(value = "params", hasPostfix = false) void glGetSamplerParameteriv2(@GLuint int sampler, @GLenum int pname, @OutParameter IntBuffer params); @StripPostfix("params") @@ -137,7 +136,7 @@ @Alternate("glGetSamplerParameterfv") @GLreturn("params") - @StripPostfix(value = "params", postfix = "v") + @StripPostfix(value = "params", hasPostfix = false) void glGetSamplerParameterfv2(@GLuint int sampler, @GLenum int pname, @OutParameter FloatBuffer params); @StripPostfix("params") @@ -145,7 +144,7 @@ @Alternate("glGetSamplerParameterIiv") @GLreturn("params") - @StripPostfix(value = "params", postfix = "v") + @StripPostfix(value = "params", hasPostfix = false) void glGetSamplerParameterIiv2(@GLuint int sampler, @GLenum int pname, @OutParameter IntBuffer params); @StripPostfix("params") @@ -153,7 +152,7 @@ @Alternate("glGetSamplerParameterIuiv") @GLreturn("params") - @StripPostfix(value = "params", postfix = "v") + @StripPostfix(value = "params", hasPostfix = false) void glGetSamplerParameterIuiv2(@GLuint int sampler, @GLenum int pname, @OutParameter IntBuffer params); // ------------------------------------------------------------------- @@ -209,19 +208,35 @@ @StripPostfix("params") void glGetQueryObjecti64v(@GLuint int id, @GLenum int pname, @OutParameter @Check("1") @GLint64 LongBuffer params); + /** @deprecated Will be removed in 3.0. Use {@link #glGetQueryObjecti64} instead. */ @Alternate("glGetQueryObjecti64v") @GLreturn("params") @StripPostfix("params") + @Reuse(value = "GL33", method = "glGetQueryObjecti64") + @Deprecated void glGetQueryObjecti64v2(@GLuint int id, @GLenum int pname, @OutParameter @GLint64 LongBuffer params); + @Alternate("glGetQueryObjecti64v") + @GLreturn("params") + @StripPostfix(value = "params", hasPostfix = false) + void glGetQueryObjecti64v3(@GLuint int id, @GLenum int pname, @OutParameter @GLint64 LongBuffer params); + @StripPostfix("params") void glGetQueryObjectui64v(@GLuint int id, @GLenum int pname, @OutParameter @Check("1") @GLuint64 LongBuffer params); + /** @deprecated Will be removed in 3.0. Use {@link #glGetQueryObjectui64} instead. */ @Alternate("glGetQueryObjectui64v") @GLreturn("params") @StripPostfix("params") + @Reuse(value = "GL33", method = "glGetQueryObjectui64") + @Deprecated void glGetQueryObjectui64v2(@GLuint int id, @GLenum int pname, @OutParameter @GLuint64 LongBuffer params); + @Alternate("glGetQueryObjectui64v") + @GLreturn("params") + @StripPostfix(value = "params", hasPostfix = false) + void glGetQueryObjectui64v3(@GLuint int id, @GLenum int pname, @OutParameter @GLuint64 LongBuffer params); + // -------------------------------------------------------------------- // ----------------------[ ARB_instanced_arrays ]---------------------- // -------------------------------------------------------------------- diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/GL40.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/GL40.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/GL40.java 2011-03-26 18:15:37.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/GL40.java 2016-04-09 16:26:56.000000000 +0000 @@ -40,7 +40,7 @@ import java.nio.FloatBuffer; import java.nio.IntBuffer; -import com.sun.mirror.type.PrimitiveType; +import javax.lang.model.type.TypeKind; public interface GL40 { @@ -75,9 +75,15 @@ */ int GL_DRAW_INDIRECT_BUFFER_BINDING = 0x8F43; - void glDrawArraysIndirect(@GLenum int mode, @BufferObject(BufferKind.IndirectBO) @Check("4") @NullTerminated @Const @GLvoid(PrimitiveType.Kind.INT) IntBuffer indirect); + void glDrawArraysIndirect(@GLenum int mode, @BufferObject(BufferKind.IndirectBO) @Check("4 * 4") @Const @GLvoid ByteBuffer indirect); - void glDrawElementsIndirect(@GLenum int mode, @GLenum int type, @BufferObject(BufferKind.IndirectBO) @Check("5") @NullTerminated @Const @GLvoid(PrimitiveType.Kind.INT) IntBuffer indirect); + @Alternate("glDrawArraysIndirect") + void glDrawArraysIndirect(@GLenum int mode, @BufferObject(BufferKind.IndirectBO) @Check("4") @Const @GLvoid(TypeKind.INT) IntBuffer indirect); + + void glDrawElementsIndirect(@GLenum int mode, @GLenum int type, @BufferObject(BufferKind.IndirectBO) @Check("5 * 4") @Const @GLvoid ByteBuffer indirect); + + @Alternate("glDrawElementsIndirect") + void glDrawElementsIndirect(@GLenum int mode, @GLenum int type, @BufferObject(BufferKind.IndirectBO) @Check("5") @Const @GLvoid(TypeKind.INT) IntBuffer indirect); // --------------------------------------------------------------- // ----------------------[ ARB_gpu_shader5 ]---------------------- @@ -184,8 +190,7 @@ */ int GL_MIN_SAMPLE_SHADING_VALUE = 0x8C37; - @Optional(reason = "AMD does not expose this (last driver checked: 10.9)") - void glMinSampleShading(@GLclampf float value); + void glMinSampleShading(float value); // --------------------------------------------------------------------- // ----------------------[ ARB_shader_subroutine ]---------------------- @@ -208,24 +213,38 @@ /** Accepted by the <pname> parameter of GetActiveSubroutineUniformiv: */ int GL_NUM_COMPATIBLE_SUBROUTINES = 0x8E4A; int GL_COMPATIBLE_SUBROUTINES = 0x8E4B; - int GL_UNIFORM_SIZE = GL31.GL_UNIFORM_SIZE; - int GL_UNIFORM_NAME_LENGTH = GL31.GL_UNIFORM_NAME_LENGTH; int glGetSubroutineUniformLocation(@GLuint int program, @GLenum int shadertype, @Const @NullTerminated ByteBuffer name); + @Alternate("glGetSubroutineUniformLocation") + int glGetSubroutineUniformLocation(@GLuint int program, @GLenum int shadertype, @NullTerminated CharSequence name); + @GLuint int glGetSubroutineIndex(@GLuint int program, @GLenum int shadertype, @Const @NullTerminated ByteBuffer name); + @Alternate("glGetSubroutineIndex") + @GLuint + int glGetSubroutineIndex(@GLuint int program, @GLenum int shadertype, @NullTerminated CharSequence name); + @StripPostfix("values") void glGetActiveSubroutineUniformiv(@GLuint int program, @GLenum int shadertype, @GLuint int index, @GLenum int pname, @OutParameter @Check("1") IntBuffer values); + /** @deprecated Will be removed in 3.0. Use {@link #glGetActiveSubroutineUniformi} instead. */ @Alternate("glGetActiveSubroutineUniformiv") @GLreturn("values") @StripPostfix("values") + @Reuse(value = "GL40", method = "glGetActiveSubroutineUniformi") + @Deprecated void glGetActiveSubroutineUniformiv2(@GLuint int program, @GLenum int shadertype, @GLuint int index, @GLenum int pname, @OutParameter IntBuffer values); + @Alternate("glGetActiveSubroutineUniformiv") + @GLreturn("values") + @StripPostfix(value = "values", hasPostfix = false) + void glGetActiveSubroutineUniformiv3(@GLuint int program, @GLenum int shadertype, @GLuint int index, @GLenum int pname, + @OutParameter IntBuffer values); + void glGetActiveSubroutineUniformName(@GLuint int program, @GLenum int shadertype, @GLuint int index, @AutoSize("name") @GLsizei int bufsize, @OutParameter @Check(value = "1", canBeNull = true) @GLsizei IntBuffer length, @OutParameter @GLchar ByteBuffer name); @@ -233,7 +252,7 @@ @Alternate("glGetActiveSubroutineUniformName") @GLreturn(value = "name", maxLength = "bufsize") void glGetActiveSubroutineUniformName2(@GLuint int program, @GLenum int shadertype, @GLuint int index, @GLsizei int bufsize, - @OutParameter @Constant("name_length, 0") @GLsizei IntBuffer length, + @OutParameter @Constant("MemoryUtil.getAddress0(name_length)") @GLsizei IntBuffer length, @OutParameter @GLchar ByteBuffer name); void glGetActiveSubroutineName(@GLuint int program, @GLenum int shadertype, @GLuint int index, @AutoSize("name") @GLsizei int bufsize, @@ -243,7 +262,7 @@ @Alternate("glGetActiveSubroutineName") @GLreturn(value = "name", maxLength = "bufsize") void glGetActiveSubroutineName2(@GLuint int program, @GLenum int shadertype, @GLuint int index, @GLsizei int bufsize, - @OutParameter @Constant("name_length, 0") @GLsizei IntBuffer length, + @OutParameter @Constant("MemoryUtil.getAddress0(name_length)") @GLsizei IntBuffer length, @OutParameter @GLchar ByteBuffer name); @StripPostfix("indices") @@ -252,19 +271,35 @@ @StripPostfix("params") void glGetUniformSubroutineuiv(@GLenum int shadertype, int location, @Check("1") @OutParameter @GLuint IntBuffer params); + /** @deprecated Will be removed in 3.0. Use {@link #glGetUniformSubroutineui} instead. */ @Alternate("glGetUniformSubroutineuiv") @GLreturn("params") @StripPostfix("params") + @Reuse(value = "GL40", method = "glGetUniformSubroutineui") + @Deprecated void glGetUniformSubroutineuiv2(@GLenum int shadertype, int location, @OutParameter @GLuint IntBuffer params); + @Alternate("glGetUniformSubroutineuiv") + @GLreturn("params") + @StripPostfix(value = "params", hasPostfix = false) + void glGetUniformSubroutineuiv3(@GLenum int shadertype, int location, @OutParameter @GLuint IntBuffer params); + @StripPostfix("values") void glGetProgramStageiv(@GLuint int program, @GLenum int shadertype, @GLenum int pname, @Check("1") @OutParameter IntBuffer values); + /** @deprecated Will be removed in 3.0. Use {@link #glGetProgramStagei} instead. */ @Alternate("glGetProgramStageiv") @GLreturn("values") @StripPostfix("values") + @Reuse(value = "GL40", method = "glGetProgramStagei") + @Deprecated void glGetProgramStageiv2(@GLuint int program, @GLenum int shadertype, @GLenum int pname, @OutParameter IntBuffer values); + @Alternate("glGetProgramStageiv") + @GLreturn("values") + @StripPostfix(value = "values", hasPostfix = false) + void glGetProgramStageiv3(@GLuint int program, @GLenum int shadertype, @GLenum int pname, @OutParameter IntBuffer values); + // ----------------------------------------------------------------------- // ----------------------[ ARB_tessellation_shader ]---------------------- // ----------------------------------------------------------------------- @@ -395,8 +430,10 @@ * Accepted by the <pname> parameter of GetBooleanv, GetDoublev, GetIntegerv, * and GetFloatv: */ - int GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED = 0x8E23; - int GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE = 0x8E24; + int GL_TRANSFORM_FEEDBACK_PAUSED = 0x8E23; + int GL_TRANSFORM_FEEDBACK_ACTIVE = 0x8E24; + int GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED = GL_TRANSFORM_FEEDBACK_PAUSED; + int GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE = GL_TRANSFORM_FEEDBACK_ACTIVE; int GL_TRANSFORM_FEEDBACK_BINDING = 0x8E25; void glBindTransformFeedback(@GLenum int target, @GLuint int id); @@ -404,7 +441,7 @@ void glDeleteTransformFeedbacks(@AutoSize("ids") @GLsizei int n, @Const @GLuint IntBuffer ids); @Alternate("glDeleteTransformFeedbacks") - void glDeleteTransformFeedbacks(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getBufferInt().put(0, id), 0", keepParam = true) int id); + void glDeleteTransformFeedbacks(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getInt(caps, id)", keepParam = true) int id); void glGenTransformFeedbacks(@AutoSize("ids") @GLsizei int n, @OutParameter @GLuint IntBuffer ids); @@ -439,9 +476,17 @@ @StripPostfix("params") void glGetQueryIndexediv(@GLenum int target, @GLuint int index, @GLenum int pname, @OutParameter @Check("1") IntBuffer params); + /** @deprecated Will be removed in 3.0. Use {@link #glGetQueryIndexedi} instead. */ @Alternate("glGetQueryIndexediv") @GLreturn("params") @StripPostfix("params") + @Reuse(value = "GL40", method = "glGetQueryIndexedi") + @Deprecated void glGetQueryIndexediv2(@GLenum int target, @GLuint int index, @GLenum int pname, @OutParameter IntBuffer params); + @Alternate("glGetQueryIndexediv") + @GLreturn("params") + @StripPostfix(value = "params", hasPostfix = false) + void glGetQueryIndexediv3(@GLenum int target, @GLuint int index, @GLenum int pname, @OutParameter IntBuffer params); + } \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/GL41.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/GL41.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/GL41.java 2011-03-26 18:15:37.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/GL41.java 2016-04-09 16:26:56.000000000 +0000 @@ -46,12 +46,12 @@ * Accepted by the <value> parameter of GetBooleanv, GetIntegerv, * GetInteger64v, GetFloatv, and GetDoublev: */ - int GL_SHADER_COMPILER = 0x8DFA, - GL_NUM_SHADER_BINARY_FORMATS = 0x8DF9, - GL_MAX_VERTEX_UNIFORM_VECTORS = 0x8DFB, - GL_MAX_VARYING_VECTORS = 0x8DFC, - GL_MAX_FRAGMENT_UNIFORM_VECTORS = 0x8DFD, - GL_IMPLEMENTATION_COLOR_READ_TYPE = 0x8B9A, + int GL_SHADER_COMPILER = 0x8DFA, + GL_NUM_SHADER_BINARY_FORMATS = 0x8DF9, + GL_MAX_VERTEX_UNIFORM_VECTORS = 0x8DFB, + GL_MAX_VARYING_VECTORS = 0x8DFC, + GL_MAX_FRAGMENT_UNIFORM_VECTORS = 0x8DFD, + GL_IMPLEMENTATION_COLOR_READ_TYPE = 0x8B9A, GL_IMPLEMENTATION_COLOR_READ_FORMAT = 0x8B9B; /** Accepted by the <type> parameter of VertexAttribPointer: */ @@ -61,30 +61,28 @@ * Accepted by the <precisiontype> parameter of * GetShaderPrecisionFormat: */ - int GL_LOW_FLOAT = 0x8DF0, + int GL_LOW_FLOAT = 0x8DF0, GL_MEDIUM_FLOAT = 0x8DF1, - GL_HIGH_FLOAT = 0x8DF2, - GL_LOW_INT = 0x8DF3, - GL_MEDIUM_INT = 0x8DF4, - GL_HIGH_INT = 0x8DF5; + GL_HIGH_FLOAT = 0x8DF2, + GL_LOW_INT = 0x8DF3, + GL_MEDIUM_INT = 0x8DF4, + GL_HIGH_INT = 0x8DF5; + + /** Accepted by the <format> parameter of most commands taking sized internal formats: */ + int GL_RGB565 = 0x8D62; - @Optional(reason = "Not exposed in ATI Catalyst 10.10c") void glReleaseShaderCompiler(); - @Optional(reason = "Not exposed in ATI Catalyst 10.10c") void glShaderBinary(@AutoSize("shaders") @GLsizei int count, @Const @GLuint IntBuffer shaders, @GLenum int binaryformat, @Const @GLvoid ByteBuffer binary, @AutoSize("binary") @GLsizei int length); - @Optional(reason = "Not exposed in ATI Catalyst 10.10c") void glGetShaderPrecisionFormat(@GLenum int shadertype, @GLenum int precisiontype, @OutParameter @Check("2") IntBuffer range, @OutParameter @Check("1") IntBuffer precision); - @Optional(reason = "Not exposed in ATI Catalyst 10.10c") - void glDepthRangef(@GLclampf float n, @GLclampf float f); + void glDepthRangef(float n, float f); - @Optional(reason = "Not exposed in ATI Catalyst 10.10c") - void glClearDepthf(@GLclampf float d); + void glClearDepthf(float d); // ---------------------------------------------------------------------- // ----------------------[ ARB_get_program_binary ]---------------------- @@ -104,7 +102,7 @@ * GetInteger64v, GetFloatv and GetDoublev: */ int GL_NUM_PROGRAM_BINARY_FORMATS = 0x87FE, - GL_PROGRAM_BINARY_FORMATS = 0x87FF; + GL_PROGRAM_BINARY_FORMATS = 0x87FF; void glGetProgramBinary(@GLuint int program, @AutoSize("binary") @GLsizei int bufSize, @Check(value = "1", canBeNull = true) @GLsizei IntBuffer length, @@ -120,12 +118,12 @@ // --------------------------------------------------------------------------- /** Accepted by <stages> parameter to UseProgramStages: */ - int GL_VERTEX_SHADER_BIT = 0x00000001, - GL_FRAGMENT_SHADER_BIT = 0x00000002, - GL_GEOMETRY_SHADER_BIT = 0x00000004, - GL_TESS_CONTROL_SHADER_BIT = 0x00000008, + int GL_VERTEX_SHADER_BIT = 0x00000001, + GL_FRAGMENT_SHADER_BIT = 0x00000002, + GL_GEOMETRY_SHADER_BIT = 0x00000004, + GL_TESS_CONTROL_SHADER_BIT = 0x00000008, GL_TESS_EVALUATION_SHADER_BIT = 0x00000010, - GL_ALL_SHADER_BITS = 0xFFFFFFFF; + GL_ALL_SHADER_BITS = 0xFFFFFFFF; /** * Accepted by the <pname> parameter of ProgramParameteri and @@ -146,27 +144,39 @@ void glActiveShaderProgram(@GLuint int pipeline, @GLuint int program); - @StripPostfix(value = "strings", postfix = "v") + /** Single null-terminated source code string. */ + @StripPostfix(value = "string", hasPostfix = false) + @GLuint + int glCreateShaderProgramv(@GLenum int type, @Constant("1") @GLsizei int count, @NullTerminated @Check @Const @Indirect @GLchar ByteBuffer string); + + /** Multiple null-terminated source code strings, one after the other. */ + @Alternate(value = "glCreateShaderProgramv", nativeAlt = true) + @StripPostfix(value = "strings", hasPostfix = false) @GLuint - int glCreateShaderProgramv(@GLenum int type, @GLsizei int count, @Check @Const @Indirect @GLchar ByteBuffer strings); + int glCreateShaderProgramv2(@GLenum int type, @GLsizei int count, @NullTerminated("count") @Check @Const @Indirect @GLchar @PointerArray("count") ByteBuffer strings); + + @Alternate(value = "glCreateShaderProgramv", nativeAlt = true) + @StripPostfix(value = "strings", hasPostfix = false) + @GLuint + int glCreateShaderProgramv3(@GLenum int type, @Constant("strings.length") @GLsizei int count, @NullTerminated @Check("1") @PointerArray(value = "count") @Const @NativeType("GLchar") ByteBuffer[] strings); @Alternate("glCreateShaderProgramv") - @StripPostfix(value = "string", postfix = "v") + @StripPostfix(value = "string", hasPostfix = false) @GLuint int glCreateShaderProgramv(@GLenum int type, @Constant("1") @GLsizei int count, @NullTerminated CharSequence string); - @Alternate("glCreateShaderProgramv") - @StripPostfix(value = "strings", postfix = "v") + @Alternate(value = "glCreateShaderProgramv", nativeAlt = true, skipNative = true) + @StripPostfix(value = "strings", hasPostfix = false) @GLuint - int glCreateShaderProgramv(@GLenum int type, @Constant("strings.length") @GLsizei int count, - @Const @NullTerminated @PointerArray(value = "count") CharSequence[] strings); + int glCreateShaderProgramv2(@GLenum int type, @Constant("strings.length") @GLsizei int count, + @Const @NullTerminated @PointerArray(value = "count") CharSequence[] strings); void glBindProgramPipeline(@GLuint int pipeline); void glDeleteProgramPipelines(@AutoSize("pipelines") @GLsizei int n, @Const @GLuint IntBuffer pipelines); @Alternate("glDeleteProgramPipelines") - void glDeleteProgramPipelines(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getBufferInt().put(0, pipeline), 0", keepParam = true) int pipeline); + void glDeleteProgramPipelines(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getInt(caps, pipeline)", keepParam = true) int pipeline); void glGenProgramPipelines(@AutoSize("pipelines") @GLsizei int n, @OutParameter @GLuint IntBuffer pipelines); @@ -181,7 +191,7 @@ @Alternate("glGetProgramPipelineiv") @GLreturn("params") - @StripPostfix("params") + @StripPostfix(value = "params", hasPostfix = false) void glGetProgramPipelineiv2(@GLuint int pipeline, @GLenum int pname, @OutParameter IntBuffer params); void glProgramUniform1i(@GLuint int program, int location, int v0); @@ -339,62 +349,38 @@ @Alternate("glGetProgramPipelineInfoLog") @GLreturn(value = "infoLog", maxLength = "bufSize") void glGetProgramPipelineInfoLog2(@GLuint int pipeline, @GLsizei int bufSize, - @OutParameter @GLsizei @Constant("infoLog_length, 0") IntBuffer length, + @OutParameter @GLsizei @Constant("MemoryUtil.getAddress0(infoLog_length)") IntBuffer length, @OutParameter @GLchar ByteBuffer infoLog); // ----------------------------------------------------------------------- // ----------------------[ ARB_vertex_attrib_64bit ]---------------------- // ----------------------------------------------------------------------- - /** Returned in the <type> parameter of GetActiveAttrib: */ - int GL_DOUBLE_VEC2 = 0x8FFC; - int GL_DOUBLE_VEC3 = 0x8FFD; - int GL_DOUBLE_VEC4 = 0x8FFE; - int GL_DOUBLE_MAT2 = 0x8F46; - int GL_DOUBLE_MAT3 = 0x8F47; - int GL_DOUBLE_MAT4 = 0x8F48; - int GL_DOUBLE_MAT2x3 = 0x8F49; - int GL_DOUBLE_MAT2x4 = 0x8F4A; - int GL_DOUBLE_MAT3x2 = 0x8F4B; - int GL_DOUBLE_MAT3x4 = 0x8F4C; - int GL_DOUBLE_MAT4x2 = 0x8F4D; - int GL_DOUBLE_MAT4x3 = 0x8F4E; - - @Optional(reason = "Not exposed in ATI Catalyst 10.10c") void glVertexAttribL1d(@GLuint int index, double x); - @Optional(reason = "Not exposed in ATI Catalyst 10.10c") void glVertexAttribL2d(@GLuint int index, double x, double y); - @Optional(reason = "Not exposed in ATI Catalyst 10.10c") void glVertexAttribL3d(@GLuint int index, double x, double y, double z); - @Optional(reason = "Not exposed in ATI Catalyst 10.10c") void glVertexAttribL4d(@GLuint int index, double x, double y, double z, double w); - @Optional(reason = "Not exposed in ATI Catalyst 10.10c") @StripPostfix("v") void glVertexAttribL1dv(@GLuint int index, @Const @Check("1") DoubleBuffer v); - @Optional(reason = "Not exposed in ATI Catalyst 10.10c") @StripPostfix("v") void glVertexAttribL2dv(@GLuint int index, @Const @Check("2") DoubleBuffer v); - @Optional(reason = "Not exposed in ATI Catalyst 10.10c") @StripPostfix("v") void glVertexAttribL3dv(@GLuint int index, @Const @Check("3") DoubleBuffer v); - @Optional(reason = "Not exposed in ATI Catalyst 10.10c") @StripPostfix("v") void glVertexAttribL4dv(@GLuint int index, @Const @Check("4") DoubleBuffer v); - @Optional(reason = "Not exposed in ATI Catalyst 10.10c") void glVertexAttribLPointer(@GLuint int index, int size, @Constant("GL11.GL_DOUBLE") @GLenum int type, @GLsizei int stride, @CachedReference(index = "index", name = "glVertexAttribPointer_buffer") @BufferObject(BufferKind.ArrayVBO) @Check @Const @GLdouble Buffer pointer); - @Optional(reason = "Not exposed in ATI Catalyst 10.10c") @StripPostfix("params") void glGetVertexAttribLdv(@GLuint int index, @GLenum int pname, @OutParameter @Check("4") DoubleBuffer params); @@ -406,32 +392,17 @@ * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, * GetDoublev and GetInteger64v: */ - int GL_MAX_VIEWPORTS = 0x825B, - GL_VIEWPORT_SUBPIXEL_BITS = 0x825C, - GL_VIEWPORT_BOUNDS_RANGE = 0x825D, - GL_LAYER_PROVOKING_VERTEX = 0x825E, + int GL_MAX_VIEWPORTS = 0x825B, + GL_VIEWPORT_SUBPIXEL_BITS = 0x825C, + GL_VIEWPORT_BOUNDS_RANGE = 0x825D, + GL_LAYER_PROVOKING_VERTEX = 0x825E, GL_VIEWPORT_INDEX_PROVOKING_VERTEX = 0x825F; - /** Accepted by the <pname> parameter of GetIntegeri_v: */ - int GL_SCISSOR_BOX = 0x0C10; - - /** Accepted by the <pname> parameter of GetFloati_v: */ - int GL_VIEWPORT = 0x0BA2; - - /** Accepted by the <pname> parameter of GetDoublei_v: */ - int GL_DEPTH_RANGE = 0x0B70; - - /** Accepted by the <pname> parameter of Enablei, Disablei, and IsEnabledi: */ - int GL_SCISSOR_TEST = 0x0C11; - /** * Returned in the <data> parameter from a Get query with a <pname> of * LAYER_PROVOKING_VERTEX or VIEWPORT_INDEX_PROVOKING_VERTEX: */ - int GL_FIRST_VERTEX_CONVENTION = 0x8E4D, - GL_LAST_VERTEX_CONVENTION = 0x8E4E, - GL_PROVOKING_VERTEX = 0x8E4F, - GL_UNDEFINED_VERTEX = 0x8260; + int GL_UNDEFINED_VERTEX = 0x8260; @StripPostfix("v") void glViewportArrayv(@GLuint int first, @AutoSize(value = "v", expression = " >> 2") @GLsizei int count, @Const FloatBuffer v); @@ -450,9 +421,9 @@ void glScissorIndexedv(@GLuint int index, @Check("4") @Const IntBuffer v); @StripPostfix("v") - void glDepthRangeArrayv(@GLuint int first, @AutoSize(value = "v", expression = " >> 1") @GLsizei int count, @Const @GLclampd DoubleBuffer v); + void glDepthRangeArrayv(@GLuint int first, @AutoSize(value = "v", expression = " >> 1") @GLsizei int count, @Const DoubleBuffer v); - void glDepthRangeIndexed(@GLuint int index, @GLclampd double n, @GLclampd double f); + void glDepthRangeIndexed(@GLuint int index, double n, double f); @StripPostfix("data") void glGetFloati_v(@GLenum int target, @GLuint int index, @Check @OutParameter FloatBuffer data); diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/GL42.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/GL42.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/GL42.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/GL42.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,321 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +import org.lwjgl.util.generator.*; +import org.lwjgl.util.generator.opengl.*; + +import java.nio.Buffer; +import java.nio.IntBuffer; + +public interface GL42 { + + // ---------------------------------------------------------------------------- + // ----------------------[ ARB_texture_compression_bptc ]---------------------- + // ---------------------------------------------------------------------------- + + /** + * Accepted by the <internalformat> parameter of TexImage2D, TexImage3D, + * CopyTexImage2D, CopyTexImage3D, CompressedTexImage2DARB, and + * CompressedTexImage3DARB and the <format> parameter of + * CompressedTexSubImage2DARB and CompressedTexSubImage3DARB: + */ + int GL_COMPRESSED_RGBA_BPTC_UNORM = 0x8E8C; + int GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM = 0x8E8D; + int GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT = 0x8E8E; + int GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT = 0x8E8F; + + // ------------------------------------------------------------------------------------ + // ----------------------[ ARB_compressed_texture_pixel_storage ]---------------------- + // ------------------------------------------------------------------------------------ + + /** + * Accepted by the <pname> parameter of PixelStore[fi], GetBooleanv, + * GetIntegerv, GetInteger64v, GetFloatv, and GetDoublev: + */ + int GL_UNPACK_COMPRESSED_BLOCK_WIDTH = 0x9127, + GL_UNPACK_COMPRESSED_BLOCK_HEIGHT = 0x9128, + GL_UNPACK_COMPRESSED_BLOCK_DEPTH = 0x9129, + GL_UNPACK_COMPRESSED_BLOCK_SIZE = 0x912A, + GL_PACK_COMPRESSED_BLOCK_WIDTH = 0x912B, + GL_PACK_COMPRESSED_BLOCK_HEIGHT = 0x912C, + GL_PACK_COMPRESSED_BLOCK_DEPTH = 0x912D, + GL_PACK_COMPRESSED_BLOCK_SIZE = 0x912E; + + // -------------------------------------------------------------------------- + // ----------------------[ ARB_shader_atomic_counters ]---------------------- + // -------------------------------------------------------------------------- + + /** Accepted by the <target> parameter of BindBufferBase and BindBufferRange: */ + int GL_ATOMIC_COUNTER_BUFFER = 0x92C0; + + /** + * Accepted by the <pname> parameter of GetBooleani_v, GetIntegeri_v, + * GetFloati_v, GetDoublei_v, GetInteger64i_v, GetBooleanv, GetIntegerv, + * GetInteger64v, GetFloatv, GetDoublev, and GetActiveAtomicCounterBufferiv: + */ + int GL_ATOMIC_COUNTER_BUFFER_BINDING = 0x92C1; + + /** Accepted by the <pname> parameter of GetIntegeri_64v: */ + int GL_ATOMIC_COUNTER_BUFFER_START = 0x92C2, + GL_ATOMIC_COUNTER_BUFFER_SIZE = 0x92C3; + + /** Accepted by the <pname> parameter of GetActiveAtomicCounterBufferiv: */ + int GL_ATOMIC_COUNTER_BUFFER_DATA_SIZE = 0x92C4, + GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTERS = 0x92C5, + GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTER_INDICES = 0x92C6, + GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_VERTEX_SHADER = 0x92C7, + GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_CONTROL_SHADER = 0x92C8, + GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_EVALUATION_SHADER = 0x92C9, + GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_GEOMETRY_SHADER = 0x92CA, + GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_FRAGMENT_SHADER = 0x92CB; + + /** + * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, + * GetInteger64v, GetFloatv, and GetDoublev: + */ + int GL_MAX_VERTEX_ATOMIC_COUNTER_BUFFERS = 0x92CC, + GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS = 0x92CD, + GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS = 0x92CE, + GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS = 0x92CF, + GL_MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS = 0x92D0, + GL_MAX_COMBINED_ATOMIC_COUNTER_BUFFERS = 0x92D1, + GL_MAX_VERTEX_ATOMIC_COUNTERS = 0x92D2, + GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS = 0x92D3, + GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS = 0x92D4, + GL_MAX_GEOMETRY_ATOMIC_COUNTERS = 0x92D5, + GL_MAX_FRAGMENT_ATOMIC_COUNTERS = 0x92D6, + GL_MAX_COMBINED_ATOMIC_COUNTERS = 0x92D7, + GL_MAX_ATOMIC_COUNTER_BUFFER_SIZE = 0x92D8, + GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS = 0x92DC; + + /** Accepted by the <pname> parameter of GetProgramiv: */ + int GL_ACTIVE_ATOMIC_COUNTER_BUFFERS = 0x92D9; + + /** Accepted by the <pname> parameter of GetActiveUniformsiv: */ + int GL_UNIFORM_ATOMIC_COUNTER_BUFFER_INDEX = 0x92DA; + + /** Returned in <params> by GetActiveUniform and GetActiveUniformsiv: */ + int GL_UNSIGNED_INT_ATOMIC_COUNTER = 0x92DB; + + @StripPostfix("params") + void glGetActiveAtomicCounterBufferiv(@GLuint int program, @GLuint int bufferIndex, @GLenum int pname, @Check("1") @OutParameter IntBuffer params); + + @Alternate("glGetActiveAtomicCounterBufferiv") + @StripPostfix("params") + @GLreturn("params") + void glGetActiveAtomicCounterBufferiv2(@GLuint int program, @GLuint int bufferIndex, @GLenum int pname, @OutParameter IntBuffer params); + + // ------------------------------------------------------------------- + // ----------------------[ ARB_texture_storage ]---------------------- + // ------------------------------------------------------------------- + + /** Accepted by the <value> parameter of GetTexParameter{if}v: */ + int GL_TEXTURE_IMMUTABLE_FORMAT = 0x912F; + + void glTexStorage1D(@GLenum int target, @GLsizei int levels, + @GLenum int internalformat, + @GLsizei int width); + + void glTexStorage2D(@GLenum int target, @GLsizei int levels, + @GLenum int internalformat, + @GLsizei int width, @GLsizei int height); + + void glTexStorage3D(@GLenum int target, @GLsizei int levels, + @GLenum int internalformat, + @GLsizei int width, @GLsizei int height, @GLsizei int depth); + + // -------------------------------------------------------------------------------- + // ----------------------[ ARB_transform_feedback_instanced ]---------------------- + // -------------------------------------------------------------------------------- + + void glDrawTransformFeedbackInstanced(@GLenum int mode, @GLuint int id, @GLsizei int primcount); + + void glDrawTransformFeedbackStreamInstanced(@GLenum int mode, @GLuint int id, @GLuint int stream, @GLsizei int primcount); + + // ----------------------------------------------------------------- + // ----------------------[ ARB_base_instance ]---------------------- + // ----------------------------------------------------------------- + + void glDrawArraysInstancedBaseInstance(@GLenum int mode, + int first, + @GLsizei int count, + @GLsizei int primcount, + @GLuint int baseinstance); + + void glDrawElementsInstancedBaseInstance(@GLenum int mode, + @AutoSize("indices") @GLsizei int count, + @AutoType("indices") @GLenum int type, + @Const + @BufferObject(BufferKind.ElementVBO) + @GLubyte + @GLushort + @GLuint Buffer indices, + @GLsizei int primcount, + @GLuint int baseinstance); + + void glDrawElementsInstancedBaseVertexBaseInstance(@GLenum int mode, + @AutoSize("indices") @GLsizei int count, + @AutoType("indices") @GLenum int type, + @Const + @BufferObject(BufferKind.ElementVBO) + @GLubyte + @GLushort + @GLuint Buffer indices, + @GLsizei int primcount, + int basevertex, + @GLuint int baseinstance); + + // --------------------------------------------------------------------------- + // ----------------------[ ARB_shader_image_load_store ]---------------------- + // --------------------------------------------------------------------------- + + /** + * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, + * GetFloatv, GetDoublev, and GetInteger64v: + */ + int GL_MAX_IMAGE_UNITS = 0x8F38, + GL_MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS = 0x8F39, + GL_MAX_IMAGE_SAMPLES = 0x906D, + GL_MAX_VERTEX_IMAGE_UNIFORMS = 0x90CA, + GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS = 0x90CB, + GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS = 0x90CC, + GL_MAX_GEOMETRY_IMAGE_UNIFORMS = 0x90CD, + GL_MAX_FRAGMENT_IMAGE_UNIFORMS = 0x90CE, + GL_MAX_COMBINED_IMAGE_UNIFORMS = 0x90CF; + + /** Accepted by the <target> parameter of GetIntegeri_v and GetBooleani_v: */ + int GL_IMAGE_BINDING_NAME = 0x8F3A, + GL_IMAGE_BINDING_LEVEL = 0x8F3B, + GL_IMAGE_BINDING_LAYERED = 0x8F3C, + GL_IMAGE_BINDING_LAYER = 0x8F3D, + GL_IMAGE_BINDING_ACCESS = 0x8F3E, + GL_IMAGE_BINDING_FORMAT = 0x906E; + + /** Accepted by the <barriers> parameter of MemoryBarrier: */ + int GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT = 0x00000001, + GL_ELEMENT_ARRAY_BARRIER_BIT = 0x00000002, + GL_UNIFORM_BARRIER_BIT = 0x00000004, + GL_TEXTURE_FETCH_BARRIER_BIT = 0x00000008, + GL_SHADER_IMAGE_ACCESS_BARRIER_BIT = 0x00000020, + GL_COMMAND_BARRIER_BIT = 0x00000040, + GL_PIXEL_BUFFER_BARRIER_BIT = 0x00000080, + GL_TEXTURE_UPDATE_BARRIER_BIT = 0x00000100, + GL_BUFFER_UPDATE_BARRIER_BIT = 0x00000200, + GL_FRAMEBUFFER_BARRIER_BIT = 0x00000400, + GL_TRANSFORM_FEEDBACK_BARRIER_BIT = 0x00000800, + GL_ATOMIC_COUNTER_BARRIER_BIT = 0x00001000, + GL_ALL_BARRIER_BITS = 0xFFFFFFFF; + + /** Returned by the <type> parameter of GetActiveUniform: */ + int GL_IMAGE_1D = 0x904C, + GL_IMAGE_2D = 0x904D, + GL_IMAGE_3D = 0x904E, + GL_IMAGE_2D_RECT = 0x904F, + GL_IMAGE_CUBE = 0x9050, + GL_IMAGE_BUFFER = 0x9051, + GL_IMAGE_1D_ARRAY = 0x9052, + GL_IMAGE_2D_ARRAY = 0x9053, + GL_IMAGE_CUBE_MAP_ARRAY = 0x9054, + GL_IMAGE_2D_MULTISAMPLE = 0x9055, + GL_IMAGE_2D_MULTISAMPLE_ARRAY = 0x9056, + GL_INT_IMAGE_1D = 0x9057, + GL_INT_IMAGE_2D = 0x9058, + GL_INT_IMAGE_3D = 0x9059, + GL_INT_IMAGE_2D_RECT = 0x905A, + GL_INT_IMAGE_CUBE = 0x905B, + GL_INT_IMAGE_BUFFER = 0x905C, + GL_INT_IMAGE_1D_ARRAY = 0x905D, + GL_INT_IMAGE_2D_ARRAY = 0x905E, + GL_INT_IMAGE_CUBE_MAP_ARRAY = 0x905F, + GL_INT_IMAGE_2D_MULTISAMPLE = 0x9060, + GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY = 0x9061, + GL_UNSIGNED_INT_IMAGE_1D = 0x9062, + GL_UNSIGNED_INT_IMAGE_2D = 0x9063, + GL_UNSIGNED_INT_IMAGE_3D = 0x9064, + GL_UNSIGNED_INT_IMAGE_2D_RECT = 0x9065, + GL_UNSIGNED_INT_IMAGE_CUBE = 0x9066, + GL_UNSIGNED_INT_IMAGE_BUFFER = 0x9067, + GL_UNSIGNED_INT_IMAGE_1D_ARRAY = 0x9068, + GL_UNSIGNED_INT_IMAGE_2D_ARRAY = 0x9069, + GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY = 0x906A, + GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE = 0x906B, + GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY = 0x906C; + + /** + * Accepted by the <value> parameter of GetTexParameteriv, GetTexParameterfv, + * GetTexParameterIiv, and GetTexParameterIuiv: + */ + int GL_IMAGE_FORMAT_COMPATIBILITY_TYPE = 0x90C7; + + /** + * Returned in the <data> parameter of GetTexParameteriv, GetTexParameterfv, + * GetTexParameterIiv, and GetTexParameterIuiv when <value> is + * IMAGE_FORMAT_COMPATIBILITY_TYPE: + */ + int GL_IMAGE_FORMAT_COMPATIBILITY_BY_SIZE = 0x90C8, + IMAGE_FORMAT_COMPATIBILITY_BY_CLASS = 0x90C9; + + void glBindImageTexture(@GLuint int unit, @GLuint int texture, int level, + boolean layered, int layer, @GLenum int access, + @GLenum int format); + + void glMemoryBarrier(@GLbitfield int barriers); + + // ------------------------------------------------------------------------- + // ----------------------[ ARB_internal_format_query ]---------------------- + // ------------------------------------------------------------------------- + + /** Accepted by the <pname> parameter of GetInternalformativ: */ + int GL_NUM_SAMPLE_COUNTS = 0x9380; + + @StripPostfix("params") + void glGetInternalformativ(@GLenum int target, @GLenum int internalformat, + @GLenum int pname, @AutoSize("params") @GLsizei int bufSize, @OutParameter IntBuffer params); + + @Alternate("glGetInternalformativ") + @StripPostfix("params") + @GLreturn("params") + void glGetInternalformativ2(@GLenum int target, @GLenum int internalformat, + @GLenum int pname, @Constant("1") @GLsizei int bufSize, @OutParameter IntBuffer params); + + // ------------------------------------------------------------------------ + // ----------------------[ ARB_map_buffer_alignment ]---------------------- + // ------------------------------------------------------------------------ + + /** + * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, + * GetInteger64v, GetFloatv, and GetDoublev: + */ + int GL_MIN_MAP_BUFFER_ALIGNMENT = 0x90BC; + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/GL43.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/GL43.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/GL43.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/GL43.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,833 @@ +/* + * Copyright (c) 2002-2012 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +import org.lwjgl.util.generator.*; +import org.lwjgl.util.generator.opengl.*; + +import java.nio.ByteBuffer; +import java.nio.IntBuffer; +import java.nio.LongBuffer; +import javax.lang.model.type.TypeKind; + + +public interface GL43 { + + /** No. of supported Shading Language Versions. Accepted by the <pname> parameter of GetIntegerv. */ + int GL_NUM_SHADING_LANGUAGE_VERSIONS = 0x82E9; + + /** Vertex attrib array has unconverted doubles. Accepted by the <pname> parameter of GetVertexAttribiv. */ + int GL_VERTEX_ATTRIB_ARRAY_LONG = 0x874E; + + // --------------------------------------------------------------------- + // ----------------------[ ARB_ES3_compatibility ]---------------------- + // --------------------------------------------------------------------- + + /** Accepted by the <internalformat> parameter of CompressedTexImage2D */ + int GL_COMPRESSED_RGB8_ETC2 = 0x9274, + GL_COMPRESSED_SRGB8_ETC2 = 0x9275, + GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 0x9276, + GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 0x9277, + GL_COMPRESSED_RGBA8_ETC2_EAC = 0x9278, + GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC = 0x9279, + GL_COMPRESSED_R11_EAC = 0x9270, + GL_COMPRESSED_SIGNED_R11_EAC = 0x9271, + GL_COMPRESSED_RG11_EAC = 0x9272, + GL_COMPRESSED_SIGNED_RG11_EAC = 0x9273; + + /** Accepted by the <target> parameter of Enable and Disable: */ + int GL_PRIMITIVE_RESTART_FIXED_INDEX = 0x8D69; + + /** + * Accepted by the <target> parameter of BeginQuery, EndQuery, + * GetQueryIndexediv and GetQueryiv: + */ + int GL_ANY_SAMPLES_PASSED_CONSERVATIVE = 0x8D6A; + + /** Accepted by the <value> parameter of the GetInteger* functions: */ + int GL_MAX_ELEMENT_INDEX = 0x8D6B; + + // ----------------------------------------------------------------------- + // ----------------------[ ARB_clear_buffer_object ]---------------------- + // ----------------------------------------------------------------------- + + void glClearBufferData(@GLenum int target, + @GLenum int internalformat, + @GLenum int format, + @GLenum int type, + @Check("1") @Const @GLvoid ByteBuffer data); + + void glClearBufferSubData(@GLenum int target, + @GLenum int internalformat, + @GLintptr long offset, + @GLsizeiptr long size, + @GLenum int format, + @GLenum int type, + @Check("1") @Const @GLvoid ByteBuffer data); + + // ------------------------------------------------------------------ + // ----------------------[ ARB_compute_shader ]---------------------- + // ------------------------------------------------------------------ + + /** + * Accepted by the <type> parameter of CreateShader and returned in the + * <params> parameter by GetShaderiv: + */ + int GL_COMPUTE_SHADER = 0x91B9; + + /** + * Accepted by the <pname> parameter of GetIntegerv, GetBooleanv, GetFloatv, + * GetDoublev and GetInteger64v: + */ + int GL_MAX_COMPUTE_UNIFORM_BLOCKS = 0x91BB, + GL_MAX_COMPUTE_TEXTURE_IMAGE_UNITS = 0x91BC, + GL_MAX_COMPUTE_IMAGE_UNIFORMS = 0x91BD, + GL_MAX_COMPUTE_SHARED_MEMORY_SIZE = 0x8262, + GL_MAX_COMPUTE_UNIFORM_COMPONENTS = 0x8263, + GL_MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS = 0x8264, + GL_MAX_COMPUTE_ATOMIC_COUNTERS = 0x8265, + GL_MAX_COMBINED_COMPUTE_UNIFORM_COMPONENTS = 0x8266, + GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS = 0x90EB; + + /** + * Accepted by the <pname> parameter of GetIntegeri_v, GetBooleani_v, + * GetFloati_v, GetDoublei_v and GetInteger64i_v: + */ + + int GL_MAX_COMPUTE_WORK_GROUP_COUNT = 0x91BE, + GL_MAX_COMPUTE_WORK_GROUP_SIZE = 0x91BF; + + /** Accepted by the <pname> parameter of GetProgramiv: */ + int GL_COMPUTE_WORK_GROUP_SIZE = 0x8267; + + /** Accepted by the <pname> parameter of GetActiveUniformBlockiv: */ + int GL_UNIFORM_BLOCK_REFERENCED_BY_COMPUTE_SHADER = 0x90EC; + + /** Accepted by the <pname> parameter of GetActiveAtomicCounterBufferiv: */ + int GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_COMPUTE_SHADER = 0x90ED; + + /** + * Accepted by the <target> parameters of BindBuffer, BufferData, + * BufferSubData, MapBuffer, UnmapBuffer, GetBufferSubData, and + * GetBufferPointerv: + */ + int GL_DISPATCH_INDIRECT_BUFFER = 0x90EE; + + /** + * Accepted by the <value> parameter of GetIntegerv, GetBooleanv, + * GetInteger64v, GetFloatv, and GetDoublev: + */ + int GL_DISPATCH_INDIRECT_BUFFER_BINDING = 0x90EF; + + /** Accepted by the <stages> parameter of UseProgramStages: */ + int GL_COMPUTE_SHADER_BIT = 0x00000020; + + void glDispatchCompute(@GLuint int num_groups_x, + @GLuint int num_groups_y, + @GLuint int num_groups_z); + + void glDispatchComputeIndirect(@GLintptr long indirect); + + // -------------------------------------------------------------- + // ----------------------[ ARB_copy_image ]---------------------- + // -------------------------------------------------------------- + + void glCopyImageSubData( + @GLuint int srcName, @GLenum int srcTarget, int srcLevel, + int srcX, int srcY, int srcZ, + @GLuint int dstName, @GLenum int dstTarget, int dstLevel, + int dstX, int dstY, int dstZ, + @GLsizei int srcWidth, @GLsizei int srcHeight, @GLsizei int srcDepth); + + // ---------------------------------------------------------------- + // ----------------------[ KHR_debug_output ]---------------------- + // ----------------------[ ARB_debug_output2 ]--------------------- + // ----------------------[ ARB_debug_group ]----------------------- + // ----------------------[ ARB_debug_label ]----------------------- + // ---------------------------------------------------------------- + + /** + * Tokens accepted by the <target> parameters of Enable, Disable, and + * IsEnabled: + */ + int GL_DEBUG_OUTPUT = 0x92E0, + GL_DEBUG_OUTPUT_SYNCHRONOUS = 0x8242; + + /** Returned by GetIntegerv when <pname> is CONTEXT_FLAGS: */ + int GL_CONTEXT_FLAG_DEBUG_BIT = 0x00000002; + + /** + * Tokens accepted by the <value> parameters of GetBooleanv, GetIntegerv, + * GetFloatv, GetDoublev and GetInteger64v: + */ + int GL_MAX_DEBUG_MESSAGE_LENGTH = 0x9143, + GL_MAX_DEBUG_LOGGED_MESSAGES = 0x9144, + GL_DEBUG_LOGGED_MESSAGES = 0x9145, + GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH = 0x8243, + GL_MAX_DEBUG_GROUP_STACK_DEPTH = 0x826C, + GL_DEBUG_GROUP_STACK_DEPTH = 0x826D, + GL_MAX_LABEL_LENGTH = 0x82E8; + + /** Tokens accepted by the <pname> parameter of GetPointerv: */ + int GL_DEBUG_CALLBACK_FUNCTION = 0x8244, + GL_DEBUG_CALLBACK_USER_PARAM = 0x8245; + + /** + * Tokens accepted or provided by the <source> parameters of + * DebugMessageControl, DebugMessageInsert and DEBUGPROC, and the <sources> + * parameter of GetDebugMessageLog: + */ + int GL_DEBUG_SOURCE_API = 0x8246, + GL_DEBUG_SOURCE_WINDOW_SYSTEM = 0x8247, + GL_DEBUG_SOURCE_SHADER_COMPILER = 0x8248, + GL_DEBUG_SOURCE_THIRD_PARTY = 0x8249, + GL_DEBUG_SOURCE_APPLICATION = 0x824A, + GL_DEBUG_SOURCE_OTHER = 0x824B; + + /** + * Tokens accepted or provided by the <type> parameters of + * DebugMessageControl, DebugMessageInsert and DEBUGPROC, and the <types> + * parameter of GetDebugMessageLog: + */ + int GL_DEBUG_TYPE_ERROR = 0x824C, + GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR = 0x824D, + GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR = 0x824E, + GL_DEBUG_TYPE_PORTABILITY = 0x824F, + GL_DEBUG_TYPE_PERFORMANCE = 0x8250, + GL_DEBUG_TYPE_OTHER = 0x8251, + GL_DEBUG_TYPE_MARKER = 0x8268; + + /** + * Tokens accepted or provided by the <type> parameters of + * DebugMessageControl and DEBUGPROC, and the <types> parameter of + * GetDebugMessageLog: + */ + int GL_DEBUG_TYPE_PUSH_GROUP = 0x8269, + GL_DEBUG_TYPE_POP_GROUP = 0x826A; + + /** + * Tokens accepted or provided by the <severity> parameters of + * DebugMessageControl, DebugMessageInsert and DEBUGPROC callback functions, + * and the <severities> parameter of GetDebugMessageLog: + */ + int GL_DEBUG_SEVERITY_HIGH = 0x9146, + GL_DEBUG_SEVERITY_MEDIUM = 0x9147, + GL_DEBUG_SEVERITY_LOW = 0x9148, + GL_DEBUG_SEVERITY_NOTIFICATION = 0x826B; + + /** + * Tokens accepted or provided by the <identifier> parameters of + * ObjectLabel and GetObjectLabel: + */ + int GL_BUFFER = 0x82E0, + GL_SHADER = 0x82E1, + GL_PROGRAM = 0x82E2, + GL_QUERY = 0x82E3, + GL_PROGRAM_PIPELINE = 0x82E4, + GL_SAMPLER = 0x82E6, + GL_DISPLAY_LIST = 0x82E7; + + // ----------------------------- + + void glDebugMessageControl(@GLenum int source, + @GLenum int type, + @GLenum int severity, + @AutoSize(value = "ids", canBeNull = true) @GLsizei int count, + @Check(canBeNull = true) @Const @GLuint IntBuffer ids, + boolean enabled); + + void glDebugMessageInsert(@GLenum int source, + @GLenum int type, + @GLuint int id, + @GLenum int severity, + @AutoSize("buf") @GLsizei int length, + @Const @GLchar ByteBuffer buf); + + @Alternate("glDebugMessageInsert") + void glDebugMessageInsert(@GLenum int source, + @GLenum int type, + @GLuint int id, + @GLenum int severity, + @Constant("buf.length()") @GLsizei int length, + CharSequence buf); + + /** + * The {@code KHRDebugCallback.Handler} implementation passed to this method will be used for + * KHR_debug messages. If callback is null, any previously registered handler for the current + * thread will be unregistered and stop receiving messages. + * + * @param callback the callback function to use + */ + @Code( + // Create a GlobalRef to the callback object and register it with the current context. + javaBeforeNative = "\t\tlong userParam = callback == null ? 0 : CallbackUtil.createGlobalRef(callback.getHandler());\n" + + "\t\tCallbackUtil.registerContextCallbackKHR(userParam);" + ) + void glDebugMessageCallback(@PointerWrapper(value = "GLDEBUGPROC", canBeNull = true) KHRDebugCallback callback, + @Constant("userParam") @PointerWrapper("GLvoid *") long userParam); + + @GLuint + int glGetDebugMessageLog(@GLuint int count, + @AutoSize(value = "messageLog", canBeNull = true) @GLsizei int bufsize, + @Check(value = "count", canBeNull = true) @GLenum IntBuffer sources, + @Check(value = "count", canBeNull = true) @GLenum IntBuffer types, + @Check(value = "count", canBeNull = true) @GLuint IntBuffer ids, + @Check(value = "count", canBeNull = true) @GLenum IntBuffer severities, + @Check(value = "count", canBeNull = true) @GLsizei IntBuffer lengths, + @Check(canBeNull = true) @OutParameter @GLchar ByteBuffer messageLog); + + void glPushDebugGroup(@GLenum int source, @GLuint int id, @AutoSize("message") @GLsizei int length, + @Const @GLchar ByteBuffer message); + + @Alternate("glPushDebugGroup") + void glPushDebugGroup(@GLenum int source, @GLuint int id, @Constant("message.length()") @GLsizei int length, + CharSequence message); + + void glPopDebugGroup(); + + void glObjectLabel(@GLenum int identifier, @GLuint int name, @AutoSize(value = "label", canBeNull = true) @GLsizei int length, + @Check(canBeNull = true) @Const @GLchar ByteBuffer label); + + @Alternate("glObjectLabel") + void glObjectLabel(@GLenum int identifier, @GLuint int name, @Constant("label.length()") @GLsizei int length, + CharSequence label); + + void glGetObjectLabel(@GLenum int identifier, @GLuint int name, @AutoSize("label") @GLsizei int bufSize, + @OutParameter @Check(value = "1", canBeNull = true) @GLsizei IntBuffer length, + @OutParameter @GLchar ByteBuffer label); + + @Alternate("glGetObjectLabel") + @GLreturn(value = "label", maxLength = "bufSize") + void glGetObjectLabel2(@GLenum int identifier, @GLuint int name, @GLsizei int bufSize, + @OutParameter @GLsizei @Constant("MemoryUtil.getAddress0(label_length)") IntBuffer length, + @OutParameter @GLchar ByteBuffer label); + + void glObjectPtrLabel(@PointerWrapper("GLvoid *") org.lwjgl.PointerWrapper ptr, @AutoSize(value = "label", canBeNull = true) @GLsizei int length, + @Check(canBeNull = true) @Const @GLchar ByteBuffer label); + + @Alternate("glObjectPtrLabel") + void glObjectPtrLabel(@PointerWrapper("GLvoid *") org.lwjgl.PointerWrapper ptr, @Constant("label.length()") @GLsizei int length, + CharSequence label); + + void glGetObjectPtrLabel(@PointerWrapper("GLvoid *") org.lwjgl.PointerWrapper ptr, @AutoSize("label") @GLsizei int bufSize, + @OutParameter @Check(value = "1", canBeNull = true) @GLsizei IntBuffer length, + @OutParameter @GLchar ByteBuffer label); + + @Alternate("glGetObjectPtrLabel") + @GLreturn(value = "label", maxLength = "bufSize") + void glGetObjectPtrLabel2(@PointerWrapper("GLvoid *") org.lwjgl.PointerWrapper ptr, @GLsizei int bufSize, + @OutParameter @GLsizei @Constant("MemoryUtil.getAddress0(label_length)") IntBuffer length, + @OutParameter @GLchar ByteBuffer label); + + // ----------------------------------------------------------------------------- + // ----------------------[ ARB_explicit_uniform_location ]---------------------- + // ----------------------------------------------------------------------------- + + /** + * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, + * GetFloatv, GetDoublev, and GetInteger64v: + */ + int GL_MAX_UNIFORM_LOCATIONS = 0x826E; + + // ----------------------------------------------------------------------------- + // ----------------------[ ARB_framebuffer_no_attachment ]---------------------- + // ----------------------------------------------------------------------------- + + /** + * Accepted by the <pname> parameter of FramebufferParameteri, + * GetFramebufferParameteriv, NamedFramebufferParameteriEXT, and + * GetNamedFramebufferParameterivEXT: + */ + int GL_FRAMEBUFFER_DEFAULT_WIDTH = 0x9310, + GL_FRAMEBUFFER_DEFAULT_HEIGHT = 0x9311, + GL_FRAMEBUFFER_DEFAULT_LAYERS = 0x9312, + GL_FRAMEBUFFER_DEFAULT_SAMPLES = 0x9313, + GL_FRAMEBUFFER_DEFAULT_FIXED_SAMPLE_LOCATIONS = 0x9314; + + /** + * Accepted by the <pname> parameter of GetIntegerv, GetBooleanv, + * GetInteger64v, GetFloatv, and GetDoublev: + */ + int GL_MAX_FRAMEBUFFER_WIDTH = 0x9315, + GL_MAX_FRAMEBUFFER_HEIGHT = 0x9316, + GL_MAX_FRAMEBUFFER_LAYERS = 0x9317, + GL_MAX_FRAMEBUFFER_SAMPLES = 0x9318; + + void glFramebufferParameteri(@GLenum int target, @GLenum int pname, int param); + + @StripPostfix("params") + void glGetFramebufferParameteriv(@GLenum int target, @GLenum int pname, @OutParameter @Check("1") IntBuffer params); + + @Alternate("glGetFramebufferParameteriv") + @GLreturn("params") + @StripPostfix(value = "params", hasPostfix = false) + void glGetFramebufferParameteriv2(@GLenum int target, @GLenum int pname, @OutParameter IntBuffer params); + + // ----------------------------------------------------------------------------- + // ----------------------[ ARB_internalformat_query2 ]---------------------- + // ----------------------------------------------------------------------------- + + /** + * Accepted by the <pname> parameter of GetInternalformativ + * and GetInternalformati64v: + */ + int GL_INTERNALFORMAT_SUPPORTED = 0x826F, + GL_INTERNALFORMAT_PREFERRED = 0x8270, + GL_INTERNALFORMAT_RED_SIZE = 0x8271, + GL_INTERNALFORMAT_GREEN_SIZE = 0x8272, + GL_INTERNALFORMAT_BLUE_SIZE = 0x8273, + GL_INTERNALFORMAT_ALPHA_SIZE = 0x8274, + GL_INTERNALFORMAT_DEPTH_SIZE = 0x8275, + GL_INTERNALFORMAT_STENCIL_SIZE = 0x8276, + GL_INTERNALFORMAT_SHARED_SIZE = 0x8277, + GL_INTERNALFORMAT_RED_TYPE = 0x8278, + GL_INTERNALFORMAT_GREEN_TYPE = 0x8279, + GL_INTERNALFORMAT_BLUE_TYPE = 0x827A, + GL_INTERNALFORMAT_ALPHA_TYPE = 0x827B, + GL_INTERNALFORMAT_DEPTH_TYPE = 0x827C, + GL_INTERNALFORMAT_STENCIL_TYPE = 0x827D, + GL_MAX_WIDTH = 0x827E, + GL_MAX_HEIGHT = 0x827F, + GL_MAX_DEPTH = 0x8280, + GL_MAX_LAYERS = 0x8281, + GL_MAX_COMBINED_DIMENSIONS = 0x8282, + GL_COLOR_COMPONENTS = 0x8283, + GL_DEPTH_COMPONENTS = 0x8284, + GL_STENCIL_COMPONENTS = 0x8285, + GL_COLOR_RENDERABLE = 0x8286, + GL_DEPTH_RENDERABLE = 0x8287, + GL_STENCIL_RENDERABLE = 0x8288, + GL_FRAMEBUFFER_RENDERABLE = 0x8289, + GL_FRAMEBUFFER_RENDERABLE_LAYERED = 0x828A, + GL_FRAMEBUFFER_BLEND = 0x828B, + GL_READ_PIXELS = 0x828C, + GL_READ_PIXELS_FORMAT = 0x828D, + GL_READ_PIXELS_TYPE = 0x828E, + GL_TEXTURE_IMAGE_FORMAT = 0x828F, + GL_TEXTURE_IMAGE_TYPE = 0x8290, + GL_GET_TEXTURE_IMAGE_FORMAT = 0x8291, + GL_GET_TEXTURE_IMAGE_TYPE = 0x8292, + GL_MIPMAP = 0x8293, + GL_MANUAL_GENERATE_MIPMAP = 0x8294, + GL_AUTO_GENERATE_MIPMAP = 0x8295, + GL_COLOR_ENCODING = 0x8296, + GL_SRGB_READ = 0x8297, + GL_SRGB_WRITE = 0x8298, + GL_SRGB_DECODE_ARB = 0x8299, + GL_FILTER = 0x829A, + GL_VERTEX_TEXTURE = 0x829B, + GL_TESS_CONTROL_TEXTURE = 0x829C, + GL_TESS_EVALUATION_TEXTURE = 0x829D, + GL_GEOMETRY_TEXTURE = 0x829E, + GL_FRAGMENT_TEXTURE = 0x829F, + GL_COMPUTE_TEXTURE = 0x82A0, + GL_TEXTURE_SHADOW = 0x82A1, + GL_TEXTURE_GATHER = 0x82A2, + GL_TEXTURE_GATHER_SHADOW = 0x82A3, + GL_SHADER_IMAGE_LOAD = 0x82A4, + GL_SHADER_IMAGE_STORE = 0x82A5, + GL_SHADER_IMAGE_ATOMIC = 0x82A6, + GL_IMAGE_TEXEL_SIZE = 0x82A7, + GL_IMAGE_COMPATIBILITY_CLASS = 0x82A8, + GL_IMAGE_PIXEL_FORMAT = 0x82A9, + GL_IMAGE_PIXEL_TYPE = 0x82AA, + GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_TEST = 0x82AC, + GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_TEST = 0x82AD, + GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_WRITE = 0x82AE, + GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_WRITE = 0x82AF, + GL_TEXTURE_COMPRESSED_BLOCK_WIDTH = 0x82B1, + GL_TEXTURE_COMPRESSED_BLOCK_HEIGHT = 0x82B2, + GL_TEXTURE_COMPRESSED_BLOCK_SIZE = 0x82B3, + GL_CLEAR_BUFFER = 0x82B4, + GL_TEXTURE_VIEW = 0x82B5, + GL_VIEW_COMPATIBILITY_CLASS = 0x82B6; + + /** + * Returned as possible responses for various <pname> queries + * to GetInternalformativ and GetInternalformati64v + */ + int GL_FULL_SUPPORT = 0x82B7, + GL_CAVEAT_SUPPORT = 0x82B8, + GL_IMAGE_CLASS_4_X_32 = 0x82B9, + GL_IMAGE_CLASS_2_X_32 = 0x82BA, + GL_IMAGE_CLASS_1_X_32 = 0x82BB, + GL_IMAGE_CLASS_4_X_16 = 0x82BC, + GL_IMAGE_CLASS_2_X_16 = 0x82BD, + GL_IMAGE_CLASS_1_X_16 = 0x82BE, + GL_IMAGE_CLASS_4_X_8 = 0x82BF, + GL_IMAGE_CLASS_2_X_8 = 0x82C0, + GL_IMAGE_CLASS_1_X_8 = 0x82C1, + GL_IMAGE_CLASS_11_11_10 = 0x82C2, + GL_IMAGE_CLASS_10_10_10_2 = 0x82C3, + GL_VIEW_CLASS_128_BITS = 0x82C4, + GL_VIEW_CLASS_96_BITS = 0x82C5, + GL_VIEW_CLASS_64_BITS = 0x82C6, + GL_VIEW_CLASS_48_BITS = 0x82C7, + GL_VIEW_CLASS_32_BITS = 0x82C8, + GL_VIEW_CLASS_24_BITS = 0x82C9, + GL_VIEW_CLASS_16_BITS = 0x82CA, + GL_VIEW_CLASS_8_BITS = 0x82CB, + GL_VIEW_CLASS_S3TC_DXT1_RGB = 0x82CC, + GL_VIEW_CLASS_S3TC_DXT1_RGBA = 0x82CD, + GL_VIEW_CLASS_S3TC_DXT3_RGBA = 0x82CE, + GL_VIEW_CLASS_S3TC_DXT5_RGBA = 0x82CF, + GL_VIEW_CLASS_RGTC1_RED = 0x82D0, + GL_VIEW_CLASS_RGTC2_RG = 0x82D1, + GL_VIEW_CLASS_BPTC_UNORM = 0x82D2, + GL_VIEW_CLASS_BPTC_FLOAT = 0x82D3; + + @StripPostfix("params") + void glGetInternalformati64v(@GLenum int target, @GLenum int internalformat, + @GLenum int pname, @AutoSize("params") @GLsizei int bufSize, @OutParameter @GLint64 LongBuffer params); + + @Alternate("glGetInternalformati64v") + @GLreturn("params") + @StripPostfix(value = "params", hasPostfix = false) + void glGetInternalformati64v2(@GLenum int target, @GLenum int internalformat, + @GLenum int pname, @Constant("1") @GLsizei int bufSize, @OutParameter @GLint64 LongBuffer params); + + // ---------------------------------------------------------------------- + // ----------------------[ ARB_invalidate_subdata ]---------------------- + // ---------------------------------------------------------------------- + + void glInvalidateTexSubImage(@GLuint int texture, int level, + int xoffset, int yoffset, int zoffset, + @GLsizei int width, @GLsizei int height, @GLsizei int depth); + + void glInvalidateTexImage(@GLuint int texture, int level); + + void glInvalidateBufferSubData(@GLuint int buffer, @GLintptr long offset, @GLsizeiptr long length); + + void glInvalidateBufferData(@GLuint int buffer); + + void glInvalidateFramebuffer(@GLenum int target, + @AutoSize("attachments") @GLsizei int numAttachments, + @Const @GLenum IntBuffer attachments); + + void glInvalidateSubFramebuffer(@GLenum int target, + @AutoSize("attachments") @GLsizei int numAttachments, + @Const @GLenum IntBuffer attachments, + int x, int y, @GLsizei int width, @GLsizei int height); + + // ----------------------------------------------------------------------- + // ----------------------[ ARB_multi_draw_indirect ]---------------------- + // ----------------------------------------------------------------------- + + void glMultiDrawArraysIndirect(@GLenum int mode, + @BufferObject(BufferKind.IndirectBO) @Check("(stride == 0 ? 4 * 4 : stride) * primcount") @Const @GLvoid ByteBuffer indirect, + @GLsizei int primcount, + @GLsizei int stride); + + @Alternate("glMultiDrawArraysIndirect") + void glMultiDrawArraysIndirect(@GLenum int mode, + @BufferObject(BufferKind.IndirectBO) @Check("(stride == 0 ? 4 : stride >> 2) * primcount") @Const @GLvoid(TypeKind.INT) IntBuffer indirect, + @GLsizei int primcount, + @GLsizei int stride); + + void glMultiDrawElementsIndirect(@GLenum int mode, + @GLenum int type, + @BufferObject(BufferKind.IndirectBO) @Check("(stride == 0 ? 5 * 4 : stride) * primcount") @Const @GLvoid ByteBuffer indirect, + @GLsizei int primcount, + @GLsizei int stride); + + @Alternate("glMultiDrawElementsIndirect") + void glMultiDrawElementsIndirect(@GLenum int mode, + @GLenum int type, + @BufferObject(BufferKind.IndirectBO) @Check("(stride == 0 ? 5 : stride >> 2) * primcount") @Const @GLvoid(TypeKind.INT) IntBuffer indirect, + @GLsizei int primcount, + @GLsizei int stride); + + // --------------------------------------------------------------------------- + // ----------------------[ ARB_program_interface_query ]---------------------- + // --------------------------------------------------------------------------- + + /** + * Accepted by the <programInterface> parameter of GetProgramInterfaceiv, + * GetProgramResourceIndex, GetProgramResourceName, GetProgramResourceiv, + * GetProgramResourceLocation, and GetProgramResourceLocationIndex: + */ + int GL_UNIFORM = 0x92E1, + GL_UNIFORM_BLOCK = 0x92E2, + GL_PROGRAM_INPUT = 0x92E3, + GL_PROGRAM_OUTPUT = 0x92E4, + GL_BUFFER_VARIABLE = 0x92E5, + GL_SHADER_STORAGE_BLOCK = 0x92E6, + GL_VERTEX_SUBROUTINE = 0x92E8, + GL_TESS_CONTROL_SUBROUTINE = 0x92E9, + GL_TESS_EVALUATION_SUBROUTINE = 0x92EA, + GL_GEOMETRY_SUBROUTINE = 0x92EB, + GL_FRAGMENT_SUBROUTINE = 0x92EC, + GL_COMPUTE_SUBROUTINE = 0x92ED, + GL_VERTEX_SUBROUTINE_UNIFORM = 0x92EE, + GL_TESS_CONTROL_SUBROUTINE_UNIFORM = 0x92EF, + GL_TESS_EVALUATION_SUBROUTINE_UNIFORM = 0x92F0, + GL_GEOMETRY_SUBROUTINE_UNIFORM = 0x92F1, + GL_FRAGMENT_SUBROUTINE_UNIFORM = 0x92F2, + GL_COMPUTE_SUBROUTINE_UNIFORM = 0x92F3, + GL_TRANSFORM_FEEDBACK_VARYING = 0x92F4; + + /** Accepted by the <pname> parameter of GetProgramInterfaceiv: */ + int GL_ACTIVE_RESOURCES = 0x92F5, + GL_MAX_NAME_LENGTH = 0x92F6, + GL_MAX_NUM_ACTIVE_VARIABLES = 0x92F7, + GL_MAX_NUM_COMPATIBLE_SUBROUTINES = 0x92F8; + + /** Accepted in the <props> array of GetProgramResourceiv: */ + int GL_NAME_LENGTH = 0x92F9, + GL_TYPE = 0x92FA, + GL_ARRAY_SIZE = 0x92FB, + GL_OFFSET = 0x92FC, + GL_BLOCK_INDEX = 0x92FD, + GL_ARRAY_STRIDE = 0x92FE, + GL_MATRIX_STRIDE = 0x92FF, + GL_IS_ROW_MAJOR = 0x9300, + GL_ATOMIC_COUNTER_BUFFER_INDEX = 0x9301, + GL_BUFFER_BINDING = 0x9302, + GL_BUFFER_DATA_SIZE = 0x9303, + GL_NUM_ACTIVE_VARIABLES = 0x9304, + GL_ACTIVE_VARIABLES = 0x9305, + GL_REFERENCED_BY_VERTEX_SHADER = 0x9306, + GL_REFERENCED_BY_TESS_CONTROL_SHADER = 0x9307, + GL_REFERENCED_BY_TESS_EVALUATION_SHADER = 0x9308, + GL_REFERENCED_BY_GEOMETRY_SHADER = 0x9309, + GL_REFERENCED_BY_FRAGMENT_SHADER = 0x930A, + GL_REFERENCED_BY_COMPUTE_SHADER = 0x930B, + GL_TOP_LEVEL_ARRAY_SIZE = 0x930C, + GL_TOP_LEVEL_ARRAY_STRIDE = 0x930D, + GL_LOCATION = 0x930E, + GL_LOCATION_INDEX = 0x930F, + GL_IS_PER_PATCH = 0x92E7; + + @StripPostfix("params") + void glGetProgramInterfaceiv(@GLuint int program, @GLenum int programInterface, + @GLenum int pname, @Check("1") @OutParameter IntBuffer params); + + @Alternate("glGetProgramInterfaceiv") + @GLreturn("params") + @StripPostfix(value = "params", hasPostfix = false) + void glGetProgramInterfaceiv2(@GLuint int program, @GLenum int programInterface, + @GLenum int pname, @OutParameter IntBuffer params); + + @GLuint + int glGetProgramResourceIndex(@GLuint int program, @GLenum int programInterface, + @NullTerminated @Const @GLchar ByteBuffer name); + + @Alternate("glGetProgramResourceIndex") + @GLuint + int glGetProgramResourceIndex(@GLuint int program, @GLenum int programInterface, + @NullTerminated CharSequence name); + + void glGetProgramResourceName(@GLuint int program, @GLenum int programInterface, + @GLuint int index, @AutoSize(value = "name", canBeNull = true) @GLsizei int bufSize, @Check(value = "1", canBeNull = true) @OutParameter @GLsizei IntBuffer length, + @Check(canBeNull = true) @OutParameter @GLchar ByteBuffer name); + + @Alternate("glGetProgramResourceName") + @GLreturn(value = "name", maxLength = "bufSize") + void glGetProgramResourceName2(@GLuint int program, @GLenum int programInterface, + @GLuint int index, @GLsizei int bufSize, + @OutParameter @GLsizei @Constant("MemoryUtil.getAddress0(name_length)") IntBuffer length, + @OutParameter @GLchar ByteBuffer name); + + @StripPostfix("params") + void glGetProgramResourceiv(@GLuint int program, @GLenum int programInterface, + @GLuint int index, @AutoSize("props") @GLsizei int propCount, + @Const @GLenum IntBuffer props, @AutoSize("params") @GLsizei int bufSize, + @Check(value = "1", canBeNull = true) @OutParameter @GLsizei IntBuffer length, @OutParameter IntBuffer params); + + int glGetProgramResourceLocation(@GLuint int program, @GLenum int programInterface, + @NullTerminated @Const @GLchar ByteBuffer name); + + @Alternate("glGetProgramResourceLocation") + int glGetProgramResourceLocation(@GLuint int program, @GLenum int programInterface, + @NullTerminated CharSequence name); + + int glGetProgramResourceLocationIndex(@GLuint int program, @GLenum int programInterface, + @NullTerminated @Const @GLchar ByteBuffer name); + + @Alternate("glGetProgramResourceLocationIndex") + int glGetProgramResourceLocationIndex(@GLuint int program, @GLenum int programInterface, + @NullTerminated CharSequence name); + + // -------------------------------------------------------------------------------- + // ----------------------[ ARB_shader_storage_buffer_object ]---------------------- + // -------------------------------------------------------------------------------- + + /** + * Accepted by the <target> parameters of BindBuffer, BufferData, + * BufferSubData, MapBuffer, UnmapBuffer, GetBufferSubData, and + * GetBufferPointerv: + */ + int GL_SHADER_STORAGE_BUFFER = 0x90D2; + + /** + * Accepted by the <pname> parameter of GetIntegerv, GetIntegeri_v, + * GetBooleanv, GetInteger64v, GetFloatv, GetDoublev, GetBooleani_v, + * GetIntegeri_v, GetFloati_v, GetDoublei_v, and GetInteger64i_v: + */ + int GL_SHADER_STORAGE_BUFFER_BINDING = 0x90D3; + + /** + * Accepted by the <pname> parameter of GetIntegeri_v, GetBooleani_v, + * GetIntegeri_v, GetFloati_v, GetDoublei_v, and GetInteger64i_v: + */ + int GL_SHADER_STORAGE_BUFFER_START = 0x90D4, + GL_SHADER_STORAGE_BUFFER_SIZE = 0x90D5; + + /** + * Accepted by the <pname> parameter of GetIntegerv, GetBooleanv, + * GetInteger64v, GetFloatv, and GetDoublev: + */ + int GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS = 0x90D6, + GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS = 0x90D7, + GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS = 0x90D8, + GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS = 0x90D9, + GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS = 0x90DA, + GL_MAX_COMPUTE_SHADER_STORAGE_BLOCKS = 0x90DB, + GL_MAX_COMBINED_SHADER_STORAGE_BLOCKS = 0x90DC, + GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS = 0x90DD, + GL_MAX_SHADER_STORAGE_BLOCK_SIZE = 0x90DE, + GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT = 0x90DF; + + /** Accepted in the <barriers> bitfield in glMemoryBarrier: */ + int GL_SHADER_STORAGE_BARRIER_BIT = 0x2000; + + /** + * Alias for the existing token + * MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS: + */ + int GL_MAX_COMBINED_SHADER_OUTPUT_RESOURCES = 0x8F39; + + void glShaderStorageBlockBinding(@GLuint int program, @GLuint int storageBlockIndex, + @GLuint int storageBlockBinding); + + // --------------------------------------------------------------------- + // ----------------------[ ARB_stencil_texturing ]---------------------- + // --------------------------------------------------------------------- + + /** Accepted by the <pname> parameter of TexParameter* and GetTexParameter*: */ + int GL_DEPTH_STENCIL_TEXTURE_MODE = 0x90EA; + + // ------------------------------------------------------------------------ + // ----------------------[ ARB_texture_buffer_range ]---------------------- + // ------------------------------------------------------------------------ + + /** Accepted by the <pname> parameter of GetTexLevelParameter: */ + int GL_TEXTURE_BUFFER_OFFSET = 0x919D, + GL_TEXTURE_BUFFER_SIZE = 0x919E; + + /** + * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, + * and GetDoublev: + */ + int GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT = 0x919F; + + void glTexBufferRange(@GLenum int target, + @GLenum int internalformat, + @GLuint int buffer, + @GLintptr long offset, + @GLsizeiptr long size); + + // ------------------------------------------------------------------------------- + // ----------------------[ ARB_texture_storage_multisample ]---------------------- + // ------------------------------------------------------------------------------- + + void glTexStorage2DMultisample(@GLenum int target, + @GLsizei int samples, + @GLenum int internalformat, + @GLsizei int width, + @GLsizei int height, + boolean fixedsamplelocations); + + void glTexStorage3DMultisample(@GLenum int target, + @GLsizei int samples, + @GLenum int internalformat, + @GLsizei int width, + @GLsizei int height, + @GLsizei int depth, + boolean fixedsamplelocations); + + // ---------------------------------------------------------------- + // ----------------------[ ARB_texture_view ]---------------------- + // ---------------------------------------------------------------- + + /** + * Accepted by the <pname> parameters of GetTexParameterfv and + * GetTexParameteriv: + */ + int GL_TEXTURE_VIEW_MIN_LEVEL = 0x82DB, + GL_TEXTURE_VIEW_NUM_LEVELS = 0x82DC, + GL_TEXTURE_VIEW_MIN_LAYER = 0x82DD, + GL_TEXTURE_VIEW_NUM_LAYERS = 0x82DE, + GL_TEXTURE_IMMUTABLE_LEVELS = 0x82DF; + + void glTextureView(@GLuint int texture, @GLenum int target, @GLuint int origtexture, + @GLenum int internalformat, + @GLuint int minlevel, @GLuint int numlevels, + @GLuint int minlayer, @GLuint int numlayers); + + // ------------------------------------------------------------------------- + // ----------------------[ ARB_vertex_attrib_binding ]---------------------- + // ------------------------------------------------------------------------- + + /** Accepted by the <pname> parameter of GetVertexAttrib*v: */ + int GL_VERTEX_ATTRIB_BINDING = 0x82D4, + GL_VERTEX_ATTRIB_RELATIVE_OFFSET = 0x82D5; + + /** + * Accepted by the <target> parameter of GetBooleani_v, GetIntegeri_v, + * GetFloati_v, GetDoublei_v, and GetInteger64i_v: + */ + int GL_VERTEX_BINDING_DIVISOR = 0x82D6, + GL_VERTEX_BINDING_OFFSET = 0x82D7, + GL_VERTEX_BINDING_STRIDE = 0x82D8; + + /** Accepted by the <pname> parameter of GetIntegerv, ... */ + int GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET = 0x82D9, + GL_MAX_VERTEX_ATTRIB_BINDINGS = 0x82DA; + + void glBindVertexBuffer(@GLuint int bindingindex, @GLuint int buffer, @GLintptr long offset, + @GLsizei int stride); + + void glVertexAttribFormat(@GLuint int attribindex, int size, @GLenum int type, + boolean normalized, @GLuint int relativeoffset); + + void glVertexAttribIFormat(@GLuint int attribindex, int size, @GLenum int type, + @GLuint int relativeoffset); + + void glVertexAttribLFormat(@GLuint int attribindex, int size, @GLenum int type, + @GLuint int relativeoffset); + + void glVertexAttribBinding(@GLuint int attribindex, @GLuint int bindingindex); + + void glVertexBindingDivisor(@GLuint int bindingindex, @GLuint int divisor); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/GL44.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/GL44.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/GL44.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/GL44.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,190 @@ +/* + * Copyright (c) 2002-2012 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +import org.lwjgl.PointerBuffer; +import org.lwjgl.util.generator.*; +import org.lwjgl.util.generator.opengl.*; + +import java.nio.Buffer; +import java.nio.IntBuffer; + +public interface GL44 { + + /** Implementation-dependent state which constrains the maximum value of stride parameters to vertex array pointer-setting commands. */ + int GL_MAX_VERTEX_ATTRIB_STRIDE = 0x82E5; + + // ------------------------------------------------------------------ + // ----------------------[ ARB_buffer_storage ]---------------------- + // ------------------------------------------------------------------ + + /** + * Accepted in the <flags> parameter of BufferStorage and + * NamedBufferStorageEXT: + */ + int GL_MAP_PERSISTENT_BIT = 0x0040, + GL_MAP_COHERENT_BIT = 0x0080, + GL_DYNAMIC_STORAGE_BIT = 0x0100, + GL_CLIENT_STORAGE_BIT = 0x0200; + + /** Accepted by the <pname> parameter of GetBufferParameter{i|i64}v:\ */ + + int GL_BUFFER_IMMUTABLE_STORAGE = 0x821F, + GL_BUFFER_STORAGE_FLAGS = 0x8220; + + /** Accepted by the <barriers> parameter of MemoryBarrier: */ + int GL_CLIENT_MAPPED_BUFFER_BARRIER_BIT = 0x00004000; + + void glBufferStorage(@GLenum int target, + @AutoSize("data") @GLsizeiptr long size, + @Const + @GLbyte + @GLshort + @GLint + @GLuint64 + @GLfloat + @GLdouble Buffer data, + @GLbitfield int flags); + + @Alternate("glBufferStorage") + void glBufferStorage2(@GLenum int target, + @GLsizeiptr long size, + @Constant("0L") @Const Buffer data, + @GLbitfield int flags); + + // ----------------------------------------------------------------- + // ----------------------[ ARB_clear_texture ]---------------------- + // ----------------------------------------------------------------- + + /** + * Accepted by the <pname> parameter for GetInternalformativ and + * GetInternalformati64v: + */ + int GL_CLEAR_TEXTURE = 0x9365; + + void glClearTexImage(@GLuint int texture, int level, + @GLenum int format, @GLenum int type, + @Check(value = "1", canBeNull = true) + @Const + @GLbyte + @GLshort + @GLint + @GLuint64 + @GLfloat + @GLdouble Buffer data); + + void glClearTexSubImage(@GLuint int texture, int level, + int xoffset, int yoffset, int zoffset, + @GLsizei int width, @GLsizei int height, @GLsizei int depth, + @GLenum int format, @GLenum int type, + @Check(value = "1", canBeNull = true) + @Const + @GLbyte + @GLshort + @GLint + @GLuint64 + @GLfloat + @GLdouble Buffer data); + + // -------------------------------------------------------------------- + // ----------------------[ ARB_enhanced_layouts ]---------------------- + // -------------------------------------------------------------------- + + /** Accepted in the <props> array of GetProgramResourceiv: */ + int GL_LOCATION_COMPONENT = 0x934A, + GL_TRANSFORM_FEEDBACK_BUFFER_INDEX = 0x934B, + GL_TRANSFORM_FEEDBACK_BUFFER_STRIDE = 0x934C; + + // -------------------------------------------------------------- + // ----------------------[ ARB_multi_bind ]---------------------- + // -------------------------------------------------------------- + + void glBindBuffersBase(@GLenum int target, @GLuint int first, @GLsizei int count, @Check(value = "count", canBeNull = true) @Const @GLuint IntBuffer buffers); + + void glBindBuffersRange(@GLenum int target, @GLuint int first, @GLsizei int count, + @Check(value = "count", canBeNull = true) @Const @GLuint IntBuffer buffers, + @Check(value = "count", canBeNull = true) @Const @GLintptr PointerBuffer offsets, + @Check(value = "count", canBeNull = true) @Const @GLsizeiptr PointerBuffer sizes); + + void glBindTextures(@GLuint int first, @GLsizei int count, @Check(value = "count", canBeNull = true) @Const @GLuint IntBuffer textures); + + void glBindSamplers(@GLuint int first, @GLsizei int count, @Check(value = "count", canBeNull = true) @Const @GLuint IntBuffer samplers); + + void glBindImageTextures(@GLuint int first, @GLsizei int count, @Check(value = "count", canBeNull = true) @Const @GLuint IntBuffer textures); + + void glBindVertexBuffers(@GLuint int first, @GLsizei int count, + @Check(value = "count", canBeNull = true) @Const @GLuint IntBuffer buffers, + @Check(value = "count", canBeNull = true) @Const @GLintptr PointerBuffer offsets, + @Check(value = "count", canBeNull = true) @Const @GLsizei IntBuffer strides); + + // ----------------------------------------------------------------------- + // ----------------------[ ARB_query_buffer_object ]---------------------- + // ----------------------------------------------------------------------- + + /** + * Accepted by the <pname> parameter of GetQueryObjectiv, GetQueryObjectuiv, + * GetQueryObjecti64v and GetQueryObjectui64v: + */ + int GL_QUERY_RESULT_NO_WAIT = 0x9194; + + /** + * Accepted by the <target> parameter of BindBuffer, BufferData, + * BufferSubData, MapBuffer, UnmapBuffer, MapBufferRange, GetBufferSubData, + * GetBufferParameteriv, GetBufferParameteri64v, GetBufferPointerv, + * ClearBufferSubData, and the <readtarget> and <writetarget> parameters of + * CopyBufferSubData: + */ + int GL_QUERY_BUFFER = 0x9192; + + /** + * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, + * and GetDoublev: + */ + int GL_QUERY_BUFFER_BINDING = 0x9193; + + /** Accepted in the <barriers> bitfield in MemoryBarrier: */ + int GL_QUERY_BUFFER_BARRIER_BIT = 0x00008000; + + // -------------------------------------------------------------------------------- + // ----------------------[ ARB_texture_mirror_clamp_to_edge ]---------------------- + // -------------------------------------------------------------------------------- + + /** + * Accepted by the <param> parameter of TexParameter{if}, SamplerParameter{if} + * and SamplerParameter{if}v, and by the <params> parameter of + * TexParameter{if}v, TexParameterI{i ui}v and SamplerParameterI{i ui}v when + * their <pname> parameter is TEXTURE_WRAP_S, TEXTURE_WRAP_T, or + * TEXTURE_WRAP_R: + */ + int GL_MIRROR_CLAMP_TO_EDGE = 0x8743; + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/GL45.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/GL45.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/GL45.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/GL45.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,663 @@ +/* + * Copyright (c) 2002-2014 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +import org.lwjgl.PointerBuffer; +import org.lwjgl.util.generator.*; +import org.lwjgl.util.generator.opengl.*; + +import java.nio.*; + +public interface GL45 { + + // ---------------------------------------------------------------- + // ----------------------[ ARB_clip_control ]---------------------- + // ---------------------------------------------------------------- + + /** Accepted by the <depth> parameter of ClipControl: */ + int GL_NEGATIVE_ONE_TO_ONE = 0x935E, + GL_ZERO_TO_ONE = 0x935F; + + /** + * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, + * GetFloatv, and GetDoublev: + */ + int GL_CLIP_ORIGIN = 0x935C, + GL_CLIP_DEPTH_MODE = 0x935D; + + void glClipControl(@GLenum int origin, @GLenum int depth); + + // ------------------------------------------------------------------------------- + // ----------------------[ ARB_conditional_render_inverted ]---------------------- + // ------------------------------------------------------------------------------- + + /** Accepted by the <mode> parameter of BeginConditionalRender: */ + int GL_QUERY_WAIT_INVERTED = 0x8E17, + GL_QUERY_NO_WAIT_INVERTED = 0x8E18, + GL_QUERY_BY_REGION_WAIT_INVERTED = 0x8E19, + GL_QUERY_BY_REGION_NO_WAIT_INVERTED = 0x8E1A; + + // ----------------------------------------------------------------- + // ----------------------[ ARB_cull_distance ]---------------------- + // ----------------------------------------------------------------- + + /** Accepted by the <pname> parameter of GetBooeleanv, GetDoublev, GetFloatv GetIntegerv, and GetInteger64v: */ + int GL_MAX_CULL_DISTANCES = 0x82F9, + GL_MAX_COMBINED_CLIP_AND_CULL_DISTANCES = 0x82FA; + + // ----------------------------------------------------------------------- + // ----------------------[ ARB_direct_state_access ]---------------------- + // ----------------------------------------------------------------------- + + /** + * Accepted by the <pname> parameter of GetTextureParameter{if}v and + * GetTextureParameterI{i ui}v: + */ + int GL_TEXTURE_TARGET = 0x1006; + + /** Accepted by the <pname> parameter of GetQueryObjectiv: */ + int GL_QUERY_TARGET = 0x82EA; + + /** Accepted by the <pname> parameter of GetIntegeri_v: */ + int GL_TEXTURE_BINDING = 0x82EB; + + // Transform Feedback object functions + + void glCreateTransformFeedbacks(@AutoSize("ids") @GLsizei int n, @OutParameter @GLuint IntBuffer ids); + + @Alternate("glCreateTransformFeedbacks") + @GLreturn("ids") + void glCreateTransformFeedbacks2(@Constant("1") @GLsizei int n, @OutParameter @GLuint IntBuffer ids); + + void glTransformFeedbackBufferBase(@GLuint int xfb, @GLuint int index, @GLuint int buffer); + + void glTransformFeedbackBufferRange(@GLuint int xfb, @GLuint int index, @GLuint int buffer, @GLintptr long offset, @GLsizeiptr long size); + + @StripPostfix("param") + void glGetTransformFeedbackiv(@GLuint int xfb, @GLenum int pname, @OutParameter @Check("1") IntBuffer param); + + @Alternate("glGetTransformFeedbackiv") + @GLreturn("param") + @StripPostfix(value = "param", hasPostfix = false) + void glGetTransformFeedbackiv2(@GLuint int xfb, @GLenum int pname, @OutParameter IntBuffer param); + + @StripPostfix("param") + void glGetTransformFeedbacki_v(@GLuint int xfb, @GLenum int pname, @GLuint int index, @OutParameter @Check("1") IntBuffer param); + + @Alternate("glGetTransformFeedbacki_v") + @GLreturn("param") + @StripPostfix(value = "param", postfix = "_v") + void glGetTransformFeedbacki_v2(@GLuint int xfb, @GLenum int pname, @GLuint int index, @OutParameter IntBuffer param); + + @StripPostfix("param") + void glGetTransformFeedbacki64_v(@GLuint int xfb, @GLenum int pname, @GLuint int index, @OutParameter @Check("1") @GLint64 LongBuffer param); + + @Alternate("glGetTransformFeedbacki64_v") + @GLreturn("param") + @StripPostfix(value = "param", postfix = "_v") + void glGetTransformFeedbacki64_v2(@GLuint int xfb, @GLenum int pname, @GLuint int index, @OutParameter @GLint64 LongBuffer param); + + // Buffer object functions + + void glCreateBuffers(@AutoSize("buffers") @GLsizei int n, @OutParameter @GLuint IntBuffer buffers); + + @Alternate("glCreateBuffers") + @GLreturn("buffers") + void glCreateBuffers2(@Constant("1") @GLsizei int n, @OutParameter @GLuint IntBuffer buffers); + + void glNamedBufferStorage(@GLuint int buffer, @AutoSize("data") @GLsizeiptr long size, + @Const + @GLbyte + @GLshort + @GLint + @GLuint64 + @GLfloat + @GLdouble Buffer data, + @GLbitfield int flags); + + @Alternate("glNamedBufferStorage") + void glNamedBufferStorage2(@GLuint int buffer, @GLsizeiptr long size, @Constant("0L") @Const Buffer data, @GLbitfield int flags); + + @GenerateAutos + void glNamedBufferData(@GLuint int buffer, @AutoSize("data") @GLsizeiptr long size, + @Check + @Const + @GLbyte + @GLshort + @GLint + @GLfloat + @GLdouble Buffer data, + @GLenum int usage); + + void glNamedBufferSubData(@GLuint int buffer, @GLintptr long offset, @AutoSize("data") @GLsizeiptr long size, + @Check + @Const + @GLbyte + @GLshort + @GLint + @GLfloat + @GLdouble Buffer data); + + void glCopyNamedBufferSubData(@GLuint int readBuffer, @GLuint int writeBuffer, @GLintptr long readOffset, @GLintptr long writeOffset, @GLsizeiptr long size); + + void glClearNamedBufferData(@GLuint int buffer, @GLenum int internalformat, @GLenum int format, @GLenum int type, @Check("1") @Const @GLvoid ByteBuffer data); + + void glClearNamedBufferSubData(@GLuint int buffer, @GLenum int internalformat, @GLintptr long offset, @GLsizeiptr long size, @GLenum int format, @GLenum int type, @Check("1") @Const @GLvoid ByteBuffer data); + + /** + * Maps a buffer object's data store. + *

        + * LWJGL note: This method comes in 2 flavors: + *

          + *
        1. {@link #glMapNamedBuffer(int, int, ByteBuffer)} - Calls {@link #glGetNamedBufferParameteri} to retrieve the buffer size and the {@code old_buffer} parameter is reused if the returned size and pointer match the buffer capacity and address, respectively.
        2. + *
        3. {@link #glMapNamedBuffer(int, int, int, ByteBuffer)} - The buffer size is explicitly specified and the {@code old_buffer} parameter is reused if {@code size} and the returned pointer match the buffer capacity and address, respectively. This is the most efficient method.
        4. + *
        + * + * @param buffer the buffer object being mapped + * @param access the access policy, indicating whether it will be possible to read from, write to, or both read from and write to the buffer object's mapped data store + */ + @CachedResult + @GLvoid + @AutoSize("glGetNamedBufferParameteri(buffer, GL15.GL_BUFFER_SIZE)") + ByteBuffer glMapNamedBuffer(@GLuint int buffer, @GLenum int access); + + @CachedResult(isRange = true) + @GLvoid + @AutoSize("length") + ByteBuffer glMapNamedBufferRange(@GLuint int buffer, @GLintptr long offset, @GLsizeiptr long length, @GLbitfield int access); + + boolean glUnmapNamedBuffer(@GLuint int buffer); + + void glFlushMappedNamedBufferRange(@GLuint int buffer, @GLintptr long offset, @GLsizeiptr long length); + + @StripPostfix("params") + void glGetNamedBufferParameteriv(@GLuint int buffer, @GLenum int pname, @OutParameter @Check IntBuffer params); + + @Alternate("glGetNamedBufferParameteriv") + @GLreturn("params") + @StripPostfix(value = "params", hasPostfix = false) + void glGetNamedBufferParameteriv2(@GLuint int buffer, @GLenum int pname, @OutParameter IntBuffer params); + + @StripPostfix("params") + void glGetNamedBufferParameteri64v(@GLuint int buffer, @GLenum int pname, @OutParameter @Check("1") @GLint64 LongBuffer params); + + @Alternate("glGetNamedBufferParameteri64v") + @GLreturn("params") + @StripPostfix(value = "params", hasPostfix = false) + void glGetNamedBufferParameteri64v2(@GLuint int buffer, @GLenum int pname, @OutParameter @GLint64 LongBuffer params); + + @StripPostfix("params") + @AutoSize("glGetNamedBufferParameteri(buffer, GL15.GL_BUFFER_SIZE)") + void glGetNamedBufferPointerv(@GLuint int buffer, @GLenum int pname, @Result @GLvoid ByteBuffer params); + + void glGetNamedBufferSubData(@GLuint int buffer, @GLintptr long offset, @AutoSize("data") @GLsizeiptr long size, + @OutParameter + @Check + @GLbyte + @GLshort + @GLint + @GLfloat + @GLdouble Buffer data); + + // Framebuffer object functions + + void glCreateFramebuffers(@AutoSize("framebuffers") @GLsizei int n, @OutParameter @GLuint IntBuffer framebuffers); + + @Alternate("glCreateFramebuffers") + @GLreturn("framebuffers") + void glCreateFramebuffers2(@Constant("1") @GLsizei int n, @OutParameter @GLuint IntBuffer framebuffers); + + void glNamedFramebufferRenderbuffer(@GLuint int framebuffer, @GLenum int attachment, @GLenum int renderbuffertarget, @GLuint int renderbuffer); + + void glNamedFramebufferParameteri(@GLuint int framebuffer, @GLenum int pname, int param); + + void glNamedFramebufferTexture(@GLuint int framebuffer, @GLenum int attachment, @GLuint int texture, int level); + + void glNamedFramebufferTextureLayer(@GLuint int framebuffer, @GLenum int attachment, @GLuint int texture, int level, int layer); + + void glNamedFramebufferDrawBuffer(@GLuint int framebuffer, @GLenum int mode); + + void glNamedFramebufferDrawBuffers(@GLuint int framebuffer, @AutoSize("bufs") @GLsizei int n, @Const @GLenum IntBuffer bufs); + + void glNamedFramebufferReadBuffer(@GLuint int framebuffer, @GLenum int mode); + + void glInvalidateNamedFramebufferData(@GLuint int framebuffer, @AutoSize("attachments") @GLsizei int numAttachments, @Const @GLenum IntBuffer attachments); + + void glInvalidateNamedFramebufferSubData(@GLuint int framebuffer, @AutoSize("attachments") @GLsizei int numAttachments, @Const @GLenum IntBuffer attachments, int x, int y, @GLsizei int width, @GLsizei int height); + + @StripPostfix("value") + void glClearNamedFramebufferiv(@GLuint int framebuffer, @GLenum int buffer, int drawbuffer, @Const @Check("1") IntBuffer value); + + @StripPostfix("value") + void glClearNamedFramebufferuiv(@GLuint int framebuffer, @GLenum int buffer, int drawbuffer, @Const @Check("4") @GLuint IntBuffer value); + + @StripPostfix("value") + void glClearNamedFramebufferfv(@GLuint int framebuffer, @GLenum int buffer, int drawbuffer, @Const @Check("1") FloatBuffer value); + + void glClearNamedFramebufferfi(@GLuint int framebuffer, @GLenum int buffer, float depth, int stencil); + + void glBlitNamedFramebuffer( + @GLuint int readFramebuffer, @GLuint int drawFramebuffer, + int srcX0, int srcY0, int srcX1, int srcY1, + int dstX0, int dstY0, int dstX1, int dstY1, + @GLbitfield int mask, @GLenum int filter); + + @GLenum + int glCheckNamedFramebufferStatus(@GLuint int framebuffer, @GLenum int target); + + @StripPostfix("params") + void glGetNamedFramebufferParameteriv(@GLuint int framebuffer, @GLenum int pname, @OutParameter @Check("1") IntBuffer params); + + @Alternate("glGetNamedFramebufferParameteriv") + @GLreturn("params") + @StripPostfix("params") + void glGetNamedFramebufferParameteriv2(@GLuint int framebuffer, @GLenum int pname, @OutParameter IntBuffer params); + + @StripPostfix("params") + void glGetNamedFramebufferAttachmentParameteriv(@GLuint int framebuffer, @GLenum int attachment, @GLenum int pname, @OutParameter @Check("1") IntBuffer params); + + @Alternate("glGetNamedFramebufferAttachmentParameteriv") + @GLreturn("params") + @StripPostfix("params") + void glGetNamedFramebufferAttachmentParameteriv2(@GLuint int framebuffer, @GLenum int attachment, @GLenum int pname, @OutParameter IntBuffer params); + + // Renderbuffer object functions + + void glCreateRenderbuffers(@AutoSize("renderbuffers") @GLsizei int n, @OutParameter @GLuint IntBuffer renderbuffers); + + @Alternate("glCreateRenderbuffers") + @GLreturn("renderbuffers") + void glCreateRenderbuffers2(@Constant("1") @GLsizei int n, @OutParameter @GLuint IntBuffer renderbuffers); + + void glNamedRenderbufferStorage(@GLuint int renderbuffer, @GLenum int internalformat, @GLsizei int width, @GLsizei int height); + + void glNamedRenderbufferStorageMultisample(@GLuint int renderbuffer, @GLsizei int samples, @GLenum int internalformat, @GLsizei int width, @GLsizei int height); + + @StripPostfix("params") + void glGetNamedRenderbufferParameteriv(@GLuint int renderbuffer, @GLenum int pname, @OutParameter @Check("1") IntBuffer params); + + @Alternate("glGetNamedRenderbufferParameteriv") + @GLreturn("params") + @StripPostfix("params") + void glGetNamedRenderbufferParameteriv2(@GLuint int renderbuffer, @GLenum int pname, @OutParameter IntBuffer params); + + // Texture object functions + + void glCreateTextures(@GLenum int target, @AutoSize("textures") @GLsizei int n, @OutParameter @GLuint IntBuffer textures); + + @Alternate("glCreateTextures") + @GLreturn("textures") + void glCreateTextures2(@GLenum int target, @Constant("1") @GLsizei int n, @OutParameter @GLuint IntBuffer textures); + + void glTextureBuffer(@GLuint int texture, @GLenum int internalformat, @GLuint int buffer); + + void glTextureBufferRange(@GLuint int texture, @GLenum int internalformat, @GLuint int buffer, @GLintptr long offset, @GLsizeiptr long size); + + void glTextureStorage1D(@GLuint int texture, @GLsizei int levels, @GLenum int internalformat, @GLsizei int width); + + void glTextureStorage2D(@GLuint int texture, @GLsizei int levels, @GLenum int internalformat, @GLsizei int width, @GLsizei int height); + + void glTextureStorage3D(@GLuint int texture, @GLsizei int levels, @GLenum int internalformat, @GLsizei int width, @GLsizei int height, @GLsizei int depth); + + void glTextureStorage2DMultisample(@GLuint int texture, @GLsizei int samples, @GLenum int internalformat, @GLsizei int width, @GLsizei int height, boolean fixedsamplelocations); + + void glTextureStorage3DMultisample(@GLuint int texture, @GLsizei int samples, @GLenum int internalformat, @GLsizei int width, @GLsizei int height, @GLsizei int depth, boolean fixedsamplelocations); + + void glTextureSubImage1D(@GLuint int texture, int level, int xoffset, @GLsizei int width, @GLenum int format, @GLenum int type, + @BufferObject(BufferKind.UnpackPBO) + @Check("GLChecks.calculateImageStorage(pixels, format, type, width, 1, 1)") + @Const + @GLbyte + @GLshort + @GLint + @GLfloat + @GLdouble Buffer pixels); + + void glTextureSubImage2D(@GLuint int texture, int level, int xoffset, int yoffset, @GLsizei int width, @GLsizei int height, @GLenum int format, @GLenum int type, + @BufferObject(BufferKind.UnpackPBO) + @Check("GLChecks.calculateImageStorage(pixels, format, type, width, height, 1)") + @Const + @GLbyte + @GLshort + @GLint + @GLfloat + @GLdouble Buffer pixels); + + void glTextureSubImage3D(@GLuint int texture, int level, int xoffset, int yoffset, int zoffset, @GLsizei int width, @GLsizei int height, @GLsizei int depth, @GLenum int format, @GLenum int type, + @BufferObject(BufferKind.UnpackPBO) + @Check("GLChecks.calculateImageStorage(pixels, format, type, width, height, depth)") + @Const + @GLbyte + @GLshort + @GLint + @GLfloat + @GLdouble Buffer pixels); + + void glCompressedTextureSubImage1D(@GLuint int texture, int level, int xoffset, @GLsizei int width, @GLenum int format, @AutoSize("data") @GLsizei int imageSize, + @BufferObject(BufferKind.UnpackPBO) + @Check + @Const + @GLvoid + ByteBuffer data); + + void glCompressedTextureSubImage2D(@GLuint int texture, int level, int xoffset, int yoffset, @GLsizei int width, @GLsizei int height, @GLenum int format, @AutoSize("data") @GLsizei int imageSize, + @BufferObject(BufferKind.UnpackPBO) + @Check + @Const + @GLvoid + ByteBuffer data); + + void glCompressedTextureSubImage3D(@GLuint int texture, int level, int xoffset, int yoffset, int zoffset, @GLsizei int width, @GLsizei int height, @GLsizei int depth, @GLenum int format, @GLsizei int imageSize, + @BufferObject(BufferKind.UnpackPBO) + @Check + @Const + @GLvoid + ByteBuffer data); + + void glCopyTextureSubImage1D(@GLuint int texture, int level, int xoffset, int x, int y, @GLsizei int width); + + void glCopyTextureSubImage2D(@GLuint int texture, int level, int xoffset, int yoffset, int x, int y, @GLsizei int width, @GLsizei int height); + + void glCopyTextureSubImage3D(@GLuint int texture, int level, int xoffset, int yoffset, int zoffset, int x, int y, @GLsizei int width, @GLsizei int height); + + void glTextureParameterf(@GLuint int texture, @GLenum int pname, float param); + + @StripPostfix("params") + void glTextureParameterfv(@GLuint int texture, @GLenum int pname, @Const @Check("4") FloatBuffer params); + + void glTextureParameteri(@GLuint int texture, @GLenum int pname, int param); + + @StripPostfix("params") + void glTextureParameterIiv(@GLuint int texture, @GLenum int pname, @Const @Check("1") IntBuffer params); + + @StripPostfix("params") + void glTextureParameterIuiv(@GLuint int texture, @GLenum int pname, @Const @Check("1") @GLuint IntBuffer params); + + @StripPostfix("params") + void glTextureParameteriv(@GLuint int texture, @GLenum int pname, @Const @Check("4") IntBuffer params); + + void glGenerateTextureMipmap(@GLuint int texture); + + void glBindTextureUnit(@GLuint int unit, @GLuint int texture); + + void glGetTextureImage(@GLuint int texture, int level, @GLenum int format, @GLenum int type, @AutoSize("pixels") @GLsizei int bufSize, + @OutParameter + @BufferObject(BufferKind.PackPBO) + @GLbyte + @GLshort + @GLint + @GLfloat + @GLdouble Buffer pixels); + + void glGetCompressedTextureImage(@GLuint int texture, int level, @AutoSize("pixels") @GLsizei int bufSize, + @OutParameter + @BufferObject(BufferKind.PackPBO) + @Check + @GLbyte + @GLshort + @GLint Buffer pixels); + + @StripPostfix("params") + void glGetTextureLevelParameterfv(@GLuint int texture, int level, @GLenum int pname, @OutParameter @Check("1") FloatBuffer params); + + @Alternate("glGetTextureLevelParameterfv") + @GLreturn("params") + @StripPostfix(value = "params", hasPostfix = false) + void glGetTextureLevelParameterfv2(@GLuint int texture, int level, @GLenum int pname, @OutParameter FloatBuffer params); + + @StripPostfix("params") + void glGetTextureLevelParameteriv(@GLuint int texture, int level, @GLenum int pname, @OutParameter @Check("1") IntBuffer params); + + @Alternate("glGetTextureLevelParameteriv") + @GLreturn("params") + @StripPostfix(value = "params", hasPostfix = false) + void glGetTextureLevelParameteriv2(@GLuint int texture, int level, @GLenum int pname, @OutParameter IntBuffer params); + + @StripPostfix("params") + void glGetTextureParameterfv(@GLuint int texture, @GLenum int pname, @OutParameter @Check("1") FloatBuffer params); + + @Alternate("glGetTextureParameterfv") + @GLreturn("params") + @StripPostfix(value = "params", hasPostfix = false) + void glGetTextureParameterfv2(@GLuint int texture, @GLenum int pname, @OutParameter FloatBuffer params); + + @StripPostfix("params") + void glGetTextureParameterIiv(@GLuint int texture, @GLenum int pname, @OutParameter @Check("1") IntBuffer params); + + @Alternate("glGetTextureParameterIiv") + @GLreturn("params") + @StripPostfix(value = "params", hasPostfix = false) + void glGetTextureParameterIiv2(@GLuint int texture, @GLenum int pname, @OutParameter IntBuffer params); + + @StripPostfix("params") + void glGetTextureParameterIuiv(@GLuint int texture, @GLenum int pname, @OutParameter @Check("1") @GLuint IntBuffer params); + + @Alternate("glGetTextureParameterIuiv") + @GLreturn("params") + @StripPostfix(value = "params", hasPostfix = false) + void glGetTextureParameterIuiv2(@GLuint int texture, @GLenum int pname, @OutParameter @GLuint IntBuffer params); + + @StripPostfix("params") + void glGetTextureParameteriv(@GLuint int texture, @GLenum int pname, @OutParameter @Check("1") IntBuffer params); + + @Alternate("glGetTextureParameteriv") + @GLreturn("params") + @StripPostfix(value = "params", hasPostfix = false) + void glGetTextureParameteriv2(@GLuint int texture, @GLenum int pname, @OutParameter IntBuffer params); + + // Vertex Array object functions + + void glCreateVertexArrays(@AutoSize("arrays") @GLsizei int n, @OutParameter @GLuint IntBuffer arrays); + + @Alternate("glCreateVertexArrays") + @GLreturn("arrays") + void glCreateVertexArrays2(@Constant("1") @GLsizei int n, @OutParameter @GLuint IntBuffer arrays); + + void glDisableVertexArrayAttrib(@GLuint int vaobj, @GLuint int index); + + void glEnableVertexArrayAttrib(@GLuint int vaobj, @GLuint int index); + + void glVertexArrayElementBuffer(@GLuint int vaobj, @GLuint int buffer); + + void glVertexArrayVertexBuffer(@GLuint int vaobj, @GLuint int bindingindex, @GLuint int buffer, @GLintptr long offset, @GLsizei int stride); + + void glVertexArrayVertexBuffers(@GLuint int vaobj, @GLuint int first, @GLsizei int count, + @Check(value = "count", canBeNull = true) @Const @GLuint IntBuffer buffers, + @Check(value = "count", canBeNull = true) @Const @GLintptr PointerBuffer offsets, + @Check(value = "count", canBeNull = true) @Const @GLsizei IntBuffer strides); + + void glVertexArrayAttribFormat(@GLuint int vaobj, @GLuint int attribindex, int size, @GLenum int type, boolean normalized, @GLuint int relativeoffset); + + void glVertexArrayAttribIFormat(@GLuint int vaobj, @GLuint int attribindex, int size, @GLenum int type, @GLuint int relativeoffset); + + void glVertexArrayAttribLFormat(@GLuint int vaobj, @GLuint int attribindex, int size, @GLenum int type, @GLuint int relativeoffset); + + void glVertexArrayAttribBinding(@GLuint int vaobj, @GLuint int attribindex, @GLuint int bindingindex); + + void glVertexArrayBindingDivisor(@GLuint int vaobj, @GLuint int bindingindex, @GLuint int divisor); + + @StripPostfix("param") + void glGetVertexArrayiv(@GLuint int vaobj, @GLenum int pname, @OutParameter @Check("1") IntBuffer param); + + @Alternate("glGetVertexArrayiv") + @GLreturn("param") + @StripPostfix("param") + void glGetVertexArrayiv2(@GLuint int vaobj, @GLenum int pname, @OutParameter IntBuffer param); + + @StripPostfix("param") + void glGetVertexArrayIndexediv(@GLuint int vaobj, @GLuint int index, @GLenum int pname, @OutParameter @Check("1") IntBuffer param); + + @Alternate("glGetVertexArrayIndexediv") + @GLreturn("param") + @StripPostfix("param") + void glGetVertexArrayIndexediv2(@GLuint int vaobj, @GLuint int index, @GLenum int pname, @OutParameter IntBuffer param); + + @StripPostfix("param") + void glGetVertexArrayIndexed64iv(@GLuint int vaobj, @GLuint int index, @GLenum int pname, @OutParameter @Check("1") @GLint64 LongBuffer param); + + @Alternate("glGetVertexArrayIndexed64iv") + @GLreturn("param") + @StripPostfix("param") + void glGetVertexArrayIndexed64iv2(@GLuint int vaobj, @GLuint int index, @GLenum int pname, @OutParameter @GLint64 LongBuffer param); + + // Sampler object functions + + void glCreateSamplers(@AutoSize("samplers") @GLsizei int n, @OutParameter @GLuint IntBuffer samplers); + + @Alternate("glCreateSamplers") + @GLreturn("samplers") + void glCreateSamplers2(@Constant("1") @GLsizei int n, @OutParameter @GLuint IntBuffer samplers); + + // Program Pipeline object functions + + void glCreateProgramPipelines(@AutoSize("pipelines") @GLsizei int n, @OutParameter @GLuint IntBuffer pipelines); + + @Alternate("glCreateProgramPipelines") + @GLreturn("pipelines") + void glCreateProgramPipelines2(@Constant("1") @GLsizei int n, @OutParameter @GLuint IntBuffer pipelines); + + // Query object functions + + void glCreateQueries(@GLenum int target, @AutoSize("ids") @GLsizei int n, @OutParameter @GLuint IntBuffer ids); + + @Alternate("glCreateQueries") + @GLreturn("ids") + void glCreateQueries2(@GLenum int target, @Constant("1") @GLsizei int n, @OutParameter @GLuint IntBuffer ids); + + // ----------------------------------------------------------------------- + // ----------------------[ ARB_ES3_1_compatibility ]---------------------- + // ----------------------------------------------------------------------- + + void glMemoryBarrierByRegion(@GLbitfield int barriers); + + // ------------------------------------------------------------------------- + // ----------------------[ ARB_get_texture_sub_image ]---------------------- + // ------------------------------------------------------------------------- + + void glGetTextureSubImage( + @GLuint int texture, int level, int xoffset, int yoffset, int zoffset, + @GLsizei int width, @GLsizei int height, @GLsizei int depth, + @GLenum int format, @GLenum int type, + @AutoSize("pixels") @GLsizei int bufSize, + @OutParameter + @BufferObject(BufferKind.PackPBO) + @GLbyte + @GLshort + @GLint + @GLfloat + @GLdouble Buffer pixels + ); + + void glGetCompressedTextureSubImage( + @GLuint int texture, int level, int xoffset, int yoffset, int zoffset, + @GLsizei int width, @GLsizei int height, @GLsizei int depth, + @AutoSize("pixels") @GLsizei int bufSize, + @OutParameter + @BufferObject(BufferKind.PackPBO) + @GLbyte + @GLshort + @GLint + @GLfloat + @GLdouble Buffer pixels + ); + + // ------------------------------------------------------------------- + // ----------------------[ ARB_texture_barrier ]---------------------- + // ------------------------------------------------------------------- + + void glTextureBarrier(); + + // ------------------------------------------------------------------------- + // ----------------------[ KHR_context_flush_control ]---------------------- + // ------------------------------------------------------------------------- + + /** + * Accepted by the <pname> parameter of GetIntegerv, GetFloatv, GetBooleanv + * GetDoublev and GetInteger64v: + */ + int GL_CONTEXT_RELEASE_BEHAVIOR = 0x82FB; + + /** + * Returned in <data> by GetIntegerv, GetFloatv, GetBooleanv + * GetDoublev and GetInteger64v when <pname> is + * GL_CONTEXT_RELEASE_BEHAVIOR: + */ + int GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH = 0x82FC; + + // -------------------------------------------------------------- + // ----------------------[ KHR_robustness ]---------------------- + // -------------------------------------------------------------- + + /** Returned by GetGraphicsResetStatus: */ + int GL_GUILTY_CONTEXT_RESET = 0x8253, + GL_INNOCENT_CONTEXT_RESET = 0x8254, + GL_UNKNOWN_CONTEXT_RESET = 0x8255; + + /** + * Accepted by the <value> parameter of GetBooleanv, GetIntegerv, + * and GetFloatv: + */ + int GL_CONTEXT_ROBUST_ACCESS = 0x90F3, + GL_RESET_NOTIFICATION_STRATEGY = 0x8256; + + /** + * Returned by GetIntegerv and related simple queries when <value> is + * RESET_NOTIFICATION_STRATEGY: + */ + int GL_LOSE_CONTEXT_ON_RESET = 0x8252, + GL_NO_RESET_NOTIFICATION = 0x8261; + + /** Returned by GetError: */ + int GL_CONTEXT_LOST = 0x0507; + + @GLenum + int glGetGraphicsResetStatus(); + + void glReadnPixels(int x, int y, @GLsizei int width, @GLsizei int height, @GLenum int format, @GLenum int type, @AutoSize("pixels") @GLsizei int bufSize, + @OutParameter + @BufferObject(BufferKind.PackPBO) + @GLbyte + @GLshort + @GLint + @GLfloat + @GLdouble Buffer pixels); + + @StripPostfix("params") + void glGetnUniformfv(@GLuint int program, int location, @AutoSize("params") @GLsizei int bufSize, @OutParameter FloatBuffer params); + + @StripPostfix("params") + void glGetnUniformiv(@GLuint int program, int location, @AutoSize("params") @GLsizei int bufSize, @OutParameter IntBuffer params); + + @StripPostfix("params") + void glGetnUniformuiv(@GLuint int program, int location, @AutoSize("params") @GLsizei int bufSize, @OutParameter @GLuint IntBuffer params); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/GREMEDY_frame_terminator.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/GREMEDY_frame_terminator.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/GREMEDY_frame_terminator.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/GREMEDY_frame_terminator.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2002-2012 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +public interface GREMEDY_frame_terminator { + + void glFrameTerminatorGREMEDY(); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/INTEL_map_texture.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/INTEL_map_texture.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/INTEL_map_texture.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/INTEL_map_texture.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2002-2012 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +import org.lwjgl.util.generator.*; +import org.lwjgl.util.generator.opengl.*; + +import java.nio.ByteBuffer; +import java.nio.IntBuffer; + +public interface INTEL_map_texture { + + /** Accepted by the <pname> parameter of TexParameteri, for target TEXTURE_2D */ + int GL_TEXTURE_MEMORY_LAYOUT_INTEL = 0x83FF; + + /** + * Accepted by the <params> when <pname> is set to + * <TEXTURE_MEMORY_LAYOUT_INTEL>: + */ + int GL_LAYOUT_DEFAULT_INTEL = 0, + GL_LAYOUT_LINEAR_INTEL = 1, + GL_LAYOUT_LINEAR_CPU_CACHED_INTEL = 2; + + /** + * The length parameter does not exist in the native API. It used by LWJGL to return a ByteBuffer + * with a proper capacity. + */ + @CachedResult(isRange = true) + @GLvoid + @AutoSize("length") + ByteBuffer glMapTexture2DINTEL(@GLuint int texture, int level, @Helper(passToNative = true) @GLsizeiptr long length, @GLbitfield int access, + @Check("1") @OutParameter IntBuffer stride, @Check("1") @OutParameter @GLenum IntBuffer layout); + + void glUnmapTexture2DINTEL(@GLuint int texture, int level); + + void glSyncTextureINTEL(@GLuint int texture); + +} diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/KHR_context_flush_control.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/KHR_context_flush_control.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/KHR_context_flush_control.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/KHR_context_flush_control.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2002-2014 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +public interface KHR_context_flush_control { + + /** + * Accepted by the <pname> parameter of GetIntegerv, GetFloatv, GetBooleanv + * GetDoublev and GetInteger64v: + */ + int GL_CONTEXT_RELEASE_BEHAVIOR = 0x82FB; + + /** + * Returned in <data> by GetIntegerv, GetFloatv, GetBooleanv + * GetDoublev and GetInteger64v when <pname> is + * GL_CONTEXT_RELEASE_BEHAVIOR: + */ + int GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH = 0x82FC; + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/KHR_debug.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/KHR_debug.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/KHR_debug.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/KHR_debug.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,229 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +import org.lwjgl.util.generator.*; +import org.lwjgl.util.generator.opengl.*; + +import java.nio.ByteBuffer; +import java.nio.IntBuffer; + +public interface KHR_debug { + + /** + * Tokens accepted by the <target> parameters of Enable, Disable, and + * IsEnabled: + */ + int GL_DEBUG_OUTPUT = 0x92E0, + GL_DEBUG_OUTPUT_SYNCHRONOUS = 0x8242; + + /** Returned by GetIntegerv when <pname> is CONTEXT_FLAGS: */ + int GL_CONTEXT_FLAG_DEBUG_BIT = 0x00000002; + + /** + * Tokens accepted by the <value> parameters of GetBooleanv, GetIntegerv, + * GetFloatv, GetDoublev and GetInteger64v: + */ + int GL_MAX_DEBUG_MESSAGE_LENGTH = 0x9143, + GL_MAX_DEBUG_LOGGED_MESSAGES = 0x9144, + GL_DEBUG_LOGGED_MESSAGES = 0x9145, + GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH = 0x8243, + GL_MAX_DEBUG_GROUP_STACK_DEPTH = 0x826C, + GL_DEBUG_GROUP_STACK_DEPTH = 0x826D, + GL_MAX_LABEL_LENGTH = 0x82E8; + + /** Tokens accepted by the <pname> parameter of GetPointerv: */ + int GL_DEBUG_CALLBACK_FUNCTION = 0x8244, + GL_DEBUG_CALLBACK_USER_PARAM = 0x8245; + + /** + * Tokens accepted or provided by the <source> parameters of + * DebugMessageControl, DebugMessageInsert and DEBUGPROC, and the <sources> + * parameter of GetDebugMessageLog: + */ + int GL_DEBUG_SOURCE_API = 0x8246, + GL_DEBUG_SOURCE_WINDOW_SYSTEM = 0x8247, + GL_DEBUG_SOURCE_SHADER_COMPILER = 0x8248, + GL_DEBUG_SOURCE_THIRD_PARTY = 0x8249, + GL_DEBUG_SOURCE_APPLICATION = 0x824A, + GL_DEBUG_SOURCE_OTHER = 0x824B; + + /** + * Tokens accepted or provided by the <type> parameters of + * DebugMessageControl, DebugMessageInsert and DEBUGPROC, and the <types> + * parameter of GetDebugMessageLog: + */ + int GL_DEBUG_TYPE_ERROR = 0x824C, + GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR = 0x824D, + GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR = 0x824E, + GL_DEBUG_TYPE_PORTABILITY = 0x824F, + GL_DEBUG_TYPE_PERFORMANCE = 0x8250, + GL_DEBUG_TYPE_OTHER = 0x8251, + GL_DEBUG_TYPE_MARKER = 0x8268; + + /** + * Tokens accepted or provided by the <type> parameters of + * DebugMessageControl and DEBUGPROC, and the <types> parameter of + * GetDebugMessageLog: + */ + int GL_DEBUG_TYPE_PUSH_GROUP = 0x8269, + GL_DEBUG_TYPE_POP_GROUP = 0x826A; + + /** + * Tokens accepted or provided by the <severity> parameters of + * DebugMessageControl, DebugMessageInsert and DEBUGPROC callback functions, + * and the <severities> parameter of GetDebugMessageLog: + */ + int GL_DEBUG_SEVERITY_HIGH = 0x9146, + GL_DEBUG_SEVERITY_MEDIUM = 0x9147, + GL_DEBUG_SEVERITY_LOW = 0x9148, + GL_DEBUG_SEVERITY_NOTIFICATION = 0x826B; + + /** + * Tokens accepted or provided by the <identifier> parameters of + * ObjectLabel and GetObjectLabel: + */ + int GL_BUFFER = 0x82E0, + GL_SHADER = 0x82E1, + GL_PROGRAM = 0x82E2, + GL_QUERY = 0x82E3, + GL_PROGRAM_PIPELINE = 0x82E4, + GL_SAMPLER = 0x82E6, + GL_DISPLAY_LIST = 0x82E7; + + // ----------------------------- + + @Reuse("GL43") + void glDebugMessageControl(@GLenum int source, + @GLenum int type, + @GLenum int severity, + @AutoSize(value = "ids", canBeNull = true) @GLsizei int count, + @Check(canBeNull = true) @Const @GLuint IntBuffer ids, + boolean enabled); + + @Reuse("GL43") + void glDebugMessageInsert(@GLenum int source, + @GLenum int type, + @GLuint int id, + @GLenum int severity, + @AutoSize("buf") @GLsizei int length, + @Const @GLchar ByteBuffer buf); + + @Reuse("GL43") + @Alternate("glDebugMessageInsert") + void glDebugMessageInsert(@GLenum int source, + @GLenum int type, + @GLuint int id, + @GLenum int severity, + @Constant("buf.length()") @GLsizei int length, + CharSequence buf); + + /** + * The {@code KHRDebugCallback.Handler} implementation passed to this method will be used for + * KHR_debug messages. If callback is null, any previously registered handler for the current + * thread will be unregistered and stop receiving messages. + * + * @param callback the callback function to use + */ + @Reuse("GL43") + void glDebugMessageCallback(@PointerWrapper(value = "GLDEBUGPROC", canBeNull = true) KHRDebugCallback callback, + @Constant("userParam") @PointerWrapper("GLvoid *") long userParam); + + @Reuse("GL43") + @GLuint + int glGetDebugMessageLog(@GLuint int count, + @AutoSize(value = "messageLog", canBeNull = true) @GLsizei int bufsize, + @Check(value = "count", canBeNull = true) @GLenum IntBuffer sources, + @Check(value = "count", canBeNull = true) @GLenum IntBuffer types, + @Check(value = "count", canBeNull = true) @GLuint IntBuffer ids, + @Check(value = "count", canBeNull = true) @GLenum IntBuffer severities, + @Check(value = "count", canBeNull = true) @GLsizei IntBuffer lengths, + @Check(canBeNull = true) @OutParameter @GLchar ByteBuffer messageLog); + + // Not really useful and a pain to implement in Java + // void glGetPointerv(@GLenum int pname, void** params); + + @Reuse("GL43") + void glPushDebugGroup(@GLenum int source, @GLuint int id, @AutoSize("message") @GLsizei int length, + @Const @GLchar ByteBuffer message); + + @Reuse("GL43") + @Alternate("glPushDebugGroup") + void glPushDebugGroup(@GLenum int source, @GLuint int id, @Constant("message.length()") @GLsizei int length, + CharSequence message); + + @Reuse("GL43") + void glPopDebugGroup(); + + @Reuse("GL43") + void glObjectLabel(@GLenum int identifier, @GLuint int name, @AutoSize(value = "label", canBeNull = true) @GLsizei int length, + @Check(canBeNull = true) @Const @GLchar ByteBuffer label); + + @Reuse("GL43") + @Alternate("glObjectLabel") + void glObjectLabel(@GLenum int identifier, @GLuint int name, @Constant("label.length()") @GLsizei int length, + CharSequence label); + + @Reuse("GL43") + void glGetObjectLabel(@GLenum int identifier, @GLuint int name, @AutoSize("label") @GLsizei int bufSize, + @OutParameter @Check(value = "1", canBeNull = true) @GLsizei IntBuffer length, + @OutParameter @GLchar ByteBuffer label); + + @Reuse("GL43") + @Alternate("glGetObjectLabel") + @GLreturn(value = "label", maxLength = "bufSize") + void glGetObjectLabel2(@GLenum int identifier, @GLuint int name, @GLsizei int bufSize, + @OutParameter @GLsizei @Constant("MemoryUtil.getAddress0(label_length)") IntBuffer length, + @OutParameter @GLchar ByteBuffer label); + + @Reuse("GL43") + void glObjectPtrLabel(@PointerWrapper("GLvoid *") org.lwjgl.PointerWrapper ptr, @AutoSize(value = "label", canBeNull = true) @GLsizei int length, + @Check(canBeNull = true) @Const @GLchar ByteBuffer label); + + @Reuse("GL43") + @Alternate("glObjectPtrLabel") + void glObjectPtrLabel(@PointerWrapper("GLvoid *") org.lwjgl.PointerWrapper ptr, @Constant("label.length()") @GLsizei int length, + CharSequence label); + + @Reuse("GL43") + void glGetObjectPtrLabel(@PointerWrapper("GLvoid *") org.lwjgl.PointerWrapper ptr, @AutoSize("label") @GLsizei int bufSize, + @OutParameter @Check(value = "1", canBeNull = true) @GLsizei IntBuffer length, + @OutParameter @GLchar ByteBuffer label); + + @Reuse("GL43") + @Alternate("glGetObjectPtrLabel") + @GLreturn(value = "label", maxLength = "bufSize") + void glGetObjectPtrLabel2(@PointerWrapper("GLvoid *") org.lwjgl.PointerWrapper ptr, @GLsizei int bufSize, + @OutParameter @GLsizei @Constant("MemoryUtil.getAddress0(label_length)") IntBuffer length, + @OutParameter @GLchar ByteBuffer label); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/KHR_robust_buffer_access_behavior.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/KHR_robust_buffer_access_behavior.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/KHR_robust_buffer_access_behavior.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/KHR_robust_buffer_access_behavior.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2002-2014 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +public interface KHR_robust_buffer_access_behavior { +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/KHR_robustness.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/KHR_robustness.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/KHR_robustness.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/KHR_robustness.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2002-2014 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +import org.lwjgl.util.generator.*; +import org.lwjgl.util.generator.opengl.*; + +import java.nio.Buffer; +import java.nio.FloatBuffer; +import java.nio.IntBuffer; + +@Extension(postfix = "") +public interface KHR_robustness { + + /** Returned by GetGraphicsResetStatus: */ + int GL_GUILTY_CONTEXT_RESET = 0x8253, + GL_INNOCENT_CONTEXT_RESET = 0x8254, + GL_UNKNOWN_CONTEXT_RESET = 0x8255; + + /** + * Accepted by the <value> parameter of GetBooleanv, GetIntegerv, + * and GetFloatv: + */ + int GL_CONTEXT_ROBUST_ACCESS = 0x90F3, + GL_RESET_NOTIFICATION_STRATEGY = 0x8256; + + /** + * Returned by GetIntegerv and related simple queries when <value> is + * RESET_NOTIFICATION_STRATEGY: + */ + int GL_LOSE_CONTEXT_ON_RESET = 0x8252, + GL_NO_RESET_NOTIFICATION = 0x8261; + + /** Returned by GetError: */ + int GL_CONTEXT_LOST = 0x0507; + + @Reuse("GL45") + @GLenum + int glGetGraphicsResetStatus(); + + @Reuse("GL45") + void glReadnPixels(int x, int y, @GLsizei int width, @GLsizei int height, @GLenum int format, @GLenum int type, @AutoSize("pixels") @GLsizei int bufSize, + @OutParameter + @BufferObject(BufferKind.PackPBO) + @GLbyte + @GLshort + @GLint + @GLfloat + @GLdouble Buffer pixels); + + @StripPostfix("params") + @Reuse("GL45") + void glGetnUniformfv(@GLuint int program, int location, @AutoSize("params") @GLsizei int bufSize, @OutParameter FloatBuffer params); + + @StripPostfix("params") + @Reuse("GL45") + void glGetnUniformiv(@GLuint int program, int location, @AutoSize("params") @GLsizei int bufSize, @OutParameter IntBuffer params); + + @StripPostfix("params") + @Reuse("GL45") + void glGetnUniformuiv(@GLuint int program, int location, @AutoSize("params") @GLsizei int bufSize, @OutParameter @GLuint IntBuffer params); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/KHR_texture_compression_astc_ldr.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/KHR_texture_compression_astc_ldr.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/KHR_texture_compression_astc_ldr.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/KHR_texture_compression_astc_ldr.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2002-2012 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +public interface KHR_texture_compression_astc_ldr { + + /** + * Accepted by the <internalformat> parameter of CompressedTexImage2D, + * CompressedTexSubImage2D, TexStorage2D, TextureStorage2D, TexStorage3D, + * and TextureStorage3D: + */ + int GL_COMPRESSED_RGBA_ASTC_4x4_KHR = 0x93B0, + GL_COMPRESSED_RGBA_ASTC_5x4_KHR = 0x93B1, + GL_COMPRESSED_RGBA_ASTC_5x5_KHR = 0x93B2, + GL_COMPRESSED_RGBA_ASTC_6x5_KHR = 0x93B3, + GL_COMPRESSED_RGBA_ASTC_6x6_KHR = 0x93B4, + GL_COMPRESSED_RGBA_ASTC_8x5_KHR = 0x93B5, + GL_COMPRESSED_RGBA_ASTC_8x6_KHR = 0x93B6, + GL_COMPRESSED_RGBA_ASTC_8x8_KHR = 0x93B7, + GL_COMPRESSED_RGBA_ASTC_10x5_KHR = 0x93B8, + GL_COMPRESSED_RGBA_ASTC_10x6_KHR = 0x93B9, + GL_COMPRESSED_RGBA_ASTC_10x8_KHR = 0x93BA, + GL_COMPRESSED_RGBA_ASTC_10x10_KHR = 0x93BB, + GL_COMPRESSED_RGBA_ASTC_12x10_KHR = 0x93BC, + GL_COMPRESSED_RGBA_ASTC_12x12_KHR = 0x93BD, + GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR = 0x93D0, + GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR = 0x93D1, + GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR = 0x93D2, + GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR = 0x93D3, + GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR = 0x93D4, + GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR = 0x93D5, + GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR = 0x93D6, + GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR = 0x93D7, + GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR = 0x93D8, + GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR = 0x93D9, + GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR = 0x93DA, + GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR = 0x93DB, + GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR = 0x93DC, + GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR = 0x93DD; + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/NV_bindless_multi_draw_indirect.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/NV_bindless_multi_draw_indirect.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/NV_bindless_multi_draw_indirect.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/NV_bindless_multi_draw_indirect.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2002-2013 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +import org.lwjgl.util.generator.BufferKind; +import org.lwjgl.util.generator.BufferObject; +import org.lwjgl.util.generator.Check; +import org.lwjgl.util.generator.Const; +import org.lwjgl.util.generator.opengl.GLenum; +import org.lwjgl.util.generator.opengl.GLsizei; +import org.lwjgl.util.generator.opengl.GLvoid; + +import java.nio.ByteBuffer; + +public interface NV_bindless_multi_draw_indirect { + + void glMultiDrawArraysIndirectBindlessNV(@GLenum int mode, + @BufferObject(BufferKind.IndirectBO) @Check("(stride == 0 ? 20 + 24 * vertexBufferCount : stride) * drawCount") @Const @GLvoid ByteBuffer indirect, + @GLsizei int drawCount, + @GLsizei int stride, + int vertexBufferCount); + + void glMultiDrawElementsIndirectBindlessNV(@GLenum int mode, + @GLenum int type, + @BufferObject(BufferKind.IndirectBO) @Check("(stride == 0 ? 48 + 24 * vertexBufferCount : stride) * drawCount") @Const @GLvoid ByteBuffer indirect, + @GLsizei int drawCount, + @GLsizei int stride, + int vertexBufferCount); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/NV_bindless_texture.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/NV_bindless_texture.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/NV_bindless_texture.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/NV_bindless_texture.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2002-2012 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +import org.lwjgl.util.generator.AutoSize; +import org.lwjgl.util.generator.Const; +import org.lwjgl.util.generator.StripPostfix; +import org.lwjgl.util.generator.opengl.GLenum; +import org.lwjgl.util.generator.opengl.GLsizei; +import org.lwjgl.util.generator.opengl.GLuint; +import org.lwjgl.util.generator.opengl.GLuint64; + +import java.nio.LongBuffer; + +public interface NV_bindless_texture { + + @GLuint64 + long glGetTextureHandleNV(@GLuint int texture); + + @GLuint64 + long glGetTextureSamplerHandleNV(@GLuint int texture, @GLuint int sampler); + + void glMakeTextureHandleResidentNV(@GLuint64 long handle); + + void glMakeTextureHandleNonResidentNV(@GLuint64 long handle); + + @GLuint64 + long glGetImageHandleNV(@GLuint int texture, int level, boolean layered, + int layer, @GLenum int format); + + void glMakeImageHandleResidentNV(@GLuint64 long handle, @GLenum int access); + + void glMakeImageHandleNonResidentNV(@GLuint64 long handle); + + void glUniformHandleui64NV(int location, @GLuint64 long value); + + @StripPostfix("value") + void glUniformHandleui64vNV(int location, @AutoSize("value") @GLsizei int count, @Const @GLuint64 LongBuffer value); + + void glProgramUniformHandleui64NV(@GLuint int program, int location, + @GLuint64 long value); + + @StripPostfix("values") + void glProgramUniformHandleui64vNV(@GLuint int program, int location, + @AutoSize("values") @GLsizei int count, @Const @GLuint64 LongBuffer values); + + boolean glIsTextureHandleResidentNV(@GLuint64 long handle); + + boolean glIsImageHandleResidentNV(@GLuint64 long handle); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/NV_blend_equation_advanced.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/NV_blend_equation_advanced.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/NV_blend_equation_advanced.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/NV_blend_equation_advanced.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,105 @@ +/* + * Copyright (c) 2002-2013 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +import org.lwjgl.util.generator.opengl.GLenum; + +public interface NV_blend_equation_advanced { + + /** + * Accepted by the <cap> parameter of Disable, Enable, and IsEnabled, and by + * the <pname> parameter of GetIntegerv, GetBooleanv, GetFloatv, GetDoublev + * and GetInteger64v: + */ + int GL_BLEND_ADVANCED_COHERENT_NV = 0x9285; + + /** + * Accepted by the <pname> parameter of BlendParameteriNV, GetBooleanv, + * GetIntegerv, GetInteger64v, GetFloatv, and GetDoublev: + */ + int GL_BLEND_PREMULTIPLIED_SRC_NV = 0x9280, + GL_BLEND_OVERLAP_NV = 0x9281; + + /** + * Accepted by the <value> parameter of BlendParameteriNV when <pname> is + * BLEND_OVERLAP_NV: + */ + int GL_UNCORRELATED_NV = 0x9282, + GL_DISJOINT_NV = 0x9283, + GL_CONJOINT_NV = 0x9284; + + /** Accepted by the <mode> parameter of BlendEquation and BlendEquationi: */ + int GL_SRC_NV = 0x9286, + GL_DST_NV = 0x9287, + GL_SRC_OVER_NV = 0x9288, + GL_DST_OVER_NV = 0x9289, + GL_SRC_IN_NV = 0x928A, + GL_DST_IN_NV = 0x928B, + GL_SRC_OUT_NV = 0x928C, + GL_DST_OUT_NV = 0x928D, + GL_SRC_ATOP_NV = 0x928E, + GL_DST_ATOP_NV = 0x928F, + GL_MULTIPLY_NV = 0x9294, + GL_SCREEN_NV = 0x9295, + GL_OVERLAY_NV = 0x9296, + GL_DARKEN_NV = 0x9297, + GL_LIGHTEN_NV = 0x9298, + GL_COLORDODGE_NV = 0x9299, + GL_COLORBURN_NV = 0x929A, + GL_HARDLIGHT_NV = 0x929B, + GL_SOFTLIGHT_NV = 0x929C, + GL_DIFFERENCE_NV = 0x929E, + GL_EXCLUSION_NV = 0x92A0, + GL_INVERT_RGB_NV = 0x92A3, + GL_LINEARDODGE_NV = 0x92A4, + GL_LINEARBURN_NV = 0x92A5, + GL_VIVIDLIGHT_NV = 0x92A6, + GL_LINEARLIGHT_NV = 0x92A7, + GL_PINLIGHT_NV = 0x92A8, + GL_HARDMIX_NV = 0x92A9, + GL_HSL_HUE_NV = 0x92AD, + GL_HSL_SATURATION_NV = 0x92AE, + GL_HSL_COLOR_NV = 0x92AF, + GL_HSL_LUMINOSITY_NV = 0x92B0, + GL_PLUS_NV = 0x9291, + GL_PLUS_CLAMPED_NV = 0x92B1, + GL_PLUS_CLAMPED_ALPHA_NV = 0x92B2, + GL_PLUS_DARKER_NV = 0x9292, + GL_MINUS_NV = 0x929F, + GL_MINUS_CLAMPED_NV = 0x92B3, + GL_CONTRAST_NV = 0x92A1, + GL_INVERT_OVG_NV = 0x92B4; + + void glBlendParameteriNV(@GLenum int pname, int value); + + void glBlendBarrierNV(); +} diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/NV_compute_program5.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/NV_compute_program5.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/NV_compute_program5.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/NV_compute_program5.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2002-2012 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +public interface NV_compute_program5 { + + /** + * Accepted by the <cap> parameter of Disable, Enable, and IsEnabled, + * by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, + * and GetDoublev, and by the <target> parameter of ProgramStringARB, + * BindProgramARB, ProgramEnvParameter4[df][v]ARB, + * ProgramLocalParameter4[df][v]ARB, GetProgramEnvParameter[df]vARB, + * GetProgramLocalParameter[df]vARB, GetProgramivARB and + * GetProgramStringARB: + */ + int GL_COMPUTE_PROGRAM_NV = 0x90FB; + + /** + * Accepted by the <target> parameter of ProgramBufferParametersfvNV, + * ProgramBufferParametersIivNV, and ProgramBufferParametersIuivNV, + * BindBufferRangeNV, BindBufferOffsetNV, BindBufferBaseNV, and BindBuffer + * and the <value> parameter of GetIntegerIndexedvEXT: + */ + int GL_COMPUTE_PROGRAM_PARAMETER_BUFFER_NV = 0x90FC; + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/NV_deep_texture3D.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/NV_deep_texture3D.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/NV_deep_texture3D.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/NV_deep_texture3D.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2002-2012 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +public interface NV_deep_texture3D { + + /** + * Accepted by the <pname> parameter of GetBooleanv, GetDoublev, GetIntegerv + * and GetFloatv: + */ + int GL_MAX_DEEP_3D_TEXTURE_WIDTH_HEIGHT_NV = 0x90D0, + GL_MAX_DEEP_3D_TEXTURE_DEPTH_NV = 0x90D1; + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/NV_draw_texture.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/NV_draw_texture.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/NV_draw_texture.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/NV_draw_texture.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2002-2012 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +import org.lwjgl.util.generator.opengl.GLfloat; +import org.lwjgl.util.generator.opengl.GLuint; + +public interface NV_draw_texture { + + void glDrawTextureNV(@GLuint int texture, @GLuint int sampler, + @GLfloat float x0, @GLfloat float y0, + @GLfloat float x1, @GLfloat float y1, + @GLfloat float z, + @GLfloat float s0, @GLfloat float t0, + @GLfloat float s1, @GLfloat float t1); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/NV_fence.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/NV_fence.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/NV_fence.java 2011-03-26 18:15:37.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/NV_fence.java 2016-04-09 16:26:56.000000000 +0000 @@ -54,7 +54,7 @@ void glDeleteFencesNV(@AutoSize("piFences") @GLsizei int n, @Const @GLuint IntBuffer piFences); @Alternate("glDeleteFencesNV") - void glDeleteFencesNV(@Constant("1") @GLsizei int n, @Const @GLuint @Constant(value = "APIUtil.getBufferInt().put(0, fence), 0", keepParam = true) int fence); + void glDeleteFencesNV(@Constant("1") @GLsizei int n, @Const @GLuint @Constant(value = "APIUtil.getInt(caps, fence)", keepParam = true) int fence); void glSetFenceNV(@GLuint int fence, @GLenum int condition); diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/NV_gpu_program5_mem_extended.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/NV_gpu_program5_mem_extended.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/NV_gpu_program5_mem_extended.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/NV_gpu_program5_mem_extended.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2002-2013 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +public interface NV_gpu_program5_mem_extended { + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/NV_gpu_shader5.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/NV_gpu_shader5.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/NV_gpu_shader5.java 2011-03-26 18:15:37.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/NV_gpu_shader5.java 2016-04-09 16:26:56.000000000 +0000 @@ -127,59 +127,59 @@ // ------------- - @Dependent("EXT_direct_state_access") + @Dependent("GL_EXT_direct_state_access") void glProgramUniform1i64NV(@GLuint int program, int location, @GLint64EXT long x); - @Dependent("EXT_direct_state_access") + @Dependent("GL_EXT_direct_state_access") void glProgramUniform2i64NV(@GLuint int program, int location, @GLint64EXT long x, @GLint64EXT long y); - @Dependent("EXT_direct_state_access") + @Dependent("GL_EXT_direct_state_access") void glProgramUniform3i64NV(@GLuint int program, int location, @GLint64EXT long x, @GLint64EXT long y, @GLint64EXT long z); - @Dependent("EXT_direct_state_access") + @Dependent("GL_EXT_direct_state_access") void glProgramUniform4i64NV(@GLuint int program, int location, @GLint64EXT long x, @GLint64EXT long y, @GLint64EXT long z, @GLint64EXT long w); - @Dependent("EXT_direct_state_access") + @Dependent("GL_EXT_direct_state_access") @StripPostfix("value") void glProgramUniform1i64vNV(@GLuint int program, int location, @AutoSize("value") @GLsizei int count, @Const @GLint64EXT LongBuffer value); - @Dependent("EXT_direct_state_access") + @Dependent("GL_EXT_direct_state_access") @StripPostfix("value") void glProgramUniform2i64vNV(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 1") @GLsizei int count, @Const @GLint64EXT LongBuffer value); - @Dependent("EXT_direct_state_access") + @Dependent("GL_EXT_direct_state_access") @StripPostfix("value") void glProgramUniform3i64vNV(@GLuint int program, int location, @AutoSize(value = "value", expression = " / 3") @GLsizei int count, @Const @GLint64EXT LongBuffer value); - @Dependent("EXT_direct_state_access") + @Dependent("GL_EXT_direct_state_access") @StripPostfix("value") void glProgramUniform4i64vNV(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 2") @GLsizei int count, @Const @GLint64EXT LongBuffer value); - @Dependent("EXT_direct_state_access") + @Dependent("GL_EXT_direct_state_access") void glProgramUniform1ui64NV(@GLuint int program, int location, @GLuint64EXT long x); - @Dependent("EXT_direct_state_access") + @Dependent("GL_EXT_direct_state_access") void glProgramUniform2ui64NV(@GLuint int program, int location, @GLuint64EXT long x, @GLuint64EXT long y); - @Dependent("EXT_direct_state_access") + @Dependent("GL_EXT_direct_state_access") void glProgramUniform3ui64NV(@GLuint int program, int location, @GLuint64EXT long x, @GLuint64EXT long y, @GLuint64EXT long z); - @Dependent("EXT_direct_state_access") + @Dependent("GL_EXT_direct_state_access") void glProgramUniform4ui64NV(@GLuint int program, int location, @GLuint64EXT long x, @GLuint64EXT long y, @GLuint64EXT long z, @GLuint64EXT long w); - @Dependent("EXT_direct_state_access") + @Dependent("GL_EXT_direct_state_access") @StripPostfix("value") void glProgramUniform1ui64vNV(@GLuint int program, int location, @AutoSize("value") @GLsizei int count, @Const @GLuint64EXT LongBuffer value); - @Dependent("EXT_direct_state_access") + @Dependent("GL_EXT_direct_state_access") @StripPostfix("value") void glProgramUniform2ui64vNV(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 1") @GLsizei int count, @Const @GLuint64EXT LongBuffer value); - @Dependent("EXT_direct_state_access") + @Dependent("GL_EXT_direct_state_access") @StripPostfix("value") void glProgramUniform3ui64vNV(@GLuint int program, int location, @AutoSize(value = "value", expression = " / 3") @GLsizei int count, @Const @GLuint64EXT LongBuffer value); - @Dependent("EXT_direct_state_access") + @Dependent("GL_EXT_direct_state_access") @StripPostfix("value") void glProgramUniform4ui64vNV(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 2") @GLsizei int count, @Const @GLuint64EXT LongBuffer value); diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/NV_half_float.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/NV_half_float.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/NV_half_float.java 2011-03-26 18:15:37.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/NV_half_float.java 2016-04-09 16:26:56.000000000 +0000 @@ -39,6 +39,7 @@ import java.nio.*; +@Dependent public interface NV_half_float { /** @@ -92,48 +93,50 @@ @NoErrorCheck void glMultiTexCoord4hNV(@GLenum int target, @GLhalf short s, @GLhalf short t, @GLhalf short r, @GLhalf short q); + @Dependent("GL_EXT_fog_coord") @NoErrorCheck void glFogCoordhNV(@GLhalf short fog); + @Dependent("GL_EXT_secondary_color") @NoErrorCheck void glSecondaryColor3hNV(@GLhalf short red, @GLhalf short green, @GLhalf short blue); - @Optional(reason = "AMD does not expose this (last driver checked: 10.9)") + @Dependent("GL_EXT_vertex_weighting") @NoErrorCheck void glVertexWeighthNV(@GLhalf short weight); - @Optional(reason = "AMD does not expose this (last driver checked: 10.9)") + @Dependent("GL_NV_vertex_program") @NoErrorCheck void glVertexAttrib1hNV(@GLuint int index, @GLhalf short x); - @Optional(reason = "AMD does not expose this (last driver checked: 10.9)") + @Dependent("GL_NV_vertex_program") @NoErrorCheck void glVertexAttrib2hNV(@GLuint int index, @GLhalf short x, @GLhalf short y); - @Optional(reason = "AMD does not expose this (last driver checked: 10.9)") + @Dependent("GL_NV_vertex_program") @NoErrorCheck void glVertexAttrib3hNV(@GLuint int index, @GLhalf short x, @GLhalf short y, @GLhalf short z); - @Optional(reason = "AMD does not expose this (last driver checked: 10.9)") + @Dependent("GL_NV_vertex_program") @NoErrorCheck void glVertexAttrib4hNV(@GLuint int index, @GLhalf short x, @GLhalf short y, @GLhalf short z, @GLhalf short w); - @Optional(reason = "AMD does not expose this (last driver checked: 10.9)") + @Dependent("GL_NV_vertex_program") @NoErrorCheck @StripPostfix("attribs") void glVertexAttribs1hvNV(@GLuint int index, @AutoSize("attribs") @GLsizei int n, @Const @GLhalf ShortBuffer attribs); - @Optional(reason = "AMD does not expose this (last driver checked: 10.9)") + @Dependent("GL_NV_vertex_program") @NoErrorCheck @StripPostfix("attribs") void glVertexAttribs2hvNV(@GLuint int index, @AutoSize(value = "attribs", expression = " >> 1") @GLsizei int n, @Const @GLhalf ShortBuffer attribs); - @Optional(reason = "AMD does not expose this (last driver checked: 10.9)") + @Dependent("GL_NV_vertex_program") @NoErrorCheck @StripPostfix("attribs") void glVertexAttribs3hvNV(@GLuint int index, @AutoSize(value = "attribs", expression = " / 3") @GLsizei int n, @Const @GLhalf ShortBuffer attribs); - @Optional(reason = "AMD does not expose this (last driver checked: 10.9)") + @Dependent("GL_NV_vertex_program") @NoErrorCheck @StripPostfix("attribs") void glVertexAttribs4hvNV(@GLuint int index, @AutoSize(value = "attribs", expression = " >> 2") @GLsizei int n, @Const @GLhalf ShortBuffer attribs); diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/NV_occlusion_query.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/NV_occlusion_query.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/NV_occlusion_query.java 2011-03-26 18:15:37.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/NV_occlusion_query.java 2016-04-09 16:26:56.000000000 +0000 @@ -59,7 +59,7 @@ void glDeleteOcclusionQueriesNV(@AutoSize("piIDs") @GLsizei int n, @Const @GLuint IntBuffer piIDs); @Alternate("glDeleteOcclusionQueriesNV") - void glDeleteOcclusionQueriesNV(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getBufferInt().put(0, piID), 0", keepParam = true) int piID); + void glDeleteOcclusionQueriesNV(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getInt(caps, piID)", keepParam = true) int piID); boolean glIsOcclusionQueryNV(@GLuint int id); @@ -72,7 +72,7 @@ @Alternate("glGetOcclusionQueryuivNV") @GLreturn("params") - @StripPostfix(value = "params", postfix = "v") + @StripPostfix(value = "params", hasPostfix = false) void glGetOcclusionQueryuivNV2(@GLuint int id, @GLenum int pname, @OutParameter @GLuint IntBuffer params); @StripPostfix("params") @@ -80,6 +80,6 @@ @Alternate("glGetOcclusionQueryivNV") @GLreturn("params") - @StripPostfix(value = "params", postfix = "v") + @StripPostfix(value = "params", hasPostfix = false) void glGetOcclusionQueryivNV2(@GLuint int id, @GLenum int pname, @OutParameter IntBuffer params); } diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/NV_path_rendering.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/NV_path_rendering.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/NV_path_rendering.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/NV_path_rendering.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,515 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +import org.lwjgl.util.generator.*; +import org.lwjgl.util.generator.opengl.*; + +import java.nio.ByteBuffer; +import java.nio.FloatBuffer; +import java.nio.IntBuffer; + +public interface NV_path_rendering { + + /** + * Accepted in elements of the <commands> array parameter of + * PathCommandsNV and PathSubCommandsNV: + */ + int GL_CLOSE_PATH_NV = 0x00, + GL_MOVE_TO_NV = 0x02, + GL_RELATIVE_MOVE_TO_NV = 0x03, + GL_LINE_TO_NV = 0x04, + GL_RELATIVE_LINE_TO_NV = 0x05, + GL_HORIZONTAL_LINE_TO_NV = 0x06, + GL_RELATIVE_HORIZONTAL_LINE_TO_NV = 0x07, + GL_VERTICAL_LINE_TO_NV = 0x08, + GL_RELATIVE_VERTICAL_LINE_TO_NV = 0x09, + GL_QUADRATIC_CURVE_TO_NV = 0x0A, + GL_RELATIVE_QUADRATIC_CURVE_TO_NV = 0x0B, + GL_CUBIC_CURVE_TO_NV = 0x0C, + GL_RELATIVE_CUBIC_CURVE_TO_NV = 0x0D, + GL_SMOOTH_QUADRATIC_CURVE_TO_NV = 0x0E, + GL_RELATIVE_SMOOTH_QUADRATIC_CURVE_TO_NV = 0x0F, + GL_SMOOTH_CUBIC_CURVE_TO_NV = 0x10, + GL_RELATIVE_SMOOTH_CUBIC_CURVE_TO_NV = 0x11, + GL_SMALL_CCW_ARC_TO_NV = 0x12, + GL_RELATIVE_SMALL_CCW_ARC_TO_NV = 0x13, + GL_SMALL_CW_ARC_TO_NV = 0x14, + GL_RELATIVE_SMALL_CW_ARC_TO_NV = 0x15, + GL_LARGE_CCW_ARC_TO_NV = 0x16, + GL_RELATIVE_LARGE_CCW_ARC_TO_NV = 0x17, + GL_LARGE_CW_ARC_TO_NV = 0x18, + GL_RELATIVE_LARGE_CW_ARC_TO_NV = 0x19, + GL_CIRCULAR_CCW_ARC_TO_NV = 0xF8, + GL_CIRCULAR_CW_ARC_TO_NV = 0xFA, + GL_CIRCULAR_TANGENT_ARC_TO_NV = 0xFC, + GL_ARC_TO_NV = 0xFE, + GL_RELATIVE_ARC_TO_NV = 0xFF; + + /** Accepted by the <format> parameter of PathStringNV: */ + int GL_PATH_FORMAT_SVG_NV = 0x9070, + GL_PATH_FORMAT_PS_NV = 0x9071; + + /** + * Accepted by the <fontTarget> parameter of PathGlyphsNV and + * PathGlyphRangeNV: + */ + int GL_STANDARD_FONT_NAME_NV = 0x9072, + GL_SYSTEM_FONT_NAME_NV = 0x9073, + GL_FILE_NAME_NV = 0x9074; + + /** + * Accepted by the <handleMissingGlyph> parameter of PathGlyphsNV and + * PathGlyphRangeNV: + */ + int GL_SKIP_MISSING_GLYPH_NV = 0x90A9, + GL_USE_MISSING_GLYPH_NV = 0x90AA; + + /** + * Accepted by the <pname> parameter of PathParameterfNV, + * PathParameterfvNV, GetPathParameterfvNV, PathParameteriNV, + * PathParameterivNV, and GetPathParameterivNV: + */ + int GL_PATH_STROKE_WIDTH_NV = 0x9075, + GL_PATH_INITIAL_END_CAP_NV = 0x9077, + GL_PATH_TERMINAL_END_CAP_NV = 0x9078, + GL_PATH_JOIN_STYLE_NV = 0x9079, + GL_PATH_MITER_LIMIT_NV = 0x907A, + GL_PATH_INITIAL_DASH_CAP_NV = 0x907C, + GL_PATH_TERMINAL_DASH_CAP_NV = 0x907D, + GL_PATH_DASH_OFFSET_NV = 0x907E, + GL_PATH_CLIENT_LENGTH_NV = 0x907F, + GL_PATH_DASH_OFFSET_RESET_NV = 0x90B4, + + GL_PATH_FILL_MODE_NV = 0x9080, + GL_PATH_FILL_MASK_NV = 0x9081, + GL_PATH_FILL_COVER_MODE_NV = 0x9082, + GL_PATH_STROKE_COVER_MODE_NV = 0x9083, + GL_PATH_STROKE_MASK_NV = 0x9084; + + /** + * Accepted by the <pname> parameter of PathParameterfNV and + * PathParameterfvNV: + */ + int GL_PATH_END_CAPS_NV = 0x9076, + GL_PATH_DASH_CAPS_NV = 0x907B; + + /** + * Accepted by the <fillMode> parameter of StencilFillPathNV and + * StencilFillPathInstancedNV: + */ + int GL_COUNT_UP_NV = 0x9088, + GL_COUNT_DOWN_NV = 0x9089; + + /** + * Accepted by the <color> parameter of PathColorGenNV, + * GetPathColorGenivNV, and GetPathColorGenfvNV: + */ + int GL_PRIMARY_COLOR = 0x8577, // from OpenGL 1.3 + GL_PRIMARY_COLOR_NV = 0x852C, // from NV_register_combiners + GL_SECONDARY_COLOR_NV = 0x852D; // from NV_register_combiners + + /** + * Accepted by the <genMode> parameter of PathColorGenNV and + * PathTexGenNV: + */ + int GL_PATH_OBJECT_BOUNDING_BOX_NV = 0x908A; + + /** + * Accepted by the <coverMode> parameter of CoverFillPathNV and + * CoverFillPathInstancedNV: + */ + int GL_CONVEX_HULL_NV = 0x908B, + GL_BOUNDING_BOX_NV = 0x908D; + + /** + * Accepted by the <transformType> parameter of + * StencilFillPathInstancedNV, StencilStrokePathInstancedNV, + * CoverFillPathInstancedNV, and CoverStrokePathInstancedNV: + */ + int GL_TRANSLATE_X_NV = 0x908E, + GL_TRANSLATE_Y_NV = 0x908F, + GL_TRANSLATE_2D_NV = 0x9090, + GL_TRANSLATE_3D_NV = 0x9091, + GL_AFFINE_2D_NV = 0x9092, + GL_AFFINE_3D_NV = 0x9094, + GL_TRANSPOSE_AFFINE_2D_NV = 0x9096, + GL_TRANSPOSE_AFFINE_3D_NV = 0x9098; + + /** + * Accepted by the <type> or <pathNameType> parameter of CallLists, + * StencilFillPathInstancedNV, StencilStrokePathInstancedNV, + * CoverFillPathInstancedNV, CoverStrokePathInstancedNV, + * GetPathMetricsNV, and GetPathSpacingNV: + */ + int GL_UTF8_NV = 0x909A, + GL_UTF16_NV = 0x909B; + + /** Accepted by the <coverMode> parameter of CoverFillPathInstancedNV: */ + int GL_BOUNDING_BOX_OF_BOUNDING_BOXES_NV = 0x909C; + + /** + * Accepted by the <pname> parameter of GetPathParameterfvNV and + * GetPathParameterivNV: + */ + int GL_PATH_COMMAND_COUNT_NV = 0x909D, + GL_PATH_COORD_COUNT_NV = 0x909E, + GL_PATH_DASH_ARRAY_COUNT_NV = 0x909F, + GL_PATH_COMPUTED_LENGTH_NV = 0x90A0, + GL_PATH_FILL_BOUNDING_BOX_NV = 0x90A1, + GL_PATH_STROKE_BOUNDING_BOX_NV = 0x90A2; + + /** + * Accepted by the <value> parameter of PathParameterfNV, + * PathParameterfvNV, PathParameteriNV, and PathParameterivNV + * when <pname> is one of PATH_END_CAPS_NV, PATH_INTIAL_END_CAP_NV, + * PATH_TERMINAL_END_CAP_NV, PATH_DASH_CAPS_NV, PATH_INITIAL_DASH_CAP_NV, + * and PATH_TERMINAL_DASH_CAP_NV: + */ + int GL_SQUARE_NV = 0x90A3, + GL_ROUND_NV = 0x90A4, + GL_TRIANGULAR_NV = 0x90A5; + + /** + * Accepted by the <value> parameter of PathParameterfNV, + * PathParameterfvNV, PathParameteriNV, and PathParameterivNV + * when <pname> is PATH_JOIN_STYLE_NV: + */ + int GL_BEVEL_NV = 0x90A6, + GL_MITER_REVERT_NV = 0x90A7, + GL_MITER_TRUNCATE_NV = 0x90A8; + + /** + * Accepted by the <value> parameter of PathParameterfNV, + * PathParameterfvNV, PathParameteriNV, and PathParameterivNV when + * <pname> is PATH_DASH_OFFSET_RESET_NV + */ + int GL_MOVE_TO_RESETS_NV = 0x90B5, + GL_MOVE_TO_CONTINUES_NV = 0x90B6; + + /** Accepted by the <fontStyle> parameter of PathStringNV: */ + int GL_BOLD_BIT_NV = 0x01, + GL_ITALIC_BIT_NV = 0x02; + + /** + * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, + * GetInteger64v, GetFloatv, and GetDoublev: + */ + int GL_PATH_ERROR_POSITION_NV = 0x90AB, + + GL_PATH_FOG_GEN_MODE_NV = 0x90AC, + + GL_PATH_STENCIL_FUNC_NV = 0x90B7, + GL_PATH_STENCIL_REF_NV = 0x90B8, + GL_PATH_STENCIL_VALUE_MASK_NV = 0x90B9, + + GL_PATH_STENCIL_DEPTH_OFFSET_FACTOR_NV = 0x90BD, + GL_PATH_STENCIL_DEPTH_OFFSET_UNITS_NV = 0x90BE, + + GL_PATH_COVER_DEPTH_FUNC_NV = 0x90BF; + + /** + * Accepted as a bit within the <metricQueryMask> parameter of + * GetPathMetricRangeNV or GetPathMetricsNV: + */ + + int GL_GLYPH_WIDTH_BIT_NV = 0x01, // per-glyph metrics + GL_GLYPH_HEIGHT_BIT_NV = 0x02, + GL_GLYPH_HORIZONTAL_BEARING_X_BIT_NV = 0x04, + GL_GLYPH_HORIZONTAL_BEARING_Y_BIT_NV = 0x08, + GL_GLYPH_HORIZONTAL_BEARING_ADVANCE_BIT_NV = 0x10, + GL_GLYPH_VERTICAL_BEARING_X_BIT_NV = 0x20, + GL_GLYPH_VERTICAL_BEARING_Y_BIT_NV = 0x40, + GL_GLYPH_VERTICAL_BEARING_ADVANCE_BIT_NV = 0x80, + GL_GLYPH_HAS_KERNING_NV = 0x100, + GL_FONT_X_MIN_BOUNDS_NV = 0x00010000, // per-font face metrics + GL_FONT_Y_MIN_BOUNDS_NV = 0x00020000, + GL_FONT_X_MAX_BOUNDS_NV = 0x00040000, + GL_FONT_Y_MAX_BOUNDS_NV = 0x00080000, + GL_FONT_UNITS_PER_EM_NV = 0x00100000, + GL_FONT_ASCENDER_NV = 0x00200000, + GL_FONT_DESCENDER_NV = 0x00400000, + GL_FONT_HEIGHT_NV = 0x00800000, + GL_FONT_MAX_ADVANCE_WIDTH_NV = 0x01000000, + GL_FONT_MAX_ADVANCE_HEIGHT_NV = 0x02000000, + GL_FONT_UNDERLINE_POSITION_NV = 0x04000000, + GL_FONT_UNDERLINE_THICKNESS_NV = 0x08000000, + GL_FONT_HAS_KERNING_NV = 0x10000000; + + /** Accepted by the <pathListMode> parameter of GetPathSpacingNV: */ + int GL_ACCUM_ADJACENT_PAIRS_NV = 0x90AD, + GL_ADJACENT_PAIRS_NV = 0x90AE, + GL_FIRST_TO_REST_NV = 0x90AF; + + /** + * Accepted by the <pname> parameter of GetPathColorGenivNV, + * GetPathColorGenfvNV, GetPathTexGenivNV and GetPathTexGenfvNV: + */ + int GL_PATH_GEN_MODE_NV = 0x90B0, + GL_PATH_GEN_COEFF_NV = 0x90B1, + GL_PATH_GEN_COLOR_FORMAT_NV = 0x90B2, + GL_PATH_GEN_COMPONENTS_NV = 0x90B3; + + void glPathCommandsNV(@GLuint int path, + @AutoSize("commands") @GLsizei int numCommands, @Const @GLubyte ByteBuffer commands, + @AutoSize("coords") @GLsizei int numCoords, @GLenum int coordType, + @Const @GLvoid ByteBuffer coords); + + void glPathCoordsNV(@GLuint int path, + @AutoSize("coords") @GLsizei int numCoords, @GLenum int coordType, + @Const @GLvoid ByteBuffer coords); + + void glPathSubCommandsNV(@GLuint int path, + @GLsizei int commandStart, @GLsizei int commandsToDelete, + @AutoSize("commands") @GLsizei int numCommands, @Const @GLubyte ByteBuffer commands, + @AutoSize("coords") @GLsizei int numCoords, @GLenum int coordType, + @Const @GLvoid ByteBuffer coords); + + void glPathSubCoordsNV(@GLuint int path, + @GLsizei int coordStart, + @AutoSize("coords") @GLsizei int numCoords, @GLenum int coordType, + @Const @GLvoid ByteBuffer coords); + + void glPathStringNV(@GLuint int path, @GLenum int format, + @AutoSize("pathString") @GLsizei int length, @Const @GLvoid ByteBuffer pathString); + + void glPathGlyphsNV(@GLuint int firstPathName, + @GLenum int fontTarget, + @NullTerminated @Const @GLvoid ByteBuffer fontName, + @GLbitfield int fontStyle, + @AutoSize(value = "charcodes", expression = " / GLChecks.calculateBytesPerCharCode(type)") @GLsizei int numGlyphs, @GLenum int type, + @Const @GLvoid ByteBuffer charcodes, + @GLenum int handleMissingGlyphs, + @GLuint int pathParameterTemplate, + float emScale); + + void glPathGlyphRangeNV(@GLuint int firstPathName, + @GLenum int fontTarget, + @NullTerminated @Const @GLvoid ByteBuffer fontName, + @GLbitfield int fontStyle, + @GLuint int firstGlyph, + @GLsizei int numGlyphs, + @GLenum int handleMissingGlyphs, + @GLuint int pathParameterTemplate, + float emScale); + + void glWeightPathsNV(@GLuint int resultPath, + @AutoSize("paths") @GLsizei int numPaths, + @Const @GLuint IntBuffer paths, @Check("paths.remaining()") @Const FloatBuffer weights); + + void glCopyPathNV(@GLuint int resultPath, @GLuint int srcPath); + + void glInterpolatePathsNV(@GLuint int resultPath, + @GLuint int pathA, @GLuint int pathB, + float weight); + + void glTransformPathNV(@GLuint int resultPath, + @GLuint int srcPath, + @GLenum int transformType, + @Check(value = "GLChecks.calculateTransformPathValues(transformType)", canBeNull = true) @Const FloatBuffer transformValues); + + @StripPostfix("value") + void glPathParameterivNV(@GLuint int path, @GLenum int pname, @Check("4") @Const IntBuffer value); + + void glPathParameteriNV(@GLuint int path, @GLenum int pname, int value); + + @StripPostfix("value") + void glPathParameterfvNV(@GLuint int path, @GLenum int pname, @Check("4") @Const FloatBuffer value); + + void glPathParameterfNV(@GLuint int path, @GLenum int pname, float value); + + void glPathDashArrayNV(@GLuint int path, + @AutoSize("dashArray") @GLsizei int dashCount, @Const FloatBuffer dashArray); + + // PATH NAME MANAGEMENT + + @GLuint + int glGenPathsNV(@GLsizei int range); + + void glDeletePathsNV(@GLuint int path, @GLsizei int range); + + boolean glIsPathNV(@GLuint int path); + + // PATH STENCILING + + void glPathStencilFuncNV(@GLenum int func, int ref, @GLuint int mask); + + void glPathStencilDepthOffsetNV(float factor, int units); + + void glStencilFillPathNV(@GLuint int path, + @GLenum int fillMode, @GLuint int mask); + + void glStencilStrokePathNV(@GLuint int path, + int reference, @GLuint int mask); + + void glStencilFillPathInstancedNV(@AutoSize(value="paths", expression = " / GLChecks.calculateBytesPerPathName(pathNameType)") @GLsizei int numPaths, + @GLenum int pathNameType, @Const @GLvoid ByteBuffer paths, + @GLuint int pathBase, + @GLenum int fillMode, @GLuint int mask, + @GLenum int transformType, + @Check(value = "GLChecks.calculateTransformPathValues(transformType)", canBeNull = true) @Const FloatBuffer transformValues); + + void glStencilStrokePathInstancedNV(@AutoSize(value = "paths", expression = " / GLChecks.calculateBytesPerPathName(pathNameType)") @GLsizei int numPaths, + @GLenum int pathNameType, @Const @GLvoid ByteBuffer paths, + @GLuint int pathBase, + int reference, @GLuint int mask, + @GLenum int transformType, + @Check(value = "GLChecks.calculateTransformPathValues(transformType)", canBeNull = true) @Const FloatBuffer transformValues); + + // PATH COVERING + + void glPathCoverDepthFuncNV(@GLenum int zfunc); + + void glPathColorGenNV(@GLenum int color, + @GLenum int genMode, + @GLenum int colorFormat, @Check(value = "GLChecks.calculatePathColorGenCoeffsCount(genMode, colorFormat)", canBeNull = true) @Const FloatBuffer coeffs); + + void glPathTexGenNV(@GLenum int texCoordSet, + @GLenum int genMode, + @AutoSize(value="coeffs", expression="GLChecks.calculatePathTextGenCoeffsPerComponent(coeffs, genMode)", useExpression = true, canBeNull = true) int components, @Check(canBeNull = true) @Const FloatBuffer coeffs); + + void glPathFogGenNV(@GLenum int genMode); + + void glCoverFillPathNV(@GLuint int path, @GLenum int coverMode); + + void glCoverStrokePathNV(@GLuint int name, @GLenum int coverMode); + + void glCoverFillPathInstancedNV(@AutoSize(value = "paths", expression = " / GLChecks.calculateBytesPerPathName(pathNameType)") @GLsizei int numPaths, + @GLenum int pathNameType, @Const @GLvoid ByteBuffer paths, + @GLuint int pathBase, + @GLenum int coverMode, + @GLenum int transformType, + @Check(value = "GLChecks.calculateTransformPathValues(transformType)", canBeNull = true) @Const FloatBuffer transformValues); + + void glCoverStrokePathInstancedNV(@AutoSize(value = "paths", expression = " / GLChecks.calculateBytesPerPathName(pathNameType)") @GLsizei int numPaths, + @GLenum int pathNameType, @Const @GLvoid ByteBuffer paths, + @GLuint int pathBase, + @GLenum int coverMode, + @GLenum int transformType, + @Check(value = "GLChecks.calculateTransformPathValues(transformType)", canBeNull = true) @Const FloatBuffer transformValues); + + // PATH QUERIES + + @StripPostfix("value") + void glGetPathParameterivNV(@GLuint int name, @GLenum int param, @Check("4") @OutParameter IntBuffer value); + + @Alternate("glGetPathParameterivNV") + @GLreturn("value") + @StripPostfix(value = "value", hasPostfix = false) + void glGetPathParameterivNV2(@GLuint int name, @GLenum int param, @OutParameter IntBuffer value); + + void glGetPathParameterfvNV(@GLuint int name, @GLenum int param, @Check("4") @OutParameter FloatBuffer value); + + @Alternate("glGetPathParameterfvNV") + @GLreturn("value") + @StripPostfix(value = "value", hasPostfix = false) + void glGetPathParameterfvNV2(@GLuint int name, @GLenum int param, @OutParameter FloatBuffer value); + + void glGetPathCommandsNV(@GLuint int name, @Check @OutParameter @GLubyte ByteBuffer commands); + + void glGetPathCoordsNV(@GLuint int name, @Check @OutParameter FloatBuffer coords); + + void glGetPathDashArrayNV(@GLuint int name, @Check @OutParameter FloatBuffer dashArray); + + void glGetPathMetricsNV(@GLbitfield int metricQueryMask, + @AutoSize(value = "paths", expression = " / GLChecks.calculateBytesPerPathName(pathNameType)") @GLsizei int numPaths, + @GLenum int pathNameType, @Const @GLvoid ByteBuffer paths, + @GLuint int pathBase, + @GLsizei int stride, + @Check("GLChecks.calculateMetricsSize(metricQueryMask, stride)") @OutParameter FloatBuffer metrics); + + void glGetPathMetricRangeNV(@GLbitfield int metricQueryMask, + @GLuint int fistPathName, + @GLsizei int numPaths, + @GLsizei int stride, + @Check("GLChecks.calculateMetricsSize(metricQueryMask, stride)") @OutParameter FloatBuffer metrics); + + @Code("\t\tint numPaths = paths.remaining() / GLChecks.calculateBytesPerPathName(pathNameType);") + void glGetPathSpacingNV(@GLenum int pathListMode, + @AutoSize(value = "paths", expression = "numPaths", useExpression = true) @GLsizei int numPaths, + @GLenum int pathNameType, @Const @GLvoid ByteBuffer paths, + @GLuint int pathBase, + float advanceScale, + float kerningScale, + @GLenum int transformType, + @Check("numPaths - 1") @OutParameter FloatBuffer returnedSpacing); + + @StripPostfix("value") + void glGetPathColorGenivNV(@GLenum int color, @GLenum int pname, @Check("16") @OutParameter IntBuffer value); + + @Alternate("glGetPathColorGenivNV") + @GLreturn("value") + @StripPostfix(value = "value", hasPostfix = false) + void glGetPathColorGenivNV2(@GLenum int color, @GLenum int pname, @OutParameter IntBuffer value); + + @StripPostfix("value") + void glGetPathColorGenfvNV(@GLenum int color, @GLenum int pname, @Check("16") @OutParameter FloatBuffer value); + + @Alternate("glGetPathColorGenfvNV") + @GLreturn("value") + @StripPostfix(value = "value", hasPostfix = false) + void glGetPathColorGenfvNV2(@GLenum int color, @GLenum int pname, @OutParameter FloatBuffer value); + + @StripPostfix("value") + void glGetPathTexGenivNV(@GLenum int texCoordSet, @GLenum int pname, @Check("16") @OutParameter IntBuffer value); + + @Alternate("glGetPathTexGenivNV") + @GLreturn("value") + @StripPostfix(value = "value", hasPostfix = false) + void glGetPathTexGenivNV2(@GLenum int texCoordSet, @GLenum int pname, @OutParameter IntBuffer value); + + @StripPostfix("value") + void glGetPathTexGenfvNV(@GLenum int texCoordSet, @GLenum int pname, @Check("16") @OutParameter FloatBuffer value); + + @Alternate("glGetPathTexGenfvNV") + @GLreturn("value") + @StripPostfix(value = "value", hasPostfix = false) + void glGetPathTexGenfvNV2(@GLenum int texCoordSet, @GLenum int pname, @OutParameter FloatBuffer value); + + boolean glIsPointInFillPathNV(@GLuint int path, + @GLuint int mask, float x, float y); + + boolean glIsPointInStrokePathNV(@GLuint int path, + float x, float y); + + float glGetPathLengthNV(@GLuint int path, + @GLsizei int startSegment, @GLsizei int numSegments); + + boolean glPointAlongPathNV(@GLuint int path, + @GLsizei int startSegment, @GLsizei int numSegments, + float distance, + @Check(value = "1", canBeNull = true) @OutParameter FloatBuffer x, + @Check(value = "1", canBeNull = true) @OutParameter FloatBuffer y, + @Check(value = "1", canBeNull = true) @OutParameter FloatBuffer tangentX, + @Check(value = "1", canBeNull = true) @OutParameter FloatBuffer tangentY); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/NV_present_video.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/NV_present_video.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/NV_present_video.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/NV_present_video.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,116 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +import org.lwjgl.util.generator.Alternate; +import org.lwjgl.util.generator.Check; +import org.lwjgl.util.generator.OutParameter; +import org.lwjgl.util.generator.StripPostfix; +import org.lwjgl.util.generator.opengl.*; + +import java.nio.IntBuffer; +import java.nio.LongBuffer; + +public interface NV_present_video { + + /** + * Accepted by the <type> parameter of PresentFrameKeyedNV and + * PresentFrameDualFillNV: + */ + int GL_FRAME_NV = 0x8E26, + FIELDS_NV = 0x8E27; + + /** + * Accepted by the <pname> parameter of GetVideoivNV, GetVideouivNV, + * GetVideoi64vNV, GetVideoui64vNV: + */ + int GL_CURRENT_TIME_NV = 0x8E28, + GL_NUM_FILL_STREAMS_NV = 0x8E29; + + /** Accepted by the <target> parameter of GetQueryiv: */ + int GL_PRESENT_TIME_NV = 0x8E2A, + GL_PRESENT_DURATION_NV = 0x8E2B; + + /** Accepted by the <attribute> parameter of NVPresentVideoUtil.glQueryContextNV: */ + int GL_NUM_VIDEO_SLOTS_NV = 0x20F0; // GLX_NUM_VIDEO_SLOTS_NV & WGL_NUM_VIDEO_SLOTS_NV + + void glPresentFrameKeyedNV(@GLuint int video_slot, + @GLuint64EXT long minPresentTime, + @GLuint int beginPresentTimeId, + @GLuint int presentDurationId, + @GLenum int type, + @GLenum int target0, @GLuint int fill0, @GLuint int key0, + @GLenum int target1, @GLuint int fill1, @GLuint int key1); + + void glPresentFrameDualFillNV(@GLuint int video_slot, + @GLuint64EXT long minPresentTime, + @GLuint int beginPresentTimeId, + @GLuint int presentDurationId, + @GLenum int type, + @GLenum int target0, @GLuint int fill0, + @GLenum int target1, @GLuint int fill1, + @GLenum int target2, @GLuint int fill2, + @GLenum int target3, @GLuint int fill3); + + @StripPostfix("params") + void glGetVideoivNV(@GLuint int video_slot, @GLenum int pname, @OutParameter @Check("1") IntBuffer params); + + @Alternate("glGetVideoivNV") + @GLreturn("params") + @StripPostfix(value = "params", hasPostfix = false) + void glGetVideoivNV2(@GLuint int video_slot, @GLenum int pname, @OutParameter IntBuffer params); + + @StripPostfix("params") + void glGetVideouivNV(@GLuint int video_slot, @GLenum int pname, @OutParameter @Check("1") @GLuint IntBuffer params); + + @Alternate("glGetVideouivNV") + @GLreturn("params") + @StripPostfix(value = "params", hasPostfix = false) + void glGetVideouivNV2(@GLuint int video_slot, @GLenum int pname, @OutParameter @GLuint IntBuffer params); + + @StripPostfix("params") + void glGetVideoi64vNV(@GLuint int video_slot, @GLenum int pname, @OutParameter @Check("1") @GLint64EXT LongBuffer params); + + @Alternate("glGetVideoi64vNV") + @GLreturn("params") + @StripPostfix(value = "params", hasPostfix = false) + void glGetVideoi64vNV2(@GLuint int video_slot, @GLenum int pname, @OutParameter @GLint64EXT LongBuffer params); + + @StripPostfix("params") + void glGetVideoui64vNV(@GLuint int video_slot, @GLenum int pname, @OutParameter @Check("1") @GLuint64EXT LongBuffer params); + + @Alternate("glGetVideoui64vNV") + @GLreturn("params") + @StripPostfix(value = "params", hasPostfix = false) + void glGetVideoui64vNV2(@GLuint int video_slot, @GLenum int pname, @OutParameter @GLuint64EXT LongBuffer params); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/NV_program.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/NV_program.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/NV_program.java 2011-03-26 18:15:37.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/NV_program.java 2016-04-09 16:26:56.000000000 +0000 @@ -69,7 +69,7 @@ void glDeleteProgramsNV(@AutoSize("programs") @GLsizei int n, @Const @GLuint IntBuffer programs); @Alternate("glDeleteProgramsNV") - void glDeleteProgramsNV(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getBufferInt().put(0, program), 0", keepParam = true) int program); + void glDeleteProgramsNV(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getInt(caps, program)", keepParam = true) int program); void glGenProgramsNV(@AutoSize("programs") @GLsizei int n, @OutParameter @GLuint IntBuffer programs); @@ -80,15 +80,23 @@ @StripPostfix("params") void glGetProgramivNV(@GLuint int programID, @GLenum int parameterName, @OutParameter @Check @GLint IntBuffer params); + /** @deprecated Will be removed in 3.0. Use {@link #glGetProgramiNV} instead. */ @Alternate("glGetProgramivNV") @GLreturn("params") @StripPostfix("params") + @Reuse(value = "NVProgram", method = "glGetProgramiNV") + @Deprecated void glGetProgramivNV2(@GLuint int programID, @GLenum int parameterName, @OutParameter @GLint IntBuffer params); + @Alternate("glGetProgramivNV") + @GLreturn("params") + @StripPostfix(value = "params", hasPostfix = false) + void glGetProgramivNV3(@GLuint int programID, @GLenum int parameterName, @OutParameter @GLint IntBuffer params); + void glGetProgramStringNV(@GLuint int programID, @GLenum int parameterName, @OutParameter @Check @GLubyte Buffer paramString); @Alternate("glGetProgramStringNV") - @Code("\t\tint programLength = glGetProgramNV(programID, GL_PROGRAM_LENGTH_NV);") + @Code("\t\tint programLength = glGetProgramiNV(programID, GL_PROGRAM_LENGTH_NV);") @GLreturn(value="paramString", maxLength = "programLength", forceMaxLength = true) void glGetProgramStringNV2(@GLuint int programID, @GLenum int parameterName, @OutParameter @GLchar ByteBuffer paramString); @@ -101,6 +109,6 @@ void glRequestResidentProgramsNV(@AutoSize("programIDs") @GLsizei int n, @GLuint IntBuffer programIDs); @Alternate("glRequestResidentProgramsNV") - void glRequestResidentProgramsNV(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getBufferInt().put(0, programID), 0", keepParam = true) int programID); + void glRequestResidentProgramsNV(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getInt(caps, programID)", keepParam = true) int programID); } diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/NV_register_combiners.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/NV_register_combiners.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/NV_register_combiners.java 2011-03-26 18:15:37.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/NV_register_combiners.java 2016-04-09 16:26:56.000000000 +0000 @@ -112,7 +112,7 @@ @Alternate("glGetCombinerInputParameterfvNV") @GLreturn("params") - @StripPostfix(value = "params", postfix = "v") + @StripPostfix(value = "params", hasPostfix = false) void glGetCombinerInputParameterfvNV2(@GLenum int stage, @GLenum int portion, @GLenum int variable, @GLenum int pname, @OutParameter FloatBuffer params); @StripPostfix("params") @@ -120,7 +120,7 @@ @Alternate("glGetCombinerInputParameterivNV") @GLreturn("params") - @StripPostfix(value = "params", postfix = "v") + @StripPostfix(value = "params", hasPostfix = false) void glGetCombinerInputParameterivNV2(@GLenum int stage, @GLenum int portion, @GLenum int variable, @GLenum int pname, @OutParameter IntBuffer params); @StripPostfix("params") @@ -128,7 +128,7 @@ @Alternate("glGetCombinerOutputParameterfvNV") @GLreturn("params") - @StripPostfix(value = "params", postfix = "v") + @StripPostfix(value = "params", hasPostfix = false) void glGetCombinerOutputParameterfvNV2(@GLenum int stage, @GLenum int portion, @GLenum int pname, @OutParameter FloatBuffer params); @StripPostfix("params") @@ -136,7 +136,7 @@ @Alternate("glGetCombinerOutputParameterivNV") @GLreturn("params") - @StripPostfix(value = "params", postfix = "v") + @StripPostfix(value = "params", hasPostfix = false) void glGetCombinerOutputParameterivNV2(@GLenum int stage, @GLenum int portion, @GLenum int pname, @OutParameter IntBuffer params); @StripPostfix("params") @@ -144,7 +144,7 @@ @Alternate("glGetFinalCombinerInputParameterfvNV") @GLreturn("params") - @StripPostfix(value = "params", postfix = "v") + @StripPostfix(value = "params", hasPostfix = false) void glGetFinalCombinerInputParameterfvNV2(@GLenum int variable, @GLenum int pname, @OutParameter FloatBuffer params); @StripPostfix("params") @@ -152,6 +152,6 @@ @Alternate("glGetFinalCombinerInputParameterivNV") @GLreturn("params") - @StripPostfix(value = "params", postfix = "v") + @StripPostfix(value = "params", hasPostfix = false) void glGetFinalCombinerInputParameterivNV2(@GLenum int variable, @GLenum int pname, @OutParameter IntBuffer params); } diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/NV_shader_atomic_counters.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/NV_shader_atomic_counters.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/NV_shader_atomic_counters.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/NV_shader_atomic_counters.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2002-2012 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +public interface NV_shader_atomic_counters { +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/NV_shader_atomic_float.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/NV_shader_atomic_float.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/NV_shader_atomic_float.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/NV_shader_atomic_float.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2002-2012 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +public interface NV_shader_atomic_float { + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/NV_shader_buffer_load.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/NV_shader_buffer_load.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/NV_shader_buffer_load.java 2011-03-26 18:15:37.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/NV_shader_buffer_load.java 2016-04-09 16:26:56.000000000 +0000 @@ -68,7 +68,7 @@ @Alternate("glGetBufferParameterui64vNV") @GLreturn("params") - @StripPostfix("params") + @StripPostfix(value = "params", hasPostfix = false) void glGetBufferParameterui64vNV2(@GLenum int target, @GLenum int pname, @OutParameter @GLuint64EXT LongBuffer params); @StripPostfix("params") @@ -76,7 +76,7 @@ @Alternate("glGetNamedBufferParameterui64vNV") @GLreturn("params") - @StripPostfix("params") + @StripPostfix(value = "params", hasPostfix = false) void glGetNamedBufferParameterui64vNV2(@GLuint int buffer, @GLenum int pname, @OutParameter @GLuint64EXT LongBuffer params); @StripPostfix("result") @@ -84,7 +84,7 @@ @Alternate("glGetIntegerui64vNV") @GLreturn("result") - @StripPostfix("result") + @StripPostfix(value = "result", hasPostfix = false) void glGetIntegerui64vNV2(@GLenum int value, @OutParameter @GLuint64EXT LongBuffer result); void glUniformui64NV(int location, @GLuint64EXT long value); diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/NV_shader_buffer_store.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/NV_shader_buffer_store.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/NV_shader_buffer_store.java 2011-03-26 18:15:37.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/NV_shader_buffer_store.java 2016-04-09 16:26:56.000000000 +0000 @@ -36,8 +36,4 @@ /** Accepted by the <barriers> parameter of MemoryBarrierNV: */ int GL_SHADER_GLOBAL_ACCESS_BARRIER_BIT_NV = 0x00000010; - /** Accepted by the <access> parameter of MakeBufferResidentNV: */ - int GL_READ_WRITE = GL15.GL_READ_WRITE; - int GL_WRITE_ONLY = GL15.GL_WRITE_ONLY; - } \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/NV_shader_storage_buffer_object.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/NV_shader_storage_buffer_object.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/NV_shader_storage_buffer_object.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/NV_shader_storage_buffer_object.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2002-2012 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +public interface NV_shader_storage_buffer_object { +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/NV_texture_multisample.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/NV_texture_multisample.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/NV_texture_multisample.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/NV_texture_multisample.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +import org.lwjgl.util.generator.opengl.GLenum; +import org.lwjgl.util.generator.opengl.GLsizei; +import org.lwjgl.util.generator.opengl.GLuint; + +public interface NV_texture_multisample { + + /** Accepted by the <pname> parameter of GetTexLevelParameter: */ + + int GL_TEXTURE_COVERAGE_SAMPLES_NV = 0x9045, + GL_TEXTURE_COLOR_SAMPLES_NV = 0x9046; + + void glTexImage2DMultisampleCoverageNV(@GLenum int target, + @GLsizei int coverageSamples, @GLsizei int colorSamples, + int internalFormat, + @GLsizei int width, @GLsizei int height, + boolean fixedSampleLocations); + + void glTexImage3DMultisampleCoverageNV(@GLenum int target, + @GLsizei int coverageSamples, @GLsizei int colorSamples, + int internalFormat, + @GLsizei int width, @GLsizei int height, @GLsizei int depth, + boolean fixedSampleLocations); + + void glTextureImage2DMultisampleNV(@GLuint int texture, @GLenum int target, + @GLsizei int samples, int internalFormat, + @GLsizei int width, @GLsizei int height, + boolean fixedSampleLocations); + + void glTextureImage3DMultisampleNV(@GLuint int texture, @GLenum int target, + @GLsizei int samples, int internalFormat, + @GLsizei int width, @GLsizei int height, @GLsizei int depth, + boolean fixedSampleLocations); + + void glTextureImage2DMultisampleCoverageNV(@GLuint int texture, @GLenum int target, + @GLsizei int coverageSamples, @GLsizei int colorSamples, + int internalFormat, + @GLsizei int width, @GLsizei int height, + boolean fixedSampleLocations); + + void glTextureImage3DMultisampleCoverageNV(@GLuint int texture, @GLenum int target, + @GLsizei int coverageSamples, @GLsizei int colorSamples, + int internalFormat, + @GLsizei int width, @GLsizei int height, @GLsizei int depth, + boolean fixedSampleLocations); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/NV_transform_feedback2.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/NV_transform_feedback2.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/NV_transform_feedback2.java 2011-03-26 18:15:37.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/NV_transform_feedback2.java 2016-04-09 16:26:56.000000000 +0000 @@ -59,7 +59,7 @@ void glDeleteTransformFeedbacksNV(@AutoSize("ids") @GLsizei int n, @Const @GLuint IntBuffer ids); @Alternate("glDeleteTransformFeedbacksNV") - void glDeleteTransformFeedbacksNV(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getBufferInt().put(0, id), 0", keepParam = true) int id); + void glDeleteTransformFeedbacksNV(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getInt(caps, id)", keepParam = true) int id); void glGenTransformFeedbacksNV(@AutoSize("ids") @GLsizei int n, @OutParameter @GLuint IntBuffer ids); diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/NV_transform_feedback.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/NV_transform_feedback.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/NV_transform_feedback.java 2011-03-26 18:15:37.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/NV_transform_feedback.java 2016-04-09 16:26:56.000000000 +0000 @@ -120,7 +120,7 @@ void glBindBufferBaseNV(@GLenum int target, @GLuint int index, @GLuint int buffer); - void glTransformFeedbackAttribsNV(@AutoSize("attribs") @GLsizei int count, @Const IntBuffer attribs, @GLenum int bufferMode); + void glTransformFeedbackAttribsNV(@Constant("attribs.remaining() / 3") @GLsizei int count, @Check("3") @Const IntBuffer attribs, @GLenum int bufferMode); void glTransformFeedbackVaryingsNV(@GLuint int program, @AutoSize("locations") @GLsizei int count, @Const IntBuffer locations, @GLenum int bufferMode); @@ -143,35 +143,35 @@ @Alternate("glGetActiveVaryingNV") @GLreturn(value = "name", maxLength = "bufSize") void glGetActiveVaryingNV2(@GLuint int program, @GLuint int index, @GLsizei int bufSize, - @OutParameter @GLsizei @Constant("name_length, 0") IntBuffer length, + @OutParameter @GLsizei @Constant("MemoryUtil.getAddress0(name_length)") IntBuffer length, @OutParameter @Check("2") IntBuffer sizeType, - @OutParameter @GLenum @Constant("sizeType, sizeType.position() + 1") IntBuffer type, + @OutParameter @GLenum @Constant("MemoryUtil.getAddress(sizeType, sizeType.position() + 1)") IntBuffer type, @OutParameter @GLchar ByteBuffer name); /** Overloads glGetActiveVaryingNV. This version returns only the varying name. */ @Alternate(value = "glGetActiveVaryingNV", javaAlt = true) @GLreturn(value = "name", maxLength = "bufSize") void glGetActiveVaryingNV(@GLuint int program, @GLuint int index, @GLsizei int bufSize, - @OutParameter @GLsizei @Constant("name_length, 0, APIUtil.getBufferInt(), 0, APIUtil.getBufferInt(), 1") IntBuffer length, + @OutParameter @GLsizei @Constant("MemoryUtil.getAddress0(name_length), MemoryUtil.getAddress0(APIUtil.getBufferInt(caps)), MemoryUtil.getAddress(APIUtil.getBufferInt(caps), 1)") IntBuffer length, @OutParameter @GLchar ByteBuffer name); /** Overloads glGetActiveVaryingNV. This version returns only the varying size. */ @Alternate(value = "glGetActiveVaryingNV", javaAlt = true) @GLreturn(value = "size") void glGetActiveVaryingSizeNV(@GLuint int program, @GLuint int index, @Constant("0") @GLsizei int bufSize, - @OutParameter @GLsizei @Constant("null, 0") IntBuffer length, + @OutParameter @GLsizei @Constant("0L") IntBuffer length, @OutParameter IntBuffer size, - @OutParameter @GLenum @Constant("size, 1") IntBuffer type, // Reuse size buffer and ignore - @OutParameter @GLchar @Constant("APIUtil.getBufferByte(0), 0") ByteBuffer name); + @OutParameter @GLenum @Constant("MemoryUtil.getAddress(size, 1)") IntBuffer type, // Reuse size buffer and ignore + @OutParameter @GLchar @Constant("APIUtil.getBufferByte0(caps)") ByteBuffer name); /** Overloads glGetActiveVaryingNV. This version returns only the varying type. */ @Alternate(value = "glGetActiveVaryingNV", javaAlt = true) @GLreturn(value = "type") void glGetActiveVaryingTypeNV(@GLuint int program, @GLuint int index, @Constant("0") @GLsizei int bufSize, - @OutParameter @GLsizei @Constant("null, 0") IntBuffer length, - @OutParameter @Constant("type, 1") IntBuffer size, // Reuse type buffer and ignore + @OutParameter @GLsizei @Constant("0L") IntBuffer length, + @OutParameter @Constant("MemoryUtil.getAddress(type, 1)") IntBuffer size, // Reuse type buffer and ignore @OutParameter @GLenum IntBuffer type, - @OutParameter @GLchar @Constant("APIUtil.getBufferByte(0), 0") ByteBuffer name); + @OutParameter @GLchar @Constant("APIUtil.getBufferByte0(caps)") ByteBuffer name); void glActiveVaryingNV(@GLuint int program, @NullTerminated @Const @GLchar ByteBuffer name); diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/NV_vertex_attrib_integer_64bit.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/NV_vertex_attrib_integer_64bit.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/NV_vertex_attrib_integer_64bit.java 2011-03-26 18:15:37.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/NV_vertex_attrib_integer_64bit.java 2016-04-09 16:26:56.000000000 +0000 @@ -92,7 +92,7 @@ @StripPostfix("params") void glGetVertexAttribLui64vNV(@GLuint int index, @GLenum int pname, @OutParameter @GLuint64EXT @Check("4") LongBuffer params); - @Dependent("NV_vertex_buffer_unified_memory") + @Dependent("GL_NV_vertex_buffer_unified_memory") void glVertexAttribLFormatNV(@GLuint int index, int size, @GLenum int type, @GLsizei int stride); } \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/NV_vertex_buffer_unified_memory.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/NV_vertex_buffer_unified_memory.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/NV_vertex_buffer_unified_memory.java 2011-03-26 18:15:37.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/NV_vertex_buffer_unified_memory.java 2016-04-09 16:26:56.000000000 +0000 @@ -102,12 +102,12 @@ void glVertexAttribIFormatNV(@GLuint int index, int size, @GLenum int type, @GLsizei int stride); - @StripPostfix("result") + @StripPostfix(value = "result", postfix = "i64i_v") void glGetIntegerui64i_vNV(@GLenum int value, @GLuint int index, @OutParameter @Check("1") @GLuint64EXT LongBuffer result); @Alternate("glGetIntegerui64i_vNV") @GLreturn("result") - @StripPostfix("result") + @StripPostfix(value = "result", postfix = "i_v") void glGetIntegerui64i_vNV2(@GLenum int value, @GLuint int index, @OutParameter @GLuint64EXT LongBuffer result); } \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/NV_video_capture.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/NV_video_capture.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengl/NV_video_capture.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengl/NV_video_capture.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,201 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +import org.lwjgl.util.generator.*; +import org.lwjgl.util.generator.opengl.*; + +import java.nio.DoubleBuffer; +import java.nio.FloatBuffer; +import java.nio.IntBuffer; +import java.nio.LongBuffer; + +public interface NV_video_capture { + + /** + * Accepted by the <target> parameters of BindBufferARB, BufferDataARB, + * BufferSubDataARB, MapBufferARB, UnmapBufferARB, GetBufferSubDataARB, + * GetBufferParameterivARB, and GetBufferPointervARB: + */ + int GL_VIDEO_BUFFER_NV = 0x9020; + + /** + * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, + * GetFloatv, and GetDoublev: + */ + int GL_VIDEO_BUFFER_BINDING_NV = 0x9021; + + /** + * Accepted by the <frame_region> parameter of + * BindVideoCaptureStreamBufferNV, and BindVideoCaptureStreamTextureNV: + */ + int GL_FIELD_UPPER_NV = 0x9022, + GL_FIELD_LOWER_NV = 0x9023; + + /** Accepted by the <pname> parameter of GetVideoCaptureivNV: */ + int GL_NUM_VIDEO_CAPTURE_STREAMS_NV = 0x9024, + GL_NEXT_VIDEO_CAPTURE_BUFFER_STATUS_NV = 0x9025; + + /** + * Accepted by the <pname> parameter of + * GetVideoCaptureStream{i,f,d}vNV: + */ + int GL_LAST_VIDEO_CAPTURE_STATUS_NV = 0x9027, + GL_VIDEO_BUFFER_PITCH_NV = 0x9028, + GL_VIDEO_CAPTURE_FRAME_WIDTH_NV = 0x9038, + GL_VIDEO_CAPTURE_FRAME_HEIGHT_NV = 0x9039, + GL_VIDEO_CAPTURE_FIELD_UPPER_HEIGHT_NV = 0x903A, + GL_VIDEO_CAPTURE_FIELD_LOWER_HEIGHT_NV = 0x903B, + GL_VIDEO_CAPTURE_TO_422_SUPPORTED_NV = 0x9026; + + /** + * Accepted by the <pname> parameter of + * GetVideoCaptureStream{i,f,d}vNV and as the <pname> parameter of + * VideoCaptureStreamParameter{i,f,d}vNV: + */ + int GL_VIDEO_COLOR_CONVERSION_MATRIX_NV = 0x9029, + GL_VIDEO_COLOR_CONVERSION_MAX_NV = 0x902A, + GL_VIDEO_COLOR_CONVERSION_MIN_NV = 0x902B, + GL_VIDEO_COLOR_CONVERSION_OFFSET_NV = 0x902C, + GL_VIDEO_BUFFER_INTERNAL_FORMAT_NV = 0x902D, + GL_VIDEO_CAPTURE_SURFACE_ORIGIN_NV = 0x903C; + /** Returned by VideoCaptureNV: */ + int GL_PARTIAL_SUCCESS_NV = 0x902E; + + /** + * Returned by VideoCaptureNV and GetVideoCaptureStream{i,f,d}vNV + * when <pname> is LAST_VIDEO_CAPTURE_STATUS_NV: + */ + int GL_SUCCESS_NV = 0x902F, + GL_FAILURE_NV = 0x9030; + + /** + * Accepted in the <params> parameter of + * VideoCaptureStreamParameter{i,f,d}vNV when <pname> is + * VIDEO_BUFFER_INTERNAL_FORMAT_NV and returned by + * GetVideoCaptureStream{i,f,d}vNV when <pname> is + * VIDEO_BUFFER_INTERNAL_FORMAT_NV: + */ + int GL_YCBYCR8_422_NV = 0x9031, + GL_YCBAYCR8A_4224_NV = 0x9032, + GL_Z6Y10Z6CB10Z6Y10Z6CR10_422_NV = 0x9033, + GL_Z6Y10Z6CB10Z6A10Z6Y10Z6CR10Z6A10_4224_NV = 0x9034, + GL_Z4Y12Z4CB12Z4Y12Z4CR12_422_NV = 0x9035, + GL_Z4Y12Z4CB12Z4A12Z4Y12Z4CR12Z4A12_4224_NV = 0x9036, + GL_Z4Y12Z4CB12Z4CR12_444_NV = 0x9037; + + /* + * Accepted in the attribute list of the GLX reply to the + * glXEnumerateVideoCaptureDevicesNV command: + */ + /*int GLX_DEVICE_ID_NV = 0x20CD;*/ + + /** Accepted by the <attribute> parameter of NVPresentVideoUtil.glQueryContextNV: */ + int GL_NUM_VIDEO_CAPTURE_SLOTS_NV = 0x20CF; + + /** + * Accepted by the <attribute> parameter of + * glQueryVideoCaptureDeviceNV: + */ + int GL_UNIQUE_ID_NV = 0x20CE; + + void glBeginVideoCaptureNV(@GLuint int video_capture_slot); + + void glBindVideoCaptureStreamBufferNV(@GLuint int video_capture_slot, + @GLuint int stream, @GLenum int frame_region, + @GLintptrARB long offset); + + void glBindVideoCaptureStreamTextureNV(@GLuint int video_capture_slot, + @GLuint int stream, @GLenum int frame_region, + @GLenum int target, @GLuint int texture); + + void glEndVideoCaptureNV(@GLuint int video_capture_slot); + + @StripPostfix("params") + void glGetVideoCaptureivNV(@GLuint int video_capture_slot, @GLenum int pname, @OutParameter @Check("1") IntBuffer params); + + @Alternate("glGetVideoCaptureivNV") + @GLreturn("params") + @StripPostfix(value = "params", hasPostfix = false) + void glGetVideoCaptureivNV2(@GLuint int video_capture_slot, @GLenum int pname, @OutParameter IntBuffer params); + + @StripPostfix("params") + void glGetVideoCaptureStreamivNV(@GLuint int video_capture_slot, + @GLuint int stream, @GLenum int pname, + @OutParameter @Check("1") IntBuffer params); + + @Alternate("glGetVideoCaptureStreamivNV") + @GLreturn("params") + @StripPostfix(value = "params", hasPostfix = false) + void glGetVideoCaptureStreamivNV2(@GLuint int video_capture_slot, + @GLuint int stream, @GLenum int pname, + @OutParameter IntBuffer params); + + @StripPostfix("params") + void glGetVideoCaptureStreamfvNV(@GLuint int video_capture_slot, + @GLuint int stream, @GLenum int pname, + @OutParameter @Check("1") FloatBuffer params); + + @Alternate("glGetVideoCaptureStreamfvNV") + @GLreturn("params") + @StripPostfix(value = "params", hasPostfix = false) + void glGetVideoCaptureStreamfvNV2(@GLuint int video_capture_slot, + @GLuint int stream, @GLenum int pname, + @OutParameter FloatBuffer params); + + @StripPostfix("params") + void glGetVideoCaptureStreamdvNV(@GLuint int video_capture_slot, + @GLuint int stream, @GLenum int pname, + @OutParameter @Check("1") DoubleBuffer params); + + @Alternate("glGetVideoCaptureStreamdvNV") + @GLreturn("params") + @StripPostfix(value = "params", hasPostfix = false) + void glGetVideoCaptureStreamdvNV2(@GLuint int video_capture_slot, + @GLuint int stream, @GLenum int pname, + @OutParameter DoubleBuffer params); + + @GLenum + int glVideoCaptureNV(@GLuint int video_capture_slot, + @OutParameter @Check("1") @GLuint IntBuffer sequence_num, + @OutParameter @Check("1") @GLuint64EXT LongBuffer capture_time); + + @StripPostfix("params") + void glVideoCaptureStreamParameterivNV(@GLuint int video_capture_slot, @GLuint int stream, @GLenum int pname, @Const @Check("16") IntBuffer params); + + @StripPostfix("params") + void glVideoCaptureStreamParameterfvNV(@GLuint int video_capture_slot, @GLuint int stream, @GLenum int pname, @Const @Check("16") FloatBuffer params); + + @StripPostfix("params") + void glVideoCaptureStreamParameterdvNV(@GLuint int video_capture_slot, @GLuint int stream, @GLenum int pname, @Const @Check("16") DoubleBuffer params); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/AMD_compressed_3DC_texture.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/AMD_compressed_3DC_texture.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/AMD_compressed_3DC_texture.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/AMD_compressed_3DC_texture.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +public interface AMD_compressed_3DC_texture { + + /** + * Accepted by the <internalFormat> parameter of CompressedTexImage2D and + * CompressedTexImage3DOES: + */ + int GL_3DC_X_AMD = 0x87F9, + GL_3DC_XY_AMD = 0x87FA; + +} diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/AMD_compressed_ATC_texture.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/AMD_compressed_ATC_texture.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/AMD_compressed_ATC_texture.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/AMD_compressed_ATC_texture.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +public interface AMD_compressed_ATC_texture { + + /** + * Accepted by the <internalformat> parameter of CompressedTexImage2D and + * CompressedTexImage3DOES. + */ + int GL_ATC_RGB_AMD = 0x8C92, + GL_ATC_RGBA_EXPLICIT_ALPHA_AMD = 0x8C93, + GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD = 0x87EE; + +} diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/AMD_performance_monitor.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/AMD_performance_monitor.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/AMD_performance_monitor.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/AMD_performance_monitor.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,121 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +import org.lwjgl.util.generator.*; +import org.lwjgl.util.generator.opengl.*; + +import java.nio.ByteBuffer; +import java.nio.IntBuffer; + +public interface AMD_performance_monitor { + + /** Accepted by the <pame> parameter of GetPerfMonitorCounterInfoAMD */ + int GL_COUNTER_TYPE_AMD = 0x8BC0; + int GL_COUNTER_RANGE_AMD = 0x8BC1; + + /** + * Returned as a valid value in <data> parameter of + * GetPerfMonitorCounterInfoAMD if <pname> = COUNTER_TYPE_AMD + */ + int GL_UNSIGNED_INT64_AMD = 0x8BC2; + int GL_PERCENTAGE_AMD = 0x8BC3; + + /** Accepted by the <pname> parameter of GetPerfMonitorCounterDataAMD */ + + int GL_PERFMON_RESULT_AVAILABLE_AMD = 0x8BC4; + int GL_PERFMON_RESULT_SIZE_AMD = 0x8BC5; + int GL_PERFMON_RESULT_AMD = 0x8BC6; + + void glGetPerfMonitorGroupsAMD(@OutParameter @Check(value = "1", canBeNull = true) @GLint IntBuffer numGroups, + @AutoSize("groups") @GLsizei int groupsSize, @GLuint IntBuffer groups); + + void glGetPerfMonitorCountersAMD(@GLuint int group, + @OutParameter @Check(value = "1") @GLint IntBuffer numCounters, + @OutParameter @Check(value = "1") @GLint IntBuffer maxActiveCounters, + @AutoSize("counters") @GLsizei int countersSize, + @GLuint IntBuffer counters); + + void glGetPerfMonitorGroupStringAMD(@GLuint int group, + @AutoSize("groupString") @GLsizei int bufSize, + @OutParameter @GLsizei @Check(value = "1", canBeNull = true) IntBuffer length, + @OutParameter @GLchar ByteBuffer groupString); + + @Alternate("glGetPerfMonitorGroupStringAMD") + @GLreturn(value = "groupString", maxLength = "bufSize") + void glGetPerfMonitorGroupStringAMD2(@GLuint int group, @GLsizei int bufSize, + @OutParameter @GLsizei @Constant("MemoryUtil.getAddress0(groupString_length)") IntBuffer length, + @OutParameter @GLchar ByteBuffer groupString); + + void glGetPerfMonitorCounterStringAMD(@GLuint int group, @GLuint int counter, @AutoSize("counterString") @GLsizei int bufSize, + @OutParameter @GLsizei @Check(value = "1", canBeNull = true) IntBuffer length, + @OutParameter @GLchar ByteBuffer counterString); + + @Alternate("glGetPerfMonitorCounterStringAMD") + @GLreturn(value = "counterString", maxLength = "bufSize") + void glGetPerfMonitorCounterStringAMD2(@GLuint int group, @GLuint int counter, @GLsizei int bufSize, + @OutParameter @GLsizei @Constant("MemoryUtil.getAddress0(counterString_length)") IntBuffer length, + @OutParameter @GLchar ByteBuffer counterString); + + void glGetPerfMonitorCounterInfoAMD(@GLuint int group, @GLuint int counter, @GLenum int pname, @Check(value = "16") @GLvoid ByteBuffer data); + + void glGenPerfMonitorsAMD(@AutoSize("monitors") @GLsizei int n, @OutParameter @GLuint IntBuffer monitors); + + @Alternate("glGenPerfMonitorsAMD") + @GLreturn("monitors") + void glGenPerfMonitorsAMD2(@Constant("1") @GLsizei int n, @OutParameter @GLuint IntBuffer monitors); + + void glDeletePerfMonitorsAMD(@AutoSize("monitors") @GLsizei int n, @GLuint IntBuffer monitors); + + @Alternate("glDeletePerfMonitorsAMD") + void glDeletePerfMonitorsAMD(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getInt(monitor)", keepParam = true) int monitor); + + void glSelectPerfMonitorCountersAMD(@GLuint int monitor, boolean enable, @GLuint int group, @AutoSize("counterList") int numCounters, @GLuint IntBuffer counterList); + + @Alternate("glSelectPerfMonitorCountersAMD") + void glSelectPerfMonitorCountersAMD(@GLuint int monitor, boolean enable, @GLuint int group, @Constant("1") int numCounters, @Constant(value = "APIUtil.getInt(counter)", keepParam = true) int counter); + + void glBeginPerfMonitorAMD(@GLuint int monitor); + + void glEndPerfMonitorAMD(@GLuint int monitor); + + void glGetPerfMonitorCounterDataAMD(@GLuint int monitor, @GLenum int pname, @AutoSize("data") @GLsizei int dataSize, + @OutParameter @GLuint IntBuffer data, + @OutParameter @GLint @Check(value = "1", canBeNull = true) IntBuffer bytesWritten); + + @Alternate("glGetPerfMonitorCounterDataAMD") + @GLreturn("data") + void glGetPerfMonitorCounterDataAMD2(@GLuint int monitor, @GLenum int pname, @Constant("4") @GLsizei int dataSize, + @OutParameter @GLuint IntBuffer data, + @OutParameter @GLint @Constant("0L") IntBuffer bytesWritten); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/AMD_program_binary_Z400.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/AMD_program_binary_Z400.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/AMD_program_binary_Z400.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/AMD_program_binary_Z400.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +public interface AMD_program_binary_Z400 { + + /** Accepted by the <binaryFormat> parameter of ProgramBinaryOES: */ + int GL_Z400_BINARY_AMD = 0x8740; + +} diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/ANGLE_framebuffer_blit.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/ANGLE_framebuffer_blit.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/ANGLE_framebuffer_blit.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/ANGLE_framebuffer_blit.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +import org.lwjgl.util.generator.opengl.GLbitfield; +import org.lwjgl.util.generator.opengl.GLenum; + +public interface ANGLE_framebuffer_blit { + + /** + * Accepted by the <target> parameter of BindFramebuffer, + * CheckFramebufferStatus, FramebufferTexture2D, FramebufferTexture3DOES, + * FramebufferRenderbuffer, and + * GetFramebufferAttachmentParameteriv: + */ + int GL_READ_FRAMEBUFFER_ANGLE = 0x8CA8, + GL_DRAW_FRAMEBUFFER_ANGLE = 0x8CA9; + + /** Accepted by the <pname> parameters of GetIntegerv and GetFloatv: */ + int GL_DRAW_FRAMEBUFFER_BINDING_ANGLE = 0x8CA6, // alias FRAMEBUFFER_BINDING + GL_READ_FRAMEBUFFER_BINDING_ANGLE = 0x8CAA; + + void glBlitFramebufferANGLE(int srcX0, int srcY0, int srcX1, int srcY1, + int dstX0, int dstY0, int dstX1, int dstY1, + @GLbitfield int mask, @GLenum int filter); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/ANGLE_framebuffer_multisample.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/ANGLE_framebuffer_multisample.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/ANGLE_framebuffer_multisample.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/ANGLE_framebuffer_multisample.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +import org.lwjgl.util.generator.opengl.GLenum; +import org.lwjgl.util.generator.opengl.GLsizei; + +public interface ANGLE_framebuffer_multisample { + + /** Accepted by the <pname> parameter of GetRenderbufferParameteriv: */ + int GL_RENDERBUFFER_SAMPLES_ANGLE = 0x8CAB; + + /** Returned by CheckFramebufferStatus: */ + int GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_ANGLE = 0x8D56; + + /** + * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, + * and GetFloatv: + */ + int GL_MAX_SAMPLES_ANGLE = 0x8D57; + + void glRenderbufferStorageMultisampleANGLE( + @GLenum int target, @GLsizei int samples, + @GLenum int internalformat, + @GLsizei int width, @GLsizei int height); +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/APPLE_framebuffer_multisample.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/APPLE_framebuffer_multisample.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/APPLE_framebuffer_multisample.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/APPLE_framebuffer_multisample.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +import org.lwjgl.util.generator.opengl.GLenum; +import org.lwjgl.util.generator.opengl.GLsizei; + +public interface APPLE_framebuffer_multisample { + + /** Accepted by the <pname> parameter of GetRenderbufferParameteriv: */ + int GL_RENDERBUFFER_SAMPLES_APPLE = 0x8CAB; + + /** Returned by CheckFramebufferStatus: */ + int GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_APPLE = 0x8D56; + + /** + * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, and + * GetFloatv: + */ + int GL_MAX_SAMPLES_APPLE = 0x8D57; + + /** + * Accepted by the <target> parameter of BindFramebuffer, + * CheckFramebufferStatus, FramebufferTexture2D, FramebufferRenderbuffer, and + * GetFramebufferAttachmentParameteriv: + */ + int GL_READ_FRAMEBUFFER_APPLE = 0x8CA8, + GL_DRAW_FRAMEBUFFER_APPLE = 0x8CA9; + + /** + * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, and + * GetFloatv: + */ + int GL_DRAW_FRAMEBUFFER_BINDING_APPLE = 0x8CA6, // FRAMEBUFFER_BINDING + GL_READ_FRAMEBUFFER_BINDING_APPLE = 0x8CAA; + + void glRenderbufferStorageMultisampleAPPLE( + @GLenum int target, @GLsizei int samples, + @GLenum int internalformat, + @GLsizei int width, @GLsizei int height); + + void glResolveMultisampleFramebufferAPPLE(); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/APPLE_rgb_422.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/APPLE_rgb_422.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/APPLE_rgb_422.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/APPLE_rgb_422.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +public interface APPLE_rgb_422 { + + /** + * Accepted by the <format> parameter of DrawPixels, ReadPixels, TexImage1D, + * TexImage2D, GetTexImage, TexImage3D, TexSubImage1D, TexSubImage2D, + * TexSubImage3D, GetHistogram, GetMinmax, ConvolutionFilter1D, + * ConvolutionFilter2D, GetConvolutionFilter, SeparableFilter2D, + * GetSeparableFilter, ColorTable, GetColorTable: + */ + int GL_RGB_422_APPLE = 0x8A1F; + + /** + * Accepted by the <type> parameter of DrawPixels, ReadPixels, TexImage1D, + * TexImage2D, GetTexImage, TexImage3D, TexSubImage1D, TexSubImage2D, + * TexSubImage3D, GetHistogram, GetMinmax, ConvolutionFilter1D, + * ConvolutionFilter2D, GetConvolutionFilter, SeparableFilter2D, + * GetSeparableFilter, ColorTable, GetColorTable: + */ + int GL_UNSIGNED_SHORT_8_8_APPLE = 0x85BA; + int GL_UNSIGNED_SHORT_8_8_REV_APPLE = 0x85BB; + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/APPLE_sync.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/APPLE_sync.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/APPLE_sync.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/APPLE_sync.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,112 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +import org.lwjgl.opengl.GLSync; +import org.lwjgl.util.generator.*; +import org.lwjgl.util.generator.opengl.*; + +import java.nio.IntBuffer; +import java.nio.LongBuffer; + +public interface APPLE_sync { + + /** Accepted as the <pname> parameter of GetInteger64vAPPLE: */ + int GL_MAX_SERVER_WAIT_TIMEOUT_APPLE = 0x9111; + + /** Accepted as the <pname> parameter of GetSyncivAPPLE: */ + int GL_OBJECT_TYPE_APPLE = 0x9112, + SYNC_CONDITION_APPLE = 0x9113, + SYNC_STATUS_APPLE = 0x9114, + SYNC_FLAGS_APPLE = 0x9115; + + /** Returned in <values> for GetSynciv <pname> OBJECT_TYPE_APPLE: */ + int GL_SYNC_FENCE_APPLE = 0x9116; + + /** Returned in <values> for GetSyncivAPPLE <pname> SYNC_CONDITION_APPLE: */ + int GL_SYNC_GPU_COMMANDS_COMPLETE_APPLE = 0x9117; + + /** Returned in <values> for GetSyncivAPPLE <pname> SYNC_STATUS_APPLE: */ + int GL_UNSIGNALED_APPLE = 0x9118, + SIGNALED_APPLE = 0x9119; + + /** Accepted in the <flags> parameter of ClientWaitSyncAPPLE: */ + int GL_SYNC_FLUSH_COMMANDS_BIT_APPLE = 0x00000001; + + /** Accepted in the <timeout> parameter of WaitSyncAPPLE: */ + long GL_TIMEOUT_IGNORED_APPLE = 0xFFFFFFFFFFFFFFFFl; + + /** Returned by ClientWaitSyncAPPLE: */ + int GL_ALREADY_SIGNALED_APPLE = 0x911A, + TIMEOUT_EXPIRED_APPLE = 0x911B, + CONDITION_SATISFIED_APPLE = 0x911C, + WAIT_FAILED_APPLE = 0x911D; + + /** + * Accepted by the <type> parameter of LabelObjectEXT and + * GetObjectLabelEXT: + */ + int GL_SYNC_OBJECT_APPLE = 0x8A53; + + @PointerWrapper("GLsync") + org.lwjgl.opengl.GLSync glFenceSyncAPPLE(@GLenum int condition, @GLbitfield int flags); + + boolean glIsSyncAPPLE(@PointerWrapper("GLsync") org.lwjgl.opengl.GLSync sync); + + void glDeleteSyncAPPLE(@PointerWrapper("GLsync") org.lwjgl.opengl.GLSync sync); + + @GLenum + int glClientWaitSyncAPPLE(@PointerWrapper("GLsync") org.lwjgl.opengl.GLSync sync, @GLbitfield int flags, @GLuint64 long timeout); + + void glWaitSyncAPPLE(@PointerWrapper("GLsync") org.lwjgl.opengl.GLSync sync, @GLbitfield int flags, @GLuint64 long timeout); + + @StripPostfix("params") + void glGetInteger64vAPPLE(@GLenum int pname, @OutParameter @Check("1") @GLint64 LongBuffer params); + + @Alternate("glGetInteger64vAPPLE") + @GLreturn("params") + @StripPostfix(value = "params", hasPostfix = false) + void glGetInteger64vAPPLE2(@GLenum int pname, @OutParameter @GLint64 LongBuffer params); + + @StripPostfix("values") + void glGetSyncivAPPLE(@PointerWrapper("GLsync") org.lwjgl.opengl.GLSync sync, @GLenum int pname, @AutoSize("values") @GLsizei int bufSize, + @OutParameter @GLsizei @Check(value = "1", canBeNull = true) IntBuffer length, + @OutParameter IntBuffer values); + + @Alternate("glGetSyncivAPPLE") + @GLreturn("values") + @StripPostfix(value = "values", hasPostfix = false) + void glGetSyncivAPPLE2(@PointerWrapper("GLsync") GLSync sync, @GLenum int pname, @Constant("1") @GLsizei int bufSize, + @OutParameter @GLsizei @Constant("0L") IntBuffer length, + @OutParameter IntBuffer values); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/APPLE_texture_format_BGRA8888.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/APPLE_texture_format_BGRA8888.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/APPLE_texture_format_BGRA8888.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/APPLE_texture_format_BGRA8888.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +public interface APPLE_texture_format_BGRA8888 { + + /** Accepted by the <format> parameters of TexImage2D and TexSubImage2D: */ + int GL_BGRA_EXT = 0x80E1; + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/APPLE_texture_max_level.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/APPLE_texture_max_level.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/APPLE_texture_max_level.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/APPLE_texture_max_level.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +public interface APPLE_texture_max_level { + + /** + * Accepted by the <pname> parameter of TexParameteri, TexParameterf, + * TexParameteriv, TexParameterfv, GetTexParameteriv, and GetTexParameterfv: + */ + int GL_TEXTURE_MAX_LEVEL_APPLE = 0x813D; + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/ARB_draw_buffers.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/ARB_draw_buffers.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/ARB_draw_buffers.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/ARB_draw_buffers.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +import org.lwjgl.util.generator.Alternate; +import org.lwjgl.util.generator.AutoSize; +import org.lwjgl.util.generator.Const; +import org.lwjgl.util.generator.Constant; +import org.lwjgl.util.generator.opengl.GLenum; +import org.lwjgl.util.generator.opengl.GLsizei; + +import java.nio.IntBuffer; + +public interface ARB_draw_buffers { + + /** Accepted by the <pname> parameters of GetIntegerv, GetFloatv: */ + int GL_MAX_DRAW_BUFFERS_ARB = 0x8824, + GL_DRAW_BUFFER0_ARB = 0x8825, + GL_DRAW_BUFFER1_ARB = 0x8826, + GL_DRAW_BUFFER2_ARB = 0x8827, + GL_DRAW_BUFFER3_ARB = 0x8828, + GL_DRAW_BUFFER4_ARB = 0x8829, + GL_DRAW_BUFFER5_ARB = 0x882A, + GL_DRAW_BUFFER6_ARB = 0x882B, + GL_DRAW_BUFFER7_ARB = 0x882C, + GL_DRAW_BUFFER8_ARB = 0x882D, + GL_DRAW_BUFFER9_ARB = 0x882E, + GL_DRAW_BUFFER10_ARB = 0x882F, + GL_DRAW_BUFFER11_ARB = 0x8830, + GL_DRAW_BUFFER12_ARB = 0x8831, + GL_DRAW_BUFFER13_ARB = 0x8832, + GL_DRAW_BUFFER14_ARB = 0x8833, + GL_DRAW_BUFFER15_ARB = 0x8834; + + void glDrawBuffersARB(@AutoSize("buffers") @GLsizei int size, @Const @GLenum IntBuffer buffers); + + @Alternate("glDrawBuffersARB") + void glDrawBuffersARB(@Constant("1") @GLsizei int size, @Constant(value = "APIUtil.getInt(buffer)", keepParam = true) int buffer); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/ARB_half_float_pixel.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/ARB_half_float_pixel.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/ARB_half_float_pixel.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/ARB_half_float_pixel.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +public interface ARB_half_float_pixel { + + /** + * Accepted by the <type> parameter of DrawPixels, ReadPixels, + * TexImage1D, TexImage2D, TexImage3D, GetTexImage, TexSubImage1D, + * TexSubImage2D, TexSubImage3D: + */ + int GL_HALF_FLOAT_ARB = 0x140B; + +} diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/ARB_texture_rectangle.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/ARB_texture_rectangle.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/ARB_texture_rectangle.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/ARB_texture_rectangle.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +public interface ARB_texture_rectangle { + + /** + * Accepted by the <cap> parameter of Enable, Disable and IsEnabled; + * by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv + * and GetDoublev; and by the <target> parameter of BindTexture, + * GetTexParameterfv, GetTexParameteriv, TexParameterf, TexParameteri, + * TexParameterfv and TexParameteriv: + * Accepted by the <target> parameter of GetTexImage, + * GetTexLevelParameteriv, GetTexLevelParameterfv, TexImage2D, + * CopyTexImage2D, TexSubImage2D and CopySubTexImage2D: + */ + int GL_TEXTURE_RECTANGLE_ARB = 0x84F5; + + /** + * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, + * GetFloatv and GetDoublev: + */ + int GL_TEXTURE_BINDING_RECTANGLE_ARB = 0x84F6; + + /** + * Accepted by the <target> parameter of GetTexLevelParameteriv, + * GetTexLevelParameterfv, GetTexParameteriv and TexImage2D: + */ + int GL_PROXY_TEXTURE_RECTANGLE_ARB = 0x84F7; + + /** + * Accepted by the <pname> parameter of GetBooleanv, GetDoublev, + * GetIntegerv and GetFloatv: + */ + int GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB = 0x84F8; + + /** + * Returned by <type> parameter of GetActiveUniform when the location + * <index> for program object <program> is of type sampler2DRect: + */ + int GL_SAMPLER_2D_RECT_ARB = 0x8B63; + + /** + * Returned by <type> parameter of GetActiveUniform when the location + * <index> for program object <program> is of type sampler2DRectShadow: + */ + int GL_SAMPLER_2D_RECT_SHADOW_ARB = 0x8B64; + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/ARM_mali_shader_binary.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/ARM_mali_shader_binary.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/ARM_mali_shader_binary.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/ARM_mali_shader_binary.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +public interface ARM_mali_shader_binary { + + /** Accepted by the <binaryFormat> parameter of ShaderBinary: */ + int GL_MALI_SHADER_BINARY_ARM = 0x8F60; + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/ARM_rgba8.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/ARM_rgba8.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/ARM_rgba8.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/ARM_rgba8.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +public interface ARM_rgba8 { + + /** Accepted by the <internalformat> parameter of RenderbufferStorage: */ + int GL_RGBA8_OES = 0x8058; + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/DMP_shader_binary.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/DMP_shader_binary.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/DMP_shader_binary.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/DMP_shader_binary.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +public interface DMP_shader_binary { + + /** Accepted by the <binaryformat> parameter of ShaderBinary: */ + int GL_SHADER_BINARY_DMP = 0x9250; + +} diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/EXT_bgra.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/EXT_bgra.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/EXT_bgra.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/EXT_bgra.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +public interface EXT_bgra { + + /** + * Accepted by the <format> parameter of DrawPixels, GetTexImage, + * ReadPixels, TexImage1D, and TexImage2D: + */ + int GL_BGR_EXT = 0x80E0, + GL_BGRA_EXT = 0x80E1; + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/EXT_blend_minmax.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/EXT_blend_minmax.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/EXT_blend_minmax.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/EXT_blend_minmax.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +import org.lwjgl.util.generator.opengl.GLenum; + +public interface EXT_blend_minmax { + + /** Accepted by the <mode> parameter of BlendEquationEXT: */ + int GL_FUNC_ADD_EXT = 0x8006, + GL_MIN_EXT = 0x8007, + GL_MAX_EXT = 0x8008; + + void glBlendEquationEXT(@GLenum int mode); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/EXT_Cg_shader.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/EXT_Cg_shader.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/EXT_Cg_shader.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/EXT_Cg_shader.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +public interface EXT_Cg_shader { + + /** + * You can pass GL_CG_VERTEX_SHADER_EXT to glCreateShader instead of GL_VERTEX_SHADER to create a vertex shader + * that will parse and compile its shader source with the Cg compiler front-end rather than the GLSL front-end. Likewise, you + * can pass GL_CG_FRAGMENT_SHADER_EXT to glCreateShader instead of GL_FRAGMENT_SHADER to create a fragment shader object + * that will parse and compile its shader source with the Cg front-end rather than the GLSL front-end. + */ + int GL_CG_VERTEX_SHADER_EXT = 0x890E, + GL_CG_FRAGMENT_SHADER_EXT = 0x890F; + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/EXT_color_buffer_half_float.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/EXT_color_buffer_half_float.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/EXT_color_buffer_half_float.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/EXT_color_buffer_half_float.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +public interface EXT_color_buffer_half_float { + + /** + * Accepted by the <internalformat> parameter of RenderbufferStorage and + * RenderbufferStorageMultisampleAPPLE: + */ + int GL_RGBA16F_EXT = 0x881A, + GL_RGB16F_EXT = 0x881B, + GL_RG16F_EXT = 0x822F, + GL_R16F_EXT = 0x822D; + + /** Accepted by the <pname> parameter of GetFramebufferAttachmentParameteriv: */ + int GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT = 0x8211; + + /** Returned in <params> by GetFramebufferAttachmentParameteriv: */ + int GL_UNSIGNED_NORMALIZED_EXT = 0x8C17; + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/EXT_copy_texture_levels.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/EXT_copy_texture_levels.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/EXT_copy_texture_levels.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/EXT_copy_texture_levels.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +import org.lwjgl.util.generator.opengl.GLsizei; +import org.lwjgl.util.generator.opengl.GLuint; + +public interface EXT_copy_texture_levels { + + void glCopyTextureLevelsAPPLE(@GLuint int destinationTexture, @GLuint int sourceTexture, + int sourceBaseLevel, @GLsizei int sourceLevelCount); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/EXT_debug_label.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/EXT_debug_label.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/EXT_debug_label.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/EXT_debug_label.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +import org.lwjgl.util.generator.*; +import org.lwjgl.util.generator.opengl.*; + +import java.nio.ByteBuffer; +import java.nio.IntBuffer; + +public interface EXT_debug_label { + + /** + * Accepted by the <type> parameter of LabelObjectEXT and + * GetObjectLabelEXT: + */ + int GL_BUFFER_OBJECT_EXT = 0x9151, + GL_SHADER_OBJECT_EXT = 0x8B48, + GL_PROGRAM_OBJECT_EXT = 0x8B40, + GL_VERTEX_ARRAY_OBJECT_EXT = 0x9154, + GL_QUERY_OBJECT_EXT = 0x9153, + GL_PROGRAM_PIPELINE_OBJECT_EXT = 0x8A4F; + + void glLabelObjectEXT(@GLenum int type, @GLuint int object, + @AutoSize("label") @GLsizei int length, + @Const @GLchar ByteBuffer label); + + @Alternate("glLabelObjectEXT") + void glLabelObjectEXT(@GLenum int type, @GLuint int object, + @Constant("label.length()") @GLsizei int length, + CharSequence label); + + void glGetObjectLabelEXT(@GLenum int type, @GLuint int object, + @AutoSize(value = "label", canBeNull = true) @GLsizei int bufSize, + @Check(value = "1", canBeNull = true) @OutParameter @GLsizei IntBuffer length, + @Check(canBeNull = true) @OutParameter @GLchar ByteBuffer label); + + @Alternate("glGetObjectLabelEXT") + @GLreturn(value = "label", maxLength = "bufSize") + void glGetObjectLabelEXT2(@GLenum int type, @GLuint int object, + @GLsizei int bufSize, + @Constant("MemoryUtil.getAddress0(label_length)") @OutParameter @GLsizei IntBuffer length, + @OutParameter @GLchar ByteBuffer label); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/EXT_debug_marker.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/EXT_debug_marker.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/EXT_debug_marker.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/EXT_debug_marker.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +import org.lwjgl.util.generator.Alternate; +import org.lwjgl.util.generator.AutoSize; +import org.lwjgl.util.generator.Const; +import org.lwjgl.util.generator.Constant; +import org.lwjgl.util.generator.opengl.GLchar; +import org.lwjgl.util.generator.opengl.GLsizei; + +import java.nio.ByteBuffer; + +public interface EXT_debug_marker { + + void glInsertEventMarkerEXT(@AutoSize("marker") @GLsizei int length, @Const @GLchar ByteBuffer marker); + + @Alternate("glInsertEventMarkerEXT") + void glInsertEventMarkerEXT(@Constant("marker.length()") @GLsizei int length, CharSequence marker); + + void glPushGroupMarkerEXT(@AutoSize("marker") @GLsizei int length, @Const @GLchar ByteBuffer marker); + + @Alternate("glPushGroupMarkerEXT") + void glPushGroupMarkerEXT(@Constant("marker.length()") @GLsizei int length, CharSequence marker); + + void glPopGroupMarkerEXT(); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/EXT_discard_framebuffer.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/EXT_discard_framebuffer.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/EXT_discard_framebuffer.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/EXT_discard_framebuffer.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +import org.lwjgl.util.generator.AutoSize; +import org.lwjgl.util.generator.Const; +import org.lwjgl.util.generator.opengl.GLenum; +import org.lwjgl.util.generator.opengl.GLsizei; + +import java.nio.IntBuffer; + +public interface EXT_discard_framebuffer { + + /** + * Accepted in the <attachments> parameter of DiscardFramebufferEXT when the + * default framebuffer is bound to <target>: + */ + int GL_COLOR_EXT = 0x1800, + GL_DEPTH_EXT = 0x1801, + GL_STENCIL_EXT = 0x1802; + + void glDiscardFramebufferEXT(@GLenum int target, @AutoSize("attachments") @GLsizei int numAttachments, @Const @GLenum IntBuffer attachments); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/EXT_frag_depth.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/EXT_frag_depth.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/EXT_frag_depth.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/EXT_frag_depth.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +public interface EXT_frag_depth { + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/EXT_map_buffer_range.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/EXT_map_buffer_range.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/EXT_map_buffer_range.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/EXT_map_buffer_range.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2002-2012 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +import org.lwjgl.util.generator.AutoSize; +import org.lwjgl.util.generator.CachedResult; +import org.lwjgl.util.generator.opengl.*; + +import java.nio.ByteBuffer; + +public interface EXT_map_buffer_range { + + /** Accepted by the <access> parameter of MapBufferRangeEXT: */ + int GL_MAP_READ_BIT_EXT = 0x0001, + GL_MAP_WRITE_BIT_EXT = 0x0002, + GL_MAP_INVALIDATE_RANGE_BIT_EXT = 0x0004, + GL_MAP_INVALIDATE_BUFFER_BIT_EXT = 0x0008, + GL_MAP_FLUSH_EXPLICIT_BIT_EXT = 0x0010, + GL_MAP_UNSYNCHRONIZED_BIT_EXT = 0x0020; + + /** + * glMapBufferRange maps a GL buffer object range to a ByteBuffer. The old_buffer argument can be null, + * in which case a new ByteBuffer will be created, pointing to the returned memory. If old_buffer is non-null, + * it will be returned if it points to the same mapped memory and has the same capacity as the buffer object, + * otherwise a new ByteBuffer is created. That way, an application will normally use glMapBufferRange like this: + *

        + * ByteBuffer mapped_buffer; mapped_buffer = glMapBufferRange(..., ..., ..., ..., null); ... // Another map on the same buffer mapped_buffer = glMapBufferRange(..., ..., ..., ..., mapped_buffer); + *

        + * Only ByteBuffers returned from this method are to be passed as the old_buffer argument. User-created ByteBuffers cannot be reused. + * + * @param old_buffer A ByteBuffer. If this argument points to the same address and has the same capacity as the new mapping, it will be returned and no new buffer will be created. + * + * @return A ByteBuffer representing the mapped buffer memory. + */ + @CachedResult(isRange = true) + @GLvoid + @AutoSize("length") + ByteBuffer glMapBufferRangeEXT(@GLenum int target, @GLintptr long offset, @GLsizeiptr long length, @GLbitfield int access); + + void glFlushMappedBufferRangeEXT(@GLenum int target, @GLintptr long offset, @GLsizeiptr long length); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/EXT_multi_draw_arrays.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/EXT_multi_draw_arrays.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/EXT_multi_draw_arrays.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/EXT_multi_draw_arrays.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +import org.lwjgl.util.generator.AutoSize; +import org.lwjgl.util.generator.Check; +import org.lwjgl.util.generator.opengl.GLenum; +import org.lwjgl.util.generator.opengl.GLint; +import org.lwjgl.util.generator.opengl.GLsizei; + +import java.nio.IntBuffer; + +public interface EXT_multi_draw_arrays { + + void glMultiDrawArraysEXT(@GLenum int mode, @GLint IntBuffer first, @Check("first.remaining()") @GLsizei IntBuffer count, @AutoSize("first") @GLsizei int primcount); + + //void glMultiDrawElementsEXT(GLenum mode, GLsizei*count, GLenum type, const GLvoid**indices, GLsizei primcount) + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/EXT_multisampled_render_to_texture.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/EXT_multisampled_render_to_texture.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/EXT_multisampled_render_to_texture.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/EXT_multisampled_render_to_texture.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +import org.lwjgl.util.generator.opengl.GLenum; +import org.lwjgl.util.generator.opengl.GLsizei; +import org.lwjgl.util.generator.opengl.GLuint; + +public interface EXT_multisampled_render_to_texture { + + /** Accepted by the <pname> parameter of GetRenderbufferParameteriv: */ + int GL_RENDERBUFFER_SAMPLES_EXT = 0x9133; + + /** Returned by CheckFramebufferStatus: */ + int GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT = 0x9134; + + /** + * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, + * and GetFloatv: + */ + int GL_MAX_SAMPLES_EXT = 0x9135; + + /** Accepted by the <pname> parameter of GetFramebufferAttachmentParameteriv: */ + int GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SAMPLES_EXT = 0x8D6C; + + void glRenderbufferStorageMultisampleEXT( + @GLenum int target, @GLsizei int samples, + @GLenum int internalformat, + @GLsizei int width, @GLsizei int height); + + void glFramebufferTexture2DMultisampleEXT( + @GLenum int target, @GLenum int attachment, + @GLenum int textarget, @GLuint int texture, + int level, @GLsizei int samples); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/EXT_multiview_draw_buffers.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/EXT_multiview_draw_buffers.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/EXT_multiview_draw_buffers.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/EXT_multiview_draw_buffers.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +import org.lwjgl.util.generator.*; +import org.lwjgl.util.generator.opengl.GLenum; +import org.lwjgl.util.generator.opengl.GLreturn; +import org.lwjgl.util.generator.opengl.GLuint; + +import java.nio.IntBuffer; + +public interface EXT_multiview_draw_buffers { + + /** Accepted by the <location> parameter of DrawBuffersIndexedEXT: */ + int GL_COLOR_ATTACHMENT_EXT = 0x90F0, + GL_MULTIVIEW_EXT = 0x90F1; + + /** Accepted by the <target> parameter of GetIntegeri_EXT: */ + int GL_DRAW_BUFFER_EXT = 0x0C01, + GL_READ_BUFFER_EXT = 0x0C02; + + /** Accepted by the <target> parameter of GetInteger: */ + int GL_MAX_MULTIVIEW_BUFFERS_EXT = 0x90F2; + + void glReadBufferIndexedEXT(@GLenum int src, int index); + + void glDrawBuffersIndexedEXT(@AutoSize("indices") int n, @Check("indices.remaining()") @Const @GLenum IntBuffer location, + @Const IntBuffer indices); + + @StripPostfix("data") + void glGetIntegeri_vEXT(@GLenum int target, @GLuint int index, @OutParameter @Check("4") IntBuffer data); + + @Alternate("glGetIntegeri_vEXT") + @GLreturn("data") + @StripPostfix("data") + void glGetIntegeri_vEXT2(@GLenum int value, @GLuint int index, @OutParameter IntBuffer data); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/EXT_occlusion_query_boolean.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/EXT_occlusion_query_boolean.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/EXT_occlusion_query_boolean.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/EXT_occlusion_query_boolean.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,94 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +import org.lwjgl.util.generator.*; +import org.lwjgl.util.generator.opengl.GLenum; +import org.lwjgl.util.generator.opengl.GLreturn; +import org.lwjgl.util.generator.opengl.GLsizei; +import org.lwjgl.util.generator.opengl.GLuint; + +import java.nio.IntBuffer; + +public interface EXT_occlusion_query_boolean { + + /** + * Accepted by the <target> parameter of BeginQueryEXT, EndQueryEXT, + * and GetQueryivEXT: + */ + int GL_ANY_SAMPLES_PASSED_EXT = 0x8C2F, + GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT = 0x8D6A; + + /** Accepted by the <pname> parameter of GetQueryivEXT: */ + int GL_CURRENT_QUERY_EXT = 0x8865; + + /** + * Accepted by the <pname> parameter of GetQueryObjectivEXT and + * GetQueryObjectuivEXT: + */ + int GL_QUERY_RESULT_EXT = 0x8866, + GL_QUERY_RESULT_AVAILABLE_EXT = 0x8867; + + void glGenQueriesEXT(@AutoSize("ids") @GLsizei int n, @OutParameter @GLuint IntBuffer ids); + + @Alternate("glGenQueriesEXT") + @GLreturn("ids") + void glGenQueriesEXT2(@Constant("1") @GLsizei int n, @OutParameter @GLuint IntBuffer ids); + + void glDeleteQueriesEXT(@AutoSize("ids") @GLsizei int n, @GLuint IntBuffer ids); + + @Alternate("glDeleteQueriesEXT") + void glDeleteQueriesEXT(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getInt(id)", keepParam = true) int id); + + boolean glIsQueryEXT(@GLuint int id); + + void glBeginQueryEXT(@GLenum int target, @GLuint int id); + + void glEndQueryEXT(@GLenum int target); + + @StripPostfix("params") + void glGetQueryivEXT(@GLenum int target, @GLenum int pname, @OutParameter @Check("1") IntBuffer params); + + @Alternate("glGetQueryivEXT") + @GLreturn("params") + @StripPostfix(value = "params", hasPostfix = false) + void glGetQueryivEXT2(@GLenum int target, @GLenum int pname, @OutParameter IntBuffer params); + + @StripPostfix("params") + void glGetQueryObjectuivEXT(@GLuint int id, @GLenum int pname, @OutParameter @Check("1") IntBuffer params); + + @Alternate("glGetQueryObjectuivEXT") + @GLreturn("params") + @StripPostfix(value = "params", hasPostfix = false) + void glGetQueryObjectuivEXT2(@GLuint int id, @GLenum int pname, @OutParameter IntBuffer params); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/EXT_packed_float.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/EXT_packed_float.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/EXT_packed_float.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/EXT_packed_float.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +public interface EXT_packed_float { + + /** + * Accepted by the <internalformat> parameter of TexImage1D, + * TexImage2D, TexImage3D, CopyTexImage1D, CopyTexImage2D, and + * RenderbufferStorage: + */ + int GL_R11F_G11F_B10F_EXT = 0x8C3A; + + /** + * Accepted by the <type> parameter of DrawPixels, ReadPixels, + * TexImage1D, TexImage2D, GetTexImage, TexImage3D, TexSubImage1D, + * TexSubImage2D, TexSubImage3D: + */ + int GL_UNSIGNED_INT_10F_11F_11F_REV_EXT = 0x8C3B; + + /** Accepted by the <pname> parameters of GetIntegerv and GetFloatv: */ + int GL_RGBA_SIGNED_COMPONENTS_EXT = 0x8C3C; + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/EXT_read_format_bgra.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/EXT_read_format_bgra.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/EXT_read_format_bgra.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/EXT_read_format_bgra.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +public interface EXT_read_format_bgra { + + /** Accepted by the <format> parameter of ReadPixels: */ + int GL_BGRA_EXT = 0x80E1; + + /** Accepted by the <type> parameter of ReadPixels: */ + int GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT = 0x8365, + GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT = 0x8366; + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/EXT_robustness.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/EXT_robustness.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/EXT_robustness.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/EXT_robustness.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +import org.lwjgl.util.generator.AutoSize; +import org.lwjgl.util.generator.OutParameter; +import org.lwjgl.util.generator.StripPostfix; +import org.lwjgl.util.generator.opengl.*; + +import java.nio.Buffer; +import java.nio.FloatBuffer; +import java.nio.IntBuffer; + +public interface EXT_robustness { + + /** Returned by GetGraphicsResetStatusEXT: */ + int GL_NO_ERROR = 0x0000, + GL_GUILTY_CONTEXT_RESET_EXT = 0x8253, + GL_INNOCENT_CONTEXT_RESET_EXT = 0x8254, + GL_UNKNOWN_CONTEXT_RESET_EXT = 0x8255; + + /** + * Accepted by the <value> parameter of GetBooleanv, GetIntegerv, + * and GetFloatv: + */ + int GL_CONTEXT_ROBUST_ACCESS_EXT = 0x90F3, + GL_RESET_NOTIFICATION_STRATEGY_EXT = 0x8256; + + /** + * Returned by GetIntegerv and related simple queries when <value> is + * RESET_NOTIFICATION_STRATEGY_EXT : + */ + int GL_LOSE_CONTEXT_ON_RESET_EXT = 0x8252, + GL_NO_RESET_NOTIFICATION_EXT = 0x8261; + + @GLenum + int glGetGraphicsResetStatusEXT(); + + void glReadnPixelsEXT(int x, int y, @GLsizei int width, @GLsizei int height, + @GLenum int format, @GLenum int type, @AutoSize("data") @GLsizei int bufSize, + @OutParameter @GLbyte @GLshort @GLint @GLfloat Buffer data); + + @StripPostfix("params") + void glGetnUniformfvEXT(@GLuint int program, int location, @AutoSize("params") @GLsizei int bufSize, @OutParameter FloatBuffer params); + + @StripPostfix("params") + void glGetnUniformivEXT(@GLuint int program, int location, @AutoSize("params") @GLsizei int bufSize, @OutParameter IntBuffer params); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/EXT_separate_shader_objects.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/EXT_separate_shader_objects.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/EXT_separate_shader_objects.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/EXT_separate_shader_objects.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,180 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +import org.lwjgl.util.generator.*; +import org.lwjgl.util.generator.opengl.*; + +import java.nio.ByteBuffer; +import java.nio.FloatBuffer; +import java.nio.IntBuffer; + +public interface EXT_separate_shader_objects { + + /** Accepted by <stages> parameter to UseProgramStagesEXT: */ + int GL_VERTEX_SHADER_BIT_EXT = 0x00000001, + GL_FRAGMENT_SHADER_BIT_EXT = 0x00000002, + GL_ALL_SHADER_BITS_EXT = 0xFFFFFFFF; + + /** + * Accepted by the <pname> parameter of ProgramParameteriEXT and + * GetProgramiv: + */ + int GL_PROGRAM_SEPARABLE_EXT = 0x8258; + + /** Accepted by <type> parameter to GetProgramPipelineivEXT: */ + int GL_ACTIVE_PROGRAM_EXT = 0x8259; + + /** + * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, and + * GetFloatv: + */ + int GL_PROGRAM_PIPELINE_BINDING_EXT = 0x825A; + + void glUseProgramStagesEXT(@GLuint int pipeline, @GLbitfield int stages, @GLuint int program); + + void glActiveShaderProgramEXT(@GLuint int pipeline, @GLuint int program); + + /** Single null-terminated source code string. */ + @StripPostfix(value = "string", hasPostfix = false) + @GLuint + int glCreateShaderProgramvEXT(@GLenum int type, @Constant("1") @GLsizei int count, @NullTerminated @Check @Const @Indirect @GLchar ByteBuffer string); + + /** Multiple null-terminated source code strings, one after the other. */ + @Alternate(value = "glCreateShaderProgramvEXT", nativeAlt = true) + @StripPostfix(value = "strings", hasPostfix = false) + @GLuint + int glCreateShaderProgramvEXT2(@GLenum int type, @GLsizei int count, @NullTerminated("count") @Check @Const @Indirect @GLchar @PointerArray("count") ByteBuffer strings); + + @Alternate(value = "glCreateShaderProgramvEXT", nativeAlt = true) + @StripPostfix(value = "strings", hasPostfix = false) + @GLuint + int glCreateShaderProgramvEXT3(@GLenum int type, @Constant("strings.length") @GLsizei int count, @NullTerminated @Check("1") @PointerArray(value = "count") @Const @NativeType("GLchar") ByteBuffer[] strings); + + @Alternate("glCreateShaderProgramvEXT") + @StripPostfix(value = "string", hasPostfix = false) + @GLuint + int glCreateShaderProgramvEXT(@GLenum int type, @Constant("1") @GLsizei int count, @NullTerminated CharSequence string); + + @Alternate(value = "glCreateShaderProgramvEXT", nativeAlt = true, skipNative = true) + @StripPostfix(value = "strings", hasPostfix = false) + @GLuint + int glCreateShaderProgramvEXT2(@GLenum int type, @Constant("strings.length") @GLsizei int count, + @Const @NullTerminated @PointerArray(value = "count") CharSequence[] strings); + + void glBindProgramPipelineEXT(@GLuint int pipeline); + + void glDeleteProgramPipelinesEXT(@AutoSize("pipelines") @GLsizei int n, @Const @GLuint IntBuffer pipelines); + + @Alternate("glDeleteProgramPipelinesEXT") + void glDeleteProgramPipelinesEXT(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getInt(pipeline)", keepParam = true) int pipeline); + + void glGenProgramPipelinesEXT(@AutoSize("pipelines") @GLsizei int n, @OutParameter @GLuint IntBuffer pipelines); + + @Alternate("glGenProgramPipelinesEXT") + @GLreturn("pipelines") + void glGenProgramPipelinesEXT2(@Constant("1") @GLsizei int n, @OutParameter @GLuint IntBuffer pipelines); + + boolean glIsProgramPipelineEXT(@GLuint int pipeline); + + void glProgramParameteriEXT(@GLuint int program, @GLenum int pname, int value); + + @StripPostfix("params") + void glGetProgramPipelineivEXT(@GLuint int pipeline, @GLenum int pname, @OutParameter @Check("1") IntBuffer params); + + @Alternate("glGetProgramPipelineivEXT") + @GLreturn("params") + @StripPostfix(value = "params", hasPostfix = false) + void glGetProgramPipelineivEXT2(@GLuint int pipeline, @GLenum int pname, @OutParameter IntBuffer params); + + void glProgramUniform1iEXT(@GLuint int program, int location, int v0); + + void glProgramUniform2iEXT(@GLuint int program, int location, int v0, int v1); + + void glProgramUniform3iEXT(@GLuint int program, int location, int v0, int v1, int v2); + + void glProgramUniform4iEXT(@GLuint int program, int location, int v0, int v1, int v2, int v3); + + void glProgramUniform1fEXT(@GLuint int program, int location, float v0); + + void glProgramUniform2fEXT(@GLuint int program, int location, float v0, float v1); + + void glProgramUniform3fEXT(@GLuint int program, int location, float v0, float v1, float v2); + + void glProgramUniform4fEXT(@GLuint int program, int location, float v0, float v1, float v2, float v3); + + @StripPostfix("value") + void glProgramUniform1ivEXT(@GLuint int program, int location, @AutoSize("value") @GLsizei int count, @Const IntBuffer value); + + @StripPostfix("value") + void glProgramUniform2ivEXT(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 1") @GLsizei int count, @Const IntBuffer value); + + @StripPostfix("value") + void glProgramUniform3ivEXT(@GLuint int program, int location, @AutoSize(value = "value", expression = " / 3") @GLsizei int count, @Const IntBuffer value); + + @StripPostfix("value") + void glProgramUniform4ivEXT(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 2") @GLsizei int count, @Const IntBuffer value); + + @StripPostfix("value") + void glProgramUniform1fvEXT(@GLuint int program, int location, @AutoSize("value") @GLsizei int count, @Const FloatBuffer value); + + @StripPostfix("value") + void glProgramUniform2fvEXT(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 1") @GLsizei int count, @Const FloatBuffer value); + + @StripPostfix("value") + void glProgramUniform3fvEXT(@GLuint int program, int location, @AutoSize(value = "value", expression = " / 3") @GLsizei int count, @Const FloatBuffer value); + + @StripPostfix("value") + void glProgramUniform4fvEXT(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 2") @GLsizei int count, @Const FloatBuffer value); + + @StripPostfix("value") + void glProgramUniformMatrix2fvEXT(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 2") @GLsizei int count, boolean transpose, @Const FloatBuffer value); + + @StripPostfix("value") + void glProgramUniformMatrix3fvEXT(@GLuint int program, int location, @AutoSize(value = "value", expression = " / (3 * 3)") @GLsizei int count, boolean transpose, @Const FloatBuffer value); + + @StripPostfix("value") + void glProgramUniformMatrix4fvEXT(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 4") @GLsizei int count, boolean transpose, @Const FloatBuffer value); + + void glValidateProgramPipelineEXT(@GLuint int pipeline); + + void glGetProgramPipelineInfoLogEXT(@GLuint int pipeline, @AutoSize("infoLog") @GLsizei int bufSize, + @OutParameter @Check(value = "1", canBeNull = true) @GLsizei IntBuffer length, + @OutParameter @GLchar ByteBuffer infoLog); + + @Alternate("glGetProgramPipelineInfoLogEXT") + @GLreturn(value = "infoLog", maxLength = "bufSize") + void glGetProgramPipelineInfoLogEXT2(@GLuint int pipeline, @GLsizei int bufSize, + @OutParameter @GLsizei @Constant("MemoryUtil.getAddress0(infoLog_length)") IntBuffer length, + @OutParameter @GLchar ByteBuffer infoLog); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/EXT_shader_framebuffer_fetch.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/EXT_shader_framebuffer_fetch.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/EXT_shader_framebuffer_fetch.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/EXT_shader_framebuffer_fetch.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2002-2012 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +public interface EXT_shader_framebuffer_fetch { + + /** + * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, + * and GetDoublev: + */ + int GL_FRAGMENT_SHADER_DISCARDS_SAMPLES_EXT = 0x8A52; + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/EXT_shader_texture_lod.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/EXT_shader_texture_lod.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/EXT_shader_texture_lod.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/EXT_shader_texture_lod.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +public interface EXT_shader_texture_lod { + +} diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/EXT_shadow_samplers.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/EXT_shadow_samplers.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/EXT_shadow_samplers.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/EXT_shadow_samplers.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +public interface EXT_shadow_samplers { + + /** + * Accepted by the <pname> parameter of TexParameterf, TexParameteri, + * TexParameterfv, TexParameteriv, GetTexParameterfv, and GetTexParameteriv: + */ + int GL_TEXTURE_COMPARE_MODE_EXT = 0x884C, + GL_TEXTURE_COMPARE_FUNC_EXT = 0x884D; + + /** + * Accepted by the <param> parameter of TexParameterf, TexParameteri, + * TexParameterfv, and TexParameteriv when the <pname> parameter is + * TEXTURE_COMPARE_MODE_EXT: + */ + int GL_COMPARE_REF_TO_TEXTURE_EXT = 0x884E; + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/EXT_sRGB.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/EXT_sRGB.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/EXT_sRGB.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/EXT_sRGB.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +public interface EXT_sRGB { + + /** + * Accepted by the <format> and <internalformat> parameter of TexImage2D, and + * TexImage3DOES. These are also accepted by <format> parameter of + * TexSubImage2D and TexSubImage3DOES: + */ + int GL_SRGB_EXT = 0x8C40, + GL_SRGB_ALPHA_EXT = 0x8C42; + + /** Accepted by the <internalformat> parameter of RenderbufferStorage: */ + int GL_SRGB8_ALPHA8_EXT = 0x8C43; + + /** Accepted by the <pname> parameter of GetFramebufferAttachmentParameteriv: */ + int GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT = 0x8210; + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/EXT_texture_array.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/EXT_texture_array.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/EXT_texture_array.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/EXT_texture_array.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +import org.lwjgl.util.generator.opengl.GLenum; +import org.lwjgl.util.generator.opengl.GLuint; + +public interface EXT_texture_array { + + /** + * Accepted by the <target> parameter of TexParameteri, TexParameteriv, + * TexParameterf, TexParameterfv, and BindTexture: + */ + int GL_TEXTURE_1D_ARRAY_EXT = 0x8C18, + GL_TEXTURE_2D_ARRAY_EXT = 0x8C1A; + + /** + * Accepted by the <target> parameter of TexImage3D, TexSubImage3D, + * CopyTexSubImage3D, CompressedTexImage3D, and CompressedTexSubImage3D: + */ + int GL_PROXY_TEXTURE_2D_ARRAY_EXT = 0x8C1B; + + /** + * Accepted by the <target> parameter of TexImage2D, TexSubImage2D, + * CopyTexImage2D, CopyTexSubImage2D, CompressedTexImage2D, and + * CompressedTexSubImage2D: + */ + int GL_PROXY_TEXTURE_1D_ARRAY_EXT = 0x8C19; + + /** + * Accepted by the <pname> parameter of GetBooleanv, GetDoublev, GetIntegerv + * and GetFloatv: + */ + int GL_TEXTURE_BINDING_1D_ARRAY_EXT = 0x8C1C, + GL_TEXTURE_BINDING_2D_ARRAY_EXT = 0x8C1D, + GL_MAX_ARRAY_TEXTURE_LAYERS_EXT = 0x88FF; + + /** + * Accepted by the <pname> parameter of + * GetFramebufferAttachmentParameterivEXT: + */ + int GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT = 0x8CD4; + + /** Returned by the <type> parameter of GetActiveUniform: */ + int GL_SAMPLER_1D_ARRAY_EXT = 0x8DC0, + GL_SAMPLER_2D_ARRAY_EXT = 0x8DC1; + + void glFramebufferTextureLayerEXT(@GLenum int target, @GLenum int attachment, @GLuint int texture, int level, int layer); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/EXT_texture_compression_dxt1.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/EXT_texture_compression_dxt1.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/EXT_texture_compression_dxt1.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/EXT_texture_compression_dxt1.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +import org.lwjgl.util.generator.Extension; + +@Extension(postfix = "EXT", className = "EXTTextureCompressionDXT1") +public interface EXT_texture_compression_dxt1 { + + /** + * Accepted by the <internalformat> parameter of CompressedTexImage2D + * and the <format> parameter of CompressedTexSubImage2D: + */ + int GL_COMPRESSED_RGB_S3TC_DXT1_EXT = 0x83F0, + GL_COMPRESSED_RGBA_S3TC_DXT1_EXT = 0x83F1; + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/EXT_texture_compression_latc.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/EXT_texture_compression_latc.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/EXT_texture_compression_latc.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/EXT_texture_compression_latc.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +import org.lwjgl.util.generator.Extension; + +@Extension(postfix = "EXT", className = "EXTTextureCompressionLATC") +public interface EXT_texture_compression_latc { + + /** + * Accepted by the <internalformat> parameter of TexImage2D, + * CopyTexImage2D, and CompressedTexImage2D and the <format> parameter + * of CompressedTexSubImage2D: + */ + int GL_COMPRESSED_LUMINANCE_LATC1_EXT = 0x8C70, + GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT = 0x8C71, + GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT = 0x8C72, + GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT = 0x8C73; + +} diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/EXT_texture_compression_s3tc.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/EXT_texture_compression_s3tc.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/EXT_texture_compression_s3tc.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/EXT_texture_compression_s3tc.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +import org.lwjgl.util.generator.Extension; + +@Extension(postfix = "EXT", className = "EXTTextureCompressionS3TC") +public interface EXT_texture_compression_s3tc { + + /** + * Accepted by the <internalformat> parameter of TexImage2D, CopyTexImage2D, + * and CompressedTexImage2D and the <format> parameter of + * CompressedTexSubImage2D: + */ + int GL_COMPRESSED_RGB_S3TC_DXT1_EXT = 0x83F0, + GL_COMPRESSED_RGBA_S3TC_DXT1_EXT = 0x83F1, + GL_COMPRESSED_RGBA_S3TC_DXT3_EXT = 0x83F2, + GL_COMPRESSED_RGBA_S3TC_DXT5_EXT = 0x83F3; + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/EXT_texture_filter_anisotropic.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/EXT_texture_filter_anisotropic.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/EXT_texture_filter_anisotropic.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/EXT_texture_filter_anisotropic.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +public interface EXT_texture_filter_anisotropic { + + /** + * Accepted by the <pname> parameters of GetTexParameterfv, + * GetTexParameteriv, TexParameterf, TexParameterfv, TexParameteri, + * and TexParameteriv: + */ + int GL_TEXTURE_MAX_ANISOTROPY_EXT = 0x84FE; + + /** + * Accepted by the <pname> parameters of GetBooleanv, + * GetFloatv, and GetIntegerv: + */ + int GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT = 0x84FF; + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/EXT_texture_format_BGRA8888.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/EXT_texture_format_BGRA8888.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/EXT_texture_format_BGRA8888.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/EXT_texture_format_BGRA8888.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +public interface EXT_texture_format_BGRA8888 { + + /** + * Accepted by the <format> and <internalformat> parameters of TexImage2D + * and the <format> parameter of TexSubImage2D: + */ + int GL_BGRA_EXT = 0x80E1; + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/EXT_texture_lod_bias.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/EXT_texture_lod_bias.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/EXT_texture_lod_bias.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/EXT_texture_lod_bias.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +import org.lwjgl.util.generator.Extension; + +@Extension(postfix = "EXT", className = "EXTTextureLODBias") +public interface EXT_texture_lod_bias { + + /** + * Accepted by the <target> parameters of GetTexEnvfv, GetTexEnviv, + * TexEnvi, TexEnvf, Texenviv, and TexEnvfv: + */ + int GL_TEXTURE_FILTER_CONTROL_EXT = 0x8500; + + /** + * When the <target> parameter of GetTexEnvfv, GetTexEnviv, TexEnvi, + * TexEnvf, TexEnviv, and TexEnvfv is TEXTURE_FILTER_CONTROL_EXT, then + * the value of <pname> may be: + */ + int GL_TEXTURE_LOD_BIAS_EXT = 0x8501; + + /** + * Accepted by the <pname> parameters of GetBooleanv, GetIntegerv, + * GetFloatv, and GetDoublev: + */ + int GL_MAX_TEXTURE_LOD_BIAS_EXT = 0x84FD; + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/EXT_texture_rg.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/EXT_texture_rg.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/EXT_texture_rg.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/EXT_texture_rg.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +public interface EXT_texture_rg { + + /** + * Accepted by the <internalformat> parameter of TexImage2D and CopyTexImage2D, + * and the <format> parameter of TexImage2D, TexSubImage2D, and ReadPixels: + */ + int GL_RED_EXT = 0x1903, + GL_RG_EXT = 0x8227; + + /** + * Accepted by the <internalformat> parameter of RenderbufferStorage and + * RenderbufferStorageMultisampleAPPLE: + */ + int GL_R8_EXT = 0x8229, + GL_RG8_EXT = 0x822B; + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/EXT_texture_storage.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/EXT_texture_storage.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/EXT_texture_storage.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/EXT_texture_storage.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +import org.lwjgl.util.generator.opengl.GLenum; +import org.lwjgl.util.generator.opengl.GLsizei; +import org.lwjgl.util.generator.opengl.GLuint; + +public interface EXT_texture_storage { + + /** Accepted by the <value> parameter of GetTexParameter{if}v: */ + + int GL_TEXTURE_IMMUTABLE_FORMAT_EXT = 0x912F; + /** + * Accepted by the <internalformat> parameter of TexStorage* when + * implemented on OpenGL ES: + */ + int GL_ALPHA8_EXT = 0x803C, + GL_LUMINANCE8_EXT = 0x8040, + GL_LUMINANCE8_ALPHA8_EXT = 0x8045, + GL_RGBA32F_EXT = 0x8814, + GL_RGB32F_EXT = 0x8815, + GL_ALPHA32F_EXT = 0x8816, + GL_LUMINANCE32F_EXT = 0x8818, + GL_LUMINANCE_ALPHA32F_EXT = 0x8819, + GL_RGBA16F_EXT = 0x881A, + GL_RGB16F_EXT = 0x881B, + GL_ALPHA16F_EXT = 0x881C, + GL_LUMINANCE16F_EXT = 0x881E, + GL_LUMINANCE_ALPHA16F_EXT = 0x881F, + GL_RGB10_A2_EXT = 0x8059, + GL_RGB10_EXT = 0x8052, + GL_BGRA8_EXT = 0x93A1; + + void glTexStorage1DEXT(@GLenum int target, @GLsizei int levels, + @GLenum int internalformat, + @GLsizei int width); + + void glTexStorage2DEXT(@GLenum int target, @GLsizei int levels, + @GLenum int internalformat, + @GLsizei int width, @GLsizei int height); + + void glTexStorage3DEXT(@GLenum int target, @GLsizei int levels, + @GLenum int internalformat, + @GLsizei int width, @GLsizei int height, @GLsizei int depth); + + void glTextureStorage1DEXT(@GLuint int texture, @GLenum int target, @GLsizei int levels, + @GLenum int internalformat, + @GLsizei int width); + + void glTextureStorage2DEXT(@GLuint int texture, @GLenum int target, @GLsizei int levels, + @GLenum int internalformat, + @GLsizei int width, @GLsizei int height); + + void glTextureStorage3DEXT(@GLuint int texture, @GLenum int target, @GLsizei int levels, + @GLenum int internalformat, + @GLsizei int width, @GLsizei int height, @GLsizei int depth); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/EXT_texture_type_2_10_10_10_REV.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/EXT_texture_type_2_10_10_10_REV.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/EXT_texture_type_2_10_10_10_REV.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/EXT_texture_type_2_10_10_10_REV.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +public interface EXT_texture_type_2_10_10_10_REV { + + /** Accepted by the <type> parameter of TexImage2D and TexImage3D: */ + int GL_UNSIGNED_INT_2_10_10_10_REV_EXT = 0x8368; + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/EXT_unpack_subimage.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/EXT_unpack_subimage.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/EXT_unpack_subimage.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/EXT_unpack_subimage.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +public interface EXT_unpack_subimage { + + /** + * Accepted by the <pname> parameters of PixelStorei, GetIntegerv, and + * GetFloatv: + */ + int GL_UNPACK_ROW_LENGTH = 0x0CF2, + GL_UNPACK_SKIP_ROWS = 0x0CF3, + GL_UNPACK_SKIP_PIXELS = 0x0CF4; + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/GLES20.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/GLES20.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/GLES20.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/GLES20.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,1050 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +import org.lwjgl.util.generator.*; +import org.lwjgl.util.generator.opengl.*; + +import java.nio.Buffer; +import java.nio.ByteBuffer; +import java.nio.FloatBuffer; +import java.nio.IntBuffer; + +public interface GLES20 { + + /** ClearBufferMask */ + int GL_DEPTH_BUFFER_BIT = 0x00000100, + GL_STENCIL_BUFFER_BIT = 0x00000400, + GL_COLOR_BUFFER_BIT = 0x00004000; + + /** Boolean */ + int GL_FALSE = 0, + GL_TRUE = 1; + + /** BeginMode */ + int GL_POINTS = 0x0000, + GL_LINES = 0x0001, + GL_LINE_LOOP = 0x0002, + GL_LINE_STRIP = 0x0003, + GL_TRIANGLES = 0x0004, + GL_TRIANGLE_STRIP = 0x0005, + GL_TRIANGLE_FAN = 0x0006; + + /** BlendingFactorDest */ + int GL_ZERO = 0, + GL_ONE = 1, + GL_SRC_COLOR = 0x0300, + GL_ONE_MINUS_SRC_COLOR = 0x0301, + GL_SRC_ALPHA = 0x0302, + GL_ONE_MINUS_SRC_ALPHA = 0x0303, + GL_DST_ALPHA = 0x0304, + GL_ONE_MINUS_DST_ALPHA = 0x0305; + + /** BlendingFactorSrc */ + int +/* GL_ZERO */ +/* GL_ONE */ + GL_DST_COLOR = 0x0306, + GL_ONE_MINUS_DST_COLOR = 0x0307, + GL_SRC_ALPHA_SATURATE = 0x0308; +/* GL_SRC_ALPHA */ +/* GL_ONE_MINUS_SRC_ALPHA */ +/* GL_DST_ALPHA */ +/* GL_ONE_MINUS_DST_ALPHA */ + + /** BlendEquationSeparate */ + int GL_FUNC_ADD = 0x8006, + GL_BLEND_EQUATION = 0x8009, + GL_BLEND_EQUATION_RGB = 0x8009, /* same as BLEND_EQUATION */ + GL_BLEND_EQUATION_ALPHA = 0x883D; + + /** BlendSubtract */ + int GL_FUNC_SUBTRACT = 0x800A, + GL_FUNC_REVERSE_SUBTRACT = 0x800B; + + /** Separate Blend Functions */ + int GL_BLEND_DST_RGB = 0x80C8, + GL_BLEND_SRC_RGB = 0x80C9, + GL_BLEND_DST_ALPHA = 0x80CA, + GL_BLEND_SRC_ALPHA = 0x80CB, + GL_CONSTANT_COLOR = 0x8001, + GL_ONE_MINUS_CONSTANT_COLOR = 0x8002, + GL_CONSTANT_ALPHA = 0x8003, + GL_ONE_MINUS_CONSTANT_ALPHA = 0x8004, + GL_BLEND_COLOR = 0x8005; + + /** Buffer Objects */ + int GL_ARRAY_BUFFER = 0x8892, + GL_ELEMENT_ARRAY_BUFFER = 0x8893, + GL_ARRAY_BUFFER_BINDING = 0x8894, + GL_ELEMENT_ARRAY_BUFFER_BINDING = 0x8895, + GL_STREAM_DRAW = 0x88E0, + GL_STATIC_DRAW = 0x88E4, + GL_DYNAMIC_DRAW = 0x88E8, + GL_BUFFER_SIZE = 0x8764, + GL_BUFFER_USAGE = 0x8765, + GL_CURRENT_VERTEX_ATTRIB = 0x8626; + + /** CullFaceMode */ + int GL_FRONT = 0x0404, + GL_BACK = 0x0405, + GL_FRONT_AND_BACK = 0x0408; + +/** DepthFunction */ +/* GL_NEVER */ +/* GL_LESS */ +/* GL_EQUAL */ +/* GL_LEQUAL */ +/* GL_GREATER */ +/* GL_NOTEQUAL */ +/* GL_GEQUAL */ +/* GL_ALWAYS */ + + /** EnableCap */ + int GL_TEXTURE_2D = 0x0DE1, + GL_CULL_FACE = 0x0B44, + GL_BLEND = 0x0BE2, + GL_DITHER = 0x0BD0, + GL_STENCIL_TEST = 0x0B90, + GL_DEPTH_TEST = 0x0B71, + GL_SCISSOR_TEST = 0x0C11, + GL_POLYGON_OFFSET_FILL = 0x8037, + GL_SAMPLE_ALPHA_TO_COVERAGE = 0x809E, + GL_SAMPLE_COVERAGE = 0x80A0; + + /** ErrorCode */ + int GL_NO_ERROR = 0, + GL_INVALID_ENUM = 0x0500, + GL_INVALID_VALUE = 0x0501, + GL_INVALID_OPERATION = 0x0502, + GL_OUT_OF_MEMORY = 0x0505; + + /** FrontFaceDirection */ + int GL_CW = 0x0900, + GL_CCW = 0x0901; + + /** GetPName */ + int GL_LINE_WIDTH = 0x0B21, + GL_ALIASED_POINT_SIZE_RANGE = 0x846D, + GL_ALIASED_LINE_WIDTH_RANGE = 0x846E, + GL_CULL_FACE_MODE = 0x0B45, + GL_FRONT_FACE = 0x0B46, + GL_DEPTH_RANGE = 0x0B70, + GL_DEPTH_WRITEMASK = 0x0B72, + GL_DEPTH_CLEAR_VALUE = 0x0B73, + GL_DEPTH_FUNC = 0x0B74, + GL_STENCIL_CLEAR_VALUE = 0x0B91, + GL_STENCIL_FUNC = 0x0B92, + GL_STENCIL_FAIL = 0x0B94, + GL_STENCIL_PASS_DEPTH_FAIL = 0x0B95, + GL_STENCIL_PASS_DEPTH_PASS = 0x0B96, + GL_STENCIL_REF = 0x0B97, + GL_STENCIL_VALUE_MASK = 0x0B93, + GL_STENCIL_WRITEMASK = 0x0B98, + GL_STENCIL_BACK_FUNC = 0x8800, + GL_STENCIL_BACK_FAIL = 0x8801, + GL_STENCIL_BACK_PASS_DEPTH_FAIL = 0x8802, + GL_STENCIL_BACK_PASS_DEPTH_PASS = 0x8803, + GL_STENCIL_BACK_REF = 0x8CA3, + GL_STENCIL_BACK_VALUE_MASK = 0x8CA4, + GL_STENCIL_BACK_WRITEMASK = 0x8CA5, + GL_VIEWPORT = 0x0BA2, + GL_SCISSOR_BOX = 0x0C10, + /* GL_SCISSOR_TEST */ + GL_COLOR_CLEAR_VALUE = 0x0C22, + GL_COLOR_WRITEMASK = 0x0C23, + GL_UNPACK_ALIGNMENT = 0x0CF5, + GL_PACK_ALIGNMENT = 0x0D05, + GL_MAX_TEXTURE_SIZE = 0x0D33, + GL_MAX_VIEWPORT_DIMS = 0x0D3A, + GL_SUBPIXEL_BITS = 0x0D50, + GL_RED_BITS = 0x0D52, + GL_GREEN_BITS = 0x0D53, + GL_BLUE_BITS = 0x0D54, + GL_ALPHA_BITS = 0x0D55, + GL_DEPTH_BITS = 0x0D56, + GL_STENCIL_BITS = 0x0D57, + GL_POLYGON_OFFSET_UNITS = 0x2A00, + /* GL_POLYGON_OFFSET_FILL */ + GL_POLYGON_OFFSET_FACTOR = 0x8038, + GL_TEXTURE_BINDING_2D = 0x8069, + GL_SAMPLE_BUFFERS = 0x80A8, + GL_SAMPLES = 0x80A9, + GL_SAMPLE_COVERAGE_VALUE = 0x80AA, + GL_SAMPLE_COVERAGE_INVERT = 0x80AB; + + /** GetTextureParameter */ + int +/* GL_TEXTURE_MAG_FILTER */ +/* GL_TEXTURE_MIN_FILTER */ +/* GL_TEXTURE_WRAP_S */ +/* GL_TEXTURE_WRAP_T */ + GL_NUM_COMPRESSED_TEXTURE_FORMATS = 0x86A2, + GL_COMPRESSED_TEXTURE_FORMATS = 0x86A3; + + /** HintMode */ + int GL_DONT_CARE = 0x1100, + GL_FASTEST = 0x1101, + GL_NICEST = 0x1102; + + /** HintTarget */ + int GL_GENERATE_MIPMAP_HINT = 0x8192; + + /** DataType */ + int GL_BYTE = 0x1400, + GL_UNSIGNED_BYTE = 0x1401, + GL_SHORT = 0x1402, + GL_UNSIGNED_SHORT = 0x1403, + GL_INT = 0x1404, + GL_UNSIGNED_INT = 0x1405, + GL_FLOAT = 0x1406, + GL_FIXED = 0x140C; + + /** PixelFormat */ + int GL_DEPTH_COMPONENT = 0x1902, + GL_ALPHA = 0x1906, + GL_RGB = 0x1907, + GL_RGBA = 0x1908, + GL_LUMINANCE = 0x1909, + GL_LUMINANCE_ALPHA = 0x190A; + + /** PixelType */ + int +/* GL_UNSIGNED_BYTE */ + GL_UNSIGNED_SHORT_4_4_4_4 = 0x8033, + GL_UNSIGNED_SHORT_5_5_5_1 = 0x8034, + GL_UNSIGNED_SHORT_5_6_5 = 0x8363; + + /** Shaders */ + int GL_FRAGMENT_SHADER = 0x8B30, + GL_VERTEX_SHADER = 0x8B31, + GL_MAX_VERTEX_ATTRIBS = 0x8869, + GL_MAX_VERTEX_UNIFORM_VECTORS = 0x8DFB, + GL_MAX_VARYING_VECTORS = 0x8DFC, + GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS = 0x8B4D, + GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS = 0x8B4C, + GL_MAX_TEXTURE_IMAGE_UNITS = 0x8872, + GL_MAX_FRAGMENT_UNIFORM_VECTORS = 0x8DFD, + GL_SHADER_TYPE = 0x8B4F, + GL_DELETE_STATUS = 0x8B80, + GL_LINK_STATUS = 0x8B82, + GL_VALIDATE_STATUS = 0x8B83, + GL_ATTACHED_SHADERS = 0x8B85, + GL_ACTIVE_UNIFORMS = 0x8B86, + GL_ACTIVE_UNIFORM_MAX_LENGTH = 0x8B87, + GL_ACTIVE_ATTRIBUTES = 0x8B89, + GL_ACTIVE_ATTRIBUTE_MAX_LENGTH = 0x8B8A, + GL_SHADING_LANGUAGE_VERSION = 0x8B8C, + GL_CURRENT_PROGRAM = 0x8B8D; + + /** StencilFunction */ + int GL_NEVER = 0x0200, + GL_LESS = 0x0201, + GL_EQUAL = 0x0202, + GL_LEQUAL = 0x0203, + GL_GREATER = 0x0204, + GL_NOTEQUAL = 0x0205, + GL_GEQUAL = 0x0206, + GL_ALWAYS = 0x0207; + + /** StencilOp */ + int +/* GL_ZERO */ + GL_KEEP = 0x1E00, + GL_REPLACE = 0x1E01, + GL_INCR = 0x1E02, + GL_DECR = 0x1E03, + GL_INVERT = 0x150A, + GL_INCR_WRAP = 0x8507, + GL_DECR_WRAP = 0x8508; + + /** StringName */ + int GL_VENDOR = 0x1F00, + GL_RENDERER = 0x1F01, + GL_VERSION = 0x1F02, + GL_EXTENSIONS = 0x1F03; + + /** TextureMagFilter */ + int GL_NEAREST = 0x2600, + GL_LINEAR = 0x2601; + + /** TextureMinFilter */ + int +/* GL_NEAREST */ +/* GL_LINEAR */ + GL_NEAREST_MIPMAP_NEAREST = 0x2700, + GL_LINEAR_MIPMAP_NEAREST = 0x2701, + GL_NEAREST_MIPMAP_LINEAR = 0x2702, + GL_LINEAR_MIPMAP_LINEAR = 0x2703; + + /** TextureParameterName */ + int GL_TEXTURE_MAG_FILTER = 0x2800, + GL_TEXTURE_MIN_FILTER = 0x2801, + GL_TEXTURE_WRAP_S = 0x2802, + GL_TEXTURE_WRAP_T = 0x2803; + + /** TextureTarget */ + int +/* GL_TEXTURE_2D */ + GL_TEXTURE = 0x1702, + GL_TEXTURE_CUBE_MAP = 0x8513, + GL_TEXTURE_BINDING_CUBE_MAP = 0x8514, + GL_TEXTURE_CUBE_MAP_POSITIVE_X = 0x8515, + GL_TEXTURE_CUBE_MAP_NEGATIVE_X = 0x8516, + GL_TEXTURE_CUBE_MAP_POSITIVE_Y = 0x8517, + GL_TEXTURE_CUBE_MAP_NEGATIVE_Y = 0x8518, + GL_TEXTURE_CUBE_MAP_POSITIVE_Z = 0x8519, + GL_TEXTURE_CUBE_MAP_NEGATIVE_Z = 0x851A, + GL_MAX_CUBE_MAP_TEXTURE_SIZE = 0x851C; + + /** TextureUnit */ + int GL_TEXTURE0 = 0x84C0, + GL_TEXTURE1 = 0x84C1, + GL_TEXTURE2 = 0x84C2, + GL_TEXTURE3 = 0x84C3, + GL_TEXTURE4 = 0x84C4, + GL_TEXTURE5 = 0x84C5, + GL_TEXTURE6 = 0x84C6, + GL_TEXTURE7 = 0x84C7, + GL_TEXTURE8 = 0x84C8, + GL_TEXTURE9 = 0x84C9, + GL_TEXTURE10 = 0x84CA, + GL_TEXTURE11 = 0x84CB, + GL_TEXTURE12 = 0x84CC, + GL_TEXTURE13 = 0x84CD, + GL_TEXTURE14 = 0x84CE, + GL_TEXTURE15 = 0x84CF, + GL_TEXTURE16 = 0x84D0, + GL_TEXTURE17 = 0x84D1, + GL_TEXTURE18 = 0x84D2, + GL_TEXTURE19 = 0x84D3, + GL_TEXTURE20 = 0x84D4, + GL_TEXTURE21 = 0x84D5, + GL_TEXTURE22 = 0x84D6, + GL_TEXTURE23 = 0x84D7, + GL_TEXTURE24 = 0x84D8, + GL_TEXTURE25 = 0x84D9, + GL_TEXTURE26 = 0x84DA, + GL_TEXTURE27 = 0x84DB, + GL_TEXTURE28 = 0x84DC, + GL_TEXTURE29 = 0x84DD, + GL_TEXTURE30 = 0x84DE, + GL_TEXTURE31 = 0x84DF, + GL_ACTIVE_TEXTURE = 0x84E0; + + /** TextureWrapMode */ + int GL_REPEAT = 0x2901, + GL_CLAMP_TO_EDGE = 0x812F, + GL_MIRRORED_REPEAT = 0x8370; + + /** Uniform Types */ + int GL_FLOAT_VEC2 = 0x8B50, + GL_FLOAT_VEC3 = 0x8B51, + GL_FLOAT_VEC4 = 0x8B52, + GL_INT_VEC2 = 0x8B53, + GL_INT_VEC3 = 0x8B54, + GL_INT_VEC4 = 0x8B55, + GL_BOOL = 0x8B56, + GL_BOOL_VEC2 = 0x8B57, + GL_BOOL_VEC3 = 0x8B58, + GL_BOOL_VEC4 = 0x8B59, + GL_FLOAT_MAT2 = 0x8B5A, + GL_FLOAT_MAT3 = 0x8B5B, + GL_FLOAT_MAT4 = 0x8B5C, + GL_SAMPLER_2D = 0x8B5E, + GL_SAMPLER_CUBE = 0x8B60; + + /** Vertex Arrays */ + int GL_VERTEX_ATTRIB_ARRAY_ENABLED = 0x8622, + GL_VERTEX_ATTRIB_ARRAY_SIZE = 0x8623, + GL_VERTEX_ATTRIB_ARRAY_STRIDE = 0x8624, + GL_VERTEX_ATTRIB_ARRAY_TYPE = 0x8625, + GL_VERTEX_ATTRIB_ARRAY_NORMALIZED = 0x886A, + GL_VERTEX_ATTRIB_ARRAY_POINTER = 0x8645, + GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING = 0x889F; + + /** Read Format */ + int GL_IMPLEMENTATION_COLOR_READ_TYPE = 0x8B9A, + GL_IMPLEMENTATION_COLOR_READ_FORMAT = 0x8B9B; + + /** Shader Source */ + int GL_COMPILE_STATUS = 0x8B81, + GL_INFO_LOG_LENGTH = 0x8B84, + GL_SHADER_SOURCE_LENGTH = 0x8B88, + GL_SHADER_COMPILER = 0x8DFA; + + /** Shader Binary */ + int GL_SHADER_BINARY_FORMATS = 0x8DF8, + GL_NUM_SHADER_BINARY_FORMATS = 0x8DF9; + + /** Shader Precision-Specified Types */ + int GL_LOW_FLOAT = 0x8DF0, + GL_MEDIUM_FLOAT = 0x8DF1, + GL_HIGH_FLOAT = 0x8DF2, + GL_LOW_INT = 0x8DF3, + GL_MEDIUM_INT = 0x8DF4, + GL_HIGH_INT = 0x8DF5; + + /** Framebuffer Object. */ + int GL_FRAMEBUFFER = 0x8D40, + GL_RENDERBUFFER = 0x8D41, + GL_RGBA4 = 0x8056, + GL_RGB5_A1 = 0x8057, + GL_RGB565 = 0x8D62, + GL_DEPTH_COMPONENT16 = 0x81A5, + GL_STENCIL_INDEX = 0x1901, + GL_STENCIL_INDEX8 = 0x8D48, + GL_RENDERBUFFER_WIDTH = 0x8D42, + GL_RENDERBUFFER_HEIGHT = 0x8D43, + GL_RENDERBUFFER_INTERNAL_FORMAT = 0x8D44, + GL_RENDERBUFFER_RED_SIZE = 0x8D50, + GL_RENDERBUFFER_GREEN_SIZE = 0x8D51, + GL_RENDERBUFFER_BLUE_SIZE = 0x8D52, + GL_RENDERBUFFER_ALPHA_SIZE = 0x8D53, + GL_RENDERBUFFER_DEPTH_SIZE = 0x8D54, + GL_RENDERBUFFER_STENCIL_SIZE = 0x8D55, + GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE = 0x8CD0, + GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME = 0x8CD1, + GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL = 0x8CD2, + GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE = 0x8CD3, + GL_COLOR_ATTACHMENT0 = 0x8CE0, + GL_DEPTH_ATTACHMENT = 0x8D00, + GL_STENCIL_ATTACHMENT = 0x8D20, + GL_NONE = 0, + GL_FRAMEBUFFER_COMPLETE = 0x8CD5, + GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT = 0x8CD6, + GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = 0x8CD7, + GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS = 0x8CD9, + GL_FRAMEBUFFER_UNSUPPORTED = 0x8CDD, + GL_FRAMEBUFFER_BINDING = 0x8CA6, + GL_RENDERBUFFER_BINDING = 0x8CA7, + GL_MAX_RENDERBUFFER_SIZE = 0x84E8, + GL_INVALID_FRAMEBUFFER_OPERATION = 0x0506; + + void glActiveTexture(@GLenum int texture); + + void glAttachShader(@GLuint int program, @GLuint int shader); + + void glBindAttribLocation(@GLuint int program, @GLuint int index, @NullTerminated @Const @GLchar ByteBuffer name); + + @Alternate("glBindAttribLocation") + void glBindAttribLocation(@GLuint int program, @GLuint int index, @NullTerminated CharSequence name); + + @Code(" StateTracker.bindBuffer(target, buffer);") + void glBindBuffer(@GLenum int target, @GLuint int buffer); + + void glBindFramebuffer(@GLenum int target, @GLuint int framebuffer); + + void glBindRenderbuffer(@GLenum int target, @GLuint int renderbuffer); + + void glBindTexture(@GLenum int target, @GLuint int texture); + + void glBlendColor(@GLclampf float red, @GLclampf float green, @GLclampf float blue, @GLclampf float alpha); + + void glBlendEquation(@GLenum int mode); + + void glBlendEquationSeparate(@GLenum int modeRGB, @GLenum int modeAlpha); + + void glBlendFunc(@GLenum int sfactor, @GLenum int dfactor); + + void glBlendFuncSeparate(@GLenum int srcRGB, @GLenum int dstRGB, @GLenum int srcAlpha, @GLenum int dstAlpha); + + @GenerateAutos + void glBufferData(@GLenum int target, @AutoSize("data") @GLsizeiptr long size, + @Check @Const @GLbyte @GLshort @GLint @GLfloat Buffer data, @GLenum int usage); + + void glBufferSubData(@GLenum int target, @GLintptr long offset, @AutoSize("data") @GLsizeiptr long size, + @Check @Const @GLbyte @GLshort @GLint @GLfloat Buffer data); + + @GLenum + int glCheckFramebufferStatus(@GLenum int target); + + void glClear(@GLbitfield int mask); + + void glClearColor(@GLclampf float red, @GLclampf float green, @GLclampf float blue, @GLclampf float alpha); + + void glClearDepthf(@GLclampf float depth); + + void glClearStencil(@GLint int s); + + void glColorMask(@GLboolean boolean red, @GLboolean boolean green, @GLboolean boolean blue, @GLboolean boolean alpha); + + void glCompileShader(@GLuint int shader); + + void glCompressedTexImage2D(@GLenum int target, int level, @GLenum int internalformat, @GLsizei int width, @GLsizei int height, int border, @AutoSize("data") @GLsizei int imageSize, + @Check @Const @GLvoid ByteBuffer data); + + void glCompressedTexSubImage2D(@GLenum int target, int level, int xoffset, int yoffset, @GLsizei int width, @GLsizei int height, @GLenum int format, @AutoSize("data") @GLsizei int imageSize, + @Check @Const @GLvoid ByteBuffer data); + + void glCopyTexImage2D(@GLenum int target, @GLint int level, @GLenum int internalformat, @GLint int x, @GLint int y, @GLsizei int width, @GLsizei int height, @GLint int border); + + void glCopyTexSubImage2D(@GLenum int target, @GLint int level, @GLint int xoffset, @GLint int yoffset, @GLint int x, @GLint int y, @GLsizei int width, @GLsizei int height); + + @GLuint + int glCreateProgram(); + + @GLuint + int glCreateShader(@GLenum int type); + + void glCullFace(@GLenum int mode); + + void glDeleteBuffers(@AutoSize("buffers") @GLsizei int n, @Const @GLuint IntBuffer buffers); + + @Alternate("glDeleteBuffers") + void glDeleteBuffers(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getInt(buffer)", keepParam = true) int buffer); + + void glDeleteFramebuffers(@AutoSize("framebuffers") int n, @Const @GLuint IntBuffer framebuffers); + + @Alternate("glDeleteFramebuffers") + void glDeleteFramebuffers(@Constant("1") int n, @Constant(value = "APIUtil.getInt(framebuffer)", keepParam = true) int framebuffer); + + void glDeleteProgram(@GLuint int program); + + void glDeleteRenderbuffers(@AutoSize("renderbuffers") int n, @Const @GLuint IntBuffer renderbuffers); + + @Alternate("glDeleteRenderbuffers") + void glDeleteRenderbuffers(@Constant("1") int n, @Constant(value = "APIUtil.getInt(renderbuffer)", keepParam = true) int renderbuffer); + + void glDeleteShader(@GLuint int shader); + + void glDeleteTextures(@AutoSize("textures") @GLsizei int n, @Const @GLuint IntBuffer textures); + + @Alternate("glDeleteTextures") + void glDeleteTextures(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getInt(texture)", keepParam = true) int texture); + + void glDepthFunc(@GLenum int func); + + void glDepthMask(@GLboolean boolean flag); + + void glDepthRangef(@GLclampf float zNear, @GLclampf float zFar); + + void glDetachShader(@GLuint int program, @GLuint int shader); + + void glDisable(@GLenum int cap); + + void glDisableVertexAttribArray(@GLuint int index); + + void glDrawArrays(@GLenum int mode, @GLint int first, @GLsizei int count); + + void glDrawElements(@GLenum int mode, @AutoSize("indices") @GLsizei int count, @AutoType("indices") @GLenum int type, + @BufferObject(BufferKind.ElementVBO) @Const @GLubyte @GLushort @GLuint Buffer indices); + + void glEnable(@GLenum int cap); + + void glEnableVertexAttribArray(@GLuint int index); + + void glFinish(); + + void glFlush(); + + void glFramebufferRenderbuffer(@GLenum int target, @GLenum int attachment, @GLenum int renderbuffertarget, @GLuint int renderbuffer); + + void glFramebufferTexture2D(@GLenum int target, @GLenum int attachment, @GLenum int textarget, @GLuint int texture, @GLint int level); + + void glFrontFace(@GLenum int mode); + + void glGenBuffers(@AutoSize("buffers") @GLsizei int n, @OutParameter @GLuint IntBuffer buffers); + + @Alternate("glGenBuffers") + @GLreturn("buffers") + void glGenBuffers2(@Constant("1") @GLsizei int n, @OutParameter @GLuint IntBuffer buffers); + + void glGenerateMipmap(@GLenum int target); + + void glGenFramebuffers(@AutoSize("framebuffers") int n, @OutParameter @GLuint IntBuffer framebuffers); + + @Alternate("glGenFramebuffers") + @GLreturn("framebuffers") + void glGenFramebuffers2(@Constant("1") int n, @OutParameter @GLuint IntBuffer framebuffers); + + void glGenRenderbuffers(@AutoSize("renderbuffers") int n, @OutParameter @GLuint IntBuffer renderbuffers); + + @Alternate("glGenRenderbuffers") + @GLreturn("renderbuffers") + void glGenRenderbuffers2(@Constant("1") int n, @OutParameter @GLuint IntBuffer renderbuffers); + + void glGenTextures(@AutoSize("textures") @GLsizei int n, @OutParameter @GLuint IntBuffer textures); + + @Alternate("glGenTextures") + @GLreturn("textures") + void glGenTextures2(@Constant("1") @GLsizei int n, @OutParameter @GLuint IntBuffer textures); + + void glGetActiveAttrib(@GLuint int program, @GLuint int index, @AutoSize("name") @GLsizei int bufsize, + @OutParameter @Check(value = "1", canBeNull = true) @GLsizei IntBuffer length, + @OutParameter @Check("1") IntBuffer size, + @OutParameter @Check("1") @GLenum IntBuffer type, + @OutParameter @GLchar ByteBuffer name); + + /** Overloads glGetActiveAttrib. This version returns both size and type in the sizeType buffer (at .position() and .position() + 1). */ + @Alternate("glGetActiveAttrib") + @GLreturn(value = "name", maxLength = "bufsize") + void glGetActiveAttrib2(@GLuint int program, @GLuint int index, @GLsizei int bufsize, + @OutParameter @Constant("MemoryUtil.getAddress0(name_length)") @GLsizei IntBuffer length, + @OutParameter @Check("2") IntBuffer sizeType, + @OutParameter @Constant("MemoryUtil.getAddress(sizeType, sizeType.position() + 1)") @GLenum IntBuffer type, + @OutParameter @GLchar ByteBuffer name); + + /** Overloads glGetActiveAttrib. This version returns only the attrib name. */ + @Alternate(value = "glGetActiveAttrib", javaAlt = true) + @GLreturn(value = "name", maxLength = "bufsize") + void glGetActiveAttrib(@GLuint int program, @GLuint int index, @GLsizei int bufsize, + @OutParameter @GLsizei @Constant("MemoryUtil.getAddress0(name_length), MemoryUtil.getAddress0(APIUtil.getBufferInt()), MemoryUtil.getAddress(APIUtil.getBufferInt(), 1)") IntBuffer length, + @OutParameter @GLchar ByteBuffer name); + + /** Overloads glGetActiveAttrib. This version returns only the attrib size. */ + @Alternate(value = "glGetActiveAttrib", javaAlt = true) + @GLreturn(value = "size") + void glGetActiveAttribSize(@GLuint int program, @GLuint int index, @Constant("0") @GLsizei int bufsize, + @OutParameter @GLsizei @Constant("0L") IntBuffer length, + @OutParameter IntBuffer size, + @OutParameter @GLenum @Constant("MemoryUtil.getAddress(size, 1)") IntBuffer type, // Reuse size buffer and ignore + @OutParameter @GLchar @Constant("APIUtil.getBufferByte0()") ByteBuffer name); + + /** Overloads glGetActiveAttrib. This version returns only the attrib type. */ + @Alternate(value = "glGetActiveAttrib", javaAlt = true) + @GLreturn(value = "type") + void glGetActiveAttribType(@GLuint int program, @GLuint int index, @Constant("0") @GLsizei int bufsize, + @OutParameter @GLsizei @Constant("0L") IntBuffer length, + @OutParameter @Constant("MemoryUtil.getAddress(type, 1)") IntBuffer size, // Reuse type buffer and ignore + @OutParameter @GLenum IntBuffer type, + @OutParameter @GLchar @Constant("APIUtil.getBufferByte0()") ByteBuffer name); + + void glGetActiveUniform(@GLuint int program, @GLuint int index, @AutoSize("name") @GLsizei int bufsize, + @OutParameter @Check(value = "1", canBeNull = true) @GLsizei IntBuffer length, + @OutParameter @Check("1") @GLsizei IntBuffer size, + @OutParameter @Check("1") @GLenum IntBuffer type, + @OutParameter @GLchar ByteBuffer name); + + /** Overloads glGetActiveUniform. This version returns both size and type in the sizeType buffer (at .position() and .position() + 1). */ + @Alternate("glGetActiveUniform") + @GLreturn(value = "name", maxLength = "bufsize") + void glGetActiveUniform2(@GLuint int program, @GLuint int index, @GLsizei int bufsize, + @OutParameter @Constant("MemoryUtil.getAddress0(name_length)") @GLsizei IntBuffer length, + @OutParameter @Check("2") IntBuffer sizeType, + @OutParameter @Constant("MemoryUtil.getAddress(sizeType, sizeType.position() + 1)") @GLenum IntBuffer type, + @OutParameter @GLchar ByteBuffer name); + + /** Overloads glGetActiveUniformARB. This version returns only the uniform name. */ + @Alternate(value = "glGetActiveUniform", javaAlt = true) + @GLreturn(value = "name", maxLength = "bufsize") + void glGetActiveUniform(@GLuint int program, @GLuint int index, @GLsizei int bufsize, + @OutParameter @GLsizei @Constant("MemoryUtil.getAddress0(name_length), MemoryUtil.getAddress0(APIUtil.getBufferInt()), MemoryUtil.getAddress(APIUtil.getBufferInt(), 1)") IntBuffer length, + @OutParameter @GLchar ByteBuffer name); + + /** Overloads glGetActiveUniform. This version returns only the uniform size. */ + @Alternate(value = "glGetActiveUniform", javaAlt = true) + @GLreturn(value = "size") + void glGetActiveUniformSize(@GLuint int program, @GLuint int index, @Constant("0") @GLsizei int bufsize, + @OutParameter @GLsizei @Constant("0L") IntBuffer length, + @OutParameter IntBuffer size, + @OutParameter @GLenum @Constant("MemoryUtil.getAddress(size, 1)") IntBuffer type, // Reuse size buffer and ignore + @OutParameter @GLchar @Constant("APIUtil.getBufferByte0()") ByteBuffer name); + + /** Overloads glGetActiveUniform. This version returns only the uniform type. */ + @Alternate(value = "glGetActiveUniform", javaAlt = true) + @GLreturn(value = "type") + void glGetActiveUniformType(@GLuint int program, @GLuint int index, @Constant("0") @GLsizei int bufsize, + @OutParameter @GLsizei @Constant("0L") IntBuffer length, + @OutParameter @Constant("MemoryUtil.getAddress(type, 1)") IntBuffer size, // Reuse type buffer and ignore + @OutParameter @GLenum IntBuffer type, + @OutParameter @GLchar @Constant("APIUtil.getBufferByte0()") ByteBuffer name); + + void glGetAttachedShaders(@GLuint int program, @AutoSize("shaders") @GLsizei int maxCount, + @OutParameter @Check(value = "1", canBeNull = true) @GLsizei IntBuffer count, + @OutParameter @GLuint IntBuffer shaders); + + int glGetAttribLocation(@GLuint int program, @NullTerminated @Const @GLchar ByteBuffer name); + + @Alternate("glGetAttribLocation") + int glGetAttribLocation(@GLuint int program, @NullTerminated CharSequence name); + + @StripPostfix("params") + void glGetBooleanv(@GLenum int pname, @OutParameter @Check("1") @GLboolean ByteBuffer params); + + @Alternate("glGetBooleanv") + @GLreturn("params") + @StripPostfix("params") + void glGetBooleanv2(@GLenum int pname, @OutParameter @GLboolean ByteBuffer params); + + @StripPostfix("params") + void glGetBufferParameteriv(@GLenum int target, @GLenum int pname, @OutParameter @Check("1") IntBuffer params); + + /** @deprecated Will be removed in 3.0. Use {@link #glGetBufferParameteri} instead. */ + @Alternate("glGetBufferParameteriv") + @GLreturn("params") + @StripPostfix("params") + @Reuse(value = "GLES20", method = "glGetBufferParameteri") + @Deprecated + void glGetBufferParameteriv2(@GLenum int target, @GLenum int pname, @OutParameter IntBuffer params); + + @Alternate("glGetBufferParameteriv") + @GLreturn("params") + @StripPostfix(value = "params", hasPostfix = false) + void glGetBufferParameteriv3(@GLenum int target, @GLenum int pname, @OutParameter IntBuffer params); + + @NoErrorCheck + @GLenum + int glGetError(); + + @StripPostfix("params") + void glGetFloatv(@GLenum int pname, @OutParameter @Check("1") FloatBuffer params); + + @Alternate("glGetFloatv") + @GLreturn("params") + @StripPostfix("params") + void glGetFloatv2(@GLenum int pname, @OutParameter FloatBuffer params); + + @StripPostfix("params") + void glGetFramebufferAttachmentParameteriv(@GLenum int target, @GLenum int attachment, @GLenum int pname, @OutParameter @Check("1") IntBuffer params); + + /** @deprecated Will be removed in 3.0. Use {@link #glGetFramebufferAttachmentParameteri} instead. */ + @Alternate("glGetFramebufferAttachmentParameteriv") + @GLreturn("params") + @StripPostfix("params") + @Reuse(value = "GLES20", method = "glGetFramebufferAttachmentParameteri") + @Deprecated + void glGetFramebufferAttachmentParameteriv2(@GLenum int target, @GLenum int attachment, @GLenum int pname, @OutParameter IntBuffer params); + + @Alternate("glGetFramebufferAttachmentParameteriv") + @GLreturn("params") + @StripPostfix(value = "params", hasPostfix = false) + void glGetFramebufferAttachmentParameteriv3(@GLenum int target, @GLenum int attachment, @GLenum int pname, @OutParameter IntBuffer params); + + @StripPostfix("params") + void glGetIntegerv(@GLenum int pname, @OutParameter @Check("1") IntBuffer params); + + @Alternate("glGetIntegerv") + @GLreturn("params") + @StripPostfix("params") + void glGetIntegerv2(@GLenum int pname, @OutParameter IntBuffer params); + + @StripPostfix("params") + void glGetProgramiv(@GLuint int program, @GLenum int pname, @OutParameter @Check("1") IntBuffer params); + + /** @deprecated Will be removed in 3.0. Use {@link #glGetProgrami} instead. */ + @Alternate("glGetProgramiv") + @GLreturn("params") + @StripPostfix("params") + @Reuse(value = "GLES20", method = "glGetProgrami") + @Deprecated + void glGetProgramiv2(@GLuint int program, @GLenum int pname, @OutParameter IntBuffer params); + + @Alternate("glGetProgramiv") + @GLreturn("params") + @StripPostfix(value = "params", hasPostfix = false) + void glGetProgramiv3(@GLuint int program, @GLenum int pname, @OutParameter IntBuffer params); + + void glGetProgramInfoLog(@GLuint int program, @AutoSize("infoLog") @GLsizei int bufsize, + @OutParameter @Check(value = "1", canBeNull = true) @GLsizei IntBuffer length, + @OutParameter @GLchar ByteBuffer infoLog); + + @Alternate("glGetProgramInfoLog") + @GLreturn(value = "infoLog", maxLength = "bufsize") + void glGetProgramInfoLog2(@GLuint int program, @GLsizei int bufsize, + @OutParameter @GLsizei @Constant("MemoryUtil.getAddress0(infoLog_length)") IntBuffer length, + @OutParameter @GLchar ByteBuffer infoLog); + + @StripPostfix("params") + void glGetRenderbufferParameteriv(@GLenum int target, @GLenum int pname, @OutParameter @Check("1") IntBuffer params); + + /** @deprecated Will be removed in 3.0. Use {@link #glGetRenderbufferParameteri} instead. */ + @Alternate("glGetRenderbufferParameteriv") + @GLreturn("params") + @StripPostfix("params") + @Reuse(value = "GLES20", method = "glGetRenderbufferParameteri") + @Deprecated + void glGetRenderbufferParameteriv2(@GLenum int target, @GLenum int pname, @OutParameter IntBuffer params); + + @Alternate("glGetRenderbufferParameteriv") + @GLreturn("params") + @StripPostfix(value = "params", hasPostfix = false) + void glGetRenderbufferParameteriv3(@GLenum int target, @GLenum int pname, @OutParameter IntBuffer params); + + @StripPostfix("params") + void glGetShaderiv(@GLuint int shader, @GLenum int pname, @OutParameter @Check("1") IntBuffer params); + + /** @deprecated Will be removed in 3.0. Use {@link #glGetShaderi} instead. */ + @Alternate("glGetShaderiv") + @GLreturn("params") + @StripPostfix("params") + @Reuse(value = "GLES20", method = "glGetShaderi") + @Deprecated + void glGetShaderiv2(@GLuint int shader, @GLenum int pname, @OutParameter IntBuffer params); + + @Alternate("glGetShaderiv") + @GLreturn("params") + @StripPostfix(value = "params", hasPostfix = false) + void glGetShaderiv3(@GLuint int shader, @GLenum int pname, @OutParameter IntBuffer params); + + void glGetShaderInfoLog(@GLuint int shader, @AutoSize("infoLog") @GLsizei int bufsize, + @OutParameter @Check(value = "1", canBeNull = true) @GLsizei IntBuffer length, + @OutParameter @GLchar ByteBuffer infoLog); + + @Alternate("glGetShaderInfoLog") + @GLreturn(value = "infoLog", maxLength = "bufsize") + void glGetShaderInfoLog2(@GLuint int shader, @GLsizei int bufsize, + @OutParameter @GLsizei @Constant("MemoryUtil.getAddress0(infoLog_length)") IntBuffer length, + @OutParameter @GLchar ByteBuffer infoLog); + + void glGetShaderPrecisionFormat(@GLenum int shadertype, @GLenum int precisiontype, @OutParameter @GLint @Check("2") IntBuffer range, @OutParameter @Check("1") @GLint IntBuffer precision); + + void glGetShaderSource(@GLuint int shader, @AutoSize("source") @GLsizei int bufsize, + @OutParameter @Check(value = "1", canBeNull = true) @GLsizei IntBuffer length, + @OutParameter @GLchar ByteBuffer source); + + @Alternate("glGetShaderSource") + @GLreturn(value = "source", maxLength = "bufsize") + void glGetShaderSource2(@GLuint int shader, @GLsizei int bufsize, + @OutParameter @GLsizei @Constant("MemoryUtil.getAddress0(source_length)") IntBuffer length, + @OutParameter @GLchar ByteBuffer source); + + @Const + String glGetString(@GLenum int name); + + @StripPostfix("params") + void glGetTexParameterfv(@GLenum int target, @GLenum int pname, @OutParameter @Check("1") FloatBuffer params); + + @Alternate("glGetTexParameterfv") + @GLreturn("params") + @StripPostfix(value = "params", hasPostfix = false) + void glGetTexParameterfv2(@GLenum int target, @GLenum int pname, @OutParameter FloatBuffer params); + + @StripPostfix("params") + void glGetTexParameteriv(@GLenum int target, @GLenum int pname, @OutParameter @Check("1") IntBuffer params); + + @Alternate("glGetTexParameteriv") + @GLreturn("params") + @StripPostfix(value = "params", hasPostfix = false) + void glGetTexParameteriv2(@GLenum int target, @GLenum int pname, @OutParameter IntBuffer params); + + @StripPostfix("params") + void glGetUniformfv(@GLuint int program, int location, @OutParameter @Check("1") FloatBuffer params); + + @StripPostfix("params") + void glGetUniformiv(@GLuint int program, int location, @OutParameter @Check("1") IntBuffer params); + + /** + * Returns the location of the uniform with the specified name. The ByteBuffer should contain the uniform name as a + * null-terminated string. + * + * @param program + * @param name + */ + int glGetUniformLocation(@GLuint int program, @NullTerminated @Check("1") @Const @GLchar ByteBuffer name); + + @Alternate("glGetUniformLocation") + int glGetUniformLocation(@GLuint int program, @NullTerminated CharSequence name); + + @StripPostfix("params") + void glGetVertexAttribfv(@GLuint int index, @GLenum int pname, @OutParameter @Check("4") FloatBuffer params); + + @StripPostfix("params") + void glGetVertexAttribiv(@GLuint int index, @GLenum int pname, @OutParameter @Check("4") IntBuffer params); + + @StripPostfix("pointer") + void glGetVertexAttribPointerv(@GLuint int index, @GLenum int pname, @Result @GLvoid ByteBuffer pointer); + + void glHint(@GLenum int target, @GLenum int mode); + + @GLboolean + boolean glIsBuffer(@GLuint int buffer); + + @GLboolean + boolean glIsEnabled(@GLenum int cap); + + @GLboolean + boolean glIsFramebuffer(@GLuint int framebuffer); + + @GLboolean + boolean glIsProgram(@GLuint int program); + + @GLboolean + boolean glIsRenderbuffer(@GLuint int renderbuffer); + + @GLboolean + boolean glIsShader(@GLuint int shader); + + @GLboolean + boolean glIsTexture(@GLuint int texture); + + void glLineWidth(@GLfloat float width); + + void glLinkProgram(@GLuint int program); + + void glPixelStorei(@GLenum int pname, @GLint int param); + + void glPolygonOffset(@GLfloat float factor, @GLfloat float units); + + void glReadPixels(int x, int y, @GLsizei int width, @GLsizei int height, @GLenum int format, @GLenum int type, + @Check("GLChecks.calculateImageStorage(pixels, format, type, width, height, 1)") + @OutParameter @GLbyte @GLshort @GLint @GLfloat Buffer pixels); + + void glReleaseShaderCompiler(); + + void glRenderbufferStorage(@GLenum int target, @GLenum int internalformat, @GLsizei int width, @GLsizei int height); + + void glSampleCoverage(@GLclampf float value, @GLboolean boolean invert); + + void glScissor(@GLint int x, @GLint int y, @GLsizei int width, @GLsizei int height); + + void glShaderBinary(@AutoSize("shaders") @GLsizei int n, @Const @GLuint IntBuffer shaders, @GLenum int binaryformat, @Const @GLvoid ByteBuffer binary, @AutoSize("binary") @GLsizei int length); + + /** + * glShaderSource allows multiple, optionally null-terminated, source strings to define a shader program. + *

        + * This method uses just a single string, that should NOT be null-terminated. + * + * @param shader + * @param string + */ + void glShaderSource(@GLuint int shader, @Constant("1") @GLsizei int count, + @Indirect @Const @Check @GLchar ByteBuffer string, + @AutoSize("string") @Indirect @Const @GLint int length); + + @Alternate("glShaderSource") + void glShaderSource2(@GLuint int shader, @Constant("1") @GLsizei int count, CharSequence string, @Constant("string.length()") @Indirect @Const int length); + + @Alternate(value = "glShaderSource", nativeAlt = true) + void glShaderSource3(@GLuint int shader, @Constant("strings.length") @GLsizei int count, + @Const @PointerArray(value = "count", lengths = "length") CharSequence[] strings, + @Constant("APIUtil.getLengths(strings)") @Const IntBuffer length); + + void glStencilFunc(@GLenum int func, @GLint int ref, @GLuint int mask); + + void glStencilFuncSeparate(@GLenum int face, @GLenum int func, @GLint int ref, @GLuint int mask); + + void glStencilMask(@GLuint int mask); + + void glStencilMaskSeparate(@GLenum int face, @GLuint int mask); + + void glStencilOp(@GLenum int fail, @GLenum int zfail, @GLenum int zpass); + + void glStencilOpSeparate(@GLenum int face, @GLenum int fail, @GLenum int zfail, @GLenum int zpass); + + void glTexImage2D(@GLenum int target, int level, int internalformat, int width, int height, int border, @GLenum int format, @GLenum int type, + @Check(value = "GLChecks.calculateTexImage2DStorage(pixels, format, type, width, height)", canBeNull = true) + @Const @GLbyte @GLshort @GLint @GLfloat Buffer pixels); + + void glTexParameterf(@GLenum int target, @GLenum int pname, @GLfloat float param); + + @StripPostfix("param") + void glTexParameterfv(@GLenum int target, @GLenum int pname, @Check("4") @Const FloatBuffer param); + + void glTexParameteri(@GLenum int target, @GLenum int pname, @GLint int param); + + @StripPostfix("param") + void glTexParameteriv(@GLenum int target, @GLenum int pname, @Check("4") @Const IntBuffer param); + + void glTexSubImage2D(@GLenum int target, int level, int xoffset, int yoffset, @GLsizei int width, @GLsizei int height, @GLenum int format, @GLenum int type, + @Check("GLChecks.calculateImageStorage(pixels, format, type, width, height, 1)") + @Const @GLbyte @GLshort @GLint @GLfloat Buffer pixels); + + void glUniform1f(@GLint int location, @GLfloat float x); + + @StripPostfix("v") + void glUniform1fv(int location, @AutoSize("v") @GLsizei int count, @Const FloatBuffer v); + + void glUniform1i(@GLint int location, @GLint int x); + + @StripPostfix("v") + void glUniform1iv(int location, @AutoSize("v") @GLsizei int count, @Const IntBuffer v); + + void glUniform2f(@GLint int location, @GLfloat float x, @GLfloat float y); + + @StripPostfix("v") + void glUniform2fv(int location, @AutoSize(value = "v", expression = " >> 1") @GLsizei int count, @Const FloatBuffer v); + + void glUniform2i(@GLint int location, @GLint int x, @GLint int y); + + @StripPostfix("v") + void glUniform2iv(int location, @AutoSize(value = "v", expression = " >> 1") @GLsizei int count, @Const IntBuffer v); + + void glUniform3f(@GLint int location, @GLfloat float x, @GLfloat float y, @GLfloat float z); + + @StripPostfix("v") + void glUniform3fv(int location, @AutoSize(value = "v", expression = " / 3") @GLsizei int count, @Const FloatBuffer v); + + void glUniform3i(@GLint int location, @GLint int x, @GLint int y, @GLint int z); + + @StripPostfix("v") + void glUniform3iv(int location, @AutoSize(value = "v", expression = " / 3") @GLsizei int count, @Const IntBuffer v); + + void glUniform4f(@GLint int location, @GLfloat float x, @GLfloat float y, @GLfloat float z, @GLfloat float w); + + @StripPostfix("v") + void glUniform4fv(int location, @AutoSize(value = "v", expression = " >> 2") @GLsizei int count, @Const FloatBuffer v); + + void glUniform4i(@GLint int location, @GLint int x, @GLint int y, @GLint int z, @GLint int w); + + @StripPostfix("v") + void glUniform4iv(int location, @AutoSize(value = "v", expression = " >> 2") @GLsizei int count, @Const IntBuffer v); + + @StripPostfix("matrices") + void glUniformMatrix2fv(int location, @AutoSize(value = "matrices", expression = " >> 2") @GLsizei int count, @GLboolean boolean transpose, @Const FloatBuffer matrices); + + @StripPostfix("matrices") + void glUniformMatrix3fv(int location, @AutoSize(value = "matrices", expression = " / (3 * 3)") @GLsizei int count, @GLboolean boolean transpose, @Const FloatBuffer matrices); + + @StripPostfix("matrices") + void glUniformMatrix4fv(int location, @AutoSize(value = "matrices", expression = " >> 4") @GLsizei int count, @GLboolean boolean transpose, @Const FloatBuffer matrices); + + void glUseProgram(@GLuint int program); + + void glValidateProgram(@GLuint int program); + + void glVertexAttrib1f(@GLuint int indx, @GLfloat float x); + + @StripPostfix("values") + void glVertexAttrib1fv(@GLuint int indx, @Const @Check("1") FloatBuffer values); + + void glVertexAttrib2f(@GLuint int indx, @GLfloat float x, @GLfloat float y); + + @StripPostfix("values") + void glVertexAttrib2fv(@GLuint int indx, @Const @Check("2") FloatBuffer values); + + void glVertexAttrib3f(@GLuint int indx, @GLfloat float x, @GLfloat float y, @GLfloat float z); + + @StripPostfix("values") + void glVertexAttrib3fv(@GLuint int indx, @Const @Check("3") FloatBuffer values); + + void glVertexAttrib4f(@GLuint int indx, @GLfloat float x, @GLfloat float y, @GLfloat float z, @GLfloat float w); + + @StripPostfix("values") + void glVertexAttrib4fv(@GLuint int indx, @Const @Check("4") FloatBuffer values); + + void glVertexAttribPointer(@GLuint int index, int size, @AutoType("buffer") @GLenum int type, @GLboolean boolean normalized, @GLsizei int stride, + @CachedReference(index = "index", name = "glVertexAttribPointer_buffer") + @BufferObject(BufferKind.ArrayVBO) @Check @Const @GLubyte @GLbyte @GLshort @GLushort @GLint @GLuint @GLfloat Buffer buffer); + + void glViewport(@GLint int x, @GLint int y, @GLsizei int width, @GLsizei int height); +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/GLES30.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/GLES30.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/GLES30.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/GLES30.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,855 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +import org.lwjgl.opengl.GLSync; +import org.lwjgl.util.generator.*; +import org.lwjgl.util.generator.opengl.*; + +import java.nio.*; + +public interface GLES30 { + + int GL_READ_BUFFER = 0x0C02; + int GL_UNPACK_ROW_LENGTH = 0x0CF2; + int GL_UNPACK_SKIP_ROWS = 0x0CF3; + int GL_UNPACK_SKIP_PIXELS = 0x0CF4; + int GL_PACK_ROW_LENGTH = 0x0D02; + int GL_PACK_SKIP_ROWS = 0x0D03; + int GL_PACK_SKIP_PIXELS = 0x0D04; + int GL_COLOR = 0x1800; + int GL_DEPTH = 0x1801; + int GL_STENCIL = 0x1802; + int GL_RED = 0x1903; + int GL_RGB8 = 0x8051; + int GL_RGBA8 = 0x8058; + int GL_RGB10_A2 = 0x8059; + int GL_TEXTURE_BINDING_3D = 0x806A; + int GL_PACK_SKIP_IMAGES = 0x806B; + int GL_PACK_IMAGE_HEIGHT = 0x806C; + int GL_UNPACK_SKIP_IMAGES = 0x806D; + int GL_UNPACK_IMAGE_HEIGHT = 0x806E; + int GL_TEXTURE_3D = 0x806F; + int GL_TEXTURE_WRAP_R = 0x8072; + int GL_MAX_3D_TEXTURE_SIZE = 0x8073; + int GL_UNSIGNED_INT_2_10_10_10_REV = 0x8368; + int GL_MAX_ELEMENTS_VERTICES = 0x80E8; + int GL_MAX_ELEMENTS_INDICES = 0x80E9; + int GL_TEXTURE_MIN_LOD = 0x813A; + int GL_TEXTURE_MAX_LOD = 0x813B; + int GL_TEXTURE_BASE_LEVEL = 0x813C; + int GL_TEXTURE_MAX_LEVEL = 0x813D; + int GL_MIN = 0x8007; + int GL_MAX = 0x8008; + int GL_DEPTH_COMPONENT24 = 0x81A6; + int GL_MAX_TEXTURE_LOD_BIAS = 0x84FD; + int GL_TEXTURE_COMPARE_MODE = 0x884C; + int GL_TEXTURE_COMPARE_FUNC = 0x884D; + int GL_CURRENT_QUERY = 0x8865; + int GL_QUERY_RESULT = 0x8866; + int GL_QUERY_RESULT_AVAILABLE = 0x8867; + int GL_BUFFER_MAPPED = 0x88BC; + int GL_BUFFER_MAP_POINTER = 0x88BD; + int GL_STREAM_READ = 0x88E1; + int GL_STREAM_COPY = 0x88E2; + int GL_STATIC_READ = 0x88E5; + int GL_STATIC_COPY = 0x88E6; + int GL_DYNAMIC_READ = 0x88E9; + int GL_DYNAMIC_COPY = 0x88EA; + int GL_MAX_DRAW_BUFFERS = 0x8824; + int GL_DRAW_BUFFER0 = 0x8825; + int GL_DRAW_BUFFER1 = 0x8826; + int GL_DRAW_BUFFER2 = 0x8827; + int GL_DRAW_BUFFER3 = 0x8828; + int GL_DRAW_BUFFER4 = 0x8829; + int GL_DRAW_BUFFER5 = 0x882A; + int GL_DRAW_BUFFER6 = 0x882B; + int GL_DRAW_BUFFER7 = 0x882C; + int GL_DRAW_BUFFER8 = 0x882D; + int GL_DRAW_BUFFER9 = 0x882E; + int GL_DRAW_BUFFER10 = 0x882F; + int GL_DRAW_BUFFER11 = 0x8830; + int GL_DRAW_BUFFER12 = 0x8831; + int GL_DRAW_BUFFER13 = 0x8832; + int GL_DRAW_BUFFER14 = 0x8833; + int GL_DRAW_BUFFER15 = 0x8834; + int GL_MAX_FRAGMENT_UNIFORM_COMPONENTS = 0x8B49; + int GL_MAX_VERTEX_UNIFORM_COMPONENTS = 0x8B4A; + int GL_SAMPLER_3D = 0x8B5F; + int GL_SAMPLER_2D_SHADOW = 0x8B62; + int GL_FRAGMENT_SHADER_DERIVATIVE_HINT = 0x8B8B; + int GL_PIXEL_PACK_BUFFER = 0x88EB; + int GL_PIXEL_UNPACK_BUFFER = 0x88EC; + int GL_PIXEL_PACK_BUFFER_BINDING = 0x88ED; + int GL_PIXEL_UNPACK_BUFFER_BINDING = 0x88EF; + int GL_FLOAT_MAT2x3 = 0x8B65; + int GL_FLOAT_MAT2x4 = 0x8B66; + int GL_FLOAT_MAT3x2 = 0x8B67; + int GL_FLOAT_MAT3x4 = 0x8B68; + int GL_FLOAT_MAT4x2 = 0x8B69; + int GL_FLOAT_MAT4x3 = 0x8B6A; + int GL_SRGB = 0x8C40; + int GL_SRGB8 = 0x8C41; + int GL_SRGB8_ALPHA8 = 0x8C43; + int GL_COMPARE_REF_TO_TEXTURE = 0x884E; + int GL_MAJOR_VERSION = 0x821B; + int GL_MINOR_VERSION = 0x821C; + int GL_NUM_EXTENSIONS = 0x821D; + int GL_RGBA32F = 0x8814; + int GL_RGB32F = 0x8815; + int GL_RGBA16F = 0x881A; + int GL_RGB16F = 0x881B; + int GL_VERTEX_ATTRIB_ARRAY_INTEGER = 0x88FD; + int GL_MAX_ARRAY_TEXTURE_LAYERS = 0x88FF; + int GL_MIN_PROGRAM_TEXEL_OFFSET = 0x8904; + int GL_MAX_PROGRAM_TEXEL_OFFSET = 0x8905; + int GL_MAX_VARYING_COMPONENTS = 0x8B4B; + int GL_TEXTURE_2D_ARRAY = 0x8C1A; + int GL_TEXTURE_BINDING_2D_ARRAY = 0x8C1D; + int GL_R11F_G11F_B10F = 0x8C3A; + int GL_UNSIGNED_INT_10F_11F_11F_REV = 0x8C3B; + int GL_RGB9_E5 = 0x8C3D; + int GL_UNSIGNED_INT_5_9_9_9_REV = 0x8C3E; + int GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH = 0x8C76; + int GL_TRANSFORM_FEEDBACK_BUFFER_MODE = 0x8C7F; + int GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS = 0x8C80; + int GL_TRANSFORM_FEEDBACK_VARYINGS = 0x8C83; + int GL_TRANSFORM_FEEDBACK_BUFFER_START = 0x8C84; + int GL_TRANSFORM_FEEDBACK_BUFFER_SIZE = 0x8C85; + int GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN = 0x8C88; + int GL_RASTERIZER_DISCARD = 0x8C89; + int GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS = 0x8C8A; + int GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS = 0x8C8B; + int GL_INTERLEAVED_ATTRIBS = 0x8C8C; + int GL_SEPARATE_ATTRIBS = 0x8C8D; + int GL_TRANSFORM_FEEDBACK_BUFFER = 0x8C8E; + int GL_TRANSFORM_FEEDBACK_BUFFER_BINDING = 0x8C8F; + int GL_RGBA32UI = 0x8D70; + int GL_RGB32UI = 0x8D71; + int GL_RGBA16UI = 0x8D76; + int GL_RGB16UI = 0x8D77; + int GL_RGBA8UI = 0x8D7C; + int GL_RGB8UI = 0x8D7D; + int GL_RGBA32I = 0x8D82; + int GL_RGB32I = 0x8D83; + int GL_RGBA16I = 0x8D88; + int GL_RGB16I = 0x8D89; + int GL_RGBA8I = 0x8D8E; + int GL_RGB8I = 0x8D8F; + int GL_RED_INTEGER = 0x8D94; + int GL_RGB_INTEGER = 0x8D98; + int GL_RGBA_INTEGER = 0x8D99; + int GL_SAMPLER_2D_ARRAY = 0x8DC1; + int GL_SAMPLER_2D_ARRAY_SHADOW = 0x8DC4; + int GL_SAMPLER_CUBE_SHADOW = 0x8DC5; + int GL_UNSIGNED_INT_VEC2 = 0x8DC6; + int GL_UNSIGNED_INT_VEC3 = 0x8DC7; + int GL_UNSIGNED_INT_VEC4 = 0x8DC8; + int GL_INT_SAMPLER_2D = 0x8DCA; + int GL_INT_SAMPLER_3D = 0x8DCB; + int GL_INT_SAMPLER_CUBE = 0x8DCC; + int GL_INT_SAMPLER_2D_ARRAY = 0x8DCF; + int GL_UNSIGNED_INT_SAMPLER_2D = 0x8DD2; + int GL_UNSIGNED_INT_SAMPLER_3D = 0x8DD3; + int GL_UNSIGNED_INT_SAMPLER_CUBE = 0x8DD4; + int GL_UNSIGNED_INT_SAMPLER_2D_ARRAY = 0x8DD7; + int GL_BUFFER_ACCESS_FLAGS = 0x911F; + int GL_BUFFER_MAP_LENGTH = 0x9120; + int GL_BUFFER_MAP_OFFSET = 0x9121; + int GL_DEPTH_COMPONENT32F = 0x8CAC; + int GL_DEPTH32F_STENCIL8 = 0x8CAD; + int GL_FLOAT_32_UNSIGNED_INT_24_8_REV = 0x8DAD; + int GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING = 0x8210; + int GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE = 0x8211; + int GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE = 0x8212; + int GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE = 0x8213; + int GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE = 0x8214; + int GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE = 0x8215; + int GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE = 0x8216; + int GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE = 0x8217; + int GL_FRAMEBUFFER_DEFAULT = 0x8218; + int GL_FRAMEBUFFER_UNDEFINED = 0x8219; + int GL_DEPTH_STENCIL_ATTACHMENT = 0x821A; + int GL_DEPTH_STENCIL = 0x84F9; + int GL_UNSIGNED_INT_24_8 = 0x84FA; + int GL_DEPTH24_STENCIL8 = 0x88F0; + int GL_UNSIGNED_NORMALIZED = 0x8C17; + int GL_DRAW_FRAMEBUFFER_BINDING = GLES20.GL_FRAMEBUFFER_BINDING; + int GL_READ_FRAMEBUFFER = 0x8CA8; + int GL_DRAW_FRAMEBUFFER = 0x8CA9; + int GL_READ_FRAMEBUFFER_BINDING = 0x8CAA; + int GL_RENDERBUFFER_SAMPLES = 0x8CAB; + int GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER = 0x8CD4; + int GL_MAX_COLOR_ATTACHMENTS = 0x8CDF; + int GL_COLOR_ATTACHMENT1 = 0x8CE1; + int GL_COLOR_ATTACHMENT2 = 0x8CE2; + int GL_COLOR_ATTACHMENT3 = 0x8CE3; + int GL_COLOR_ATTACHMENT4 = 0x8CE4; + int GL_COLOR_ATTACHMENT5 = 0x8CE5; + int GL_COLOR_ATTACHMENT6 = 0x8CE6; + int GL_COLOR_ATTACHMENT7 = 0x8CE7; + int GL_COLOR_ATTACHMENT8 = 0x8CE8; + int GL_COLOR_ATTACHMENT9 = 0x8CE9; + int GL_COLOR_ATTACHMENT10 = 0x8CEA; + int GL_COLOR_ATTACHMENT11 = 0x8CEB; + int GL_COLOR_ATTACHMENT12 = 0x8CEC; + int GL_COLOR_ATTACHMENT13 = 0x8CED; + int GL_COLOR_ATTACHMENT14 = 0x8CEE; + int GL_COLOR_ATTACHMENT15 = 0x8CEF; + int GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE = 0x8D56; + int GL_MAX_SAMPLES = 0x8D57; + int GL_HALF_FLOAT = 0x140B; + int GL_MAP_READ_BIT = 0x0001; + int GL_MAP_WRITE_BIT = 0x0002; + int GL_MAP_INVALIDATE_RANGE_BIT = 0x0004; + int GL_MAP_INVALIDATE_BUFFER_BIT = 0x0008; + int GL_MAP_FLUSH_EXPLICIT_BIT = 0x0010; + int GL_MAP_UNSYNCHRONIZED_BIT = 0x0020; + int GL_RG = 0x8227; + int GL_RG_INTEGER = 0x8228; + int GL_R8 = 0x8229; + int GL_RG8 = 0x822B; + int GL_R16F = 0x822D; + int GL_R32F = 0x822E; + int GL_RG16F = 0x822F; + int GL_RG32F = 0x8230; + int GL_R8I = 0x8231; + int GL_R8UI = 0x8232; + int GL_R16I = 0x8233; + int GL_R16UI = 0x8234; + int GL_R32I = 0x8235; + int GL_R32UI = 0x8236; + int GL_RG8I = 0x8237; + int GL_RG8UI = 0x8238; + int GL_RG16I = 0x8239; + int GL_RG16UI = 0x823A; + int GL_RG32I = 0x823B; + int GL_RG32UI = 0x823C; + int GL_VERTEX_ARRAY_BINDING = 0x85B5; + int GL_R8_SNORM = 0x8F94; + int GL_RG8_SNORM = 0x8F95; + int GL_RGB8_SNORM = 0x8F96; + int GL_RGBA8_SNORM = 0x8F97; + int GL_SIGNED_NORMALIZED = 0x8F9C; + int GL_PRIMITIVE_RESTART_FIXED_INDEX = 0x8D69; + int GL_COPY_READ_BUFFER = 0x8F36; + int GL_COPY_WRITE_BUFFER = 0x8F37; + int GL_COPY_READ_BUFFER_BINDING = GL_COPY_READ_BUFFER; + int GL_COPY_WRITE_BUFFER_BINDING = GL_COPY_WRITE_BUFFER; + int GL_UNIFORM_BUFFER = 0x8A11; + int GL_UNIFORM_BUFFER_BINDING = 0x8A28; + int GL_UNIFORM_BUFFER_START = 0x8A29; + int GL_UNIFORM_BUFFER_SIZE = 0x8A2A; + int GL_MAX_VERTEX_UNIFORM_BLOCKS = 0x8A2B; + int GL_MAX_FRAGMENT_UNIFORM_BLOCKS = 0x8A2D; + int GL_MAX_COMBINED_UNIFORM_BLOCKS = 0x8A2E; + int GL_MAX_UNIFORM_BUFFER_BINDINGS = 0x8A2F; + int GL_MAX_UNIFORM_BLOCK_SIZE = 0x8A30; + int GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS = 0x8A31; + int GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS = 0x8A33; + int GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT = 0x8A34; + int GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH = 0x8A35; + int GL_ACTIVE_UNIFORM_BLOCKS = 0x8A36; + int GL_UNIFORM_TYPE = 0x8A37; + int GL_UNIFORM_SIZE = 0x8A38; + int GL_UNIFORM_NAME_LENGTH = 0x8A39; + int GL_UNIFORM_BLOCK_INDEX = 0x8A3A; + int GL_UNIFORM_OFFSET = 0x8A3B; + int GL_UNIFORM_ARRAY_STRIDE = 0x8A3C; + int GL_UNIFORM_MATRIX_STRIDE = 0x8A3D; + int GL_UNIFORM_IS_ROW_MAJOR = 0x8A3E; + int GL_UNIFORM_BLOCK_BINDING = 0x8A3F; + int GL_UNIFORM_BLOCK_DATA_SIZE = 0x8A40; + int GL_UNIFORM_BLOCK_NAME_LENGTH = 0x8A41; + int GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS = 0x8A42; + int GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES = 0x8A43; + int GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER = 0x8A44; + int GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER = 0x8A46; + int GL_INVALID_INDEX = 0xFFFFFFFF; + int GL_MAX_VERTEX_OUTPUT_COMPONENTS = 0x9122; + int GL_MAX_FRAGMENT_INPUT_COMPONENTS = 0x9125; + int GL_MAX_SERVER_WAIT_TIMEOUT = 0x9111; + int GL_OBJECT_TYPE = 0x9112; + int GL_SYNC_CONDITION = 0x9113; + int GL_SYNC_STATUS = 0x9114; + int GL_SYNC_FLAGS = 0x9115; + int GL_SYNC_FENCE = 0x9116; + int GL_SYNC_GPU_COMMANDS_COMPLETE = 0x9117; + int GL_UNSIGNALED = 0x9118; + int GL_SIGNALED = 0x9119; + int GL_ALREADY_SIGNALED = 0x911A; + int GL_TIMEOUT_EXPIRED = 0x911B; + int GL_CONDITION_SATISFIED = 0x911C; + int GL_WAIT_FAILED = 0x911D; + int GL_SYNC_FLUSH_COMMANDS_BIT = 0x00000001; + long GL_TIMEOUT_IGNORED = 0xFFFFFFFFFFFFFFFFl; + int GL_VERTEX_ATTRIB_ARRAY_DIVISOR = 0x88FE; + int GL_ANY_SAMPLES_PASSED = 0x8C2F; + int GL_ANY_SAMPLES_PASSED_CONSERVATIVE = 0x8D6A; + int GL_SAMPLER_BINDING = 0x8919; + int GL_RGB10_A2UI = 0x906F; + int GL_TEXTURE_SWIZZLE_R = 0x8E42; + int GL_TEXTURE_SWIZZLE_G = 0x8E43; + int GL_TEXTURE_SWIZZLE_B = 0x8E44; + int GL_TEXTURE_SWIZZLE_A = 0x8E45; + int GL_GREEN = 0x1904; + int GL_BLUE = 0x1905; + int GL_INT_2_10_10_10_REV = 0x8D9F; + int GL_TRANSFORM_FEEDBACK = 0x8E22; + int GL_TRANSFORM_FEEDBACK_PAUSED = 0x8E23; + int GL_TRANSFORM_FEEDBACK_ACTIVE = 0x8E24; + int GL_TRANSFORM_FEEDBACK_BINDING = 0x8E25; + int GL_PROGRAM_BINARY_RETRIEVABLE_HINT = 0x8257; + int GL_PROGRAM_BINARY_LENGTH = 0x8741; + int GL_NUM_PROGRAM_BINARY_FORMATS = 0x87FE; + int GL_PROGRAM_BINARY_FORMATS = 0x87FF; + int GL_COMPRESSED_R11_EAC = 0x9270; + int GL_COMPRESSED_SIGNED_R11_EAC = 0x9271; + int GL_COMPRESSED_RG11_EAC = 0x9272; + int GL_COMPRESSED_SIGNED_RG11_EAC = 0x9273; + int GL_COMPRESSED_RGB8_ETC2 = 0x9274; + int GL_COMPRESSED_SRGB8_ETC2 = 0x9275; + int GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 0x9276; + int GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 0x9277; + int GL_COMPRESSED_RGBA8_ETC2_EAC = 0x9278; + int GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC = 0x9279; + int GL_TEXTURE_IMMUTABLE_FORMAT = 0x912F; + int GL_MAX_ELEMENT_INDEX = 0x8D6B; + int GL_NUM_SAMPLE_COUNTS = 0x9380; + + void glReadBuffer(@GLenum int mode); + + void glDrawRangeElements(@GLenum int mode, @GLuint int start, @GLuint int end, @AutoSize("indices") @GLsizei int count, + @AutoType("indices") + @GLenum int type, + @BufferObject(BufferKind.ElementVBO) + @Const + @GLubyte + @GLushort + @GLuint Buffer indices); + + void glTexImage3D(@GLenum int target, int level, int internalFormat, @GLsizei int width, @GLsizei int height, @GLsizei int depth, int border, @GLenum int format, @GLenum int type, + @BufferObject(BufferKind.UnpackPBO) + @Check(value = "GLChecks.calculateTexImage3DStorage(pixels, format, type, width, height, depth)", canBeNull = true) + @Const + @GLbyte + @GLshort + @GLint + @GLfloat Buffer pixels); + + void glTexSubImage3D(@GLenum int target, int level, int xoffset, int yoffset, int zoffset, @GLsizei int width, @GLsizei int height, @GLsizei int depth, @GLenum int format, @GLenum int type, + @BufferObject(BufferKind.UnpackPBO) + @Check("GLChecks.calculateImageStorage(pixels, format, type, width, height, depth)") + @Const + @GLbyte + @GLshort + @GLint + @GLfloat Buffer pixels); + + void glCopyTexSubImage3D(@GLenum int target, int level, int xoffset, int yoffset, int zoffset, int x, int y, @GLsizei int width, @GLsizei int height); + + void glCompressedTexImage3D(@GLenum int target, int level, @GLenum int internalformat, @GLsizei int width, @GLsizei int height, @GLsizei int depth, int border, @AutoSize("data") @GLsizei int imageSize, + @BufferObject(BufferKind.UnpackPBO) + @Check + @Const + @GLvoid + ByteBuffer data); + + void glCompressedTexSubImage3D(@GLenum int target, int level, int xoffset, int yoffset, int zoffset, @GLsizei int width, @GLsizei int height, @GLsizei int depth, @GLenum int format, @AutoSize("data") @GLsizei int imageSize, + @BufferObject(BufferKind.UnpackPBO) + @Check + @Const + @GLvoid + ByteBuffer data); + + void glGenQueries(@AutoSize("ids") @GLsizei int n, @OutParameter @GLuint IntBuffer ids); + + @Alternate("glGenQueries") + @GLreturn("ids") + void glGenQueries2(@Constant("1") @GLsizei int n, @OutParameter @GLuint IntBuffer ids); + + void glDeleteQueries(@AutoSize("ids") @GLsizei int n, @GLuint IntBuffer ids); + + @Alternate("glDeleteQueries") + void glDeleteQueries(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getInt(id)", keepParam = true) int id); + + boolean glIsQuery(@GLuint int id); + + void glBeginQuery(@GLenum int target, @GLuint int id); + + void glEndQuery(@GLenum int target); + + @StripPostfix("params") + void glGetQueryiv(@GLenum int target, @GLenum int pname, @OutParameter @Check("1") IntBuffer params); + + @Alternate("glGetQueryiv") + @GLreturn("params") + @StripPostfix(value = "params", hasPostfix = false) + void glGetQueryiv2(@GLenum int target, @GLenum int pname, @OutParameter IntBuffer params); + + @StripPostfix("params") + void glGetQueryObjectuiv(@GLenum int id, @GLenum int pname, @OutParameter @Check("1") @GLuint IntBuffer params); + + @Alternate("glGetQueryObjectuiv") + @GLreturn("params") + @StripPostfix(value = "params", hasPostfix = false) + void glGetQueryObjectuiv2(@GLenum int id, @GLenum int pname, @OutParameter @GLuint IntBuffer params); + + boolean glUnmapBuffer(@GLenum int target); + + @StripPostfix("pointer") + @AutoSize("GLES20.glGetBufferParameteri(target, GLES20.GL_BUFFER_SIZE)") + void glGetBufferPointerv(@GLenum int target, @GLenum int pname, @OutParameter @Result @GLvoid ByteBuffer pointer); + + void glDrawBuffers(@AutoSize("buffers") @GLsizei int size, @Const @GLenum IntBuffer buffers); + + @Alternate("glDrawBuffers") + void glDrawBuffers(@Constant("1") @GLsizei int size, @Constant(value = "APIUtil.getInt(buffer)", keepParam = true) int buffer); + + @StripPostfix("matrices") + void glUniformMatrix2x3fv(int location, @AutoSize(value = "matrices", expression = " / (2 * 3)") @GLsizei int count, + boolean transpose, FloatBuffer matrices); + + @StripPostfix("matrices") + void glUniformMatrix3x2fv(int location, @AutoSize(value = "matrices", expression = " / (3 * 2)") @GLsizei int count, + boolean transpose, FloatBuffer matrices); + + @StripPostfix("matrices") + void glUniformMatrix2x4fv(int location, @AutoSize(value = "matrices", expression = " >> 3") @GLsizei int count, + boolean transpose, FloatBuffer matrices); + + @StripPostfix("matrices") + void glUniformMatrix4x2fv(int location, @AutoSize(value = "matrices", expression = " >> 3") @GLsizei int count, + boolean transpose, FloatBuffer matrices); + + @StripPostfix("matrices") + void glUniformMatrix3x4fv(int location, @AutoSize(value = "matrices", expression = " / (3 * 4)") @GLsizei int count, + boolean transpose, FloatBuffer matrices); + + @StripPostfix("matrices") + void glUniformMatrix4x3fv(int location, @AutoSize(value = "matrices", expression = " / (4 * 3)") @GLsizei int count, + boolean transpose, FloatBuffer matrices); + + /** + * Transfers a rectangle of pixel values from one + * region of the read framebuffer to another in the draw framebuffer. + * <mask> is the bitwise OR of a number of values indicating which + * buffers are to be copied. The values are COLOR_BUFFER_BIT, + * DEPTH_BUFFER_BIT, and STENCIL_BUFFER_BIT. + * The pixels corresponding to these buffers are + * copied from the source rectangle, bound by the locations (srcX0, + * srcY0) and (srcX1, srcY1) inclusive, to the destination rectangle, + * bound by the locations (dstX0, dstY0) and (dstX1, dstY1) + * inclusive. + * If the source and destination rectangle dimensions do not match, + * the source image is stretched to fit the destination + * rectangle. <filter> must be LINEAR or NEAREST and specifies the + * method of interpolation to be applied if the image is + * stretched. + */ + void glBlitFramebuffer( + @GLint int srcX0, @GLint int srcY0, @GLint int srcX1, @GLint int srcY1, + @GLint int dstX0, @GLint int dstY0, @GLint int dstX1, @GLint int dstY1, + @GLbitfield int mask, @GLenum int filter); + + /** + * Establishes the data storage, format, dimensions, and number of + * samples of a renderbuffer object's image. + */ + void glRenderbufferStorageMultisample( + @GLenum int target, @GLsizei int samples, + @GLenum int internalformat, + @GLsizei int width, @GLsizei int height); + + void glFramebufferTextureLayer(@GLenum int target, @GLenum int attachment, @GLuint int texture, int level, int layer); + + /** + * glMapBufferRange maps a GL buffer object range to a ByteBuffer. The old_buffer argument can be null, + * in which case a new ByteBuffer will be created, pointing to the returned memory. If old_buffer is non-null, + * it will be returned if it points to the same mapped memory and has the same capacity as the buffer object, + * otherwise a new ByteBuffer is created. That way, an application will normally use glMapBufferRange like this: + *

        + * ByteBuffer mapped_buffer; mapped_buffer = glMapBufferRange(..., ..., ..., ..., null); ... // Another map on the same buffer mapped_buffer = glMapBufferRange(..., ..., ..., ..., mapped_buffer); + *

        + * Only ByteBuffers returned from this method are to be passed as the old_buffer argument. User-created ByteBuffers cannot be reused. + * + * @param old_buffer A ByteBuffer. If this argument points to the same address and has the same capacity as the new mapping, it will be returned and no new buffer will be created. + * + * @return A ByteBuffer representing the mapped buffer memory. + */ + @CachedResult(isRange = true) + @GLvoid + @AutoSize("length") + ByteBuffer glMapBufferRange(@GLenum int target, @GLintptr long offset, @GLsizeiptr long length, @GLbitfield int access); + + void glFlushMappedBufferRange(@GLenum int target, @GLintptr long offset, @GLsizeiptr long length); + + @Code(" StateTracker.bindVAO(array);") + void glBindVertexArray(@GLuint int array); + + @Code(" StateTracker.deleteVAO(arrays);") + void glDeleteVertexArrays(@AutoSize("arrays") @GLsizei int n, @Const @GLuint IntBuffer arrays); + + @Alternate("glDeleteVertexArrays") + @Code(" StateTracker.deleteVAO(array);") + void glDeleteVertexArrays(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getInt(array)", keepParam = true) int array); + + void glGenVertexArrays(@AutoSize("arrays") @GLsizei int n, @OutParameter @GLuint IntBuffer arrays); + + @Alternate("glGenVertexArrays") + @GLreturn("arrays") + void glGenVertexArrays2(@Constant("1") @GLsizei int n, @OutParameter @GLuint IntBuffer arrays); + + boolean glIsVertexArray(@GLuint int array); + + @StripPostfix("data") + void glGetIntegeri_v(@GLenum int value, @GLuint int index, @OutParameter @Check("4") IntBuffer data); + + @Alternate("glGetIntegeri_v") + @GLreturn("data") + @StripPostfix("data") + void glGetIntegeri_v2(@GLenum int value, @GLuint int index, @OutParameter IntBuffer data); + + void glBeginTransformFeedback(@GLenum int primitiveMode); + + void glEndTransformFeedback(); + + void glBindBufferRange(@GLenum int target, @GLuint int index, @GLuint int buffer, @GLintptr long offset, @GLsizeiptr long size); + + void glBindBufferBase(@GLenum int target, @GLuint int index, @GLuint int buffer); + + void glTransformFeedbackVaryings(@GLuint int program, @GLsizei int count, + @Const @NullTerminated("count") @GLchar @PointerArray("count") ByteBuffer varyings, + @GLenum int bufferMode); + + @Alternate("glTransformFeedbackVaryings") + void glTransformFeedbackVaryings(@GLuint int program, @Constant("varyings.length") @GLsizei int count, + @Const @NullTerminated @PointerArray("count") CharSequence[] varyings, + @GLenum int bufferMode); + + void glGetTransformFeedbackVarying(@GLuint int program, @GLuint int index, @AutoSize("name") @GLsizei int bufSize, + @OutParameter @GLsizei @Check(value = "1", canBeNull = true) IntBuffer length, + @OutParameter @GLsizei @Check("1") IntBuffer size, + @OutParameter @GLenum @Check("1") IntBuffer type, + @OutParameter @GLchar ByteBuffer name); + + @Alternate("glGetTransformFeedbackVarying") + @GLreturn(value = "name", maxLength = "bufSize") + void glGetTransformFeedbackVarying2(@GLuint int program, @GLuint int index, @GLsizei int bufSize, + @OutParameter @GLsizei @Constant("MemoryUtil.getAddress0(name_length)") IntBuffer length, + @OutParameter @GLsizei @Check("1") IntBuffer size, + @OutParameter @GLenum @Check("1") IntBuffer type, + @OutParameter @GLchar ByteBuffer name); + + void glVertexAttribIPointer(@GLuint int index, int size, @GLenum int type, @GLsizei int stride, + @CachedReference(index = "index", name = "glVertexAttribPointer_buffer") + @BufferObject(BufferKind.ArrayVBO) + @Check + @Const + @GLbyte + @GLubyte + @GLshort + @GLushort + @GLint + @GLuint Buffer buffer); + + @StripPostfix("params") + void glGetVertexAttribIiv(@GLuint int index, @GLenum int pname, @OutParameter @Check("4") IntBuffer params); + + @StripPostfix("params") + void glGetVertexAttribIuiv(@GLuint int index, @GLenum int pname, @OutParameter @Check("4") @GLuint IntBuffer params); + + @NoErrorCheck + void glVertexAttribI4i(@GLuint int index, int x, int y, int z, int w); + + @NoErrorCheck + void glVertexAttribI4ui(@GLuint int index, @GLuint int x, @GLuint int y, @GLuint int z, @GLuint int w); + + @NoErrorCheck + @StripPostfix("v") + void glVertexAttribI4iv(@GLuint int index, @Check("4") @Const IntBuffer v); + + @NoErrorCheck + @StripPostfix("v") + void glVertexAttribI4uiv(@GLuint int index, @Check("4") @Const @GLuint IntBuffer v); + + @StripPostfix("params") + void glGetUniformuiv(@GLuint int program, int location, @OutParameter @Check @GLuint IntBuffer params); + + int glGetFragDataLocation(@GLuint int program, @NullTerminated @Const @GLchar ByteBuffer name); + + @Alternate("glGetFragDataLocation") + int glGetFragDataLocation(@GLuint int program, @NullTerminated CharSequence name); + + void glUniform1ui(int location, @GLuint int v0); + + void glUniform2ui(int location, @GLuint int v0, @GLuint int v1); + + void glUniform3ui(int location, @GLuint int v0, @GLuint int v1, @GLuint int v2); + + void glUniform4ui(int location, @GLuint int v0, @GLuint int v1, @GLuint int v2, @GLuint int v3); + + @StripPostfix("value") + void glUniform1uiv(int location, @AutoSize("value") @GLsizei int count, @Const @GLuint IntBuffer value); + + @StripPostfix("value") + void glUniform2uiv(int location, @AutoSize(value = "value", expression = " >> 1") @GLsizei int count, @Const @GLuint IntBuffer value); + + @StripPostfix("value") + void glUniform3uiv(int location, @AutoSize(value = "value", expression = " / 3") @GLsizei int count, @Const @GLuint IntBuffer value); + + @StripPostfix("value") + void glUniform4uiv(int location, @AutoSize(value = "value", expression = " >> 2") @GLsizei int count, @Const @GLuint IntBuffer value); + + @StripPostfix("value") + void glClearBufferfv(@GLenum int buffer, int drawbuffer, @Const @Check("4") FloatBuffer value); + + @StripPostfix("value") + void glClearBufferiv(@GLenum int buffer, int drawbuffer, @Const @Check("4") IntBuffer value); + + @StripPostfix("value") + void glClearBufferuiv(@GLenum int buffer, int drawbuffer, @Const @Check("4") IntBuffer value); + + void glClearBufferfi(@GLenum int buffer, int drawbuffer, float depth, int stencil); + + String glGetStringi(@GLenum int name, @GLuint int index); + + void glCopyBufferSubData(@GLenum int readtarget, @GLenum int writetarget, @GLintptr long readoffset, @GLintptr long writeoffset, @GLsizeiptr long size); + + void glGetUniformIndices(@GLuint int program, @AutoSize("uniformIndices") @GLsizei int uniformCount, + @Const @NullTerminated("uniformIndices.remaining()") @GLchar @PointerArray("uniformCount") ByteBuffer uniformNames, + @OutParameter @GLuint IntBuffer uniformIndices); + + @Alternate("glGetUniformIndices") + void glGetUniformIndices(@GLuint int program, @Constant("uniformNames.length") @GLsizei int uniformCount, + @Const @NullTerminated @PointerArray("uniformCount") CharSequence[] uniformNames, + @OutParameter @Check("uniformNames.length") @GLuint IntBuffer uniformIndices); + + @StripPostfix("params") + void glGetActiveUniformsiv(@GLuint int program, @AutoSize("uniformIndices") @GLsizei int uniformCount, + @Const @GLuint IntBuffer uniformIndices, + @GLenum int pname, + @OutParameter @Check("uniformIndices.remaining()") @GLint IntBuffer params); + + @Alternate("glGetActiveUniformsiv") + @GLreturn("params") + @StripPostfix(value = "params", hasPostfix = false) + void glGetActiveUniformsiv(@GLuint int program, @Constant("1") @GLsizei int uniformCount, + @Constant(value = "MemoryUtil.getAddress(params.put(1, uniformIndex), 1)", keepParam = true) int uniformIndex, // Reuse params buffer + @GLenum int pname, + @OutParameter @GLint IntBuffer params); + + @GLuint + int glGetUniformBlockIndex(@GLuint int program, @Const @NullTerminated @GLchar ByteBuffer uniformBlockName); + + @Alternate("glGetUniformBlockIndex") + @GLuint + int glGetUniformBlockIndex(@GLuint int program, @NullTerminated CharSequence uniformBlockName); + + @StripPostfix("params") + void glGetActiveUniformBlockiv(@GLuint int program, @GLuint int uniformBlockIndex, @GLenum int pname, + @OutParameter @Check(value = "16") @GLint IntBuffer params); + + @Alternate("glGetActiveUniformBlockiv") + @GLreturn("params") + @StripPostfix(value = "params", hasPostfix = false) + void glGetActiveUniformBlockiv2(@GLuint int program, @GLuint int uniformBlockIndex, @GLenum int pname, + @OutParameter @GLint IntBuffer params); + + void glGetActiveUniformBlockName(@GLuint int program, @GLuint int uniformBlockIndex, @AutoSize("uniformBlockName") @GLsizei int bufSize, + @OutParameter @GLsizei @Check(value = "1", canBeNull = true) IntBuffer length, + @OutParameter @GLchar ByteBuffer uniformBlockName); + + @Alternate("glGetActiveUniformBlockName") + @GLreturn(value = "uniformBlockName", maxLength = "bufSize") + void glGetActiveUniformBlockName2(@GLuint int program, @GLuint int uniformBlockIndex, @GLsizei int bufSize, + @OutParameter @GLsizei @Constant("MemoryUtil.getAddress0(uniformBlockName_length)") IntBuffer length, + @OutParameter @GLchar ByteBuffer uniformBlockName); + + void glUniformBlockBinding(@GLuint int program, @GLuint int uniformBlockIndex, @GLuint int uniformBlockBinding); + + void glDrawArraysInstanced(@GLenum int mode, int first, @GLsizei int count, @GLsizei int primcount); + + void glDrawElementsInstanced(@GLenum int mode, @AutoSize("indices") @GLsizei int count, @AutoType("indices") @GLenum int type, + @BufferObject(BufferKind.ElementVBO) + @Const + @GLubyte + @GLushort + @GLuint Buffer indices, @GLsizei int primcount); + + @PointerWrapper("GLsync") + GLSync glFenceSync(@GLenum int condition, @GLbitfield int flags); + + boolean glIsSync(@PointerWrapper("GLsync") GLSync sync); + + void glDeleteSync(@PointerWrapper("GLsync") GLSync sync); + + @GLenum + int glClientWaitSync(@PointerWrapper("GLsync") GLSync sync, @GLbitfield int flags, @GLuint64 long timeout); + + void glWaitSync(@PointerWrapper("GLsync") GLSync sync, @GLbitfield int flags, @GLuint64 long timeout); + + @StripPostfix("data") + void glGetInteger64v(@GLenum int pname, @OutParameter @Check("1") @GLint64 LongBuffer data); + + @Alternate("glGetInteger64v") + @GLreturn("data") + @StripPostfix("data") + void glGetInteger64v2(@GLenum int pname, @OutParameter @GLint64 LongBuffer data); + + @StripPostfix("data") + void glGetInteger64i_v(@GLenum int value, @GLuint int index, @OutParameter @Check("4") @GLint64 LongBuffer data); + + @Alternate("glGetInteger64i_v") + @GLreturn("data") + @StripPostfix("data") + void glGetInteger64i_v2(@GLenum int value, @GLuint int index, @OutParameter @GLint64 LongBuffer data); + + @StripPostfix("values") + void glGetSynciv(@PointerWrapper("GLsync") GLSync sync, @GLenum int pname, @AutoSize("values") @GLsizei int bufSize, + @OutParameter @GLsizei @Check(value = "1", canBeNull = true) IntBuffer length, + @OutParameter IntBuffer values); + + @Alternate("glGetSynciv") + @GLreturn("values") + @StripPostfix(value = "values", hasPostfix = false) + void glGetSynciv2(@PointerWrapper("GLsync") GLSync sync, @GLenum int pname, @Constant("1") @GLsizei int bufSize, + @OutParameter @GLsizei @Constant("0L") IntBuffer length, + @OutParameter IntBuffer values); + + @StripPostfix("params") + void glGetBufferParameteri64v(@GLenum int target, @GLenum int pname, @OutParameter @Check("4") LongBuffer params); + + @Alternate("glGetBufferParameteri64v") + @GLreturn("params") + @StripPostfix(value = "params", hasPostfix = false) + void glGetBufferParameteri64v2(@GLenum int target, @GLenum int pname, @OutParameter LongBuffer params); + + void glGenSamplers(@AutoSize("samplers") @GLsizei int count, @OutParameter @GLuint IntBuffer samplers); + + @Alternate("glGenSamplers") + @GLreturn("samplers") + void glGenSamplers2(@Constant("1") @GLsizei int count, @OutParameter @GLuint IntBuffer samplers); + + void glDeleteSamplers(@AutoSize("samplers") @GLsizei int count, @Const @GLuint IntBuffer samplers); + + @Alternate("glDeleteSamplers") + void glDeleteSamplers(@Constant("1") @GLsizei int count, @Constant(value = "APIUtil.getInt(sampler)", keepParam = true) int sampler); + + boolean glIsSampler(@GLuint int sampler); + + void glBindSampler(@GLenum int unit, @GLuint int sampler); + + void glSamplerParameteri(@GLuint int sampler, @GLenum int pname, int param); + + void glSamplerParameterf(@GLuint int sampler, @GLenum int pname, float param); + + @StripPostfix("params") + void glSamplerParameteriv(@GLuint int sampler, @GLenum int pname, @Check("4") @Const IntBuffer params); + + @StripPostfix("params") + void glSamplerParameterfv(@GLuint int sampler, @GLenum int pname, @Check("4") @Const FloatBuffer params); + + @StripPostfix("params") + void glGetSamplerParameteriv(@GLuint int sampler, @GLenum int pname, @Check("4") @OutParameter IntBuffer params); + + @Alternate("glGetSamplerParameteriv") + @GLreturn("params") + @StripPostfix(value = "params", hasPostfix = false) + void glGetSamplerParameteriv2(@GLuint int sampler, @GLenum int pname, @OutParameter IntBuffer params); + + @StripPostfix("params") + void glGetSamplerParameterfv(@GLuint int sampler, @GLenum int pname, @Check("4") @OutParameter FloatBuffer params); + + @Alternate("glGetSamplerParameterfv") + @GLreturn("params") + @StripPostfix(value = "params", hasPostfix = false) + void glGetSamplerParameterfv2(@GLuint int sampler, @GLenum int pname, @OutParameter FloatBuffer params); + + void glVertexAttribDivisor(@GLuint int index, @GLuint int divisor); + + void glBindTransformFeedback(@GLenum int target, @GLuint int id); + + void glDeleteTransformFeedbacks(@AutoSize("ids") @GLsizei int n, @Const @GLuint IntBuffer ids); + + @Alternate("glDeleteTransformFeedbacks") + void glDeleteTransformFeedbacks(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getInt(id)", keepParam = true) int id); + + void glGenTransformFeedbacks(@AutoSize("ids") @GLsizei int n, @OutParameter @GLuint IntBuffer ids); + + @Alternate("glGenTransformFeedbacks") + @GLreturn("ids") + void glGenTransformFeedbacks2(@Constant("1") @GLsizei int n, @OutParameter @GLuint IntBuffer ids); + + boolean glIsTransformFeedback(@GLuint int id); + + void glPauseTransformFeedback(); + + void glResumeTransformFeedback(); + + void glGetProgramBinary(@GLuint int program, @AutoSize("binary") @GLsizei int bufSize, + @Check(value = "1", canBeNull = true) @GLsizei IntBuffer length, + @Check("1") @GLenum IntBuffer binaryFormat, + @OutParameter @GLvoid ByteBuffer binary); + + void glProgramBinary(@GLuint int program, @GLenum int binaryFormat, @Const @GLvoid ByteBuffer binary, @AutoSize("binary") @GLsizei int length); + + void glProgramParameteri(@GLuint int program, @GLenum int pname, int value); + + void glInvalidateFramebuffer(@GLenum int target, + @AutoSize("attachments") @GLsizei int numAttachments, + @Const @GLenum IntBuffer attachments); + + void glInvalidateSubFramebuffer(@GLenum int target, + @AutoSize("attachments") @GLsizei int numAttachments, + @Const @GLenum IntBuffer attachments, + int x, int y, @GLsizei int width, @GLsizei int height); + + void glTexStorage2D(@GLenum int target, @GLsizei int levels, + @GLenum int internalformat, + @GLsizei int width, @GLsizei int height); + + void glTexStorage3D(@GLenum int target, @GLsizei int levels, + @GLenum int internalformat, + @GLsizei int width, @GLsizei int height, @GLsizei int depth); + + @StripPostfix("params") + void glGetInternalformativ(@GLenum int target, @GLenum int internalformat, + @GLenum int pname, @AutoSize("params") @GLsizei int bufSize, @OutParameter IntBuffer params); + + @Alternate("glGetInternalformativ") + @StripPostfix("params") + @GLreturn("params") + void glGetInternalformativ2(@GLenum int target, @GLenum int internalformat, + @GLenum int pname, @Constant("1") @GLsizei int bufSize, @OutParameter IntBuffer params); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/IMG_multisampled_render_to_texture.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/IMG_multisampled_render_to_texture.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/IMG_multisampled_render_to_texture.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/IMG_multisampled_render_to_texture.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +import org.lwjgl.util.generator.opengl.GLenum; +import org.lwjgl.util.generator.opengl.GLsizei; +import org.lwjgl.util.generator.opengl.GLuint; + +public interface IMG_multisampled_render_to_texture { + + /** Accepted by the <pname> parameter of GetRenderbufferParameteriv: */ + int GL_RENDERBUFFER_SAMPLES_IMG = 0x9133; + + /** Returned by CheckFramebufferStatus: */ + int GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_IMG = 0x9134; + + /** + * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, + * GetFloatv, and GetDoublev: + */ + int GL_MAX_SAMPLES_IMG = 0x9135; + + /** Accepted by the <pname> parameter of GetFramebufferAttachmentParameteriv: */ + int GL_TEXTURE_SAMPLES_IMG = 0x9136; + + void glRenderbufferStorageMultisampleIMG( + @GLenum int target, @GLsizei int samples, + @GLenum int internalformat, + @GLsizei int width, @GLsizei int height); + + void glFramebufferTexture2DMultisampleIMG( + @GLenum int target, @GLenum int attachment, + @GLenum int textarget, @GLuint int texture, + int level, @GLsizei int samples); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/IMG_program_binary.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/IMG_program_binary.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/IMG_program_binary.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/IMG_program_binary.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +public interface IMG_program_binary { + + /** Accepted by the <binaryFormat> parameter of ProgramBinaryOES: */ + int GL_SGX_PROGRAM_BINARY_IMG = 0x9130; + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/IMG_read_format.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/IMG_read_format.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/IMG_read_format.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/IMG_read_format.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +public interface IMG_read_format { + + /** Accepted by the <format> parameter of ReadPixels: */ + int GL_BGRA_IMG = 0x80E1, + GL_UNSIGNED_SHORT_4_4_4_4_REV_IMG = 0x8365; + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/IMG_shader_binary.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/IMG_shader_binary.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/IMG_shader_binary.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/IMG_shader_binary.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +public interface IMG_shader_binary { + + /** Accepted by the <binaryformat> parameter of ShaderBinary: */ + int GL_SGX_BINARY_IMG = 0x8C0A; + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/IMG_texture_compression_pvrtc.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/IMG_texture_compression_pvrtc.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/IMG_texture_compression_pvrtc.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/IMG_texture_compression_pvrtc.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +public interface IMG_texture_compression_pvrtc { + + /** + * Accepted by the <internalformat> parameter of CompressedTexImage2DARB + * and the <format> parameter of CompressedTexSubImage2DARB: + */ + int GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG = 0x8C00, + GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG = 0x8C01, + GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG = 0x8C02, + GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG = 0x8C03; + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/KHR_debug.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/KHR_debug.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/KHR_debug.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/KHR_debug.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,222 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +import org.lwjgl.util.generator.*; +import org.lwjgl.util.generator.opengl.*; + +import java.nio.ByteBuffer; +import java.nio.IntBuffer; + +public interface KHR_debug { + + /** + * Tokens accepted by the <target> parameters of Enable, Disable, and + * IsEnabled: + */ + int GL_DEBUG_OUTPUT = 0x92E0, + GL_DEBUG_OUTPUT_SYNCHRONOUS = 0x8242; + + /** Returned by GetIntegerv when <pname> is CONTEXT_FLAGS: */ + int GL_CONTEXT_FLAG_DEBUG_BIT = 0x00000002; + + /** + * Tokens accepted by the <value> parameters of GetBooleanv, GetIntegerv, + * GetFloatv, GetDoublev and GetInteger64v: + */ + int GL_MAX_DEBUG_MESSAGE_LENGTH = 0x9143, + GL_MAX_DEBUG_LOGGED_MESSAGES = 0x9144, + GL_DEBUG_LOGGED_MESSAGES = 0x9145, + GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH = 0x8243, + GL_MAX_DEBUG_GROUP_STACK_DEPTH = 0x826C, + GL_DEBUG_GROUP_STACK_DEPTH = 0x826D, + GL_MAX_LABEL_LENGTH = 0x82E8; + + /** Tokens accepted by the <pname> parameter of GetPointerv: */ + int GL_DEBUG_CALLBACK_FUNCTION = 0x8244, + GL_DEBUG_CALLBACK_USER_PARAM = 0x8245; + + /** + * Tokens accepted or provided by the <source> parameters of + * DebugMessageControl, DebugMessageInsert and DEBUGPROC, and the <sources> + * parameter of GetDebugMessageLog: + */ + int GL_DEBUG_SOURCE_API = 0x8246, + GL_DEBUG_SOURCE_WINDOW_SYSTEM = 0x8247, + GL_DEBUG_SOURCE_SHADER_COMPILER = 0x8248, + GL_DEBUG_SOURCE_THIRD_PARTY = 0x8249, + GL_DEBUG_SOURCE_APPLICATION = 0x824A, + GL_DEBUG_SOURCE_OTHER = 0x824B; + + /** + * Tokens accepted or provided by the <type> parameters of + * DebugMessageControl, DebugMessageInsert and DEBUGPROC, and the <types> + * parameter of GetDebugMessageLog: + */ + int GL_DEBUG_TYPE_ERROR = 0x824C, + GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR = 0x824D, + GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR = 0x824E, + GL_DEBUG_TYPE_PORTABILITY = 0x824F, + GL_DEBUG_TYPE_PERFORMANCE = 0x8250, + GL_DEBUG_TYPE_OTHER = 0x8251, + GL_DEBUG_TYPE_MARKER = 0x8268; + + /** + * Tokens accepted or provided by the <type> parameters of + * DebugMessageControl and DEBUGPROC, and the <types> parameter of + * GetDebugMessageLog: + */ + int GL_DEBUG_TYPE_PUSH_GROUP = 0x8269, + GL_DEBUG_TYPE_POP_GROUP = 0x826A; + + /** + * Tokens accepted or provided by the <severity> parameters of + * DebugMessageControl, DebugMessageInsert and DEBUGPROC callback functions, + * and the <severities> parameter of GetDebugMessageLog: + */ + int GL_DEBUG_SEVERITY_HIGH = 0x9146, + GL_DEBUG_SEVERITY_MEDIUM = 0x9147, + GL_DEBUG_SEVERITY_LOW = 0x9148, + GL_DEBUG_SEVERITY_NOTIFICATION = 0x826B; + + /** Returned by GetError: */ + int GL_STACK_UNDERFLOW = 0x0504, + GL_STACK_OVERFLOW = 0x0503; + + /** + * Tokens accepted or provided by the <identifier> parameters of + * ObjectLabel and GetObjectLabel: + */ + int GL_BUFFER = 0x82E0, + GL_SHADER = 0x82E1, + GL_PROGRAM = 0x82E2, + GL_QUERY = 0x82E3, + GL_PROGRAM_PIPELINE = 0x82E4, + GL_SAMPLER = 0x82E6, + GL_DISPLAY_LIST = 0x82E7; + + // ----------------------------- + + void glDebugMessageControl(@GLenum int source, + @GLenum int type, + @GLenum int severity, + @AutoSize(value = "ids", canBeNull = true) @GLsizei int count, + @Check(canBeNull = true) @Const @GLuint IntBuffer ids, + boolean enabled); + + void glDebugMessageInsert(@GLenum int source, + @GLenum int type, + @GLuint int id, + @GLenum int severity, + @AutoSize("buf") @GLsizei int length, + @Const @GLchar ByteBuffer buf); + + @Alternate("glDebugMessageInsert") + void glDebugMessageInsert(@GLenum int source, + @GLenum int type, + @GLuint int id, + @GLenum int severity, + @Constant("buf.length()") @GLsizei int length, + CharSequence buf); + + /** + * The {@code KHRDebugCallback.Handler} implementation passed to this method will be used for + * KHR_debug messages. If callback is null, any previously registered handler for the current + * thread will be unregistered and stop receiving messages. + * + * @param callback the callback function to use + */ + @Code( + // Create a GlobalRef to the callback object and register it with the current context. + javaBeforeNative = "\t\tlong userParam = callback == null ? 0 : CallbackUtil.createGlobalRef(callback.getHandler());\n" + + "\t\tCallbackUtil.registerContextCallbackKHR(userParam);" + ) + void glDebugMessageCallback(@PointerWrapper(value = "GLDEBUGPROC", canBeNull = true) KHRDebugCallback callback, + @Constant("userParam") @PointerWrapper("GLvoid *") long userParam); + + @GLuint + int glGetDebugMessageLog(@GLuint int count, + @AutoSize(value = "messageLog", canBeNull = true) @GLsizei int bufsize, + @Check(value = "count", canBeNull = true) @GLenum IntBuffer sources, + @Check(value = "count", canBeNull = true) @GLenum IntBuffer types, + @Check(value = "count", canBeNull = true) @GLuint IntBuffer ids, + @Check(value = "count", canBeNull = true) @GLenum IntBuffer severities, + @Check(value = "count", canBeNull = true) @GLsizei IntBuffer lengths, + @Check(canBeNull = true) @OutParameter @GLchar ByteBuffer messageLog); + + // Not really useful and a pain to implement in Java + // void glGetPointerv(@GLenum int pname, void** params); + + void glPushDebugGroup(@GLenum int source, @GLuint int id, @AutoSize("message") @GLsizei int length, + @Const @GLchar ByteBuffer message); + + @Alternate("glPushDebugGroup") + void glPushDebugGroup(@GLenum int source, @GLuint int id, @Constant("message.length()") @GLsizei int length, + CharSequence message); + + void glPopDebugGroup(); + + void glObjectLabel(@GLenum int identifier, @GLuint int name, @AutoSize(value = "label", canBeNull = true) @GLsizei int length, + @Check(canBeNull = true) @Const @GLchar ByteBuffer label); + + @Alternate("glObjectLabel") + void glObjectLabel(@GLenum int identifier, @GLuint int name, @Constant("label.length()") @GLsizei int length, + CharSequence label); + + void glGetObjectLabel(@GLenum int identifier, @GLuint int name, @AutoSize("label") @GLsizei int bufSize, + @OutParameter @Check(value = "1", canBeNull = true) @GLsizei IntBuffer length, + @OutParameter @GLchar ByteBuffer label); + + @Alternate("glGetObjectLabel") + @GLreturn(value = "label", maxLength = "bufSize") + void glGetObjectLabel2(@GLenum int identifier, @GLuint int name, @GLsizei int bufSize, + @OutParameter @GLsizei @Constant("MemoryUtil.getAddress0(label_length)") IntBuffer length, + @OutParameter @GLchar ByteBuffer label); + + void glObjectPtrLabel(@PointerWrapper("GLvoid *") org.lwjgl.PointerWrapper ptr, @AutoSize(value = "label", canBeNull = true) @GLsizei int length, + @Check(canBeNull = true) @Const @GLchar ByteBuffer label); + + @Alternate("glObjectPtrLabel") + void glObjectPtrLabel(@PointerWrapper("GLvoid *") org.lwjgl.PointerWrapper ptr, @Constant("label.length()") @GLsizei int length, + CharSequence label); + + void glGetObjectPtrLabel(@PointerWrapper("GLvoid *") org.lwjgl.PointerWrapper ptr, @AutoSize("label") @GLsizei int bufSize, + @OutParameter @Check(value = "1", canBeNull = true) @GLsizei IntBuffer length, + @OutParameter @GLchar ByteBuffer label); + + @Alternate("glGetObjectPtrLabel") + @GLreturn(value = "label", maxLength = "bufSize") + void glGetObjectPtrLabel2(@PointerWrapper("GLvoid *") org.lwjgl.PointerWrapper ptr, @GLsizei int bufSize, + @OutParameter @GLsizei @Constant("MemoryUtil.getAddress0(label_length)") IntBuffer length, + @OutParameter @GLchar ByteBuffer label); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/KHR_texture_compression_astc_ldr.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/KHR_texture_compression_astc_ldr.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/KHR_texture_compression_astc_ldr.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/KHR_texture_compression_astc_ldr.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2002-2012 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +public interface KHR_texture_compression_astc_ldr { + + /** + * Accepted by the <internalformat> parameter of CompressedTexImage2D, + * CompressedTexSubImage2D, TexStorage2D, TextureStorage2D, TexStorage3D, + * and TextureStorage3D: + */ + int GL_COMPRESSED_RGBA_ASTC_4x4_KHR = 0x93B0, + GL_COMPRESSED_RGBA_ASTC_5x4_KHR = 0x93B1, + GL_COMPRESSED_RGBA_ASTC_5x5_KHR = 0x93B2, + GL_COMPRESSED_RGBA_ASTC_6x5_KHR = 0x93B3, + GL_COMPRESSED_RGBA_ASTC_6x6_KHR = 0x93B4, + GL_COMPRESSED_RGBA_ASTC_8x5_KHR = 0x93B5, + GL_COMPRESSED_RGBA_ASTC_8x6_KHR = 0x93B6, + GL_COMPRESSED_RGBA_ASTC_8x8_KHR = 0x93B7, + GL_COMPRESSED_RGBA_ASTC_10x5_KHR = 0x93B8, + GL_COMPRESSED_RGBA_ASTC_10x6_KHR = 0x93B9, + GL_COMPRESSED_RGBA_ASTC_10x8_KHR = 0x93BA, + GL_COMPRESSED_RGBA_ASTC_10x10_KHR = 0x93BB, + GL_COMPRESSED_RGBA_ASTC_12x10_KHR = 0x93BC, + GL_COMPRESSED_RGBA_ASTC_12x12_KHR = 0x93BD, + GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR = 0x93D0, + GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR = 0x93D1, + GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR = 0x93D2, + GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR = 0x93D3, + GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR = 0x93D4, + GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR = 0x93D5, + GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR = 0x93D6, + GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR = 0x93D7, + GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR = 0x93D8, + GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR = 0x93D9, + GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR = 0x93DA, + GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR = 0x93DB, + GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR = 0x93DC, + GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR = 0x93DD; + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/NV_coverage_sample.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/NV_coverage_sample.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/NV_coverage_sample.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/NV_coverage_sample.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +import org.lwjgl.util.generator.opengl.GLenum; + +public interface NV_coverage_sample { + + /** + * Accepted by the <attrib_list> parameter of eglChooseConfig + * and eglCreatePbufferSurface, and by the <attribute> + * parameter of eglGetConfigAttrib: + */ + int EGL_COVERAGE_BUFFERS_NV = 0x30E0, + EGL_COVERAGE_SAMPLES_NV = 0x30E1; + + /** + * Accepted by the <internalformat> parameter of + * RenderbufferStorageEXT and the <format> parameter of ReadPixels: + */ + int GL_COVERAGE_COMPONENT_NV = 0x8522; + + /** + * Accepted by the <internalformat> parameter of + * RenderbufferStorageEXT: + */ + int GL_COVERAGE_COMPONENT4_NV = 0x8523; + + /** Accepted by the <operation> parameter of CoverageOperationNV: */ + int GL_COVERAGE_ALL_FRAGMENTS_NV = 0x8524, + GL_COVERAGE_EDGE_FRAGMENTS_NV = 0x8525, + GL_COVERAGE_AUTOMATIC_NV = 0x8526; + + /** + * Accepted by the <attachment> parameter of + * FramebufferRenderbuffer, and GetFramebufferAttachmentParameteriv: + */ + int GL_COVERAGE_ATTACHMENT_NV = 0x8527; + + /** Accepted by the <buf> parameter of Clear: */ + int GL_COVERAGE_BUFFER_BIT_NV = 0x8000; + + /** Accepted by the <pname> parameter of GetIntegerv: */ + int GL_COVERAGE_BUFFERS_NV = 0x8528, + GL_COVERAGE_SAMPLES_NV = 0x8529; + + void glCoverageMaskNV(boolean mask); + + void glCoverageOperationNV(@GLenum int operation); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/NV_depth_nonlinear.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/NV_depth_nonlinear.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/NV_depth_nonlinear.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/NV_depth_nonlinear.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +public interface NV_depth_nonlinear { + + /** + * Accepted as a valid sized internal format by all functions accepting + * sized internal formats with a base format of DEPTH_COMPONENT: + */ + int GL_DEPTH_COMPONENT16_NONLINEAR_NV = 0x8553; + + /** + * Accepted by the <attrib_list> parameter of eglChooseConfig, + * and by the <attribute> parameter of eglGetConfigAttrib: + */ + int EGL_DEPTH_ENCODING_NV = 0x30E2; + + /** + * Accepted as a value in the <attrib_list> parameter of eglChooseConfig + * and eglCreatePbufferSurface, and returned in the <value> parameter + * of eglGetConfigAttrib: + */ + int EGL_DEPTH_ENCODING_NONE_NV = 0, + EGL_DEPTH_ENCODING_NONLINEAR_NV = 0x30E3; + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/NV_draw_buffers.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/NV_draw_buffers.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/NV_draw_buffers.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/NV_draw_buffers.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +import org.lwjgl.util.generator.Alternate; +import org.lwjgl.util.generator.AutoSize; +import org.lwjgl.util.generator.Const; +import org.lwjgl.util.generator.Constant; +import org.lwjgl.util.generator.opengl.GLenum; +import org.lwjgl.util.generator.opengl.GLsizei; + +import java.nio.IntBuffer; + +public interface NV_draw_buffers { + + /** + * Accepted by the <pname> parameters of GetIntegerv, GetFloatv, + * and GetDoublev: + */ + int GL_MAX_DRAW_BUFFERS_NV = 0x8824, + GL_DRAW_BUFFER0_NV = 0x8825, + GL_DRAW_BUFFER1_NV = 0x8826, + GL_DRAW_BUFFER2_NV = 0x8827, + GL_DRAW_BUFFER3_NV = 0x8828, + GL_DRAW_BUFFER4_NV = 0x8829, + GL_DRAW_BUFFER5_NV = 0x882A, + GL_DRAW_BUFFER6_NV = 0x882B, + GL_DRAW_BUFFER7_NV = 0x882C, + GL_DRAW_BUFFER8_NV = 0x882D, + GL_DRAW_BUFFER9_NV = 0x882E, + GL_DRAW_BUFFER10_NV = 0x882F, + GL_DRAW_BUFFER11_NV = 0x8830, + GL_DRAW_BUFFER12_NV = 0x8831, + GL_DRAW_BUFFER13_NV = 0x8832, + GL_DRAW_BUFFER14_NV = 0x8833, + GL_DRAW_BUFFER15_NV = 0x8834; + + /** Accepted by the <bufs> parameter of DrawBuffersNV: */ + int GL_COLOR_ATTACHMENT0_NV = 0x8CE0, + GL_COLOR_ATTACHMENT1_NV = 0x8CE1, + GL_COLOR_ATTACHMENT2_NV = 0x8CE2, + GL_COLOR_ATTACHMENT3_NV = 0x8CE3, + GL_COLOR_ATTACHMENT4_NV = 0x8CE4, + GL_COLOR_ATTACHMENT5_NV = 0x8CE5, + GL_COLOR_ATTACHMENT6_NV = 0x8CE6, + GL_COLOR_ATTACHMENT7_NV = 0x8CE7, + GL_COLOR_ATTACHMENT8_NV = 0x8CE8, + GL_COLOR_ATTACHMENT9_NV = 0x8CE9, + GL_COLOR_ATTACHMENT10_NV = 0x8CEA, + GL_COLOR_ATTACHMENT11_NV = 0x8CEB, + GL_COLOR_ATTACHMENT12_NV = 0x8CEC, + GL_COLOR_ATTACHMENT13_NV = 0x8CED, + GL_COLOR_ATTACHMENT14_NV = 0x8CEE, + GL_COLOR_ATTACHMENT15_NV = 0x8CEF; + + void glDrawBuffersNV(@AutoSize("bufs") @GLsizei int n, @Const @GLenum IntBuffer bufs); + + @Alternate("glDrawBuffersNV") + void glDrawBuffersNV(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getInt(buf)", keepParam = true) int buf); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/NV_draw_path.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/NV_draw_path.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/NV_draw_path.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/NV_draw_path.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,123 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +import org.lwjgl.util.generator.AutoSize; +import org.lwjgl.util.generator.Check; +import org.lwjgl.util.generator.Const; +import org.lwjgl.util.generator.opengl.*; + +import java.nio.ByteBuffer; +import java.nio.FloatBuffer; + +public interface NV_draw_path { + + /** Accepted as the <paramType> parameter of PathParameterNV: */ + int GL_PATH_QUALITY_NV = 0x8ED8, + GL_FILL_RULE_NV = 0x8ED9, + GL_STROKE_CAP0_STYLE_NV = 0x8EE0, + GL_STROKE_CAP1_STYLE_NV = 0x8EE1, + GL_STROKE_CAP2_STYLE_NV = 0x8EE2, + GL_STROKE_CAP3_STYLE_NV = 0x8EE3, + GL_STROKE_JOIN_STYLE_NV = 0x8EE8, + GL_STROKE_MITER_LIMIT_NV = 0x8EE9; + + /** Values for the ILL_RULE_NV path parameter: */ + int GL_EVEN_ODD_NV = 0x8EF0, + GL_NON_ZERO_NV = 0x8EF1; + + /** Values for the CAP[0-3]_STYLE_NV path parameter: */ + int GL_CAP_BUTT_NV = 0x8EF4, + GL_CAP_ROUND_NV = 0x8EF5, + GL_CAP_SQUARE_NV = 0x8EF6, + GL_CAP_TRIANGLE_NV = 0x8EF7; + + /** Values for the JOIN_STYLE_NV path parameter: */ + int GL_JOIN_MITER_NV = 0x8EFC, + GL_JOIN_ROUND_NV = 0x8EFD, + GL_JOIN_BEVEL_NV = 0x8EFE, + GL_JOIN_CLIPPED_MITER_NV = 0x8EFF; + + /** Accepted as the <target> parameter of PathMatrixNV: */ + int GL_MATRIX_PATH_TO_CLIP_NV = 0x8F04, + GL_MATRIX_STROKE_TO_PATH_NV = 0x8F05, + GL_MATRIX_PATH_COORD0_NV = 0x8F08, + GL_MATRIX_PATH_COORD1_NV = 0x8F09, + GL_MATRIX_PATH_COORD2_NV = 0x8F0A, + GL_MATRIX_PATH_COORD3_NV = 0x8F0B; + + /** Accepted as the <mode> parameter of DrawPathbufferNV: */ + int GL_FILL_PATH_NV = 0x8F18, + GL_STROKE_PATH_NV = 0x8F19; + + /** Accepted as path commands by CreatePathNV: */ + byte GL_MOVE_TO_NV = 0x00, + GL_LINE_TO_NV = 0x01, + GL_QUADRATIC_BEZIER_TO_NV = 0x02, + GL_CUBIC_BEZIER_TO_NV = 0x03, + GL_START_MARKER_NV = 0x20, + GL_CLOSE_NV = 0x21, + GL_STROKE_CAP0_NV = 0x40, + GL_STROKE_CAP1_NV = 0x41, + GL_STROKE_CAP2_NV = 0x42, + GL_STROKE_CAP3_NV = 0x43; + + @GLuint + int glCreatePathNV(@GLenum int datatype, @AutoSize("commands") @GLsizei int numCommands, @Const @GLubyte ByteBuffer commands); + + void glDeletePathNV(@GLuint int path); + + void glPathVerticesNV(@GLuint int path, @Const @Check @GLvoid ByteBuffer vertices); + + void glPathParameterfNV(@GLuint int path, @GLenum int paramType, float param); + + void glPathParameteriNV(@GLuint int path, @GLenum int paramType, int param); + + @GLuint + int glCreatePathProgramNV(); + + void glPathMatrixNV(@GLenum int target, @Const @Check("16") FloatBuffer value); + + void glDrawPathNV(@GLuint int path, @GLenum int mode); + + @GLuint + int glCreatePathbufferNV(@GLsizei int capacity); + + void glDeletePathbufferNV(@GLuint int buffer); + + void glPathbufferPathNV(@GLuint int buffer, int index, @GLuint int path); + + void glPathbufferPositionNV(@GLuint int buffer, int index, float x, float y); + + void glDrawPathbufferNV(@GLuint int buffer, @GLenum int mode); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/NV_draw_texture.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/NV_draw_texture.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/NV_draw_texture.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/NV_draw_texture.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2002-2012 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +import org.lwjgl.util.generator.opengl.GLfloat; +import org.lwjgl.util.generator.opengl.GLuint; + +public interface NV_draw_texture { + + void glDrawTextureNV(@GLuint int texture, @GLuint int sampler, + @GLfloat float x0, @GLfloat float y0, + @GLfloat float x1, @GLfloat float y1, + @GLfloat float z, + @GLfloat float s0, @GLfloat float t0, + @GLfloat float s1, @GLfloat float t1); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/NV_EGL_stream_consumer_external.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/NV_EGL_stream_consumer_external.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/NV_EGL_stream_consumer_external.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/NV_EGL_stream_consumer_external.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +public interface NV_EGL_stream_consumer_external { + + /** Accepted as a target in the <target> parameter of BindTexture: */ + int GL_TEXTURE_EXTERNAL_OES = 0x8D65; + + /** Returned in the <type> parameter of GetActiveUniform: */ + int GL_SAMPLER_EXTERNAL_OES = 0x8D66; + + /** Accepted as <value> in GetIntegerv() and GetFloatv() queries: */ + int GL_TEXTURE_BINDING_EXTERNAL_OES = 0x8D67; + + /** Accepted as <value> in GetTexParameter*() queries: */ + int GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES = 0x8D68; + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/NV_fbo_color_attachments.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/NV_fbo_color_attachments.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/NV_fbo_color_attachments.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/NV_fbo_color_attachments.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +public interface NV_fbo_color_attachments { + + int GL_MAX_COLOR_ATTACHMENTS_NV = 0x8CDF, + GL_COLOR_ATTACHMENT0_NV = 0x8CE0, + GL_COLOR_ATTACHMENT1_NV = 0x8CE1, + GL_COLOR_ATTACHMENT2_NV = 0x8CE2, + GL_COLOR_ATTACHMENT3_NV = 0x8CE3, + GL_COLOR_ATTACHMENT4_NV = 0x8CE4, + GL_COLOR_ATTACHMENT5_NV = 0x8CE5, + GL_COLOR_ATTACHMENT6_NV = 0x8CE6, + GL_COLOR_ATTACHMENT7_NV = 0x8CE7, + GL_COLOR_ATTACHMENT8_NV = 0x8CE8, + GL_COLOR_ATTACHMENT9_NV = 0x8CE9, + GL_COLOR_ATTACHMENT10_NV = 0x8CEA, + GL_COLOR_ATTACHMENT11_NV = 0x8CEB, + GL_COLOR_ATTACHMENT12_NV = 0x8CEC, + GL_COLOR_ATTACHMENT13_NV = 0x8CED, + GL_COLOR_ATTACHMENT14_NV = 0x8CEE, + GL_COLOR_ATTACHMENT15_NV = 0x8CEF; + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/NV_fence.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/NV_fence.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/NV_fence.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/NV_fence.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +import org.lwjgl.util.generator.*; +import org.lwjgl.util.generator.opengl.GLenum; +import org.lwjgl.util.generator.opengl.GLreturn; +import org.lwjgl.util.generator.opengl.GLsizei; +import org.lwjgl.util.generator.opengl.GLuint; + +import java.nio.IntBuffer; + +public interface NV_fence { + + /** Accepted by the <condition> parameter of SetFenceNV: */ + int GL_ALL_COMPLETED_NV = 0x84F2; + + /** Accepted by the <pname> parameter of GetFenceivNV: */ + int GL_FENCE_STATUS_NV = 0x84F3, + GL_FENCE_CONDITION_NV = 0x84F4; + + void glGenFencesNV(@AutoSize("fences") @GLsizei int n, @OutParameter @GLuint IntBuffer fences); + + @Alternate("glGenFencesNV") + @GLreturn("fences") + void glGenFencesNV2(@Constant("1") @GLsizei int n, @OutParameter @GLuint IntBuffer fences); + + void glDeleteFencesNV(@AutoSize("fences") @GLsizei int n, @Const @GLuint IntBuffer fences); + + @Alternate("glDeleteFencesNV") + void glDeleteFencesNV(@Constant("1") @GLsizei int n, @Const @GLuint @Constant(value = "APIUtil.getInt(fence)", keepParam = true) int fence); + + void glSetFenceNV(@GLuint int fence, @GLenum int condition); + + boolean glTestFenceNV(@GLuint int fence); + + void glFinishFenceNV(@GLuint int fence); + + boolean glIsFenceNV(@GLuint int fence); + + void glGetFenceivNV(@GLuint int fence, @GLenum int pname, @OutParameter @Check("1") IntBuffer params); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/NV_framebuffer_vertex_attrib_array.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/NV_framebuffer_vertex_attrib_array.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/NV_framebuffer_vertex_attrib_array.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/NV_framebuffer_vertex_attrib_array.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +import org.lwjgl.util.generator.opengl.*; + +public interface NV_framebuffer_vertex_attrib_array { + + int GL_FRAMEBUFFER_ATTACHABLE_NV = 0x852A, + GL_VERTEX_ATTRIB_ARRAY_NV = 0x852B, + GL_FRAMEBUFFER_ATTACHMENT_VERTEX_ATTRIB_ARRAY_SIZE_NV = 0x852C, + GL_FRAMEBUFFER_ATTACHMENT_VERTEX_ATTRIB_ARRAY_TYPE_NV = 0x852D, + GL_FRAMEBUFFER_ATTACHMENT_VERTEX_ATTRIB_ARRAY_NORMALIZED_NV = 0x852E, + GL_FRAMEBUFFER_ATTACHMENT_VERTEX_ATTRIB_ARRAY_OFFSET_NV = 0x852F, + GL_FRAMEBUFFER_ATTACHMENT_VERTEX_ATTRIB_ARRAY_WIDTH_NV = 0x8530, + GL_FRAMEBUFFER_ATTACHMENT_VERTEX_ATTRIB_ARRAY_STRIDE_NV = 0x8531, + GL_FRAMEBUFFER_ATTACHMENT_VERTEX_ATTRIB_ARRAY_HEIGHT_NV = 0x8532; + + void glFramebufferVertexAttribArrayNV(@GLenum int target, @GLenum int attachment, + @GLenum int buffertarget, @GLuint int bufferobject, + @GLint int size, @GLenum int type, @GLboolean boolean normalized, @GLintptr long offset, + @GLsizeiptr long width, @GLsizeiptr long height, @GLsizei int stride); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/NV_get_tex_image.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/NV_get_tex_image.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/NV_get_tex_image.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/NV_get_tex_image.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +import org.lwjgl.util.generator.Alternate; +import org.lwjgl.util.generator.Check; +import org.lwjgl.util.generator.OutParameter; +import org.lwjgl.util.generator.StripPostfix; +import org.lwjgl.util.generator.opengl.*; + +import java.nio.Buffer; +import java.nio.ByteBuffer; +import java.nio.FloatBuffer; +import java.nio.IntBuffer; + +public interface NV_get_tex_image { + + int GL_TEXTURE_WIDTH_NV = 0x1000, + GL_TEXTURE_HEIGHT_NV = 0x1001, + GL_TEXTURE_INTERNAL_FORMAT_NV = 0x1003, + GL_TEXTURE_COMPONENTS_NV = GL_TEXTURE_INTERNAL_FORMAT_NV, + GL_TEXTURE_BORDER_NV = 0x1005, + GL_TEXTURE_RED_SIZE_NV = 0x805C, + GL_TEXTURE_GREEN_SIZE_NV = 0x805D, + GL_TEXTURE_BLUE_SIZE_NV = 0x805E, + GL_TEXTURE_ALPHA_SIZE_NV = 0x805F, + GL_TEXTURE_LUMINANCE_SIZE_NV = 0x8060, + GL_TEXTURE_INTENSITY_SIZE_NV = 0x8061, + GL_TEXTURE_DEPTH_NV = 0x8071, + GL_TEXTURE_COMPRESSED_IMAGE_SIZE_NV = 0x86A0, + GL_TEXTURE_COMPRESSED_NV = 0x86A1, + GL_TEXTURE_DEPTH_SIZE_NV = 0x884A; + + void glGetTexImageNV(@GLenum int target, @GLint int level, @GLenum int format, @GLenum int type, + @OutParameter + @Check("GLChecks.calculateImageStorage(img, format, type, 1, 1, 1)") + @GLbyte + @GLshort + @GLint + @GLfloat Buffer img); + + void glGetCompressedTexImageNV(@GLenum int target, @GLint int level, @OutParameter @Check @GLvoid ByteBuffer img); + + @StripPostfix("params") + void glGetTexLevelParameterfvNV(@GLenum int target, @GLint int level, @GLenum int pname, @OutParameter @Check("1") @GLfloat FloatBuffer params); + + @Alternate("glGetTexLevelParameterfvNV") + @GLreturn("params") + @StripPostfix(value = "params", hasPostfix = false) + void glGetTexLevelParameterfvNV2(@GLenum int target, @GLint int level, @GLenum int pname, @OutParameter @GLfloat FloatBuffer params); + + @StripPostfix("params") + void glGetTexLevelParameterivNV(@GLenum int target, @GLint int level, @GLenum int pname, @OutParameter @Check("1") @GLint IntBuffer params); + + @Alternate("glGetTexLevelParameterivNV") + @GLreturn("params") + @StripPostfix(value = "params", hasPostfix = false) + void glGetTexLevelParameterivNV2(@GLenum int target, @GLint int level, @GLenum int pname, @OutParameter @GLint IntBuffer params); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/NV_platform_binary.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/NV_platform_binary.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/NV_platform_binary.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/NV_platform_binary.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +public interface NV_platform_binary { + + /** Accepted by the <binaryformat> parameter of ShaderBinary: */ + int GL_NVIDIA_PLATFORM_BINARY_NV = 0x890B; + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/NV_read_buffer.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/NV_read_buffer.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/NV_read_buffer.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/NV_read_buffer.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +import org.lwjgl.util.generator.opengl.GLenum; + +public interface NV_read_buffer { + + int GL_READ_BUFFER_NV = 0x0C02, + GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_NV = 0x8CDC; + + void glReadBufferNV(@GLenum int mode); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/NV_read_depth_stencil.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/NV_read_depth_stencil.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/NV_read_depth_stencil.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/NV_read_depth_stencil.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +public interface NV_read_depth_stencil { + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/NV_shader_framebuffer_fetch.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/NV_shader_framebuffer_fetch.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/NV_shader_framebuffer_fetch.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/NV_shader_framebuffer_fetch.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +public interface NV_shader_framebuffer_fetch { + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/NV_system_time.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/NV_system_time.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/NV_system_time.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/NV_system_time.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +import org.lwjgl.util.generator.opengl.EGLuint64NV; + +public interface NV_system_time { + + @EGLuint64NV + long glGetSystemTimeFrequencyNV(); + + @EGLuint64NV + long glGetSystemTimeNV(); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/NV_texture_compression_s3tc_update.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/NV_texture_compression_s3tc_update.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/NV_texture_compression_s3tc_update.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/NV_texture_compression_s3tc_update.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +public interface NV_texture_compression_s3tc_update { + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/NV_texture_npot_2D_mipmap.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/NV_texture_npot_2D_mipmap.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/NV_texture_npot_2D_mipmap.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/NV_texture_npot_2D_mipmap.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +public interface NV_texture_npot_2D_mipmap { + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/OES_blend_equation_separate.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/OES_blend_equation_separate.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/OES_blend_equation_separate.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/OES_blend_equation_separate.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +import org.lwjgl.util.generator.opengl.GLenum; + +public interface OES_blend_equation_separate { + + /** + * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, and + * GetFloatv: + */ + int GL_BLEND_EQUATION_RGB_OES = 0x8009, + GL_BLEND_EQUATION_ALPHA_OES = 0x883D; + + void glBlendEquationSeparateOES(@GLenum int modeRGB, @GLenum int modeAlpha); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/OES_blend_func_separate.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/OES_blend_func_separate.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/OES_blend_func_separate.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/OES_blend_func_separate.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +import org.lwjgl.util.generator.opengl.GLenum; + +public interface OES_blend_func_separate { + + /** + * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, and + * GetFloatv: + */ + int GL_BLEND_DST_RGB_OES = 0x80C8, + BLEND_SRC_RGB_OES = 0x80C9, + BLEND_DST_ALPHA_OES = 0x80CA, + BLEND_SRC_ALPHA_OES = 0x80CB; + + void glBlendFuncSeparateOES(@GLenum int sfactorRGB, + @GLenum int dfactorRGB, + @GLenum int sfactorAlpha, + @GLenum int dfactorAlpha); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/OES_blend_subtract.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/OES_blend_subtract.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/OES_blend_subtract.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/OES_blend_subtract.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +import org.lwjgl.util.generator.opengl.GLenum; + +public interface OES_blend_subtract { + + /** Accepted by the <mode> parameter of BlendEquationOES: */ + int GL_FUNC_ADD_OES = 0x8006, + GL_FUNC_SUBTRACT_OES = 0x800A, + GL_FUNC_REVERSE_SUBTRACT_OES = 0x800B; + + /** + * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, + * and GetFloatv: + */ + int GL_BLEND_EQUATION_OES = 0x8009; + + void glBlendEquationOES(@GLenum int mode); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/OES_compressed_ETC1_RGB8_texture.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/OES_compressed_ETC1_RGB8_texture.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/OES_compressed_ETC1_RGB8_texture.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/OES_compressed_ETC1_RGB8_texture.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +public interface OES_compressed_ETC1_RGB8_texture { + + /** Accepted by the <internalformat> parameter of CompressedTexImage2D: */ + int GL_ETC1_RGB8_OES = 0x8D64; + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/OES_compressed_paletted_texture.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/OES_compressed_paletted_texture.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/OES_compressed_paletted_texture.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/OES_compressed_paletted_texture.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +public interface OES_compressed_paletted_texture { + + /** Accepted by the <internalformat> paramter of CompressedTexImage2D */ + int GL_PALETTE4_RGB8_OES = 0x8B90, + GL_PALETTE4_RGBA8_OES = 0x8B91, + GL_PALETTE4_R5_G6_B5_OES = 0x8B92, + GL_PALETTE4_RGBA4_OES = 0x8B93, + GL_PALETTE4_RGB5_A1_OES = 0x8B94, + GL_PALETTE8_RGB8_OES = 0x8B95, + GL_PALETTE8_RGBA8_OES = 0x8B96, + GL_PALETTE8_R5_G6_B5_OES = 0x8B97, + GL_PALETTE8_RGBA4_OES = 0x8B98, + GL_PALETTE8_RGB5_A1_OES = 0x8B99; + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/OES_depth24.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/OES_depth24.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/OES_depth24.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/OES_depth24.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +public interface OES_depth24 { + + /** Accepted by the <internalformat> parameter of RenderbufferStorageOES: */ + int GL_DEPTH_COMPONENT24_OES = 0x81A6; + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/OES_depth32.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/OES_depth32.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/OES_depth32.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/OES_depth32.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +public interface OES_depth32 { + + /** Accepted by the <internalformat> parameter of RenderbufferStorageOES: */ + int GL_DEPTH_COMPONENT32_OES = 0x81A7; + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/OES_depth_texture.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/OES_depth_texture.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/OES_depth_texture.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/OES_depth_texture.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +public interface OES_depth_texture { + + /** + * Accepted by the <format> parameter of TexImage2D and TexSubImage2D and + * <internalFormat> parameter of TexImage2D: + */ + int GL_DEPTH_COMPONENT = 0x1902; + + /** Accepted by the <type> parameter of TexImage2D, TexSubImage2D: */ + int GL_UNSIGNED_SHORT = 0x1403, + GL_UNSIGNED_INT = 0x1405; + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/OES_EGL_image_external.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/OES_EGL_image_external.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/OES_EGL_image_external.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/OES_EGL_image_external.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +import org.lwjgl.util.generator.PointerWrapper; +import org.lwjgl.util.generator.opengl.GLenum; + +public interface OES_EGL_image_external { + + /** + * Accepted as a target in the <target> parameter of BindTexture and + * EGLImageTargetTexture2DOES: + */ + int GL_TEXTURE_EXTERNAL_OES = 0x8D65; + + /** Returned in the <type> parameter of GetActiveUniform: */ + int GL_SAMPLER_EXTERNAL_OES = 0x8D66; + + /** Accepted as <value> in GetIntegerv() and GetFloatv() queries: */ + int GL_TEXTURE_BINDING_EXTERNAL_OES = 0x8D67; + + /** Accepted as <value> in GetTexParameter*() queries: */ + int GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES = 0x8D68; + + void glEGLImageTargetTexture2DOES(@GLenum int target, @PointerWrapper("GLeglImageOES") EGLImageOES image); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/OES_EGL_image.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/OES_EGL_image.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/OES_EGL_image.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/OES_EGL_image.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +import org.lwjgl.util.generator.PointerWrapper; +import org.lwjgl.util.generator.opengl.GLenum; + +public interface OES_EGL_image { + + void glEGLImageTargetTexture2DOES(@GLenum int target, @PointerWrapper("GLeglImageOES") EGLImageOES image); + + void glEGLImageTargetRenderbufferStorageOES(@GLenum int target, @PointerWrapper("GLeglImageOES") EGLImageOES image); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/OES_EGL_sync.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/OES_EGL_sync.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/OES_EGL_sync.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/OES_EGL_sync.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +import org.lwjgl.util.generator.Alias; + +@Alias("OES_egl_sync") +public interface OES_EGL_sync { + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/OES_element_index_uint.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/OES_element_index_uint.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/OES_element_index_uint.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/OES_element_index_uint.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +public interface OES_element_index_uint { + + /** Accepted by the <type> parameter of DrawElements: */ + int GL_UNSIGNED_INT = 0x1405; + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/OES_fbo_render_mipmap.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/OES_fbo_render_mipmap.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/OES_fbo_render_mipmap.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/OES_fbo_render_mipmap.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +public interface OES_fbo_render_mipmap { + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/OES_framebuffer_object.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/OES_framebuffer_object.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/OES_framebuffer_object.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/OES_framebuffer_object.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,198 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +import org.lwjgl.util.generator.*; +import org.lwjgl.util.generator.opengl.GLenum; +import org.lwjgl.util.generator.opengl.GLreturn; +import org.lwjgl.util.generator.opengl.GLsizei; +import org.lwjgl.util.generator.opengl.GLuint; + +import java.nio.IntBuffer; + +public interface OES_framebuffer_object { + + /** + * Accepted by the <target> parameter of BindFramebufferOES, + * CheckFramebufferStatusOES, FramebufferTexture{2D|3D}OES, + * FramebufferRenderbufferOES, and + * GetFramebufferAttachmentParameterivOES: + */ + int GL_FRAMEBUFFER_OES = 0x8D40; + + /** + * Accepted by the <target> parameter of BindRenderbufferOES, + * RenderbufferStorageOES, and GetRenderbufferParameterivOES, and + * returned by GetFramebufferAttachmentParameterivOES: + */ + int GL_RENDERBUFFER_OES = 0x8D41; + + /** + * Accepted by the <internalformat> parameter of + * RenderbufferStorageOES: + */ + int GL_DEPTH_COMPONENT16_OES = 0x81A5, + GL_RGBA4_OES = 0x8056, + GL_RGB5_A1_OES = 0x8057, + GL_RGB565_OES = 0x8D62, + GL_STENCIL_INDEX1_OES = 0x8D46, + GL_STENCIL_INDEX4_OES = 0x8D47, + GL_STENCIL_INDEX8_OES = 0x8D48; + + /** Accepted by the <pname> parameter of GetRenderbufferParameterivOES: */ + int GL_RENDERBUFFER_WIDTH_OES = 0x8D42, + GL_RENDERBUFFER_HEIGHT_OES = 0x8D43, + GL_RENDERBUFFER_INTERNAL_FORMAT_OES = 0x8D44, + GL_RENDERBUFFER_RED_SIZE_OES = 0x8D50, + GL_RENDERBUFFER_GREEN_SIZE_OES = 0x8D51, + GL_RENDERBUFFER_BLUE_SIZE_OES = 0x8D52, + GL_RENDERBUFFER_ALPHA_SIZE_OES = 0x8D53, + GL_RENDERBUFFER_DEPTH_SIZE_OES = 0x8D54, + GL_RENDERBUFFER_STENCIL_SIZE_OES = 0x8D55; + + /** + * Accepted by the <pname> parameter of + * GetFramebufferAttachmentParameterivOES: + */ + int GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_OES = 0x8CD0, + GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_OES = 0x8CD1, + GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_OES = 0x8CD2, + GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_OES = 0x8CD3, + GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_OES = 0x8CD4; + + /** + * Accepted by the <attachment> parameter of + * FramebufferTexture{2D|3D}OES, FramebufferRenderbufferOES, and + * GetFramebufferAttachmentParameterivOES + */ + int GL_COLOR_ATTACHMENT0_OES = 0x8CE0, + GL_DEPTH_ATTACHMENT_OES = 0x8D00, + GL_STENCIL_ATTACHMENT_OES = 0x8D20; + + /** + * Returned by GetFramebufferAttachmentParameterivOES when the + * <pname> parameter is FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_OES: + */ + int GL_NONE_OES = 0; + + /** Returned by CheckFramebufferStatusOES(): */ + int GL_FRAMEBUFFER_COMPLETE_OES = 0x8CD5, + GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES = 0x8CD6, + GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_OES = 0x8CD7, + GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_OES = 0x8CD9, + GL_FRAMEBUFFER_INCOMPLETE_FORMATS_OES = 0x8CDA, + GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_OES = 0x8CDB, + GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_OES = 0x8CDC, + GL_FRAMEBUFFER_UNSUPPORTED_OES = 0x8CDD; + + /** Accepted by GetIntegerv(): */ + int GL_FRAMEBUFFER_BINDING_OES = 0x8CA6, + GL_RENDERBUFFER_BINDING_OES = 0x8CA7, + GL_MAX_RENDERBUFFER_SIZE_OES = 0x84E8; + + /** Returned by GetError(): */ + int GL_INVALID_FRAMEBUFFER_OPERATION_OES = 0x0506; + + boolean glIsRenderbufferOES(@GLuint int renderbuffer); + + void glBindRenderbufferOES(@GLenum int target, @GLuint int renderbuffer); + + void glDeleteRenderbuffersOES(@AutoSize("renderbuffers") int n, @Const @GLuint IntBuffer renderbuffers); + + @Alternate("glDeleteRenderbuffersOES") + void glDeleteRenderbuffersOES(@Constant("1") int n, @Constant(value = "APIUtil.getInt(renderbuffer)", keepParam = true) int renderbuffer); + + void glGenRenderbuffersOES(@AutoSize("renderbuffers") int n, @OutParameter @GLuint IntBuffer renderbuffers); + + @Alternate("glGenRenderbuffersOES") + @GLreturn("renderbuffers") + void glGenRenderbuffersOES2(@Constant("1") int n, @OutParameter @GLuint IntBuffer renderbuffers); + + void glRenderbufferStorageOES(@GLenum int target, @GLenum int internalformat, @GLsizei int width, @GLsizei int height); + + @StripPostfix("params") + void glGetRenderbufferParameterivOES(@GLenum int target, @GLenum int pname, @OutParameter @Check("1") IntBuffer params); + + /** @deprecated Will be removed in 3.0. Use {@link #glGetRenderbufferParameteriOES} instead. */ + @Alternate("glGetRenderbufferParameterivOES") + @GLreturn("params") + @StripPostfix("params") + @Reuse(value = "OESFramebufferObject", method = "glGetRenderbufferParameteriOES") + @Deprecated + void glGetRenderbufferParameterivOES2(@GLenum int target, @GLenum int pname, @OutParameter IntBuffer params); + + @Alternate("glGetRenderbufferParameterivOES") + @GLreturn("params") + @StripPostfix(value = "params", hasPostfix = false) + void glGetRenderbufferParameterivOES3(@GLenum int target, @GLenum int pname, @OutParameter IntBuffer params); + + boolean glIsFramebufferOES(@GLuint int framebuffer); + + void glBindFramebufferOES(@GLenum int target, @GLuint int framebuffer); + + void glDeleteFramebuffersOES(@AutoSize("framebuffers") int n, @Const @GLuint IntBuffer framebuffers); + + @Alternate("glDeleteFramebuffersOES") + void glDeleteFramebuffersOES(@Constant("1") int n, @Constant(value = "APIUtil.getInt(framebuffer)", keepParam = true) int framebuffer); + + void glGenFramebuffersOES(@AutoSize("framebuffers") int n, @OutParameter @GLuint IntBuffer framebuffers); + + @Alternate("glGenFramebuffersOES") + @GLreturn("framebuffers") + void glGenFramebuffersOES2(@Constant("1") int n, @OutParameter @GLuint IntBuffer framebuffers); + + @GLenum + int glCheckFramebufferStatusOES(@GLenum int target); + + void glFramebufferTexture2DOES(@GLenum int target, @GLenum int attachment, @GLenum int textarget, @GLuint int texture, int level); + + void glFramebufferRenderbufferOES(@GLenum int target, @GLenum int attachment, @GLenum int renderbuffertarget, @GLuint int renderbuffer); + + @StripPostfix("params") + void glGetFramebufferAttachmentParameterivOES(@GLenum int target, @GLenum int attachment, @GLenum int pname, @OutParameter @Check("1") IntBuffer params); + + /** @deprecated Will be removed in 3.0. Use {@link #glGetFramebufferAttachmentParameteriOES} instead. */ + @Alternate("glGetFramebufferAttachmentParameterivOES") + @GLreturn("params") + @StripPostfix("params") + @Reuse(value = "OESFramebufferObject", method = "glGetFramebufferAttachmentParameteriOES") + @Deprecated + void glGetFramebufferAttachmentParameterivOES2(@GLenum int target, @GLenum int attachment, @GLenum int pname, @OutParameter IntBuffer params); + + @Alternate("glGetFramebufferAttachmentParameterivOES") + @GLreturn("params") + @StripPostfix(value = "params", hasPostfix = false) + void glGetFramebufferAttachmentParameterivOES3(@GLenum int target, @GLenum int attachment, @GLenum int pname, @OutParameter IntBuffer params); + + void glGenerateMipmapOES(@GLenum int target); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/OES_get_program_binary.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/OES_get_program_binary.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/OES_get_program_binary.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/OES_get_program_binary.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +import org.lwjgl.util.generator.AutoSize; +import org.lwjgl.util.generator.Check; +import org.lwjgl.util.generator.Const; +import org.lwjgl.util.generator.OutParameter; +import org.lwjgl.util.generator.opengl.GLenum; +import org.lwjgl.util.generator.opengl.GLsizei; +import org.lwjgl.util.generator.opengl.GLuint; +import org.lwjgl.util.generator.opengl.GLvoid; + +import java.nio.ByteBuffer; +import java.nio.IntBuffer; + +public interface OES_get_program_binary { + + /** Accepted by the <pname> parameter of GetProgramiv: */ + int GL_PROGRAM_BINARY_LENGTH_OES = 0x8741; + + /** + * Accepted by the <pname< parameter of GetBooleanv, GetIntegerv, and + * GetFloatv: + */ + int GL_NUM_PROGRAM_BINARY_FORMATS_OES = 0x87FE, + GL_PROGRAM_BINARY_FORMATS_OES = 0x87FF; + + void glGetProgramBinaryOES(@GLuint int program, @AutoSize("binary") @GLsizei int bufSize, + @OutParameter @Check(value = "1", canBeNull = true) @GLsizei IntBuffer length, + @OutParameter @Check("1") @GLenum IntBuffer binaryFormat, + @OutParameter @GLvoid ByteBuffer binary); + + void glProgramBinaryOES(@GLuint int program, @GLenum int binaryFormat, @Const @GLvoid ByteBuffer binary, @AutoSize("binary") int length); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/OES_mapbuffer.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/OES_mapbuffer.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/OES_mapbuffer.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/OES_mapbuffer.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +import org.lwjgl.util.generator.*; +import org.lwjgl.util.generator.opengl.GLenum; +import org.lwjgl.util.generator.opengl.GLvoid; + +import java.nio.ByteBuffer; + +public interface OES_mapbuffer { + + /** Accepted by the <access> parameter of MapBufferOES: */ + int GL_WRITE_ONLY_OES = 0x88B9; + + /** Accepted by the <value> parameter of GetBufferParameteriv: */ + int GL_BUFFER_ACCESS_OES = 0x88BB, + GL_BUFFER_MAPPED_OES = 0x88BC; + + /** Accepted by the <pname> parameter of GetBufferPointervOES: */ + int GL_BUFFER_MAP_POINTER_OES = 0x88BD; + + @StripPostfix("pointer") + @CachedResult + @AutoSize("GLES20.glGetBufferParameteri(target, GLES20.GL_BUFFER_SIZE)") + void glGetBufferPointervOES(@GLenum int target, @GLenum int pname, @OutParameter @Result @GLvoid ByteBuffer pointer); + + /** + * glMapBufferOES maps a GL buffer object to a ByteBuffer. The old_buffer argument can be null, + * in which case a new ByteBuffer will be created, pointing to the returned memory. If old_buffer is non-null, + * it will be returned if it points to the same mapped memory and has the same capacity as the buffer object, + * otherwise a new ByteBuffer is created. That way, an application will normally use glMapBuffer like this: + *

        + * ByteBuffer mapped_buffer; mapped_buffer = glMapBufferOES(..., ..., null); ... // Another map on the same buffer mapped_buffer = glMapBufferOES(..., ..., mapped_buffer); + *

        + * Only ByteBuffers returned from this method are to be passed as the old_buffer argument. User-created ByteBuffers cannot be reused. + *

        + * The version of this method without an explicit length argument calls glGetBufferParameter internally to + * retrieve the current buffer object size, which may cause a pipeline flush and reduce application performance. + *

        + * The version of this method with an explicit length argument is a fast alternative to the one without. No GL call + * is made to retrieve the buffer object size, so the user is responsible for tracking and using the appropriate length.
        + * Security warning: The length argument should match the buffer object size. Reading from or writing to outside + * the memory region that corresponds to the mapped buffer object will cause native crashes. + * + * @param old_buffer A ByteBuffer. If this argument points to the same address and has the same capacity as the new mapping, it will be returned and no new buffer will be created. + * + * @return A ByteBuffer representing the mapped buffer memory. + */ + @CachedResult + @GLvoid + @AutoSize("GLES20.glGetBufferParameteri(target, GLES20.GL_BUFFER_SIZE)") + ByteBuffer glMapBufferOES(@GLenum int target, @GLenum int access); + + boolean glUnmapBufferOES(@GLenum int target); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/OES_packed_depth_stencil.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/OES_packed_depth_stencil.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/OES_packed_depth_stencil.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/OES_packed_depth_stencil.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +public interface OES_packed_depth_stencil { + + /** + * Accepted by the <format> parameter of TexImage2D and TexSubImage2D and by the + * <internalformat> parameter of TexImage2D: + */ + int GL_DEPTH_STENCIL_OES = 0x84F9; + + /** Accepted by the <type> parameter of TexImage2D and TexSubImage2D: */ + int GL_UNSIGNED_INT_24_8_OES = 0x84FA; + + /** + * Accepted by the <internalformat> parameter of RenderbufferStorage, and + * returned in the <params> parameter of GetRenderbufferParameteriv when + * <pname> is RENDERBUFFER_INTERNAL_FORMAT: + */ + int GL_DEPTH24_STENCIL8_OES = 0x88F0; + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/OES_required_internalformat.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/OES_required_internalformat.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/OES_required_internalformat.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/OES_required_internalformat.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2002-2012 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +public interface OES_required_internalformat { +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/OES_rgb8_rgba8.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/OES_rgb8_rgba8.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/OES_rgb8_rgba8.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/OES_rgb8_rgba8.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +import org.lwjgl.util.generator.Extension; + +@Extension(postfix = "OES", className = "OESRGB8RGBA8") +public interface OES_rgb8_rgba8 { + + /** Accepted by the <internalformat> parameter of RenderbufferStorageOES: */ + int GL_RGB8_OES = 0x8051, + GL_RGBA8_OES = 0x8058; + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/OES_standard_derivatives.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/OES_standard_derivatives.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/OES_standard_derivatives.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/OES_standard_derivatives.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +public interface OES_standard_derivatives { + + /** + * Accepted by the <target> parameter of Hint and by the <pname> parameter of + * GetBooleanv, GetIntegerv, GetFloatv, and GetDoublev: + */ + int GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES = 0x8B8B; + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/OES_stencil1.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/OES_stencil1.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/OES_stencil1.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/OES_stencil1.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +public interface OES_stencil1 { + + /** Accepted by the <internalformat> parameter of RenderbufferStorageOES: */ + int GL_STENCIL_INDEX1_OES = 0x8D46; + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/OES_stencil4.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/OES_stencil4.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/OES_stencil4.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/OES_stencil4.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +public interface OES_stencil4 { + + /** Accepted by the <internalformat> parameter of RenderbufferStorageOES: */ + int GL_STENCIL_INDEX4_OES = 0x8D47; + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/OES_stencil8.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/OES_stencil8.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/OES_stencil8.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/OES_stencil8.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +public interface OES_stencil8 { + + /** Accepted by the <internalformat> parameter of RenderbufferStorageOES: */ + int GL_STENCIL_INDEX8_OES = 0x8D48; + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/OES_surfaceless_context.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/OES_surfaceless_context.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/OES_surfaceless_context.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/OES_surfaceless_context.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2002-2012 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +public interface OES_surfaceless_context { + + /** Returned by glCheckFramebufferStatusOES and glCheckFramebufferStatus: */ + int GL_FRAMEBUFFER_UNDEFINED_OES = 0x8219; + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/OES_texture_3D.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/OES_texture_3D.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/OES_texture_3D.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/OES_texture_3D.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +import org.lwjgl.util.generator.Check; +import org.lwjgl.util.generator.Const; +import org.lwjgl.util.generator.opengl.*; + +import java.nio.Buffer; +import java.nio.ByteBuffer; + +public interface OES_texture_3D { + + /** + * Accepted by the <target> parameter of TexImage3DOES, TexSubImage3DOES, + * CopyTexSubImage3DOES, CompressedTexImage3DOES and + * CompressedTexSubImage3DOES, GetTexParameteriv, and GetTexParameterfv: + */ + int GL_TEXTURE_3D_OES = 0x806F; + + /** + * Accepted by the <pname> parameter of TexParameteriv, TexParameterfv, + * GetTexParameteriv, and GetTexParameterfv: + */ + int GL_TEXTURE_WRAP_R_OES = 0x8072; + + /** + * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, and + * GetFloatv: + */ + int GL_MAX_3D_TEXTURE_SIZE_OES = 0x8073, + GL_TEXTURE_BINDING_3D_OES = 0x806A; + + void glTexImage3DOES(@GLenum int target, int level, + @GLenum int internalFormat, @GLsizei int width, @GLsizei int height, @GLsizei int depth, int border, + @GLenum int format, @GLenum int type, + @Check(value = "GLChecks.calculateTexImage3DStorage(pixels, format, type, width, height, depth)", canBeNull = true) + @Const @GLbyte @GLshort @GLint @GLfloat Buffer pixels); + + void glTexSubImage3DOES(@GLenum int target, int level, + int xoffset, int yoffset, int zoffset, + @GLsizei int width, @GLsizei int height, @GLsizei int depth, + @GLenum int format, @GLenum int type, + @Check("GLChecks.calculateImageStorage(pixels, format, type, width, height, depth)") + @Const @GLbyte @GLshort @GLint @GLfloat Buffer pixels); + + void glCopyTexSubImage3DOES(@GLenum int target, int level, int xoffset, int yoffset, int zoffset, int x, int y, @GLsizei int width, @GLsizei int height); + + void glCompressedTexImage3DOES(@GLenum int target, int level, @GLenum int internalformat, + @GLsizei int width, @GLsizei int height, @GLsizei int depth, + int border, @GLsizei int imageSize, + @Check @Const @GLvoid ByteBuffer data); + + void glCompressedTexSubImage3DOES(@GLenum int target, int level, + int xoffset, int yoffset, int zoffset, + @GLsizei int width, @GLsizei int height, @GLsizei int depth, + @GLenum int format, @GLsizei int imageSize, + @Check @Const @GLvoid ByteBuffer data); + + void glFramebufferTexture3DOES(@GLenum int target, @GLenum int attachment, @GLenum int textarget, @GLuint int texture, int level, int zoffset); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/OES_texture_float.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/OES_texture_float.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/OES_texture_float.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/OES_texture_float.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +public interface OES_texture_float { +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/OES_texture_float_linear.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/OES_texture_float_linear.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/OES_texture_float_linear.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/OES_texture_float_linear.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +public interface OES_texture_float_linear { + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/OES_texture_half_float.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/OES_texture_half_float.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/OES_texture_half_float.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/OES_texture_half_float.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +public interface OES_texture_half_float { + + /** + * Accepted by the <type> parameter of TexImage2D, TexSubImage2D, + * TexImage3D, and TexSubImage3D: + */ + int GL_HALF_FLOAT_OES = 0x8D61; + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/OES_texture_half_float_linear.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/OES_texture_half_float_linear.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/OES_texture_half_float_linear.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/OES_texture_half_float_linear.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +public interface OES_texture_half_float_linear { + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/OES_texture_npot.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/OES_texture_npot.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/OES_texture_npot.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/OES_texture_npot.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +public interface OES_texture_npot { + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/OES_vertex_array_object.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/OES_vertex_array_object.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/OES_vertex_array_object.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/OES_vertex_array_object.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +import org.lwjgl.util.generator.*; +import org.lwjgl.util.generator.opengl.GLreturn; +import org.lwjgl.util.generator.opengl.GLsizei; +import org.lwjgl.util.generator.opengl.GLuint; + +import java.nio.IntBuffer; + +public interface OES_vertex_array_object { + + /** Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv: */ + int GL_VERTEX_ARRAY_BINDING_OES = 0x85B5; + + void glBindVertexArrayOES(@GLuint int array); + + void glDeleteVertexArraysOES(@AutoSize("arrays") @GLsizei int n, @Const @GLuint IntBuffer arrays); + + @Alternate("glDeleteVertexArraysOES") + void glDeleteVertexArraysOES(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getInt(array)", keepParam = true) int array); + + void glGenVertexArraysOES(@AutoSize("arrays") @GLsizei int n, @OutParameter @GLuint IntBuffer arrays); + + @Alternate("glGenVertexArraysOES") + @GLreturn("arrays") + void glGenVertexArraysOES2(@Constant("1") @GLsizei int n, @OutParameter @GLuint IntBuffer arrays); + + boolean glIsVertexArrayOES(@GLuint int array); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/OES_vertex_half_float.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/OES_vertex_half_float.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/OES_vertex_half_float.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/OES_vertex_half_float.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +public interface OES_vertex_half_float { + + /** Accepted by the <type> parameter of VertexAttribPointer: */ + int GL_HALF_FLOAT_OES = 0x8D61; + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/OES_vertex_type_10_10_10_2.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/OES_vertex_type_10_10_10_2.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/OES_vertex_type_10_10_10_2.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/OES_vertex_type_10_10_10_2.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +public interface OES_vertex_type_10_10_10_2 { + + /** Accepted by the <type> parameter of VertexAttribPointer */ + int GL_UNSIGNED_INT_10_10_10_2_OES = 0x8DF6, + GL_INT_10_10_10_2_OES = 0x8DF7; + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/QCOM_binning_control.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/QCOM_binning_control.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/QCOM_binning_control.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/QCOM_binning_control.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +public interface QCOM_binning_control { + + /** Accepted by the <target> parameter of Hint: */ + int GL_BINNING_CONTROL_HINT_QCOM = 0x8FB0; + + /** Accepted by the <hint> parameter of Hint: */ + int GL_CPU_OPTIMIZED_QCOM = 0x8FB1, + GL_GPU_OPTIMIZED_QCOM = 0x8FB2, + GL_RENDER_DIRECT_TO_FRAMEBUFFER_QCOM = 0x8FB3, + GL_DONT_CARE = 0x1100; + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/QCOM_driver_control.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/QCOM_driver_control.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/QCOM_driver_control.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/QCOM_driver_control.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +import org.lwjgl.util.generator.*; +import org.lwjgl.util.generator.opengl.GLchar; +import org.lwjgl.util.generator.opengl.GLreturn; +import org.lwjgl.util.generator.opengl.GLsizei; +import org.lwjgl.util.generator.opengl.GLuint; + +import java.nio.ByteBuffer; +import java.nio.IntBuffer; + +public interface QCOM_driver_control { + + void glGetDriverControlsQCOM(@OutParameter @Check(value = "1", canBeNull = true) IntBuffer num, + @AutoSize(value = "driverControls", canBeNull = true) @GLsizei int size, + @OutParameter @Check(canBeNull = true) @GLuint IntBuffer driverControls); + + void glGetDriverControlStringQCOM(@GLuint int driverControl, + @AutoSize(value = "driverControlString", canBeNull = true) @GLsizei int bufSize, + @OutParameter @Check(value = "1", canBeNull = true) @GLsizei IntBuffer length, + @OutParameter @Check(canBeNull = true) @GLchar ByteBuffer driverControlString); + + @Alternate("glGetDriverControlStringQCOM") + @GLreturn(value = "driverControlString", maxLength = "bufSize") + void glGetDriverControlStringQCOM2(@GLuint int driverControl, + @GLsizei int bufSize, + @OutParameter @GLsizei @Constant("MemoryUtil.getAddress0(driverControlString_length)") IntBuffer length, + @OutParameter @GLchar ByteBuffer driverControlString); + + void glEnableDriverControlQCOM(@GLuint int driverControl); + + void glDisableDriverControlQCOM(@GLuint int driverControl); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/QCOM_extended_get2.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/QCOM_extended_get2.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/QCOM_extended_get2.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/QCOM_extended_get2.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +import org.lwjgl.util.generator.AutoSize; +import org.lwjgl.util.generator.Check; +import org.lwjgl.util.generator.OutParameter; +import org.lwjgl.util.generator.opengl.GLchar; +import org.lwjgl.util.generator.opengl.GLenum; +import org.lwjgl.util.generator.opengl.GLuint; + +import java.nio.ByteBuffer; +import java.nio.IntBuffer; + +public interface QCOM_extended_get2 { + + void glExtGetShadersQCOM(@OutParameter @Check("1") @GLuint IntBuffer shaders, + @AutoSize("shaders") int maxShaders, + @OutParameter @Check("1") IntBuffer numShaders); + + void glExtGetProgramsQCOM(@OutParameter @Check("1") @GLuint IntBuffer programs, + @AutoSize("programs") int maxPrograms, + @OutParameter @Check("1") IntBuffer numPrograms); + + boolean glExtIsProgramBinaryQCOM(@GLuint int program); + + void glExtGetProgramBinarySourceQCOM(@GLuint int program, @GLenum int shadertype, + @OutParameter @Check @GLchar ByteBuffer source, @OutParameter @Check("1") IntBuffer length); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/QCOM_extended_get.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/QCOM_extended_get.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/QCOM_extended_get.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/QCOM_extended_get.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +import org.lwjgl.util.generator.AutoSize; +import org.lwjgl.util.generator.Check; +import org.lwjgl.util.generator.OutParameter; +import org.lwjgl.util.generator.Result; +import org.lwjgl.util.generator.opengl.*; + +import java.nio.Buffer; +import java.nio.ByteBuffer; +import java.nio.IntBuffer; + +public interface QCOM_extended_get { + + /** Accepted by the <pname> parameter of ExtGetTexLevelParameterivQCOM */ + int GL_TEXTURE_WIDTH_QCOM = 0x8BD2, + GL_TEXTURE_HEIGHT_QCOM = 0x8BD3, + GL_TEXTURE_DEPTH_QCOM = 0x8BD4, + GL_TEXTURE_INTERNAL_FORMAT_QCOM = 0x8BD5, + GL_TEXTURE_FORMAT_QCOM = 0x8BD6, + GL_TEXTURE_TYPE_QCOM = 0x8BD7, + GL_TEXTURE_IMAGE_VALID_QCOM = 0x8BD8, + GL_TEXTURE_NUM_LEVELS_QCOM = 0x8BD9, + GL_TEXTURE_TARGET_QCOM = 0x8BDA, + GL_TEXTURE_OBJECT_VALID_QCOM = 0x8BDB; + + /** Accepted by the <pname> parameter of ExtTexObjectStateOverrideiQCOM */ + int GL_STATE_RESTORE = 0x8BDC; + + void glExtGetTexturesQCOM(@OutParameter @Check("1") @GLuint IntBuffer textures, + @AutoSize("textures") int maxTextures, + @OutParameter @Check("1") IntBuffer numTextures); + + void glExtGetBuffersQCOM(@OutParameter @Check("1") @GLuint IntBuffer buffers, + @AutoSize("buffers") int maxBuffers, + @OutParameter @Check("1") IntBuffer numBuffers); + + void glExtGetRenderbuffersQCOM(@OutParameter @Check("1") @GLuint IntBuffer renderbuffers, + @AutoSize("renderbuffers") int maxRenderbuffers, + @OutParameter @Check("1") IntBuffer numRenderbuffers); + + void glExtGetFramebuffersQCOM(@OutParameter @Check("1") @GLuint IntBuffer framebuffers, + @AutoSize("framebuffers") int maxFramebuffers, + @OutParameter @Check("1") IntBuffer numFramebuffers); + + void glExtGetTexLevelParameterivQCOM(@GLuint int texture, @GLenum int face, int level, + @GLenum int pname, @OutParameter @Check("1") IntBuffer params); + + void glExtTexObjectStateOverrideiQCOM(@GLenum int target, @GLenum int pname, int param); + + void glExtGetTexSubImageQCOM(@GLenum int target, int level, + int xoffset, int yoffset, int zoffset, + @GLsizei int width, @GLsizei int height, @GLsizei int depth, + @GLenum int format, @GLenum int type, + @OutParameter + @Check("GLChecks.calculateImageStorage(texels, format, type, width, height, depth)") + @GLbyte + @GLshort + @GLint + @GLfloat Buffer texels); + + void glExtGetBufferPointervQCOM(@GLenum int target, @Result @GLvoid ByteBuffer params); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/QCOM_performance_monitor_global_mode.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/QCOM_performance_monitor_global_mode.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/QCOM_performance_monitor_global_mode.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/QCOM_performance_monitor_global_mode.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +public interface QCOM_performance_monitor_global_mode { + + /** + * Accepted by the <cap> parameter of Enable and Disable, and + * IsEnabled, and by the <pname> parameter of GetBooleanv, GetIntegerv, + * and GetFloatv: + */ + int GL_PERFMON_GLOBAL_MODE_QCOM = 0x8FA0; + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/QCOM_tiled_rendering.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/QCOM_tiled_rendering.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/QCOM_tiled_rendering.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/QCOM_tiled_rendering.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +import org.lwjgl.util.generator.opengl.GLbitfield; +import org.lwjgl.util.generator.opengl.GLuint; + +public interface QCOM_tiled_rendering { + + /** + * Accepted by the <preserveMask> parameter of StartTilingQCOM and + * EndTilingQCOM + */ + int GL_COLOR_BUFFER_BIT0_QCOM = 0x00000001, + GL_COLOR_BUFFER_BIT1_QCOM = 0x00000002, + GL_COLOR_BUFFER_BIT2_QCOM = 0x00000004, + GL_COLOR_BUFFER_BIT3_QCOM = 0x00000008, + GL_COLOR_BUFFER_BIT4_QCOM = 0x00000010, + GL_COLOR_BUFFER_BIT5_QCOM = 0x00000020, + GL_COLOR_BUFFER_BIT6_QCOM = 0x00000040, + GL_COLOR_BUFFER_BIT7_QCOM = 0x00000080, + GL_DEPTH_BUFFER_BIT0_QCOM = 0x00000100, + GL_DEPTH_BUFFER_BIT1_QCOM = 0x00000200, + GL_DEPTH_BUFFER_BIT2_QCOM = 0x00000400, + GL_DEPTH_BUFFER_BIT3_QCOM = 0x00000800, + GL_DEPTH_BUFFER_BIT4_QCOM = 0x00001000, + GL_DEPTH_BUFFER_BIT5_QCOM = 0x00002000, + GL_DEPTH_BUFFER_BIT6_QCOM = 0x00004000, + GL_DEPTH_BUFFER_BIT7_QCOM = 0x00008000, + GL_STENCIL_BUFFER_BIT0_QCOM = 0x00010000, + GL_STENCIL_BUFFER_BIT1_QCOM = 0x00020000, + GL_STENCIL_BUFFER_BIT2_QCOM = 0x00040000, + GL_STENCIL_BUFFER_BIT3_QCOM = 0x00080000, + GL_STENCIL_BUFFER_BIT4_QCOM = 0x00100000, + GL_STENCIL_BUFFER_BIT5_QCOM = 0x00200000, + GL_STENCIL_BUFFER_BIT6_QCOM = 0x00400000, + GL_STENCIL_BUFFER_BIT7_QCOM = 0x00800000, + GL_MULTISAMPLE_BUFFER_BIT0_QCOM = 0x01000000, + GL_MULTISAMPLE_BUFFER_BIT1_QCOM = 0x02000000, + GL_MULTISAMPLE_BUFFER_BIT2_QCOM = 0x04000000, + GL_MULTISAMPLE_BUFFER_BIT3_QCOM = 0x08000000, + GL_MULTISAMPLE_BUFFER_BIT4_QCOM = 0x10000000, + GL_MULTISAMPLE_BUFFER_BIT5_QCOM = 0x20000000, + GL_MULTISAMPLE_BUFFER_BIT6_QCOM = 0x40000000, + GL_MULTISAMPLE_BUFFER_BIT7_QCOM = 0x80000000; + + void glStartTilingQCOM(@GLuint int x, @GLuint int y, @GLuint int width, @GLuint int height, + @GLbitfield int preserveMask); + + void glEndTilingQCOM(@GLbitfield int preserveMask); + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/QCOM_writeonly_rendering.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/QCOM_writeonly_rendering.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/QCOM_writeonly_rendering.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/QCOM_writeonly_rendering.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +public interface QCOM_writeonly_rendering { + + /** Accepted by the <cap> parameter of Enable, Disable. */ + int GL_WRITEONLY_RENDERING_QCOM = 0x8823; + +} \ No newline at end of file diff -Nru lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/VIV_shader_binary.java lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/VIV_shader_binary.java --- lwjgl-2.7.1+dfsg/src/templates/org/lwjgl/opengles/VIV_shader_binary.java 1970-01-01 00:00:00.000000000 +0000 +++ lwjgl-2.9.3+dfsg/src/templates/org/lwjgl/opengles/VIV_shader_binary.java 2016-04-09 16:26:56.000000000 +0000 @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2002-2011 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengles; + +public interface VIV_shader_binary { + + /** Accepted by the <binaryformat> parameter of ShaderBinary: */ + int GL_SHADER_BINARY_VIV = 0x8FC4; + +}