Re: [AD] DGA 2.0 driver completed

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


From: Angelo Mottola <a.mottola@xxxxxxxxxx>
Sent: Monday, September 25, 2000 10:24 AM


> PS: while testing the Allegro example programs with my new driver, I found
the
> only one which crashes is ex3d; anyway I've discovered this example also
crashes
> with the Xwindows driver, so the problem is not with my code. It always
crashes
> if you select 8bit color, and when the cubes drawing mode is changed to
> POLYTYPE_GRGB. If you start the example with hicolor depth, all drawing
modes
> run fine, but the program gives a segmentation fault once you exit it. I
may be
> wrong, but I guess the problem is with the new polygon routines added to
Allegro
> recently, as this example always worked for me with old lib versions...

You're right ! I'm guilty : I noticed this bug a long time ago but I didn't
realized it occured when the drawing mode was changed to POLYTYPE_GRGB ; I
thought it was a random bug (under DJGPP ex3d behaviour - a segmentation
fault when exiting - was the same whether the colordepth was 8 bits or
higher). Moreover none of my own test programs crashed at all although they
use the GRGB mode.

Your mail has helped me a lot since it pointed out the GRGB case to be
blamed. For the GRGB mode, the only difference between my routines and the
old ones was the get[rgb]_depth(..) call : I did not understand why a call
to 'bitmap_color_depth(bmp)' was made each time a 'get[rgb]_depth(..)' was
called. So, I created a variable 'coldepth' which was set to
bitmap_color_depth(bmp). Then I replaced each occurence of
bitmap_color_depth(bmp) by 'coldepth'. It seems it was not a good idea at
all

So here is a small patch which set the get[rgb]_depth calls the way they
were in the old version.

Note : I can't test this patch under Linux (I can't have it yet cause my HD
is full, I hope I will get it soon). So if ex3d keeps not working under
Linux tell me, and if it works fine tell me too :-)

I'm sorry... I'm a very bad boy...
Bertrand.

BTW can anyone can explain me why

    r=getr_depth(bitmap_color_depth(bmp), c);
    g=getg_depth(bitmap_color_depth(bmp), c);
    b=getb_depth(bitmap_color_depth(bmp), c);

works fine while

    int coldepth = bitmap_color_depth(bmp);
    r=getr_depth(coldepth, c);
    g=getg_depth(coldepth, c);
    b=getb_depth(coldepth, c);

gives a segmentation fault ????


Attachment: grgbbug.diff
Description: Binary data



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