No change in functionality, only rename.
Change-Id: I43d134c9e9acca1761712bfe1a9fc6f4143131af
import com.android.ide.eclipse.gldebugger.GLEnum;
import com.android.ide.eclipse.gldebugger.MessageFormatter;
import com.android.ide.eclipse.gldebugger.MessageParserEx;
-import com.android.ide.eclipse.gldebugger.SampleView;
+import com.android.ide.eclipse.gldebugger.GLFramesView;
import com.android.ide.eclipse.gldebugger.DebuggerMessage.Message;
import com.android.ide.eclipse.gldebugger.DebuggerMessage.Message.Function;
import com.android.ide.eclipse.gldebugger.DebuggerMessage.Message.Type;
final String args = "{0, 1 ,2,3 }";
parser.args = args;
final ByteBuffer data = parser.parseFloats(4).asReadOnlyByteBuffer();
- data.order(SampleView.TARGET_BYTE_ORDER);
+ data.order(GLFramesView.TARGET_BYTE_ORDER);
for (int i = 0; i < 4; i++)
assertEquals(i, data.getFloat(), 0);
}
@Test
public void testParseFormatterMessage() {
final ByteBuffer srcData = ByteBuffer.allocate(4 * 2 * 4);
- srcData.order(SampleView.TARGET_BYTE_ORDER);
+ srcData.order(GLFramesView.TARGET_BYTE_ORDER);
for (int i = 0; i < 4 * 2; i++)
srcData.putFloat(i);
srcData.rewind();
name="OpenGL ES 2.0 Debugger"\r
icon="icons/sample.gif"\r
category="org.eclipse.debug.ui"\r
- class="com.android.ide.eclipse.gldebugger.SampleView"\r
+ class="com.android.ide.eclipse.gldebugger.GLFramesView"\r
id="glesv2debuggerclient.views.SampleView">\r
</view>\r
</extension>\r
public class BreakpointOption extends ScrolledComposite implements SelectionListener,
ProcessMessage {
- SampleView sampleView;
+ GLFramesView mGLFramesView;
Button[] buttonsBreak = new Button[Function.values().length];
/** cache of buttonsBreak[Function.getNumber()].getSelection */
boolean[] breakpoints = new boolean[Function.values().length];
- BreakpointOption(SampleView sampleView, Composite parent) {
+ BreakpointOption(GLFramesView view, Composite parent) {
super(parent, SWT.NO_BACKGROUND | SWT.V_SCROLL | SWT.H_SCROLL);
- this.sampleView = sampleView;
+ mGLFramesView = view;
Composite composite = new Composite(this, 0);
GridLayout layout = new GridLayout();
builder.setProp(Prop.ExpectResponse);
builder.setArg0(function.getNumber());
builder.setArg1(enabled ? 1 : 0);
- sampleView.messageQueue.addCommand(builder.build());
+ mGLFramesView.messageQueue.addCommand(builder.build());
breakpoints[function.getNumber()] = enabled;
}
Button btn = (Button) e.widget;
Group group = (Group) btn.getParent();
int contextId = 0;
- if (sampleView.current != null)
- contextId = sampleView.current.contextId;
+ if (mGLFramesView.current != null)
+ contextId = mGLFramesView.current.contextId;
setBreakpoint(contextId, Function.valueOf(group.getText()), btn.getSelection());
}
builder.setContextId(contextId);
builder.setType(Type.Response);
builder.setExpectResponse(true);
- final Shell shell = sampleView.getViewSite().getShell();
+ final Shell shell = mGLFramesView.getViewSite().getShell();
final boolean send[] = new boolean[1];
shell.getDisplay().syncExec(new Runnable() {
public void run() {
private void codeGenGenNames(final Message msg) {
final ByteBuffer names = msg.getData().asReadOnlyByteBuffer();
- names.order(SampleView.TARGET_BYTE_ORDER);
+ names.order(GLFramesView.TARGET_BYTE_ORDER);
SparseIntArray namesArray = null;
for (int i = 0; i < msg.getArg0(); i++) {
String id = "";
private void codeGenDeleteNames(final Message msg) {
final ByteBuffer names = msg.getData().asReadOnlyByteBuffer();
- names.order(SampleView.TARGET_BYTE_ORDER);
+ names.order(GLFramesView.TARGET_BYTE_ORDER);
SparseIntArray namesArray = null;
for (int i = 0; i < msg.getArg0(); i++) {
String id = null;
// need to load user pointer indices and/or attributes
final byte[] element = new byte[attribDataStride];
final ByteBuffer data = msgData.msg.getData().asReadOnlyByteBuffer();
- data.order(SampleView.TARGET_BYTE_ORDER);
+ data.order(GLFramesView.TARGET_BYTE_ORDER);
final ByteBuffer indexData = ByteBuffer.allocate(count * GLServerVertex.typeSize(type));
- indexData.order(SampleView.TARGET_BYTE_ORDER);
+ indexData.order(GLFramesView.TARGET_BYTE_ORDER);
final ByteBuffer attribData = ByteBuffer.allocate(count * attribDataStride);
- attribData.order(SampleView.TARGET_BYTE_ORDER);
+ attribData.order(GLFramesView.TARGET_BYTE_ORDER);
int maxIndex = -1;
ByteBuffer indexSrc = data;
if (v.indexBuffer != null) {
indexSrc = v.indexBuffer.data;
indexSrc.position(msgData.msg.getArg3());
}
- indexSrc.order(SampleView.TARGET_BYTE_ORDER);
+ indexSrc.order(GLFramesView.TARGET_BYTE_ORDER);
for (int i = 0; i < count; i++) {
int index = -1;
if (type == GLEnum.GL_UNSIGNED_BYTE) {
final int count = msgData.attribs[0].length / 4;
final GLEnum mode = GLEnum.valueOf(msgData.msg.getArg0());
final ByteBuffer attribData = ByteBuffer.allocate(maxAttrib * count * 16);
- attribData.order(SampleView.TARGET_BYTE_ORDER);
+ attribData.order(GLFramesView.TARGET_BYTE_ORDER);
for (int i = 0; i < count; i++)
for (int j = 0; j < maxAttrib; j++)
for (int k = 0; k < 4; k++)
file.seek(filePosition);
for (int i = 0; i < callsCount; i++) {
int len = file.readInt();
- if (SampleView.TARGET_BYTE_ORDER == ByteOrder.LITTLE_ENDIAN)
+ if (GLFramesView.TARGET_BYTE_ORDER == ByteOrder.LITTLE_ENDIAN)
len = Integer.reverseBytes(len);
final byte[] data = new byte[len];
file.read(data);
frame.increaseCallsCount();
final byte[] data = msg.toByteArray();
final ByteBuffer len = ByteBuffer.allocate(4);
- len.order(SampleView.TARGET_BYTE_ORDER);
+ len.order(GLFramesView.TARGET_BYTE_ORDER);
len.putInt(data.length);
try {
- if (SampleView.TARGET_BYTE_ORDER == ByteOrder.BIG_ENDIAN)
+ if (GLFramesView.TARGET_BYTE_ORDER == ByteOrder.BIG_ENDIAN)
file.writeInt(data.length);
else
file.writeInt(Integer.reverseBytes(data.length));
class ContextViewProvider extends LabelProvider implements ITreeContentProvider,
ISelectionChangedListener {
Context context;
- final SampleView sampleView;
+ final GLFramesView sampleView;
- ContextViewProvider(final SampleView sampleView) {
+ ContextViewProvider(final GLFramesView sampleView) {
this.sampleView = sampleView;
}
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Scale;
import org.eclipse.swt.widgets.ScrollBar;
import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Slider;
import org.eclipse.swt.widgets.Spinner;
import org.eclipse.swt.widgets.TabFolder;
import org.eclipse.swt.widgets.TabItem;
import java.io.FileNotFoundException;
import java.nio.ByteOrder;
-public class SampleView extends ViewPart implements Runnable {
+public class GLFramesView extends ViewPart implements Runnable {
public static final ByteOrder TARGET_BYTE_ORDER = ByteOrder.LITTLE_ENDIAN;
private boolean mRunning = false;
menuMgr.setRemoveAllWhenShown(true);
menuMgr.addMenuListener(new IMenuListener() {
public void menuAboutToShow(IMenuManager manager) {
- SampleView.this.fillContextMenu(manager);
+ GLFramesView.this.fillContextMenu(manager);
}
});
Menu menu = menuMgr.createContextMenu(mViewer.getControl());
}
case glDeleteTextures: {
final ByteBuffer names = msg.getData().asReadOnlyByteBuffer();
- names.order(SampleView.TARGET_BYTE_ORDER);
+ names.order(GLFramesView.TARGET_BYTE_ORDER);
for (int i = 0; i < msg.getArg0(); i++) {
final int name = names.getInt();
if (tex2D != null && tex2D.name == name)
GLBuffer copy = (GLBuffer) super.clone();
if (data != null) {
copy.data = ByteBuffer.allocate(data.capacity());
- copy.data.order(SampleView.TARGET_BYTE_ORDER);
+ copy.data.order(GLFramesView.TARGET_BYTE_ORDER);
data.position(0);
copy.data.put(data);
}
if (GLEnum.valueOf(msg.getArg0()) == GLEnum.GL_ARRAY_BUFFER) {
attribBuffer.usage = GLEnum.valueOf(msg.getArg3());
attribBuffer.data = msg.getData().asReadOnlyByteBuffer();
- attribBuffer.data.order(SampleView.TARGET_BYTE_ORDER);
+ attribBuffer.data.order(GLFramesView.TARGET_BYTE_ORDER);
} else if (GLEnum.valueOf(msg.getArg0()) == GLEnum.GL_ELEMENT_ARRAY_BUFFER) {
indexBuffer.usage = GLEnum.valueOf(msg.getArg3());
indexBuffer.data = msg.getData().asReadOnlyByteBuffer();
- indexBuffer.data.order(SampleView.TARGET_BYTE_ORDER);
+ indexBuffer.data.order(GLFramesView.TARGET_BYTE_ORDER);
} else
assert false;
}
if (GLEnum.valueOf(msg.getArg0()) == GLEnum.GL_ARRAY_BUFFER) {
if (attribBuffer.data.isReadOnly()) {
ByteBuffer buffer = ByteBuffer.allocate(attribBuffer.data.capacity());
- buffer.order(SampleView.TARGET_BYTE_ORDER);
+ buffer.order(GLFramesView.TARGET_BYTE_ORDER);
buffer.put(attribBuffer.data);
attribBuffer.data = buffer;
}
} else if (GLEnum.valueOf(msg.getArg0()) == GLEnum.GL_ELEMENT_ARRAY_BUFFER) {
if (indexBuffer.data.isReadOnly()) {
ByteBuffer buffer = ByteBuffer.allocate(indexBuffer.data.capacity());
- buffer.order(SampleView.TARGET_BYTE_ORDER);
+ buffer.order(GLFramesView.TARGET_BYTE_ORDER);
buffer.put(indexBuffer.data);
indexBuffer.data = buffer;
}
public void glDeleteBuffers(Message msg) {
final int n = msg.getArg0();
final ByteBuffer names = msg.getData().asReadOnlyByteBuffer();
- names.order(SampleView.TARGET_BYTE_ORDER);
+ names.order(GLFramesView.TARGET_BYTE_ORDER);
for (int i = 0; i < n; i++) {
final int name = names.getInt();
final GLBuffer buffer = buffers.get(name);
if (msg.hasData()) // server sends user pointer attribs
{
arrays = msg.getData().asReadOnlyByteBuffer();
- arrays.order(SampleView.TARGET_BYTE_ORDER);
+ arrays.order(GLFramesView.TARGET_BYTE_ORDER);
}
for (int i = 0; i < count; i++)
fetch(maxAttrib, first + i, i, arrays, msgData.attribs);
if (msg.hasData()) // server sends user pointer attribs
{
arrays = msg.getData().asReadOnlyByteBuffer();
- arrays.order(SampleView.TARGET_BYTE_ORDER);
+ arrays.order(GLFramesView.TARGET_BYTE_ORDER);
}
if (null == indexBuffer)
index = arrays; // server also interleaves user pointer indices
public void glGenBuffers(Message msg) {
final int n = msg.getArg0();
final ByteBuffer buffer = msg.getData().asReadOnlyByteBuffer();
- buffer.order(SampleView.TARGET_BYTE_ORDER);
+ buffer.order(GLFramesView.TARGET_BYTE_ORDER);
for (int i = 0; i < n; i++) {
final int name = buffer.getInt();
final int index = buffers.indexOfKey(name);
// void glVertexAttrib1fv(GLuint indx, const GLfloat* values)
public void glVertexAttrib1fv(Message msg) {
final ByteBuffer values = msg.getData().asReadOnlyByteBuffer();
- values.order(SampleView.TARGET_BYTE_ORDER);
+ values.order(GLFramesView.TARGET_BYTE_ORDER);
glVertexAttrib4f(msg.getArg0(),
Float.intBitsToFloat(values.getInt()),
0, 0, 1);
// void glVertexAttrib2fv(GLuint indx, const GLfloat* values)
public void glVertexAttrib2fv(Message msg) {
final ByteBuffer values = msg.getData().asReadOnlyByteBuffer();
- values.order(SampleView.TARGET_BYTE_ORDER);
+ values.order(GLFramesView.TARGET_BYTE_ORDER);
glVertexAttrib4f(msg.getArg0(),
Float.intBitsToFloat(values.getInt()),
Float.intBitsToFloat(values.getInt()), 0, 1);
// void glVertexAttrib3fv(GLuint indx, const GLfloat* values)
public void glVertexAttrib3fv(Message msg) {
final ByteBuffer values = msg.getData().asReadOnlyByteBuffer();
- values.order(SampleView.TARGET_BYTE_ORDER);
+ values.order(GLFramesView.TARGET_BYTE_ORDER);
glVertexAttrib4f(msg.getArg0(),
Float.intBitsToFloat(values.getInt()),
Float.intBitsToFloat(values.getInt()),
// void glVertexAttrib4fv(GLuint indx, const GLfloat* values)
public void glVertexAttrib4fv(Message msg) {
final ByteBuffer values = msg.getData().asReadOnlyByteBuffer();
- values.order(SampleView.TARGET_BYTE_ORDER);
+ values.order(GLFramesView.TARGET_BYTE_ORDER);
glVertexAttrib4f(msg.getArg0(),
Float.intBitsToFloat(values.getInt()),
Float.intBitsToFloat(values.getInt()),
static String formatFloats(int count, final ByteBuffer data) {
if (data.remaining() == 0)
return "{}";
- data.order(SampleView.TARGET_BYTE_ORDER);
+ data.order(GLFramesView.TARGET_BYTE_ORDER);
String ret = "{";
for (int i = 0; i < count; i++) {
ret += Float.intBitsToFloat(data.getInt());
static String formatInts(int count, final ByteBuffer data) {
if (data.remaining() == 0)
return "{}";
- data.order(SampleView.TARGET_BYTE_ORDER);
+ data.order(GLFramesView.TARGET_BYTE_ORDER);
String ret = "{";
for (int i = 0; i < count; i++) {
ret += data.getInt();
static String formatUInts(int count, final ByteBuffer data) {
if (data.remaining() == 0)
return "{}";
- data.order(SampleView.TARGET_BYTE_ORDER);
+ data.order(GLFramesView.TARGET_BYTE_ORDER);
String ret = "{";
for (int i = 0; i < count; i++) {
long bits = data.getInt() & 0xffffffff;
static String formatMatrix(int columns, int count, final ByteBuffer data) {
if (data.remaining() == 0)
return "{}";
- data.order(SampleView.TARGET_BYTE_ORDER);
+ data.order(GLFramesView.TARGET_BYTE_ORDER);
String ret = "{";
for (int i = 0; i < count; i++) {
ret += Float.intBitsToFloat(data.getInt());
ByteString parseFloats(int count) {
ByteBuffer buffer = ByteBuffer.allocate(count * 4);
- buffer.order(SampleView.TARGET_BYTE_ORDER);
+ buffer.order(GLFramesView.TARGET_BYTE_ORDER);
String [] arg = getList();
for (int i = 0; i < count; i++)
buffer.putFloat(Float.parseFloat(arg[i].trim()));
ByteString parseInts(int count) {
ByteBuffer buffer = ByteBuffer.allocate(count * 4);
- buffer.order(SampleView.TARGET_BYTE_ORDER);
+ buffer.order(GLFramesView.TARGET_BYTE_ORDER);
String [] arg = getList();
for (int i = 0; i < count; i++)
buffer.putInt(Integer.parseInt(arg[i].trim()));
ByteString parseUInts(int count) {
ByteBuffer buffer = ByteBuffer.allocate(count * 4);
- buffer.order(SampleView.TARGET_BYTE_ORDER);
+ buffer.order(GLFramesView.TARGET_BYTE_ORDER);
String [] arg = getList();
for (int i = 0; i < count; i++)
buffer.putInt((int)(Long.parseLong(arg[i].trim()) & 0xffffffff));
*/
public static byte[] lzfDecompressChunks(final ByteString data) {
ByteBuffer in = data.asReadOnlyByteBuffer();
- in.order(SampleView.TARGET_BYTE_ORDER);
+ in.order(GLFramesView.TARGET_BYTE_ORDER);
ByteBuffer out = ByteBuffer.allocate(in.getInt());
byte[] inChunk = new byte[0];
byte[] outChunk = new byte[0];
byte[] chunk = new byte[256 * 1024]; // chunk size is arbitrary
final ByteBuffer out = ByteBuffer.allocate(4 + (inSize + chunk.length - 1)
/ chunk.length * (chunk.length + 4 * 2));
- out.order(SampleView.TARGET_BYTE_ORDER);
+ out.order(GLFramesView.TARGET_BYTE_ORDER);
out.putInt(inSize);
for (int i = 0; i < inSize; i += chunk.length) {
int chunkIn = chunk.length;
private final ProcessMessage[] processes;
private ArrayList<Message> complete = new ArrayList<Message>(); // synchronized
private ArrayList<Message> commands = new ArrayList<Message>(); // synchronized
- private SampleView sampleView;
+ private GLFramesView sampleView;
- public MessageQueue(SampleView sampleView, final ProcessMessage[] processes) {
+ public MessageQueue(GLFramesView sampleView, final ProcessMessage[] processes) {
this.sampleView = sampleView;
this.processes = processes;
}
public class ShaderEditor extends Composite implements SelectionListener, ExtendedModifyListener,
ProcessMessage {
- SampleView sampleView;
+ GLFramesView mGLFramesView;
ToolBar toolbar;
ToolItem uploadShader, restoreShader, currentPrograms;
ArrayList<GLShader> shadersToUpload = new ArrayList<GLShader>();
- ShaderEditor(SampleView sampleView, Composite parent) {
+ ShaderEditor(GLFramesView view, Composite parent) {
super(parent, 0);
- this.sampleView = sampleView;
+ mGLFramesView = view;
GridLayout gridLayout = new GridLayout();
gridLayout.numColumns = 1;
public void updateUI() {
list.removeAll();
String progs = "Current Programs: ";
- for (int j = 0; j < sampleView.debugContexts.size(); j++) {
- final Context context = sampleView.debugContexts.valueAt(j).currentContext;
+ for (int j = 0; j < mGLFramesView.debugContexts.size(); j++) {
+ final Context context = mGLFramesView.debugContexts.valueAt(j).currentContext;
if (context.serverShader.current != null) {
progs += context.serverShader.current.name + "(0x";
return;
}
} catch (IOException e) {
- sampleView.showError(e);
+ mGLFramesView.showError(e);
}
// add the initial command, which when read by server will set
Message.Builder builder = getBuilder(contextId);
MessageParserEx.instance.parse(builder,
String.format("glShaderSource(%d,1,\"%s\",0)", current.name, current.source));
- sampleView.messageQueue.addCommand(builder.build());
+ mGLFramesView.messageQueue.addCommand(builder.build());
}
}
final String title = String.format("Shader %d in 0x%s failed to compile",
shader.name, Integer.toHexString(shader.context.context.contextId));
final String message = rcv.getData().toStringUtf8();
- sampleView.getSite().getShell().getDisplay().syncExec(new Runnable() {
+ mGLFramesView.getSite().getShell().getDisplay().syncExec(new Runnable() {
public void run()
{
MessageDialog.openWarning(getShell(), title, message);
final String title = String.format("Program %d in 0x%s failed to link",
program.name, Integer.toHexString(program.context.context.contextId));
final String message = rcv.getData().toStringUtf8();
- sampleView.getSite().getShell().getDisplay().syncExec(new Runnable() {
+ mGLFramesView.getSite().getShell().getDisplay().syncExec(new Runnable() {
public void run()
{
MessageDialog.openWarning(getShell(), title, message);
String[] details = list.getSelection()[0].split("\\s+");
final int contextId = Integer.parseInt(details[0], 16);
int name = Integer.parseInt(details[2]);
- current = sampleView.debugContexts.get(contextId).currentContext.serverShader.shaders
+ current = mGLFramesView.debugContexts.get(contextId).currentContext.serverShader.shaders
.get(name);
styledText.setText(current.source);
}