You can subscribe to this list here.
| 2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(134) |
Sep
(52) |
Oct
(13) |
Nov
(342) |
Dec
(163) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2003 |
Jan
(44) |
Feb
(62) |
Mar
(158) |
Apr
(38) |
May
(70) |
Jun
(58) |
Jul
(104) |
Aug
(207) |
Sep
(83) |
Oct
(122) |
Nov
(23) |
Dec
(49) |
| 2004 |
Jan
(119) |
Feb
(132) |
Mar
(192) |
Apr
(140) |
May
(77) |
Jun
(74) |
Jul
(201) |
Aug
(63) |
Sep
(102) |
Oct
(70) |
Nov
(173) |
Dec
(78) |
| 2005 |
Jan
(174) |
Feb
(197) |
Mar
(105) |
Apr
(59) |
May
(77) |
Jun
(43) |
Jul
(21) |
Aug
(18) |
Sep
(47) |
Oct
(37) |
Nov
(74) |
Dec
(50) |
| 2006 |
Jan
(44) |
Feb
(19) |
Mar
(32) |
Apr
(24) |
May
(31) |
Jun
(55) |
Jul
(138) |
Aug
(28) |
Sep
(12) |
Oct
(41) |
Nov
(58) |
Dec
(24) |
| 2007 |
Jan
(28) |
Feb
(14) |
Mar
(10) |
Apr
(68) |
May
(30) |
Jun
(26) |
Jul
(18) |
Aug
(63) |
Sep
(19) |
Oct
(29) |
Nov
(20) |
Dec
(10) |
| 2008 |
Jan
(38) |
Feb
(7) |
Mar
(37) |
Apr
(120) |
May
(41) |
Jun
(36) |
Jul
(39) |
Aug
(24) |
Sep
(28) |
Oct
(30) |
Nov
(36) |
Dec
(75) |
| 2009 |
Jan
(46) |
Feb
(22) |
Mar
(50) |
Apr
(70) |
May
(134) |
Jun
(105) |
Jul
(75) |
Aug
(34) |
Sep
(38) |
Oct
(34) |
Nov
(19) |
Dec
(20) |
| 2010 |
Jan
(11) |
Feb
(20) |
Mar
(65) |
Apr
(83) |
May
(104) |
Jun
(73) |
Jul
(78) |
Aug
(57) |
Sep
(43) |
Oct
(35) |
Nov
(9) |
Dec
(4) |
| 2011 |
Jan
(21) |
Feb
(11) |
Mar
(18) |
Apr
(10) |
May
(18) |
Jun
(15) |
Jul
(48) |
Aug
(25) |
Sep
(17) |
Oct
(45) |
Nov
(15) |
Dec
(12) |
| 2012 |
Jan
(21) |
Feb
(9) |
Mar
(12) |
Apr
(9) |
May
(9) |
Jun
(5) |
Jul
(1) |
Aug
(10) |
Sep
(12) |
Oct
(1) |
Nov
(28) |
Dec
(5) |
| 2013 |
Jan
(4) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2014 |
Jan
|
Feb
(1) |
Mar
(1) |
Apr
|
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
| 2015 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
|
Dec
|
| 2016 |
Jan
(2) |
Feb
(1) |
Mar
(1) |
Apr
(1) |
May
(2) |
Jun
|
Jul
(1) |
Aug
(2) |
Sep
|
Oct
|
Nov
(1) |
Dec
|
| 2017 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
|
|
|
|
|
1
|
2
(1) |
|
3
|
4
|
5
|
6
|
7
|
8
(1) |
9
(2) |
|
10
(8) |
11
(3) |
12
(13) |
13
(4) |
14
(2) |
15
|
16
(6) |
|
17
(1) |
18
|
19
|
20
|
21
(1) |
22
(2) |
23
(2) |
|
24
(1) |
25
|
26
|
27
|
28
|
29
(1) |
30
|
|
31
|
|
|
|
|
|
|
|
From: <sp...@us...> - 2011-07-16 22:40:12
|
Revision: 3594
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3594&view=rev
Author: spasi
Date: 2011-07-16 22:40:06 +0000 (Sat, 16 Jul 2011)
Log Message:
-----------
Removed GLES dependency on GL APIUtil.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/opengl/DrawableGLES.java
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/DrawableGLES.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/DrawableGLES.java 2011-07-16 22:26:46 UTC (rev 3593)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/DrawableGLES.java 2011-07-16 22:40:06 UTC (rev 3594)
@@ -31,6 +31,7 @@
*/
package org.lwjgl.opengl;
+import org.lwjgl.BufferUtils;
import org.lwjgl.LWJGLException;
import org.lwjgl.LWJGLUtil;
import org.lwjgl.PointerBuffer;
@@ -95,7 +96,7 @@
EGL_NATIVE_RENDERABLE, EGL_FALSE,
};
- final EGLConfig[] configs = eglDisplay.chooseConfig(pf.getAttribBuffer(eglDisplay, eglSurfaceType, attribs), null, APIUtil.getBufferInt());
+ 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.");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sp...@us...> - 2011-07-16 22:26:54
|
Revision: 3593
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3593&view=rev
Author: spasi
Date: 2011-07-16 22:26:46 +0000 (Sat, 16 Jul 2011)
Log Message:
-----------
Converted GL APIUtil to a per ContextCapabilities instance.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/opengl/APIUtil.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/TypeMap.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/Utils.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/openal/ALTypeMap.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/opencl/CLTypeMap.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/opengl/GLCapabilitiesGenerator.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/opengl/GLESTypeMap.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/opengl/GLTypeMap.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/AMD_name_gen_delete.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/AMD_performance_monitor.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_fence.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_vertex_array_object.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_buffer_object.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_draw_buffers.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_framebuffer_object.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_occlusion_query.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_program.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_sampler_objects.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_separate_shader_objects.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shader_objects.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shading_language_include.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_transform_feedback2.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_vertex_array_object.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_vertex_shader.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ATI_draw_buffers.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_direct_state_access.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_framebuffer_object.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_texture_integer.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/GL11.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/GL15.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/GL20.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/GL30.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/GL33.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/GL40.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/GL41.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_fence.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_occlusion_query.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_program.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_transform_feedback.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_transform_feedback2.java
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/APIUtil.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/APIUtil.java 2011-07-16 19:40:16 UTC (rev 3592)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/APIUtil.java 2011-07-16 22:26:46 UTC (rev 3593)
@@ -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
@@ -37,35 +37,33 @@
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<char[]> arrayTL = new ThreadLocal<char[]>() {
- protected char[] initialValue() { return new char[INITIAL_BUFFER_SIZE]; }
- };
+ private char[] arrayTL;
+ private ByteBuffer bufferTL;
+ private IntBuffer lengthsTL;
+ private final Buffers buffersTL;
- private static final ThreadLocal<ByteBuffer> bufferTL = new ThreadLocal<ByteBuffer>() {
- protected ByteBuffer initialValue() { return BufferUtils.createByteBuffer(INITIAL_BUFFER_SIZE); }
- };
-
- private static final ThreadLocal<IntBuffer> lengthsTL = new ThreadLocal<IntBuffer>() {
- protected IntBuffer initialValue() { return BufferUtils.createIntBuffer(INITIAL_LENGTHS_SIZE); }
- };
-
- private static final ThreadLocal<Buffers> buffersTL = new ThreadLocal<Buffers>() {
- protected Buffers initialValue() { return new Buffers(); }
- };
-
- private APIUtil() {
+ APIUtil() {
+ arrayTL = new char[INITIAL_BUFFER_SIZE];
+ bufferTL = BufferUtils.createByteBuffer(INITIAL_BUFFER_SIZE);
+ lengthsTL = BufferUtils.createIntBuffer(INITIAL_LENGTHS_SIZE);
+ buffersTL = new Buffers();
}
- 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.arrayTL;
if ( array.length < size ) {
int sizeNew = array.length << 1;
@@ -73,14 +71,14 @@
sizeNew <<= 1;
array = new char[size];
- arrayTL.set(array);
+ caps.util.arrayTL = 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.bufferTL;
if ( buffer.capacity() < size ) {
int sizeNew = buffer.capacity() << 1;
@@ -88,15 +86,15 @@
sizeNew <<= 1;
buffer = BufferUtils.createByteBuffer(size);
- bufferTL.set(buffer);
+ caps.util.bufferTL = 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.bufferTL;
if ( buffer.capacity() < size ) {
int sizeNew = buffer.capacity() << 1;
@@ -105,7 +103,7 @@
final ByteBuffer bufferNew = BufferUtils.createByteBuffer(size);
bufferNew.put(buffer);
- bufferTL.set(buffer = bufferNew);
+ caps.util.bufferTL = (buffer = bufferNew);
} else {
buffer.position(buffer.limit());
buffer.limit(buffer.capacity());
@@ -114,22 +112,22 @@
return buffer;
}
- static ShortBuffer getBufferShort() { return buffersTL.get().shorts; }
+ static ShortBuffer getBufferShort(final ContextCapabilities caps) { return caps.util.buffersTL.shorts; }
- static IntBuffer getBufferInt() { return buffersTL.get().ints; }
+ static IntBuffer getBufferInt(final ContextCapabilities caps) { return caps.util.buffersTL.ints; }
- static LongBuffer getBufferLong() { return buffersTL.get().longs; }
+ static LongBuffer getBufferLong(final ContextCapabilities caps) { return caps.util.buffersTL.longs; }
- static FloatBuffer getBufferFloat() { return buffersTL.get().floats; }
+ static FloatBuffer getBufferFloat(final ContextCapabilities caps) { return caps.util.buffersTL.floats; }
- static DoubleBuffer getBufferDouble() { return buffersTL.get().doubles; }
+ static DoubleBuffer getBufferDouble(final ContextCapabilities caps) { return caps.util.buffersTL.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.lengthsTL;
if ( lengths.capacity() < size ) {
int sizeNew = lengths.capacity();
@@ -137,7 +135,7 @@
sizeNew <<= 1;
lengths = BufferUtils.createIntBuffer(size);
- lengthsTL.set(lengths);
+ caps.util.lengthsTL = lengths;
} else
lengths.clear();
@@ -169,9 +167,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);
@@ -186,8 +184,8 @@
*
* @return the String as a ByteBuffer
*/
- static long 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 MemoryUtil.getAddress0(buffer);
}
@@ -199,8 +197,8 @@
*
* @return the String as a ByteBuffer
*/
- static long 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 MemoryUtil.getAddress(buffer);
}
@@ -212,8 +210,8 @@
*
* @return the String as a ByteBuffer
*/
- static long 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 MemoryUtil.getAddress0(buffer);
@@ -234,8 +232,8 @@
*
* @return the Strings as a ByteBuffer
*/
- static long 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);
@@ -251,8 +249,8 @@
*
* @return the Strings as a ByteBuffer
*/
- static long 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);
@@ -270,8 +268,8 @@
*
* @return the String lengths in an IntBuffer
*/
- static long 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());
@@ -280,21 +278,21 @@
return MemoryUtil.getAddress0(buffer);
}
- static long getInt(final int value) {
- return MemoryUtil.getAddress0(getBufferInt().put(0, value));
+ static long getInt(final ContextCapabilities caps, final int value) {
+ return MemoryUtil.getAddress0(getBufferInt(caps).put(0, value));
}
- static long getBufferByte0() {
- return MemoryUtil.getAddress0(getBufferByte(0));
+ static long getBufferByte0(final ContextCapabilities caps) {
+ return MemoryUtil.getAddress0(getBufferByte(caps, 0));
}
private static class Buffers {
final ShortBuffer shorts;
- final IntBuffer ints;
- final LongBuffer longs;
+ final IntBuffer ints;
+ final LongBuffer longs;
- final FloatBuffer floats;
+ final FloatBuffer floats;
final DoubleBuffer doubles;
Buffers() {
Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java 2011-07-16 19:40:16 UTC (rev 3592)
+++ trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java 2011-07-16 22:26:46 UTC (rev 3593)
@@ -301,13 +301,13 @@
}
} 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)
writer.print(Utils.BUFFER_OBJECT_METHOD_POSTFIX);
writer.print("(");
- boolean first_parameter = printMethodCallArguments(writer, method, typeinfos_instance, mode);
+ boolean first_parameter = printMethodCallArguments(writer, method, typeinfos_instance, mode, type_map);
if (context_specific) {
if (!first_parameter)
writer.print(", ");
@@ -335,7 +335,7 @@
else
writer.println(tabs + "return " + Utils.RESULT_VAR_NAME + ";");
} else
- Utils.printGLReturnPost(writer, method, method.getAnnotation(GLreturn.class));
+ Utils.printGLReturnPost(writer, method, method.getAnnotation(GLreturn.class), type_map);
}
if ( code_annotation != null && code_annotation.tryBlock() ) {
@@ -439,7 +439,7 @@
throw new RuntimeException(c + " is not allowed");
}
- private static boolean printMethodCallArgument(PrintWriter writer, MethodDeclaration method, ParameterDeclaration param, Map<ParameterDeclaration, TypeInfo> typeinfos_instance, Mode mode, boolean first_parameter) {
+ private static boolean printMethodCallArgument(PrintWriter writer, MethodDeclaration method, ParameterDeclaration param, Map<ParameterDeclaration, TypeInfo> typeinfos_instance, Mode mode, boolean first_parameter, TypeMap type_map) {
if (!first_parameter)
writer.print(", ");
@@ -496,7 +496,9 @@
writer.print("APIUtil.getBuffer");
if ( param.getAnnotation(NullTerminated.class) != null )
writer.print("NT");
- writer.print("(" + param.getSimpleName());
+ writer.print('(');
+ writer.print(type_map.getAPIUtilParam(true));
+ writer.print(param.getSimpleName());
if ( offset != null )
writer.print(", " + offset);
writer.print(")");
@@ -531,7 +533,7 @@
return false;
}
- private static boolean printMethodCallArguments(PrintWriter writer, MethodDeclaration method, Map<ParameterDeclaration, TypeInfo> typeinfos_instance, Mode mode) {
+ private static boolean printMethodCallArguments(PrintWriter writer, MethodDeclaration method, Map<ParameterDeclaration, TypeInfo> 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()) )
@@ -539,7 +541,7 @@
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);
+ 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()) {
Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/TypeMap.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/generator/TypeMap.java 2011-07-16 19:40:16 UTC (rev 3592)
+++ trunk/LWJGL/src/java/org/lwjgl/util/generator/TypeMap.java 2011-07-16 22:26:46 UTC (rev 3593)
@@ -50,6 +50,7 @@
public interface TypeMap {
void printCapabilitiesInit(PrintWriter writer);
String getCapabilities();
+ String getAPIUtilParam(boolean comma);
void printErrorCheckMethod(PrintWriter writer, MethodDeclaration method, String tabs);
String getRegisterNativesFunctionName();
PrimitiveType.Kind getPrimitiveTypeFromNativeType(Class<? extends Annotation> native_type);
Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/Utils.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/generator/Utils.java 2011-07-16 19:40:16 UTC (rev 3592)
+++ trunk/LWJGL/src/java/org/lwjgl/util/generator/Utils.java 2011-07-16 22:26:46 UTC (rev 3593)
@@ -57,19 +57,19 @@
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) {
Alternate alt_annotation = method.getAnnotation(Alternate.class);
@@ -102,6 +102,7 @@
}
private static class AnnotationMirrorComparator implements Comparator<AnnotationMirror> {
+
public int compare(AnnotationMirror a1, AnnotationMirror a2) {
String n1 = a1.getAnnotationType().getDeclaration().getQualifiedName();
String n2 = a2.getAnnotationType().getDeclaration().getQualifiedName();
@@ -148,22 +149,22 @@
private static boolean hasParameterMultipleTypes(ParameterDeclaration 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))
+ 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))
+ for ( ParameterDeclaration param : method.getParameters() )
+ if ( param.getSimpleName().equals(name) )
return param;
throw new RuntimeException("Parameter " + name + " not found");
}
@@ -176,7 +177,7 @@
overloadsComment = null;
String doc_comment = decl.getDocComment();
- if (doc_comment != null) {
+ if ( doc_comment != null ) {
final String tab = decl instanceof InterfaceDeclaration ? "" : "\t";
writer.println(tab + "/**");
@@ -187,7 +188,7 @@
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 )
@@ -205,8 +206,8 @@
}
public static AnnotationMirror getParameterAutoAnnotation(ParameterDeclaration param) {
- for (AnnotationMirror annotation : param.getAnnotationMirrors())
- if (NativeTypeTranslator.getAnnotation(annotation, Auto.class) != null)
+ for ( AnnotationMirror annotation : param.getAnnotationMirrors() )
+ if ( NativeTypeTranslator.getAnnotation(annotation, Auto.class) != null )
return annotation;
return null;
}
@@ -242,9 +243,9 @@
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)
+ for ( ParameterDeclaration 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;
}
@@ -255,7 +256,7 @@
public static TypeMirror getMethodReturnType(MethodDeclaration method) {
TypeMirror result_type;
ParameterDeclaration result_param = getResultParameter(method);
- if (result_param != null) {
+ if ( result_param != null ) {
result_type = result_param.getType();
} else
result_type = method.getReturnType();
@@ -291,20 +292,20 @@
public static void printExtraCallArguments(PrintWriter writer, MethodDeclaration 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) {
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
@@ -314,8 +315,8 @@
}
public static boolean hasMethodBufferObjectParameter(MethodDeclaration method) {
- for (ParameterDeclaration param : method.getParameters()) {
- if (param.getAnnotation(BufferObject.class) != null) {
+ for ( ParameterDeclaration param : method.getParameters() ) {
+ if ( param.getAnnotation(BufferObject.class) != null ) {
return true;
}
}
@@ -332,7 +333,7 @@
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 )
return ByteBuffer.class;
@@ -344,7 +345,7 @@
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))
+ if ( isMethodIndirect(generate_error_checks, context_specific, method) )
method_name = OVERLOADED_METHOD_PREFIX + method_name;
return method_name;
}
@@ -392,15 +393,15 @@
return offset;
}
- static void printGLReturnPre(PrintWriter writer, MethodDeclaration method, GLreturn return_annotation) {
+ static void printGLReturnPre(PrintWriter writer, MethodDeclaration 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());
+ 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
@@ -412,9 +413,9 @@
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 + "(");
+ writer.print(buffer_type + "Buffer " + return_annotation.value() + " = APIUtil.getBuffer" + buffer_type + "(" + type_map.getAPIUtilParam(false));
if ( "Byte".equals(buffer_type) )
- writer.print('1');
+ writer.print((type_map.getAPIUtilParam(false).length() > 0 ? ", " : "") + "1");
writer.println(");");
}
@@ -426,20 +427,20 @@
writer.print("\t\t");
}
- static void printGLReturnPost(PrintWriter writer, MethodDeclaration method, GLreturn return_annotation) {
+ static void printGLReturnPost(PrintWriter writer, MethodDeclaration 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() )
writer.print(return_annotation.maxLength());
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) )
Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/openal/ALTypeMap.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/generator/openal/ALTypeMap.java 2011-07-16 19:40:16 UTC (rev 3592)
+++ trunk/LWJGL/src/java/org/lwjgl/util/generator/openal/ALTypeMap.java 2011-07-16 22:26:46 UTC (rev 3593)
@@ -178,6 +178,10 @@
throw new UnsupportedOperationException();
}
+ public String getAPIUtilParam(boolean comma) {
+ return "";
+ }
+
public void printErrorCheckMethod(final PrintWriter writer, final MethodDeclaration method, final String tabs) {
writer.println(tabs + "Util.checkALError();");
}
Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/opencl/CLTypeMap.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/generator/opencl/CLTypeMap.java 2011-07-16 19:40:16 UTC (rev 3592)
+++ trunk/LWJGL/src/java/org/lwjgl/util/generator/opencl/CLTypeMap.java 2011-07-16 22:26:46 UTC (rev 3593)
@@ -89,6 +89,10 @@
return "CLCapabilities";
}
+ public String getAPIUtilParam(boolean comma) {
+ return "";
+ }
+
public void printErrorCheckMethod(final PrintWriter writer, final MethodDeclaration method, final String tabs) {
final Check check = method.getAnnotation(Check.class);
if ( check != null ) // Get the error code from an IntBuffer output parameter
Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/opengl/GLCapabilitiesGenerator.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/generator/opengl/GLCapabilitiesGenerator.java 2011-07-16 19:40:16 UTC (rev 3592)
+++ trunk/LWJGL/src/java/org/lwjgl/util/generator/opengl/GLCapabilitiesGenerator.java 2011-07-16 22:26:46 UTC (rev 3593)
@@ -64,6 +64,7 @@
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 ) {
Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/opengl/GLESTypeMap.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/generator/opengl/GLESTypeMap.java 2011-07-16 19:40:16 UTC (rev 3592)
+++ trunk/LWJGL/src/java/org/lwjgl/util/generator/opengl/GLESTypeMap.java 2011-07-16 22:26:46 UTC (rev 3593)
@@ -97,6 +97,10 @@
return "caps";
}
+ public String getAPIUtilParam(boolean comma) {
+ return "";
+ }
+
public void printErrorCheckMethod(final PrintWriter writer, final MethodDeclaration method, final String tabs) {
writer.println(tabs + "Util.checkGLError();");
}
Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/opengl/GLTypeMap.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/generator/opengl/GLTypeMap.java 2011-07-16 19:40:16 UTC (rev 3592)
+++ trunk/LWJGL/src/java/org/lwjgl/util/generator/opengl/GLTypeMap.java 2011-07-16 22:26:46 UTC (rev 3593)
@@ -106,6 +106,10 @@
return "caps";
}
+ public String getAPIUtilParam(boolean comma) {
+ return comma ? "caps, " : "caps";
+ }
+
public void printErrorCheckMethod(final PrintWriter writer, final MethodDeclaration method, final String tabs) {
writer.println(tabs + "Util.checkGLError();");
}
Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/AMD_name_gen_delete.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/AMD_name_gen_delete.java 2011-07-16 19:40:16 UTC (rev 3592)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/AMD_name_gen_delete.java 2011-07-16 22:26:46 UTC (rev 3593)
@@ -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.getInt(name)", 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);
Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/AMD_performance_monitor.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/AMD_performance_monitor.java 2011-07-16 19:40:16 UTC (rev 3592)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/AMD_performance_monitor.java 2011-07-16 22:26:46 UTC (rev 3593)
@@ -100,12 +100,12 @@
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 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.getInt(counter)", 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);
Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_fence.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_fence.java 2011-07-16 19:40:16 UTC (rev 3592)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_fence.java 2011-07-16 22:26:46 UTC (rev 3593)
@@ -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.getInt(fence)", 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);
Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_vertex_array_object.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_vertex_array_object.java 2011-07-16 19:40:16 UTC (rev 3592)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_vertex_array_object.java 2011-07-16 22:26:46 UTC (rev 3593)
@@ -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.getInt(array)", 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);
Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_buffer_object.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_buffer_object.java 2011-07-16 19:40:16 UTC (rev 3592)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_buffer_object.java 2011-07-16 22:26:46 UTC (rev 3593)
@@ -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.getInt(buffer)", 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);
Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_draw_buffers.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_draw_buffers.java 2011-07-16 19:40:16 UTC (rev 3592)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_draw_buffers.java 2011-07-16 22:26:46 UTC (rev 3593)
@@ -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.getInt(buffer)", keepParam = true) int buffer);
+ void glDrawBuffersARB(@Constant("1") @GLsizei int size, @Constant(value = "APIUtil.getInt(caps, buffer)", keepParam = true) int buffer);
}
Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_framebuffer_object.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_framebuffer_object.java 2011-07-16 19:40:16 UTC (rev 3592)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_framebuffer_object.java 2011-07-16 22:26:46 UTC (rev 3593)
@@ -197,7 +197,7 @@
@Reuse("GL30")
@Alternate("glDeleteRenderbuffers")
- void glDeleteRenderbuffers(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getInt(renderbuffer)", 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);
@@ -237,7 +237,7 @@
@Reuse("GL30")
@Alternate("glDeleteFramebuffers")
- void glDeleteFramebuffers(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getInt(framebuffer)", 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);
Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_occlusion_query.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_occlusion_query.java 2011-07-16 19:40:16 UTC (rev 3592)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_occlusion_query.java 2011-07-16 22:26:46 UTC (rev 3593)
@@ -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.getInt(id)", 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);
Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_program.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_program.java 2011-07-16 19:40:16 UTC (rev 3592)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_program.java 2011-07-16 22:26:46 UTC (rev 3593)
@@ -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.getInt(program)", 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);
Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_sampler_objects.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_sampler_objects.java 2011-07-16 19:40:16 UTC (rev 3592)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_sampler_objects.java 2011-07-16 22:26:46 UTC (rev 3593)
@@ -63,7 +63,7 @@
@Reuse("GL33")
@Alternate("glDeleteSamplers")
- void glDeleteSamplers(@Constant("1") @GLsizei int count, @Constant(value = "APIUtil.getInt(sampler)", 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);
Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_separate_shader_objects.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_separate_shader_objects.java 2011-07-16 19:40:16 UTC (rev 3592)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_separate_shader_objects.java 2011-07-16 22:26:46 UTC (rev 3593)
@@ -98,7 +98,7 @@
@Reuse("GL41")
@Alternate("glDeleteProgramPipelines")
- void glDeleteProgramPipelines(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getInt(pipeline)", 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);
Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shader_objects.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shader_objects.java 2011-07-16 19:40:16 UTC (rev 3592)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shader_objects.java 2011-07-16 22:26:46 UTC (rev 3593)
@@ -110,7 +110,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)") @Const IntBuffer length);
+ @Constant("APIUtil.getLengths(caps, strings)") @Const IntBuffer length);
void glCompileShaderARB(@GLhandleARB int shaderObj);
@@ -234,7 +234,7 @@
@Alternate(value = "glGetActiveUniformARB", javaAlt = true)
@GLreturn(value = "name", maxLength = "maxLength")
void glGetActiveUniformARB(@GLhandleARB int programObj, @GLuint int index, @GLsizei int maxLength,
- @OutParameter @GLsizei @Constant("MemoryUtil.getAddress0(name_length), MemoryUtil.getAddress0(APIUtil.getBufferInt()), MemoryUtil.getAddress(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. */
@@ -244,7 +244,7 @@
@OutParameter @GLsizei @Constant("0L") IntBuffer length,
@OutParameter IntBuffer size,
@OutParameter @GLenum @Constant("MemoryUtil.getAddress(size, 1)") IntBuffer type, // Reuse size buffer and ignore
- @OutParameter @GLcharARB @Constant("APIUtil.getBufferByte0()") ByteBuffer name);
+ @OutParameter @GLcharARB @Constant("APIUtil.getBufferByte0(caps)") ByteBuffer name);
/** Overloads glGetActiveUniformARB. This version returns only the uniform type. */
@Alternate(value = "glGetActiveUniformARB", javaAlt = true)
@@ -253,7 +253,7 @@
@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.getBufferByte0()") ByteBuffer name);
+ @OutParameter @GLcharARB @Constant("APIUtil.getBufferByte0(caps)") ByteBuffer name);
@StripPostfix("params")
void glGetUniformfvARB(@GLhandleARB int programObj, int location, @OutParameter @Check FloatBuffer params);
Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shading_language_include.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shading_language_include.java 2011-07-16 19:40:16 UTC (rev 3592)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shading_language_include.java 2011-07-16 22:26:46 UTC (rev 3593)
@@ -68,7 +68,7 @@
@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)") @Const IntBuffer length);
+ @Constant("APIUtil.getLengths(caps, path)") @Const IntBuffer length);
boolean glIsNamedStringARB(@AutoSize("name") int namelen, @Const @GLchar ByteBuffer name);
Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_transform_feedback2.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_transform_feedback2.java 2011-07-16 19:40:16 UTC (rev 3592)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_transform_feedback2.java 2011-07-16 22:26:46 UTC (rev 3593)
@@ -61,7 +61,7 @@
@Reuse("GL40")
@Alternate("glDeleteTransformFeedbacks")
- void glDeleteTransformFeedbacks(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getInt(id)", 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);
Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_vertex_array_object.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_vertex_array_object.java 2011-07-16 19:40:16 UTC (rev 3592)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_vertex_array_object.java 2011-07-16 22:26:46 UTC (rev 3593)
@@ -55,7 +55,7 @@
@Reuse("GL30")
@Alternate("glDeleteVertexArrays")
- void glDeleteVertexArrays(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getInt(array)", 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);
Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_vertex_shader.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_vertex_shader.java 2011-07-16 19:40:16 UTC (rev 3592)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_vertex_shader.java 2011-07-16 22:26:46 UTC (rev 3593)
@@ -170,7 +170,7 @@
@Alternate(value = "glGetActiveAttribARB", javaAlt = true)
@GLreturn(value = "name", maxLength = "maxLength")
void glGetActiveAttribARB(@GLhandleARB int programObj, @GLuint int index, @GLsizei int maxLength,
- @OutParameter @GLsizei @Constant("MemoryUtil.getAddress0(name_length), MemoryUtil.getAddress0(APIUtil.getBufferInt()), MemoryUtil.getAddress(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. */
@@ -180,7 +180,7 @@
@OutParameter @GLsizei @Constant("0L") IntBuffer length,
@OutParameter IntBuffer size,
@OutParameter @GLenum @Constant("MemoryUtil.getAddress(size, 1)") IntBuffer type, // Reuse size buffer and ignore
- @OutParameter @GLcharARB @Constant("APIUtil.getBufferByte0()") ByteBuffer name);
+ @OutParameter @GLcharARB @Constant("APIUtil.getBufferByte0(caps)") ByteBuffer name);
/** Overloads glGetActiveAttribARB. This version returns only the attrib type. */
@Alternate(value = "glGetActiveAttribARB", javaAlt = true)
@@ -189,7 +189,7 @@
@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.getBufferByte0()") ByteBuffer name);
+ @OutParameter @GLcharARB @Constant("APIUtil.getBufferByte0(caps)") ByteBuffer name);
int glGetAttribLocationARB(@GLhandleARB int programObj, @NullTerminated @Const @GLcharARB ByteBuffer name);
Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/ATI_draw_buffers.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/ATI_draw_buffers.java 2011-07-16 19:40:16 UTC (rev 3592)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ATI_draw_buffers.java 2011-07-16 22:26:46 UTC (rev 3593)
@@ -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.getInt(buffer)", keepParam = true) int buffer);
+ void glDrawBuffersATI(@Constant("1") @GLsizei int size, @Constant(value = "APIUtil.getInt(caps, buffer)", keepParam = true) int buffer);
}
Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_direct_state_access.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_direct_state_access.java 2011-07-16 19:40:16 UTC (rev 3592)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_direct_state_access.java 2011-07-16 22:26:46 UTC (rev 3593)
@@ -1075,7 +1075,7 @@
@Alternate("glTextureParameterIivEXT")
@Dependent("GL_EXT_texture_integer")
@StripPostfix("param")
- void glTextureParameterIivEXT(@GLuint int texture, @GLenum int target, @GLenum int pname, @Constant(value = "APIUtil.getInt(param)", 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 +1084,7 @@
@Alternate("glTextureParameterIuivEXT")
@Dependent("GL_EXT_texture_integer")
@StripPostfix("param")
- void glTextureParameterIuivEXT(@GLuint int texture, @GLenum int target, @GLenum int pname, @Constant(value = "APIUtil.getInt(param)", 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")
@@ -1119,7 +1119,7 @@
@Alternate("glMultiTexParameterIivEXT")
@Dependent("GL_EXT_texture_integer")
@StripPostfix("param")
- void glMultiTexParameterIivEXT(@GLenum int texunit, @GLenum int target, @GLenum int pname, @Constant(value = "APIUtil.getInt(param)", 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 +1128,7 @@
@Alternate("glMultiTexParameterIuivEXT")
@Dependent("GL_EXT_texture_integer")
@StripPostfix("param")
- void glMultiTexParameterIuivEXT(@GLenum int texunit, @GLenum int target, @GLenum int pname, @Constant(value = "APIUtil.getInt(param)", 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")
Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_framebuffer_object.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_framebuffer_object.java 2011-07-16 19:40:16 UTC (rev 3592)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_framebuffer_object.java 2011-07-16 22:26:46 UTC (rev 3593)
@@ -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.getInt(renderbuffer)", 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);
@@ -161,7 +161,7 @@
void glDeleteFramebuffersEXT(@AutoSize("framebuffers") int n, @Const @GLuint IntBuffer framebuffers);
@Alternate("glDeleteFramebuffersEXT")
- void glDeleteFramebuffersEXT(@Constant("1") int n, @Constant(value = "APIUtil.getInt(framebuffer)", 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);
Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_texture_integer.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_texture_integer.java 2011-07-16 19:40:16 UTC (rev 3592)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_texture_integer.java 2011-07-16 22:26:46 UTC (rev 3593)
@@ -118,14 +118,14 @@
@Alternate("glTexParameterIivEXT")
@StripPostfix(value = "param", postfix = "v")
- void glTexParameterIivEXT(@GLenum int target, @GLenum int pname, @Constant(value = "APIUtil.getInt(param)", keepParam = true) int param);
+ 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.getInt(param)", keepParam = true) int param);
+ 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);
Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/GL11.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/GL11.java 2011-07-16 19:40:16 UTC (rev 3592)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/GL11.java 2011-07-16 22:26:46 UTC (rev 3593)
@@ -784,7 +784,7 @@
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 glDeleteTextures(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getInt(caps, texture)", keepParam = true) int texture);
void glCullFace(@GLenum int mode);
Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/GL15.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/GL15.java 2011-07-16 19:40:16 UTC (rev 3592)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/GL15.java 2011-07-16 22:26:46 UTC (rev 3593)
@@ -97,7 +97,7 @@
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 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);
@@ -205,7 +205,7 @@
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);
+ void glDeleteQueries(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getInt(caps, id)", keepParam = true) int id);
boolean glIsQuery(@GLuint int id);
Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/GL20.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/GL20.java 2011-07-16 19:40:16 UTC (rev 3592)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/GL20.java 2011-07-16 22:26:46 UTC (rev 3593)
@@ -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)") @Const IntBuffer length);
+ @Constant("APIUtil.getLengths(caps, strings)") @Const IntBuffer length);
int glCreateShader(@GLuint int type);
@@ -257,7 +257,7 @@
@Alternate(value = "glGetActiveUniform", javaAlt = true)
@GLreturn(value = "name", maxLength = "maxLength")
void glGetActiveUniform(@GLuint int program, @GLuint int index, @GLsizei int maxLength,
- @OutParameter @GLsizei @Constant("MemoryUtil.getAddress0(name_length), MemoryUtil.getAddress0(APIUtil.getBufferInt()), MemoryUtil.getAddress(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. */
@@ -267,7 +267,7 @@
@OutParameter @GLsizei @Constant("0L") IntBuffer length,
...
[truncated message content] |
|
From: <sp...@us...> - 2011-07-16 19:40:23
|
Revision: 3592
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3592&view=rev
Author: spasi
Date: 2011-07-16 19:40:16 +0000 (Sat, 16 Jul 2011)
Log Message:
-----------
Removed test code. /fail
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/MemoryUtil.java
Modified: trunk/LWJGL/src/java/org/lwjgl/MemoryUtil.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/MemoryUtil.java 2011-07-16 16:59:46 UTC (rev 3591)
+++ trunk/LWJGL/src/java/org/lwjgl/MemoryUtil.java 2011-07-16 19:40:16 UTC (rev 3592)
@@ -49,8 +49,7 @@
Accessor util;
try {
// Depends on java.nio.Buffer#address and sun.misc.Unsafe
- //util = loadAccessor("org.lwjgl.MemoryUtilSun$AccessorUnsafe");
- util = new AccessorJNI();
+ util = loadAccessor("org.lwjgl.MemoryUtilSun$AccessorUnsafe");
} catch (Exception e0) {
try {
// Depends on java.nio.Buffer#address and sun.reflect.FieldAccessor
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sp...@us...> - 2011-07-16 16:59:53
|
Revision: 3591
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3591&view=rev
Author: spasi
Date: 2011-07-16 16:59:46 +0000 (Sat, 16 Jul 2011)
Log Message:
-----------
Pointer cast warning fix.
Modified Paths:
--------------
trunk/LWJGL/src/native/common/opengl/org_lwjgl_opengl_CallbackUtil.c
Modified: trunk/LWJGL/src/native/common/opengl/org_lwjgl_opengl_CallbackUtil.c
===================================================================
--- trunk/LWJGL/src/native/common/opengl/org_lwjgl_opengl_CallbackUtil.c 2011-07-16 16:42:51 UTC (rev 3590)
+++ trunk/LWJGL/src/native/common/opengl/org_lwjgl_opengl_CallbackUtil.c 2011-07-16 16:59:46 UTC (rev 3591)
@@ -45,11 +45,11 @@
static jmethodID debugOutputCallbackAMDJ;
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_CallbackUtil_ncreateGlobalRef(JNIEnv *env, jclass clazz, jobject obj) {
- return (jlong)(*env)->NewGlobalRef(env, 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)globalRef);
+ (*env)->DeleteGlobalRef(env, (jobject)(intptr_t)globalRef);
}
// ----------------- [ ARB_debug_output ] -----------------
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sp...@us...> - 2011-07-16 16:42:59
|
Revision: 3590
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3590&view=rev
Author: spasi
Date: 2011-07-16 16:42:51 +0000 (Sat, 16 Jul 2011)
Log Message:
-----------
More java-side pointer arithmetic.
Fixed pointer cast warning.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/openal/ALC10.java
trunk/LWJGL/src/java/org/lwjgl/openal/ALC11.java
trunk/LWJGL/src/java/org/lwjgl/opengles/EGL.java
trunk/LWJGL/src/java/org/lwjgl/opengles/EGLKHRFenceSync.java
trunk/LWJGL/src/java/org/lwjgl/opengles/EGLNVSync.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/NativeMethodStubsGenerator.java
trunk/LWJGL/src/native/common/opengles/org_lwjgl_opengles_EGL.c
trunk/LWJGL/src/native/common/opengles/org_lwjgl_opengles_EGLKHRFenceSync.c
trunk/LWJGL/src/native/common/opengles/org_lwjgl_opengles_EGLNVSync.c
trunk/LWJGL/src/native/common/org_lwjgl_openal_ALC10.c
trunk/LWJGL/src/native/common/org_lwjgl_openal_ALC11.c
Modified: trunk/LWJGL/src/java/org/lwjgl/openal/ALC10.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/openal/ALC10.java 2011-07-16 16:05:37 UTC (rev 3589)
+++ trunk/LWJGL/src/java/org/lwjgl/openal/ALC10.java 2011-07-16 16:42:51 UTC (rev 3590)
@@ -37,6 +37,7 @@
import org.lwjgl.BufferChecks;
import org.lwjgl.LWJGLException;
+import org.lwjgl.MemoryUtil;
/**
*
@@ -180,10 +181,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 <code>alcOpenDevice</code> 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
Modified: trunk/LWJGL/src/java/org/lwjgl/openal/ALC11.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/openal/ALC11.java 2011-07-16 16:05:37 UTC (rev 3589)
+++ trunk/LWJGL/src/java/org/lwjgl/openal/ALC11.java 2011-07-16 16:42:51 UTC (rev 3590)
@@ -37,8 +37,8 @@
import org.lwjgl.BufferUtils;
import org.lwjgl.LWJGLException;
import org.lwjgl.LWJGLUtil;
+import org.lwjgl.MemoryUtil;
-
/**
* <p>
* The ALC11 class implements features in OpenAL 1.1, specifically
@@ -162,9 +162,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;
Modified: trunk/LWJGL/src/java/org/lwjgl/opengles/EGL.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengles/EGL.java 2011-07-16 16:05:37 UTC (rev 3589)
+++ trunk/LWJGL/src/java/org/lwjgl/opengles/EGL.java 2011-07-16 16:42:51 UTC (rev 3590)
@@ -33,9 +33,9 @@
import org.lwjgl.BufferChecks;
import org.lwjgl.LWJGLException;
+import org.lwjgl.MemoryUtil;
import org.lwjgl.PointerBuffer;
-import java.nio.ByteBuffer;
import java.nio.IntBuffer;
/** EGL wrapper class. */
@@ -266,11 +266,11 @@
static void eglInitialize(EGLDisplay dpy, IntBuffer version) throws LWJGLException {
//LWJGLUtil.log("eglInitialize");
BufferChecks.checkBuffer(version, 2);
- if ( !neglInitialize(dpy.getPointer(), version, version.position()) )
+ if ( !neglInitialize(dpy.getPointer(), MemoryUtil.getAddress(version)) )
throwEGLError("Failed to initialize EGL display.");
}
- private static native boolean neglInitialize(long dpy_ptr, IntBuffer version, int version_position);
+ private static native boolean neglInitialize(long dpy_ptr, long version);
/**
* Release the resources associated with the specified EGL display.
@@ -314,7 +314,7 @@
//LWJGLUtil.log("eglGetConfigsNum");
IntBuffer num_config = APIUtil.getBufferInt();
- if ( !neglGetConfigs(dpy.getPointer(), null, 0, 0, num_config, num_config.position()) )
+ if ( !neglGetConfigs(dpy.getPointer(), 0L, 0, MemoryUtil.getAddress0(num_config)) )
throwEGLError("Failed to get EGL configs.");
return num_config.get(0);
@@ -340,14 +340,14 @@
BufferChecks.checkBuffer(num_config, 1);
if ( configs == null ) {
- if ( !neglGetConfigs(dpy.getPointer(), null, 0, 0, num_config, num_config.position()) )
+ 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(), configs_buffer.getBuffer(), 0, configs.length, num_config, num_config.position()) )
+ 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());
@@ -357,7 +357,7 @@
return configs;
}
- private static native boolean neglGetConfigs(long dpy_ptr, ByteBuffer configs, int configs_position, int config_size, IntBuffer num_config, int num_config_position);
+ 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
@@ -376,7 +376,7 @@
checkAttribList(attrib_list);
IntBuffer num_config = APIUtil.getBufferInt();
- if ( !neglChooseConfig(dpy.getPointer(), attrib_list, attrib_list == null ? 0 : attrib_list.position(), null, 0, 0, num_config, num_config.position()) )
+ 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);
@@ -405,7 +405,7 @@
int config_size;
if ( configs == null ) {
- if ( !neglChooseConfig(dpy.getPointer(), attrib_list, attrib_list == null ? 0 : attrib_list.position(), null, 0, 0, num_config, num_config.position()) )
+ 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());
@@ -414,7 +414,7 @@
//LWJGLUtil.log("config_size = " + config_size);
PointerBuffer configs_buffer = APIUtil.getBufferPointer(config_size);
- if ( !neglChooseConfig(dpy.getPointer(), attrib_list, attrib_list == null ? 0 : attrib_list.position(), configs_buffer.getBuffer(), 0, config_size, num_config, num_config.position()) )
+ 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)
@@ -427,7 +427,7 @@
return configs;
}
- private static native boolean neglChooseConfig(long dpy_ptr, IntBuffer attrib_list, int attrib_list_position, ByteBuffer configs, int configs_position, int config_size, IntBuffer num_config, int num_config_position);
+ 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.
@@ -442,13 +442,13 @@
//LWJGLUtil.log("eglGetConfigAttrib");
final IntBuffer value = APIUtil.getBufferInt();
- if ( !neglGetConfigAttrib(dpy.getPointer(), config.getPointer(), attribute, value, value.position()) )
+ 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, IntBuffer value, int value_position);
+ 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.
@@ -465,7 +465,7 @@
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, attrib_list, attrib_list == null ? 0 : attrib_list.position());
+ 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.");
@@ -473,7 +473,7 @@
return new EGLSurface(dpy, config, pointer);
}
- private static native long neglCreateWindowSurface(long dpy_ptr, long config_ptr, long win, IntBuffer attrib_list, int attrib_list_position);
+ 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.
@@ -489,7 +489,7 @@
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(), attrib_list, attrib_list == null ? 0 : attrib_list.position());
+ final long pointer = neglCreatePbufferSurface(dpy.getPointer(), config.getPointer(), MemoryUtil.getAddressSafe(attrib_list));
if ( pointer == EGL_NO_SURFACE )
throwEGLError("Failed to create EGL pbuffer surface.");
@@ -497,7 +497,7 @@
return new EGLSurface(dpy, config, pointer);
}
- private static native long neglCreatePbufferSurface(long dpy_ptr, long config_ptr, IntBuffer attrib_list, int attrib_list_position);
+ 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);
@@ -550,11 +550,11 @@
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, value, value.position()) )
+ 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, IntBuffer value, int value_position);
+ private static native boolean neglQuerySurface(long dpy_ptr, long surface_ptr, int attribute, long value);
/**
* Binds the specified rendering API to the current thread.
@@ -627,7 +627,7 @@
checkAttribList(attrib_list);
final long pointer = neglCreateContext(dpy.getPointer(), config.getPointer(),
share_context == null ? EGL_NO_CONTEXT : share_context.getPointer(),
- attrib_list, attrib_list == null ? 0 : attrib_list.position());
+ MemoryUtil.getAddressSafe(attrib_list));
if ( pointer == EGL_NO_CONTEXT )
throwEGLError("Failed to create EGL context.");
@@ -635,7 +635,7 @@
return new EGLContext(dpy, config, pointer);
}
- private static native long neglCreateContext(long dpy_ptr, long config_ptr, long share_context_ptr, IntBuffer attrib_list, int attrib_list_position);
+ private static native long neglCreateContext(long dpy_ptr, long config_ptr, long share_context_ptr, long attrib_list);
/**
* Destroys a rendering context.
@@ -714,7 +714,7 @@
// Query context's CONFIG_ID
final IntBuffer attrib_list = APIUtil.getBufferInt();
- neglQueryContext(display.getPointer(), ctx, EGL_CONFIG_ID, attrib_list, 0);
+ neglQueryContext(display.getPointer(), ctx, EGL_CONFIG_ID, MemoryUtil.getAddress0(attrib_list));
final EGLConfig config = getEGLConfig(display, attrib_list);
@@ -761,7 +761,7 @@
// Query context's CONFIG_ID
final IntBuffer attrib_list = APIUtil.getBufferInt();
- if ( !neglQuerySurface(display.getPointer(), surface, EGL_CONFIG_ID, attrib_list, 0) )
+ 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);
@@ -799,11 +799,11 @@
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, value, value.position()) )
+ 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, IntBuffer value, int value_position);
+ private static native boolean neglQueryContext(long dpy_ptr, long ctx_ptr, int attribute, long value);
/**
* Prevents native rendering API functions from executing until any
@@ -883,7 +883,7 @@
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(), attrib_list, attrib_list.position(), configs_buffer.getBuffer(), 0, 1, attrib_list, attrib_list.position() + 3) )
+ 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));
Modified: trunk/LWJGL/src/java/org/lwjgl/opengles/EGLKHRFenceSync.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengles/EGLKHRFenceSync.java 2011-07-16 16:05:37 UTC (rev 3589)
+++ trunk/LWJGL/src/java/org/lwjgl/opengles/EGLKHRFenceSync.java 2011-07-16 16:42:51 UTC (rev 3590)
@@ -32,6 +32,7 @@
package org.lwjgl.opengles;
import org.lwjgl.LWJGLException;
+import org.lwjgl.MemoryUtil;
import java.nio.IntBuffer;
@@ -102,7 +103,7 @@
public static EGLSyncKHR eglCreateSyncKHR(EGLDisplay dpy, int type, IntBuffer attrib_list) throws LWJGLException {
checkAttribList(attrib_list);
- final long pointer = neglCreateSyncKHR(dpy.getPointer(), type, attrib_list, attrib_list == null ? 0 : attrib_list.position());
+ 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.");
@@ -110,7 +111,7 @@
return new EGLSyncKHR(pointer);
}
- private static native long neglCreateSyncKHR(long dpy_ptr, int type, IntBuffer attrib_list, int attrib_list_position);
+ private static native long neglCreateSyncKHR(long dpy_ptr, int type, long attrib_list);
/**
* Destroys an existing sync object.
@@ -162,12 +163,12 @@
public static int eglGetSyncAttribKHR(EGLDisplay dpy, EGLSyncKHR sync, int attribute) throws LWJGLException {
final IntBuffer value = APIUtil.getBufferInt();
- if ( !neglGetSyncAttribKHR(dpy.getPointer(), sync.getPointer(), attribute, value, value.position()) )
+ 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, IntBuffer value, int value_position);
+ private static native boolean neglGetSyncAttribKHR(long dpy_ptr, long sync_ptr, int attribute, long value);
}
\ No newline at end of file
Modified: trunk/LWJGL/src/java/org/lwjgl/opengles/EGLNVSync.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengles/EGLNVSync.java 2011-07-16 16:05:37 UTC (rev 3589)
+++ trunk/LWJGL/src/java/org/lwjgl/opengles/EGLNVSync.java 2011-07-16 16:42:51 UTC (rev 3590)
@@ -32,6 +32,7 @@
package org.lwjgl.opengles;
import org.lwjgl.LWJGLException;
+import org.lwjgl.MemoryUtil;
import java.nio.IntBuffer;
@@ -112,7 +113,7 @@
public static EGLSyncNV eglCreateFenceSyncNV(EGLDisplay dpy, int condition, IntBuffer attrib_list) throws LWJGLException {
checkAttribList(attrib_list);
- final long pointer = neglCreateFenceSyncNV(dpy.getPointer(), condition, attrib_list, attrib_list == null ? 0 : attrib_list.position());
+ 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.");
@@ -120,7 +121,7 @@
return new EGLSyncNV(pointer);
}
- private static native long neglCreateFenceSyncNV(long dpy_ptr, int condition, IntBuffer attrib_list, int attrib_list_position);
+ private static native long neglCreateFenceSyncNV(long dpy_ptr, int condition, long attrib_list);
/**
* Destroys an existing sync object.
@@ -203,12 +204,12 @@
public static int eglGetSyncAttribNV(EGLSyncNV sync, int attribute) throws LWJGLException {
final IntBuffer value = APIUtil.getBufferInt();
- if ( !neglGetSyncAttribNV(sync.getPointer(), attribute, value, 0) )
+ 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, IntBuffer value, int value_position);
+ private static native boolean neglGetSyncAttribNV(long sync_ptr, int attribute, long value);
}
\ No newline at end of file
Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/NativeMethodStubsGenerator.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/generator/NativeMethodStubsGenerator.java 2011-07-16 16:05:37 UTC (rev 3589)
+++ trunk/LWJGL/src/java/org/lwjgl/util/generator/NativeMethodStubsGenerator.java 2011-07-16 16:42:51 UTC (rev 3590)
@@ -298,7 +298,7 @@
writer.print("\t" + native_type + param.getSimpleName());
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 + ")");
Modified: trunk/LWJGL/src/native/common/opengles/org_lwjgl_opengles_EGL.c
===================================================================
--- trunk/LWJGL/src/native/common/opengles/org_lwjgl_opengles_EGL.c 2011-07-16 16:05:37 UTC (rev 3589)
+++ trunk/LWJGL/src/native/common/opengles/org_lwjgl_opengles_EGL.c 2011-07-16 16:42:51 UTC (rev 3590)
@@ -43,9 +43,9 @@
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, jobject version, jint version_position) {
+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 *)(*env)->GetDirectBufferAddress(env, version)) + version_position;
+ EGLint *version_address = (EGLint *)(intptr_t)version;
return eglInitialize(dpy, version_address, version_address + 1);
}
@@ -65,43 +65,43 @@
return NewStringNativeWithLength(env, __result, strlen(__result));
}
-JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGL_neglGetConfigs(JNIEnv *env, jclass clazz, jlong dpy_ptr, jobject configs, jint configs_position, jint config_size, jobject num_config, jint num_config_position) {
+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 *)safeGetBufferAddress(env, configs)) + configs_position;
- EGLint *num_config_address = ((EGLint *)(*env)->GetDirectBufferAddress(env, num_config)) + num_config_position;
+ 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, jobject attrib_list, jint attrib_list_position, jobject configs, jint configs_position, jint config_size, jobject num_config, jint num_config_position) {
+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 *)safeGetBufferAddress(env, attrib_list)) + attrib_list_position;
- EGLConfig *configs_address = ((EGLConfig *)safeGetBufferAddress(env, configs)) + configs_position;
- EGLint *num_config_address = ((EGLint *)(*env)->GetDirectBufferAddress(env, num_config)) + num_config_position;
+ 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, jobject value, jint value_position) {
+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 *)(*env)->GetDirectBufferAddress(env, value)) + value_position;
+ 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, jobject attrib_list, jint attrib_list_position) {
+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 *)safeGetBufferAddress(env, attrib_list)) + attrib_list_position;
+ 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, jobject attrib_list, jint attrib_list_position) {
+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 *)safeGetBufferAddress(env, attrib_list)) + attrib_list_position;
+ const EGLint *attrib_list_address = (EGLint *)(intptr_t)attrib_list;
return (intptr_t)eglCreatePbufferSurface(dpy, config, attrib_list_address);
}
@@ -120,10 +120,10 @@
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, jobject value, jint value_position) {
+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 *)(*env)->GetDirectBufferAddress(env, value)) + value_position;
+ EGLint *value_address = (EGLint *)(intptr_t)value;
return eglQuerySurface(dpy, surface, attribute, value_address);
}
@@ -145,11 +145,11 @@
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, jobject attrib_list, jint attrib_list_position) {
+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 *)safeGetBufferAddress(env, attrib_list)) + attrib_list_position;
+ const EGLint *attrib_list_address = (EGLint *)(intptr_t)attrib_list;
return (intptr_t)eglCreateContext(dpy, config, share_context, attrib_list_address);
}
@@ -182,10 +182,10 @@
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, jobject value, jint value_position) {
+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 *)(*env)->GetDirectBufferAddress(env, value)) + value_position;
+ EGLint *value_address = (EGLint *)(intptr_t)value;
return eglQueryContext(dpy, ctx, attribute, value_address);
Modified: trunk/LWJGL/src/native/common/opengles/org_lwjgl_opengles_EGLKHRFenceSync.c
===================================================================
--- trunk/LWJGL/src/native/common/opengles/org_lwjgl_opengles_EGLKHRFenceSync.c 2011-07-16 16:05:37 UTC (rev 3589)
+++ trunk/LWJGL/src/native/common/opengles/org_lwjgl_opengles_EGLKHRFenceSync.c 2011-07-16 16:42:51 UTC (rev 3590)
@@ -40,9 +40,9 @@
static PFNEGLCLIENTWAITSYNCKHRPROC eglClientWaitSyncKHR;
static PFNEGLGETSYNCATTRIBKHRPROC eglGetSyncAttribKHR;
-JNIEXPORT jlong JNICALL Java_org_lwjgl_opengles_EGLKHRFenceSync_neglCreateSyncKHR(JNIEnv *env, jclass clazz, jlong dpy_ptr, jint type, jobject attrib_list, jint attrib_list_position) {
+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 *)safeGetBufferAddress(env, attrib_list)) + attrib_list_position;
+ const EGLint *attrib_list_address = (EGLint *)(intptr_t)attrib_list;
return (intptr_t)eglCreateSyncKHR(dpy, type, attrib_list_address);
}
@@ -61,20 +61,20 @@
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, jobject value, jint value_position) {
+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 *)(*env)->GetDirectBufferAddress(env, value)) + value_position;
+ 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", "(JILjava/nio/IntBuffer;I)J", (void *)&Java_org_lwjgl_opengles_EGLKHRFenceSync_neglCreateSyncKHR, "eglCreateSyncKHR", (void *)&eglCreateSyncKHR},
+ {"neglCreateSyncKHR", "(JIJ)J", (void *)&Java_org_lwjgl_opengles_EGLKHRFenceSync_neglCreateSyncKHR, "eglCreateSyncKHR", (void *)&eglCreateSyncKHR},
{"neglDestroySyncKHR", "(JJ)Z", (void *)&Java_org_lwjgl_opengles_EGLKHRFenceSync_neglDestroySyncKHR, "eglDestroySyncKHR", (void *)&eglDestroySyncKHR},
{"neglClientWaitSyncKHR", "(JJIJ)I", (void *)&Java_org_lwjgl_opengles_EGLKHRFenceSync_neglClientWaitSyncKHR, "eglClientWaitSyncKHR", (void *)&eglClientWaitSyncKHR},
- {"neglGetSyncAttribKHR", "(JJILjava/nio/IntBuffer;I)Z", (void *)&Java_org_lwjgl_opengles_EGLKHRFenceSync_neglGetSyncAttribKHR, "eglGetSyncAttribKHR", (void *)&eglGetSyncAttribKHR}
+ {"neglGetSyncAttribKHR", "(JJIJ)Z", (void *)&Java_org_lwjgl_opengles_EGLKHRFenceSync_neglGetSyncAttribKHR, "eglGetSyncAttribKHR", (void *)&eglGetSyncAttribKHR}
};
int num_functions = NUMFUNCTIONS(functions);
extgl_InitializeClass(env, clazz, num_functions, functions);
Modified: trunk/LWJGL/src/native/common/opengles/org_lwjgl_opengles_EGLNVSync.c
===================================================================
--- trunk/LWJGL/src/native/common/opengles/org_lwjgl_opengles_EGLNVSync.c 2011-07-16 16:05:37 UTC (rev 3589)
+++ trunk/LWJGL/src/native/common/opengles/org_lwjgl_opengles_EGLNVSync.c 2011-07-16 16:42:51 UTC (rev 3590)
@@ -42,9 +42,9 @@
static PFNEGLSIGNALSYNCNVPROC eglSignalSyncNV;
static PFNEGLGETSYNCATTRIBNVPROC eglGetSyncAttribNV;
-JNIEXPORT jlong JNICALL Java_org_lwjgl_opengles_EGLNVSync_neglCreateFenceSyncNV(JNIEnv *env, jclass clazz, jlong dpy_ptr, jint condition, jobject attrib_list, jint attrib_list_position) {
+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 *)safeGetBufferAddress(env, attrib_list)) + attrib_list_position;
+ const EGLint *attrib_list_address = (EGLint *)(intptr_t)attrib_list;
return (intptr_t)eglCreateFenceSyncNV(dpy, condition, attrib_list_address);
}
@@ -73,21 +73,21 @@
return eglSignalSyncNV(sync, mode);
}
-JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengles_EGLNVSync_neglGetSyncAttribNV(JNIEnv *env, jclass clazz, jlong sync_ptr, jint attribute, jobject value, jint value_position) {
+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 *)(*env)->GetDirectBufferAddress(env, value)) + value_position;
+ 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", "(JILjava/nio/IntBuffer;I)J", (void *)&Java_org_lwjgl_opengles_EGLNVSync_neglCreateFenceSyncNV, "eglCreateFenceSyncNV", (void *)&eglCreateFenceSyncNV},
+ {"neglCreateFenceSyncNV", "(JIJ)J", (void *)&Java_org_lwjgl_opengles_EGLNVSync_neglCreateFenceSyncNV, "eglCreateFenceSyncNV", (void *)&eglCreateFenceSyncNV},
{"neglDestroySyncNV", "(J)Z", (void *)&Java_org_lwjgl_opengles_EGLNVSync_neglDestroySyncNV, "eglDestroySyncNV", (void *)&eglDestroySyncNV},
{"neglFenceNV", "(J)Z", (void *)&Java_org_lwjgl_opengles_EGLNVSync_neglFenceNV, "eglFenceNV", (void *)&eglFenceNV},
{"neglClientWaitSyncNV", "(JIJ)I", (void *)&Java_org_lwjgl_opengles_EGLNVSync_neglClientWaitSyncNV, "eglClientWaitSyncNV", (void *)&eglClientWaitSyncNV},
{"neglSignalSyncNV", "(JI)Z", (void *)&Java_org_lwjgl_opengles_EGLNVSync_neglSignalSyncNV, "eglSignalSyncNV", (void *)&eglSignalSyncNV},
- {"neglGetSyncAttribNV", "(JILjava/nio/IntBuffer;I)Z", (void *)&Java_org_lwjgl_opengles_EGLNVSync_neglGetSyncAttribNV, "eglGetSyncAttribNV", (void *)&eglGetSyncAttribNV}
+ {"neglGetSyncAttribNV", "(JIJ)Z", (void *)&Java_org_lwjgl_opengles_EGLNVSync_neglGetSyncAttribNV, "eglGetSyncAttribNV", (void *)&eglGetSyncAttribNV}
};
int num_functions = NUMFUNCTIONS(functions);
extgl_InitializeClass(env, clazz, num_functions, functions);
Modified: trunk/LWJGL/src/native/common/org_lwjgl_openal_ALC10.c
===================================================================
--- trunk/LWJGL/src/native/common/org_lwjgl_openal_ALC10.c 2011-07-16 16:05:37 UTC (rev 3589)
+++ trunk/LWJGL/src/native/common/org_lwjgl_openal_ALC10.c 2011-07-16 16:42:51 UTC (rev 3590)
@@ -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 <br...@ma...>
* @version $Revision: 2279 $
*/
@@ -103,8 +103,8 @@
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;
@@ -116,21 +116,18 @@
/**
* 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 );
*/
@@ -156,7 +153,7 @@
/**
* This function closes a device by name.
- *
+ *
* C Specification:
* bool alcCloseDevice( ALCdevice *dev );
*/
@@ -166,19 +163,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 +189,7 @@
/**
* This function tells a context to begin processing.
- *
+ *
* C Specification:
* void alcProcessContext(ALCcontext *context);
*/
@@ -205,7 +199,7 @@
/**
* This function retrieves the current context.
- *
+ *
* C Specification:
* ALCcontext* alcGetCurrentContext( ALvoid );
*/
@@ -216,7 +210,7 @@
/**
* This function retrieves the specified contexts device
- *
+ *
* C Specification:
* ALCdevice* alcGetContextsDevice(ALCcontext *context);
*/
@@ -237,7 +231,7 @@
/**
* This function destroys a context.
- *
+ *
* C Specification:
* void alcDestroyContext(ALCcontext *context);
*/
@@ -247,7 +241,7 @@
/**
* This function retrieves the specified devices context error state.
- *
+ *
* C Specification:
* ALCenum alcGetError(ALCdevice *device);
*/
@@ -257,18 +251,18 @@
/**
* 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;
}
@@ -278,14 +272,14 @@
* 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) {
+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;
}
Modified: trunk/LWJGL/src/native/common/org_lwjgl_openal_ALC11.c
===================================================================
--- trunk/LWJGL/src/native/common/org_lwjgl_openal_ALC11.c 2011-07-16 16:05:37 UTC (rev 3589)
+++ trunk/LWJGL/src/native/common/org_lwjgl_openal_ALC11.c 2011-07-16 16:42:51 UTC (rev 3590)
@@ -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 <br...@ma...>
* @version $Revision: 2279 $
*/
@@ -106,8 +106,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);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sp...@us...> - 2011-07-16 16:05:47
|
Revision: 3589
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3589&view=rev
Author: spasi
Date: 2011-07-16 16:05:37 +0000 (Sat, 16 Jul 2011)
Log Message:
-----------
Moved all pointer arithmetic to Java code.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/PointerBuffer.java
trunk/LWJGL/src/java/org/lwjgl/opencl/APIUtil.java
trunk/LWJGL/src/java/org/lwjgl/opencl/InfoUtilFactory.java
trunk/LWJGL/src/java/org/lwjgl/opengl/APIUtil.java
trunk/LWJGL/src/java/org/lwjgl/opengles/APIUtil.java
trunk/LWJGL/src/java/org/lwjgl/test/mapped/MappedObjectTests3.java
trunk/LWJGL/src/java/org/lwjgl/test/opengl/sprites/SpriteShootout.java
trunk/LWJGL/src/java/org/lwjgl/test/opengl/sprites/SpriteShootout2P.java
trunk/LWJGL/src/java/org/lwjgl/test/opengl/sprites/SpriteShootoutCL.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/JNITypeTranslator.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/NativeMethodStubsGenerator.java
trunk/LWJGL/src/templates/org/lwjgl/opencl/CL10.java
trunk/LWJGL/src/templates/org/lwjgl/opencl/CL10GL.java
trunk/LWJGL/src/templates/org/lwjgl/opencl/EXT_migrate_memobject.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/AMD_name_gen_delete.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/AMD_performance_monitor.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_fence.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_vertex_array_object.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_buffer_object.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_draw_buffers.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_framebuffer_object.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_occlusion_query.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_program.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_sampler_objects.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_separate_shader_objects.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shader_objects.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shading_language_include.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_transform_feedback2.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_vertex_array_object.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_vertex_shader.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/ATI_draw_buffers.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_direct_state_access.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_framebuffer_object.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_texture_integer.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_transform_feedback.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/GL11.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/GL15.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/GL20.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/GL30.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/GL31.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/GL32.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/GL33.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/GL40.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/GL41.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_fence.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_occlusion_query.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_program.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_transform_feedback.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_transform_feedback2.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/AMD_performance_monitor.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/ARB_draw_buffers.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/GLES20.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/NV_draw_buffers.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/NV_fence.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/OES_framebuffer_object.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/OES_vertex_array_object.java
trunk/LWJGL/src/templates/org/lwjgl/opengles/QCOM_driver_control.java
Added Paths:
-----------
trunk/LWJGL/src/java/org/lwjgl/MemoryUtil.java
trunk/LWJGL/src/java/org/lwjgl/MemoryUtilSun.java
trunk/LWJGL/src/java/org/lwjgl/test/opengl/sprites/StreamVBO.java
Added: trunk/LWJGL/src/java/org/lwjgl/MemoryUtil.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/MemoryUtil.java (rev 0)
+++ trunk/LWJGL/src/java/org/lwjgl/MemoryUtil.java 2011-07-16 16:05:37 UTC (rev 3589)
@@ -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;
+
+import java.lang.reflect.Field;
+import java.nio.*;
+
+/**
+ * [INTERNAL USE ONLY]
+ * <p/>
+ * This class provides utility methods for passing buffer addresses to JNI API calls.
+ *
+ * @author Spasi
+ */
+public final class MemoryUtil {
+
+ 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");
+ util = new AccessorJNI();
+ } 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() {
+ }
+
+ public static String wrap(final String test) {
+ return "MemoryUtil.getAddress(" + test + ")";
+ }
+
+ /**
+ * 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); }
+
+ 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(Class<?> type, final String fieldName) throws NoSuchFieldException {
+ while ( type != null ) {
+ try {
+ return type.getDeclaredField(fieldName);
+ } catch (NoSuchFieldException e) {
+ type = type.getSuperclass();
+ }
+ }
+
+ throw new NoSuchFieldException(fieldName + " does not exist in " + type.getSimpleName() + " or any of its superclasses.");
+ }
+
+}
\ No newline at end of file
Added: trunk/LWJGL/src/java/org/lwjgl/MemoryUtilSun.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/MemoryUtilSun.java (rev 0)
+++ trunk/LWJGL/src/java/org/lwjgl/MemoryUtilSun.java 2011-07-16 16:05:37 UTC (rev 3589)
@@ -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
Modified: trunk/LWJGL/src/java/org/lwjgl/PointerBuffer.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/PointerBuffer.java 2011-07-14 23:11:41 UTC (rev 3588)
+++ trunk/LWJGL/src/java/org/lwjgl/PointerBuffer.java 2011-07-16 16:05:37 UTC (rev 3589)
@@ -99,7 +99,7 @@
throw new IllegalArgumentException("The source buffer is not direct.");
final int alignment = is64Bit ? 8 : 4;
- if ( (BufferUtils.getBufferAddress(source) + source.position()) % alignment != 0 || source.remaining() % alignment != 0 )
+ if ( (MemoryUtil.getAddress0(source) + source.position()) % alignment != 0 || source.remaining() % alignment != 0 )
throw new IllegalArgumentException("The source buffer is not aligned to " + alignment + " bytes.");
}
Modified: trunk/LWJGL/src/java/org/lwjgl/opencl/APIUtil.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opencl/APIUtil.java 2011-07-14 23:11:41 UTC (rev 3588)
+++ trunk/LWJGL/src/java/org/lwjgl/opencl/APIUtil.java 2011-07-16 16:05:37 UTC (rev 3589)
@@ -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;
@@ -513,25 +519,25 @@
}
}
- private static final ObjectDestructor<CLDevice> DESTRUCTOR_CLSubDevice = new ObjectDestructor<CLDevice>() {
+ private static final ObjectDestructor<CLDevice> DESTRUCTOR_CLSubDevice = new ObjectDestructor<CLDevice>() {
public void release(final CLDevice object) { clReleaseDeviceEXT(object); }
};
- private static final ObjectDestructor<CLMem> DESTRUCTOR_CLMem = new ObjectDestructor<CLMem>() {
+ private static final ObjectDestructor<CLMem> DESTRUCTOR_CLMem = new ObjectDestructor<CLMem>() {
public void release(final CLMem object) { clReleaseMemObject(object); }
};
private static final ObjectDestructor<CLCommandQueue> DESTRUCTOR_CLCommandQueue = new ObjectDestructor<CLCommandQueue>() {
public void release(final CLCommandQueue object) { clReleaseCommandQueue(object); }
};
- private static final ObjectDestructor<CLSampler> DESTRUCTOR_CLSampler = new ObjectDestructor<CLSampler>() {
+ private static final ObjectDestructor<CLSampler> DESTRUCTOR_CLSampler = new ObjectDestructor<CLSampler>() {
public void release(final CLSampler object) { clReleaseSampler(object); }
};
- private static final ObjectDestructor<CLProgram> DESTRUCTOR_CLProgram = new ObjectDestructor<CLProgram>() {
+ private static final ObjectDestructor<CLProgram> DESTRUCTOR_CLProgram = new ObjectDestructor<CLProgram>() {
public void release(final CLProgram object) { clReleaseProgram(object); }
};
- private static final ObjectDestructor<CLKernel> DESTRUCTOR_CLKernel = new ObjectDestructor<CLKernel>() {
+ private static final ObjectDestructor<CLKernel> DESTRUCTOR_CLKernel = new ObjectDestructor<CLKernel>() {
public void release(final CLKernel object) { clReleaseKernel(object); }
};
- private static final ObjectDestructor<CLEvent> DESTRUCTOR_CLEvent = new ObjectDestructor<CLEvent>() {
+ private static final ObjectDestructor<CLEvent> DESTRUCTOR_CLEvent = new ObjectDestructor<CLEvent>() {
public void release(final CLEvent object) { clReleaseEvent(object); }
};
Modified: trunk/LWJGL/src/java/org/lwjgl/opencl/InfoUtilFactory.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opencl/InfoUtilFactory.java 2011-07-14 23:11:41 UTC (rev 3588)
+++ trunk/LWJGL/src/java/org/lwjgl/opencl/InfoUtilFactory.java 2011-07-16 16:05:37 UTC (rev 3589)
@@ -118,7 +118,7 @@
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, 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;
@@ -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;
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/APIUtil.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/APIUtil.java 2011-07-14 23:11:41 UTC (rev 3588)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/APIUtil.java 2011-07-16 16:05:37 UTC (rev 3589)
@@ -33,6 +33,7 @@
import org.lwjgl.BufferUtils;
import org.lwjgl.LWJGLUtil;
+import org.lwjgl.MemoryUtil;
import java.nio.*;
@@ -185,10 +186,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);
}
/**
@@ -198,10 +199,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);
}
/**
@@ -211,11 +212,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) {
@@ -233,14 +234,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);
}
/**
@@ -250,7 +251,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 ) {
@@ -259,7 +260,7 @@
}
buffer.flip();
- return buffer;
+ return MemoryUtil.getAddress0(buffer);
}
/**
@@ -269,16 +270,24 @@
*
* @return the String lengths in an IntBuffer
*/
- static IntBuffer getLengths(final CharSequence[] strings) {
+ static long getLengths(final CharSequence[] strings) {
IntBuffer buffer = getLengths(strings.length);
for ( CharSequence string : strings )
buffer.put(string.length());
buffer.flip();
- return buffer;
+ return MemoryUtil.getAddress0(buffer);
}
+ static long getInt(final int value) {
+ return MemoryUtil.getAddress0(getBufferInt().put(0, value));
+ }
+
+ static long getBufferByte0() {
+ return MemoryUtil.getAddress0(getBufferByte(0));
+ }
+
private static class Buffers {
final ShortBuffer shorts;
Modified: trunk/LWJGL/src/java/org/lwjgl/opengles/APIUtil.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengles/APIUtil.java 2011-07-14 23:11:41 UTC (rev 3588)
+++ trunk/LWJGL/src/java/org/lwjgl/opengles/APIUtil.java 2011-07-16 16:05:37 UTC (rev 3589)
@@ -33,6 +33,7 @@
import org.lwjgl.BufferUtils;
import org.lwjgl.LWJGLUtil;
+import org.lwjgl.MemoryUtil;
import org.lwjgl.PointerBuffer;
import java.nio.ByteBuffer;
@@ -207,10 +208,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);
}
/**
@@ -220,10 +221,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);
}
/**
@@ -233,11 +234,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) {
@@ -255,14 +256,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);
}
/**
@@ -272,7 +273,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 ) {
@@ -281,7 +282,7 @@
}
buffer.flip();
- return buffer;
+ return MemoryUtil.getAddress0(buffer);
}
/**
@@ -291,16 +292,24 @@
*
* @return the String lengths in an IntBuffer
*/
- static IntBuffer getLengths(final CharSequence[] strings) {
+ static long getLengths(final CharSequence[] strings) {
IntBuffer buffer = getLengths(strings.length);
for ( CharSequence string : strings )
buffer.put(string.length());
buffer.flip();
- return buffer;
+ 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 ShortBuffer shorts;
Modified: trunk/LWJGL/src/java/org/lwjgl/test/mapped/MappedObjectTests3.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/test/mapped/MappedObjectTests3.java 2011-07-14 23:11:41 UTC (rev 3588)
+++ trunk/LWJGL/src/java/org/lwjgl/test/mapped/MappedObjectTests3.java 2011-07-16 16:05:37 UTC (rev 3589)
@@ -118,6 +118,10 @@
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
Modified: trunk/LWJGL/src/java/org/lwjgl/test/opengl/sprites/SpriteShootout.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/test/opengl/sprites/SpriteShootout.java 2011-07-14 23:11:41 UTC (rev 3588)
+++ trunk/LWJGL/src/java/org/lwjgl/test/opengl/sprites/SpriteShootout.java 2011-07-16 16:05:37 UTC (rev 3589)
@@ -1,3 +1,34 @@
+/*
+ * 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;
@@ -33,8 +64,8 @@
*/
public final class SpriteShootout {
- private static final int SCREEN_WIDTH = 800;
- private static final int SCREEN_HEIGHT = 600;
+ static final int SCREEN_WIDTH = 800;
+ static final int SCREEN_HEIGHT = 600;
private static final int ANIMATION_TICKS = 60;
@@ -45,8 +76,8 @@
private boolean smooth;
private boolean vsync;
- private int ballSize = 42;
- private int ballCount = 100 * 1000;
+ int ballSize = 42;
+ int ballCount = 100 * 1000;
private SpriteRenderer renderer;
@@ -401,43 +432,45 @@
transform = newTransform;
}
- protected void animate(final FloatBuffer geom, final int ballIndex, final int batchSize, final int delta) {
- final float[] transform = this.transform;
-
+ 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 = transform[b + 0];
- float dx = transform[b + 2];
+ float x = sprites[b + 0];
+ float dx = sprites[b + 2];
x += dx * delta;
if ( x < ballRadius ) {
x = ballRadius;
- transform[b + 2] = -dx;
+ sprites[b + 2] = -dx;
} else if ( x > boundW ) {
x = boundW;
- transform[b + 2] = -dx;
+ sprites[b + 2] = -dx;
}
- transform[b + 0] = x;
+ sprites[b + 0] = x;
- float y = transform[b + 1];
- float dy = transform[b + 3];
+ float y = sprites[b + 1];
+ float dy = sprites[b + 3];
y += dy * delta;
if ( y < ballRadius ) {
y = ballRadius;
- transform[b + 3] = -dy;
+ sprites[b + 3] = -dy;
} else if ( y > boundH ) {
y = boundH;
- transform[b + 3] = -dy;
+ sprites[b + 3] = -dy;
}
- transform[b + 1] = y;
+ sprites[b + 1] = y;
- geom.put(x).put(y);
+ spritesRender.put(x).put(y);
}
- geom.clear();
+ spritesRender.clear();
}
protected abstract void render(boolean render, boolean animate, int delta);
@@ -517,8 +550,9 @@
}
private void animate(final int ballIndex, final int batchSize, final int delta) {
- animate(geom, ballIndex, batchSize, 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);
}
@@ -526,11 +560,8 @@
private class SpriteRendererMapped extends SpriteRendererBatched {
- private ByteBuffer[] mapBuffer;
- private FloatBuffer[] geomBuffer;
+ private StreamVBO animVBO;
- protected int animVBO;
-
SpriteRendererMapped() {
System.out.println("Shootout Implementation: CPU animation & MapBufferRange");
}
@@ -538,41 +569,29 @@
public void updateBalls(final int count) {
super.updateBalls(count);
- final int batchCount = count / BALLS_PER_BATCH + (count % BALLS_PER_BATCH == 0 ? 0 : 1);
- mapBuffer = new ByteBuffer[batchCount];
- geomBuffer = new FloatBuffer[batchCount];
+ if ( animVBO != null )
+ animVBO.destroy();
- animVBO = glGenBuffers();
- glBindBuffer(GL_ARRAY_BUFFER, animVBO);
- glBufferData(GL_ARRAY_BUFFER, ballCount * (2 * 4), GL_DYNAMIC_DRAW);
- glVertexPointer(2, GL_FLOAT, 0, 0);
+ 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;
- int batchIndex = 0;
while ( ballIndex < ballCount ) {
if ( animate ) {
- final ByteBuffer buffer = glMapBufferRange(GL_ARRAY_BUFFER,
- ballIndex * (2 * 4),
- batchSize * (2 * 4),
- GL_MAP_WRITE_BIT | GL_MAP_UNSYNCHRONIZED_BIT,
- mapBuffer[batchIndex]);
- if ( buffer != mapBuffer[batchIndex] ) {
- mapBuffer[batchIndex] = buffer;
- geomBuffer[batchIndex] = mapBuffer[batchIndex].asFloatBuffer();
- }
+ final ByteBuffer buffer = animVBO.map(batchSize * (2 * 4));
- animate(geomBuffer[batchIndex], ballIndex, batchSize, delta);
+ animate(transform, buffer.asFloatBuffer(), ballSize, ballIndex, batchSize, delta);
- glUnmapBuffer(GL_ARRAY_BUFFER);
+ animVBO.unmap();
}
- if ( render )
- glDrawArrays(GL_POINTS, ballIndex, batchSize);
+ if ( render ) {
+ glVertexPointer(2, GL_FLOAT, 0, ballIndex * (2 * 4));
+ glDrawArrays(GL_POINTS, 0, batchSize);
+ }
- batchIndex++;
ballIndex += batchSize;
batchSize = Math.min(ballCount - ballIndex, BALLS_PER_BATCH);
}
@@ -653,6 +672,13 @@
}
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 ) {
@@ -660,14 +686,14 @@
glDeleteBuffers(tfVBO[i]);
}
- final FloatBuffer transform = BufferUtils.createFloatBuffer(count * 4);
- transform.put(this.transform);
- transform.flip();
+ 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, transform, GL_STATIC_DRAW);
+ glBufferData(GL_TRANSFORM_FEEDBACK_BUFFER, state, GL_STATIC_DRAW);
}
glBindBuffer(GL_ARRAY_BUFFER, tfVBO[0]);
Modified: trunk/LWJGL/src/java/org/lwjgl/test/opengl/sprites/SpriteShootout2P.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/test/opengl/sprites/SpriteShootout2P.java 2011-07-14 23:11:41 UTC (rev 3588)
+++ trunk/LWJGL/src/java/org/lwjgl/test/opengl/sprites/SpriteShootout2P.java 2011-07-16 16:05:37 UTC (rev 3589)
@@ -1,3 +1,34 @@
+/*
+ * 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;
Modified: trunk/LWJGL/src/java/org/lwjgl/test/opengl/sprites/SpriteShootoutCL.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/test/opengl/sprites/SpriteShootoutCL.java 2011-07-14 23:11:41 UTC (rev 3588)
+++ trunk/LWJGL/src/java/org/lwjgl/test/opengl/sprites/SpriteShootoutCL.java 2011-07-16 16:05:37 UTC (rev 3589)
@@ -1,3 +1,34 @@
+/*
+ * 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;
Added: trunk/LWJGL/src/java/org/lwjgl/test/opengl/sprites/StreamVBO.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/test/opengl/sprites/StreamVBO.java (rev 0)
+++ trunk/LWJGL/src/java/org/lwjgl/test/opengl/sprites/StreamVBO.java 2011-07-16 16:05:37 UTC (rev 3589)
@@ -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
Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/JNITypeTranslator.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/generator/JNITypeTranslator.java 2011-07-14 23:11:41 UTC (rev 3588)
+++ trunk/LWJGL/src/java/org/lwjgl/util/generator/JNITypeTranslator.java 2011-07-16 16:05:37 UTC (rev 3589)
@@ -32,6 +32,10 @@
package org.lwjgl.util.generator;
+import org.lwjgl.PointerBuffer;
+
+import java.nio.Buffer;
+
import com.sun.mirror.type.*;
import com.sun.mirror.util.*;
@@ -45,12 +49,19 @@
* $Id$
*/
public class JNITypeTranslator implements TypeVisitor {
+
private final StringBuilder signature = new StringBuilder();
+ private boolean objectReturn;
+
public String getSignature() {
return signature.toString();
}
+ public String getReturnSignature() {
+ return objectReturn ? "jobject" : signature.toString();
+ }
+
public void visitAnnotationType(AnnotationType t) {
throw new RuntimeException(t + " is not allowed");
}
@@ -68,7 +79,12 @@
}
public void visitClassType(ClassType t) {
- signature.append("jobject");
+ 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 visitDeclaredType(DeclaredType t) {
Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java 2011-07-14 23:11:41 UTC (rev 3588)
+++ trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java 2011-07-16 16:05:37 UTC (rev 3589)
@@ -194,8 +194,8 @@
writer.print("long ");
else {
Class type = type_info.getType();
- if ( native_stub && (type == CharSequence.class || type == CharSequence[].class || type == PointerBuffer.class) )
- writer.print("ByteBuffer ");
+ 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_info.getType().getSimpleName() + " ");
}
@@ -203,8 +203,6 @@
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;
}
@@ -490,7 +488,7 @@
Check check_annotation = param.getAnnotation(Check.class);
boolean hide_buffer = mode == Mode.AUTOS && getAutoTypeParameter(method, param) != null;
if (hide_buffer) {
- writer.print("null");
+ writer.print("0L");
} else {
if ( type == CharSequence.class || type == CharSequence[].class ) {
final String offset = Utils.getStringOffset(method, param);
@@ -502,48 +500,25 @@
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 )
writer.print(auto_size_annotation.value() + "_");
- writer.print(param.getSimpleName());
- if ( PointerBuffer.class.isAssignableFrom(type) ) {
+
+ final Class buffer_type = Utils.getNIOBufferType(param.getType());
+ if ( buffer_type == null )
+ writer.print(param.getSimpleName());
+ else {
+ writer.print("MemoryUtil.getAddress");
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");
+ 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 && param.getAnnotation(NativeType.class).value().endsWith("void") )
- 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() )
Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/NativeMethodStubsGenerator.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/generator/NativeMethodStubsGenerator.java 2011-07-14 23:11:41 UTC (rev 3588)
+++ trunk/LWJGL/src/java/org/lwjgl/util/generator/NativeMethodStubsGenerator.java 2011-07-16 16:05:37 UTC (rev 3589)
@@ -88,8 +88,6 @@
JNITypeTranslator translator = new JNITypeTranslator();
param.getType().accept(translator);
writer.print(translator.getSignature() + " " + param.getSimpleName());
- if (Utils.getNIOBufferType(param.getType()) != null)
- writer.print(", jint " + param.getSimpleName() + BUFFER_POSITION_POSTFIX);
}
}
@@ -108,7 +106,7 @@
} else {
JNITypeTranslator translator = new JNITypeTranslator();
result_type.accept(translator);
- writer.print(translator.getSignature());
+ writer.print(translator.getReturnSignature());
}
writer.print(" JNICALL ");
@@ -298,30 +296,17 @@
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(")");
if (mode == Mode.BUFFEROBJECT && param.getAnnotation(BufferObject.class) != null) {
- writer.print("offsetToPointer(" + param.getSimpleNa...
[truncated message content] |