make directory name inline with other tests
[AROS.git] / workbench / libs / mesa / src / aros / AROS_readme.txt
blobc55e8f5953ceec2a54dfeca6a490c6adfa821cb6
1 1. Solution for global context
3 Mesa uses a global variable to store current rendering context. This
4 leads to a problem when Mesa is a shared library as this context should
5 be different for each task which uses Mesa.
7 The implemented solution uses a simple TLS implementation inside Mesa library
8 to store the context in a "per task" way. The TLS implementation can be found 
9 in aros/tls.[ch]
11 The public gl/egl functions are exported from library using call wrapper which
12 have the proper "library" definitions (for example contains library base).
14 For each glXXX public function a stub is generated in arosmesa_library_api.c. 
15 This stub takes a form of AROS library function which gets the Mesa libbase
16 passed as the last parameter. 
18 Once this stub is called, it calls the real glXXX function - which due
19 to name mangling is now named mglXXX. The real function reads the Mesa 'global' 
20 rendering context via GET_CURRENT_CONTEXT macro which is redefined in glapi.h.
21 Code behind this macro eventually calls the TLS to get "per task" context (see
22 mapi/mapi/u_current.c)
24 The call sequence is as follows:
26 Client calls glA() functions. This is a stub in linklib.
27 The glA() function calls Mesa_glA() functions. This is a shared function in 
28 mesa.library. The Mesa_glA() function calls mglA() function.
30 2. AROSMesaGetProcAddress
32 This function can return a pointer to gl function by specifying name as
33 string. This function is compiled direclty into the mesa shared library
34 linklib and not found in the shared library itself. This is due to a fact
35 that the returned pointer must point to a stub gl function not its
36 implementation in shared library, because in the later case, the Mesa 
37 libbase would not be filled correclty. Using the example above, calling
39 AROSMesaGetProcAddress("glA") must return the pointer to glA, and not
40 to Mesa_glA or mglA function.