aboutsummaryrefslogtreecommitdiffstats
path: root/emulator/opengl/host/libs/libOpenglRender/NativeLinuxSubWindow.cpp
diff options
context:
space:
mode:
authorDavid 'Digit' Turner <digit@google.com>2014-09-25 14:09:45 -0700
committerbohu <bohu@google.com>2014-11-25 12:30:47 -0800
commit9ee9ffb0663c1c439ad66030331df564d0dfbdcf (patch)
tree6ebd118e21415ae1859d99d4169df9b34935d3ba /emulator/opengl/host/libs/libOpenglRender/NativeLinuxSubWindow.cpp
parentd0dc1ddf4a9678714c88aca05883592f04f6c37f (diff)
downloadsdk-9ee9ffb0663c1c439ad66030331df564d0dfbdcf.zip
sdk-9ee9ffb0663c1c439ad66030331df564d0dfbdcf.tar.gz
sdk-9ee9ffb0663c1c439ad66030331df564d0dfbdcf.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 'emulator/opengl/host/libs/libOpenglRender/NativeLinuxSubWindow.cpp')
0 files changed, 0 insertions, 0 deletions