gltrace: Make code 64-bit safe.
Currently, the trace API passes the pointers that need to be patched up via 32 bit integers. Such code will not be 64 bit safe. This patch sends all pointers in a separate array of pointers for the fixup calls to read from. Change-Id: If975333f11a6f6f9a74fba57de328affaed452a5
This commit is contained in:
parent
9291da97cb
commit
9801142afb
File diff suppressed because it is too large
Load Diff
|
@ -76,21 +76,64 @@ unsigned getBytesPerTexel(const GLenum format, const GLenum type) {
|
|||
return 1; // in doubt...
|
||||
}
|
||||
|
||||
void fixup_GenericFloatArray(int argIndex, int nFloats, GLMessage *glmsg, void *src) {
|
||||
GLMessage_DataType *arg_floatarray = glmsg->mutable_args(argIndex);
|
||||
GLfloat *floatp = (GLfloat *)src;
|
||||
|
||||
if (floatp == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
arg_floatarray->set_type(GLMessage::DataType::FLOAT);
|
||||
arg_floatarray->set_isarray(true);
|
||||
arg_floatarray->clear_floatvalue();
|
||||
|
||||
for (int i = 0; i < nFloats; i++, floatp++) {
|
||||
arg_floatarray->add_floatvalue(*floatp);
|
||||
}
|
||||
}
|
||||
|
||||
void fixup_GenericIntArray(int argIndex, int nInts, GLMessage *glmsg, void *src) {
|
||||
GLMessage_DataType *arg_intarray = glmsg->mutable_args(argIndex);
|
||||
GLint *intp = (GLint *)src;
|
||||
|
||||
if (intp == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
arg_intarray->set_type(GLMessage::DataType::INT);
|
||||
arg_intarray->set_isarray(true);
|
||||
arg_intarray->clear_intvalue();
|
||||
|
||||
for (int i = 0; i < nInts; i++, intp++) {
|
||||
arg_intarray->add_intvalue(*intp);
|
||||
}
|
||||
}
|
||||
|
||||
void fixup_GenericEnumArray(int argIndex, int nEnums, GLMessage *glmsg, void *src) {
|
||||
// fixup as if they were ints
|
||||
fixup_GenericIntArray(argIndex, nEnums, glmsg, src);
|
||||
|
||||
// and then set the data type to be enum
|
||||
GLMessage_DataType *arg_enumarray = glmsg->mutable_args(argIndex);
|
||||
arg_enumarray->set_type(GLMessage::DataType::ENUM);
|
||||
}
|
||||
|
||||
/** Generic helper function: extract pointer at argIndex and
|
||||
replace it with the C style string at *pointer */
|
||||
void fixup_CStringPtr(int argIndex, GLMessage *glmsg) {
|
||||
void fixup_CStringPtr(int argIndex, GLMessage *glmsg, void *src) {
|
||||
GLMessage_DataType *arg = glmsg->mutable_args(argIndex);
|
||||
GLchar *ptr = (GLchar *)arg->intvalue(0);
|
||||
GLchar *ptr = (GLchar *) src;
|
||||
|
||||
arg->set_type(GLMessage::DataType::CHAR);
|
||||
arg->set_isarray(true);
|
||||
arg->add_charvalue(ptr);
|
||||
}
|
||||
|
||||
void fixup_glGetString(GLMessage *glmsg) {
|
||||
void fixup_glGetString(GLMessage *glmsg, void *pointersToFixup[]) {
|
||||
/* const GLubyte* GLTrace_glGetString(GLenum name) */
|
||||
GLMessage_DataType *ret = glmsg->mutable_returnvalue();
|
||||
GLchar *ptr = (GLchar *)ret->intvalue(0);
|
||||
GLchar *ptr = (GLchar *) pointersToFixup[0];
|
||||
|
||||
if (ptr != NULL) {
|
||||
ret->set_type(GLMessage::DataType::CHAR);
|
||||
|
@ -112,7 +155,7 @@ void fixup_addFBContents(GLTraceContext *context, GLMessage *glmsg, FBBinding fb
|
|||
}
|
||||
|
||||
/** Common fixup routing for glTexImage2D & glTexSubImage2D. */
|
||||
void fixup_glTexImage(int widthIndex, int heightIndex, GLMessage *glmsg) {
|
||||
void fixup_glTexImage(int widthIndex, int heightIndex, GLMessage *glmsg, void *dataSrc) {
|
||||
GLMessage_DataType arg_width = glmsg->args(widthIndex);
|
||||
GLMessage_DataType arg_height = glmsg->args(heightIndex);
|
||||
|
||||
|
@ -124,7 +167,7 @@ void fixup_glTexImage(int widthIndex, int heightIndex, GLMessage *glmsg) {
|
|||
GLsizei height = arg_height.intvalue(0);
|
||||
GLenum format = arg_format.intvalue(0);
|
||||
GLenum type = arg_type.intvalue(0);
|
||||
void *data = (void *)arg_data->intvalue(0);
|
||||
void *data = (void *) dataSrc;
|
||||
|
||||
int bytesPerTexel = getBytesPerTexel(format, type);
|
||||
|
||||
|
@ -141,7 +184,7 @@ void fixup_glTexImage(int widthIndex, int heightIndex, GLMessage *glmsg) {
|
|||
}
|
||||
|
||||
|
||||
void fixup_glTexImage2D(GLMessage *glmsg) {
|
||||
void fixup_glTexImage2D(GLMessage *glmsg, void *pointersToFixup[]) {
|
||||
/* void glTexImage2D(GLenum target,
|
||||
GLint level,
|
||||
GLint internalformat,
|
||||
|
@ -154,10 +197,10 @@ void fixup_glTexImage2D(GLMessage *glmsg) {
|
|||
*/
|
||||
int widthIndex = 3;
|
||||
int heightIndex = 4;
|
||||
fixup_glTexImage(widthIndex, heightIndex, glmsg);
|
||||
fixup_glTexImage(widthIndex, heightIndex, glmsg, pointersToFixup[0]);
|
||||
}
|
||||
|
||||
void fixup_glTexSubImage2D(GLMessage *glmsg) {
|
||||
void fixup_glTexSubImage2D(GLMessage *glmsg, void *pointersToFixup[]) {
|
||||
/*
|
||||
void glTexSubImage2D(GLenum target,
|
||||
GLint level,
|
||||
|
@ -171,10 +214,10 @@ void fixup_glTexSubImage2D(GLMessage *glmsg) {
|
|||
*/
|
||||
int widthIndex = 4;
|
||||
int heightIndex = 5;
|
||||
fixup_glTexImage(widthIndex, heightIndex, glmsg);
|
||||
fixup_glTexImage(widthIndex, heightIndex, glmsg, pointersToFixup[0]);
|
||||
}
|
||||
|
||||
void fixup_glShaderSource(GLMessage *glmsg) {
|
||||
void fixup_glShaderSource(GLMessage *glmsg, void *pointersToFixup[]) {
|
||||
/* void glShaderSource(GLuint shader, GLsizei count, const GLchar** string,
|
||||
const GLint* length) */
|
||||
GLMessage_DataType arg_count = glmsg->args(1);
|
||||
|
@ -182,8 +225,8 @@ void fixup_glShaderSource(GLMessage *glmsg) {
|
|||
GLMessage_DataType *arg_strpp = glmsg->mutable_args(2);
|
||||
|
||||
GLsizei count = arg_count.intvalue(0);
|
||||
GLchar **stringpp = (GLchar **)arg_strpp->intvalue(0);
|
||||
GLint *lengthp = (GLint *)arg_lenp.intvalue(0);
|
||||
GLchar **stringpp = (GLchar **) pointersToFixup[0];
|
||||
GLint *lengthp = (GLint *) pointersToFixup[1];
|
||||
|
||||
arg_strpp->set_type(GLMessage::DataType::CHAR);
|
||||
arg_strpp->set_isarray(true);
|
||||
|
@ -202,48 +245,31 @@ void fixup_glShaderSource(GLMessage *glmsg) {
|
|||
arg_strpp->add_charvalue(src);
|
||||
}
|
||||
|
||||
void fixup_glUniformGenericInteger(int argIndex, int nIntegers, GLMessage *glmsg) {
|
||||
void fixup_glUniformGenericInteger(int argIndex, int nIntegers, GLMessage *glmsg,
|
||||
void *pointersToFixup[]) {
|
||||
/* void glUniform?iv(GLint location, GLsizei count, const GLint *value); */
|
||||
GLMessage_DataType *arg_values = glmsg->mutable_args(argIndex);
|
||||
GLint *src = (GLint*)arg_values->intvalue(0);
|
||||
|
||||
arg_values->set_type(GLMessage::DataType::INT);
|
||||
arg_values->set_isarray(true);
|
||||
arg_values->clear_intvalue();
|
||||
|
||||
for (int i = 0; i < nIntegers; i++) {
|
||||
arg_values->add_intvalue(*src++);
|
||||
}
|
||||
fixup_GenericIntArray(argIndex, nIntegers, glmsg, pointersToFixup[0]);
|
||||
}
|
||||
|
||||
void fixup_glUniformGeneric(int argIndex, int nFloats, GLMessage *glmsg) {
|
||||
GLMessage_DataType *arg_values = glmsg->mutable_args(argIndex);
|
||||
GLfloat *src = (GLfloat*)arg_values->intvalue(0);
|
||||
|
||||
arg_values->set_type(GLMessage::DataType::FLOAT);
|
||||
arg_values->set_isarray(true);
|
||||
arg_values->clear_floatvalue();
|
||||
|
||||
for (int i = 0; i < nFloats; i++) {
|
||||
arg_values->add_floatvalue(*src++);
|
||||
}
|
||||
void fixup_glUniformGeneric(int argIndex, int nFloats, GLMessage *glmsg, void *src) {
|
||||
fixup_GenericFloatArray(argIndex, nFloats, glmsg, src);
|
||||
}
|
||||
|
||||
void fixup_glUniformMatrixGeneric(int matrixSize, GLMessage *glmsg) {
|
||||
void fixup_glUniformMatrixGeneric(int matrixSize, GLMessage *glmsg, void *pointersToFixup[]) {
|
||||
/* void glUniformMatrix?fv(GLint location, GLsizei count, GLboolean transpose,
|
||||
const GLfloat* value) */
|
||||
GLMessage_DataType arg_count = glmsg->args(1);
|
||||
int n_matrices = arg_count.intvalue(0);
|
||||
fixup_glUniformGeneric(3, matrixSize * matrixSize * n_matrices, glmsg);
|
||||
fixup_glUniformGeneric(3, matrixSize * matrixSize * n_matrices, glmsg, pointersToFixup[0]);
|
||||
}
|
||||
|
||||
void fixup_glBufferData(int sizeIndex, int dataIndex, GLMessage *glmsg) {
|
||||
void fixup_glBufferData(int sizeIndex, int dataIndex, GLMessage *glmsg, void *pointersToFixup[]) {
|
||||
/* 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);
|
||||
GLvoid *datap = (GLvoid *) pointersToFixup[0];
|
||||
|
||||
if (datap == NULL) {
|
||||
// glBufferData can be called with a NULL data pointer
|
||||
|
@ -257,52 +283,26 @@ void fixup_glBufferData(int sizeIndex, int dataIndex, GLMessage *glmsg) {
|
|||
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);
|
||||
|
||||
if (intp == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
arg_intarray->set_type(GLMessage::DataType::INT);
|
||||
arg_intarray->set_isarray(true);
|
||||
arg_intarray->clear_intvalue();
|
||||
|
||||
for (int i = 0; i < nInts; i++, intp++) {
|
||||
arg_intarray->add_intvalue(*intp);
|
||||
}
|
||||
}
|
||||
|
||||
void fixup_GenericEnumArray(int argIndex, int nEnums, GLMessage *glmsg) {
|
||||
// fixup as if they were ints
|
||||
fixup_GenericIntArray(argIndex, nEnums, glmsg);
|
||||
|
||||
// and then set the data type to be enum
|
||||
GLMessage_DataType *arg_enumarray = glmsg->mutable_args(argIndex);
|
||||
arg_enumarray->set_type(GLMessage::DataType::ENUM);
|
||||
}
|
||||
|
||||
void fixup_glGenGeneric(GLMessage *glmsg) {
|
||||
void fixup_glGenGeneric(GLMessage *glmsg, void *pointersToFixup[]) {
|
||||
/* void glGen*(GLsizei n, GLuint * buffers); */
|
||||
GLMessage_DataType arg_n = glmsg->args(0);
|
||||
GLsizei n = arg_n.intvalue(0);
|
||||
|
||||
fixup_GenericIntArray(1, n, glmsg);
|
||||
fixup_GenericIntArray(1, n, glmsg, pointersToFixup[0]);
|
||||
}
|
||||
|
||||
void fixup_glDeleteGeneric(GLMessage *glmsg) {
|
||||
void fixup_glDeleteGeneric(GLMessage *glmsg, void *pointersToFixup[]) {
|
||||
/* void glDelete*(GLsizei n, GLuint *buffers); */
|
||||
GLMessage_DataType arg_n = glmsg->args(0);
|
||||
GLsizei n = arg_n.intvalue(0);
|
||||
|
||||
fixup_GenericIntArray(1, n, glmsg);
|
||||
fixup_GenericIntArray(1, n, glmsg, pointersToFixup[0]);
|
||||
}
|
||||
|
||||
void fixup_glGetBooleanv(GLMessage *glmsg) {
|
||||
void fixup_glGetBooleanv(GLMessage *glmsg, void *pointersToFixup[]) {
|
||||
/* void glGetBooleanv(GLenum pname, GLboolean *params); */
|
||||
GLMessage_DataType *arg_params = glmsg->mutable_args(1);
|
||||
GLboolean *src = (GLboolean*)arg_params->intvalue(0);
|
||||
GLboolean *src = (GLboolean*) pointersToFixup[0];
|
||||
|
||||
arg_params->set_type(GLMessage::DataType::BOOL);
|
||||
arg_params->set_isarray(true);
|
||||
|
@ -310,10 +310,10 @@ void fixup_glGetBooleanv(GLMessage *glmsg) {
|
|||
arg_params->add_boolvalue(*src);
|
||||
}
|
||||
|
||||
void fixup_glGetFloatv(GLMessage *glmsg) {
|
||||
void fixup_glGetFloatv(GLMessage *glmsg, void *pointersToFixup[]) {
|
||||
/* void glGetFloatv(GLenum pname, GLfloat *params); */
|
||||
GLMessage_DataType *arg_params = glmsg->mutable_args(1);
|
||||
GLfloat *src = (GLfloat*)arg_params->intvalue(0);
|
||||
GLfloat *src = (GLfloat*) pointersToFixup[0];
|
||||
|
||||
arg_params->set_type(GLMessage::DataType::FLOAT);
|
||||
arg_params->set_isarray(true);
|
||||
|
@ -358,16 +358,15 @@ void fixup_glLinkProgram(GLMessage *glmsg) {
|
|||
}
|
||||
|
||||
/** Given a glGetActive[Uniform|Attrib] call, obtain the location
|
||||
* of the variable in the call.
|
||||
* of the variable of given name in the call.
|
||||
*/
|
||||
int getShaderVariableLocation(GLTraceContext *context, GLMessage *glmsg) {
|
||||
int getShaderVariableLocation(GLTraceContext *context, GLMessage *glmsg, GLchar *name) {
|
||||
GLMessage_Function func = glmsg->function();
|
||||
if (func != GLMessage::glGetActiveAttrib && func != GLMessage::glGetActiveUniform) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
int program = glmsg->args(0).intvalue(0);
|
||||
GLchar *name = (GLchar*) glmsg->args(6).intvalue(0);
|
||||
|
||||
if (func == GLMessage::glGetActiveAttrib) {
|
||||
return context->hooks->gl.glGetAttribLocation(program, name);
|
||||
|
@ -376,16 +375,17 @@ int getShaderVariableLocation(GLTraceContext *context, GLMessage *glmsg) {
|
|||
}
|
||||
}
|
||||
|
||||
void fixup_glGetActiveAttribOrUniform(GLMessage *glmsg, int location) {
|
||||
void fixup_glGetActiveAttribOrUniform(GLTraceContext *context, GLMessage *glmsg,
|
||||
void *pointersToFixup[]) {
|
||||
/* void glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize,
|
||||
GLsizei* length, GLint* size, GLenum* type, GLchar* name); */
|
||||
/* void glGetActiveUniform(GLuint program, GLuint index, GLsizei bufsize,
|
||||
GLsizei* length, GLint* size, GLenum* type, GLchar* name) */
|
||||
|
||||
fixup_GenericIntArray(3, 1, glmsg); // length
|
||||
fixup_GenericIntArray(4, 1, glmsg); // size
|
||||
fixup_GenericEnumArray(5, 1, glmsg); // type
|
||||
fixup_CStringPtr(6, glmsg); // name
|
||||
fixup_GenericIntArray(3, 1, glmsg, pointersToFixup[0]); // length
|
||||
fixup_GenericIntArray(4, 1, glmsg, pointersToFixup[1]); // size
|
||||
fixup_GenericEnumArray(5, 1, glmsg, pointersToFixup[2]); // type
|
||||
fixup_CStringPtr(6, glmsg, pointersToFixup[3]); // name
|
||||
|
||||
// The index argument in the glGetActive[Attrib|Uniform] functions
|
||||
// does not correspond to the actual location index as used in
|
||||
|
@ -393,6 +393,7 @@ void fixup_glGetActiveAttribOrUniform(GLMessage *glmsg, int location) {
|
|||
// In order to make things simpler for the debugger, we also pass
|
||||
// a hidden location argument that stores the actual location.
|
||||
// append the location value to the end of the argument list
|
||||
int location = getShaderVariableLocation(context, glmsg, (GLchar*)pointersToFixup[3]);
|
||||
GLMessage_DataType *arg_location = glmsg->add_args();
|
||||
arg_location->set_isarray(false);
|
||||
arg_location->set_type(GLMessage::DataType::INT);
|
||||
|
@ -401,7 +402,7 @@ void fixup_glGetActiveAttribOrUniform(GLMessage *glmsg, int location) {
|
|||
|
||||
void fixupGLMessage(GLTraceContext *context, nsecs_t wallStart, nsecs_t wallEnd,
|
||||
nsecs_t threadStart, nsecs_t threadEnd,
|
||||
GLMessage *glmsg) {
|
||||
GLMessage *glmsg, void *pointersToFixup[]) {
|
||||
// for all messages, set the current context id
|
||||
glmsg->set_context_id(context->getId());
|
||||
|
||||
|
@ -416,41 +417,41 @@ void fixupGLMessage(GLTraceContext *context, nsecs_t wallStart, nsecs_t wallEnd,
|
|||
case GLMessage::glDeleteFramebuffers: /* glDeleteFramebuffers(GLsizei n, GLuint *buffers); */
|
||||
case GLMessage::glDeleteRenderbuffers:/* glDeleteRenderbuffers(GLsizei n, GLuint *buffers); */
|
||||
case GLMessage::glDeleteTextures: /* glDeleteTextures(GLsizei n, GLuint *textures); */
|
||||
fixup_glDeleteGeneric(glmsg);
|
||||
fixup_glDeleteGeneric(glmsg, pointersToFixup);
|
||||
break;
|
||||
case GLMessage::glGenBuffers: /* void glGenBuffers(GLsizei n, GLuint *buffers); */
|
||||
case GLMessage::glGenFramebuffers: /* void glGenFramebuffers(GLsizei n, GLuint *buffers); */
|
||||
case GLMessage::glGenRenderbuffers: /* void glGenFramebuffers(GLsizei n, GLuint *buffers); */
|
||||
case GLMessage::glGenTextures: /* void glGenTextures(GLsizei n, GLuint *textures); */
|
||||
fixup_glGenGeneric(glmsg);
|
||||
fixup_glGenGeneric(glmsg, pointersToFixup);
|
||||
break;
|
||||
case GLMessage::glLinkProgram: /* void glLinkProgram(GLuint program); */
|
||||
fixup_glLinkProgram(glmsg);
|
||||
break;
|
||||
case GLMessage::glGetActiveAttrib:
|
||||
fixup_glGetActiveAttribOrUniform(glmsg, getShaderVariableLocation(context, glmsg));
|
||||
fixup_glGetActiveAttribOrUniform(context, glmsg, pointersToFixup);
|
||||
break;
|
||||
case GLMessage::glGetActiveUniform:
|
||||
fixup_glGetActiveAttribOrUniform(glmsg, getShaderVariableLocation(context, glmsg));
|
||||
fixup_glGetActiveAttribOrUniform(context, glmsg, pointersToFixup);
|
||||
break;
|
||||
case GLMessage::glBindAttribLocation:
|
||||
/* void glBindAttribLocation(GLuint program, GLuint index, const GLchar* name); */
|
||||
fixup_CStringPtr(2, glmsg);
|
||||
fixup_CStringPtr(2, glmsg, pointersToFixup[0]);
|
||||
break;
|
||||
case GLMessage::glGetAttribLocation:
|
||||
case GLMessage::glGetUniformLocation:
|
||||
/* int glGetAttribLocation(GLuint program, const GLchar* name) */
|
||||
/* int glGetUniformLocation(GLuint program, const GLchar* name) */
|
||||
fixup_CStringPtr(1, glmsg);
|
||||
fixup_CStringPtr(1, glmsg, pointersToFixup[0]);
|
||||
break;
|
||||
case GLMessage::glGetBooleanv:
|
||||
fixup_glGetBooleanv(glmsg);
|
||||
fixup_glGetBooleanv(glmsg, pointersToFixup);
|
||||
break;
|
||||
case GLMessage::glGetFloatv:
|
||||
fixup_glGetFloatv(glmsg);
|
||||
fixup_glGetFloatv(glmsg, pointersToFixup);
|
||||
break;
|
||||
case GLMessage::glGetIntegerv: /* void glGetIntegerv(GLenum pname, GLint *params); */
|
||||
fixup_GenericIntArray(1, 1, glmsg);
|
||||
fixup_GenericIntArray(1, 1, glmsg, pointersToFixup[0]);
|
||||
break;
|
||||
case GLMessage::glGetProgramiv:
|
||||
case GLMessage::glGetRenderbufferParameteriv:
|
||||
|
@ -458,78 +459,78 @@ void fixupGLMessage(GLTraceContext *context, nsecs_t wallStart, nsecs_t wallEnd,
|
|||
/* void glGetProgramiv(GLuint program, GLenum pname, GLint* params) */
|
||||
/* void glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params) */
|
||||
/* void glGetShaderiv(GLuint shader, GLenum pname, GLint* params) */
|
||||
fixup_GenericIntArray(2, 1, glmsg);
|
||||
fixup_GenericIntArray(2, 1, glmsg, pointersToFixup[0]);
|
||||
break;
|
||||
case GLMessage::glGetString:
|
||||
fixup_glGetString(glmsg);
|
||||
fixup_glGetString(glmsg, pointersToFixup);
|
||||
break;
|
||||
case GLMessage::glTexImage2D:
|
||||
if (context->getGlobalTraceState()->shouldCollectTextureDataOnGlTexImage()) {
|
||||
fixup_glTexImage2D(glmsg);
|
||||
fixup_glTexImage2D(glmsg, pointersToFixup);
|
||||
}
|
||||
break;
|
||||
case GLMessage::glTexSubImage2D:
|
||||
if (context->getGlobalTraceState()->shouldCollectTextureDataOnGlTexImage()) {
|
||||
fixup_glTexSubImage2D(glmsg);
|
||||
fixup_glTexSubImage2D(glmsg, pointersToFixup);
|
||||
}
|
||||
break;
|
||||
case GLMessage::glShaderSource:
|
||||
fixup_glShaderSource(glmsg);
|
||||
fixup_glShaderSource(glmsg, pointersToFixup);
|
||||
break;
|
||||
case GLMessage::glUniform1iv:
|
||||
/* void glUniform1iv(GLint location, GLsizei count, const GLint *value); */
|
||||
fixup_glUniformGenericInteger(2, 1, glmsg);
|
||||
fixup_glUniformGenericInteger(2, 1, glmsg, pointersToFixup);
|
||||
break;
|
||||
case GLMessage::glUniform2iv:
|
||||
/* void glUniform2iv(GLint location, GLsizei count, const GLint *value); */
|
||||
fixup_glUniformGenericInteger(2, 2, glmsg);
|
||||
fixup_glUniformGenericInteger(2, 2, glmsg, pointersToFixup);
|
||||
break;
|
||||
case GLMessage::glUniform3iv:
|
||||
/* void glUniform3iv(GLint location, GLsizei count, const GLint *value); */
|
||||
fixup_glUniformGenericInteger(2, 3, glmsg);
|
||||
fixup_glUniformGenericInteger(2, 3, glmsg, pointersToFixup);
|
||||
break;
|
||||
case GLMessage::glUniform4iv:
|
||||
/* void glUniform4iv(GLint location, GLsizei count, const GLint *value); */
|
||||
fixup_glUniformGenericInteger(2, 4, glmsg);
|
||||
fixup_glUniformGenericInteger(2, 4, glmsg, pointersToFixup);
|
||||
break;
|
||||
case GLMessage::glUniform1fv:
|
||||
/* void glUniform1fv(GLint location, GLsizei count, const GLfloat *value); */
|
||||
fixup_glUniformGeneric(2, 1, glmsg);
|
||||
fixup_glUniformGeneric(2, 1, glmsg, pointersToFixup[0]);
|
||||
break;
|
||||
case GLMessage::glUniform2fv:
|
||||
/* void glUniform2fv(GLint location, GLsizei count, const GLfloat *value); */
|
||||
fixup_glUniformGeneric(2, 2, glmsg);
|
||||
fixup_glUniformGeneric(2, 2, glmsg, pointersToFixup[0]);
|
||||
break;
|
||||
case GLMessage::glUniform3fv:
|
||||
/* void glUniform3fv(GLint location, GLsizei count, const GLfloat *value); */
|
||||
fixup_glUniformGeneric(2, 3, glmsg);
|
||||
fixup_glUniformGeneric(2, 3, glmsg, pointersToFixup[0]);
|
||||
break;
|
||||
case GLMessage::glUniform4fv:
|
||||
/* void glUniform4fv(GLint location, GLsizei count, const GLfloat *value); */
|
||||
fixup_glUniformGeneric(2, 4, glmsg);
|
||||
fixup_glUniformGeneric(2, 4, glmsg, pointersToFixup[0]);
|
||||
break;
|
||||
case GLMessage::glUniformMatrix2fv:
|
||||
/* void glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose,
|
||||
const GLfloat* value) */
|
||||
fixup_glUniformMatrixGeneric(2, glmsg);
|
||||
fixup_glUniformMatrixGeneric(2, glmsg, pointersToFixup);
|
||||
break;
|
||||
case GLMessage::glUniformMatrix3fv:
|
||||
/* void glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose,
|
||||
const GLfloat* value) */
|
||||
fixup_glUniformMatrixGeneric(3, glmsg);
|
||||
fixup_glUniformMatrixGeneric(3, glmsg, pointersToFixup);
|
||||
break;
|
||||
case GLMessage::glUniformMatrix4fv:
|
||||
/* void glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose,
|
||||
const GLfloat* value) */
|
||||
fixup_glUniformMatrixGeneric(4, glmsg);
|
||||
fixup_glUniformMatrixGeneric(4, glmsg, pointersToFixup);
|
||||
break;
|
||||
case GLMessage::glBufferData:
|
||||
/* void glBufferData(GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage) */
|
||||
fixup_glBufferData(1, 2, glmsg);
|
||||
fixup_glBufferData(1, 2, glmsg, pointersToFixup);
|
||||
break;
|
||||
case GLMessage::glBufferSubData:
|
||||
/* void glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data) */
|
||||
fixup_glBufferData(2, 3, glmsg);
|
||||
fixup_glBufferData(2, 3, glmsg, pointersToFixup);
|
||||
break;
|
||||
case GLMessage::glDrawArrays:
|
||||
/* void glDrawArrays(GLenum mode, GLint first, GLsizei count) */
|
||||
|
@ -545,11 +546,11 @@ void fixupGLMessage(GLTraceContext *context, nsecs_t wallStart, nsecs_t wallEnd,
|
|||
break;
|
||||
case GLMessage::glPushGroupMarkerEXT:
|
||||
/* void PushGroupMarkerEXT(sizei length, const char *marker); */
|
||||
fixup_CStringPtr(1, glmsg);
|
||||
fixup_CStringPtr(1, glmsg, pointersToFixup[0]);
|
||||
break;
|
||||
case GLMessage::glInsertEventMarkerEXT:
|
||||
/* void InsertEventMarkerEXT(sizei length, const char *marker); */
|
||||
fixup_CStringPtr(1, glmsg);
|
||||
fixup_CStringPtr(1, glmsg, pointersToFixup[0]);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -27,7 +27,7 @@ namespace gltrace {
|
|||
|
||||
void fixupGLMessage(GLTraceContext *curContext, nsecs_t wallStart, nsecs_t wallEnd,
|
||||
nsecs_t threadStart, nsecs_t threadEnd,
|
||||
GLMessage *message);
|
||||
GLMessage *message, void *pointersToFixup[]);
|
||||
void fixup_addFBContents(GLTraceContext *curContext, GLMessage *message, FBBinding fbToRead);
|
||||
|
||||
};
|
||||
|
|
|
@ -92,8 +92,8 @@ GL2PROTOBUF_TYPE_MAP = {
|
|||
"GLclampf":DataType.FLOAT,
|
||||
"GLfixed":DataType.INT,
|
||||
"GLclampx":DataType.INT,
|
||||
"GLsizeiptr":DataType.POINTER,
|
||||
"GLintptr":DataType.POINTER,
|
||||
"GLsizeiptr":DataType.INT,
|
||||
"GLintptr":DataType.INT,
|
||||
"GLeglImageOES":DataType.POINTER,
|
||||
}
|
||||
|
||||
|
@ -180,9 +180,20 @@ TRACE_CALL_TEMPLATE = pyratemp.Template(
|
|||
rt->$!retDataType.getProtobufCall()!$retValue);
|
||||
<!--(end)-->
|
||||
|
||||
void *pointerArgs[] = {
|
||||
<!--(for argname, argtype in parsedArgs)-->
|
||||
<!--(if argtype == DataType.POINTER)-->
|
||||
(void *) $!argname!$,
|
||||
<!--(end)-->
|
||||
<!--(end)-->
|
||||
<!--(if retDataType == DataType.POINTER)-->
|
||||
(void *) retValue,
|
||||
<!--(end)-->
|
||||
};
|
||||
|
||||
fixupGLMessage(glContext, wallStartTime, wallEndTime,
|
||||
threadStartTime, threadEndTime,
|
||||
&glmsg);
|
||||
&glmsg, pointerArgs);
|
||||
glContext->traceGLMessage(&glmsg);
|
||||
<!--(if retType != "void")-->
|
||||
|
||||
|
|
Loading…
Reference in New Issue