Re: [AD] clipping line algorithm |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
Sven Sandberg wrote:
I understand it's uglier to not use the vtable, but a bit of profiling
indicates that it really speeds things up. The following are the cases I
tested.
My basic question is: should we allow the user to bypass the vtable? If
not, then it doesn't matter, because all the Allegro API functions
should route to some bitmap's vtable.
In your example, Allegro's parallelogram_map() sprite would never get
called for an AllegroGL bitmap, since the call to rotate_sprite() would
get forwarded to AGL's handler.
However, if users are allowed to bypass the vtable, then things start to
get really messy.
[snip]
Method (1) was surprisingly a bit faster than method (2); however,
method (3) was (in color depths 8, 15, 16, 24, and 32, respectively)
about 8, 7, 7, 3.4, and 3.8 times faster than any of the other ones.
As it should. But in this example, it doesn't matter because
parallelogram_map() is only called from vtables that Allegro knows about
(ie: that of Allegro bitmaps). AllegroGL will never see, nor care about,
parallelogram_map().
Although bypassing the vtable is a little bit ugly, is there any
particular situation where it is really significantly bad? As long as we
have a version that uses the vtable, and BITMAP->id is able to indicate
when the optimized version can be used instead, I think we should be fine?
I like the idea, if only because people could check the ID before using
bmp_read/write on a bitmap. This isn't something that Allegro needs to
worry about internally though.
Frankly, I'm more open to a caps flag of some sort, which would indicate
what the bitmap is capable of (or not).
--
- Robert Jr Ohannessian
http://bob.allegronetwork.com/