aboutsummaryrefslogtreecommitdiffstats
path: root/eclipse/plugins
diff options
context:
space:
mode:
authorSiva Velusamy <vsiva@google.com>2014-01-29 17:14:49 -0800
committerSiva Velusamy <vsiva@google.com>2014-01-31 12:37:49 -0800
commitcfdb0eb6ff3d6c1681f53f32c6f87e2f59309083 (patch)
tree9645f1004bad94bccd795fdb5e24ef3c0d6b1a8c /eclipse/plugins
parent20cbf755e34aa19205bac9cbdae22bd1821f390a (diff)
downloadsdk-cfdb0eb6ff3d6c1681f53f32c6f87e2f59309083.zip
sdk-cfdb0eb6ff3d6c1681f53f32c6f87e2f59309083.tar.gz
sdk-cfdb0eb6ff3d6c1681f53f32c6f87e2f59309083.tar.bz2
gltrace: Read pointer arguments in a 64 bit safe way
One of the arguments for glVertexAttribPointer is a pointer. Rather than assuming that this is always encoded as a 32 bit integer, the code now checks whether it is 32 or 64 bit before attempting to access it. This CL also changes the state to keep the pointer as 64 bit. Change-Id: I3cfcc746b76c15409b91fb2f7079940f7cded32f
Diffstat (limited to 'eclipse/plugins')
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/DisplayRadix.java21
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/GLBooleanProperty.java2
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/GLIntegerProperty.java4
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/GLLongProperty.java73
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/GLObjectProperty.java2
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/GLState.java7
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/transforms/StateTransformFactory.java10
7 files changed, 109 insertions, 10 deletions
diff --git a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/DisplayRadix.java b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/DisplayRadix.java
new file mode 100644
index 0000000..935f4d7
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/DisplayRadix.java
@@ -0,0 +1,21 @@
+/*
+ * Copyright (C) 2014 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
+ *
+ * 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
+ * limitations under the License.
+ */
+
+package com.android.ide.eclipse.gltrace.state;
+
+public enum DisplayRadix {
+ DECIMAL, HEX
+}
diff --git a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/GLBooleanProperty.java b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/GLBooleanProperty.java
index 22d8d47..8332b0a 100644
--- a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/GLBooleanProperty.java
+++ b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/GLBooleanProperty.java
@@ -30,7 +30,7 @@ public final class GLBooleanProperty extends GLAbstractAtomicProperty {
@Override
public boolean isDefault() {
- return mDefaultValue == mCurrentValue;
+ return mDefaultValue != null & mDefaultValue.equals(mCurrentValue);
}
public void setValue(Boolean newValue) {
diff --git a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/GLIntegerProperty.java b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/GLIntegerProperty.java
index 1a71fe2..7374ff0 100644
--- a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/GLIntegerProperty.java
+++ b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/GLIntegerProperty.java
@@ -18,8 +18,6 @@ package com.android.ide.eclipse.gltrace.state;
/** Properties that hold an integer value. */
public class GLIntegerProperty extends GLAbstractAtomicProperty {
- public enum DisplayRadix { DECIMAL, HEX };
-
private final Integer mDefaultValue;
private Integer mCurrentValue;
private final DisplayRadix mRadix;
@@ -37,7 +35,7 @@ public class GLIntegerProperty extends GLAbstractAtomicProperty {
@Override
public boolean isDefault() {
- return mCurrentValue == mDefaultValue;
+ return mDefaultValue != null & mDefaultValue.equals(mCurrentValue);
}
public void setValue(Integer newValue) {
diff --git a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/GLLongProperty.java b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/GLLongProperty.java
new file mode 100644
index 0000000..44c04ec
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/GLLongProperty.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2014 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
+ *
+ * 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
+ * limitations under the License.
+ */
+
+package com.android.ide.eclipse.gltrace.state;
+
+/** Properties that hold a long value. */
+public class GLLongProperty extends GLAbstractAtomicProperty {
+ private final Long mDefaultValue;
+ private Long mCurrentValue;
+ private final DisplayRadix mRadix;
+
+ public GLLongProperty(GLStateType name, Long defaultValue, DisplayRadix radix) {
+ super(name);
+
+ mDefaultValue = mCurrentValue = defaultValue;
+ mRadix = radix;
+ }
+
+ public GLLongProperty(GLStateType name, Long defaultValue) {
+ this(name, defaultValue, DisplayRadix.DECIMAL);
+ }
+
+ @Override
+ public boolean isDefault() {
+ return mDefaultValue != null & mDefaultValue.equals(mCurrentValue);
+ }
+
+ public void setValue(Long newValue) {
+ mCurrentValue = newValue;
+ }
+
+ @Override
+ public String getStringValue() {
+ if (mRadix == DisplayRadix.HEX) {
+ return String.format("0x%08x", Long.valueOf(mCurrentValue));
+ }
+
+ return mCurrentValue.toString();
+ }
+
+ @Override
+ public String toString() {
+ return getType() + "=" + getStringValue(); //$NON-NLS-1$
+ }
+
+ @Override
+ public void setValue(Object value) {
+ if (value instanceof Long) {
+ mCurrentValue = (Long) value;
+ } else {
+ throw new IllegalArgumentException("Attempt to set non-integer value for " //$NON-NLS-1$
+ + getType());
+ }
+ }
+
+ @Override
+ public Object getValue() {
+ return mCurrentValue;
+ }
+}
diff --git a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/GLObjectProperty.java b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/GLObjectProperty.java
index 84ad6ec..703d4da 100644
--- a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/GLObjectProperty.java
+++ b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/GLObjectProperty.java
@@ -34,7 +34,7 @@ public class GLObjectProperty extends GLAbstractAtomicProperty {
@Override
public boolean isDefault() {
- return mDefaultValue == mCurrentValue;
+ return mDefaultValue != null & mDefaultValue.equals(mCurrentValue);
}
@Override
diff --git a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/GLState.java b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/GLState.java
index 1743499..6230586 100644
--- a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/GLState.java
+++ b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/GLState.java
@@ -17,12 +17,12 @@
package com.android.ide.eclipse.gltrace.state;
import com.android.ide.eclipse.gltrace.GLEnum;
-import com.android.ide.eclipse.gltrace.state.GLIntegerProperty.DisplayRadix;
+import com.android.ide.eclipse.gltrace.state.DisplayRadix;
import java.util.Collections;
public class GLState {
- /** # of texture units modelled in the GL State. */
+ /** # of texture units modeled in the GL State. */
public static final int TEXTURE_UNIT_COUNT = 16;
/** # of vertex attributes */
@@ -56,7 +56,8 @@ public class GLState {
stride = new GLIntegerProperty(GLStateType.VERTEX_ATTRIB_ARRAY_STRIDE, 0);
type = new GLEnumProperty(GLStateType.VERTEX_ATTRIB_ARRAY_TYPE, GLEnum.GL_FLOAT);
normalized = new GLBooleanProperty(GLStateType.VERTEX_ATTRIB_ARRAY_NORMALIZED, false);
- pointer = new GLIntegerProperty(GLStateType.VERTEX_ATTRIB_ARRAY_POINTER, 0);
+ pointer = new GLLongProperty(GLStateType.VERTEX_ATTRIB_ARRAY_POINTER, 0L,
+ DisplayRadix.HEX);
IGLProperty perVertexAttribArrayState = new GLCompositeProperty(
GLStateType.VERTEX_ATTRIB_ARRAY_COMPOSITE,
diff --git a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/transforms/StateTransformFactory.java b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/transforms/StateTransformFactory.java
index fb9f227..023f84b 100644
--- a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/transforms/StateTransformFactory.java
+++ b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/transforms/StateTransformFactory.java
@@ -189,7 +189,13 @@ public class StateTransformFactory {
int type = msg.getArgs(2).getIntValue(0);
boolean normalized = msg.getArgs(3).getBoolValue(0);
int stride = msg.getArgs(4).getIntValue(0);
- int pointer = msg.getArgs(5).getIntValue(0);
+
+ long pointer;
+ if (msg.getArgs(5).getIntValueCount() > 0) {
+ pointer = msg.getArgs(5).getIntValue(0);
+ } else {
+ pointer = msg.getArgs(5).getInt64Value(0);
+ }
List<IStateTransform> transforms = new ArrayList<IStateTransform>();
transforms.add(new PropertyChangeTransform(
@@ -226,7 +232,7 @@ public class StateTransformFactory {
GLStateType.VERTEX_ATTRIB_ARRAY,
Integer.valueOf(index),
GLStateType.VERTEX_ATTRIB_ARRAY_POINTER),
- Integer.valueOf(pointer)));
+ Long.valueOf(pointer)));
return transforms;
}