Beispiel #1
0
void mga_emit_contiguous_verts( GLcontext *ctx,
				 GLuint start,
				 GLuint count )
{
   mgaContextPtr mmesa = MGA_CONTEXT(ctx);
   GLuint vertex_size = mmesa->vertex_size * 4;
   GLuint *dest = mgaAllocDmaLow( mmesa, (count-start) * vertex_size);
   setup_tab[mmesa->SetupIndex].emit( ctx, start, count, dest, vertex_size );
}
Beispiel #2
0
static __inline__ void mga_draw_point( mgaContextPtr mmesa,
					mgaVertexPtr tmp )
{
   const GLfloat sz = 0.5 * CLAMP(mmesa->glCtx->Point.Size,
                                  mmesa->glCtx->Const.MinPointSize,
                                  mmesa->glCtx->Const.MaxPointSize);
   const int vertex_size = mmesa->vertex_size;
   GLuint *vb = mgaAllocDmaLow( mmesa, 6 * 4 * vertex_size );
   int j;
   
#if 0
   v0->v.x += PNT_X_OFFSET - TRI_X_OFFSET;
   v0->v.y += PNT_Y_OFFSET - TRI_Y_OFFSET;
#endif

   /* Draw a point as two triangles.
    */
   *(float *)&vb[0] = tmp->v.x - sz;
   *(float *)&vb[1] = tmp->v.y - sz;
   for (j = 2 ; j < vertex_size ; j++) 
      vb[j] = tmp->ui[j];
   vb += vertex_size;

   *(float *)&vb[0] = tmp->v.x + sz;
   *(float *)&vb[1] = tmp->v.y - sz;
   for (j = 2 ; j < vertex_size ; j++) 
      vb[j] = tmp->ui[j];
   vb += vertex_size;

   *(float *)&vb[0] = tmp->v.x + sz;
   *(float *)&vb[1] = tmp->v.y + sz;
   for (j = 2 ; j < vertex_size ; j++) 
      vb[j] = tmp->ui[j];
   vb += vertex_size;

   *(float *)&vb[0] = tmp->v.x + sz;
   *(float *)&vb[1] = tmp->v.y + sz;
   for (j = 2 ; j < vertex_size ; j++) 
      vb[j] = tmp->ui[j];
   vb += vertex_size;

   *(float *)&vb[0] = tmp->v.x - sz;
   *(float *)&vb[1] = tmp->v.y + sz;
   for (j = 2 ; j < vertex_size ; j++) 
      vb[j] = tmp->ui[j];
   vb += vertex_size;

   *(float *)&vb[0] = tmp->v.x - sz;
   *(float *)&vb[1] = tmp->v.y - sz;
   for (j = 2 ; j < vertex_size ; j++) 
      vb[j] = tmp->ui[j];

#if 0
   v0->v.x -= PNT_X_OFFSET - TRI_X_OFFSET;
   v0->v.y -= PNT_Y_OFFSET - TRI_Y_OFFSET;
#endif
}
Beispiel #3
0
static void __inline__ mga_draw_triangle( mgaContextPtr mmesa,
					   mgaVertexPtr v0,
					   mgaVertexPtr v1,
					   mgaVertexPtr v2 )
{
   GLuint vertex_size = mmesa->vertex_size;
   GLuint *vb = mgaAllocDmaLow( mmesa, 3 * 4 * vertex_size );
   int j;

   EMIT_VERT( j, vb, vertex_size, v0 );
   EMIT_VERT( j, vb, vertex_size, v1 );
   EMIT_VERT( j, vb, vertex_size, v2 );
}
Beispiel #4
0
static void mgaFastRenderClippedPoly( GLcontext *ctx, const GLuint *elts, 
				       GLuint n )
{
   mgaContextPtr mmesa = MGA_CONTEXT( ctx );
   GLuint vertex_size = mmesa->vertex_size;
   GLuint *vb = mgaAllocDmaLow( mmesa, (n-2) * 3 * 4 * vertex_size );
   GLubyte *vertptr = (GLubyte *)mmesa->verts;			
   const GLuint *start = (const GLuint *)VERT(elts[0]);
   int i,j;

   for (i = 2 ; i < n ; i++) {
      EMIT_VERT( j, vb, vertex_size, (mgaVertexPtr) VERT(elts[i-1]) );
      EMIT_VERT( j, vb, vertex_size, (mgaVertexPtr) VERT(elts[i]) );
      EMIT_VERT( j, vb, vertex_size, (mgaVertexPtr) start );
   }
}
Beispiel #5
0
static void INLINE mga_draw_quad( mgaContextPtr mmesa,
				       mgaVertexPtr v0,
				       mgaVertexPtr v1,
				       mgaVertexPtr v2,
				       mgaVertexPtr v3 )
{
   GLuint vertex_size = mmesa->vertex_size;
   GLuint *vb = mgaAllocDmaLow( mmesa, 6 * 4 * vertex_size );
   int j;

   EMIT_VERT( j, vb, vertex_size, v0 );
   EMIT_VERT( j, vb, vertex_size, v1 );
   EMIT_VERT( j, vb, vertex_size, v3 );
   EMIT_VERT( j, vb, vertex_size, v1 );
   EMIT_VERT( j, vb, vertex_size, v2 );
   EMIT_VERT( j, vb, vertex_size, v3 );
}
Beispiel #6
0
static __inline__ void mga_draw_line( mgaContextPtr mmesa,
				      mgaVertexPtr v0,
				      mgaVertexPtr v1 )
{
   GLuint vertex_size = mmesa->vertex_size;
   GLuint *vb = mgaAllocDmaLow( mmesa, 6 * 4 * vertex_size );
   GLfloat dx, dy, ix, iy;
   GLfloat width = mmesa->glCtx->Line._Width;
   GLint j;

#if 0
   v0->v.x += LINE_X_OFFSET - TRI_X_OFFSET;
   v0->v.y += LINE_Y_OFFSET - TRI_Y_OFFSET;
   v1->v.x += LINE_X_OFFSET - TRI_X_OFFSET;
   v1->v.y += LINE_Y_OFFSET - TRI_Y_OFFSET;
#endif

   dx = v0->v.x - v1->v.x;
   dy = v0->v.y - v1->v.y;
   
   ix = width * .5; iy = 0;
   if (dx * dx > dy * dy) {
      iy = ix; ix = 0;
   }

   *(float *)&vb[0] = v0->v.x - ix;
   *(float *)&vb[1] = v0->v.y - iy;
   for (j = 2 ; j < vertex_size ; j++) 
      vb[j] = v0->ui[j];
   vb += vertex_size;

   *(float *)&vb[0] = v1->v.x + ix;
   *(float *)&vb[1] = v1->v.y + iy;
   for (j = 2 ; j < vertex_size ; j++) 
      vb[j] = v1->ui[j];
   vb += vertex_size;

   *(float *)&vb[0] = v0->v.x + ix;
   *(float *)&vb[1] = v0->v.y + iy;
   for (j = 2 ; j < vertex_size ; j++) 
      vb[j] = v0->ui[j];
   vb += vertex_size;
	 
   *(float *)&vb[0] = v0->v.x - ix;
   *(float *)&vb[1] = v0->v.y - iy;
   for (j = 2 ; j < vertex_size ; j++) 
      vb[j] = v0->ui[j];
   vb += vertex_size;

   *(float *)&vb[0] = v1->v.x - ix;
   *(float *)&vb[1] = v1->v.y - iy;
   for (j = 2 ; j < vertex_size ; j++) 
      vb[j] = v1->ui[j];
   vb += vertex_size;

   *(float *)&vb[0] = v1->v.x + ix;
   *(float *)&vb[1] = v1->v.y + iy;
   for (j = 2 ; j < vertex_size ; j++) 
      vb[j] = v1->ui[j];
   vb += vertex_size;

#if 0
   v0->v.x -= LINE_X_OFFSET - TRI_X_OFFSET;
   v0->v.y -= LINE_Y_OFFSET - TRI_Y_OFFSET;
   v1->v.x -= LINE_X_OFFSET - TRI_X_OFFSET;
   v1->v.y -= LINE_Y_OFFSET - TRI_Y_OFFSET;
#endif
}