Hello!

There is a VB overflow bug in Mesa. 
It seems to be that it doesn't handles overflows in VB very well.

The following glut program demonstrates it:
This is for FX driver because it has VB_SIZE 72, the X11 driver also should
have this bug, but with other number of triangles.
The last (green) triangle should have been a small one, instead of it it's
first point is replaced with 0,0 by Mesa.
The last triangle's indices in Mesa are:
2,3,4, but 2 contains (0,0) data.

#include <GL/glut.h>

/*
** OpenGL Drawing
*/
static void bugg(void)
{
 int i;
 /* Clear color buffer to yellow */
 glClearColor(1.0f, 1.0f, 0.0f, 1.0f);
 glClear(GL_COLOR_BUFFER_BIT);
 
 /* Play with Mesa VB buffer so that we only left 1 vertice in buffer. */
 
 glBegin(GL_QUADS);
  glColor3f(0.0,0.0,1.0);
  for (i = 0; i < 17; i++)
  {
   glVertex3f(-0.5,-0.25,0.0);
   glVertex3f(-0.5,-0.5,0.0);
   glVertex3f(-0.25,-0.5,0.0);
   glVertex3f(-0.25,-0.25,0.0);
  }
 glEnd();
 
 /* These are drawn correctly... */
 
 glBegin(GL_TRIANGLES);
  glColor3f(1.0,0.0,0.0);
  
  /* Draw Upper half */
  glVertex3f(-0.5,-0.25,0.0);
  glVertex3f(-0.5,-0.5,0.0);
  glVertex3f(-0.25,-0.5,0.0);
  
  
  glColor3f(0.0,0.0,1.0);

  glVertex3f(-0.25,-0.5,0.0);
  glVertex3f(-0.25,-0.25,0.0);
  glVertex3f(-0.5,-0.25,0.0);

  glVertex3f(-0.25,-0.5,0.0);
  glVertex3f(-0.25,-0.25,0.0);
  glVertex3f(-0.5,-0.25,0.0);

  glVertex3f(-0.25,-0.5,0.0);
  glVertex3f(-0.25,-0.25,0.0);
  glVertex3f(-0.5,-0.25,0.0);
 
  glVertex3f(-0.25,-0.5,0.0);
  glVertex3f(-0.25,-0.25,0.0);
  glVertex3f(-0.5,-0.25,0.0);
  
 glEnd();
 
 
 
 /* Sent 15+68=83 vertices */
 
 /* Now full it again!!! */
 glBegin(GL_TRIANGLES);
  glColor3f(0.0,0.0,1.0);
  for (i = 0; i < 20; i++)
  {
   glVertex3f(-0.25,-0.5,0.0);
   glVertex3f(-0.25,-0.25,0.0);
   glVertex3f(-0.5,-0.25,0.0);
  }
  /* This is OK so far, but we have sent 143 total number of vertices...*/
  
  /* But this isn't!!!! */
  glColor3f(0.0,1.0,0.0);
  glVertex3f(0.49,0.5,0.0);
  glVertex3f(0.49,0.49,0.0);
  glVertex3f(0.5,0.49,0.0);
 glEnd();


 /* Ensure completion */
 glFinish();
}


int main(int argc,char **argv)
{
 glutInit(&argc,argv);
 
 glutCreateWindow("Hello!");
 
 glutDisplayFunc(bugg);
 
 
 
 glutMainLoop();
 
 return 0;
}

I don't know the exact source of this bug. I was just able to produce this
program which demonstrates the bug.
I think there should be some things about the flags in overflowed vertices
in IM. Because if I remove the middle four triangle, and draw some more in
the loop, the bug doesn't occurs.

Anybody knowing that part of Mesa, can help me finding the bug?
Or just giving me some pointers where the problem could be?

Miklos.


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

Reply via email to