Chia-I Wu | d8299af | 2010-01-11 18:25:03 +0800 | [diff] [blame] | 1 | <html> |
| 2 | |
| 3 | <title>OpenGL ES State Trackers</title> |
| 4 | |
| 5 | <head><link rel="stylesheet" type="text/css" href="mesa.css"></head> |
| 6 | |
| 7 | <body> |
| 8 | |
| 9 | <h1>OpenGL ES State Trackers</h1> |
| 10 | |
| 11 | <p>The current version of the OpenGL ES state trackers implement OpenGL ES 1.1 and OpenGL ES 2.0. |
| 12 | More informations about OpenGL ES can be found at |
Brian Paul | aeff9f9 | 2010-01-21 08:13:32 -0700 | [diff] [blame] | 13 | <a href="http://www.khronos.org/opengles/" target="_parent"> |
| 14 | http://www.khronos.org/opengles/</a>.</p> |
Chia-I Wu | d8299af | 2010-01-11 18:25:03 +0800 | [diff] [blame] | 15 | |
| 16 | <p>The OpenGL ES state trackers depends on the Gallium architecture and a |
Chia-I Wu | 1af6719 | 2010-01-21 15:29:28 +0800 | [diff] [blame] | 17 | working EGL implementation. Please refer to <a href="egl.html">Mesa EGL</a> |
| 18 | for more information about EGL.</p> |
Chia-I Wu | d8299af | 2010-01-11 18:25:03 +0800 | [diff] [blame] | 19 | |
| 20 | |
| 21 | <h2>Build the Libraries</h2> |
| 22 | <ol> |
Chia-I Wu | 3c967a9 | 2010-01-22 16:31:43 +0800 | [diff] [blame] | 23 | <li>Run <code>configure</code> with <code>--with-state-trackers=egl,es</code> and enable the Gallium driver for your hardware.</li> |
Chia-I Wu | d8299af | 2010-01-11 18:25:03 +0800 | [diff] [blame] | 24 | <li>Build and install Mesa as usual.</li> |
| 25 | </ol> |
| 26 | |
| 27 | <p>It will install libGLESv1_CM, libGLESv2, libEGL, and one or more EGL drivers for your hardware.</p> |
| 28 | <h2>Run the Demos</h2> |
| 29 | |
| 30 | <p>There are some demos in <code>progs/es1/</code> and <code>progs/es2/</code>. You can use them to test your build. For example,</p> |
| 31 | |
| 32 | <pre> |
Chia-I Wu | d8299af | 2010-01-11 18:25:03 +0800 | [diff] [blame] | 33 | $ cd progs/es1/xegl |
| 34 | $ make |
| 35 | $ ./torus |
| 36 | </pre> |
| 37 | |
| 38 | <h2>Developers</h2> |
| 39 | |
| 40 | <p>The core of OpenGL ES state trackers is the ES overlay. It is located in |
| 41 | <code>src/mesa/es/</code>.</p> |
| 42 | |
| 43 | <h3>Structure</h3> |
| 44 | |
| 45 | <p>The ES overlay uses as much code as possible from Mesa. It has its own glapi XMLs to describe the APIs of OpenGL ES. The ES overlay can be built parallelly with Mesa, and they will give</p> |
| 46 | |
| 47 | <table border="1"> |
| 48 | <tr><td>Library Name</td><td>Usage</td><td>Source</td></tr> |
| 49 | <tr><td>libmesagallium.a</td><td>OpenGL state tracker</td><td>Mesa</td></tr> |
| 50 | <tr><td>libes1gallium.a</td><td>OpenGL ES 1.x state tracker</td><td>ES overlay</td></tr> |
| 51 | <tr><td>libes2gallium.a</td><td>OpenGL ES 2.x state tracker</td><td>ES overlay</td></tr> |
| 52 | <tr><td>libglapi.a</td><td>OpenGL API</td><td>Mesa</td></tr> |
| 53 | <tr><td>libes1api.a</td><td>OpenGL ES 1.x API</td><td>ES overlay</td></tr> |
| 54 | <tr><td>libes2api.a</td><td>OpenGL ES 2.x API</td><td>ES overlay</td></tr> |
| 55 | </table> |
| 56 | |
| 57 | <p>The OpenGL ES state trackers and APIs are then used by <code>src/gallium/state_trackers/es/</code> to create the final libraries.</p> |
| 58 | |
| 59 | <h3>Dispatch Table</h3> |
| 60 | |
| 61 | <p>The ES overlay uses an additional indirection when dispatching fucntions</p> |
| 62 | |
| 63 | <pre> |
| 64 | Mesa: glFoo() --> _mesa_Foo() |
| 65 | ES overlay: glFoo() --> _es_Foo() --> _mesa_Foo() |
| 66 | </pre> |
| 67 | |
| 68 | <p>The indirection serves several purposes</p> |
| 69 | |
| 70 | <ul> |
| 71 | <li>When a function is in Mesa and the type matches, it checks the arguments and calls the Mesa function.</li> |
| 72 | <li>When a function is in Mesa but the type mismatches, it checks and converts the arguments before calling the Mesa function.</li> |
| 73 | <li>When a function is not available in Mesa, or accepts arguments that are not available in OpenGL, it provides its own implementation.</li> |
| 74 | </ul> |
| 75 | |
| 76 | <p>Other than the last case, the ES overlay uses <code>APIspec.xml</code> to generate functions to check and/or converts the arguments.</p> |
| 77 | |
| 78 | </body> |
| 79 | </html> |