Widened VBO/PBO buffer offsets and sizes to long to better match the GLsizeiptr and GLintptr native types

This commit is contained in:
Elias Naur 2006-02-26 11:44:34 +00:00
parent d492cbde20
commit d7c55744ce
50 changed files with 257 additions and 245 deletions

View file

@ -59,21 +59,21 @@ public class GLTypeMap implements TypeMap {
native_types_to_primitive.put(GLfloat.class, PrimitiveType.Kind.FLOAT);
native_types_to_primitive.put(GLint.class, PrimitiveType.Kind.INT);
native_types_to_primitive.put(GLshort.class, PrimitiveType.Kind.SHORT);
native_types_to_primitive.put(GLsizeiptr.class, PrimitiveType.Kind.INT);
native_types_to_primitive.put(GLsizeiptr.class, PrimitiveType.Kind.LONG);
native_types_to_primitive.put(GLuint.class, PrimitiveType.Kind.INT);
native_types_to_primitive.put(GLboolean.class, PrimitiveType.Kind.BOOLEAN);
native_types_to_primitive.put(GLchar.class, PrimitiveType.Kind.BYTE);
native_types_to_primitive.put(GLdouble.class, PrimitiveType.Kind.DOUBLE);
native_types_to_primitive.put(GLhalf.class, PrimitiveType.Kind.SHORT);
native_types_to_primitive.put(GLintptrARB.class, PrimitiveType.Kind.INT);
native_types_to_primitive.put(GLintptrARB.class, PrimitiveType.Kind.LONG);
native_types_to_primitive.put(GLsizei.class, PrimitiveType.Kind.INT);
native_types_to_primitive.put(GLushort.class, PrimitiveType.Kind.SHORT);
native_types_to_primitive.put(GLbyte.class, PrimitiveType.Kind.BYTE);
native_types_to_primitive.put(GLclampd.class, PrimitiveType.Kind.DOUBLE);
native_types_to_primitive.put(GLenum.class, PrimitiveType.Kind.INT);
native_types_to_primitive.put(GLhandleARB.class, PrimitiveType.Kind.INT);
native_types_to_primitive.put(GLintptr.class, PrimitiveType.Kind.INT);
native_types_to_primitive.put(GLsizeiptrARB.class, PrimitiveType.Kind.INT);
native_types_to_primitive.put(GLintptr.class, PrimitiveType.Kind.LONG);
native_types_to_primitive.put(GLsizeiptrARB.class, PrimitiveType.Kind.LONG);
native_types_to_primitive.put(GLubyte.class, PrimitiveType.Kind.BYTE);
native_types_to_primitive.put(GLvoid.class, PrimitiveType.Kind.BYTE);
}
@ -172,8 +172,8 @@ public class GLTypeMap implements TypeMap {
private static Class[] getValidBufferTypes(Class type) {
if (type.equals(IntBuffer.class))
return new Class[]{GLbitfield.class, GLenum.class, GLhandleARB.class, GLint.class, GLintptrARB.class, GLintptrARB.class,
GLsizei.class, GLsizeiptrARB.class, GLsizeiptr.class, GLuint.class};
return new Class[]{GLbitfield.class, GLenum.class, GLhandleARB.class, GLint.class,
GLsizei.class, GLuint.class};
else if (type.equals(FloatBuffer.class))
return new Class[]{GLclampf.class, GLfloat.class};
else if (type.equals(ByteBuffer.class))
@ -187,9 +187,11 @@ public class GLTypeMap implements TypeMap {
}
private static Class[] getValidPrimitiveTypes(Class type) {
if (type.equals(int.class))
return new Class[]{GLbitfield.class, GLenum.class, GLhandleARB.class, GLint.class, GLintptrARB.class, GLuint.class,
GLintptr.class, GLintptr.class, GLsizei.class, GLsizeiptrARB.class, GLsizeiptr.class};
if (type.equals(long .class))
return new Class[]{GLintptrARB.class, GLuint.class, GLintptr.class, GLsizeiptrARB.class, GLsizeiptr.class};
else if (type.equals(int.class))
return new Class[]{GLbitfield.class, GLenum.class, GLhandleARB.class, GLint.class, GLuint.class,
GLsizei.class};
else if (type.equals(double.class))
return new Class[]{GLclampd.class, GLdouble.class};
else if (type.equals(float.class))

View file

@ -78,6 +78,9 @@ public class JNITypeTranslator implements TypeVisitor {
public void visitPrimitiveType(PrimitiveType t) {
String type;
switch (t.getKind()) {
case LONG:
type = "jlong";
break;
case INT:
type = "jint";
break;

View file

@ -141,7 +141,7 @@ public class JavaMethodsGenerator {
if (bo_annotation != null && mode == Mode.BUFFEROBJECT) {
if (buffer_type == null)
throw new RuntimeException("type of " + param + " is not a nio Buffer parameter but is annotated as buffer object");
writer.print("int " + param.getSimpleName() + Utils.BUFFER_OBJECT_PARAMETER_POSTFIX);
writer.print("long " + param.getSimpleName() + Utils.BUFFER_OBJECT_PARAMETER_POSTFIX);
} else {
writer.print(type_info.getType().getSimpleName());
writer.print(" " + param.getSimpleName());

View file

@ -61,6 +61,9 @@ public class JavaTypeTranslator implements TypeVisitor {
public void visitPrimitiveType(PrimitiveType t) {
switch (t.getKind()) {
case LONG:
type = long.class;
break;
case INT:
type = int.class;
break;

View file

@ -70,7 +70,7 @@ public class NativeMethodStubsGenerator {
private static void generateParameter(PrintWriter writer, ParameterDeclaration param, Mode mode) {
writer.print(", ");
if (mode == Mode.BUFFEROBJECT && param.getAnnotation(BufferObject.class) != null) {
writer.print("jint " + param.getSimpleName() + Utils.BUFFER_OBJECT_PARAMETER_POSTFIX);
writer.print("jlong " + param.getSimpleName() + Utils.BUFFER_OBJECT_PARAMETER_POSTFIX);
} else {
JNITypeTranslator translator = new JNITypeTranslator();
param.getType().accept(translator);

View file

@ -77,6 +77,9 @@ public class TypeInfo {
private static Class getTypeFromPrimitiveKind(PrimitiveType.Kind kind) {
Class type;
switch (kind) {
case LONG:
type = long.class;
break;
case INT:
type = int.class;
break;