On Tue, Sep 14, 1999 at 09:42:38AM -0600, Brett Johnson wrote:
[much elided]
> Remember, the indirection has to happen in one form or another,
> somewhere along the OpenGL pipeline. So I don't agree that doing the
> indirection in the libGL is going to be a performance hit. In fact, I
> think it can result in dramatic performance improvements if it's taken
> advantage of by the driver writers.
Not disagreeing with you, but using this as a jumping off point.
There are two different indirections going on here. One is from the
app to get to the proper per-context driver entry point (case addressed
by gl?GetProcAddress), the second within a specific driver, to dispatch
depending on the current GL state to routines which execute, compile
into dlists, compile and execute, etc. (case addressed by your
observations above). The second layer of dispatch can't be pulled up to
application visibility and it's questionable how much exposure it could
have to libGL in the case where libGL and the driver come from different
sources.
Here's my notional mental model of what dispatching must happen in
two scenarios, leaving out the scenario where libGL.so synthesizes its
own context-dependent indirection for dynamically obtained entry points,
via something like the strawman code you proposed later in your mail:
// Scenario for an entry point in libGL.so
glFoo() // app makes call
-> calls libGL.so:glFoo
-> (*dispatch[context].glFoo)() // jump table based on context
-> calls libDriver.so:__glFoo_driver_dispatch
-> (*dispatch[state].glFoo)() // jump table based on GL state
-> calls __glFoo_driver_MODE() // actually execute glFoo!
// Scenario for an entry point not in libGL.so, in the case
// where glGetProcAddress() returns context-dependent pointers
glFooPtr = glGetProcAddress("glFoo")
-> calls libDriver.so:glGetProcAddress("glFoo")
-> returns pointer to libDriver.so:__glFoo_driver_dispatch
(*glFooPtr)() // app makes call
-> libDriver.so:__glFoo_driver_dispatch()
-> (*dispatch[state].glFoo)() // jump table based on GL state
-> calls __glFoo_driver_MODE() // actually execute glFoo!
Jon Leech
SGI