aboutsummaryrefslogtreecommitdiffstats
path: root/emulator/opengl/host/tools
Commit message (Collapse)AuthorAgeFilesLines
* emulator/opengl/emugen: Use local variables for parameters.David 'Digit' Turner2014-09-251-83/+100
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* emulator/opengl/emugen: Move pointer increment out of case statements.David 'Digit' Turner2014-09-251-8/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Minor patch that ensures that the pointer/position increment all happen at one place, instead of being replicated in each case statement. In other words, the generated code used to look like: switch (opcode) { case OP_someOperation1: { ... ptr += *(uint32_t)(ptr + 4); pos += *(uint32_t)(ptr + 4); break; } case OP_someOperation2: { ... ptr += *(uint32_t)(ptr + 4); pos += *(uint32_t)(ptr + 4); break; } ... default: { unknownOpcode = true; } Now it looks like: switch (opcode) { case OP_someOperation1: { ... break; } case OP_someOperation2: { ... break; } ... default: { unknownOpcode = true; } if (!unknownOpcode) { ptr += packetLen; pos += packetLen; } Which is cleaner. Also change the type of |opcode| and |packetLen| to uint32_t and size_t respectively. + Minor formatting changes to indentation. Change-Id: If0002fe18a24b9ce6691e3e3cd3e102d1e00d4c9
* emulator/opengl/emugen: Introduce helper macros.David 'Digit' Turner2014-09-251-8/+17
| | | | | | | | This patch introduces two helper macros in the generated decoder to make its source code slightly more readable (DEBUG and SET_LASCALL). Change-Id: I6659fe69a5533e5194d8db5f1882abaf1a5daee5
* emulator/opengl/emugen: Remove accessor functions.David 'Digit' Turner2014-09-251-25/+12
| | | | | | | | This patch simplifies the generated encoders and decoders by getting rid of the accessor functions (e.g. set_glDrawElementsData) given that all fields are public and can be written to directly. Change-Id: I15f4caac95e4d5f1e24a1a5838622600c6bc3207
* emulator/opengl/emugen: Ensure correct buffer alignment.David 'Digit' Turner2014-09-241-4/+69
| | | | | | | | | | | | | | The decoders generated by emugen pass addresses that come directly from the stream to EGL/GL functions. Sometimes, these addresses are not properly padded with regards to the type of data being transfered and this can crash some implementations (e.g. OSMesa being compiled with -msse by default, and doesn't build without it). This patch introduces two helper classes in ProtocolUtils.h, named InputBuffer and OutputBuffer, which are used to auto-align buffer pointers, then make the generated decoder code use them. Change-Id: I345c7eecc230f62310ced5378b6344f419647e06
* emulator/opengl/emgen: Fix debug output of floating point values.David 'Digit' Turner2014-09-171-7/+2
| | | | | | | | | | | | When calling printf() with a "%f", the value passed must be a double, not a float, which means we can't just pass a 32-bit value in the stack and assume printf() will cast it to a float properly. This results in bogus values printed whenever a GLfloat is used in a function signature, due to invalid stack offsets used by the printf(). Fix the problem by using Unpack<>() template. Change-Id: I282d9c07af68457f32af477435e5dc1999267d39
* emulator/opengl/emugen: Use templates to read values from stream.David 'Digit' Turner2014-09-161-73/+142
| | | | | | | | | | | | | | The decoder didn't properly handle GLsizeiptr and GLintptr values, which are always 32-bit on the wire, but can be 64-bit on the host. I.e. it did something like that to read them from the stream: *(GLsizeiptr*)(ptr + offset) This fixes the issue by using templates to generate host-type-specific functions that properly read data from the stream and convert it to the appropriate host type. Change-Id: I75749bd715456ca143eb1713498f7cf635918801
* emulator/opengl/emugl: Remove ispointer field from types definitions.David 'Digit' Turner2014-09-131-14/+21
| | | | Change-Id: If8f42a739dce6d1ac4d737ee50c7d2d569004153
* emulator/opengl/emugen: Get rid of VarConverter.David 'Digit' Turner2014-09-132-72/+45
| | | | | | | | This patch simplifies VarType.h a bit, since there is no point in having a specialized class like VarConverter to essentially hold what is a size in bytes! Change-Id: Idbba469a8594d1e964bbe79bbbea65934c42c033
* emulator/opengl: A few debugging, stability improvements to emuglKen Mixter2014-05-211-2/+6
| | | | | | | | | | | | | | | | | | | * Zero output parameters so that errors don't return random data (even if the target code was careful to zero its output parameters.) Spec says that we will not modify values in case of an error, which is not currently possible, but at least this means we return deterministic values. * Similarly, avoid passing uninitialized data if an error occurs during getting the viewport. * Fix a bug where glGetError may be called when NULL is decoded in CHECK_GL_ERROR mode. * Output more information about the stream in DEBUG_PRINTOUT mode to help separate from multiple streams. Change-Id: I31706b92642efe4c7ed38d178b49e72835a9c9a6
* emulator/opengl: Backport fixes from master branch.David 'Digit' Turner2014-04-172-4/+4
| | | | | | | | | | This back-ports several fixes from aosp/master branch into idea133: 145e25 Fix the Google Maps crash issue e33909 Support GL_MAX_TEXTURE_SIZE case to glGetIntegerv API c6dd20 Fix Mac build. Change-Id: I26a05956c3b926dddeb638c6cff979199075ecbb
* Merge "Fix compilation error due to missing getopt with ↵David Turner2014-04-161-3/+0
|\ | | | | | | x86_64-linux-glibc2.11-4.8" into idea133
| * Fix compilation error due to missing getopt with x86_64-linux-glibc2.11-4.8Andrew Hsieh2014-03-181-3/+0
| | | | | | | | | | | | | | | | Unlike its 4.6 counterpart, the new x86_64-linux-glibc2.11-4.8/x86_64-linux/include/c++/4.8/x86_64-linux/bits/gthr-default.h (line #39) no longer unconditionally include unistd.h which provides getopt prototype Change-Id: I53310bb0f27e6ed7b4ee732ef301c4868decccb4
* | emulator/opengl: Fix misc. compiler warnings.David 'Digit' Turner2014-04-011-3/+1
|/ | | | | | | These warnings appear when building the sources through the emulator's standalone build system, not the platform one. Change-Id: Ib5d51cf6211f32763be00c7436ae14c06f76b436
* emulator/opengl: Fix Windows SDK build.David 'Digit' Turner2014-03-111-0/+27
| | | | | | | | | | | | | | | | | | This patch fixes the Windows SDK build. A previous patch apparently broke it even though I could not reproduce this locally before submitting. What it does is, when using the platform build to generate Windows binaries, use the host Linux binary instead of rebuilding the 'emugen' tool from sources. Note that the emulator's standalone build supports building host Linux binaries even when targetting Windows by default. + Add a missing module import that got lost in translation for some odd reason. Change-Id: I2ccd962d8b3df859b2cba82573225820b69b0d32
* emulator/opengl: Allow standalone build.David 'Digit' Turner2014-03-115-30/+121
| | | | | | | | This patch improves the build files for the GPU emulation libraries to allow them to be built directly with the emulator's own standalone build system. Change-Id: I205392bdfe4223a5c43fa67e24a2beffcbcbc07a
* emulator/opengl: Get rid of all compiler warnings (Linux).David 'Digit' Turner2014-01-181-0/+2
| | | | | | | | | | | This patch gets rid of all compiler warnings for the GPU emulation libraries when building on a Linux host. Note that GLcommon/GLutils.h now provides two new functions to perform 'safe' type casts between unsigned integers and pointers: SafePointerFromUInt() and SafeUIntFromPointer(). Change-Id: I01c48bbd72f925d70eb9831f57e15815e687121f
* [MIPS] Add support to handle unaligned accessesBhanu Chetlapalli2012-06-051-6/+7
| | | | | | | | MIPS cannot handle unaligned accesses, so this patch changes the direct assignment of ints/floats to using memcpy Signed-Off-By: Bhanu Chetlapalli <bhanu@mips.com> Change-Id: I82600dece8f48f718f73b49cdf831094bbfdcde5
* Move emulator GLES from development.git to sdk.gitJesse Hall2012-04-1614-0/+2628
| | | | | | | | | | | | | | | The emulator GLES support has two interfaces: a host shared library interface used by QEMU, and a protocol between the platform and the host. The host library interface is not versioned; QEMU and the GLES renderer must match. The protocol on the other hand must be backwards compatible: a new GLES renderer must support an older platform image. Thus for branching purposes it makes more sense to put the GLES renderer in sdk.git, which is branched along with qemu.git for SDK releases. Platform images will be built against the protocol version in the platform branch of sdk.git. Change-Id: I2c3bce627ecfd0a4b3e688d1839fe10755a21e58
* Removing emulator/opengl from the sdk.gitJacky Romano2011-03-1614-2145/+0
| | | | | | This project code is moving to live under development.git/tools/emulator Change-Id: I3f7673bc17681a0ffa14bb0b4d0880977b77f24d
* Emugen : A tool to generate wire protocol codeJacky Romano2011-02-2514-0/+2145
Emugen is a tool that can be used to generate code that deals with marshaling/unmarshaling request to/from a wire-protocol. Its input is an API defintion files and its output is C++ source code for the client (caller) and the server (callee) sides. See README file for more details. Change-Id: I45beea6657fae0887d2b4d92933213ecc20d2525