summaryrefslogtreecommitdiffstats
path: root/opengl/java/com
diff options
context:
space:
mode:
authorJack Palevich <jackpal@google.com>2009-05-07 18:28:29 -0700
committerJack Palevich <jackpal@google.com>2009-05-07 18:28:29 -0700
commite20ea783a12f1031482c3aa01938efe39dcbf0a2 (patch)
treeb32727a25f4cd4ca8c6ced40a9feb4ef6a665b9d /opengl/java/com
parent538bcd702c0053772245dfbb634c266959cf6af9 (diff)
downloadframeworks_base-e20ea783a12f1031482c3aa01938efe39dcbf0a2.zip
frameworks_base-e20ea783a12f1031482c3aa01938efe39dcbf0a2.tar.gz
frameworks_base-e20ea783a12f1031482c3aa01938efe39dcbf0a2.tar.bz2
Require native-order direct buffers for glXXXPointer APIs.
This was always a documented restriction, but was not enforced by the runtime until now. Until now, if you passed in some other kind of buffer, it would sometimes work, and sometimes fail. The failures happened when the Java VM moved the buffer data while OpenGL was still holding a pointer to it. Now we throw an exception rather than leaving the system in a potentially bad state.
Diffstat (limited to 'opengl/java/com')
-rw-r--r--opengl/java/com/google/android/gles_jni/GLImpl.java54
1 files changed, 27 insertions, 27 deletions
diff --git a/opengl/java/com/google/android/gles_jni/GLImpl.java b/opengl/java/com/google/android/gles_jni/GLImpl.java
index 47f07d0..4e365ef 100644
--- a/opengl/java/com/google/android/gles_jni/GLImpl.java
+++ b/opengl/java/com/google/android/gles_jni/GLImpl.java
@@ -172,13 +172,6 @@ public class GLImpl implements GL10, GL10Ext, GL11, GL11Ext, GL11ExtensionPack {
int stride,
java.nio.Buffer pointer
) {
- if ((size == 4) &&
- ((type == GL_FLOAT) ||
- (type == GL_UNSIGNED_BYTE) ||
- (type == GL_FIXED)) &&
- (stride >= 0)) {
- _colorPointer = pointer;
- }
glColorPointerBounds(
size,
type,
@@ -186,6 +179,13 @@ public class GLImpl implements GL10, GL10Ext, GL11, GL11Ext, GL11ExtensionPack {
pointer,
pointer.remaining()
);
+ if ((size == 4) &&
+ ((type == GL_FLOAT) ||
+ (type == GL_UNSIGNED_BYTE) ||
+ (type == GL_FIXED)) &&
+ (stride >= 0)) {
+ _colorPointer = pointer;
+ }
}
// C function void glCompressedTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data )
@@ -744,6 +744,12 @@ public class GLImpl implements GL10, GL10Ext, GL11, GL11Ext, GL11ExtensionPack {
int stride,
java.nio.Buffer pointer
) {
+ glNormalPointerBounds(
+ type,
+ stride,
+ pointer,
+ pointer.remaining()
+ );
if (((type == GL_FLOAT) ||
(type == GL_BYTE) ||
(type == GL_SHORT) ||
@@ -751,12 +757,6 @@ public class GLImpl implements GL10, GL10Ext, GL11, GL11Ext, GL11ExtensionPack {
(stride >= 0)) {
_normalPointer = pointer;
}
- glNormalPointerBounds(
- type,
- stride,
- pointer,
- pointer.remaining()
- );
}
// C function void glOrthof ( GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar )
@@ -937,6 +937,13 @@ public class GLImpl implements GL10, GL10Ext, GL11, GL11Ext, GL11ExtensionPack {
int stride,
java.nio.Buffer pointer
) {
+ glTexCoordPointerBounds(
+ size,
+ type,
+ stride,
+ pointer,
+ pointer.remaining()
+ );
if (((size == 2) ||
(size == 3) ||
(size == 4)) &&
@@ -947,13 +954,6 @@ public class GLImpl implements GL10, GL10Ext, GL11, GL11Ext, GL11ExtensionPack {
(stride >= 0)) {
_texCoordPointer = pointer;
}
- glTexCoordPointerBounds(
- size,
- type,
- stride,
- pointer,
- pointer.remaining()
- );
}
// C function void glTexEnvf ( GLenum target, GLenum pname, GLfloat param )
@@ -1082,6 +1082,13 @@ public class GLImpl implements GL10, GL10Ext, GL11, GL11Ext, GL11ExtensionPack {
int stride,
java.nio.Buffer pointer
) {
+ glVertexPointerBounds(
+ size,
+ type,
+ stride,
+ pointer,
+ pointer.remaining()
+ );
if (((size == 2) ||
(size == 3) ||
(size == 4)) &&
@@ -1092,13 +1099,6 @@ public class GLImpl implements GL10, GL10Ext, GL11, GL11Ext, GL11ExtensionPack {
(stride >= 0)) {
_vertexPointer = pointer;
}
- glVertexPointerBounds(
- size,
- type,
- stride,
- pointer,
- pointer.remaining()
- );
}
// C function void glViewport ( GLint x, GLint y, GLsizei width, GLsizei height )