diff options
author | David 'Digit' Turner <digit@google.com> | 2014-09-25 14:09:45 -0700 |
---|---|---|
committer | David 'Digit' Turner <digit@google.com> | 2014-09-25 15:44:11 -0700 |
commit | ebef20fc443650603ac91735595549bba8f47f44 (patch) | |
tree | 6ee5794a54ede7c747cf357fff6b4f8798c105a0 /sdklauncher | |
parent | e3823f90ffd60a4b1692f799e31eaccff77bf08d (diff) | |
download | sdk-ebef20fc443650603ac91735595549bba8f47f44.zip sdk-ebef20fc443650603ac91735595549bba8f47f44.tar.gz sdk-ebef20fc443650603ac91735595549bba8f47f44.tar.bz2 |
emulator/opengl/emugen: Use local variables for parameters.
Modify the generated decoder to extract paramters from the
stream into local variables, the rules are:
- non-pointer parameters are extracted into local variables
named "var_<name>", where <name> is the parameter name as
it appears in the protocol specification for the entry.
- for input pointers, use "inptr_<name>", as well as
"size_<name>" for the corresponding size in bytes.
- for output pointers, use "outptr_<name>" and "size_<name>"
This makes the generated code easier to understand, for example
the following:
case OP_glBindAttribLocation: {
size_t tmpPtr2Size = (size_t)*(uint32_t *)(ptr + 8 + 4 + 4);
InputBuffer tmpPtr2(ptr + 8 + 4 + 4 + 4, tmpPtr2Size);
DEBUG("gl2(%p): glBindAttribLocation(%u %u %p(%u) )\n", stream,Unpack<GLuint,uint32_t>(ptr + 8), Unpack<GLuint,uint32_t>(ptr + 8 + 4), (const GLchar*)(tmpPtr2.get()), (uint32_t)tmpPtr2Size);
this->glBindAttribLocation(Unpack<GLuint,uint32_t>(ptr + 8), Unpack<GLuint,uint32_t>(ptr + 8 + 4), (const GLchar*)(tmpPtr2.get()));
SET_LASTCALL("glBindAttribLocation");
break;
}
becomes:
case OP_glBindAttribLocation: {
GLuint var_program = Unpack<GLuint,uint32_t>(ptr + 8);
GLuint var_index = Unpack<GLuint,uint32_t>(ptr + 8 + 4);
uint32_t size_name = Unpack<uint32_t,uint32_t>(ptr + 8 + 4 + 4);
InputBuffer inptr_name(ptr + 8 + 4 + 4 + 4, size_name);
DEBUG("gl2(%p): glBindAttribLocation(%u %u %p(%u) )\n", stream,var_program, var_index, (const GLchar*)(inptr_name.get()), size_name);
this->glBindAttribLocation(var_program, var_index, (const GLchar*)(inptr_name.get()));
SET_LASTCALL("glBindAttribLocation");
break;
}
Change-Id: Ifa8c73eec85b818d6d8b6371587da9fdfa57de8e
Diffstat (limited to 'sdklauncher')
0 files changed, 0 insertions, 0 deletions