Add buffer object versions of several functions

Some of these are new ES3 functions, some are existing ES2 functions
that can now use the new pixel pack/unpack buffer bindings.

glDrawElementsInstanced needs a special case since the pointer/offset
arg isn't the last one like the generator assumes.

Bug: 8566953
Change-Id: I638a36b0a31aefcb5bfee6f4d049348223045103
This commit is contained in:
Jesse Hall 2013-04-10 01:17:34 -07:00
parent 68fc8bbced
commit 071fc66059
6 changed files with 95 additions and 7 deletions

View File

@ -23,7 +23,9 @@ void glClearStencil ( GLint s )
void glColorMask ( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha )
void glCompileShader ( GLuint shader )
void glCompressedTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data )
void glCompressedTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, GLsizei offset )
void glCompressedTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data )
void glCompressedTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, GLsizei offset )
void glCopyTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border )
void glCopyTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height )
GLuint glCreateProgram ( void )
@ -95,6 +97,7 @@ void glLinkProgram ( GLuint program )
void glPixelStorei ( GLenum pname, GLint param )
void glPolygonOffset ( GLfloat factor, GLfloat units )
void glReadPixels ( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels )
void glReadPixels ( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei offset )
void glReleaseShaderCompiler ( void )
void glRenderbufferStorage ( GLenum target, GLenum internalformat, GLsizei width, GLsizei height )
void glSampleCoverage ( GLfloat value, GLboolean invert )
@ -108,11 +111,13 @@ void glStencilMaskSeparate ( GLenum face, GLuint mask )
void glStencilOp ( GLenum fail, GLenum zfail, GLenum zpass )
void glStencilOpSeparate ( GLenum face, GLenum fail, GLenum zfail, GLenum zpass )
void glTexImage2D ( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels )
void glTexImage2D ( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, GLsizei offset )
void glTexParameterf ( GLenum target, GLenum pname, GLfloat param )
void glTexParameterfv ( GLenum target, GLenum pname, const GLfloat *params )
void glTexParameteri ( GLenum target, GLenum pname, GLint param )
void glTexParameteriv ( GLenum target, GLenum pname, const GLint *params )
void glTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels )
void glTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei offset )
void glUniform1f ( GLint location, GLfloat x )
void glUniform1fv ( GLint location, GLsizei count, const GLfloat *v )
void glUniform1i ( GLint location, GLint x )
@ -150,11 +155,16 @@ void glViewport ( GLint x, GLint y, GLsizei width, GLsizei height )
//
void glReadBuffer ( GLenum mode )
void glDrawRangeElements ( GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices )
void glDrawRangeElements ( GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, GLsizei offset )
void glTexImage3D ( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels )
void glTexImage3D ( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, GLsizei offset )
void glTexSubImage3D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels )
void glTexSubImage3D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLsizei offset )
void glCopyTexSubImage3D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height )
void glCompressedTexImage3D ( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data )
void glCompressedTexImage3D ( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, GLsizei offset )
void glCompressedTexSubImage3D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data )
void glCompressedTexSubImage3D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, GLsizei offset )
void glGenQueries ( GLsizei n, GLuint *ids )
void glDeleteQueries ( GLsizei n, const GLuint *ids )
GLboolean glIsQuery ( GLuint id )
@ -187,7 +197,8 @@ void glBindBufferRange ( GLenum target, GLuint index, GLuint buffer, GLintptr of
void glBindBufferBase ( GLenum target, GLuint index, GLuint buffer )
// void glTransformFeedbackVaryings ( GLuint program, GLsizei count, const GLchar *const *varyings, GLenum bufferMode )
// void glGetTransformFeedbackVarying ( GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name )
// void glVertexAttribIPointer ( GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer )
void glVertexAttribIPointer ( GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer )
void glVertexAttribIPointer ( GLuint index, GLint size, GLenum type, GLsizei stride, GLsizei offset )
void glGetVertexAttribIiv ( GLuint index, GLenum pname, GLint *params )
void glGetVertexAttribIuiv ( GLuint index, GLenum pname, GLuint *params )
void glVertexAttribI4i ( GLuint index, GLint x, GLint y, GLint z, GLint w )

View File

@ -749,10 +749,20 @@ public class JniCodeEmitter {
String outName = "android_" + jfunc.getName();
boolean isPointerFunc = isPointerFunc(jfunc);
boolean isVBOPointerFunc = (outName.endsWith("Pointer") ||
outName.endsWith("PointerOES") ||
outName.endsWith("DrawElements") || outName.endsWith("VertexAttribPointer")) &&
!jfunc.getCFunc().hasPointerArg();
boolean isPointerOffsetFunc =
(outName.endsWith("Pointer") || outName.endsWith("PointerOES") ||
outName.endsWith("glDrawElements") ||
outName.endsWith("glDrawRangeElements") ||
outName.endsWith("glTexImage2D") ||
outName.endsWith("glTexSubImage2D") ||
outName.endsWith("glCompressedTexImage2D") ||
outName.endsWith("glCompressedTexSubImage2D") ||
outName.endsWith("glTexImage3D") ||
outName.endsWith("glTexSubImage3D") ||
outName.endsWith("glCompressedTexImage3D") ||
outName.endsWith("glCompressedTexSubImage3D") ||
outName.endsWith("glReadPixels"))
&& !jfunc.getCFunc().hasPointerArg();
if (isPointerFunc) {
outName += "Bounds";
}
@ -1271,8 +1281,8 @@ public class JniCodeEmitter {
}
for (int i = 0; i < numArgs; i++) {
String typecast;
if (i == numArgs - 1 && isVBOPointerFunc) {
typecast = "(const GLvoid *)";
if (i == numArgs - 1 && isPointerOffsetFunc) {
typecast = "(GLvoid *)";
} else {
typecast = "(" + cfunc.getArgType(i).getDeclaration() + ")";
}

View File

@ -41,6 +41,12 @@ static void glVertexAttribPointerBounds(GLuint indx, GLint size, GLenum type,
glVertexAttribPointer(indx, size, type, normalized, stride, pointer);
}
#endif
#ifdef GL_ES_VERSION_3_0
static void glVertexAttribIPointerBounds(GLuint indx, GLint size, GLenum type,
GLsizei stride, const GLvoid *pointer, GLsizei count) {
glVertexAttribIPointer(indx, size, type, stride, pointer);
}
#endif
}
/* Cache method IDs each time the class is loaded. */

View File

@ -0,0 +1,39 @@
/* void glDrawElementsInstanced ( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instanceCount ) */
static void
android_glDrawElementsInstanced__IIILjava_nio_Buffer_2I
(JNIEnv *_env, jobject _this, jint mode, jint count, jint type, jobject indices_buf, jint instanceCount) {
jarray _array = (jarray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLvoid *indices = (GLvoid *) 0;
indices = (GLvoid *)getPointer(_env, indices_buf, &_array, &_remaining, &_bufferOffset);
if (indices == NULL) {
char * _indicesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
indices = (GLvoid *) (_indicesBase + _bufferOffset);
}
glDrawElementsInstanced(
(GLenum)mode,
(GLsizei)count,
(GLenum)type,
(GLvoid *)indices,
(GLsizei)instanceCount
);
if (_array) {
releasePointer(_env, _array, indices, JNI_FALSE);
}
}
/* void glDrawElementsInstanced ( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instanceCount ) */
static void
android_glDrawElementsInstanced__IIIII
(JNIEnv *_env, jobject _this, jint mode, jint count, jint type, jint indicesOffset, jint instanceCount) {
glDrawElementsInstanced(
(GLenum)mode,
(GLsizei)count,
(GLenum)type,
(GLvoid *)indicesOffset,
(GLsizei)instanceCount
);
}

View File

@ -0,0 +1,20 @@
// C function void glDrawElementsInstanced ( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instanceCount )
public static native void glDrawElementsInstanced(
int mode,
int count,
int type,
java.nio.Buffer indices,
int instanceCount
);
// C function void glDrawElementsInstanced ( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instanceCount )
public static native void glDrawElementsInstanced(
int mode,
int count,
int type,
int indicesOffset,
int instanceCount
);

View File

@ -0,0 +1,2 @@
{"glDrawElementsInstanced", "(IIILjava/nio/Buffer;I)V", (void *) android_glDrawElementsInstanced__IIILjava_nio_Buffer_2I },
{"glDrawElementsInstanced", "(IIIII)V", (void *) android_glDrawElementsInstanced__IIIII },