> > 
> > To follow up, this still happens in 3.2 beta 1. What can I do to help track
> > this down further?
> 
> 
> To disable that one function and use the default C implementation instead,
> I think this would work:
> 
> Modify Mesa/src/X86/x86.c in the gl_init_x86_asm_transforms() function:
> 
> 
> void gl_init_x86_asm_transforms( void )
> {
> #ifdef USE_X86_ASM
>    void *save = gl_transform_tab[0][3][MATRIX_3D_NO_ROT];  /* save C function */
<snip>
> 
>    gl_transform_tab[0][3][MATRIX_3D_NO_ROT] = save;  /* restore C function */
> ...
> ...
> 
> It'll generate a warning, but it should work.

Did that, here's what I get now:

Starting program: /tmp/mesa/junk

Program received signal SIGFPE, Arithmetic exception.
transform_points3_3d_no_rot_raw (to_vec=0x80b4000, mat=0x80b5000, from_vec=0x80b500c,
    mask=0x18 <Error reading address 0x18: Bad address>, flag=4) at xform_tmp.h:680
680              to[i][0] = m0 * ox                      + m12       ;
(gdb) bt
#0  transform_points3_3d_no_rot_raw (to_vec=0x80b4000, mat=0x80b5000, 
from_vec=0x80b500c,
    mask=0x18 <Error reading address 0x18: Bad address>, flag=4) at xform_tmp.h:680
#1  0x2 in ?? ()
#2  0x80b2030 in ?? ()
(gdb) info float
u: status 0x90a8: exceptions: OVERF LOS; flags: 0000; top 2
e: status 0x1000: flags: 0000; top 2
control 0x1260: compute to 53 bits; round NEAREST; mask: LOS;
last instruction: opcode 0x158; pc 0x1f:0x2814e16e; operand 0x2f:0x80b2068
 regno     tag  msb              lsb  value
%st(5)    valid 4005f000000000000000  120
%st(4)    valid 400dffff000000000000  32767.5
%st(3)    valid 4006a000000000000000  160
%st(2)    valid 4005f000000000000000  120
%st(1)    valid 400dffff000000000000  32767.5
%st(0) => valid 4085b074bb8a94000000  3.00224e+40
%st(7)    empty 400dffff000000000000  32767.5
%st(6)    empty 4005f000000000000000  120
(gdb) list
675        (void) flag;
676        ASSERT(mat->type == MATRIX_3D_NO_ROT);
677        STRIDE_LOOP {
678           CLIP_CHECK {
679              const GLfloat ox = from[0], oy = from[1], oz = from[2];
680              to[i][0] = m0 * ox                      + m12       ;
681              to[i][1] =           m5 * oy            + m13       ;
682              to[i][2] =                     m10 * oz + m14       ;
683           }
684        }
(gdb) print to[i][0]
$1 = -0.199290305
(gdb) print m0
$2 = 4.18664068e-34
(gdb) print ox
No symbol "ox" in current context.
(gdb) print m12
$3 = -1.49981213


Is 'ox' a macro, or did it get optimized out?

Attached is a program that will compile cleanly without any of our junk. It
renders to a dummy osmesa buffer that doesn't get used. :) I'm playing on my
home machine which is on FreeBSD 4.0, which has all the FP exceptions
(except for division-by-zero) masked off by default, so I added the
fpsetmask line to make sure they're on. Our development target is on 3.2,
which has them all on.

In our target, if we mask off all exceptions, everything works just fine, so
it's more of an academic pursuit now. :)


-- Kevin




#include <stdlib.h>
#include <GL/gl.h>
#include <GL/osmesa.h>
#include <floatingpoint.h>

int shmid;
unsigned short *gl_memory;
OSMesaContext ctx;

double xang=0.0,yang=0.0,zang=0.0;

void InitalizeOpenGL(unsigned short *gl_memory,OSMesaContext *ctx);

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
int main(int argc,char *argv[])
{
        int c;

        fpsetmask(FP_X_INV | FP_X_OFL | FP_X_UFL | FP_X_DZ | FP_X_DNML);
        
        InitalizeOpenGL(gl_memory,&ctx);

// Setup
        glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
        while(1)
        {
                xang+=2.0;
                if(xang>360.0) xang-=360.0;
                yang+=1.7;
                if(yang>360.0) yang-=360.0;
                zang+=2.2;
                if(zang>360.0) zang-=360.0;

                glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);

                glPushMatrix();
                glTranslatef(0.0,0.0,-8.0);
                glRotated(xang,1.0,0.0,0.0);
                glRotated(yang,0.0,1.0,0.0);
                glRotated(zang,0.0,0.0,1.0);

                glBegin(GL_QUADS);

            glColor3ub(255,0,0);
                glVertex3f(1.0,1.0,1.0);
            glColor3ub(0,255,0);
                glVertex3f(-1.0,1.0,1.0);
            glColor3ub(255,255,0);
                glVertex3f(-1.0,-1.0,1.0);
            glColor3ub(0,0,255);
                glVertex3f(1.0,-1.0,1.0);

            glColor3ub(255,0,0);
                glVertex3f(1.0,1.0,-1.0);
            glColor3ub(0,255,0);
                glVertex3f(-1.0,1.0,-1.0);
            glColor3ub(255,255,0);
                glVertex3f(-1.0,1.0,1.0);
            glColor3ub(0,0,255);
                glVertex3f(1.0,1.0,1.0);

            glColor3ub(255,0,0);
                glVertex3f(1.0,-1.0,-1.0);
            glColor3ub(0,255,0);
                glVertex3f(-1.0,-1.0,-1.0);
            glColor3ub(255,255,0);
                glVertex3f(-1.0,1.0,-1.0);
            glColor3ub(0,0,255);
                glVertex3f(1.0,1.0,-1.0);

            glColor3ub(255,0,0);
                glVertex3f(1.0,-1.0,1.0);
            glColor3ub(0,255,0);
                glVertex3f(-1.0,-1.0,1.0);
            glColor3ub(255,255,0);
                glVertex3f(-1.0,-1.0,-1.0);
            glColor3ub(0,0,255);
                glVertex3f(1.0,-1.0,-1.0);

            glColor3ub(255,0,0);
                glVertex3f(1.0,1.0,-1.0);
            glColor3ub(0,255,0);
                glVertex3f(1.0,1.0,1.0);
            glColor3ub(255,255,0);
                glVertex3f(1.0,-1.0,1.0);
            glColor3ub(0,0,255);
                glVertex3f(1.0,-1.0,-1.0);

            glColor3ub(255,0,0);
                glVertex3f(-1.0,1.0,1.0);
            glColor3ub(0,255,0);
                glVertex3f(-1.0,1.0,-1.0);
            glColor3ub(255,255,0);
                glVertex3f(-1.0,-1.0,-1.0);
            glColor3ub(0,0,255);
                glVertex3f(-1.0,-1.0,1.0);

                glEnd();

                glFlush();

                glPopMatrix();

        }
}

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
void InitalizeOpenGL(unsigned short *gl_memory,OSMesaContext *ctx)
{
        GLfloat h=(GLfloat)320/(GLfloat)240;

    gl_memory=(unsigned short *)malloc(320*240*4);

// Create open gl context
    *ctx=OSMesaCreateContext((GLenum)OSMESA_ARGB,NULL);
    OSMesaMakeCurrent(*ctx,gl_memory,GL_UNSIGNED_BYTE,320,240);

// View settings
        glClearColor(0.5,0.0,1.0,1.0);
        glViewport(0,0,(GLint)320,(GLint)240);
        glMatrixMode(GL_PROJECTION);
        glLoadIdentity();
        glFrustum(-1.0,1.0,-h,h,5.0,500.0);
        glMatrixMode(GL_MODELVIEW);
        glLoadIdentity();

// Culling
        glEnable(GL_DEPTH_TEST);
        glEnable(GL_CULL_FACE);
        glFrontFace(GL_CCW);
        glCullFace(GL_BACK);

}



_______________________________________________
Mesa-bug maillist  -  [EMAIL PROTECTED]
http://lists.mesa3d.org/mailman/listinfo/mesa-bug


_______________________________________________
Mesa-dev maillist  -  [EMAIL PROTECTED]
http://lists.mesa3d.org/mailman/listinfo/mesa-dev

Reply via email to