Re: [AD] shader conveniences

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


I just ran into an issue what you say should fix. tls.c:394 is an invalid read with valgrind if you destroy your shaders then exit.

Trent

On 2013-03-06, at 2:30 PM, Peter Wang <novalazy@xxxxxxxxxx> wrote:

> [moving to ad]
> 
> On Wed, 06 Mar 2013 11:42:00 -0700, Jon Rafkind <workmin@xxxxxxxxxx> wrote:
>> Also I had to add a line to src/bitmap.c that copied the parent's shader to the sub-bitmap in al_create_sub_bitmap
>> 
>> bitmap->shader = parent->shader;
>> 
>> Anyway, after implementing my idea below some graphics still don't show up. I guess the default shader is still not being set in some circumstances. Also its a little yucky to set a shader. I have to copy the old target, set the new target, set the shader, then set the old target back.
>> 
>> if (al_get_bitmap_flags(bitmap) & ALLEGRO_VIDEO_BITMAP){
>>      ALLEGRO_BITMAP * old = al_get_target_bitmap();
>>      al_set_target_bitmap(bitmap);
>>      al_use_shader(shader_default);
>>      al_set_target_bitmap(old);
>> }
>> 
>> Could there be a al_use_shader_for_bitmap(ALLEGRO_BITMAP*, ALLEGRO_SHADER*) ?
>> 
> 
> I agree that's annoying.
> 
> I think some more conveniences are in order:
> 
> - a bitmap should by default act the same in programmable pipeline mode
>  or not, so I guess that means new bitmaps should use a default shader.
>  Would this solve the issue above in most cases?
> 
> - shaders should be destroyed automatically by the destructor system.
> 
> - shaders should implicitly be unused by any bitmaps when the shader is
>  destroyed. Otherwise your program will explode if you later target
>  one of those bitmaps.
> 
> Peter
> 
> ------------------------------------------------------------------------------
> Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester  
> Wave(TM): Endpoint Security, Q1 2013 and "remains a good choice" in the  
> endpoint security space. For insight on selecting the right partner to 
> tackle endpoint security challenges, access the full report. 
> http://p.sf.net/sfu/symantec-dev2dev
> -- 
> https://lists.sourceforge.net/lists/listinfo/alleg-developers





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