aboutsummaryrefslogtreecommitdiffstats
path: root/eclipse
diff options
context:
space:
mode:
authorSiva Velusamy <vsiva@google.com>2012-03-14 10:03:08 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-03-14 10:03:08 -0700
commit7e228281c7b18d541ffa1448437475fc039cf6ba (patch)
tree029a4db02e284d6718ea11529ea6775d25c10724 /eclipse
parent9af3fd6975e0fc4d63de0523288ebc78835b7266 (diff)
parent0ff2ba13c64c5234e012326130dc5f08332951d4 (diff)
downloadsdk-7e228281c7b18d541ffa1448437475fc039cf6ba.zip
sdk-7e228281c7b18d541ffa1448437475fc039cf6ba.tar.gz
sdk-7e228281c7b18d541ffa1448437475fc039cf6ba.tar.bz2
Merge "gltrace: Display state transformation errors in a console."
Diffstat (limited to 'eclipse')
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.gldebugger/META-INF/MANIFEST.MF5
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gldebugger/GlTracePlugin.java (renamed from eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gldebugger/Activator.java)55
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/GLTraceOptionsDialog.java6
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/TraceFileParserTask.java13
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/editors/DurationMinimap.java20
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/editors/GLFunctionTraceViewer.java6
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/editors/StateViewPage.java28
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/model/GLCall.java26
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/transforms/CurrentProgramPropertyAccessor.java7
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/transforms/CurrentVboPropertyAccessor.java5
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/transforms/GLPropertyAccessor.java20
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/transforms/IGLPropertyAccessor.java4
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/transforms/PropertyChangeTransform.java8
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/transforms/StateTransformFactory.java3
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/transforms/TexturePropertyAccessor.java5
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/transforms/TextureUnitPropertyAccessor.java5
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/views/FitToCanvasAction.java4
17 files changed, 185 insertions, 35 deletions
diff --git a/eclipse/plugins/com.android.ide.eclipse.gldebugger/META-INF/MANIFEST.MF b/eclipse/plugins/com.android.ide.eclipse.gldebugger/META-INF/MANIFEST.MF
index e3ca918..a03c229 100644
--- a/eclipse/plugins/com.android.ide.eclipse.gldebugger/META-INF/MANIFEST.MF
+++ b/eclipse/plugins/com.android.ide.eclipse.gldebugger/META-INF/MANIFEST.MF
@@ -3,13 +3,14 @@ Bundle-ManifestVersion: 2
Bundle-Name: GLESv2 Debugger Client
Bundle-SymbolicName: com.android.ide.eclipse.gldebugger;singleton:=true
Bundle-Version: 17.0.0.qualifier
-Bundle-Activator: com.android.ide.eclipse.gldebugger.Activator
+Bundle-Activator: com.android.ide.eclipse.gldebugger.GlTracePlugin
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
com.android.ide.eclipse.ddms,
org.eclipse.ui.ide,
org.eclipse.core.resources,
- org.eclipse.core.filesystem
+ org.eclipse.core.filesystem,
+ org.eclipse.ui.console
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: libs/host-libprotobuf-java-2.3.0-lite.jar,
libs/liblzf.jar,
diff --git a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gldebugger/Activator.java b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gldebugger/GlTracePlugin.java
index 67fd809..dafb661 100644
--- a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gldebugger/Activator.java
+++ b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gldebugger/GlTracePlugin.java
@@ -17,24 +17,37 @@
package com.android.ide.eclipse.gldebugger;
import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.console.ConsolePlugin;
+import org.eclipse.ui.console.IConsole;
+import org.eclipse.ui.console.IConsoleConstants;
+import org.eclipse.ui.console.MessageConsole;
+import org.eclipse.ui.console.MessageConsoleStream;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
/**
* The activator class controls the plug-in life cycle
*/
-public class Activator extends AbstractUIPlugin {
+public class GlTracePlugin extends AbstractUIPlugin {
// The plug-in ID
public static final String PLUGIN_ID = "com.android.ide.eclipse.gldebugger"; //$NON-NLS-1$
// The shared instance
- private static Activator plugin;
+ private static GlTracePlugin plugin;
+
+ private MessageConsole mConsole;
+ private MessageConsoleStream mConsoleStream;
/**
* The constructor
*/
- public Activator() {
+ public GlTracePlugin() {
}
/*
@@ -47,6 +60,12 @@ public class Activator extends AbstractUIPlugin {
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
+
+ mConsole = new MessageConsole("OpenGL Trace View", null);
+ ConsolePlugin.getDefault().getConsoleManager().addConsoles(new IConsole[] {
+ mConsole });
+
+ mConsoleStream = mConsole.newMessageStream();
}
/*
@@ -66,7 +85,7 @@ public class Activator extends AbstractUIPlugin {
*
* @return the shared instance
*/
- public static Activator getDefault() {
+ public static GlTracePlugin getDefault() {
return plugin;
}
@@ -80,4 +99,32 @@ public class Activator extends AbstractUIPlugin {
public static ImageDescriptor getImageDescriptor(String path) {
return imageDescriptorFromPlugin(PLUGIN_ID, path);
}
+
+ public void logMessage(String message) {
+ mConsoleStream.println(message);
+
+ Display.getDefault().asyncExec(sShowConsoleRunnable);
+ }
+
+ private static Runnable sShowConsoleRunnable = new Runnable() {
+ @Override
+ public void run() {
+ showConsoleView();
+ };
+ };
+
+ private static void showConsoleView() {
+ IWorkbenchWindow w = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ if (w != null) {
+ IWorkbenchPage page = w.getActivePage();
+ if (page != null) {
+ try {
+ page.showView(IConsoleConstants.ID_CONSOLE_VIEW, null,
+ IWorkbenchPage.VIEW_VISIBLE);
+ } catch (PartInitException e) {
+ // ignore
+ }
+ }
+ }
+ }
}
diff --git a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/GLTraceOptionsDialog.java b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/GLTraceOptionsDialog.java
index b0e1b1f..ac752e7 100644
--- a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/GLTraceOptionsDialog.java
+++ b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/GLTraceOptionsDialog.java
@@ -18,7 +18,7 @@ package com.android.ide.eclipse.gltrace;
import com.android.ddmlib.AndroidDebugBridge;
import com.android.ddmlib.IDevice;
-import com.android.ide.eclipse.gldebugger.Activator;
+import com.android.ide.eclipse.gldebugger.GlTracePlugin;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.InstanceScope;
@@ -283,7 +283,7 @@ public class GLTraceOptionsDialog extends TitleAreaDialog {
}
private void savePreferences() {
- IEclipsePreferences prefs = new InstanceScope().getNode(Activator.PLUGIN_ID);
+ IEclipsePreferences prefs = new InstanceScope().getNode(GlTracePlugin.PLUGIN_ID);
prefs.put(PREF_APPNAME, mActivityToTrace);
prefs.put(PREF_TRACEFILE, mTraceFilePath);
try {
@@ -294,7 +294,7 @@ public class GLTraceOptionsDialog extends TitleAreaDialog {
}
private void loadPreferences() {
- IEclipsePreferences prefs = new InstanceScope().getNode(Activator.PLUGIN_ID);
+ IEclipsePreferences prefs = new InstanceScope().getNode(GlTracePlugin.PLUGIN_ID);
mActivityToTrace = prefs.get(PREF_APPNAME, "");
mTraceFilePath = prefs.get(PREF_TRACEFILE, "");
}
diff --git a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/TraceFileParserTask.java b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/TraceFileParserTask.java
index 083cba5..7bd86d5 100644
--- a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/TraceFileParserTask.java
+++ b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/TraceFileParserTask.java
@@ -17,6 +17,7 @@
package com.android.ide.eclipse.gltrace;
import com.android.ide.eclipse.gldebugger.GLEnum;
+import com.android.ide.eclipse.gldebugger.GlTracePlugin;
import com.android.ide.eclipse.gltrace.GLProtoBuf.GLMessage;
import com.android.ide.eclipse.gltrace.GLProtoBuf.GLMessage.Function;
import com.android.ide.eclipse.gltrace.format.GLAPISpec;
@@ -107,11 +108,19 @@ public class TraceFileParserTask implements IRunnableWithProgress {
msg.hasFb(),
msg.getContextId(),
msg.getDuration(),
- msg.getThreadtime(),
- StateTransformFactory.getTransformsFor(msg));
+ msg.getThreadtime());
addProperties(c, msg);
+ try {
+ c.setStateTransformations(StateTransformFactory.getTransformsFor(msg));
+ } catch (Exception e) {
+ c.setStateTransformationCreationError(e.getMessage());
+ GlTracePlugin.getDefault().logMessage("Error while creating transformations for "
+ + c.toString() + ":");
+ GlTracePlugin.getDefault().logMessage(e.getMessage());
+ }
+
mGLCalls.add(c);
mGLContextIds.add(Integer.valueOf(c.getContextId()));
}
diff --git a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/editors/DurationMinimap.java b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/editors/DurationMinimap.java
index a6802c9..7f468e1 100644
--- a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/editors/DurationMinimap.java
+++ b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/editors/DurationMinimap.java
@@ -79,6 +79,7 @@ public class DurationMinimap extends Canvas {
private Color mBackgroundColor;
private Color mDurationLineColor;
private Color mGlDrawColor;
+ private Color mGlErrorColor;
private Color mContextHeaderColor;
private Color mVisibleCallsHighlightColor;
private Color mMouseMarkerColor;
@@ -174,6 +175,8 @@ public class DurationMinimap extends Canvas {
mContextHeaderColor = new Color(getDisplay(), 0xd1, 0xe5, 0xf0);
mVisibleCallsHighlightColor = new Color(getDisplay(), 0xcc, 0xcc, 0xcc);
mMouseMarkerColor = new Color(getDisplay(), 0xaa, 0xaa, 0xaa);
+
+ mGlErrorColor = getDisplay().getSystemColor(SWT.COLOR_RED);
}
private void disposeColors() {
@@ -301,17 +304,22 @@ public class DurationMinimap extends Canvas {
boolean resetColor = false;
GLCall c = mCalls.get(i);
- if (c.getFunction() == Function.glDrawArrays
+ long duration = c.getWallDuration();
+
+ if (c.hasErrors()) {
+ gc.setBackground(mGlErrorColor);
+ resetColor = true;
+
+ // If the call has any errors, we want it to be visible in the minimap
+ // regardless of how long it took.
+ duration = mPositionHelper.getMaxDuration();
+ } else if (c.getFunction() == Function.glDrawArrays
|| c.getFunction() == Function.glDrawElements
|| c.getFunction() == Function.eglSwapBuffers) {
gc.setBackground(mGlDrawColor);
resetColor = true;
- }
- long duration = c.getWallDuration();
- if (c.getFunction() == Function.eglSwapBuffers) {
- // egl swap buffers typically takes very little time, but since
- // it is a significant call, we explicitly size it to the max length
+ // render all draw calls & swap buffer at max length
duration = mPositionHelper.getMaxDuration();
}
diff --git a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/editors/GLFunctionTraceViewer.java b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/editors/GLFunctionTraceViewer.java
index 4d1da1f..7a9f167 100644
--- a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/editors/GLFunctionTraceViewer.java
+++ b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/editors/GLFunctionTraceViewer.java
@@ -100,6 +100,7 @@ public class GLFunctionTraceViewer extends EditorPart implements ISelectionProvi
private GLCallFilter mGLCallFilter;
private Color mGldrawTextColor;
+ private Color mGlCallErrorColor;
// Currently displayed frame's start and end call indices.
private int mCallStartIndex;
@@ -116,6 +117,7 @@ public class GLFunctionTraceViewer extends EditorPart implements ISelectionProvi
public GLFunctionTraceViewer() {
mGldrawTextColor = Display.getDefault().getSystemColor(SWT.COLOR_BLUE);
+ mGlCallErrorColor = Display.getDefault().getSystemColor(SWT.COLOR_RED);
}
@Override
@@ -528,6 +530,10 @@ public class GLFunctionTraceViewer extends EditorPart implements ISelectionProvi
cell.setForeground(mGldrawTextColor);
}
+ if (c.hasErrors()) {
+ cell.setForeground(mGlCallErrorColor);
+ }
+
cell.setText(getColumnText(c, cell.getColumnIndex()));
}
diff --git a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/editors/StateViewPage.java b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/editors/StateViewPage.java
index 174e70f..288dc15 100644
--- a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/editors/StateViewPage.java
+++ b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/editors/StateViewPage.java
@@ -16,7 +16,7 @@
package com.android.ide.eclipse.gltrace.editors;
-import com.android.ide.eclipse.gldebugger.Activator;
+import com.android.ide.eclipse.gldebugger.GlTracePlugin;
import com.android.ide.eclipse.gltrace.editors.GLCallGroups.GLCallNode;
import com.android.ide.eclipse.gltrace.model.GLCall;
import com.android.ide.eclipse.gltrace.model.GLTrace;
@@ -29,6 +29,7 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.ILock;
import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.ISelectionProvider;
@@ -82,6 +83,8 @@ public class StateViewPage extends Page implements ISelectionListener, ISelectio
@Override
public void createControl(Composite parent) {
final Tree tree = new Tree(parent, SWT.VIRTUAL | SWT.H_SCROLL | SWT.V_SCROLL);
+ GridDataFactory.fillDefaults().grab(true, true).applyTo(tree);
+
tree.setHeaderVisible(true);
tree.setLinesVisible(true);
tree.setLayoutData(new GridData(GridData.FILL_BOTH));
@@ -154,8 +157,11 @@ public class StateViewPage extends Page implements ISelectionListener, ISelectio
selectedCallIndex);
mCurrentStateIndex = selectedCallIndex;
} catch (Exception e) {
+ GlTracePlugin.getDefault().logMessage(
+ "Unexpected error while updating GL State.");
+ GlTracePlugin.getDefault().logMessage(e.getMessage());
return new Status(Status.ERROR,
- Activator.PLUGIN_ID,
+ GlTracePlugin.PLUGIN_ID,
"Unexpected error while updating GL State.",
e);
} finally {
@@ -218,12 +224,18 @@ public class StateViewPage extends Page implements ISelectionListener, ISelectio
Set<IGLProperty> changedProperties = new HashSet<IGLProperty>(setSizeHint);
for (int i = fromIndex + 1; i <= toIndex; i++) {
- for (IStateTransform f : mGLCalls.get(i).getStateTransformations()) {
- f.apply(mState);
-
- IGLProperty changedProperty = f.getChangedProperty(mState);
- if (changedProperty != null) {
- changedProperties.addAll(getHierarchy(changedProperty));
+ GLCall call = mGLCalls.get(i);
+ for (IStateTransform f : call.getStateTransformations()) {
+ try {
+ f.apply(mState);
+ IGLProperty changedProperty = f.getChangedProperty(mState);
+ if (changedProperty != null) {
+ changedProperties.addAll(getHierarchy(changedProperty));
+ }
+ } catch (Exception e) {
+ GlTracePlugin.getDefault().logMessage("Error applying transformations for "
+ + call);
+ GlTracePlugin.getDefault().logMessage(e.getMessage());
}
}
}
diff --git a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/model/GLCall.java b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/model/GLCall.java
index d049c9e..aae91c0 100644
--- a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/model/GLCall.java
+++ b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/model/GLCall.java
@@ -23,6 +23,7 @@ import com.android.sdklib.util.SparseArray;
import org.eclipse.swt.graphics.Image;
+import java.util.Collections;
import java.util.List;
/**
@@ -78,15 +79,17 @@ public class GLCall {
private final int mThreadDuration;
/** List of state transformations performed by this call. */
- private final List<IStateTransform> mStateTransforms;
+ private List<IStateTransform> mStateTransforms = Collections.emptyList();
+
+ /** Error conditions while creating state transforms for this call. */
+ private String mStateTransformationCreationErrorMessage;
/** List of properties associated to this call. */
private SparseArray<Object> mProperties;
public GLCall(int index, long startTime, long traceFileOffset, String displayString,
Image thumbnailImage, Function function, boolean hasFb, int contextId,
- int wallTime, int threadTime,
- List<IStateTransform> stateTransforms) {
+ int wallTime, int threadTime) {
mIndex = index;
mStartTime = startTime;
mTraceFileOffset = traceFileOffset;
@@ -97,7 +100,6 @@ public class GLCall {
mContextId = contextId;
mWallDuration = wallTime;
mThreadDuration = threadTime;
- mStateTransforms = stateTransforms;
}
public int getIndex() {
@@ -140,6 +142,22 @@ public class GLCall {
return mThreadDuration;
}
+ public void setStateTransformations(List<IStateTransform> transforms) {
+ mStateTransforms = transforms;
+ }
+
+ public void setStateTransformationCreationError(String errorMessage) {
+ mStateTransformationCreationErrorMessage = errorMessage;
+ }
+
+ public boolean hasErrors() {
+ return mStateTransformationCreationErrorMessage != null;
+ }
+
+ public String getError() {
+ return mStateTransformationCreationErrorMessage;
+ }
+
public List<IStateTransform> getStateTransformations() {
return mStateTransforms;
}
diff --git a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/transforms/CurrentProgramPropertyAccessor.java b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/transforms/CurrentProgramPropertyAccessor.java
index b977d87..9cc3cb8 100644
--- a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/transforms/CurrentProgramPropertyAccessor.java
+++ b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/transforms/CurrentProgramPropertyAccessor.java
@@ -38,6 +38,7 @@ public class CurrentProgramPropertyAccessor implements IGLPropertyAccessor {
GLStateType.PROGRAM_STATE,
GLStateType.CURRENT_PROGRAM);
}
+
@Override
public IGLProperty getProperty(IGLProperty state) {
// obtain the current program
@@ -57,4 +58,10 @@ public class CurrentProgramPropertyAccessor implements IGLPropertyAccessor {
Integer.valueOf(mLocation),
mStateType).getProperty(state);
}
+
+ @Override
+ public String getPath() {
+ return String.format("PROGRAM_STATE/PROGRAMS/${program}/%s/%d/%s",
+ mStateCategory, mLocation, mStateType);
+ }
}
diff --git a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/transforms/CurrentVboPropertyAccessor.java b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/transforms/CurrentVboPropertyAccessor.java
index 3f763e0..ea7617d 100644
--- a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/transforms/CurrentVboPropertyAccessor.java
+++ b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/transforms/CurrentVboPropertyAccessor.java
@@ -63,4 +63,9 @@ public class CurrentVboPropertyAccessor implements IGLPropertyAccessor {
buffer,
mVboProperty).getProperty(state);
}
+
+ @Override
+ public String getPath() {
+ return String.format("VERTEX_ARRAY_DATA/VBO/${currentBuffer}/%s", mVboProperty);
+ }
}
diff --git a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/transforms/GLPropertyAccessor.java b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/transforms/GLPropertyAccessor.java
index 8772a72..be338be 100644
--- a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/transforms/GLPropertyAccessor.java
+++ b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/transforms/GLPropertyAccessor.java
@@ -45,7 +45,8 @@ public class GLPropertyAccessor implements IGLPropertyAccessor {
for (GLPropertyExtractor e : mExtractors) {
IGLProperty successor = e.getProperty(root);
if (successor == null) {
- return null;
+ root = null;
+ break;
}
root = successor;
}
@@ -111,7 +112,7 @@ public class GLPropertyAccessor implements IGLPropertyAccessor {
@Override
public IGLProperty getProperty(IGLProperty p) {
- if (p instanceof GLListProperty) {
+ if (p instanceof GLListProperty && mIndex >= 0) {
return ((GLListProperty) p).get(mIndex);
}
if (p instanceof GLSparseArrayProperty) {
@@ -120,4 +121,19 @@ public class GLPropertyAccessor implements IGLPropertyAccessor {
return null;
}
}
+
+ @Override
+ public String getPath() {
+ StringBuilder sb = new StringBuilder(mExtractors.size() * 10);
+ for (GLPropertyExtractor e: mExtractors) {
+ if (e instanceof GLNamePropertyExtractor) {
+ sb.append(((GLNamePropertyExtractor) e).mType);
+ } else {
+ sb.append(((GLIndexPropertyExtractor) e).mIndex);
+ }
+ sb.append('/');
+ }
+
+ return sb.toString();
+ }
}
diff --git a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/transforms/IGLPropertyAccessor.java b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/transforms/IGLPropertyAccessor.java
index 32cda39..5df21b9 100644
--- a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/transforms/IGLPropertyAccessor.java
+++ b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/transforms/IGLPropertyAccessor.java
@@ -23,5 +23,9 @@ import com.android.ide.eclipse.gltrace.state.IGLProperty;
* a specific property from a composite property.
*/
public interface IGLPropertyAccessor {
+ /** Obtain a specific property from the given state. */
IGLProperty getProperty(IGLProperty state);
+
+ /** Returns the string representation of this property accessor. */
+ String getPath();
}
diff --git a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/transforms/PropertyChangeTransform.java b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/transforms/PropertyChangeTransform.java
index 79014cf..276f6f4 100644
--- a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/transforms/PropertyChangeTransform.java
+++ b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/transforms/PropertyChangeTransform.java
@@ -64,8 +64,12 @@ public class PropertyChangeTransform implements IStateTransform {
}
}
- mOldValue = property.getValue();
- property.setValue(mNewValue);
+ if (property != null) {
+ mOldValue = property.getValue();
+ property.setValue(mNewValue);
+ } else {
+ throw new RuntimeException("No such property: " + mAccessor.getPath());
+ }
}
/**
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 5751025..576e87b 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
@@ -1252,6 +1252,9 @@ public class StateTransformFactory {
// .. 4i
int location = msg.getArgs(0).getIntValue(0);
+ if (location < 0) {
+ throw new IllegalArgumentException("Argument location cannot be less than 0.");
+ }
List<?> uniforms;
if (isFloats) {
List<Float> args = new ArrayList<Float>(msg.getArgsCount() - 1);
diff --git a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/transforms/TexturePropertyAccessor.java b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/transforms/TexturePropertyAccessor.java
index 7aa8fd6..2116283 100644
--- a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/transforms/TexturePropertyAccessor.java
+++ b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/transforms/TexturePropertyAccessor.java
@@ -61,4 +61,9 @@ public class TexturePropertyAccessor implements IGLPropertyAccessor {
return textureAccessor.getProperty(state);
}
+ @Override
+ public String getPath() {
+ return String.format("TEXTURE_STATE/TEXTURES/${activeTexture}/%s", mTextureType);
+ }
+
}
diff --git a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/transforms/TextureUnitPropertyAccessor.java b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/transforms/TextureUnitPropertyAccessor.java
index 7c52cd5..2489e14 100644
--- a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/transforms/TextureUnitPropertyAccessor.java
+++ b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/transforms/TextureUnitPropertyAccessor.java
@@ -56,4 +56,9 @@ public class TextureUnitPropertyAccessor implements IGLPropertyAccessor {
mTargetType);
return targetAccessor.getProperty(state);
}
+
+ @Override
+ public String getPath() {
+ return String.format("TEXTURE_STATE/TEXTURE_UNITS/${activeTextureUnit}/%s", mTargetType);
+ }
}
diff --git a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/views/FitToCanvasAction.java b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/views/FitToCanvasAction.java
index ccd2cbe..eecd86e 100644
--- a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/views/FitToCanvasAction.java
+++ b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/views/FitToCanvasAction.java
@@ -16,7 +16,7 @@
package com.android.ide.eclipse.gltrace.views;
-import com.android.ide.eclipse.gldebugger.Activator;
+import com.android.ide.eclipse.gldebugger.GlTracePlugin;
import com.android.ide.eclipse.gltrace.widgets.ImageCanvas;
import org.eclipse.jface.action.Action;
@@ -25,7 +25,7 @@ public class FitToCanvasAction extends Action {
private ImageCanvas mImageCanvas;
public FitToCanvasAction(boolean fitByDefault, ImageCanvas canvas) {
- super("Fit to Canvas", Activator.getImageDescriptor("/icons/zoomfit.png")); //$NON-NLS-2$
+ super("Fit to Canvas", GlTracePlugin.getImageDescriptor("/icons/zoomfit.png")); //$NON-NLS-2$
setToolTipText("Fit Image to Canvas");
mImageCanvas = canvas;