1 This directory contains the modules related to hardware OpenGL ES emulation. 2 3 I. Overview of components: 4 ========================== 5 6 The 'emugen' tool is used to generate several source files related to the 7 EGL/GLES command stream used between the guest and the host during emulation. 8 9 host/tools/emugen -> emugen program 10 11 Note that emugen is capable of generating, from a single set of specification 12 files, three types of auto-generated sources: 13 14 - sources to encode commands into a byte stream. 15 - sources to decode the byte stream into commands. 16 - sources to wrap normal procedural EGL/GLES calls into context-aware ones. 17 18 Modules under the system/ directory corresponds to code that runs on the 19 guest, and implement the marshalling of EGL/GLES commands into a stream of 20 bytes sent to the host through a fast pipe mechanism. 21 22 system/GLESv1_enc -> encoder for GLES 1.1 commands 23 system/GLESv2_enc -> encoder for GLES 2.0 commands 24 system/renderControl_enc -> encoder for rendering control commands 25 system/egl -> emulator-specific guest EGL library 26 system/GLESv1 -> emulator-specific guest GLES 1.1 library 27 system/gralloc -> emulator-specific gralloc module 28 system/OpenglSystemCommon -> library of common routines 29 30 Modules under the host/ directory corresponds to code that runs on the 31 host, and implement the decoding of the command stream, translation of 32 EGL/GLES commands into desktop GL 2.0 ones, and rendering to an off-screen 33 buffer. 34 35 host/libs/GLESv1_dec -> decoder for GLES 1.1 commands 36 host/libs/GLESv2_dec -> decoder for GLES 2.0 commands 37 host/libs/renderControl_dec -> decoder for rendering control commands 38 39 host/libs/Translator/EGL -> translator for EGL commands 40 host/libs/Translator/GLES_CM -> translator for GLES 1.1 commands 41 host/libs/Translator/GLES_V2 -> translator for GLES 2.0 commands 42 host/libs/Translator/GLcommon -> library of common translation routines 43 44 host/libs/libOpenglRender -> rendering library (uses all host libs above) 45 can be used by the 'renderer' program below, 46 or directly linked into the emulator UI program. 47 48 host/renderer/ -> stand-alone renderer program executable. 49 this can run in head-less mode and receive requests from 50 several emulators at the same time. It is the receiving 51 end of all command streams. 52 53 Modules under the test/ directory correspond to test programs that are useful 54 to debug the various modules described above: 55 56 tests/EGL_host_wrapper -> a small library used to dynamically load the 57 desktop libEGL.so or a replacement named by the 58 ANDROID_EGL_LIB environment variable. This lib 59 provides all EGL entry points. 60 61 tests/emulator_test_renderer -> a small program to run the rendering library 62 in a single SDL window on the host desktop. 63 64 tests/gles_android_wrapper -> guest EGL / GLES libraries that are run on 65 the device to run some tests. Replace the 66 system/egl and system/GLESv1 modules for now. 67 68 tests/translator_tests/GLES_CM -> desktop GLESv1 translation unit test 69 tests/translator_tests/GLES_V2 -> desktop GLESv2 translation unit test 70 tests/translator_tests/MacCommon -> used by translation tests on Mac only. 71 72 tests/ut_rendercontrol_enc -> guest library used by tests/ut_renderer 73 tests/ut_rendercontrol_dec -> host library used by tests/ut_renderer 74 tests/ut_renderer -> unit-test for render control and rendering library. 75 76 77 II. Build system considerations: 78 -------------------------------- 79 80 The dependencies on the more than 20 components described in the previous 81 section are pretty sophisticated, involving lots of auto-generated code and 82 non-trivial placement for guest/device libraries. 83 84 To simplify the development and maintenance of these modules, a set of 85 helper GNU Make function is defined in common.mk, and included from the 86 Android.mk in this directory. 87 88 These functions all begin with the "emugl-" prefix, and can be used to 89 declare modules, what information they export to other modules, or import 90 from them, and also what kind of auto-generated sources they depend on. 91 92 Look at the comments inside common.mk and the Android.mk of the modules 93 to better understand what's happening. 94 95