Browse Source

Changes for ffb

tags/mesa_3_5
Keith Whitwell 24 years ago
parent
commit
0ceb82b838
2 changed files with 178 additions and 68 deletions
  1. 4
    2
      src/mesa/drivers/common/t_dd_dmatmp.h
  2. 174
    66
      src/mesa/drivers/common/t_dd_tritmp.h

+ 4
- 2
src/mesa/drivers/common/t_dd_dmatmp.h View File

@@ -44,6 +44,7 @@
#endif

#if !HAVE_ELTS
#define ELTS_VARS
#define ALLOC_ELTS( nr )
#define EMIT_ELT( offset, elt )
#define INCR_ELTS( nr )
@@ -392,7 +393,7 @@ static void TAG(render_quad_strip_verts)( GLcontext *ctx,
if (HAVE_QUAD_STRIPS && 0) {
/* TODO.
*/
} else if (ctx->_TriangleCaps & DD_FLATSHADE) {
} else if (HAVE_TRI_STRIPS && ctx->_TriangleCaps & DD_FLATSHADE) {
if (TAG(emit_elt_verts)( ctx, start, count )) {
LOCAL_VARS;
int dmasz = GET_SUBSEQUENT_VB_MAX_ELTS();
@@ -881,7 +882,8 @@ static void TAG(render_quad_strip_elts)( GLcontext *ctx,
GLuint flags )
{
if (HAVE_QUAD_STRIPS && 0) {
} else {
}
else if (HAVE_TRI_STRIPS) {
LOCAL_VARS;
GLuint *elts = TNL_CONTEXT(ctx)->vb.Elts;
int dmasz = GET_SUBSEQUENT_VB_MAX_ELTS();

+ 174
- 66
src/mesa/drivers/common/t_dd_tritmp.h View File

@@ -69,6 +69,17 @@
#define VERT_COPY_IND( v0, v1 )
#define VERT_SAVE_IND( idx )
#define VERT_RESTORE_IND( idx )
#if HAVE_BACK_COLORS
#define VERT_SET_RGBA( v, c )
#endif
#else
#define VERT_SET_RGBA( v, c ) (void) c
#define VERT_COPY_RGBA( v0, v1 )
#define VERT_SAVE_RGBA( idx )
#define VERT_RESTORE_RGBA( idx )
#if HAVE_BACK_COLORS
#define VERT_SET_IND( v, c )
#endif
#endif

#if !HAVE_SPEC
@@ -76,8 +87,27 @@
#define VERT_COPY_SPEC( v0, v1 )
#define VERT_SAVE_SPEC( idx )
#define VERT_RESTORE_SPEC( idx )
#if HAVE_BACK_COLORS
#define VERT_COPY_SPEC1( v )
#endif
#else
#if HAVE_BACK_COLORS
#define VERT_SET_SPEC( v, c )
#endif
#endif

#if !HAVE_BACK_COLORS
#define VERT_COPY_SPEC1( v )
#define VERT_COPY_IND1( v )
#define VERT_COPY_RGBA1( v )
#endif

#ifndef INSANE_VERTICES
#define VERT_SET_Z(v,val) VERT_Z(v) = val
#define VERT_Z_ADD(v,val) VERT_Z(v) += val
#endif

#if DO_TRI
static void TAG(triangle)( GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 )
{
struct vertex_buffer *VB = &TNL_CONTEXT( ctx )->vb;
@@ -125,26 +155,48 @@ static void TAG(triangle)( GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 )
if (DO_TWOSIDE && facing == 1)
{
if (HAVE_RGBA) {
GLchan (*vbcolor)[4] = VB->ColorPtr[1]->data;
ASSERT(VB->ColorPtr[1]->stride == 4*sizeof(GLchan));

if (!DO_FLAT) {
VERT_SET_RGBA( v[0], vbcolor[e0] );
VERT_SET_RGBA( v[1], vbcolor[e1] );
}
VERT_SET_RGBA( v[2], vbcolor[e2] );
if (HAVE_BACK_COLORS) {
if (!DO_FLAT) {
VERT_SAVE_RGBA( 0 );
VERT_SAVE_RGBA( 1 );
VERT_COPY_RGBA1( v[0] );
VERT_COPY_RGBA1( v[1] );
}
VERT_SAVE_RGBA( 2 );
VERT_COPY_RGBA1( v[2] );
if (HAVE_SPEC) {
if (!DO_FLAT) {
VERT_SAVE_SPEC( 0 );
VERT_SAVE_SPEC( 1 );
VERT_COPY_SPEC1( v[0] );
VERT_COPY_SPEC1( v[1] );
}
VERT_SAVE_SPEC( 2 );
VERT_COPY_SPEC1( v[2] );
}
}
else {
GLchan (*vbcolor)[4] = VB->ColorPtr[1]->data;
ASSERT(VB->ColorPtr[1]->stride == 4*sizeof(GLchan));
(void) vbcolor;

if (HAVE_SPEC && VB->SecondaryColorPtr[1]) {
GLchan (*vbspec)[4] = VB->SecondaryColorPtr[1]->data;
ASSERT(VB->SecondaryColorPtr[1]->stride == 4*sizeof(GLchan));
if (!DO_FLAT) {
VERT_SET_SPEC( v[0], vbspec[e0] );
VERT_SET_SPEC( v[1], vbspec[e1] );
VERT_SET_RGBA( v[0], vbcolor[e0] );
VERT_SET_RGBA( v[1], vbcolor[e1] );
}
VERT_SET_SPEC( v[2], vbspec[e2] );
}
}
VERT_SET_RGBA( v[2], vbcolor[e2] );
if (HAVE_SPEC && VB->SecondaryColorPtr[1]) {
GLchan (*vbspec)[4] = VB->SecondaryColorPtr[1]->data;
if (!DO_FLAT) {
VERT_SET_SPEC( v[0], vbspec[e0] );
VERT_SET_SPEC( v[1], vbspec[e1] );
}
VERT_SET_SPEC( v[2], vbspec[e2] );
}
}
}
else {
GLuint *vbindex = VB->IndexPtr[1]->data;
if (!DO_FLAT) {
@@ -202,23 +254,23 @@ static void TAG(triangle)( GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 )

if (mode == GL_POINT) {
if (DO_OFFSET && ctx->Polygon.OffsetPoint) {
VERT_Z(v[0]) += offset;
VERT_Z(v[1]) += offset;
VERT_Z(v[2]) += offset;
VERT_Z_ADD(v[0], offset);
VERT_Z_ADD(v[1], offset);
VERT_Z_ADD(v[2], offset);
}
UNFILLED_TRI( ctx, GL_POINT, e0, e1, e2 );
} else if (mode == GL_LINE) {
if (DO_OFFSET && ctx->Polygon.OffsetLine) {
VERT_Z(v[0]) += offset;
VERT_Z(v[1]) += offset;
VERT_Z(v[2]) += offset;
VERT_Z_ADD(v[0], offset);
VERT_Z_ADD(v[1], offset);
VERT_Z_ADD(v[2], offset);
}
UNFILLED_TRI( ctx, GL_LINE, e0, e1, e2 );
} else {
if (DO_OFFSET && ctx->Polygon.OffsetFill) {
VERT_Z(v[0]) += offset;
VERT_Z(v[1]) += offset;
VERT_Z(v[2]) += offset;
VERT_Z_ADD(v[0], offset);
VERT_Z_ADD(v[1], offset);
VERT_Z_ADD(v[2], offset);
}
if (DO_UNFILLED)
RASTERIZE( GL_TRIANGLES );
@@ -227,32 +279,45 @@ static void TAG(triangle)( GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 )

if (DO_OFFSET)
{
VERT_Z(v[0]) = z[0];
VERT_Z(v[1]) = z[1];
VERT_Z(v[2]) = z[2];
VERT_SET_Z(v[0], z[0]);
VERT_SET_Z(v[1], z[1]);
VERT_SET_Z(v[2], z[2]);
}

if (DO_TWOSIDE && facing == 1)
{
if (HAVE_RGBA) {
GLchan (*vbcolor)[4] = VB->ColorPtr[0]->data;
ASSERT(VB->ColorPtr[0]->stride == 4*sizeof(GLchan));
if (!DO_FLAT) {
VERT_SET_RGBA( v[0], vbcolor[e0] );
VERT_SET_RGBA( v[1], vbcolor[e1] );
}
VERT_SET_RGBA( v[2], vbcolor[e2] );
if (HAVE_SPEC && VB->SecondaryColorPtr[0]) {
GLchan (*vbspec)[4] = VB->SecondaryColorPtr[0]->data;
ASSERT(VB->SecondaryColorPtr[0]->stride == 4*sizeof(GLchan));
if (HAVE_BACK_COLORS) {
VERT_RESTORE_RGBA( 0 );
VERT_RESTORE_RGBA( 1 );
VERT_RESTORE_RGBA( 2 );
if (HAVE_SPEC) {
VERT_RESTORE_SPEC( 0 );
VERT_RESTORE_SPEC( 1 );
VERT_RESTORE_SPEC( 2 );
}
}
else {
GLchan (*vbcolor)[4] = VB->ColorPtr[0]->data;
ASSERT(VB->ColorPtr[0]->stride == 4*sizeof(GLchan));
(void) vbcolor;
if (!DO_FLAT) {
VERT_SET_SPEC( v[0], vbspec[e0] );
VERT_SET_SPEC( v[1], vbspec[e1] );
VERT_SET_RGBA( v[0], vbcolor[e0] );
VERT_SET_RGBA( v[1], vbcolor[e1] );
}
VERT_SET_RGBA( v[2], vbcolor[e2] );
if (HAVE_SPEC && VB->SecondaryColorPtr[0]) {
GLchan (*vbspec)[4] = VB->SecondaryColorPtr[0]->data;
ASSERT(VB->SecondaryColorPtr[0]->stride == 4*sizeof(GLchan));
if (!DO_FLAT) {
VERT_SET_SPEC( v[0], vbspec[e0] );
VERT_SET_SPEC( v[1], vbspec[e1] );
}
VERT_SET_SPEC( v[2], vbspec[e2] );
}
VERT_SET_SPEC( v[2], vbspec[e2] );
}
}
else {
@@ -280,11 +345,11 @@ static void TAG(triangle)( GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 )
VERT_RESTORE_IND( 1 );
}
}


}
#endif

#if (DO_FULL_QUAD)
#if DO_QUAD
#if DO_FULL_QUAD
static void TAG(quad)( GLcontext *ctx,
GLuint e0, GLuint e1, GLuint e2, GLuint e3 )
{
@@ -333,6 +398,7 @@ static void TAG(quad)( GLcontext *ctx,
{
if (HAVE_RGBA) {
GLchan (*vbcolor)[4] = VB->ColorPtr[1]->data;
(void)vbcolor;
if (!DO_FLAT) {
VERT_SET_RGBA( v[0], vbcolor[e0] );
@@ -418,26 +484,26 @@ static void TAG(quad)( GLcontext *ctx,

if (mode == GL_POINT) {
if (( DO_OFFSET) && ctx->Polygon.OffsetPoint) {
VERT_Z(v[0]) += offset;
VERT_Z(v[1]) += offset;
VERT_Z(v[2]) += offset;
VERT_Z(v[3]) += offset;
VERT_Z_ADD(v[0], offset);
VERT_Z_ADD(v[1], offset);
VERT_Z_ADD(v[2], offset);
VERT_Z_ADD(v[3], offset);
}
UNFILLED_QUAD( ctx, GL_POINT, e0, e1, e2, e3 );
} else if (mode == GL_LINE) {
if (DO_OFFSET && ctx->Polygon.OffsetLine) {
VERT_Z(v[0]) += offset;
VERT_Z(v[1]) += offset;
VERT_Z(v[2]) += offset;
VERT_Z(v[3]) += offset;
VERT_Z_ADD(v[0], offset);
VERT_Z_ADD(v[1], offset);
VERT_Z_ADD(v[2], offset);
VERT_Z_ADD(v[3], offset);
}
UNFILLED_QUAD( ctx, GL_LINE, e0, e1, e2, e3 );
} else {
if (DO_OFFSET && ctx->Polygon.OffsetFill) {
VERT_Z(v[0]) += offset;
VERT_Z(v[1]) += offset;
VERT_Z(v[2]) += offset;
VERT_Z(v[3]) += offset;
VERT_Z_ADD(v[0], offset);
VERT_Z_ADD(v[1], offset);
VERT_Z_ADD(v[2], offset);
VERT_Z_ADD(v[3], offset);
}
RASTERIZE( GL_TRIANGLES );
QUAD( (v[0]), (v[1]), (v[2]), (v[3]) );
@@ -445,10 +511,10 @@ static void TAG(quad)( GLcontext *ctx,

if (DO_OFFSET)
{
VERT_Z(v[0]) = z[0];
VERT_Z(v[1]) = z[1];
VERT_Z(v[2]) = z[2];
VERT_Z(v[3]) = z[3];
VERT_SET_Z(v[0], z[0]);
VERT_SET_Z(v[1], z[1]);
VERT_SET_Z(v[2], z[2]);
VERT_SET_Z(v[3], z[3]);
}

if (DO_TWOSIDE && facing == 1)
@@ -456,6 +522,7 @@ static void TAG(quad)( GLcontext *ctx,
if (HAVE_RGBA) {
GLchan (*vbcolor)[4] = VB->ColorPtr[0]->data;
ASSERT(VB->ColorPtr[0]->stride == 4*sizeof(GLchan));
(void) vbcolor;
if (!DO_FLAT) {
VERT_SET_RGBA( v[0], vbcolor[e0] );
@@ -526,8 +593,9 @@ static void TAG(quad)( GLcontext *ctx, GLuint e0,
}
}
#endif
#endif

#if DO_LINE
static void TAG(line)( GLcontext *ctx, GLuint e0, GLuint e1 )
{
TNLvertexbuffer *VB = &TNL_CONTEXT(ctx)->vb;
@@ -567,8 +635,9 @@ static void TAG(line)( GLcontext *ctx, GLuint e0, GLuint e1 )
}
}
}
#endif

#if DO_POINT
static void TAG(points)( GLcontext *ctx, GLuint first, GLuint last )
{
struct vertex_buffer *VB = &TNL_CONTEXT( ctx )->vb;
@@ -592,13 +661,22 @@ static void TAG(points)( GLcontext *ctx, GLuint first, GLuint last )
}
}
}
#endif

static void TAG(init)( void )
{
#if DO_QUAD
TAB[IND].quad = TAG(quad);
#endif
#if DO_TRI
TAB[IND].triangle = TAG(triangle);
#endif
#if DO_LINE
TAB[IND].line = TAG(line);
#endif
#if DO_POINT
TAB[IND].points = TAG(points);
#endif
}

#undef IND
@@ -609,6 +687,17 @@ static void TAG(init)( void )
#undef VERT_COPY_IND
#undef VERT_SAVE_IND
#undef VERT_RESTORE_IND
#if HAVE_BACK_COLORS
#undef VERT_SET_RGBA
#endif
#else
#undef VERT_SET_RGBA
#undef VERT_COPY_RGBA
#undef VERT_SAVE_RGBA
#undef VERT_RESTORE_RGBA
#if HAVE_BACK_COLORS
#undef VERT_SET_IND
#endif
#endif

#if !HAVE_SPEC
@@ -616,4 +705,23 @@ static void TAG(init)( void )
#undef VERT_COPY_SPEC
#undef VERT_SAVE_SPEC
#undef VERT_RESTORE_SPEC
#if HAVE_BACK_COLORS
#undef VERT_COPY_SPEC1
#endif
#else
#if HAVE_BACK_COLORS
#undef VERT_SET_SPEC
#endif
#endif

#if !HAVE_BACK_COLORS
#undef VERT_COPY_SPEC1
#undef VERT_COPY_IND1
#undef VERT_COPY_RGBA1
#endif

#ifndef INSANE_VERTICES
#undef VERT_SET_Z
#undef VERT_Z_ADD
#endif


Loading…
Cancel
Save