Andrew Richardson wrote:
>
> Dear All,
> Ive just come over from the DRI devel list. I've been looking at providing
> an SMP dispatch layer to Mesa to provide a means by which even if a client is
> not multithreaded you can still get the whole process running ~2 as fast. I
> have'nt got the concentration to enumerate exactly how it works as ive been
> up ~all~ night coding. :)
> Anyway I need some way to hook a set of dummy functions into mesa so that
> the client thinks the real openGL routine has been called without breaking
> the ABI (that I assume exists in Mesa). I can quite happily using the
> _mesa_<function-name> and _tnl_<function-name> but they don't cover the whole
> API. I need to know where the other functions are.
> If anyone has a better idea of how to hook a set of routines info mesa
> without breaking the ABI I would like to know. I know that you have some sort
> of override layer thing. How does that work? Does it alow me to get my
> routines called without knackering the ABI, but does mesa then call the
> original layer or is that my responibility? If anyone can tell me I would be
> greatful.
You can override any GL entrypoint function by patching into the
API dispatch tables. In the GLcontext struct you'll see:
/* API function pointer tables */
struct _glapi_table *Save; /* Display list save funcs */
struct _glapi_table *Exec; /* Execute funcs */
struct _glapi_table *CurrentDispatch; /* == Save or Exec !! */
If you wanted to override glHint() for example, you'd do something
like
ctx->Exec->Hint = myHintFunction;
Then, you might have:
void myHintFunction(GLenum hint, GLenum value)
{
/* my hint code here */
/* call normal Mesa hint function */
_mesa_Hint(hint, value);
}
-Brian
|