Re: [AD] android_set_current_display

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


On Mon Nov 5, 2012, Elias Pschernig wrote:
> On Mon, Nov 5, 2012 at 9:35 AM, Jon Rafkind <workmin@xxxxxxxxxx> wrote:
> > There is a bug in android_set_current_display where the new display will
> > never be set properly. The short story is that it first checks if
> > al_get_current_display() == dpy, where dpy is the argument to the
> > function, and if they are equal then the function aborts (presumably to
> > save time). But these two things will always be equal.
> > 
> > With this client code:
> >   ALLEGRO_BITMAP * old = al_get_target_bitmap();
> >   al_set_target_bitmap(NULL);
> >   al_set_target_bitmap(old);
> > 
> > The old->display will be the current active display. Setting the target
> > to NULL will unset the current display. Then setting the target back to
> > old will try to reset the display to old->display.
> > 
> > The logic Allegro follows is
> > 
> > al_set_target_bitmap(old)
> > // tls.c: al_set_target_bitmap
> > ...
> > if (old_display != new_display){
> > 
> >    ...
> >    tls->current_display = new_display;
> >    new_display->vt->set_current_display(new_display)
> >    
> >    // android/android_display.c:android_set_current_display
> >    if (al_get_current_display() == dpy) return true;
> > 
> > Where al_get_current_display() is
> > 
> > // tls.c:al_get_current_display
> > 
> >  return tls->current_display;
> > 
> > So al_get_current_display() will always be equal to the dpy parameter to
> > android_set_current_display. By simply commenting out the check in
> > android_set_current_display() and letting it always set the display
> > (with make_current) my application works as expected. I guess I should
> > mention that this bug eventually causes all opengl calls to fail because
> > there is no context for them.
> 
> Other ports have no such check - so why does the Android port have it?

2 possibilities, the tls function was changed after the fact, or potentially 
more likely, I was in my "CHECK ALL THE INPUTS" mode, when it wasn't wanted or 
desired. (or for that matter, correct)

> ---------------------------------------------------------------------------
> --- LogMeIn Central: Instant, anywhere, Remote PC access and management.
> Stay in control, update software, and manage PCs from one command center
> Diagnose problems and improve visibility into emerging IT issues
> Automate, monitor and manage. Do more in less time with Central
> http://p.sf.net/sfu/logmein12331_d2d


-- 
Thomas Fjellstrom
tfjellstrom@xxxxxxxxxx




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