[AD] bug in polygon3d()

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


Hello,

I sent a bug report some time ago about quad3d + POLYTYPE_PTEX_LIT
crashing with Watcom. Nobody answered (not surprising, given the
combination of strange platform and difficult function). Well, today I
debugged it and I'm almost certain that the problem is in the macro
DO_PTEX() in i386/iscan.s. I can't debug further because I don't know
assembler well enough, but there's pretty good evidence that the problem
is in DO_PTEX(): I tested all POLYTYPE_* in all color depths, and it
crashed exactly on the types that use DO_PTEX() (namely POLYTYPE_PTEX,
POLYTYPE_PTEX_LIT and POLYTYPE_PTEX_MASK in 8 bpp). And the crash goes
away if I comment out the call to the scanline drawer from
draw_polygon_segment() in poly3d.c.

The crash is usually a bit strange: it hangs in the middle of writing
the traceback for the crash, just after it has written "Shutting down
Allegro". Maybe this suggests something wrong with the stack? I don't
know. Also, this particular polygon has only one scanline and its width
is 1. (At the time draw_polygon_segment() calls drawer(), dx=183 and
y=111.)

I'm using watcom 10.6, today's cvs, windows 95, on a Pentium 133. It
would be good if an expert took a look at it, because I don't know what
to do.

The program that crashes is:

---- begin test.c ----
   #include <allegro.h>
   int main(int argc, char *argv[])
   {
      V3D vtx1, vtx2, vtx3, vtx4;
      BITMAP *bmp, *texture;

      allegro_init();
      set_gfx_mode(GFX_AUTODETECT, 320, 200, 0, 0);
      bmp = create_bitmap(320, 200);
      texture = create_bitmap(32, 32);

      vtx1.x=11726240; vtx1.y=7579000; vtx1.z=61833760;
      vtx1.u=0; vtx1.v=0; vtx1.c=19;
      vtx2.x=12037280; vtx2.y=7223700; vtx2.z=63607072;
      vtx2.u=2097152; vtx2.v=0; vtx2.c=13;
      vtx3.x=11911200; vtx3.y=7372800; vtx3.z=67331232;
      vtx3.u=2097152; vtx3.v=2097152; vtx3.c=0;
      vtx4.x=11614400; vtx4.y=7711900; vtx4.z=65557920;
      vtx4.u=0; vtx4.v=2097152; vtx4.c=5;

      quad3d(bmp, POLYTYPE_PTEX, texture, &vtx1, &vtx2, &vtx3, &vtx4);
	
      return 0;
   }
   END_OF_MAIN()
---- end test.c ----

(this is a special case of ex3d)

-- 
Sven Sandberg    svsa1977@xxxxxxxxxx    home.student.uu.se/svsa1977



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