Re: [AD] shaders + ttf

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


On Thu, 07 Mar 2013 09:53:03 -0700, Jon Rafkind <workmin@xxxxxxxxxx> wrote:
> On 03/07/2013 05:26 AM, Peter Wang wrote:
> > On Thu, 07 Mar 2013 03:25:10 -0500, SiegeLord <slabode@xxxxxxxxxx> wrote:
> >> On 03/07/2013 03:16 AM, SiegeLord wrote:
> >>> On 03/07/2013 03:10 AM, Jon Rafkind wrote:
> >>>> There seems to be an issue using the programmable pipeline and the ttf addon. Fonts sometimes don't draw, specifically when they are drawn to FBO's. Adding the following line to ttf.c:172 makes it work again, but I am unsure why. One possible reason is the upload of the page bitmap requires a shader, but Siegelord seems to suggest that isn't the case.
> >>>>
> >>>> push_new_page:
> >>>>      ...
> >>>>      page = al_create_bitmap(256, 256);
> >>>> + page->shader = al_get_target_bitmap()->shader;
> >>>>
> >>>> I'll try to make a test case showing the broken behavior.
> >>> Here's a testcase:
> >>> It draws the pixel via that locking code (note how it functions without
> >>> the shader), but the actual text doesn't draw. Jon's change makes the
> >>> text draw but it's not clear why.
> > It effectively calls al_use_shader() on the new page bitmap.
> 
> Yes but the question is why does that matter. The only place that
> seems like the shader might have an effect is on upload (after
> unlocking the bitmap). Is that the case?

My guess is because in programmable pipeline mode much of the code
requires the display->ogl_extras->program_object to be non-zero.
I didn't understand why before, but it turns out using glUseProgram(0)
to get fixed functionality mode is undefined behaviour.  So the Allegro
code did NOT fallback to the non-programmable-pipeline path when
program_object==0 (except where I wrongly made the change).

When a display is created with USE_PROGRAMMABLE_PIPELINE, I think
Allegro needs to create an OpenGL program for use when no ALLEGRO_SHADER
is in effect.

> Anyway I think the proper solution is for the ttf addon to keep its
> own default shader around to attach to the page bitmap (getting it
> from the current target is a hack).

I think that any solution should be such that shader-unaware code can
work continue to work in either programmable pipeline mode or not.

Peter




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