Add *int64 and GLsync types and related functions

Return values are declared with the C return type, but the JNI
function returns the JNI return type. In the case of GLsync/jlong as
in glFenceSync(), this causes a compile error. So the generator now
explicitly casts the return value to the JNI return type.

Bug: 8566953
Change-Id: I814befe2e4cce745434cbc4e1c8639fc3ce8aeae
This commit is contained in:
Jesse Hall 2013-04-10 01:01:00 -07:00
parent 2d9faafa23
commit 68fc8bbced
3 changed files with 16 additions and 10 deletions

View File

@ -218,15 +218,15 @@ void glGetActiveUniformBlockiv ( GLuint program, GLuint uniformBlockIndex, GLenu
void glUniformBlockBinding ( GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding ) void glUniformBlockBinding ( GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding )
void glDrawArraysInstanced ( GLenum mode, GLint first, GLsizei count, GLsizei instanceCount ) void glDrawArraysInstanced ( GLenum mode, GLint first, GLsizei count, GLsizei instanceCount )
void glDrawElementsInstanced ( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instanceCount ) void glDrawElementsInstanced ( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instanceCount )
// GLsync glFenceSync ( GLenum condition, GLbitfield flags ) GLsync glFenceSync ( GLenum condition, GLbitfield flags )
// GLboolean glIsSync ( GLsync sync ) GLboolean glIsSync ( GLsync sync )
// void glDeleteSync ( GLsync sync ) void glDeleteSync ( GLsync sync )
// GLenum glClientWaitSync ( GLsync sync, GLbitfield flags, GLuint64 timeout ) GLenum glClientWaitSync ( GLsync sync, GLbitfield flags, GLuint64 timeout )
// void glWaitSync ( GLsync sync, GLbitfield flags, GLuint64 timeout ) void glWaitSync ( GLsync sync, GLbitfield flags, GLuint64 timeout )
// void glGetInteger64v ( GLenum pname, GLint64 *params ) void glGetInteger64v ( GLenum pname, GLint64 *params )
// void glGetSynciv ( GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values ) void glGetSynciv ( GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values )
// void glGetInteger64i_v ( GLenum target, GLuint index, GLint64 *data ) void glGetInteger64i_v ( GLenum target, GLuint index, GLint64 *data )
// void glGetBufferParameteri64v ( GLenum target, GLenum pname, GLint64 *params ) void glGetBufferParameteri64v ( GLenum target, GLenum pname, GLint64 *params )
void glGenSamplers ( GLsizei count, GLuint *samplers ) void glGenSamplers ( GLsizei count, GLuint *samplers )
void glDeleteSamplers ( GLsizei count, const GLuint *samplers ) void glDeleteSamplers ( GLsizei count, const GLuint *samplers )
GLboolean glIsSampler ( GLuint sampler ) GLboolean glIsSampler ( GLuint sampler )

View File

@ -48,6 +48,8 @@ public class JType {
typeMapping.put(new CType("char", true, true), new JType("String", false, false)); typeMapping.put(new CType("char", true, true), new JType("String", false, false));
typeMapping.put(new CType("GLchar", true, true), new JType("String", false, false)); typeMapping.put(new CType("GLchar", true, true), new JType("String", false, false));
typeMapping.put(new CType("int"), new JType("int")); typeMapping.put(new CType("int"), new JType("int"));
typeMapping.put(new CType("GLuint64"), new JType("long"));
typeMapping.put(new CType("GLsync"), new JType("long"));
// EGL primitive types // EGL primitive types
typeMapping.put(new CType("EGLint"), new JType("int")); typeMapping.put(new CType("EGLint"), new JType("int"));
@ -103,6 +105,8 @@ public class JType {
new JType("java.nio.IntBuffer", true, false)); new JType("java.nio.IntBuffer", true, false));
typeMapping.put(new CType("GLshort", true, true), typeMapping.put(new CType("GLshort", true, true),
new JType("java.nio.ShortBuffer", true, false)); new JType("java.nio.ShortBuffer", true, false));
typeMapping.put(new CType("GLint64", false, true),
new JType("java.nio.LongBuffer", true, false));
// Typed pointers map to arrays + offsets // Typed pointers map to arrays + offsets
arrayTypeMapping.put(new CType("char", false, true), arrayTypeMapping.put(new CType("char", false, true),
@ -124,6 +128,7 @@ public class JType {
arrayTypeMapping.put(new CType("GLuint", true, true), new JType("int", false, true)); arrayTypeMapping.put(new CType("GLuint", true, true), new JType("int", false, true));
arrayTypeMapping.put(new CType("GLintptr"), new JType("int", false, true)); arrayTypeMapping.put(new CType("GLintptr"), new JType("int", false, true));
arrayTypeMapping.put(new CType("GLsizeiptr"), new JType("int", false, true)); arrayTypeMapping.put(new CType("GLsizeiptr"), new JType("int", false, true));
arrayTypeMapping.put(new CType("GLint64", false, true), new JType("long", false, true));
//EGL typed pointers map to arrays + offsets //EGL typed pointers map to arrays + offsets
arrayTypeMapping.put(new CType("EGLint", false, true), new JType("int", false, true)); arrayTypeMapping.put(new CType("EGLint", false, true), new JType("int", false, true));

View File

@ -1421,7 +1421,8 @@ public class JniCodeEmitter {
"return toEGLHandle(_env, " + baseType + "Class, " + "return toEGLHandle(_env, " + baseType + "Class, " +
baseType + "Constructor, _returnValue);"); baseType + "Constructor, _returnValue);");
} else { } else {
out.println(indent + "return _returnValue;"); out.println(indent + "return (" +
getJniType(jfunc.getType()) + ")_returnValue;");
} }
} }