am 981ccfbb: Implement Matrix Palette extension.

Merge commit '981ccfbbfd737e2bdf0cedec0089975f91fd4e0a' into eclair-mr2-plus-aosp

* commit '981ccfbbfd737e2bdf0cedec0089975f91fd4e0a':
  Implement Matrix Palette extension.
This commit is contained in:
Jack Palevich
2009-12-09 15:59:08 -08:00
committed by Android Git Automerger
19 changed files with 473 additions and 114 deletions

View File

@ -24,6 +24,13 @@
#include <GLES/gl.h> #include <GLES/gl.h>
#include <GLES/glext.h> #include <GLES/glext.h>
/* special calls implemented in Android's GLES wrapper used to more
* efficiently bound-check passed arrays */
extern "C" {
GL_API void GL_APIENTRY glPointSizePointerOESBounds(GLenum type, GLsizei stride,
const GLvoid *ptr, GLsizei count);
}
static int initialized = 0; static int initialized = 0;
static jclass nioAccessClass; static jclass nioAccessClass;
@ -122,6 +129,19 @@ releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit)
commit ? 0 : JNI_ABORT); commit ? 0 : JNI_ABORT);
} }
static void *
getDirectBufferPointer(JNIEnv *_env, jobject buffer) {
char* buf = (char*) _env->GetDirectBufferAddress(buffer);
if (buf) {
jint position = _env->GetIntField(buffer, positionID);
jint elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID);
buf += position << elementSizeShift;
} else {
_env->ThrowNew(IAEClass, "Must use a native order direct Buffer");
}
return (void*) buf;
}
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
/* void glBindBuffer ( GLenum target, GLuint buffer ) */ /* void glBindBuffer ( GLenum target, GLuint buffer ) */
@ -2035,21 +2055,24 @@ exit:
/* void glPointSizePointerOES ( GLenum type, GLsizei stride, const GLvoid *pointer ) */ /* void glPointSizePointerOES ( GLenum type, GLsizei stride, const GLvoid *pointer ) */
static void static void
android_glPointSizePointerOES__IILjava_nio_Buffer_2 android_glPointSizePointerOESBounds__IILjava_nio_Buffer_2I
(JNIEnv *_env, jobject _this, jint type, jint stride, jobject pointer_buf) { (JNIEnv *_env, jobject _this, jint type, jint stride, jobject pointer_buf, jint remaining) {
jarray _array = (jarray) 0; jarray _array = (jarray) 0;
jint _remaining; jint _remaining;
GLvoid *pointer = (GLvoid *) 0; GLvoid *pointer = (GLvoid *) 0;
pointer = (GLvoid *)getPointer(_env, pointer_buf, &_array, &_remaining); if (pointer_buf) {
glPointSizePointerOES( pointer = (GLvoid *) getDirectBufferPointer(_env, pointer_buf);
if ( ! pointer ) {
return;
}
}
glPointSizePointerOESBounds(
(GLenum)type, (GLenum)type,
(GLsizei)stride, (GLsizei)stride,
(GLvoid *)pointer (GLvoid *)pointer,
(GLsizei)remaining
); );
if (_array) {
releasePointer(_env, _array, pointer, JNI_FALSE);
}
} }
/* void glTexCoordPointer ( GLint size, GLenum type, GLsizei stride, GLint offset ) */ /* void glTexCoordPointer ( GLint size, GLenum type, GLsizei stride, GLint offset ) */
@ -2454,7 +2477,7 @@ static JNINativeMethod methods[] = {
{"glPointParameterx", "(II)V", (void *) android_glPointParameterx__II }, {"glPointParameterx", "(II)V", (void *) android_glPointParameterx__II },
{"glPointParameterxv", "(I[II)V", (void *) android_glPointParameterxv__I_3II }, {"glPointParameterxv", "(I[II)V", (void *) android_glPointParameterxv__I_3II },
{"glPointParameterxv", "(ILjava/nio/IntBuffer;)V", (void *) android_glPointParameterxv__ILjava_nio_IntBuffer_2 }, {"glPointParameterxv", "(ILjava/nio/IntBuffer;)V", (void *) android_glPointParameterxv__ILjava_nio_IntBuffer_2 },
{"glPointSizePointerOES", "(IILjava/nio/Buffer;)V", (void *) android_glPointSizePointerOES__IILjava_nio_Buffer_2 }, {"glPointSizePointerOESBounds", "(IILjava/nio/Buffer;I)V", (void *) android_glPointSizePointerOESBounds__IILjava_nio_Buffer_2I },
{"glTexCoordPointer", "(IIII)V", (void *) android_glTexCoordPointer__IIII }, {"glTexCoordPointer", "(IIII)V", (void *) android_glTexCoordPointer__IIII },
{"glTexEnvi", "(III)V", (void *) android_glTexEnvi__III }, {"glTexEnvi", "(III)V", (void *) android_glTexEnvi__III },
{"glTexEnviv", "(II[II)V", (void *) android_glTexEnviv__II_3II }, {"glTexEnviv", "(II[II)V", (void *) android_glTexEnviv__II_3II },

View File

@ -24,6 +24,15 @@
#include <GLES/gl.h> #include <GLES/gl.h>
#include <GLES/glext.h> #include <GLES/glext.h>
/* special calls implemented in Android's GLES wrapper used to more
* efficiently bound-check passed arrays */
extern "C" {
GL_API void GL_APIENTRY glMatrixIndexPointerOESBounds(GLint size, GLenum type, GLsizei stride,
const GLvoid *ptr, GLsizei count);
GL_API void GL_APIENTRY glWeightPointerOESBounds(GLint size, GLenum type, GLsizei stride,
const GLvoid *ptr, GLsizei count);
}
static int initialized = 0; static int initialized = 0;
static jclass nioAccessClass; static jclass nioAccessClass;
@ -122,6 +131,18 @@ releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit)
commit ? 0 : JNI_ABORT); commit ? 0 : JNI_ABORT);
} }
static void *
getDirectBufferPointer(JNIEnv *_env, jobject buffer) {
char* buf = (char*) _env->GetDirectBufferAddress(buffer);
if (buf) {
jint position = _env->GetIntField(buffer, positionID);
jint elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID);
buf += position << elementSizeShift;
} else {
_env->ThrowNew(IAEClass, "Must use a native order direct Buffer");
}
return (void*) buf;
}
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
/* void glBlendEquationSeparateOES ( GLenum modeRGB, GLenum modeAlpha ) */ /* void glBlendEquationSeparateOES ( GLenum modeRGB, GLenum modeAlpha ) */
@ -1771,32 +1792,62 @@ android_glGenerateMipmapOES__I
static void static void
android_glCurrentPaletteMatrixOES__I android_glCurrentPaletteMatrixOES__I
(JNIEnv *_env, jobject _this, jint matrixpaletteindex) { (JNIEnv *_env, jobject _this, jint matrixpaletteindex) {
_env->ThrowNew(UOEClass, glCurrentPaletteMatrixOES(
"glCurrentPaletteMatrixOES"); (GLuint)matrixpaletteindex
);
} }
/* void glLoadPaletteFromModelViewMatrixOES ( void ) */ /* void glLoadPaletteFromModelViewMatrixOES ( void ) */
static void static void
android_glLoadPaletteFromModelViewMatrixOES__ android_glLoadPaletteFromModelViewMatrixOES__
(JNIEnv *_env, jobject _this) { (JNIEnv *_env, jobject _this) {
_env->ThrowNew(UOEClass, glLoadPaletteFromModelViewMatrixOES();
"glLoadPaletteFromModelViewMatrixOES");
} }
/* void glMatrixIndexPointerOES ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ) */ /* void glMatrixIndexPointerOES ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ) */
static void static void
android_glMatrixIndexPointerOES__IIILjava_nio_Buffer_2 android_glMatrixIndexPointerOESBounds__IIILjava_nio_Buffer_2I
(JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jobject pointer_buf) { (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jobject pointer_buf, jint remaining) {
_env->ThrowNew(UOEClass, jarray _array = (jarray) 0;
"glMatrixIndexPointerOES"); jint _remaining;
GLvoid *pointer = (GLvoid *) 0;
if (pointer_buf) {
pointer = (GLvoid *) getDirectBufferPointer(_env, pointer_buf);
if ( ! pointer ) {
return;
}
}
glMatrixIndexPointerOESBounds(
(GLint)size,
(GLenum)type,
(GLsizei)stride,
(GLvoid *)pointer,
(GLsizei)remaining
);
} }
/* void glWeightPointerOES ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ) */ /* void glWeightPointerOES ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ) */
static void static void
android_glWeightPointerOES__IIILjava_nio_Buffer_2 android_glWeightPointerOESBounds__IIILjava_nio_Buffer_2I
(JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jobject pointer_buf) { (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jobject pointer_buf, jint remaining) {
_env->ThrowNew(UOEClass, jarray _array = (jarray) 0;
"glWeightPointerOES"); jint _remaining;
GLvoid *pointer = (GLvoid *) 0;
if (pointer_buf) {
pointer = (GLvoid *) getDirectBufferPointer(_env, pointer_buf);
if ( ! pointer ) {
return;
}
}
glWeightPointerOESBounds(
(GLint)size,
(GLenum)type,
(GLsizei)stride,
(GLvoid *)pointer,
(GLsizei)remaining
);
} }
/* void glDepthRangefOES ( GLclampf zNear, GLclampf zFar ) */ /* void glDepthRangefOES ( GLclampf zNear, GLclampf zFar ) */
@ -2426,8 +2477,8 @@ static JNINativeMethod methods[] = {
{"glGenerateMipmapOES", "(I)V", (void *) android_glGenerateMipmapOES__I }, {"glGenerateMipmapOES", "(I)V", (void *) android_glGenerateMipmapOES__I },
{"glCurrentPaletteMatrixOES", "(I)V", (void *) android_glCurrentPaletteMatrixOES__I }, {"glCurrentPaletteMatrixOES", "(I)V", (void *) android_glCurrentPaletteMatrixOES__I },
{"glLoadPaletteFromModelViewMatrixOES", "()V", (void *) android_glLoadPaletteFromModelViewMatrixOES__ }, {"glLoadPaletteFromModelViewMatrixOES", "()V", (void *) android_glLoadPaletteFromModelViewMatrixOES__ },
{"glMatrixIndexPointerOES", "(IIILjava/nio/Buffer;)V", (void *) android_glMatrixIndexPointerOES__IIILjava_nio_Buffer_2 }, {"glMatrixIndexPointerOESBounds", "(IIILjava/nio/Buffer;I)V", (void *) android_glMatrixIndexPointerOESBounds__IIILjava_nio_Buffer_2I },
{"glWeightPointerOES", "(IIILjava/nio/Buffer;)V", (void *) android_glWeightPointerOES__IIILjava_nio_Buffer_2 }, {"glWeightPointerOESBounds", "(IIILjava/nio/Buffer;I)V", (void *) android_glWeightPointerOESBounds__IIILjava_nio_Buffer_2I },
{"glDepthRangefOES", "(FF)V", (void *) android_glDepthRangefOES__FF }, {"glDepthRangefOES", "(FF)V", (void *) android_glDepthRangefOES__FF },
{"glFrustumfOES", "(FFFFFF)V", (void *) android_glFrustumfOES__FFFFFF }, {"glFrustumfOES", "(FFFFFF)V", (void *) android_glFrustumfOES__FFFFFF },
{"glOrthofOES", "(FFFFFF)V", (void *) android_glOrthofOES__FFFFFF }, {"glOrthofOES", "(FFFFFF)V", (void *) android_glOrthofOES__FFFFFF },

View File

@ -35,6 +35,12 @@ GL_API void GL_APIENTRY glTexCoordPointerBounds(GLint size, GLenum type,
GLsizei stride, const GLvoid *pointer, GLsizei count); GLsizei stride, const GLvoid *pointer, GLsizei count);
GL_API void GL_APIENTRY glVertexPointerBounds(GLint size, GLenum type, GL_API void GL_APIENTRY glVertexPointerBounds(GLint size, GLenum type,
GLsizei stride, const GLvoid *pointer, GLsizei count); GLsizei stride, const GLvoid *pointer, GLsizei count);
GL_API void GL_APIENTRY glPointSizePointerOESBounds(GLenum type,
GLsizei stride, const GLvoid *pointer, GLsizei count);
GL_API void GL_APIENTRY glMatrixIndexPointerOESBounds(GLint size, GLenum type,
GLsizei stride, const GLvoid *pointer, GLsizei count);
GL_API void GL_APIENTRY glWeightPointerOESBounds(GLint size, GLenum type,
GLsizei stride, const GLvoid *pointer, GLsizei count);
} }
static int initialized = 0; static int initialized = 0;
@ -5391,21 +5397,24 @@ exit:
/* void glPointSizePointerOES ( GLenum type, GLsizei stride, const GLvoid *pointer ) */ /* void glPointSizePointerOES ( GLenum type, GLsizei stride, const GLvoid *pointer ) */
static void static void
android_glPointSizePointerOES__IILjava_nio_Buffer_2 android_glPointSizePointerOESBounds__IILjava_nio_Buffer_2I
(JNIEnv *_env, jobject _this, jint type, jint stride, jobject pointer_buf) { (JNIEnv *_env, jobject _this, jint type, jint stride, jobject pointer_buf, jint remaining) {
jarray _array = (jarray) 0; jarray _array = (jarray) 0;
jint _remaining; jint _remaining;
GLvoid *pointer = (GLvoid *) 0; GLvoid *pointer = (GLvoid *) 0;
pointer = (GLvoid *)getPointer(_env, pointer_buf, &_array, &_remaining); if (pointer_buf) {
glPointSizePointerOES( pointer = (GLvoid *) getDirectBufferPointer(_env, pointer_buf);
if ( ! pointer ) {
return;
}
}
glPointSizePointerOESBounds(
(GLenum)type, (GLenum)type,
(GLsizei)stride, (GLsizei)stride,
(GLvoid *)pointer (GLvoid *)pointer,
(GLsizei)remaining
); );
if (_array) {
releasePointer(_env, _array, pointer, JNI_FALSE);
}
} }
/* void glTexCoordPointer ( GLint size, GLenum type, GLsizei stride, GLint offset ) */ /* void glTexCoordPointer ( GLint size, GLenum type, GLsizei stride, GLint offset ) */
@ -5754,8 +5763,9 @@ android_glVertexPointer__IIII
static void static void
android_glCurrentPaletteMatrixOES__I android_glCurrentPaletteMatrixOES__I
(JNIEnv *_env, jobject _this, jint matrixpaletteindex) { (JNIEnv *_env, jobject _this, jint matrixpaletteindex) {
_env->ThrowNew(UOEClass, glCurrentPaletteMatrixOES(
"glCurrentPaletteMatrixOES"); (GLuint)matrixpaletteindex
);
} }
/* void glDrawTexfOES ( GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height ) */ /* void glDrawTexfOES ( GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height ) */
@ -6050,40 +6060,77 @@ exit:
static void static void
android_glLoadPaletteFromModelViewMatrixOES__ android_glLoadPaletteFromModelViewMatrixOES__
(JNIEnv *_env, jobject _this) { (JNIEnv *_env, jobject _this) {
_env->ThrowNew(UOEClass, glLoadPaletteFromModelViewMatrixOES();
"glLoadPaletteFromModelViewMatrixOES");
} }
/* void glMatrixIndexPointerOES ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ) */ /* void glMatrixIndexPointerOES ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ) */
static void static void
android_glMatrixIndexPointerOES__IIILjava_nio_Buffer_2 android_glMatrixIndexPointerOESBounds__IIILjava_nio_Buffer_2I
(JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jobject pointer_buf) { (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jobject pointer_buf, jint remaining) {
_env->ThrowNew(UOEClass, jarray _array = (jarray) 0;
"glMatrixIndexPointerOES"); jint _remaining;
GLvoid *pointer = (GLvoid *) 0;
if (pointer_buf) {
pointer = (GLvoid *) getDirectBufferPointer(_env, pointer_buf);
if ( ! pointer ) {
return;
}
}
glMatrixIndexPointerOESBounds(
(GLint)size,
(GLenum)type,
(GLsizei)stride,
(GLvoid *)pointer,
(GLsizei)remaining
);
} }
/* void glMatrixIndexPointerOES ( GLint size, GLenum type, GLsizei stride, GLint offset ) */ /* void glMatrixIndexPointerOES ( GLint size, GLenum type, GLsizei stride, GLint offset ) */
static void static void
android_glMatrixIndexPointerOES__IIII android_glMatrixIndexPointerOES__IIII
(JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jint offset) { (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jint offset) {
_env->ThrowNew(UOEClass, glMatrixIndexPointerOES(
"glMatrixIndexPointerOES"); (GLint)size,
(GLenum)type,
(GLsizei)stride,
(const GLvoid *)offset
);
} }
/* void glWeightPointerOES ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ) */ /* void glWeightPointerOES ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ) */
static void static void
android_glWeightPointerOES__IIILjava_nio_Buffer_2 android_glWeightPointerOESBounds__IIILjava_nio_Buffer_2I
(JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jobject pointer_buf) { (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jobject pointer_buf, jint remaining) {
_env->ThrowNew(UOEClass, jarray _array = (jarray) 0;
"glWeightPointerOES"); jint _remaining;
GLvoid *pointer = (GLvoid *) 0;
if (pointer_buf) {
pointer = (GLvoid *) getDirectBufferPointer(_env, pointer_buf);
if ( ! pointer ) {
return;
}
}
glWeightPointerOESBounds(
(GLint)size,
(GLenum)type,
(GLsizei)stride,
(GLvoid *)pointer,
(GLsizei)remaining
);
} }
/* void glWeightPointerOES ( GLint size, GLenum type, GLsizei stride, GLint offset ) */ /* void glWeightPointerOES ( GLint size, GLenum type, GLsizei stride, GLint offset ) */
static void static void
android_glWeightPointerOES__IIII android_glWeightPointerOES__IIII
(JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jint offset) { (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jint offset) {
_env->ThrowNew(UOEClass, glWeightPointerOES(
"glWeightPointerOES"); (GLint)size,
(GLenum)type,
(GLsizei)stride,
(const GLvoid *)offset
);
} }
/* void glBindFramebufferOES ( GLint target, GLint framebuffer ) */ /* void glBindFramebufferOES ( GLint target, GLint framebuffer ) */
@ -6584,7 +6631,7 @@ static JNINativeMethod methods[] = {
{"glPointParameterx", "(II)V", (void *) android_glPointParameterx__II }, {"glPointParameterx", "(II)V", (void *) android_glPointParameterx__II },
{"glPointParameterxv", "(I[II)V", (void *) android_glPointParameterxv__I_3II }, {"glPointParameterxv", "(I[II)V", (void *) android_glPointParameterxv__I_3II },
{"glPointParameterxv", "(ILjava/nio/IntBuffer;)V", (void *) android_glPointParameterxv__ILjava_nio_IntBuffer_2 }, {"glPointParameterxv", "(ILjava/nio/IntBuffer;)V", (void *) android_glPointParameterxv__ILjava_nio_IntBuffer_2 },
{"glPointSizePointerOES", "(IILjava/nio/Buffer;)V", (void *) android_glPointSizePointerOES__IILjava_nio_Buffer_2 }, {"glPointSizePointerOESBounds", "(IILjava/nio/Buffer;I)V", (void *) android_glPointSizePointerOESBounds__IILjava_nio_Buffer_2I },
{"glTexCoordPointer", "(IIII)V", (void *) android_glTexCoordPointer__IIII }, {"glTexCoordPointer", "(IIII)V", (void *) android_glTexCoordPointer__IIII },
{"glTexEnvi", "(III)V", (void *) android_glTexEnvi__III }, {"glTexEnvi", "(III)V", (void *) android_glTexEnvi__III },
{"glTexEnviv", "(II[II)V", (void *) android_glTexEnviv__II_3II }, {"glTexEnviv", "(II[II)V", (void *) android_glTexEnviv__II_3II },
@ -6611,9 +6658,9 @@ static JNINativeMethod methods[] = {
{"glDrawTexxvOES", "([II)V", (void *) android_glDrawTexxvOES___3II }, {"glDrawTexxvOES", "([II)V", (void *) android_glDrawTexxvOES___3II },
{"glDrawTexxvOES", "(Ljava/nio/IntBuffer;)V", (void *) android_glDrawTexxvOES__Ljava_nio_IntBuffer_2 }, {"glDrawTexxvOES", "(Ljava/nio/IntBuffer;)V", (void *) android_glDrawTexxvOES__Ljava_nio_IntBuffer_2 },
{"glLoadPaletteFromModelViewMatrixOES", "()V", (void *) android_glLoadPaletteFromModelViewMatrixOES__ }, {"glLoadPaletteFromModelViewMatrixOES", "()V", (void *) android_glLoadPaletteFromModelViewMatrixOES__ },
{"glMatrixIndexPointerOES", "(IIILjava/nio/Buffer;)V", (void *) android_glMatrixIndexPointerOES__IIILjava_nio_Buffer_2 }, {"glMatrixIndexPointerOESBounds", "(IIILjava/nio/Buffer;I)V", (void *) android_glMatrixIndexPointerOESBounds__IIILjava_nio_Buffer_2I },
{"glMatrixIndexPointerOES", "(IIII)V", (void *) android_glMatrixIndexPointerOES__IIII }, {"glMatrixIndexPointerOES", "(IIII)V", (void *) android_glMatrixIndexPointerOES__IIII },
{"glWeightPointerOES", "(IIILjava/nio/Buffer;)V", (void *) android_glWeightPointerOES__IIILjava_nio_Buffer_2 }, {"glWeightPointerOESBounds", "(IIILjava/nio/Buffer;I)V", (void *) android_glWeightPointerOESBounds__IIILjava_nio_Buffer_2I },
{"glWeightPointerOES", "(IIII)V", (void *) android_glWeightPointerOES__IIII }, {"glWeightPointerOES", "(IIII)V", (void *) android_glWeightPointerOES__IIII },
{"glBindFramebufferOES", "(II)V", (void *) android_glBindFramebufferOES__II }, {"glBindFramebufferOES", "(II)V", (void *) android_glBindFramebufferOES__II },
{"glBindRenderbufferOES", "(II)V", (void *) android_glBindRenderbufferOES__II }, {"glBindRenderbufferOES", "(II)V", (void *) android_glBindRenderbufferOES__II },

View File

@ -150,6 +150,7 @@ public class GLES11 extends GLES10 {
_nativeClassInit(); _nativeClassInit();
} }
private static Buffer _pointSizePointerOES;
// C function void glBindBuffer ( GLenum target, GLuint buffer ) // C function void glBindBuffer ( GLenum target, GLuint buffer )
public static native void glBindBuffer( public static native void glBindBuffer(
@ -596,11 +597,30 @@ public class GLES11 extends GLES10 {
// C function void glPointSizePointerOES ( GLenum type, GLsizei stride, const GLvoid *pointer ) // C function void glPointSizePointerOES ( GLenum type, GLsizei stride, const GLvoid *pointer )
public static native void glPointSizePointerOES( private static native void glPointSizePointerOESBounds(
int type,
int stride,
java.nio.Buffer pointer,
int remaining
);
public static void glPointSizePointerOES(
int type, int type,
int stride, int stride,
java.nio.Buffer pointer java.nio.Buffer pointer
); ) {
glPointSizePointerOESBounds(
type,
stride,
pointer,
pointer.remaining()
);
if (((type == GL_FLOAT) ||
(type == GL_FIXED)) &&
(stride >= 0)) {
_pointSizePointerOES = pointer;
}
}
// C function void glTexCoordPointer ( GLint size, GLenum type, GLsizei stride, GLint offset ) // C function void glTexCoordPointer ( GLint size, GLenum type, GLsizei stride, GLint offset )

View File

@ -19,6 +19,8 @@
package android.opengl; package android.opengl;
import java.nio.Buffer;
public class GLES11Ext { public class GLES11Ext {
public static final int GL_BLEND_EQUATION_RGB_OES = 0x8009; public static final int GL_BLEND_EQUATION_RGB_OES = 0x8009;
public static final int GL_BLEND_EQUATION_ALPHA_OES = 0x883D; public static final int GL_BLEND_EQUATION_ALPHA_OES = 0x883D;
@ -129,6 +131,12 @@ public class GLES11Ext {
_nativeClassInit(); _nativeClassInit();
} }
private static final int GL_BYTE = GLES10.GL_BYTE;
private static final int GL_FIXED = GLES10.GL_FIXED;
private static final int GL_FLOAT = GLES10.GL_FLOAT;
private static final int GL_SHORT = GLES10.GL_SHORT;
private static Buffer _matrixIndexPointerOES;
// C function void glBlendEquationSeparateOES ( GLenum modeRGB, GLenum modeAlpha ) // C function void glBlendEquationSeparateOES ( GLenum modeRGB, GLenum modeAlpha )
public static native void glBlendEquationSeparateOES( public static native void glBlendEquationSeparateOES(
@ -866,21 +874,63 @@ public class GLES11Ext {
// C function void glMatrixIndexPointerOES ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ) // C function void glMatrixIndexPointerOES ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer )
public static native void glMatrixIndexPointerOES( private static native void glMatrixIndexPointerOESBounds(
int size,
int type,
int stride,
java.nio.Buffer pointer,
int remaining
);
public static void glMatrixIndexPointerOES(
int size, int size,
int type, int type,
int stride, int stride,
java.nio.Buffer pointer java.nio.Buffer pointer
); ) {
glMatrixIndexPointerOESBounds(
size,
type,
stride,
pointer,
pointer.remaining()
);
if (((size == 2) ||
(size == 3) ||
(size == 4)) &&
((type == GL_FLOAT) ||
(type == GL_BYTE) ||
(type == GL_SHORT) ||
(type == GL_FIXED)) &&
(stride >= 0)) {
_matrixIndexPointerOES = pointer;
}
}
// C function void glWeightPointerOES ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ) // C function void glWeightPointerOES ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer )
public static native void glWeightPointerOES( private static native void glWeightPointerOESBounds(
int size,
int type,
int stride,
java.nio.Buffer pointer,
int remaining
);
public static void glWeightPointerOES(
int size, int size,
int type, int type,
int stride, int stride,
java.nio.Buffer pointer java.nio.Buffer pointer
); ) {
glWeightPointerOESBounds(
size,
type,
stride,
pointer,
pointer.remaining()
);
}
// C function void glDepthRangefOES ( GLclampf zNear, GLclampf zFar ) // C function void glDepthRangefOES ( GLclampf zNear, GLclampf zFar )

View File

@ -2,16 +2,16 @@
** **
** Copyright 2009, The Android Open Source Project ** Copyright 2009, The Android Open Source Project
** **
** Licensed under the Apache License, Version 2.0 (the "License"); ** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License. ** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at ** You may obtain a copy of the License at
** **
** http://www.apache.org/licenses/LICENSE-2.0 ** http://www.apache.org/licenses/LICENSE-2.0
** **
** Unless required by applicable law or agreed to in writing, software ** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS, ** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and ** See the License for the specific language governing permissions and
** limitations under the License. ** limitations under the License.
*/ */
@ -19,8 +19,7 @@
package android.opengl; package android.opengl;
/** OpenGL ES 2.0. This class exposes the core OpenGL ES 2.0 APIs. /** OpenGL ES 2.0
* All the methods are static.
*/ */
public class GLES20 { public class GLES20 {
public static final int GL_ACTIVE_TEXTURE = 0x84E0; public static final int GL_ACTIVE_TEXTURE = 0x84E0;
@ -49,7 +48,7 @@ public class GLES20 {
public static final int GL_SRC_ALPHA_SATURATE = 0x0308; public static final int GL_SRC_ALPHA_SATURATE = 0x0308;
public static final int GL_FUNC_ADD = 0x8006; public static final int GL_FUNC_ADD = 0x8006;
public static final int GL_BLEND_EQUATION = 0x8009; public static final int GL_BLEND_EQUATION = 0x8009;
public static final int GL_BLEND_EQUATION_RGB = 0x8009; public static final int GL_BLEND_EQUATION_RGB = 0x8009; /* same as BLEND_EQUATION */
public static final int GL_BLEND_EQUATION_ALPHA = 0x883D; public static final int GL_BLEND_EQUATION_ALPHA = 0x883D;
public static final int GL_FUNC_SUBTRACT = 0x800A; public static final int GL_FUNC_SUBTRACT = 0x800A;
public static final int GL_FUNC_REVERSE_SUBTRACT = 0x800B; public static final int GL_FUNC_REVERSE_SUBTRACT = 0x800B;
@ -328,7 +327,7 @@ public class GLES20 {
native private static void _nativeClassInit(); native private static void _nativeClassInit();
static { static {
_nativeClassInit(); _nativeClassInit();
} }
// C function void glActiveTexture ( GLenum texture ) // C function void glActiveTexture ( GLenum texture )
@ -980,7 +979,7 @@ public class GLES20 {
); );
// C function void glGetProgramInfoLog( GLuint program, GLsizei maxLength, GLsizei * length, // C function void glGetProgramInfoLog( GLuint program, GLsizei maxLength, GLsizei * length,
// GLchar * infoLog); // GLchar * infoLog);
public static native String glGetProgramInfoLog( public static native String glGetProgramInfoLog(
int program int program
@ -1020,7 +1019,7 @@ public class GLES20 {
); );
// C function void glGetShaderInfoLog( GLuint shader, GLsizei maxLength, GLsizei * length, // C function void glGetShaderInfoLog( GLuint shader, GLsizei maxLength, GLsizei * length,
// GLchar * infoLog); // GLchar * infoLog);
public static native String glGetShaderInfoLog( public static native String glGetShaderInfoLog(
int shader int shader

View File

@ -932,83 +932,83 @@ class GLLogWrapper extends GLWrapperBase {
boolean convertWholeBuffer = (byteCount < 0); boolean convertWholeBuffer = (byteCount < 0);
if (input instanceof ByteBuffer) { if (input instanceof ByteBuffer) {
ByteBuffer input2 = (ByteBuffer) input; ByteBuffer input2 = (ByteBuffer) input;
int position = input2.position();
if (convertWholeBuffer) { if (convertWholeBuffer) {
byteCount = input2.limit(); byteCount = input2.limit() - position;
} }
result = ByteBuffer.allocate(byteCount).order(input2.order()); result = ByteBuffer.allocate(byteCount).order(input2.order());
int position = input2.position();
for (int i = 0; i < byteCount; i++) { for (int i = 0; i < byteCount; i++) {
result.put(input2.get()); result.put(input2.get());
} }
input2.position(position); input2.position(position);
} else if (input instanceof CharBuffer) { } else if (input instanceof CharBuffer) {
CharBuffer input2 = (CharBuffer) input; CharBuffer input2 = (CharBuffer) input;
int position = input2.position();
if (convertWholeBuffer) { if (convertWholeBuffer) {
byteCount = input2.limit() * 2; byteCount = (input2.limit() - position) * 2;
} }
result = ByteBuffer.allocate(byteCount).order(input2.order()); result = ByteBuffer.allocate(byteCount).order(input2.order());
CharBuffer result2 = result.asCharBuffer(); CharBuffer result2 = result.asCharBuffer();
int position = input2.position();
for (int i = 0; i < byteCount / 2; i++) { for (int i = 0; i < byteCount / 2; i++) {
result2.put(input2.get()); result2.put(input2.get());
} }
input2.position(position); input2.position(position);
} else if (input instanceof ShortBuffer) { } else if (input instanceof ShortBuffer) {
ShortBuffer input2 = (ShortBuffer) input; ShortBuffer input2 = (ShortBuffer) input;
int position = input2.position();
if (convertWholeBuffer) { if (convertWholeBuffer) {
byteCount = input2.limit() * 2; byteCount = (input2.limit() - position)* 2;
} }
result = ByteBuffer.allocate(byteCount).order(input2.order()); result = ByteBuffer.allocate(byteCount).order(input2.order());
ShortBuffer result2 = result.asShortBuffer(); ShortBuffer result2 = result.asShortBuffer();
int position = input2.position();
for (int i = 0; i < byteCount / 2; i++) { for (int i = 0; i < byteCount / 2; i++) {
result2.put(input2.get()); result2.put(input2.get());
} }
input2.position(position); input2.position(position);
} else if (input instanceof IntBuffer) { } else if (input instanceof IntBuffer) {
IntBuffer input2 = (IntBuffer) input; IntBuffer input2 = (IntBuffer) input;
int position = input2.position();
if (convertWholeBuffer) { if (convertWholeBuffer) {
byteCount = input2.limit() * 4; byteCount = (input2.limit() - position) * 4;
} }
result = ByteBuffer.allocate(byteCount).order(input2.order()); result = ByteBuffer.allocate(byteCount).order(input2.order());
IntBuffer result2 = result.asIntBuffer(); IntBuffer result2 = result.asIntBuffer();
int position = input2.position();
for (int i = 0; i < byteCount / 4; i++) { for (int i = 0; i < byteCount / 4; i++) {
result2.put(input2.get()); result2.put(input2.get());
} }
input2.position(position); input2.position(position);
} else if (input instanceof FloatBuffer) { } else if (input instanceof FloatBuffer) {
FloatBuffer input2 = (FloatBuffer) input; FloatBuffer input2 = (FloatBuffer) input;
int position = input2.position();
if (convertWholeBuffer) { if (convertWholeBuffer) {
byteCount = input2.limit() * 4; byteCount = (input2.limit() - position) * 4;
} }
result = ByteBuffer.allocate(byteCount).order(input2.order()); result = ByteBuffer.allocate(byteCount).order(input2.order());
FloatBuffer result2 = result.asFloatBuffer(); FloatBuffer result2 = result.asFloatBuffer();
int position = input2.position();
for (int i = 0; i < byteCount / 4; i++) { for (int i = 0; i < byteCount / 4; i++) {
result2.put(input2.get()); result2.put(input2.get());
} }
input2.position(position); input2.position(position);
} else if (input instanceof DoubleBuffer) { } else if (input instanceof DoubleBuffer) {
DoubleBuffer input2 = (DoubleBuffer) input; DoubleBuffer input2 = (DoubleBuffer) input;
int position = input2.position();
if (convertWholeBuffer) { if (convertWholeBuffer) {
byteCount = input2.limit() * 8; byteCount = (input2.limit() - position) * 8;
} }
result = ByteBuffer.allocate(byteCount).order(input2.order()); result = ByteBuffer.allocate(byteCount).order(input2.order());
DoubleBuffer result2 = result.asDoubleBuffer(); DoubleBuffer result2 = result.asDoubleBuffer();
int position = input2.position();
for (int i = 0; i < byteCount / 8; i++) { for (int i = 0; i < byteCount / 8; i++) {
result2.put(input2.get()); result2.put(input2.get());
} }
input2.position(position); input2.position(position);
} else if (input instanceof LongBuffer) { } else if (input instanceof LongBuffer) {
LongBuffer input2 = (LongBuffer) input; LongBuffer input2 = (LongBuffer) input;
int position = input2.position();
if (convertWholeBuffer) { if (convertWholeBuffer) {
byteCount = input2.limit() * 8; byteCount = (input2.limit() - position) * 8;
} }
result = ByteBuffer.allocate(byteCount).order(input2.order()); result = ByteBuffer.allocate(byteCount).order(input2.order());
LongBuffer result2 = result.asLongBuffer(); LongBuffer result2 = result.asLongBuffer();
int position = input2.position();
for (int i = 0; i < byteCount / 8; i++) { for (int i = 0; i < byteCount / 8; i++) {
result2.put(input2.get()); result2.put(input2.get());
} }
@ -1064,8 +1064,8 @@ class GLLogWrapper extends GLWrapperBase {
} }
builder.append(" "); builder.append(" ");
builder.append(name + ":{"); builder.append(name + ":{");
if (pointer == null) { if (pointer == null || pointer.mTempByteBuffer == null ) {
builder.append("undefined"); builder.append("undefined }");
return; return;
} }
if (pointer.mStride < 0) { if (pointer.mStride < 0) {
@ -3010,6 +3010,9 @@ class GLLogWrapper extends GLWrapperBase {
public Buffer mPointer; public Buffer mPointer;
public ByteBuffer mTempByteBuffer; // Only valid during glDrawXXX calls public ByteBuffer mTempByteBuffer; // Only valid during glDrawXXX calls
public PointerInfo() {
}
public PointerInfo(int size, int type, int stride, Buffer pointer) { public PointerInfo(int size, int type, int stride, Buffer pointer) {
mSize = size; mSize = size;
mType = type; mType = type;
@ -3039,7 +3042,7 @@ class GLLogWrapper extends GLWrapperBase {
} }
public void bindByteBuffer() { public void bindByteBuffer() {
mTempByteBuffer = toByteBuffer(-1, mPointer); mTempByteBuffer = mPointer == null ? null : toByteBuffer(-1, mPointer);
} }
public void unbindByteBuffer() { public void unbindByteBuffer() {
@ -3051,10 +3054,10 @@ class GLLogWrapper extends GLWrapperBase {
private boolean mLogArgumentNames; private boolean mLogArgumentNames;
private int mArgCount; private int mArgCount;
private PointerInfo mColorPointer; private PointerInfo mColorPointer = new PointerInfo();
private PointerInfo mNormalPointer; private PointerInfo mNormalPointer = new PointerInfo();
private PointerInfo mTexCoordPointer; private PointerInfo mTexCoordPointer = new PointerInfo();
private PointerInfo mVertexPointer; private PointerInfo mVertexPointer = new PointerInfo();
boolean mColorArrayEnabled; boolean mColorArrayEnabled;
boolean mNormalArrayEnabled; boolean mNormalArrayEnabled;

View File

@ -45,6 +45,9 @@ public class GLImpl implements GL10, GL10Ext, GL11, GL11Ext, GL11ExtensionPack {
Buffer _normalPointer = null; Buffer _normalPointer = null;
Buffer _texCoordPointer = null; Buffer _texCoordPointer = null;
Buffer _vertexPointer = null; Buffer _vertexPointer = null;
Buffer _pointSizePointerOES = null;
Buffer _matrixIndexPointerOES = null;
Buffer _weightPointerOES = null;
public GLImpl() { public GLImpl() {
} }
@ -1582,11 +1585,30 @@ public class GLImpl implements GL10, GL10Ext, GL11, GL11Ext, GL11ExtensionPack {
// C function void glPointSizePointerOES ( GLenum type, GLsizei stride, const GLvoid *pointer ) // C function void glPointSizePointerOES ( GLenum type, GLsizei stride, const GLvoid *pointer )
public native void glPointSizePointerOES( private native void glPointSizePointerOESBounds(
int type,
int stride,
java.nio.Buffer pointer,
int remaining
);
public void glPointSizePointerOES(
int type, int type,
int stride, int stride,
java.nio.Buffer pointer java.nio.Buffer pointer
); ) {
glPointSizePointerOESBounds(
type,
stride,
pointer,
pointer.remaining()
);
if (((type == GL_FLOAT) ||
(type == GL_FIXED)) &&
(stride >= 0)) {
_pointSizePointerOES = pointer;
}
}
// C function void glTexCoordPointer ( GLint size, GLenum type, GLsizei stride, GLint offset ) // C function void glTexCoordPointer ( GLint size, GLenum type, GLsizei stride, GLint offset )
@ -1795,12 +1817,38 @@ public class GLImpl implements GL10, GL10Ext, GL11, GL11Ext, GL11ExtensionPack {
// C function void glMatrixIndexPointerOES ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ) // C function void glMatrixIndexPointerOES ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer )
public native void glMatrixIndexPointerOES( private native void glMatrixIndexPointerOESBounds(
int size,
int type,
int stride,
java.nio.Buffer pointer,
int remaining
);
public void glMatrixIndexPointerOES(
int size, int size,
int type, int type,
int stride, int stride,
java.nio.Buffer pointer java.nio.Buffer pointer
); ) {
glMatrixIndexPointerOESBounds(
size,
type,
stride,
pointer,
pointer.remaining()
);
if (((size == 2) ||
(size == 3) ||
(size == 4)) &&
((type == GL_FLOAT) ||
(type == GL_BYTE) ||
(type == GL_SHORT) ||
(type == GL_FIXED)) &&
(stride >= 0)) {
_matrixIndexPointerOES = pointer;
}
}
// C function void glMatrixIndexPointerOES ( GLint size, GLenum type, GLsizei stride, GLint offset ) // C function void glMatrixIndexPointerOES ( GLint size, GLenum type, GLsizei stride, GLint offset )
@ -1813,12 +1861,28 @@ public class GLImpl implements GL10, GL10Ext, GL11, GL11Ext, GL11ExtensionPack {
// C function void glWeightPointerOES ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ) // C function void glWeightPointerOES ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer )
public native void glWeightPointerOES( private native void glWeightPointerOESBounds(
int size,
int type,
int stride,
java.nio.Buffer pointer,
int remaining
);
public void glWeightPointerOES(
int size, int size,
int type, int type,
int stride, int stride,
java.nio.Buffer pointer java.nio.Buffer pointer
); ) {
glWeightPointerOESBounds(
size,
type,
stride,
pointer,
pointer.remaining()
);
}
// C function void glWeightPointerOES ( GLint size, GLenum type, GLsizei stride, GLint offset ) // C function void glWeightPointerOES ( GLint size, GLenum type, GLsizei stride, GLint offset )

View File

@ -47,6 +47,12 @@ GL_API void GL_APIENTRY glTexCoordPointerBounds(GLint size, GLenum type,
GLsizei stride, const GLvoid *pointer, GLsizei count); GLsizei stride, const GLvoid *pointer, GLsizei count);
GL_API void GL_APIENTRY glVertexPointerBounds(GLint size, GLenum type, GL_API void GL_APIENTRY glVertexPointerBounds(GLint size, GLenum type,
GLsizei stride, const GLvoid *pointer, GLsizei count); GLsizei stride, const GLvoid *pointer, GLsizei count);
GL_API void GL_APIENTRY glPointSizePointerOESBounds(GLenum type,
GLsizei stride, const GLvoid *pointer, GLsizei count);
GL_API void GL_APIENTRY glMatrixIndexPointerOESBounds(GLint size, GLenum type,
GLsizei stride, const GLvoid *pointer, GLsizei count);
GL_API void GL_APIENTRY glWeightPointerOESBounds(GLint size, GLenum type,
GLsizei stride, const GLvoid *pointer, GLsizei count);
} }
void glColorPointerBounds(GLint size, GLenum type, GLsizei stride, void glColorPointerBounds(GLint size, GLenum type, GLsizei stride,
@ -66,6 +72,21 @@ void glVertexPointerBounds(GLint size, GLenum type,
glVertexPointer(size, type, stride, pointer); glVertexPointer(size, type, stride, pointer);
} }
void GL_APIENTRY glPointSizePointerOESBounds(GLenum type,
GLsizei stride, const GLvoid *pointer, GLsizei count) {
glPointSizePointerOES(type, stride, pointer);
}
GL_API void GL_APIENTRY glMatrixIndexPointerOESBounds(GLint size, GLenum type,
GLsizei stride, const GLvoid *pointer, GLsizei count) {
glMatrixIndexPointerOES(size, type, stride, pointer);
}
GL_API void GL_APIENTRY glWeightPointerOESBounds(GLint size, GLenum type,
GLsizei stride, const GLvoid *pointer, GLsizei count) {
glWeightPointerOES(size, type, stride, pointer);
}
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// Actual GL entry-points // Actual GL entry-points
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------

View File

@ -37,7 +37,6 @@ glBlendEquation unsupported
glBlendEquationSeparate unsupported glBlendEquationSeparate unsupported
glBlendFuncSeparate unsupported glBlendFuncSeparate unsupported
glCheckFramebufferStatusOES unsupported return 0 glCheckFramebufferStatusOES unsupported return 0
glCurrentPaletteMatrixOES unsupported
glDeleteFramebuffersOES unsupported glDeleteFramebuffersOES unsupported
glDeleteRenderbuffersOES unsupported glDeleteRenderbuffersOES unsupported
glFramebufferRenderbufferOES unsupported glFramebufferRenderbufferOES unsupported
@ -52,11 +51,8 @@ glGetRenderbufferParameterivOES unsupported
glGetTexGen unsupported glGetTexGen unsupported
glIsFramebufferOES unsupported return JNI_FALSE glIsFramebufferOES unsupported return JNI_FALSE
glIsRenderbufferOES unsupported return JNI_FALSE glIsRenderbufferOES unsupported return JNI_FALSE
glLoadPaletteFromModelViewMatrixOES unsupported
glMatrixIndexPointerOES unsupported
glRenderbufferStorageOES unsupported return false glRenderbufferStorageOES unsupported return false
glTexGen unsupported glTexGen unsupported
glTexGenf unsupported glTexGenf unsupported
glTexGeni unsupported glTexGeni unsupported
glTexGenx unsupported glTexGenx unsupported
glWeightPointerOES unsupported

View File

@ -35,7 +35,6 @@ glBlendEquation unsupported
glBlendEquationSeparate unsupported glBlendEquationSeparate unsupported
glBlendFuncSeparate unsupported glBlendFuncSeparate unsupported
glCheckFramebufferStatusOES unsupported return 0 glCheckFramebufferStatusOES unsupported return 0
glCurrentPaletteMatrixOES unsupported
glDeleteFramebuffersOES unsupported glDeleteFramebuffersOES unsupported
glDeleteRenderbuffersOES unsupported glDeleteRenderbuffersOES unsupported
glFramebufferRenderbufferOES unsupported glFramebufferRenderbufferOES unsupported
@ -50,11 +49,8 @@ glGetRenderbufferParameterivOES unsupported
glGetTexGen unsupported glGetTexGen unsupported
glIsFramebufferOES unsupported return JNI_FALSE glIsFramebufferOES unsupported return JNI_FALSE
glIsRenderbufferOES unsupported return JNI_FALSE glIsRenderbufferOES unsupported return JNI_FALSE
glLoadPaletteFromModelViewMatrixOES unsupported
glMatrixIndexPointerOES unsupported
glRenderbufferStorageOES unsupported return false glRenderbufferStorageOES unsupported return false
glTexGen unsupported glTexGen unsupported
glTexGenf unsupported glTexGenf unsupported
glTexGeni unsupported glTexGeni unsupported
glTexGenx unsupported glTexGenx unsupported
glWeightPointerOES unsupported

View File

@ -119,10 +119,15 @@ public class JniCodeEmitter {
emitFunction(jfunc, out, false, false); emitFunction(jfunc, out, false, false);
} }
boolean isPointerFunc(JFunc jfunc) {
String name = jfunc.getName();
return (name.endsWith("Pointer") || name.endsWith("PointerOES"))
&& jfunc.getCFunc().hasPointerArg();
}
void emitFunctionCall(JFunc jfunc, PrintStream out, String iii, boolean grabArray) { void emitFunctionCall(JFunc jfunc, PrintStream out, String iii, boolean grabArray) {
boolean isVoid = jfunc.getType().isVoid(); boolean isVoid = jfunc.getType().isVoid();
boolean isPointerFunc = jfunc.getName().endsWith("Pointer") && boolean isPointerFunc = isPointerFunc(jfunc);
jfunc.getCFunc().hasPointerArg();
if (!isVoid) { if (!isVoid) {
out.println(iii + out.println(iii +
@ -406,9 +411,7 @@ public class JniCodeEmitter {
* if !interfaceDecl: public <returntype> func(args) { body } * if !interfaceDecl: public <returntype> func(args) { body }
*/ */
void emitFunction(JFunc jfunc, PrintStream out, boolean nativeDecl, boolean interfaceDecl) { void emitFunction(JFunc jfunc, PrintStream out, boolean nativeDecl, boolean interfaceDecl) {
boolean isPointerFunc = boolean isPointerFunc = isPointerFunc(jfunc);
jfunc.getName().endsWith("Pointer") &&
jfunc.getCFunc().hasPointerArg();
if (!nativeDecl && !interfaceDecl && !isPointerFunc) { if (!nativeDecl && !interfaceDecl && !isPointerFunc) {
// If it's not a pointer function, we've already emitted it // If it's not a pointer function, we've already emitted it
@ -510,6 +513,34 @@ public class JniCodeEmitter {
out.println(iii + " (stride >= 0)) {"); out.println(iii + " (stride >= 0)) {");
out.println(iii + indent + "_vertexPointer = pointer;"); out.println(iii + indent + "_vertexPointer = pointer;");
out.println(iii + "}"); out.println(iii + "}");
} else if (fname.equals("glPointSizePointerOES")) {
out.println(iii + "if (((type == GL_FLOAT) ||");
out.println(iii + " (type == GL_FIXED)) &&");
out.println(iii + " (stride >= 0)) {");
out.println(iii + indent + "_pointSizePointerOES = pointer;");
out.println(iii + "}");
} else if (fname.equals("glMatrixIndexPointerOES")) {
out.println(iii + "if (((size == 2) ||");
out.println(iii + " (size == 3) ||");
out.println(iii + " (size == 4)) &&");
out.println(iii + " ((type == GL_FLOAT) ||");
out.println(iii + " (type == GL_BYTE) ||");
out.println(iii + " (type == GL_SHORT) ||");
out.println(iii + " (type == GL_FIXED)) &&");
out.println(iii + " (stride >= 0)) {");
out.println(iii + indent + "_matrixIndexPointerOES = pointer;");
out.println(iii + "}");
} else if (fname.equals("glWeightPointer")) {
out.println(iii + "if (((size == 2) ||");
out.println(iii + " (size == 3) ||");
out.println(iii + " (size == 4)) &&");
out.println(iii + " ((type == GL_FLOAT) ||");
out.println(iii + " (type == GL_BYTE) ||");
out.println(iii + " (type == GL_SHORT) ||");
out.println(iii + " (type == GL_FIXED)) &&");
out.println(iii + " (stride >= 0)) {");
out.println(iii + indent + "_weightPointerOES = pointer;");
out.println(iii + "}");
} }
} }
@ -609,9 +640,9 @@ public class JniCodeEmitter {
// //
String outName = "android_" + jfunc.getName(); String outName = "android_" + jfunc.getName();
boolean isPointerFunc = outName.endsWith("Pointer") && boolean isPointerFunc = isPointerFunc(jfunc);
jfunc.getCFunc().hasPointerArg();
boolean isVBOPointerFunc = (outName.endsWith("Pointer") || boolean isVBOPointerFunc = (outName.endsWith("Pointer") ||
outName.endsWith("PointerOES") ||
outName.endsWith("DrawElements")) && outName.endsWith("DrawElements")) &&
!jfunc.getCFunc().hasPointerArg(); !jfunc.getCFunc().hasPointerArg();
if (isPointerFunc) { if (isPointerFunc) {

View File

@ -18,6 +18,8 @@
package android.opengl; package android.opengl;
import java.nio.Buffer;
public class GLES11Ext { public class GLES11Ext {
public static final int GL_BLEND_EQUATION_RGB_OES = 0x8009; public static final int GL_BLEND_EQUATION_RGB_OES = 0x8009;
public static final int GL_BLEND_EQUATION_ALPHA_OES = 0x883D; public static final int GL_BLEND_EQUATION_ALPHA_OES = 0x883D;
@ -127,4 +129,10 @@ public class GLES11Ext {
static { static {
_nativeClassInit(); _nativeClassInit();
} }
private static final int GL_BYTE = GLES10.GL_BYTE;
private static final int GL_FIXED = GLES10.GL_FIXED;
private static final int GL_FLOAT = GLES10.GL_FLOAT;
private static final int GL_SHORT = GLES10.GL_SHORT;
private static Buffer _matrixIndexPointerOES;

View File

@ -23,6 +23,15 @@
#include <GLES/gl.h> #include <GLES/gl.h>
#include <GLES/glext.h> #include <GLES/glext.h>
/* special calls implemented in Android's GLES wrapper used to more
* efficiently bound-check passed arrays */
extern "C" {
GL_API void GL_APIENTRY glMatrixIndexPointerOESBounds(GLint size, GLenum type, GLsizei stride,
const GLvoid *ptr, GLsizei count);
GL_API void GL_APIENTRY glWeightPointerOESBounds(GLint size, GLenum type, GLsizei stride,
const GLvoid *ptr, GLsizei count);
}
static int initialized = 0; static int initialized = 0;
static jclass nioAccessClass; static jclass nioAccessClass;
@ -121,5 +130,17 @@ releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit)
commit ? 0 : JNI_ABORT); commit ? 0 : JNI_ABORT);
} }
static void *
getDirectBufferPointer(JNIEnv *_env, jobject buffer) {
char* buf = (char*) _env->GetDirectBufferAddress(buffer);
if (buf) {
jint position = _env->GetIntField(buffer, positionID);
jint elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID);
buf += position << elementSizeShift;
} else {
_env->ThrowNew(IAEClass, "Must use a native order direct Buffer");
}
return (void*) buf;
}
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------

View File

@ -149,3 +149,4 @@ public class GLES11 extends GLES10 {
_nativeClassInit(); _nativeClassInit();
} }
private static Buffer _pointSizePointerOES;

View File

@ -23,6 +23,13 @@
#include <GLES/gl.h> #include <GLES/gl.h>
#include <GLES/glext.h> #include <GLES/glext.h>
/* special calls implemented in Android's GLES wrapper used to more
* efficiently bound-check passed arrays */
extern "C" {
GL_API void GL_APIENTRY glPointSizePointerOESBounds(GLenum type, GLsizei stride,
const GLvoid *ptr, GLsizei count);
}
static int initialized = 0; static int initialized = 0;
static jclass nioAccessClass; static jclass nioAccessClass;
@ -121,5 +128,18 @@ releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit)
commit ? 0 : JNI_ABORT); commit ? 0 : JNI_ABORT);
} }
static void *
getDirectBufferPointer(JNIEnv *_env, jobject buffer) {
char* buf = (char*) _env->GetDirectBufferAddress(buffer);
if (buf) {
jint position = _env->GetIntField(buffer, positionID);
jint elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID);
buf += position << elementSizeShift;
} else {
_env->ThrowNew(IAEClass, "Must use a native order direct Buffer");
}
return (void*) buf;
}
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------

View File

@ -19,7 +19,6 @@
package android.opengl; package android.opengl;
/** OpenGL ES 2.0 /** OpenGL ES 2.0
* @hide
*/ */
public class GLES20 { public class GLES20 {
public static final int GL_ACTIVE_TEXTURE = 0x84E0; public static final int GL_ACTIVE_TEXTURE = 0x84E0;

View File

@ -34,6 +34,12 @@ GL_API void GL_APIENTRY glTexCoordPointerBounds(GLint size, GLenum type,
GLsizei stride, const GLvoid *pointer, GLsizei count); GLsizei stride, const GLvoid *pointer, GLsizei count);
GL_API void GL_APIENTRY glVertexPointerBounds(GLint size, GLenum type, GL_API void GL_APIENTRY glVertexPointerBounds(GLint size, GLenum type,
GLsizei stride, const GLvoid *pointer, GLsizei count); GLsizei stride, const GLvoid *pointer, GLsizei count);
GL_API void GL_APIENTRY glPointSizePointerOESBounds(GLenum type,
GLsizei stride, const GLvoid *pointer, GLsizei count);
GL_API void GL_APIENTRY glMatrixIndexPointerOESBounds(GLint size, GLenum type,
GLsizei stride, const GLvoid *pointer, GLsizei count);
GL_API void GL_APIENTRY glWeightPointerOESBounds(GLint size, GLenum type,
GLsizei stride, const GLvoid *pointer, GLsizei count);
} }
static int initialized = 0; static int initialized = 0;

View File

@ -44,6 +44,9 @@ public class GLImpl implements GL10, GL10Ext, GL11, GL11Ext, GL11ExtensionPack {
Buffer _normalPointer = null; Buffer _normalPointer = null;
Buffer _texCoordPointer = null; Buffer _texCoordPointer = null;
Buffer _vertexPointer = null; Buffer _vertexPointer = null;
Buffer _pointSizePointerOES = null;
Buffer _matrixIndexPointerOES = null;
Buffer _weightPointerOES = null;
public GLImpl() { public GLImpl() {
} }