X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=docs%2Fdispatch.html;h=34ab44dd915730d846c677fd9acacf3b1d770669;hb=fa5a36dbd474fb3c755da51553c6ca18dab76a06;hp=1e6377ad818d4fa37e1b4128c699c18eeae1b98e;hpb=9f37c9903b87f86a533bfaffa72f0ecb285b02b2;p=mesa.git diff --git a/docs/dispatch.html b/docs/dispatch.html index 1e6377ad818..34ab44dd915 100644 --- a/docs/dispatch.html +++ b/docs/dispatch.html @@ -77,17 +77,17 @@ table.

This can be implemented in just a few lines of C code. The file src/mesa/glapi/glapitemp.h contains code very similar to this.

-
- - -
+
+
 void glVertex3f(GLfloat x, GLfloat y, GLfloat z)
 {
     const struct _glapi_table * const dispatch = GET_DISPATCH();
 
     (*dispatch->Vertex3f)(x, y, z);
-}
Sample dispatch function
-
+} + +
Sample dispatch function
+

The problem with this simple implementation is the large amount of overhead that it adds to every GL function call.

@@ -129,15 +129,14 @@ The resulting implementation of GET_DISPATCH is slightly more complex, but it avoids the expensive pthread_getspecific call in the common case.

-
- - -
+
+
 #define GET_DISPATCH() \
     (_glapi_Dispatch != NULL) \
         ? _glapi_Dispatch : pthread_getspecific(&_glapi_Dispatch_key)
-
Improved GET_DISPATCH Implementation
-
+ +
Improved GET_DISPATCH Implementation
+

3.2. ELF TLS

@@ -154,16 +153,15 @@ direct rendering drivers that use either interface. Once the pointer is properly declared, GET_DISPACH becomes a simple variable reference.

-
- - -
+
+
 extern __thread struct _glapi_table *_glapi_tls_Dispatch
     __attribute__((tls_model("initial-exec")));
 
 #define GET_DISPATCH() _glapi_tls_Dispatch
-
TLS GET_DISPATCH Implementation
-
+ +
TLS GET_DISPATCH Implementation
+

Use of this path is controlled by the preprocessor define USE_ELF_TLS. Any platform capable of using ELF TLS should use this @@ -215,13 +213,12 @@ of the assembly source file different implementations of the macro are selected based on the defined preprocessor variables. The assembly code then consists of a series of invocations of the macros such as: -

- - -
+
+
 GL_STUB(Color3fv, _gloffset_Color3fv)
-
SPARC Assembly Implementation of glColor3fv
-
+ +
SPARC Assembly Implementation of glColor3fv
+

The benefit of this technique is that changes to the calling pattern (i.e., addition of a new dispatch table pointer access method) require fewer @@ -271,8 +268,6 @@ dispatch stub.

src/mesa/glapi/glapi.c just before glprocs.h is included.

-

4. Automatic Generation of Dispatch Stubs

-