summaryrefslogtreecommitdiffstats
path: root/opengl/tools/glgen
diff options
context:
space:
mode:
authorJesse Hall <jessehall@google.com>2013-04-10 01:17:34 -0700
committerJesse Hall <jessehall@google.com>2013-04-10 22:00:17 -0700
commit071fc660597efdfa5ebc58b427252393e628a497 (patch)
treea03ae094dfecaa0025bc8a10d1a9daa17a8f15b4 /opengl/tools/glgen
parent68fc8bbced285a8a2b716e5fe1900968ad8ba7d3 (diff)
downloadframeworks_native-071fc660597efdfa5ebc58b427252393e628a497.zip
frameworks_native-071fc660597efdfa5ebc58b427252393e628a497.tar.gz
frameworks_native-071fc660597efdfa5ebc58b427252393e628a497.tar.bz2
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
Diffstat (limited to 'opengl/tools/glgen')
-rw-r--r--opengl/tools/glgen/specs/gles11/GLES30.spec13
-rw-r--r--opengl/tools/glgen/src/JniCodeEmitter.java22
-rw-r--r--opengl/tools/glgen/stubs/gles11/common.cpp6
-rw-r--r--opengl/tools/glgen/stubs/gles11/glDrawElementsInstanced.cpp39
-rw-r--r--opengl/tools/glgen/stubs/gles11/glDrawElementsInstanced.java20
-rw-r--r--opengl/tools/glgen/stubs/gles11/glDrawElementsInstanced.nativeReg2
6 files changed, 95 insertions, 7 deletions
diff --git a/opengl/tools/glgen/specs/gles11/GLES30.spec b/opengl/tools/glgen/specs/gles11/GLES30.spec
index cf5a758..dad4499 100644
--- a/opengl/tools/glgen/specs/gles11/GLES30.spec
+++ b/opengl/tools/glgen/specs/gles11/GLES30.spec
@@ -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 )
diff --git a/opengl/tools/glgen/src/JniCodeEmitter.java b/opengl/tools/glgen/src/JniCodeEmitter.java
index ba1152a..d5e2d34 100644
--- a/opengl/tools/glgen/src/JniCodeEmitter.java
+++ b/opengl/tools/glgen/src/JniCodeEmitter.java
@@ -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() + ")";
}
diff --git a/opengl/tools/glgen/stubs/gles11/common.cpp b/opengl/tools/glgen/stubs/gles11/common.cpp
index 106dbdc..579d573 100644
--- a/opengl/tools/glgen/stubs/gles11/common.cpp
+++ b/opengl/tools/glgen/stubs/gles11/common.cpp
@@ -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. */
diff --git a/opengl/tools/glgen/stubs/gles11/glDrawElementsInstanced.cpp b/opengl/tools/glgen/stubs/gles11/glDrawElementsInstanced.cpp
new file mode 100644
index 0000000..41df486
--- /dev/null
+++ b/opengl/tools/glgen/stubs/gles11/glDrawElementsInstanced.cpp
@@ -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
+ );
+}
+
diff --git a/opengl/tools/glgen/stubs/gles11/glDrawElementsInstanced.java b/opengl/tools/glgen/stubs/gles11/glDrawElementsInstanced.java
new file mode 100644
index 0000000..53651ce
--- /dev/null
+++ b/opengl/tools/glgen/stubs/gles11/glDrawElementsInstanced.java
@@ -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
+ );
+
diff --git a/opengl/tools/glgen/stubs/gles11/glDrawElementsInstanced.nativeReg b/opengl/tools/glgen/stubs/gles11/glDrawElementsInstanced.nativeReg
new file mode 100644
index 0000000..3b7424c
--- /dev/null
+++ b/opengl/tools/glgen/stubs/gles11/glDrawElementsInstanced.nativeReg
@@ -0,0 +1,2 @@
+{"glDrawElementsInstanced", "(IIILjava/nio/Buffer;I)V", (void *) android_glDrawElementsInstanced__IIILjava_nio_Buffer_2I },
+{"glDrawElementsInstanced", "(IIIII)V", (void *) android_glDrawElementsInstanced__IIIII },