Re: [AD] Alleg5 - new driver structure idea

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Hein Zelle wrote:


- how will allegro know which function to call? Does it have to do a
 string lookup on the driver ID to find the graphics functions, and
 then a string lookup to find the 'blit' function, for example? I
 assume not, but I don't see how that would work with the indicated
 structure. Do you want to have fixed array indices to access a
 certain driver / function pair?


No, not at all. What's going to happen is that install_graphics() will then read through the list of all registered drivers, and look for those that have a driver type of "gfx". One it finds them, it will then convert them to an AL_GRAPHICS_DRIVER_VTABLE, which is internal to Allegro, and is free to change in between versions of Allegro. Allegro can then call AL_GRAPHICS_DRIVER_VTABLE->blit() or whatever.

The string conversion is done only once.



- how bad is the 'internal bloat' compared to what we currently have?


Well, we'd need an extra file (drivers.c), and virtually all of Allegro will link to it. It also means that we'll have a lot of string tables in Allegro so that the, for example, the graphics driver can recognize the blit() function.

There is also the issue of supporting older interfaces. What if we add a parameter to blit() for example? We can make a "blit2" entry in the driver, but then we also need to support the old "blit" interface.

Finally, I'm not really sure how it'll work for the DOS port, where people keep complaining about large executable sizes. Will this system really allow us the user to pick and chose the drivers he wants linked in, without the #define trickery that was needed before? Or will this (somehow) force all of Allegro to be linked in all the time?




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/