-/* $Id: t_vb_render.c,v 1.29 2002/04/09 16:56:52 keithw Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 4.0.1
+ * Version: 5.1
*
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Authors:
- * Keith Whitwell <keithw@valinux.com>
+ * Keith Whitwell <keith@tungstengraphics.com>
*/
#include "context.h"
#include "enums.h"
#include "macros.h"
-#include "mem.h"
+#include "imports.h"
#include "mtypes.h"
-#include "mmath.h"
-
+#include "nvfragprog.h"
#include "math/m_matrix.h"
#include "math/m_xform.h"
/**********************************************************************/
-#if defined(USE_IEEE)
-#define NEGATIVE(x) (GET_FLOAT_BITS(x) & (1<<31))
-#define DIFFERENT_SIGNS(x,y) ((GET_FLOAT_BITS(x) ^ GET_FLOAT_BITS(y)) & (1<<31))
-#else
-#define NEGATIVE(x) (x < 0)
-#define DIFFERENT_SIGNS(x,y) (x * y <= 0 && x - y != 0)
-/* Could just use (x*y<0) except for the flatshading requirements.
- * Maybe there's a better way?
- */
-#endif
-
-
#define W(i) coord[i][3]
#define Z(i) coord[i][2]
#define Y(i) coord[i][1]
/* Clip and render whole begin/end objects */
/**********************************************************************/
-#define NEED_EDGEFLAG_SETUP (ctx->_TriangleCaps & DD_TRI_UNFILLED)
+#define NEED_EDGEFLAG_SETUP (ctx->Polygon.FrontMode != GL_FILL || ctx->Polygon.BackMode != GL_FILL)
#define EDGEFLAG_GET(idx) VB->EdgeFlag[idx]
#define EDGEFLAG_SET(idx, val) VB->EdgeFlag[idx] = val
/* Render whole begin/end objects */
/**********************************************************************/
-#define NEED_EDGEFLAG_SETUP (ctx->_TriangleCaps & DD_TRI_UNFILLED)
+#define NEED_EDGEFLAG_SETUP (ctx->Polygon.FrontMode != GL_FILL || ctx->Polygon.BackMode != GL_FILL)
#define EDGEFLAG_GET(idx) VB->EdgeFlag[idx]
#define EDGEFLAG_SET(idx, val) VB->EdgeFlag[idx] = val
static GLboolean run_render( GLcontext *ctx,
- struct gl_pipeline_stage *stage )
+ struct tnl_pipeline_stage *stage )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
struct vertex_buffer *VB = &tnl->vb;
do
{
- GLuint i, length, flags = 0;
- for (i = VB->FirstPrimitive ; !(flags & PRIM_LAST) ; i += length)
+ GLuint i;
+
+ for (i = 0 ; i < VB->PrimitiveCount ; i++)
{
- flags = VB->Primitive[i];
- length= VB->PrimitiveLength[i];
- ASSERT(length || (flags & PRIM_LAST));
- ASSERT((flags & PRIM_MODE_MASK) <= GL_POLYGON+1);
+ GLuint prim = VB->Primitive[i].mode;
+ GLuint start = VB->Primitive[i].start;
+ GLuint length = VB->Primitive[i].count;
+
+ assert((prim & PRIM_MODE_MASK) < GL_POLYGON+1);
- if (MESA_VERBOSE & VERBOSE_PRIMS)
- fprintf(stderr, "MESA prim %s %d..%d\n",
- _mesa_lookup_enum_by_nr(flags & PRIM_MODE_MASK),
- i, i+length);
+ if (MESA_VERBOSE & VERBOSE_PRIMS)
+ _mesa_debug(NULL, "MESA prim %s %d..%d\n",
+ _mesa_lookup_enum_by_nr(prim & PRIM_MODE_MASK),
+ start, start+length);
if (length)
- tab[flags & PRIM_MODE_MASK]( ctx, i, i + length, flags );
+ tab[prim & PRIM_MODE_MASK]( ctx, start, start + length, prim );
}
} while (tnl->Driver.Render.Multipass &&
tnl->Driver.Render.Multipass( ctx, ++pass ));
-
tnl->Driver.Render.Finish( ctx );
-/* _swrast_flush(ctx); */
-/* usleep(1000000); */
+
return GL_FALSE; /* finished the pipe */
}
/* Quite a bit of work involved in finding out the inputs for the
* render stage.
*/
-static void check_render( GLcontext *ctx, struct gl_pipeline_stage *stage )
+static void check_render( GLcontext *ctx, struct tnl_pipeline_stage *stage )
{
- GLuint inputs = VERT_BIT_CLIP;
- GLuint i;
-
- if (ctx->Visual.rgbMode) {
- inputs |= VERT_BIT_COLOR0;
-
- if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR)
- inputs |= VERT_BIT_COLOR1;
-
- if (ctx->Texture._ReallyEnabled) {
- for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) {
- if (ctx->Texture.Unit[i]._ReallyEnabled)
- inputs |= VERT_BIT_TEX(i);
- }
- }
- }
- else {
- inputs |= VERT_BIT_INDEX;
- }
-
- if (ctx->Point._Attenuated)
- inputs |= VERT_BIT_POINT_SIZE;
-
- /* How do drivers turn this off?
- */
- if (ctx->Fog.Enabled)
- inputs |= VERT_BIT_FOG;
-
- if (ctx->_TriangleCaps & DD_TRI_UNFILLED)
- inputs |= VERT_BIT_EDGEFLAG;
-
- if (ctx->RenderMode==GL_FEEDBACK)
- inputs |= VERT_BITS_TEX_ANY;
-
- stage->inputs = inputs;
+ stage->inputs = TNL_CONTEXT(ctx)->render_inputs;
}
-static void dtr( struct gl_pipeline_stage *stage )
+static void dtr( struct tnl_pipeline_stage *stage )
{
}
-const struct gl_pipeline_stage _tnl_render_stage =
+const struct tnl_pipeline_stage _tnl_render_stage =
{
"render", /* name */
(_NEW_BUFFERS |