Re: [AD] bitmaps and displays

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


Peter Hull wrote:
When you create a new context in OS X, you can specify an existing
context that you want it to share with. Then, internally, it
reference-counts the resources and deletes them when the last context
is deleted.

Great. The same is in GLX.

It's not clear to me (it's not in the docs AFAICS) what the rules are
for when you can and can't share (for example, can 2 contexts with
different colour depths share?) We'd have to allow for there being
groups of mutually incompatible sets of displays.

That's not a problem really. If contexts cannot be shared for whatever reason glxCreateContext() will fail (we call it again without sharing and it succeeds). If it fails then the BITMAP will be listed only in the vector of that DISPLAY. Other DISPLAYs will return false when such BITMAP is passed to is_compatible_bitmap() and bitmap locking will be used do draw it to incompatible DISPLAYs.

So the implementation of is_compatible_bitmap() in pseudcode is:
if (vector_contains(&display->bitmaps, bitmap) {
   return true;
}
else {
   return false;
}


The problem happens when such display is destroyed. I think it would be the best to convert its bitmaps to memory bitmaps so that they can still be drawn to other DISPLAYs. Anyone sees any problem with this?


--
Milan Mimica
http://sparklet.sf.net




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