From: <sp...@us...> - 2012-08-07 15:14:17
|
Revision: 3783 http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3783&view=rev Author: spasi Date: 2012-08-07 15:14:03 +0000 (Tue, 07 Aug 2012) Log Message: ----------- Added support for OpenGL 4.3 and OpenGL ES 3.0. Modified the generator process to use relative paths. We were hitting the command line length limit on Windows. Some extension improvements, fixes and spec updates. Modified Paths: -------------- trunk/LWJGL/build.xml trunk/LWJGL/platform_build/build-definitions.xml trunk/LWJGL/platform_build/build-generator.xml trunk/LWJGL/src/java/org/lwjgl/opengl/CallbackUtil.java trunk/LWJGL/src/java/org/lwjgl/opengl/ContextAttribs.java trunk/LWJGL/src/java/org/lwjgl/opengles/APIUtil.java trunk/LWJGL/src/java/org/lwjgl/opengles/ContextAttribs.java trunk/LWJGL/src/java/org/lwjgl/opengles/GLChecks.java trunk/LWJGL/src/java/org/lwjgl/opengles/GLContext.java trunk/LWJGL/src/java/org/lwjgl/opengles/StateTracker.java trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorProcessorFactory.java trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorVisitor.java trunk/LWJGL/src/java/org/lwjgl/util/generator/NativeTypeTranslator.java trunk/LWJGL/src/java/org/lwjgl/util/generator/SignatureTranslator.java trunk/LWJGL/src/java/org/lwjgl/util/generator/opengl/GLESGeneratorProcessorFactory.java trunk/LWJGL/src/java/org/lwjgl/util/generator/opengl/GLESTypeMap.java trunk/LWJGL/src/native/common/opengl/extgl.h trunk/LWJGL/src/native/common/opengl/org_lwjgl_opengl_CallbackUtil.c trunk/LWJGL/src/native/common/opengles/extgl.h trunk/LWJGL/src/native/common/opengles/extgl_types.h trunk/LWJGL/src/native/common/org_lwjgl_opencl_CallbackUtil.c trunk/LWJGL/src/templates/org/lwjgl/opengl/AMD_multi_draw_indirect.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_draw_indirect.java trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_gpu_shader4.java trunk/LWJGL/src/templates/org/lwjgl/opengl/GL30.java trunk/LWJGL/src/templates/org/lwjgl/opengl/GL32.java trunk/LWJGL/src/templates/org/lwjgl/opengl/GL40.java Added Paths: ----------- trunk/LWJGL/src/java/org/lwjgl/opengl/KHRDebugCallback.java trunk/LWJGL/src/java/org/lwjgl/opengles/CallbackUtil.java trunk/LWJGL/src/java/org/lwjgl/opengles/FastIntMap.java trunk/LWJGL/src/java/org/lwjgl/opengles/GLSync.java trunk/LWJGL/src/java/org/lwjgl/opengles/KHRDebugCallback.java trunk/LWJGL/src/native/common/opengles/org_lwjgl_opengles_CallbackUtil.c trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_ES3_compatibility.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_arrays_of_arrays.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_clear_buffer_object.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_compute_shader.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_copy_image.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_debug_group.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_debug_label.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_debug_output2.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_explicit_uniform_location.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_fragment_layer_viewport.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_framebuffer_no_attachments.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_internalformat_query2.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_invalidate_subdata.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_multi_draw_indirect.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_program_interface_query.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_robust_buffer_access_behavior.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_robustness_isolation.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shader_image_size.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shader_storage_buffer_object.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_stencil_texturing.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_texture_buffer_range.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_texture_query_levels.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_texture_storage_multisample.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_texture_view.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_vertex_attrib_binding.java trunk/LWJGL/src/templates/org/lwjgl/opengl/GL43.java trunk/LWJGL/src/templates/org/lwjgl/opengl/KHR_debug.java trunk/LWJGL/src/templates/org/lwjgl/opengl/KHR_texture_compression_astc_ldr.java trunk/LWJGL/src/templates/org/lwjgl/opengles/GLES30.java trunk/LWJGL/src/templates/org/lwjgl/opengles/KHR_debug.java trunk/LWJGL/src/templates/org/lwjgl/opengles/KHR_texture_compression_astc_ldr.java trunk/LWJGL/src/templates/org/lwjgl/opengles/OES_required_internalformat.java trunk/LWJGL/src/templates/org/lwjgl/opengles/OES_surfaceless_context.java Modified: trunk/LWJGL/build.xml =================================================================== --- trunk/LWJGL/build.xml 2012-07-14 23:29:21 UTC (rev 3782) +++ trunk/LWJGL/build.xml 2012-08-07 15:14:03 UTC (rev 3783) @@ -177,7 +177,7 @@ <!-- ================================================================== --> <!-- Generate a list of the OpenGL extension classes --> <!-- ================================================================== --> - <fileset id="opengl-template-fileset" dir="${lwjgl.src}/generated" includes="${opengl-template-pattern}"/> + <fileset id="opengl-template-fileset" dir="${lwjgl.src}/generated/org/lwjgl/opengl" includes="${opengl-template-pattern}"/> <property name="opengl-template-files" refid="opengl-template-fileset"/> <tempfile property="temp.file"/> @@ -187,7 +187,7 @@ <filterchain> <tokenfilter delimoutput=","> <stringtokenizer delims=";"/> - <replaceregex pattern="org\${file.separator}lwjgl\${file.separator}opengl\${file.separator}(.+)[.]java" + <replaceregex pattern="(.+)[.]java" replace="org/lwjgl/opengl/\1.class"/> </tokenfilter> </filterchain> @@ -350,6 +350,7 @@ <class name="org.lwjgl.opengles.EGLKHRReusableSync"/> <class name="org.lwjgl.opengles.EGLNVSync"/> <class name="org.lwjgl.opengles.GLContext"/> + <class name="org.lwjgl.opengles.CallbackUtil"/> </javah> </target> @@ -626,7 +627,7 @@ <bottom><![CDATA[<i>Copyright © 2002-2009 lwjgl.org. All Rights Reserved.</i>]]></bottom> </javadoc> </target> - + <!-- get and copy nightly binaries into libs folder --> <target name="copy-nightly-binaries" depends="-initialize" description="Copies latest successful nightly binaries into appropriate libs folder"> <delete file="${lwjgl.temp}/lwjgl-${lwjgl.version}.zip" failonerror="false"/> @@ -635,7 +636,7 @@ <patternset> <include name="**/native/**/*lwjgl*"/> </patternset> - <globmapper from="lwjgl-${lwjgl.version}/native/*" to="*"/> + <globmapper from="lwjgl-${lwjgl.version}/native/*" to="*"/> </unzip> - </target> + </target> </project> Modified: trunk/LWJGL/platform_build/build-definitions.xml =================================================================== --- trunk/LWJGL/platform_build/build-definitions.xml 2012-07-14 23:29:21 UTC (rev 3782) +++ trunk/LWJGL/platform_build/build-definitions.xml 2012-08-07 15:14:03 UTC (rev 3783) @@ -15,11 +15,17 @@ <property name="lwjgl.version" value="2.8.5" /> <property name="lwjgl.web" location="www" /> - <property name="opengl-template-pattern" value="org/lwjgl/opengl/GL*.java,org/lwjgl/opengl/ARB*.java,org/lwjgl/opengl/AMD*.java,org/lwjgl/opengl/APPLE*.java,org/lwjgl/opengl/ATI*.java,org/lwjgl/opengl/EXT*.java,org/lwjgl/opengl/NV*.java,org/lwjgl/opengl/NVX*.java,org/lwjgl/opengl/HP*.java,org/lwjgl/opengl/IBM*.java,org/lwjgl/opengl/SUN*.java,org/lwjgl/opengl/SGIS*.java,org/lwjgl/opengl/GREMEDY*.java"/> - <property name="opengles-template-pattern" value="org/lwjgl/opengles/GLES*.java,org/lwjgl/opengles/ARB*.java,org/lwjgl/opengles/EXT*.java,org/lwjgl/opengles/AMD*.java,org/lwjgl/opengles/ANGLE*.java,org/lwjgl/opengles/APPLE*.java,org/lwjgl/opengles/ARM*.java,org/lwjgl/opengles/DMP*.java,org/lwjgl/opengles/IMG*.java,org/lwjgl/opengles/NV*.java,org/lwjgl/opengles/OES*.java,org/lwjgl/opengles/QCOM*.java,org/lwjgl/opengles/VIV*.java"/> - <property name="opencl-template-pattern-extensions" value="org/lwjgl/opencl/KHR*.java,org/lwjgl/opencl/EXT*.java,org/lwjgl/opencl/APPLE*.java,org/lwjgl/opencl/AMD*.java,org/lwjgl/opencl/INTEL*.java,org/lwjgl/opencl/NV*.java"/> - <property name="opencl-template-pattern" value="org/lwjgl/opencl/CL*.java,${opencl-template-pattern-extensions}"/> + <property name="lwjgl.src.templates.al" location="${lwjgl.src.templates}/org/lwjgl/openal"/> + <property name="lwjgl.src.templates.gl" location="${lwjgl.src.templates}/org/lwjgl/opengl"/> + <property name="lwjgl.src.templates.gles" location="${lwjgl.src.templates}/org/lwjgl/opengles"/> + <property name="lwjgl.src.templates.cl" location="${lwjgl.src.templates}/org/lwjgl/opencl"/> + <property name="openal-template-pattern" value="AL*.java,EFX*.java"/> + <property name="opengl-template-pattern" value="GL*.java,ARB*.java,EXT*.java,KHR*.java,AMD*.java,APPLE*.java,ATI*.java,NV*.java,NVX*.java,HP*.java,IBM*.java,SUN*.java,SGIS*.java,GREMEDY*.java"/> + <property name="opengles-template-pattern" value="GLES*.java,ARB*.java,EXT*.java,KHR*.java,AMD*.java,ANGLE*.java,APPLE*.java,ARM*.java,DMP*.java,IMG*.java,NV*.java,OES*.java,QCOM*.java,VIV*.java"/> + <property name="opencl-template-pattern-extensions" value="KHR*.java,EXT*.java,APPLE*.java,AMD*.java,INTEL*.java,NV*.java"/> + <property name="opencl-template-pattern" value="CL*.java,${opencl-template-pattern-extensions}"/> + <!-- ================================================================== --> <!-- Filesets used for targets --> <!-- ================================================================== --> Modified: trunk/LWJGL/platform_build/build-generator.xml =================================================================== --- trunk/LWJGL/platform_build/build-generator.xml 2012-07-14 23:29:21 UTC (rev 3782) +++ trunk/LWJGL/platform_build/build-generator.xml 2012-08-07 15:14:03 UTC (rev 3783) @@ -30,8 +30,10 @@ <include name="org/lwjgl/opengl/GLSync.java"/> <include name="org/lwjgl/opengl/AMDDebugOutputCallback.java"/> <include name="org/lwjgl/opengl/ARBDebugOutputCallback.java"/> + <include name="org/lwjgl/opengl/KHRDebugCallback.java"/> <!-- OpenGL ES --> <include name="org/lwjgl/opengles/EGLImageOES.java"/> + <include name="org/lwjgl/opengles/KHRDebugCallback.java"/> <!-- OpenCL --> <include name="org/lwjgl/opencl/CLPlatform.java"/> <include name="org/lwjgl/opencl/CLDevice.java"/> @@ -57,7 +59,7 @@ <!-- Generate OpenAL --> <target name="generate-openal" depends="generators" description="Generates java and native source for AL"> - <apply executable="apt" parallel="true"> + <apply executable="apt" parallel="true" dir="${lwjgl.src.templates.al}" relative="true"> <arg value="-nocompile"/> <arg value="-factory"/> <arg value="org.lwjgl.util.generator.GeneratorProcessorFactory"/> @@ -67,14 +69,15 @@ <arg path="${lwjgl.src}/generated"/> <arg value="-d"/> <arg path="${lwjgl.src.native}/generated/openal"/> + <arg value="-Abinpath=${lwjgl.bin}"/> <arg value="-Atypemap=org.lwjgl.util.generator.openal.ALTypeMap"/> - <fileset dir="${lwjgl.src.templates}" includes="org/lwjgl/openal/AL10.java, org/lwjgl/openal/AL11.java, org/lwjgl/openal/EFX10.java"/> + <fileset dir="${lwjgl.src.templates.al}" includes="${openal-template-pattern}"/> </apply> </target> <!-- Generate OpenAL [DEBUG] --> <target name="generate-openal-debug" depends="generators" description="Generates java and native source for AL"> - <apply executable="apt" parallel="true"> + <apply executable="apt" parallel="true" dir="${lwjgl.src.templates.al}" relative="true"> <arg value="-nocompile"/> <arg value="-factory"/> <arg value="org.lwjgl.util.generator.GeneratorProcessorFactory"/> @@ -84,9 +87,10 @@ <arg path="${lwjgl.src}/generated"/> <arg value="-d"/> <arg path="${lwjgl.src.native}/generated/openal"/> + <arg value="-Abinpath=${lwjgl.bin}"/> <arg value="-Atypemap=org.lwjgl.util.generator.openal.ALTypeMap"/> <arg value="-Ageneratechecks"/> - <fileset dir="${lwjgl.src.templates}" includes="org/lwjgl/openal/AL10.java, org/lwjgl/openal/AL11.java, org/lwjgl/openal/EFX10.java"/> + <fileset dir="${lwjgl.src.templates.al}" includes="${openal-template-pattern}"/> </apply> </target> @@ -98,7 +102,7 @@ <!-- Generate OpenGL --> <target name="generate-opengl" depends="generators" description="Generates java and native source for GL"> - <apply executable="apt" parallel="true"> + <apply executable="apt" parallel="true" dir="${lwjgl.src.templates.gl}" relative="true"> <arg value="-nocompile"/> <arg value="-factory"/> <arg value="org.lwjgl.util.generator.GeneratorProcessorFactory"/> @@ -108,15 +112,16 @@ <arg path="${lwjgl.src}/generated"/> <arg value="-d"/> <arg path="${lwjgl.src.native}/generated/opengl"/> + <arg value="-Abinpath=${lwjgl.bin}"/> <arg value="-Acontextspecific"/> <arg value="-Atypemap=org.lwjgl.util.generator.opengl.GLTypeMap"/> - <fileset dir="${lwjgl.src.templates}" includes="${opengl-template-pattern}"/> + <fileset dir="${lwjgl.src.templates.gl}" includes="${opengl-template-pattern}"/> </apply> </target> <!-- Generate OpenGL [DEBUG] --> <target name="generate-opengl-debug" depends="generators" description="Generates debug java and native source for GL"> - <apply executable="apt" parallel="true"> + <apply executable="apt" parallel="true" dir="${lwjgl.src.templates.gl}" relative="true"> <arg value="-nocompile"/> <arg value="-factory"/> <arg value="org.lwjgl.util.generator.GeneratorProcessorFactory"/> @@ -126,16 +131,17 @@ <arg path="${lwjgl.src}/generated"/> <arg value="-d"/> <arg path="${lwjgl.src.native}/generated/opengl"/> + <arg value="-Abinpath=${lwjgl.bin}"/> <arg value="-Ageneratechecks"/> <arg value="-Acontextspecific"/> <arg value="-Atypemap=org.lwjgl.util.generator.opengl.GLTypeMap"/> - <fileset dir="${lwjgl.src.templates}" includes="${opengl-template-pattern}"/> + <fileset dir="${lwjgl.src.templates.gl}" includes="${opengl-template-pattern}"/> </apply> </target> <!-- Generate OpenGL references --> <target name="generate-opengl-references" depends="generators" description="Generates java and native source for GL"> - <apply executable="apt" parallel="true"> + <apply executable="apt" parallel="true" dir="${lwjgl.src.templates.gl}" relative="true"> <arg value="-nocompile"/> <arg value="-factory"/> <arg value="org.lwjgl.util.generator.opengl.GLReferencesGeneratorProcessorFactory"/> @@ -143,13 +149,13 @@ <arg path="${lwjgl.src}/java:${lwjgl.src.templates}:${lwjgl.bin}:${java.class.path}"/> <arg value="-s"/> <arg path="${lwjgl.src}/generated"/> - <fileset dir="${lwjgl.src.templates}" includes="${opengl-template-pattern}"/> + <fileset dir="${lwjgl.src.templates.gl}" includes="${opengl-template-pattern}"/> </apply> </target> <!-- Generate OpenGL context capabilities --> <target name="generate-opengl-capabilities" depends="generators" description="Generates java and native source for GL"> - <apply executable="apt" parallel="true"> + <apply executable="apt" parallel="true" dir="${lwjgl.src.templates.gl}" relative="true"> <arg value="-nocompile"/> <arg value="-factory"/> <arg value="org.lwjgl.util.generator.opengl.GLGeneratorProcessorFactory"/> @@ -158,13 +164,13 @@ <arg value="-s"/> <arg path="${lwjgl.src}/generated"/> <arg value="-Acontextspecific"/> - <fileset dir="${lwjgl.src.templates}" includes="${opengl-template-pattern}"/> + <fileset dir="${lwjgl.src.templates.gl}" includes="${opengl-template-pattern}"/> </apply> </target> <!-- Generate OpenGL context capabilities [DEBUG] --> <target name="generate-opengl-capabilities-debug" depends="generators" description="Generates debug java and native source for GL"> - <apply executable="apt" parallel="true"> + <apply executable="apt" parallel="true" dir="${lwjgl.src.templates.gl}" relative="true"> <arg value="-nocompile"/> <arg value="-factory"/> <arg value="org.lwjgl.util.generator.opengl.GLGeneratorProcessorFactory"/> @@ -174,7 +180,7 @@ <arg path="${lwjgl.src}/generated"/> <arg value="-Ageneratechecks"/> <arg value="-Acontextspecific"/> - <fileset dir="${lwjgl.src.templates}" includes="${opengl-template-pattern}"/> + <fileset dir="${lwjgl.src.templates.gl}" includes="${opengl-template-pattern}"/> </apply> </target> @@ -186,7 +192,7 @@ <!-- Generate OpenGL ES --> <target name="generate-opengles" depends="generators" description="Generates java and native source for GL ES"> - <apply executable="apt" parallel="true"> + <apply executable="apt" parallel="true" dir="${lwjgl.src.templates.gles}" relative="true"> <arg value="-nocompile"/> <arg value="-factory"/> <arg value="org.lwjgl.util.generator.GeneratorProcessorFactory"/> @@ -196,15 +202,16 @@ <arg path="${lwjgl.src}/generated"/> <arg value="-d"/> <arg path="${lwjgl.src.native}/generated/opengles"/> + <arg value="-Abinpath=${lwjgl.bin}"/> <!--<arg value="-Acontextspecific"/>--> <arg value="-Atypemap=org.lwjgl.util.generator.opengl.GLESTypeMap"/> - <fileset dir="${lwjgl.src.templates}" includes="${opengles-template-pattern}"/> + <fileset dir="${lwjgl.src.templates.gles}" includes="${opengles-template-pattern}"/> </apply> </target> <!-- Generate OpenGL ES [DEBUG] --> <target name="generate-opengles-debug" depends="generators" description="Generates debug java and native source for GL ES"> - <apply executable="apt" parallel="true"> + <apply executable="apt" parallel="true" dir="${lwjgl.src.templates.gles}" relative="true"> <arg value="-nocompile"/> <arg value="-factory"/> <arg value="org.lwjgl.util.generator.GeneratorProcessorFactory"/> @@ -214,16 +221,17 @@ <arg path="${lwjgl.src}/generated"/> <arg value="-d"/> <arg path="${lwjgl.src.native}/generated/opengles"/> + <arg value="-Abinpath=${lwjgl.bin}"/> <arg value="-Ageneratechecks"/> <!--<arg value="-Acontextspecific"/>--> <arg value="-Atypemap=org.lwjgl.util.generator.opengl.GLESTypeMap"/> - <fileset dir="${lwjgl.src.templates}" includes="${opengles-template-pattern}"/> + <fileset dir="${lwjgl.src.templates.gles}" includes="${opengles-template-pattern}"/> </apply> </target> <!-- Generate OpenGL ES context capabilities --> <target name="generate-opengles-capabilities" depends="generators" description="Generates java and native source for GL ES"> - <apply executable="apt" parallel="true"> + <apply executable="apt" parallel="true" dir="${lwjgl.src.templates.gles}" relative="true"> <arg value="-nocompile"/> <arg value="-factory"/> <arg value="org.lwjgl.util.generator.opengl.GLESGeneratorProcessorFactory"/> @@ -232,13 +240,13 @@ <arg value="-s"/> <arg path="${lwjgl.src}/generated"/> <!--<arg value="-Acontextspecific"/>--> - <fileset dir="${lwjgl.src.templates}" includes="${opengles-template-pattern}"/> + <fileset dir="${lwjgl.src.templates.gles}" includes="${opengles-template-pattern}"/> </apply> </target> <!-- Generate OpenGL ES context capabilities [DEBUG] --> <target name="generate-opengles-capabilities-debug" depends="generators" description="Generates debug java and native source for GL ES"> - <apply executable="apt" parallel="true"> + <apply executable="apt" parallel="true" dir="${lwjgl.src.templates.gles}" relative="true"> <arg value="-nocompile"/> <arg value="-factory"/> <arg value="org.lwjgl.util.generator.opengl.GLESGeneratorProcessorFactory"/> @@ -248,7 +256,7 @@ <arg path="${lwjgl.src}/generated"/> <arg value="-Ageneratechecks"/> <!--<arg value="-Acontextspecific"/>--> - <fileset dir="${lwjgl.src.templates}" includes="${opengles-template-pattern}"/> + <fileset dir="${lwjgl.src.templates.gles}" includes="${opengles-template-pattern}"/> </apply> </target> @@ -260,7 +268,7 @@ <!-- Generate OpenCL --> <target name="generate-opencl" depends="generators" description="Generates java and native source for CL"> - <apply executable="apt" parallel="true"> + <apply executable="apt" parallel="true" dir="${lwjgl.src.templates.cl}" relative="true"> <arg value="-nocompile"/> <arg value="-factory"/> <arg value="org.lwjgl.util.generator.GeneratorProcessorFactory"/> @@ -270,15 +278,16 @@ <arg path="${lwjgl.src}/generated"/> <arg value="-d"/> <arg path="${lwjgl.src.native}/generated/opencl"/> + <arg value="-Abinpath=${lwjgl.bin}"/> <arg value="-Acontextspecific"/> <arg value="-Atypemap=org.lwjgl.util.generator.opencl.CLTypeMap"/> - <fileset dir="${lwjgl.src.templates}" includes="${opencl-template-pattern}"/> + <fileset dir="${lwjgl.src.templates.cl}" includes="${opencl-template-pattern}"/> </apply> </target> <!-- Generate OpenCL [DEBUG] --> <target name="generate-opencl-debug" depends="generators" description="Generates debug java and native source for CL"> - <apply executable="apt" parallel="true"> + <apply executable="apt" parallel="true" dir="${lwjgl.src.templates.cl}" relative="true"> <arg value="-nocompile"/> <arg value="-factory"/> <arg value="org.lwjgl.util.generator.GeneratorProcessorFactory"/> @@ -288,16 +297,17 @@ <arg path="${lwjgl.src}/generated"/> <arg value="-d"/> <arg path="${lwjgl.src.native}/generated/opencl"/> + <arg value="-Abinpath=${lwjgl.bin}"/> <arg value="-Ageneratechecks"/> <arg value="-Acontextspecific"/> <arg value="-Atypemap=org.lwjgl.util.generator.opencl.CLTypeMap"/> - <fileset dir="${lwjgl.src.templates}" includes="${opencl-template-pattern}"/> + <fileset dir="${lwjgl.src.templates.cl}" includes="${opencl-template-pattern}"/> </apply> </target> <!-- Generate OpenCL capabilities --> <target name="generate-opencl-capabilities" depends="generators" description="Generates capabilities for CL"> - <apply executable="apt" parallel="true"> + <apply executable="apt" parallel="true" dir="${lwjgl.src.templates.cl}" relative="true"> <arg value="-nocompile"/> <arg value="-factory"/> <arg value="org.lwjgl.util.generator.opencl.CLGeneratorProcessorFactory"/> @@ -306,13 +316,13 @@ <arg value="-s"/> <arg path="${lwjgl.src}/generated"/> <arg value="-Acontextspecific"/> - <fileset dir="${lwjgl.src.templates}" includes="${opencl-template-pattern}"/> + <fileset dir="${lwjgl.src.templates.cl}" includes="${opencl-template-pattern}"/> </apply> </target> <!-- Generate OpenCL capabilities [DEBUG] --> <target name="generate-opencl-capabilities-debug" depends="generators" description="Generates debug capabilities for CL"> - <apply executable="apt" parallel="true"> + <apply executable="apt" parallel="true" dir="${lwjgl.src.templates.cl}" relative="true"> <arg value="-nocompile"/> <arg value="-factory"/> <arg value="org.lwjgl.util.generator.opencl.CLGeneratorProcessorFactory"/> @@ -322,7 +332,7 @@ <arg path="${lwjgl.src}/generated"/> <arg value="-Ageneratechecks"/> <arg value="-Acontextspecific"/> - <fileset dir="${lwjgl.src.templates}" includes="${opencl-template-pattern}"/> + <fileset dir="${lwjgl.src.templates.cl}" includes="${opencl-template-pattern}"/> </apply> </target> </project> Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/CallbackUtil.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/CallbackUtil.java 2012-07-14 23:29:21 UTC (rev 3782) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/CallbackUtil.java 2012-08-07 15:14:03 UTC (rev 3783) @@ -45,6 +45,8 @@ private static final Map<ContextCapabilities, Long> contextUserParamsARB = new HashMap<ContextCapabilities, Long>(); /** Context -> Long */ private static final Map<ContextCapabilities, Long> contextUserParamsAMD = new HashMap<ContextCapabilities, Long>(); + /** Context -> Long */ + private static final Map<ContextCapabilities, Long> contextUserParamsKHR = new HashMap<ContextCapabilities, Long>(); private CallbackUtil() {} @@ -115,6 +117,10 @@ userParam = contextUserParamsAMD.remove(caps); if ( userParam != null ) deleteGlobalRef(userParam); + + userParam = contextUserParamsKHR.remove(caps); + if ( userParam != null ) + deleteGlobalRef(userParam); } // --------- [ ARB_debug_output ] --------- @@ -157,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 Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/ContextAttribs.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/ContextAttribs.java 2012-07-14 23:29:21 UTC (rev 3782) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/ContextAttribs.java 2012-08-07 15:14:03 UTC (rev 3783) @@ -63,12 +63,14 @@ // Same values for GLX & WGL private static final int CONTEXT_ES2_PROFILE_BIT_EXT = 0x00000004; - private static final int CONTEXT_ROBUST_ACCESS_BIT_ARB = 0x00000004; + 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; + NO_RESET_NOTIFICATION_ARB = 0x8261, + LOSE_CONTEXT_ON_RESET_ARB = 0x8252; + private static final int CONTEXT_RESET_ISOLATION_BIT_ARB = 0x00000008; + private int majorVersion; private int minorVersion; @@ -83,6 +85,7 @@ private boolean profileES; private boolean loseContextOnReset; + private boolean contextResetIsolation; public ContextAttribs() { this(1, 0); @@ -91,7 +94,7 @@ public ContextAttribs(final int majorVersion, final int minorVersion) { if ( majorVersion < 0 || 4 < majorVersion || minorVersion < 0 || - (majorVersion == 4 && 2 < minorVersion) || + (majorVersion == 4 && 3 < minorVersion) || (majorVersion == 3 && 3 < minorVersion) || (majorVersion == 2 && 1 < minorVersion) || (majorVersion == 1 && 5 < minorVersion) ) @@ -241,6 +244,15 @@ return attribs; } + public ContextAttribs withContextResetIsolation(final boolean contextResetIsolation) { + if ( contextResetIsolation == this.contextResetIsolation ) + return this; + + final ContextAttribs attribs = new ContextAttribs(this); + attribs.contextResetIsolation = contextResetIsolation; + return attribs; + } + private static ContextAttribsImplementation getImplementation() { switch ( LWJGLUtil.getPlatform() ) { case LWJGLUtil.PLATFORM_LINUX: @@ -272,6 +284,8 @@ flags |= implementation.getForwardCompatibleBit(); if ( robustAccess ) flags |= CONTEXT_ROBUST_ACCESS_BIT_ARB; + if ( contextResetIsolation ) + flags |= CONTEXT_RESET_ISOLATION_BIT_ARB; if ( 0 < flags ) attribCount++; @@ -285,6 +299,9 @@ if ( 0 < profileMask ) attribCount++; + if ( loseContextOnReset ) + attribCount++; + if ( attribCount == 0 ) return null; Added: trunk/LWJGL/src/java/org/lwjgl/opengl/KHRDebugCallback.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/KHRDebugCallback.java (rev 0) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/KHRDebugCallback.java 2012-08-07 15:14:03 UTC (rev 3783) @@ -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.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 = "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 Modified: trunk/LWJGL/src/java/org/lwjgl/opengles/APIUtil.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengles/APIUtil.java 2012-07-14 23:29:21 UTC (rev 3782) +++ trunk/LWJGL/src/java/org/lwjgl/opengles/APIUtil.java 2012-08-07 15:14:03 UTC (rev 3783) @@ -39,6 +39,7 @@ import java.nio.ByteBuffer; import java.nio.FloatBuffer; import java.nio.IntBuffer; +import java.nio.LongBuffer; /** * Utility class for OpenGL ES API calls. @@ -143,6 +144,8 @@ static IntBuffer getBufferInt() { return buffersTL.get().ints; } + static LongBuffer getBufferLong() { return buffersTL.get().longs; } + static FloatBuffer getBufferFloat() { return buffersTL.get().floats; } static IntBuffer getLengths() { @@ -312,10 +315,12 @@ 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); } Added: trunk/LWJGL/src/java/org/lwjgl/opengles/CallbackUtil.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengles/CallbackUtil.java (rev 0) +++ trunk/LWJGL/src/java/org/lwjgl/opengles/CallbackUtil.java 2012-08-07 15:14:03 UTC (rev 3783) @@ -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<ContextCapabilities, Long> contextUserParamsKHR = new HashMap<ContextCapabilities, Long>(); + + 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<ContextCapabilities, Long> 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 Modified: trunk/LWJGL/src/java/org/lwjgl/opengles/ContextAttribs.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengles/ContextAttribs.java 2012-07-14 23:29:21 UTC (rev 3782) +++ trunk/LWJGL/src/java/org/lwjgl/opengles/ContextAttribs.java 2012-08-07 15:14:03 UTC (rev 3783) @@ -39,7 +39,7 @@ /** * 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 (LWJGL does not support GLES 1.x). + * 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 { @@ -50,7 +50,7 @@ } public ContextAttribs(final int version) { - if ( version != 2 ) + if ( 3 < version ) throw new IllegalArgumentException("Invalid OpenGL ES version specified: " + version); this.version = version; Added: trunk/LWJGL/src/java/org/lwjgl/opengles/FastIntMap.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengles/FastIntMap.java (rev 0) +++ trunk/LWJGL/src/java/org/lwjgl/opengles/FastIntMap.java 2012-08-07 15:14:03 UTC (rev 3783) @@ -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 (al...@ap...) + * @author Stephen Colebourne + * @author Nathan Sweet + */ +final class FastIntMap<V> implements Iterable<FastIntMap.Entry<V>> { + + 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<V>[] table = this.table; + int index = index(key); + + // Check if key already exists. + for ( Entry<V> 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<V>(key, value, table[index]); + + if ( size++ >= threshold ) + rehash(table); + + return null; + } + + private void rehash(final Entry<V>[] table) { + final int newCapacity = 2 * capacity; + final int newMask = newCapacity - 1; + + final Entry<V>[] newTable = new Entry[newCapacity]; + + for ( int i = 0, index; i < table.length; i++ ) { + Entry<V> e = table[i]; + if ( e == null ) continue; + do { + final Entry<V> 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<V> e = table[index]; e != null; e = e.next ) + if ( e.key == key ) return e.value; + return null; + } + + public boolean containsValue(Object value) { + final Entry<V>[] table = this.table; + for ( int i = table.length - 1; i >= 0; i-- ) + for ( Entry<V> 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<V> 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<V> prev = table[index]; + Entry<V> e = prev; + while ( e != null ) { + Entry<V> 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<V>[] 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<Entry<V>> { + + private int nextIndex; + private Entry<V> current; + + EntryIterator() { + reset(); + } + + public void reset() { + current = null; + // Find first bucket. + final Entry<V>[] 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<V> next() { + // Next entry in current bucket. + Entry<V> 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<V>[] 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<T> { + + final int key; + T value; + Entry<T> next; + + Entry(int key, T value, Entry<T> 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 Modified: trunk/LWJGL/src/java/org/lwjgl/opengles/GLChecks.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengles/GLChecks.java 2012-07-14 23:29:21 UTC (rev 3782) +++ trunk/LWJGL/src/java/org/lwjgl/opengles/GLChecks.java 2012-08-07 15:14:03 UTC (rev 3783) @@ -86,6 +86,30 @@ 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 * Modified: trunk/LWJGL/src/java/org/lwjgl/opengles/GLContext.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengles/GLContext.java 2012-07-14 23:29:21 UTC (rev 3782) +++ trunk/LWJGL/src/java/org/lwjgl/opengles/GLContext.java 2012-08-07 15:14:03 UTC (rev 3783) @@ -180,6 +180,8 @@ } // ----------------------[ 2.X ]---------------------- + if ( 3 <= majorVersion ) + supported_extensions.add("OpenGLES30"); if ( 2 <= majorVersion ) supported_extensions.add("OpenGLES20"); Added: trunk/LWJGL/src/java/org/lwjgl/opengles/GLSync.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengles/GLSync.java (rev 0) +++ trunk/LWJGL/src/java/org/lwjgl/opengles/GLSync.java 2012-08-07 15:14:03 UTC (rev 3783) @@ -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 <sp...@us...> + */ +public final class GLSync extends PointerWrapperAbstract { + + GLSync(final long sync) { + super(sync); + } + +} \ No newline at end of file Added: trunk/LWJGL/src/java/org/lwjgl/opengles/KHRDebugCallback.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengles/KHRDebugCallback.java (rev 0) +++ trunk/LWJGL/src/java/org/lwjgl/opengles/KHRDebugCallback.java 2012-08-07 15:14:03 UTC (rev 3783) @@ -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;... [truncated message content] |