|
From: <sp...@us...> - 2012-08-16 18:58:51
|
Revision: 3785
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3785&view=rev
Author: spasi
Date: 2012-08-16 18:58:41 +0000 (Thu, 16 Aug 2012)
Log Message:
-----------
Changed ALC10's alcGetString and alcOpenDevice to use UTF8 decoding/encoding.
New GL extensions: NV_compute_program5, NV_shader_storage_buffer_object, NV_shader_atomic_counters, NV_deep_texture3D
New GLES extension: QCOM_binning_control
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/MemoryUtil.java
trunk/LWJGL/src/java/org/lwjgl/openal/ALC10.java
trunk/LWJGL/src/native/common/org_lwjgl_openal_ALC10.c
Added Paths:
-----------
trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_compute_program5.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_deep_texture3D.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_shader_atomic_counters.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_shader_storage_buffer_object.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/QCOM_binning_control.java
Modified: trunk/LWJGL/src/java/org/lwjgl/MemoryUtil.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/MemoryUtil.java 2012-08-14 12:53:54 UTC (rev 3784)
+++ trunk/LWJGL/src/java/org/lwjgl/MemoryUtil.java 2012-08-16 18:58:41 UTC (rev 3785)
@@ -33,10 +33,7 @@
import java.lang.reflect.Field;
import java.nio.*;
-import java.nio.charset.CharacterCodingException;
-import java.nio.charset.Charset;
-import java.nio.charset.CharsetEncoder;
-import java.nio.charset.CoderResult;
+import java.nio.charset.*;
/**
* [INTERNAL USE ONLY]
@@ -289,6 +286,60 @@
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 {
Modified: trunk/LWJGL/src/java/org/lwjgl/openal/ALC10.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/openal/ALC10.java 2012-08-14 12:53:54 UTC (rev 3784)
+++ trunk/LWJGL/src/java/org/lwjgl/openal/ALC10.java 2012-08-16 18:58:41 UTC (rev 3785)
@@ -152,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.
@@ -199,7 +198,7 @@
* @return opened device, or null
*/
public static ALCdevice alcOpenDevice(String devicename) {
- ByteBuffer buffer = MemoryUtil.encodeASCII(devicename);
+ ByteBuffer buffer = MemoryUtil.encodeUTF8(devicename);
long device_address = nalcOpenDevice(MemoryUtil.getAddressSafe(buffer));
if(device_address != 0) {
ALCdevice device = new ALCdevice(device_address);
Modified: trunk/LWJGL/src/native/common/org_lwjgl_openal_ALC10.c
===================================================================
--- trunk/LWJGL/src/native/common/org_lwjgl_openal_ALC10.c 2012-08-14 12:53:54 UTC (rev 3784)
+++ trunk/LWJGL/src/native/common/org_lwjgl_openal_ALC10.c 2012-08-16 18:58:41 UTC (rev 3785)
@@ -81,8 +81,8 @@
* 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);
+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);
int length;
int i=1;
@@ -111,7 +111,8 @@
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);
}
/**
@@ -263,7 +264,7 @@
#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, false},
+ {"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},
Added: trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_compute_program5.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_compute_program5.java (rev 0)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_compute_program5.java 2012-08-16 18:58:41 UTC (rev 3785)
@@ -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
Added: trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_deep_texture3D.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_deep_texture3D.java (rev 0)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_deep_texture3D.java 2012-08-16 18:58:41 UTC (rev 3785)
@@ -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
Added: trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_shader_atomic_counters.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_shader_atomic_counters.java (rev 0)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_shader_atomic_counters.java 2012-08-16 18:58:41 UTC (rev 3785)
@@ -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
Added: trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_shader_storage_buffer_object.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_shader_storage_buffer_object.java (rev 0)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_shader_storage_buffer_object.java 2012-08-16 18:58:41 UTC (rev 3785)
@@ -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
Added: trunk/LWJGL/src/templates/org/lwjgl/opengles/QCOM_binning_control.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengles/QCOM_binning_control.java (rev 0)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengles/QCOM_binning_control.java 2012-08-16 18:58:41 UTC (rev 3785)
@@ -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
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|