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