summaryrefslogtreecommitdiffstats
path: root/opengl/java/android
diff options
context:
space:
mode:
authorAndroid (Google) Code Review <android-gerrit@google.com>2009-12-08 20:13:44 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2009-12-08 20:13:44 -0800
commit5c47265a704cb0cc081b79e191442f99014726b0 (patch)
treeb162ef47569b58713fd90ac0a6ad4e7402b02a3e /opengl/java/android
parent7279fb9aee1abae405384e2c4331b7d9fec28294 (diff)
parentbe6eac828f5af8b608c3fa6749330f1dcd6b6206 (diff)
downloadframeworks_base-5c47265a704cb0cc081b79e191442f99014726b0.zip
frameworks_base-5c47265a704cb0cc081b79e191442f99014726b0.tar.gz
frameworks_base-5c47265a704cb0cc081b79e191442f99014726b0.tar.bz2
Merge change Ibe6eac82
* changes: Implement Matrix Palette extension.
Diffstat (limited to 'opengl/java/android')
-rw-r--r--opengl/java/android/opengl/GLES11.java24
-rw-r--r--opengl/java/android/opengl/GLES11Ext.java58
-rw-r--r--opengl/java/android/opengl/GLES20.java27
-rw-r--r--opengl/java/android/opengl/GLLogWrapper.java45
4 files changed, 113 insertions, 41 deletions
diff --git a/opengl/java/android/opengl/GLES11.java b/opengl/java/android/opengl/GLES11.java
index 3399af7..1ca179b 100644
--- a/opengl/java/android/opengl/GLES11.java
+++ b/opengl/java/android/opengl/GLES11.java
@@ -150,6 +150,7 @@ public class GLES11 extends GLES10 {
_nativeClassInit();
}
+ private static Buffer _pointSizePointerOES;
// C function void glBindBuffer ( GLenum target, GLuint buffer )
public static native void glBindBuffer(
@@ -596,12 +597,31 @@ public class GLES11 extends GLES10 {
// 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
+ java.nio.Buffer pointer,
+ int remaining
);
+ public static void glPointSizePointerOES(
+ int type,
+ int stride,
+ 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 )
public static native void glTexCoordPointer(
diff --git a/opengl/java/android/opengl/GLES11Ext.java b/opengl/java/android/opengl/GLES11Ext.java
index 4384e9e..25d5467 100644
--- a/opengl/java/android/opengl/GLES11Ext.java
+++ b/opengl/java/android/opengl/GLES11Ext.java
@@ -19,6 +19,8 @@
package android.opengl;
+import java.nio.Buffer;
+
public class GLES11Ext {
public static final int GL_BLEND_EQUATION_RGB_OES = 0x8009;
public static final int GL_BLEND_EQUATION_ALPHA_OES = 0x883D;
@@ -129,6 +131,12 @@ public class GLES11Ext {
_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 )
public static native void glBlendEquationSeparateOES(
@@ -866,22 +874,64 @@ public class GLES11Ext {
// 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
+ java.nio.Buffer pointer,
+ int remaining
);
+ public static void glMatrixIndexPointerOES(
+ int size,
+ int type,
+ int stride,
+ 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 )
- public static native void glWeightPointerOES(
+ private static native void glWeightPointerOESBounds(
int size,
int type,
int stride,
- java.nio.Buffer pointer
+ java.nio.Buffer pointer,
+ int remaining
);
+ public static void glWeightPointerOES(
+ int size,
+ int type,
+ int stride,
+ java.nio.Buffer pointer
+ ) {
+ glWeightPointerOESBounds(
+ size,
+ type,
+ stride,
+ pointer,
+ pointer.remaining()
+ );
+ }
+
// C function void glDepthRangefOES ( GLclampf zNear, GLclampf zFar )
public static native void glDepthRangefOES(
diff --git a/opengl/java/android/opengl/GLES20.java b/opengl/java/android/opengl/GLES20.java
index 01e82de..b8aac0e 100644
--- a/opengl/java/android/opengl/GLES20.java
+++ b/opengl/java/android/opengl/GLES20.java
@@ -2,16 +2,16 @@
**
** Copyright 2009, The Android Open Source Project
**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** 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
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
** limitations under the License.
*/
@@ -19,8 +19,7 @@
package android.opengl;
-/** OpenGL ES 2.0. This class exposes the core OpenGL ES 2.0 APIs.
- * All the methods are static.
+/** OpenGL ES 2.0
*/
public class GLES20 {
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_FUNC_ADD = 0x8006;
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_FUNC_SUBTRACT = 0x800A;
public static final int GL_FUNC_REVERSE_SUBTRACT = 0x800B;
@@ -328,7 +327,7 @@ public class GLES20 {
native private static void _nativeClassInit();
static {
- _nativeClassInit();
+ _nativeClassInit();
}
// C function void glActiveTexture ( GLenum texture )
@@ -980,7 +979,7 @@ public class GLES20 {
);
// C function void glGetProgramInfoLog( GLuint program, GLsizei maxLength, GLsizei * length,
- // GLchar * infoLog);
+ // GLchar * infoLog);
public static native String glGetProgramInfoLog(
int program
@@ -1020,7 +1019,7 @@ public class GLES20 {
);
// C function void glGetShaderInfoLog( GLuint shader, GLsizei maxLength, GLsizei * length,
- // GLchar * infoLog);
+ // GLchar * infoLog);
public static native String glGetShaderInfoLog(
int shader
diff --git a/opengl/java/android/opengl/GLLogWrapper.java b/opengl/java/android/opengl/GLLogWrapper.java
index 97a6424..6e97f67 100644
--- a/opengl/java/android/opengl/GLLogWrapper.java
+++ b/opengl/java/android/opengl/GLLogWrapper.java
@@ -932,83 +932,83 @@ class GLLogWrapper extends GLWrapperBase {
boolean convertWholeBuffer = (byteCount < 0);
if (input instanceof ByteBuffer) {
ByteBuffer input2 = (ByteBuffer) input;
+ int position = input2.position();
if (convertWholeBuffer) {
- byteCount = input2.limit();
+ byteCount = input2.limit() - position;
}
result = ByteBuffer.allocate(byteCount).order(input2.order());
- int position = input2.position();
for (int i = 0; i < byteCount; i++) {
result.put(input2.get());
}
input2.position(position);
} else if (input instanceof CharBuffer) {
CharBuffer input2 = (CharBuffer) input;
+ int position = input2.position();
if (convertWholeBuffer) {
- byteCount = input2.limit() * 2;
+ byteCount = (input2.limit() - position) * 2;
}
result = ByteBuffer.allocate(byteCount).order(input2.order());
CharBuffer result2 = result.asCharBuffer();
- int position = input2.position();
for (int i = 0; i < byteCount / 2; i++) {
result2.put(input2.get());
}
input2.position(position);
} else if (input instanceof ShortBuffer) {
ShortBuffer input2 = (ShortBuffer) input;
+ int position = input2.position();
if (convertWholeBuffer) {
- byteCount = input2.limit() * 2;
+ byteCount = (input2.limit() - position)* 2;
}
result = ByteBuffer.allocate(byteCount).order(input2.order());
ShortBuffer result2 = result.asShortBuffer();
- int position = input2.position();
for (int i = 0; i < byteCount / 2; i++) {
result2.put(input2.get());
}
input2.position(position);
} else if (input instanceof IntBuffer) {
IntBuffer input2 = (IntBuffer) input;
+ int position = input2.position();
if (convertWholeBuffer) {
- byteCount = input2.limit() * 4;
+ byteCount = (input2.limit() - position) * 4;
}
result = ByteBuffer.allocate(byteCount).order(input2.order());
IntBuffer result2 = result.asIntBuffer();
- int position = input2.position();
for (int i = 0; i < byteCount / 4; i++) {
result2.put(input2.get());
}
input2.position(position);
} else if (input instanceof FloatBuffer) {
FloatBuffer input2 = (FloatBuffer) input;
+ int position = input2.position();
if (convertWholeBuffer) {
- byteCount = input2.limit() * 4;
+ byteCount = (input2.limit() - position) * 4;
}
result = ByteBuffer.allocate(byteCount).order(input2.order());
FloatBuffer result2 = result.asFloatBuffer();
- int position = input2.position();
for (int i = 0; i < byteCount / 4; i++) {
result2.put(input2.get());
}
input2.position(position);
} else if (input instanceof DoubleBuffer) {
DoubleBuffer input2 = (DoubleBuffer) input;
+ int position = input2.position();
if (convertWholeBuffer) {
- byteCount = input2.limit() * 8;
+ byteCount = (input2.limit() - position) * 8;
}
result = ByteBuffer.allocate(byteCount).order(input2.order());
DoubleBuffer result2 = result.asDoubleBuffer();
- int position = input2.position();
for (int i = 0; i < byteCount / 8; i++) {
result2.put(input2.get());
}
input2.position(position);
} else if (input instanceof LongBuffer) {
LongBuffer input2 = (LongBuffer) input;
+ int position = input2.position();
if (convertWholeBuffer) {
- byteCount = input2.limit() * 8;
+ byteCount = (input2.limit() - position) * 8;
}
result = ByteBuffer.allocate(byteCount).order(input2.order());
LongBuffer result2 = result.asLongBuffer();
- int position = input2.position();
for (int i = 0; i < byteCount / 8; i++) {
result2.put(input2.get());
}
@@ -1064,8 +1064,8 @@ class GLLogWrapper extends GLWrapperBase {
}
builder.append(" ");
builder.append(name + ":{");
- if (pointer == null) {
- builder.append("undefined");
+ if (pointer == null || pointer.mTempByteBuffer == null ) {
+ builder.append("undefined }");
return;
}
if (pointer.mStride < 0) {
@@ -3464,6 +3464,9 @@ class GLLogWrapper extends GLWrapperBase {
public Buffer mPointer;
public ByteBuffer mTempByteBuffer; // Only valid during glDrawXXX calls
+ public PointerInfo() {
+ }
+
public PointerInfo(int size, int type, int stride, Buffer pointer) {
mSize = size;
mType = type;
@@ -3493,7 +3496,7 @@ class GLLogWrapper extends GLWrapperBase {
}
public void bindByteBuffer() {
- mTempByteBuffer = toByteBuffer(-1, mPointer);
+ mTempByteBuffer = mPointer == null ? null : toByteBuffer(-1, mPointer);
}
public void unbindByteBuffer() {
@@ -3505,10 +3508,10 @@ class GLLogWrapper extends GLWrapperBase {
private boolean mLogArgumentNames;
private int mArgCount;
- private PointerInfo mColorPointer;
- private PointerInfo mNormalPointer;
- private PointerInfo mTexCoordPointer;
- private PointerInfo mVertexPointer;
+ private PointerInfo mColorPointer = new PointerInfo();
+ private PointerInfo mNormalPointer = new PointerInfo();
+ private PointerInfo mTexCoordPointer = new PointerInfo();
+ private PointerInfo mVertexPointer = new PointerInfo();
boolean mColorArrayEnabled;
boolean mNormalArrayEnabled;