mirror of
https://github.com/shadowfacts/lwjgl2-arm64.git
synced 2026-04-08 07:54:05 +00:00
Added support for OpenGL 3.2 and the following extensions: AMD_draw_buffers_blend, ARB_depth_clamp, ARB_draw_buffers_blend, ARB_draw_elements_base_vertex, ARB_fragment_coord_conventions, ARB_provoking_vertex, ARB_sample_shading, ARB_seamless_cube_map, ARB_shader_texture_lod, ARB_texture_cube_map_array, ARB_texture_gather, ARB_texture_multisample, ARB_texture_query_lod, ARB_vertex_array_bgra, EXT_separate_shader_objects, EXT_texture_snorm, NV_copy_image, NV_parameter_buffer_object2.
This commit is contained in:
parent
b37909187e
commit
b130c415f7
29 changed files with 1565 additions and 91 deletions
|
|
@ -48,7 +48,7 @@ import java.nio.IntBuffer;
|
|||
* implementation. Developers may encounter debug contexts being the same as non-debug contexts or forward compatible
|
||||
* contexts having support for deprecated functionality.
|
||||
* <p/>
|
||||
* Warning: This functionality is currently available on the Windows platform only. However, if the forwardCompatible
|
||||
* If the forwardCompatible
|
||||
* attribute is used, LWJGL will not load the deprecated functionality (as defined in the OpenGL 3.0 specification). This
|
||||
* means that developers can start working on cleaning up their applications without an OpenGL 3.0 complaint driver.
|
||||
*
|
||||
|
|
@ -64,6 +64,9 @@ public final class ContextAttribs {
|
|||
private boolean debug;
|
||||
private boolean forwardCompatible;
|
||||
|
||||
private boolean profileCore;
|
||||
private boolean profileCompatibility;
|
||||
|
||||
public ContextAttribs() {
|
||||
this(1, 0);
|
||||
}
|
||||
|
|
@ -72,7 +75,7 @@ public final class ContextAttribs {
|
|||
if ( majorVersion < 0 ||
|
||||
3 < majorVersion ||
|
||||
minorVersion < 0 ||
|
||||
(majorVersion == 3 && 1 < minorVersion) ||
|
||||
(majorVersion == 3 && 2 < minorVersion) ||
|
||||
(majorVersion == 2 && 1 < minorVersion) ||
|
||||
(majorVersion == 1 && 5 < minorVersion) )
|
||||
throw new IllegalArgumentException("Invalid OpenGL version specified: " + majorVersion + '.' + minorVersion);
|
||||
|
|
@ -84,6 +87,9 @@ public final class ContextAttribs {
|
|||
|
||||
this.debug = false;
|
||||
this.forwardCompatible = false;
|
||||
|
||||
this.profileCore = 3 < majorVersion || (majorVersion == 3 && 2 <= minorVersion) ? true : false;
|
||||
this.profileCompatibility = false;
|
||||
}
|
||||
|
||||
private ContextAttribs(final ContextAttribs attribs) {
|
||||
|
|
@ -94,6 +100,9 @@ public final class ContextAttribs {
|
|||
|
||||
this.debug = attribs.debug;
|
||||
this.forwardCompatible = attribs.forwardCompatible;
|
||||
|
||||
this.profileCore = attribs.profileCore;
|
||||
this.profileCompatibility = attribs.profileCompatibility;
|
||||
}
|
||||
|
||||
public int getMajorVersion() {
|
||||
|
|
@ -116,27 +125,74 @@ public final class ContextAttribs {
|
|||
return forwardCompatible;
|
||||
}
|
||||
|
||||
public boolean isProfileCore() {
|
||||
return profileCore;
|
||||
}
|
||||
|
||||
public boolean isProfileCompatibility() {
|
||||
return profileCompatibility;
|
||||
}
|
||||
|
||||
public ContextAttribs withLayer(final int layerPlane) {
|
||||
if ( layerPlane < 0 )
|
||||
throw new IllegalArgumentException("Invalid layer plane specified: " + layerPlane);
|
||||
|
||||
if ( layerPlane == this.layerPlane )
|
||||
return this;
|
||||
|
||||
final ContextAttribs attribs = new ContextAttribs(this);
|
||||
attribs.layerPlane = layerPlane;
|
||||
return attribs;
|
||||
}
|
||||
|
||||
public ContextAttribs withDebug(final boolean debug) {
|
||||
if ( debug == this.debug )
|
||||
return this;
|
||||
|
||||
final ContextAttribs attribs = new ContextAttribs(this);
|
||||
attribs.debug = debug;
|
||||
return attribs;
|
||||
}
|
||||
|
||||
public ContextAttribs withForwardCompatible(final boolean forwardCompatible) {
|
||||
if ( forwardCompatible == this.forwardCompatible )
|
||||
return this;
|
||||
|
||||
final ContextAttribs attribs = new ContextAttribs(this);
|
||||
attribs.forwardCompatible = forwardCompatible;
|
||||
return attribs;
|
||||
}
|
||||
|
||||
public ContextAttribs withProfileCore(final boolean profileCore) {
|
||||
if ( majorVersion < 3 || (majorVersion == 3 && minorVersion < 2) )
|
||||
throw new IllegalArgumentException("Profiles are only supported on OpenGL version 3.2 or higher.");
|
||||
|
||||
if ( profileCore == this.profileCore )
|
||||
return this;
|
||||
|
||||
final ContextAttribs attribs = new ContextAttribs(this);
|
||||
attribs.profileCore = profileCore;
|
||||
if ( profileCore )
|
||||
attribs.profileCompatibility = false;
|
||||
|
||||
return attribs;
|
||||
}
|
||||
|
||||
public ContextAttribs withProfileCompatibility(final boolean profileCompatibility) {
|
||||
if ( majorVersion < 3 || (majorVersion == 3 && minorVersion < 2) )
|
||||
throw new IllegalArgumentException("Profiles are only supported on OpenGL version 3.2 or higher.");
|
||||
|
||||
if ( profileCompatibility == this.profileCompatibility )
|
||||
return this;
|
||||
|
||||
final ContextAttribs attribs = new ContextAttribs(this);
|
||||
attribs.profileCompatibility = profileCompatibility;
|
||||
if ( profileCompatibility )
|
||||
attribs.profileCore = false;
|
||||
|
||||
return attribs;
|
||||
}
|
||||
|
||||
private static ContextAttribsImplementation getImplementation() {
|
||||
switch ( LWJGLUtil.getPlatform() ) {
|
||||
case LWJGLUtil.PLATFORM_LINUX:
|
||||
|
|
@ -168,6 +224,14 @@ public final class ContextAttribs {
|
|||
if ( 0 < flags )
|
||||
attribCount++;
|
||||
|
||||
int profileMask = 0;
|
||||
if ( profileCore )
|
||||
profileMask |= implementation.getProfileCoreBit();
|
||||
else if ( profileCompatibility )
|
||||
profileMask |= implementation.getProfileCompatibilityBit();
|
||||
if ( 0 < profileMask )
|
||||
attribCount++;
|
||||
|
||||
if ( attribCount == 0 )
|
||||
return null;
|
||||
|
||||
|
|
@ -181,6 +245,8 @@ public final class ContextAttribs {
|
|||
attribs.put(implementation.getLayerPlaneAttrib()).put(layerPlane);
|
||||
if ( 0 < flags )
|
||||
attribs.put(implementation.getFlagsAttrib()).put(flags);
|
||||
if ( 0 < profileMask )
|
||||
attribs.put(implementation.getProfileMaskAttrib()).put(profileMask);
|
||||
|
||||
attribs.put(0);
|
||||
attribs.rewind();
|
||||
|
|
@ -195,6 +261,13 @@ public final class ContextAttribs {
|
|||
sb.append(" - Layer=").append(layerPlane);
|
||||
sb.append(" - Debug=").append(debug);
|
||||
sb.append(" - ForwardCompatible=").append(forwardCompatible);
|
||||
sb.append(" - Profile=");
|
||||
if ( profileCore )
|
||||
sb.append("Core");
|
||||
else if ( profileCompatibility )
|
||||
sb.append("Compatibility");
|
||||
else
|
||||
sb.append("None");
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,4 +47,10 @@ interface ContextAttribsImplementation {
|
|||
|
||||
int getForwardCompatibleBit();
|
||||
|
||||
int getProfileMaskAttrib();
|
||||
|
||||
int getProfileCoreBit();
|
||||
|
||||
int getProfileCompatibilityBit();
|
||||
|
||||
}
|
||||
|
|
@ -200,6 +200,8 @@ public final class GLContext {
|
|||
}
|
||||
|
||||
// ----------------------[ 3.X ]----------------------
|
||||
if ( 3 < majorVersion || (3 == majorVersion && 2 <= minorVersion) )
|
||||
supported_extensions.add("OpenGL32");
|
||||
if ( 3 < majorVersion || (3 == majorVersion && 1 <= minorVersion) )
|
||||
supported_extensions.add("OpenGL31");
|
||||
if ( 3 <= majorVersion )
|
||||
|
|
|
|||
|
|
@ -44,10 +44,14 @@ final class LinuxContextAttribs implements ContextAttribsImplementation {
|
|||
private static final int GLX_CONTEXT_MINOR_VERSION_ARB = 0x2092;
|
||||
private static final int GLX_CONTEXT_LAYER_PLANE_ARB = 0x2093;
|
||||
private static final int GLX_CONTEXT_FLAGS_ARB = 0x2094;
|
||||
private static final int GLX_CONTEXT_PROFILE_MASK_ARB = 0x9126;
|
||||
|
||||
private static final int GLX_CONTEXT_DEBUG_BIT_ARB = 0x0001;
|
||||
private static final int GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB = 0x0002;
|
||||
|
||||
private static final int GLX_CONTEXT_CORE_PROFILE_BIT_ARB = 0x00000001;
|
||||
private static final int GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB = 0x00000002;
|
||||
|
||||
LinuxContextAttribs() {
|
||||
}
|
||||
|
||||
|
|
@ -75,4 +79,16 @@ final class LinuxContextAttribs implements ContextAttribsImplementation {
|
|||
return GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB;
|
||||
}
|
||||
|
||||
public int getProfileMaskAttrib() {
|
||||
return GLX_CONTEXT_PROFILE_MASK_ARB;
|
||||
}
|
||||
|
||||
public int getProfileCoreBit() {
|
||||
return GLX_CONTEXT_CORE_PROFILE_BIT_ARB;
|
||||
}
|
||||
|
||||
public int getProfileCompatibilityBit() {
|
||||
return GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -44,10 +44,14 @@ final class MacOSXContextAttribs implements ContextAttribsImplementation {
|
|||
private static final int XGL_CONTEXT_MINOR_VERSION_ARB = 0x2092;
|
||||
private static final int XGL_CONTEXT_LAYER_PLANE_ARB = 0x2093;
|
||||
private static final int XGL_CONTEXT_FLAGS_ARB = 0x2094;
|
||||
private static final int XGL_CONTEXT_PROFILE_MASK_ARB = 0x9126;
|
||||
|
||||
private static final int XGL_CONTEXT_DEBUG_BIT_ARB = 0x0001;
|
||||
private static final int XGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB = 0x0002;
|
||||
|
||||
private static final int XGL_CONTEXT_CORE_PROFILE_BIT_ARB = 0x00000001;
|
||||
private static final int XGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB = 0x00000002;
|
||||
|
||||
MacOSXContextAttribs() {
|
||||
}
|
||||
|
||||
|
|
@ -75,4 +79,16 @@ final class MacOSXContextAttribs implements ContextAttribsImplementation {
|
|||
return XGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB;
|
||||
}
|
||||
|
||||
public int getProfileMaskAttrib() {
|
||||
return XGL_CONTEXT_PROFILE_MASK_ARB;
|
||||
}
|
||||
|
||||
public int getProfileCoreBit() {
|
||||
return XGL_CONTEXT_CORE_PROFILE_BIT_ARB;
|
||||
}
|
||||
|
||||
public int getProfileCompatibilityBit() {
|
||||
return XGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -42,10 +42,14 @@ final class WindowsContextAttribs implements ContextAttribsImplementation {
|
|||
private static final int WGL_CONTEXT_MINOR_VERSION_ARB = 0x2092;
|
||||
private static final int WGL_CONTEXT_LAYER_PLANE_ARB = 0x2093;
|
||||
private static final int WGL_CONTEXT_FLAGS_ARB = 0x2094;
|
||||
private static final int WGL_CONTEXT_PROFILE_MASK_ARB = 0x9126;
|
||||
|
||||
private static final int WGL_CONTEXT_DEBUG_BIT_ARB = 0x0001;
|
||||
private static final int WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB = 0x0002;
|
||||
|
||||
private static final int WGL_CONTEXT_CORE_PROFILE_BIT_ARB = 0x00000001;
|
||||
private static final int WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB = 0x00000002;
|
||||
|
||||
WindowsContextAttribs() {
|
||||
}
|
||||
|
||||
|
|
@ -73,4 +77,16 @@ final class WindowsContextAttribs implements ContextAttribsImplementation {
|
|||
return WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB;
|
||||
}
|
||||
|
||||
public int getProfileMaskAttrib() {
|
||||
return WGL_CONTEXT_PROFILE_MASK_ARB;
|
||||
}
|
||||
|
||||
public int getProfileCoreBit() {
|
||||
return WGL_CONTEXT_CORE_PROFILE_BIT_ARB;
|
||||
}
|
||||
|
||||
public int getProfileCompatibilityBit() {
|
||||
return WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -48,17 +48,23 @@ public class FieldsGenerator {
|
|||
if (!(field_type instanceof PrimitiveType))
|
||||
throw new RuntimeException("Field " + field.getSimpleName() + " is not a primitive type");
|
||||
PrimitiveType field_type_prim = (PrimitiveType)field_type;
|
||||
if (field_type_prim.getKind() != PrimitiveType.Kind.INT)
|
||||
throw new RuntimeException("Field " + field.getSimpleName() + " is not of type 'int'");
|
||||
Integer field_value = (Integer)field.getConstantValue();
|
||||
if (field_type_prim.getKind() != PrimitiveType.Kind.INT && field_type_prim.getKind() != PrimitiveType.Kind.LONG)
|
||||
throw new RuntimeException("Field " + field.getSimpleName() + " is not of type 'int' or 'long'");
|
||||
Object field_value = field.getConstantValue();
|
||||
if (field_value == null)
|
||||
throw new RuntimeException("Field " + field.getSimpleName() + " has no initial value");
|
||||
}
|
||||
|
||||
private static void generateField(PrintWriter writer, FieldDeclaration field) {
|
||||
Integer field_value = (Integer)field.getConstantValue();
|
||||
validateField(field);
|
||||
String field_value_string = Integer.toHexString(field_value);
|
||||
|
||||
Object value = field.getConstantValue();
|
||||
String field_value_string;
|
||||
if ( value.getClass().equals(Integer.class) )
|
||||
field_value_string = Integer.toHexString((Integer)field.getConstantValue());
|
||||
else
|
||||
field_value_string = Long.toHexString((Long)field.getConstantValue()) + 'l';
|
||||
|
||||
Utils.printDocComment(writer, field);
|
||||
// Print field declaration
|
||||
writer.println("\tpublic static final " + field.getType().toString() + " " + field.getSimpleName() + " = 0x" + field_value_string + ";");
|
||||
|
|
|
|||
|
|
@ -41,14 +41,16 @@ package org.lwjgl.util.generator;
|
|||
* $Id$
|
||||
*/
|
||||
|
||||
import com.sun.mirror.declaration.*;
|
||||
import com.sun.mirror.type.*;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
import java.io.PrintWriter;
|
||||
import java.nio.*;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.sun.mirror.declaration.AnnotationMirror;
|
||||
import com.sun.mirror.type.PrimitiveType;
|
||||
|
||||
public class GLTypeMap implements TypeMap {
|
||||
|
||||
private static final Map<Class, PrimitiveType.Kind> native_types_to_primitive;
|
||||
|
||||
static {
|
||||
|
|
@ -78,11 +80,14 @@ public class GLTypeMap implements TypeMap {
|
|||
native_types_to_primitive.put(GLvoid.class, PrimitiveType.Kind.BYTE);
|
||||
native_types_to_primitive.put(GLint64EXT.class, PrimitiveType.Kind.LONG);
|
||||
native_types_to_primitive.put(GLuint64EXT.class, PrimitiveType.Kind.LONG);
|
||||
native_types_to_primitive.put(GLint64.class, PrimitiveType.Kind.LONG);
|
||||
native_types_to_primitive.put(GLuint64.class, PrimitiveType.Kind.LONG);
|
||||
native_types_to_primitive.put(GLsync.class, PrimitiveType.Kind.LONG);
|
||||
}
|
||||
|
||||
public PrimitiveType.Kind getPrimitiveTypeFromNativeType(Class native_type) {
|
||||
PrimitiveType.Kind kind = native_types_to_primitive.get(native_type);
|
||||
if (kind == null)
|
||||
if ( kind == null )
|
||||
throw new RuntimeException("Unsupported type " + native_type);
|
||||
return kind;
|
||||
}
|
||||
|
|
@ -96,50 +101,46 @@ public class GLTypeMap implements TypeMap {
|
|||
}
|
||||
|
||||
public Signedness getSignednessFromType(Class type) {
|
||||
if (GLuint.class.equals(type))
|
||||
if ( GLuint.class.equals(type) )
|
||||
return Signedness.UNSIGNED;
|
||||
else if (GLint.class.equals(type))
|
||||
else if ( GLint.class.equals(type) )
|
||||
return Signedness.SIGNED;
|
||||
else if (GLushort.class.equals(type))
|
||||
else if ( GLushort.class.equals(type) )
|
||||
return Signedness.UNSIGNED;
|
||||
else if (GLshort.class.equals(type))
|
||||
else if ( GLshort.class.equals(type) )
|
||||
return Signedness.SIGNED;
|
||||
else if (GLubyte.class.equals(type))
|
||||
else if ( GLubyte.class.equals(type) )
|
||||
return Signedness.UNSIGNED;
|
||||
else if (GLbyte.class.equals(type))
|
||||
else if ( GLbyte.class.equals(type) )
|
||||
return Signedness.SIGNED;
|
||||
else if (GLuint64EXT.class.equals(type))
|
||||
else if ( GLuint64EXT.class.equals(type) )
|
||||
return Signedness.UNSIGNED;
|
||||
else if (GLint64EXT.class.equals(type))
|
||||
else if ( GLint64EXT.class.equals(type) )
|
||||
return Signedness.SIGNED;
|
||||
else if ( GLuint64.class.equals(type) )
|
||||
return Signedness.UNSIGNED;
|
||||
else if ( GLint64.class.equals(type) )
|
||||
return Signedness.SIGNED;
|
||||
else
|
||||
return Signedness.NONE;
|
||||
}
|
||||
|
||||
public String translateAnnotation(Class annotation_type) {
|
||||
if (annotation_type.equals(GLuint.class))
|
||||
if ( annotation_type.equals(GLuint.class) || annotation_type.equals(GLint.class) )
|
||||
return "i";
|
||||
else if (annotation_type.equals(GLint.class))
|
||||
return "i";
|
||||
else if (annotation_type.equals(GLushort.class))
|
||||
return"s";
|
||||
else if (annotation_type.equals(GLshort.class))
|
||||
else if ( annotation_type.equals(GLushort.class) || annotation_type.equals(GLshort.class) )
|
||||
return "s";
|
||||
else if (annotation_type.equals(GLubyte.class))
|
||||
else if ( annotation_type.equals(GLubyte.class) || annotation_type.equals(GLbyte.class) )
|
||||
return "b";
|
||||
else if (annotation_type.equals(GLbyte.class))
|
||||
return "b";
|
||||
else if (annotation_type.equals(GLfloat.class))
|
||||
else if ( annotation_type.equals(GLfloat.class) )
|
||||
return "f";
|
||||
else if (annotation_type.equals(GLdouble.class))
|
||||
else if ( annotation_type.equals(GLdouble.class) )
|
||||
return "d";
|
||||
else if (annotation_type.equals(GLhalf.class))
|
||||
else if ( annotation_type.equals(GLhalf.class) )
|
||||
return "h";
|
||||
else if (annotation_type.equals(GLuint64EXT.class))
|
||||
else if ( annotation_type.equals(GLuint64EXT.class) || annotation_type.equals(GLint64EXT.class) || annotation_type.equals(GLuint64.class) || annotation_type.equals(GLint64.class) )
|
||||
return "i64";
|
||||
else if (annotation_type.equals(GLint64EXT.class))
|
||||
return "i64";
|
||||
else if (annotation_type.equals(GLboolean.class) || annotation_type.equals(GLvoid.class))
|
||||
else if ( annotation_type.equals(GLboolean.class) || annotation_type.equals(GLvoid.class) )
|
||||
return "";
|
||||
else
|
||||
throw new RuntimeException(annotation_type + " is not allowed");
|
||||
|
|
@ -147,7 +148,7 @@ public class GLTypeMap implements TypeMap {
|
|||
|
||||
public Class getNativeTypeFromPrimitiveType(PrimitiveType.Kind kind) {
|
||||
Class type;
|
||||
switch (kind) {
|
||||
switch ( kind ) {
|
||||
case INT:
|
||||
type = GLint.class;
|
||||
break;
|
||||
|
|
@ -184,43 +185,43 @@ 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,
|
||||
GLsizei.class, GLuint.class};
|
||||
else if (type.equals(FloatBuffer.class))
|
||||
return new Class[]{GLclampf.class, GLfloat.class};
|
||||
else if (type.equals(ByteBuffer.class))
|
||||
return new Class[]{GLboolean.class, GLbyte.class, GLcharARB.class, GLchar.class, GLubyte.class, GLvoid.class};
|
||||
else if (type.equals(ShortBuffer.class))
|
||||
return new Class[]{GLhalf.class, GLshort.class, GLushort.class};
|
||||
else if (type.equals(DoubleBuffer.class))
|
||||
return new Class[]{GLclampd.class, GLdouble.class};
|
||||
else if (type.equals(LongBuffer.class))
|
||||
return new Class[]{GLint64EXT.class, GLuint64EXT.class};
|
||||
if ( type.equals(IntBuffer.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) )
|
||||
return new Class[] { GLboolean.class, GLbyte.class, GLcharARB.class, GLchar.class, GLubyte.class, GLvoid.class };
|
||||
else if ( type.equals(ShortBuffer.class) )
|
||||
return new Class[] { GLhalf.class, GLshort.class, GLushort.class };
|
||||
else if ( type.equals(DoubleBuffer.class) )
|
||||
return new Class[] { GLclampd.class, GLdouble.class };
|
||||
else if ( type.equals(LongBuffer.class) )
|
||||
return new Class[] { GLint64EXT.class, GLuint64EXT.class, GLint64.class, GLuint64.class, GLsync.class };
|
||||
else
|
||||
return new Class[]{};
|
||||
return new Class[] { };
|
||||
}
|
||||
|
||||
private static Class[] getValidPrimitiveTypes(Class type) {
|
||||
if (type.equals(long.class))
|
||||
return new Class[]{GLintptrARB.class, GLuint.class, GLintptr.class, GLsizeiptrARB.class, GLsizeiptr.class, GLint64EXT.class, GLuint64EXT.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))
|
||||
return new Class[]{GLclampf.class, GLfloat.class};
|
||||
else if (type.equals(short.class))
|
||||
return new Class[]{GLhalf.class, GLshort.class, GLushort.class};
|
||||
else if (type.equals(byte.class))
|
||||
return new Class[]{GLbyte.class, GLcharARB.class, GLchar.class, GLubyte.class};
|
||||
else if (type.equals(boolean.class))
|
||||
return new Class[]{GLboolean.class};
|
||||
else if (type.equals(void.class))
|
||||
return new Class[]{GLvoid.class};
|
||||
if ( type.equals(long.class) )
|
||||
return new Class[] { GLintptrARB.class, GLuint.class, GLintptr.class, GLsizeiptrARB.class, GLsizeiptr.class, GLint64EXT.class, GLuint64EXT.class, GLint64.class, GLuint64.class, GLsync.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) )
|
||||
return new Class[] { GLclampf.class, GLfloat.class };
|
||||
else if ( type.equals(short.class) )
|
||||
return new Class[] { GLhalf.class, GLshort.class, GLushort.class };
|
||||
else if ( type.equals(byte.class) )
|
||||
return new Class[] { GLbyte.class, GLcharARB.class, GLchar.class, GLubyte.class };
|
||||
else if ( type.equals(boolean.class) )
|
||||
return new Class[] { GLboolean.class };
|
||||
else if ( type.equals(void.class) )
|
||||
return new Class[] { GLvoid.class };
|
||||
else
|
||||
return new Class[]{};
|
||||
return new Class[] { };
|
||||
}
|
||||
|
||||
public String getTypedefPrefix() {
|
||||
|
|
@ -233,55 +234,59 @@ public class GLTypeMap implements TypeMap {
|
|||
|
||||
public Class[] getValidAnnotationTypes(Class type) {
|
||||
Class[] valid_types;
|
||||
if (Buffer.class.isAssignableFrom(type))
|
||||
if ( Buffer.class.isAssignableFrom(type) )
|
||||
valid_types = getValidBufferTypes(type);
|
||||
else if (type.isPrimitive())
|
||||
else if ( type.isPrimitive() )
|
||||
valid_types = getValidPrimitiveTypes(type);
|
||||
else if (String.class.equals(type))
|
||||
valid_types = new Class[]{GLubyte.class};
|
||||
else if ( String.class.equals(type) )
|
||||
valid_types = new Class[] { GLubyte.class };
|
||||
else
|
||||
valid_types = new Class[]{};
|
||||
valid_types = new Class[] { };
|
||||
return valid_types;
|
||||
}
|
||||
|
||||
public Class getInverseType(Class type) {
|
||||
if (GLuint.class.equals(type))
|
||||
if ( GLuint.class.equals(type) )
|
||||
return GLint.class;
|
||||
else if (GLint.class.equals(type))
|
||||
else if ( GLint.class.equals(type) )
|
||||
return GLuint.class;
|
||||
else if (GLushort.class.equals(type))
|
||||
else if ( GLushort.class.equals(type) )
|
||||
return GLshort.class;
|
||||
else if (GLshort.class.equals(type))
|
||||
else if ( GLshort.class.equals(type) )
|
||||
return GLushort.class;
|
||||
else if (GLubyte.class.equals(type))
|
||||
else if ( GLubyte.class.equals(type) )
|
||||
return GLbyte.class;
|
||||
else if (GLbyte.class.equals(type))
|
||||
else if ( GLbyte.class.equals(type) )
|
||||
return GLubyte.class;
|
||||
else if (GLuint64EXT.class.equals(type))
|
||||
else if ( GLuint64EXT.class.equals(type) )
|
||||
return GLint64EXT.class;
|
||||
else if (GLint64EXT.class.equals(type))
|
||||
else if ( GLint64EXT.class.equals(type) )
|
||||
return GLuint64EXT.class;
|
||||
else if ( GLuint64.class.equals(type) )
|
||||
return GLint64.class;
|
||||
else if ( GLint64.class.equals(type) )
|
||||
return GLuint64.class;
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getAutoTypeFromAnnotation(AnnotationMirror annotation) {
|
||||
Class annotation_class = NativeTypeTranslator.getClassFromType(annotation.getAnnotationType());
|
||||
if (annotation_class.equals(GLint.class))
|
||||
if ( annotation_class.equals(GLint.class) )
|
||||
return "GL11.GL_INT";
|
||||
else if (annotation_class.equals(GLbyte.class))
|
||||
else if ( annotation_class.equals(GLbyte.class) )
|
||||
return "GL11.GL_BYTE";
|
||||
else if (annotation_class.equals(GLshort.class))
|
||||
else if ( annotation_class.equals(GLshort.class) )
|
||||
return "GL11.GL_SHORT";
|
||||
if (annotation_class.equals(GLuint.class))
|
||||
if ( annotation_class.equals(GLuint.class) )
|
||||
return "GL11.GL_UNSIGNED_INT";
|
||||
else if (annotation_class.equals(GLubyte.class))
|
||||
else if ( annotation_class.equals(GLubyte.class) )
|
||||
return "GL11.GL_UNSIGNED_BYTE";
|
||||
else if (annotation_class.equals(GLushort.class))
|
||||
else if ( annotation_class.equals(GLushort.class) )
|
||||
return "GL11.GL_UNSIGNED_SHORT";
|
||||
else if (annotation_class.equals(GLfloat.class))
|
||||
else if ( annotation_class.equals(GLfloat.class) )
|
||||
return "GL11.GL_FLOAT";
|
||||
else if (annotation_class.equals(GLdouble.class))
|
||||
else if ( annotation_class.equals(GLdouble.class) )
|
||||
return "GL11.GL_DOUBLE";
|
||||
else
|
||||
return null;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue