diff options
author | Siva Velusamy <vsiva@google.com> | 2012-02-22 18:21:59 -0800 |
---|---|---|
committer | Siva Velusamy <vsiva@google.com> | 2012-02-24 11:32:00 -0800 |
commit | 8293c92c751f15614b1c72e92becba6097e053c0 (patch) | |
tree | 010e9038146cd62725e4e02d3f9c0d81d518af74 | |
parent | 6b48f088b1e0bed242118422c88fea8d714307e0 (diff) | |
download | frameworks_base-8293c92c751f15614b1c72e92becba6097e053c0.zip frameworks_base-8293c92c751f15614b1c72e92becba6097e053c0.tar.gz frameworks_base-8293c92c751f15614b1c72e92becba6097e053c0.tar.bz2 |
gltrace: attach buffer data sent with glBufferData
Attach the buffer that is passed with glBufferData
and glBufferSubData to the proto buf.
Change-Id: I1b4c1172d405736b06cb0a356a6e241e1d60c4d5
-rw-r--r-- | opengl/libs/GLES_trace/src/gltrace_fixup.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/opengl/libs/GLES_trace/src/gltrace_fixup.cpp b/opengl/libs/GLES_trace/src/gltrace_fixup.cpp index 6c4feb5..a043929 100644 --- a/opengl/libs/GLES_trace/src/gltrace_fixup.cpp +++ b/opengl/libs/GLES_trace/src/gltrace_fixup.cpp @@ -237,6 +237,26 @@ void fixup_glUniformMatrixGeneric(int matrixSize, GLMessage *glmsg) { fixup_glUniformGeneric(3, matrixSize * matrixSize * n_matrices, glmsg); } +void fixup_glBufferData(int sizeIndex, int dataIndex, GLMessage *glmsg) { + /* void glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data) */ + /* void glBufferData(GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage) */ + GLsizeiptr size = glmsg->args(sizeIndex).intvalue(0); + + GLMessage_DataType *arg_datap = glmsg->mutable_args(dataIndex); + GLvoid *datap = (GLvoid *)arg_datap->intvalue(0); + + if (datap == NULL) { + // glBufferData can be called with a NULL data pointer + return; + } + + arg_datap->set_type(GLMessage::DataType::VOID); + arg_datap->set_isarray(true); + arg_datap->clear_intvalue(); + + arg_datap->add_rawbytes(datap, size); +} + void fixup_GenericIntArray(int argIndex, int nInts, GLMessage *glmsg) { GLMessage_DataType *arg_intarray = glmsg->mutable_args(argIndex); GLint *intp = (GLint *)arg_intarray->intvalue(0); @@ -503,6 +523,14 @@ void fixupGLMessage(GLTraceContext *context, nsecs_t wallStart, nsecs_t wallEnd, const GLfloat* value) */ fixup_glUniformMatrixGeneric(4, glmsg); break; + case GLMessage::glBufferData: + /* void glBufferData(GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage) */ + fixup_glBufferData(1, 2, glmsg); + break; + case GLMessage::glBufferSubData: + /* void glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data) */ + fixup_glBufferData(2, 3, glmsg); + break; case GLMessage::glDrawArrays: /* void glDrawArrays(GLenum mode, GLint first, GLsizei count) */ if (context->getGlobalTraceState()->shouldCollectFbOnGlDraw()) { |