is always the last vertex parameter.
Modify clipping to preserve pv colors.
Modify swrast and X11 driver to expect the pv in the last vertex
(was looking in the first vertex previously).
Remove all handling of flatshading from swrast_setup.
Allow drivers to override the unclipped render tabs in tnl_render_stage
directly. (Like in 3.4). Removed fxsimplerender stage.
Modified t_vb_rendertmp.h to remove the need for 'parity' arguments
in RENDER_TRI macros.
}
static const struct gl_pipeline_stage *fx_pipeline[] = {
- &_tnl_update_material_stage,
- /* TODO: Add the fastpath here */
+ &_tnl_update_material_stage, /* TODO: Add the fastpath here */
&_tnl_vertex_transform_stage,
&_tnl_normal_transform_stage,
&_tnl_lighting_stage,
&_tnl_texgen_stage,
&_tnl_texture_transform_stage,
&_tnl_point_attenuation_stage,
- &fx_render_stage, /* ADD: render simple unclipped vb's */
- &_tnl_render_stage, /* KEEP: the old render stage for fallbacks */
+ &_tnl_render_stage,
0,
};
if (firsttime) {
fxDDSetupInit();
fxDDTrifuncInit();
-/* fxDDFastPathInit(); */
firsttime = 0;
}
GLuint size;
};
-typedef void (*tfxSetupFunc)(GLcontext *ctx, GLuint, GLuint, GLuint);
+typedef void (*tfxSetupFunc)(GLcontext *ctx, GLuint, GLuint );
extern GrHwConfiguration glbHWConfig;
extern int glbCurrentBoard;
#include "swrast_setup/swrast_setup.h"
#include "tnl/t_context.h"
+#include "tnl/t_pipeline.h"
#include "fxdrv.h"
#include "fxglidew.h"
+
+/**********************************************************************/
+/* Render whole begin/end objects */
+/**********************************************************************/
+
+
+/* Vertices, no clipping.
+ */
+#define RENDER_POINTS( start, count ) \
+ for ( ; start < count ; start++) \
+ grDrawPoint( &v[ELT(start)].v );
+
+#define RENDER_LINE( i1, i ) \
+ grDrawLine( &v[i1].v, &v[i].v )
+
+#define RENDER_TRI( i2, i1, i ) \
+ grDrawTriangle( &v[i2].v, &v[i1].v, &v[i].v )
+
+#define RENDER_QUAD( i3, i2, i1, i ) \
+ grDrawTriangle( &v[i3].v, &v[i2].v, &v[i].v ); \
+ grDrawTriangle( &v[i2].v, &v[i1].v, &v[i].v )
+
+#define TAG(x) fx_##x##_verts
+#define LOCAL_VARS \
+ fxVertex *v = FX_CONTEXT(ctx)->verts;
+
+/* Verts, no clipping.
+ */
+#define ELT(x) x
+#define RESET_STIPPLE
+#define RESET_OCCLUSION
+#define PRESERVE_VB_DEFS
+#include "tnl/t_vb_rendertmp.h"
+
+
+/* Elts, no clipping.
+ */
+#undef ELT
+#undef TAG
+#undef LOCAL_VARS
+#define TAG(x) fx_##x##_elts
+#define ELT(x) elt[x]
+#define LOCAL_VARS \
+ fxVertex *v = FX_CONTEXT(ctx)->verts; \
+ const GLuint * const elt = TNL_CONTEXT(ctx)->vb.Elts;
+#include "tnl/t_vb_rendertmp.h"
+
+
+
+
/* Setup the Point, Line, Triangle and Quad functions based on the
* current rendering state. Wherever possible, use the hardware to
* render the primitive. Otherwise, fallback to software rendering.
ctx->Driver.LineFunc = _swsetup_Line;
ctx->Driver.TriangleFunc = _swsetup_Triangle;
ctx->Driver.QuadFunc = _swsetup_Quad;
+ ctx->Driver.RenderTabVerts = _tnl_render_tab_verts;
+ ctx->Driver.RenderTabElts = _tnl_render_tab_elts;
fxMesa->render_index = FX_FALLBACK_BIT;
return;
ctx->Driver.TriangleFunc = rast_tab[index].triangle;
ctx->Driver.QuadFunc = rast_tab[index].quad;
fxMesa->render_index = index;
+
+ if (fxMesa->render_index == 0) {
+ ctx->Driver.RenderTabVerts = fx_render_tab_verts;
+ ctx->Driver.RenderTabElts = fx_render_tab_elts;
+ } else {
+ ctx->Driver.RenderTabVerts = _tnl_render_tab_verts;
+ ctx->Driver.RenderTabElts = _tnl_render_tab_elts;
+ }
}
+
+
#else
static void
-fxsetup_invalid( GLcontext *ctx, GLuint start, GLuint end, GLuint newinputs )
+fxsetup_invalid( GLcontext *ctx, GLuint start, GLuint end )
{
fprintf(stderr, "fxMesa: invalid setup function\n");
- (void) (ctx && start && end && newinputs);
+ (void) (ctx && start && end);
}
{
fxMesaContext fxMesa = FX_CONTEXT(ctx);
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
- GLuint ind = fxMesa->setup_gone;
- fxMesa->setup_gone = 0;
+ if (newinputs == ~0) {
+ /* build interpolated vertices */
+ setupfuncs[fxMesa->setupindex]( ctx, start, count );
+ } else {
+ GLuint ind = fxMesa->setup_gone;
+ fxMesa->setup_gone = 0;
- if (newinputs & VERT_CLIP)
- ind = fxMesa->setupindex; /* clipmask has changed - invalidated all */
- else {
- if (newinputs & VERT_TEX0)
- ind |= fxMesa->tex_dest[0];
+ if (newinputs & VERT_CLIP)
+ ind = fxMesa->setupindex; /* clipmask has potentially changed */
+ else {
+ if (newinputs & VERT_TEX0)
+ ind |= fxMesa->tex_dest[0];
- if (newinputs & VERT_TEX1)
- ind |= fxMesa->tex_dest[1];
-
- if (newinputs & VERT_RGBA)
- ind |= SETUP_RGBA;
-
- ind &= fxMesa->setupindex;
- }
+ if (newinputs & VERT_TEX1)
+ ind |= fxMesa->tex_dest[1];
- if (0) {
- _tnl_print_vert_flags("newinputs", newinputs);
- fxPrintSetupFlags("setup function", ind);
- }
+ if (newinputs & VERT_RGBA)
+ ind |= SETUP_RGBA;
- if (fxMesa->new_state)
- fxSetupFXUnits( ctx );
+ ind &= fxMesa->setupindex;
+ }
- if (VB->importable_data)
- VB->import_data( ctx, VB->importable_data & newinputs,
- (VB->ClipOrMask
- ? VEC_NOT_WRITEABLE|VEC_BAD_STRIDE
- : VEC_BAD_STRIDE));
+ if (0) {
+ _tnl_print_vert_flags("newinputs", newinputs);
+ fxPrintSetupFlags("setup function", ind);
+ }
- setupfuncs[ind]( ctx, start, count, newinputs );
+ if (ind) {
+ if (fxMesa->new_state)
+ fxSetupFXUnits( ctx );
+
+ if (VB->importable_data)
+ VB->import_data( ctx, VB->importable_data & newinputs,
+ (VB->ClipOrMask
+ ? VEC_NOT_WRITEABLE|VEC_BAD_STRIDE
+ : VEC_BAD_STRIDE));
+
+ setupfuncs[ind]( ctx, start, count );
+ }
+ }
}
-
void fxAllocVB( GLcontext *ctx )
{
fxMesaContext fxMesa = FX_CONTEXT(ctx);
*/
-static void NAME(GLcontext *ctx, GLuint start, GLuint end, GLuint newinputs)
+static void NAME(GLcontext *ctx, GLuint start, GLuint end )
{
fxMesaContext fxMesa = (fxMesaContext)ctx->DriverCtx;
fxVertex *verts = fxMesa->verts;
-/* $Id: osmesa.c,v 1.36 2001/01/02 22:02:52 brianp Exp $ */
+/* $Id: osmesa.c,v 1.37 2001/01/05 02:26:48 keithw Exp $ */
/*
* Mesa 3-D graphics library
#include "swrast/s_lines.h"
#include "swrast/s_triangle.h"
#include "tnl/tnl.h"
+#include "array_cache/acache.h"
#endif
GLcontext *ctx = &osmesa->gl_ctx;
_swrast_CreateContext( ctx );
+ _ac_CreateContext( ctx );
_tnl_CreateContext( ctx );
_swsetup_CreateContext( ctx );
_swrast_InvalidateState( ctx, new_state );
_swsetup_InvalidateState( ctx, new_state );
+ _ac_InvalidateState( ctx, new_state );
_tnl_InvalidateState( ctx, new_state );
}
-/* $Id: xm_line.c,v 1.14 2001/01/02 22:02:52 brianp Exp $ */
+/* $Id: xm_line.c,v 1.15 2001/01/05 02:26:48 keithw Exp $ */
/*
* Mesa 3-D graphics library
const SWvertex *vert0, const SWvertex *vert1 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
- const GLubyte *color = vert0->color;
+ const GLubyte *color = vert1->color;
XMesaImage *img = xmesa->xm_buffer->backimage;
unsigned long pixel;
PACK_TRUECOLOR( pixel, color[0], color[1], color[2] );
const SWvertex *vert0, const SWvertex *vert1 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
- const GLubyte *color = vert0->color;
+ const GLubyte *color = vert1->color;
GLuint pixel = PACK_8B8G8R( color[0], color[1], color[2] );
#define PIXEL_TYPE GLuint
const SWvertex *vert0, const SWvertex *vert1 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
- const GLubyte *color = vert0->color;
+ const GLubyte *color = vert1->color;
GLuint pixel = PACK_8R8G8B( color[0], color[1], color[2] );
#define PIXEL_TYPE GLuint
const SWvertex *vert0, const SWvertex *vert1 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
- const GLubyte *color = vert0->color;
+ const GLubyte *color = vert1->color;
#define PIXEL_TYPE bgr_t
#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
const SWvertex *vert0, const SWvertex *vert1 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
- const GLubyte *color = vert0->color;
+ const GLubyte *color = vert1->color;
GLushort pixel = PACK_5R6G5B( color[0], color[1], color[2] );
#define PIXEL_TYPE GLushort
const SWvertex *vert0, const SWvertex *vert1 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
- const GLubyte *color = vert0->color;
+ const GLubyte *color = vert1->color;
#define PIXEL_TYPE GLushort
#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
const SWvertex *vert0, const SWvertex *vert1 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
- const GLubyte *color = vert0->color;
+ const GLubyte *color = vert1->color;
GLint r = color[0], g = color[1], b = color[2];
DITHER_SETUP;
const SWvertex *vert0, const SWvertex *vert1 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
- const GLubyte *color = vert0->color;
+ const GLubyte *color = vert1->color;
GLubyte pixel;
LOOKUP_SETUP;
pixel = (GLubyte) LOOKUP( color[0], color[1], color[2] );
const SWvertex *vert0, const SWvertex *vert1 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
- const GLubyte *color = vert0->color;
+ const GLubyte *color = vert1->color;
GLint r = color[0], g = color[1], b = color[2];
#define INTERP_XY 1
const SWvertex *vert0, const SWvertex *vert1 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
- const GLubyte *color = vert0->color;
+ const GLubyte *color = vert1->color;
XMesaImage *img = xmesa->xm_buffer->backimage;
unsigned long pixel;
PACK_TRUECOLOR( pixel, color[0], color[1], color[2] );
const SWvertex *vert0, const SWvertex *vert1 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
- const GLubyte *color = vert0->color;
+ const GLubyte *color = vert1->color;
GLuint pixel = PACK_8B8G8R( color[0], color[1], color[2] );
#define INTERP_Z 1
const SWvertex *vert0, const SWvertex *vert1 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
- const GLubyte *color = vert0->color;
+ const GLubyte *color = vert1->color;
GLuint pixel = PACK_8R8G8B( color[0], color[1], color[2] );
#define INTERP_Z 1
const SWvertex *vert0, const SWvertex *vert1 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
- const GLubyte *color = vert0->color;
+ const GLubyte *color = vert1->color;
#define INTERP_Z 1
#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
const SWvertex *vert0, const SWvertex *vert1 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
- const GLubyte *color = vert0->color;
+ const GLubyte *color = vert1->color;
GLushort pixel = PACK_5R6G5B( color[0], color[1], color[2] );
#define INTERP_Z 1
const SWvertex *vert0, const SWvertex *vert1 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
- const GLubyte *color = vert0->color;
+ const GLubyte *color = vert1->color;
#define INTERP_Z 1
#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
const SWvertex *vert0, const SWvertex *vert1 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
- const GLubyte *color = vert0->color;
+ const GLubyte *color = vert1->color;
GLint r = color[0], g = color[1], b = color[2];
DITHER_SETUP;
const SWvertex *vert0, const SWvertex *vert1 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
- const GLubyte *color = vert0->color;
+ const GLubyte *color = vert1->color;
GLubyte pixel;
LOOKUP_SETUP;
pixel = (GLubyte) LOOKUP( color[0], color[1], color[2] );
const SWvertex *vert0, const SWvertex *vert1 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
- const GLubyte *color = vert0->color;
+ const GLubyte *color = vert1->color;
GLint r = color[0], g = color[1], b = color[2];
#define INTERP_XY 1
-/* $Id: xm_tri.c,v 1.15 2001/01/02 22:02:52 brianp Exp $ */
+/* $Id: xm_tri.c,v 1.16 2001/01/05 02:26:48 keithw Exp $ */
/*
* Mesa 3-D graphics library
#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
#define SETUP_CODE \
unsigned long pixel; \
- PACK_TRUECOLOR(pixel, v0->color[0], v0->color[1], v0->color[2]);
+ PACK_TRUECOLOR(pixel, v2->color[0], v2->color[1], v2->color[2]);
#define INNER_LOOP( LEFT, RIGHT, Y ) \
{ \
#define PIXEL_TYPE GLuint
#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
#define SETUP_CODE \
- unsigned long p = PACK_8B8G8R( v0->color[0], \
- v0->color[1], v0->color[2] );
+ unsigned long p = PACK_8B8G8R( v2->color[0], \
+ v2->color[1], v2->color[2] );
#define INNER_LOOP( LEFT, RIGHT, Y ) \
{ \
GLint i, len = RIGHT-LEFT; \
#define PIXEL_TYPE GLuint
#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
#define SETUP_CODE \
- unsigned long p = PACK_8R8G8B( v0->color[0], \
- v0->color[1], v0->color[2] );
+ unsigned long p = PACK_8R8G8B( v2->color[0], \
+ v2->color[1], v2->color[2] );
#define INNER_LOOP( LEFT, RIGHT, Y ) \
{ \
GLint i, len = RIGHT-LEFT; \
const SWvertex *v2 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
- const GLubyte *color = v0->color;
+ const GLubyte *color = v2->color;
#define INTERP_Z 1
#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
#define PIXEL_ADDRESS(X,Y) PIXELADDR3(xmesa->xm_buffer,X,Y)
GLdepth z = FixedToDepth(ffz); \
if (z < zRow[i]) { \
unsigned long p; \
- PACK_TRUEDITHER( p, xx, yy, v0->color[0], \
- v0->color[1], v0->color[2] ); \
+ PACK_TRUEDITHER( p, xx, yy, v2->color[0], \
+ v2->color[1], v2->color[2] ); \
XMesaPutPixel( img, xx, yy, p ); \
zRow[i] = z; \
} \
#define PIXEL_TYPE GLushort
#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
#define SETUP_CODE \
- unsigned long p = PACK_5R6G5B( v0->color[0], \
- v0->color[1], v0->color[2] );
+ unsigned long p = PACK_5R6G5B( v2->color[0], \
+ v2->color[1], v2->color[2] );
#define INNER_LOOP( LEFT, RIGHT, Y ) \
{ \
GLint i, len = RIGHT-LEFT; \
const SWvertex *v2 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
- const GLubyte *color = v0->color;
+ const GLubyte *color = v2->color;
#define INTERP_Z 1
#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
#define PIXEL_ADDRESS(X,Y) PIXELADDR2(xmesa->xm_buffer,X,Y)
#define PIXEL_TYPE GLubyte
#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
#define SETUP_CODE \
- FLAT_DITHER_SETUP( v0->color[0], v0->color[1], v0->color[2] );
+ FLAT_DITHER_SETUP( v2->color[0], v2->color[1], v2->color[2] );
#define INNER_LOOP( LEFT, RIGHT, Y ) \
{ \
#define INTERP_Z 1
#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
#define SETUP_CODE \
- FLAT_DITHER_SETUP( v0->color[0], v0->color[1], v0->color[2] );
+ FLAT_DITHER_SETUP( v2->color[0], v2->color[1], v2->color[2] );
#define INNER_LOOP( LEFT, RIGHT, Y ) \
{ \
#define PIXEL_TYPE GLubyte
#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
#define SETUP_CODE \
- GLubyte r = v0->color[0]; \
- GLubyte g = v0->color[1]; \
- GLubyte b = v0->color[2];
+ GLubyte r = v2->color[0]; \
+ GLubyte g = v2->color[1]; \
+ GLubyte b = v2->color[2];
#define INNER_LOOP( LEFT, RIGHT, Y ) \
{ \
GLint i, xx = LEFT, yy = FLIP(xmesa->xm_buffer,Y), len = RIGHT-LEFT; \
#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
#define SETUP_CODE \
LOOKUP_SETUP; \
- GLubyte r = v0->color[0]; \
- GLubyte g = v0->color[1]; \
- GLubyte b = v0->color[2]; \
+ GLubyte r = v2->color[0]; \
+ GLubyte g = v2->color[1]; \
+ GLubyte b = v2->color[2]; \
GLubyte p = LOOKUP(r,g,b);
#define INNER_LOOP( LEFT, RIGHT, Y ) \
{ \
XMesaImage *img = xmesa->xm_buffer->backimage;
#define SETUP_CODE \
unsigned long pixel; \
- PACK_TRUECOLOR(pixel, v0->color[0], v0->color[1], v0->color[2]);
+ PACK_TRUECOLOR(pixel, v2->color[0], v2->color[1], v2->color[2]);
#define INNER_LOOP( LEFT, RIGHT, Y ) \
{ \
#define PIXEL_TYPE GLuint
#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
#define SETUP_CODE \
- unsigned long p = PACK_8B8G8R( v0->color[0], \
- v0->color[1], v0->color[2] );
+ unsigned long p = PACK_8B8G8R( v2->color[0], \
+ v2->color[1], v2->color[2] );
#define INNER_LOOP( LEFT, RIGHT, Y ) \
{ \
GLint xx; \
#define PIXEL_TYPE GLuint
#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
#define SETUP_CODE \
- unsigned long p = PACK_8R8G8B( v0->color[0], \
- v0->color[1], v0->color[2] );
+ unsigned long p = PACK_8R8G8B( v2->color[0], \
+ v2->color[1], v2->color[2] );
#define INNER_LOOP( LEFT, RIGHT, Y ) \
{ \
GLint xx; \
const SWvertex *v2 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
- const GLubyte *color = v0->color;
+ const GLubyte *color = v2->color;
#define PIXEL_ADDRESS(X,Y) PIXELADDR3(xmesa->xm_buffer,X,Y)
#define PIXEL_TYPE bgr_t
#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
GLint xx, yy = FLIP(xmesa->xm_buffer, Y); \
for (xx=LEFT;xx<RIGHT;xx++) { \
unsigned long p; \
- PACK_TRUEDITHER( p, xx, yy, v0->color[0], \
- v0->color[1], v0->color[2] ); \
+ PACK_TRUEDITHER( p, xx, yy, v2->color[0], \
+ v2->color[1], v2->color[2] ); \
XMesaPutPixel( img, xx, yy, p ); \
} \
}
#define PIXEL_TYPE GLushort
#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
#define SETUP_CODE \
- unsigned long p = PACK_5R6G5B( v0->color[0], \
- v0->color[1], v0->color[2] );
+ unsigned long p = PACK_5R6G5B( v2->color[0], \
+ v2->color[1], v2->color[2] );
#define INNER_LOOP( LEFT, RIGHT, Y ) \
{ \
GLint xx; \
const SWvertex *v2 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
- const GLubyte *color = v0->color;
+ const GLubyte *color = v2->color;
#define PIXEL_ADDRESS(X,Y) PIXELADDR2(xmesa->xm_buffer,X,Y)
#define PIXEL_TYPE GLushort
#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
#define PIXEL_TYPE GLubyte
#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
#define SETUP_CODE \
- FLAT_DITHER_SETUP( v0->color[0], v0->color[1], v0->color[2] );
+ FLAT_DITHER_SETUP( v2->color[0], v2->color[1], v2->color[2] );
#define INNER_LOOP( LEFT, RIGHT, Y ) \
{ \
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
XMesaImage *img = xmesa->xm_buffer->backimage;
#define SETUP_CODE \
- FLAT_DITHER_SETUP( v0->color[0], v0->color[1], v0->color[2] );
+ FLAT_DITHER_SETUP( v2->color[0], v2->color[1], v2->color[2] );
#define INNER_LOOP( LEFT, RIGHT, Y ) \
{ \
#define PIXEL_TYPE GLubyte
#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
#define SETUP_CODE \
- GLubyte r = v0->color[0]; \
- GLubyte g = v0->color[1]; \
- GLubyte b = v0->color[2];
+ GLubyte r = v2->color[0]; \
+ GLubyte g = v2->color[1]; \
+ GLubyte b = v2->color[2];
#define INNER_LOOP( LEFT, RIGHT, Y ) \
{ \
GLint xx, yy = FLIP(xmesa->xm_buffer, Y); \
#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
#define SETUP_CODE \
LOOKUP_SETUP; \
- GLubyte r = v0->color[0]; \
- GLubyte g = v0->color[1]; \
- GLubyte b = v0->color[2]; \
+ GLubyte r = v2->color[0]; \
+ GLubyte g = v2->color[1]; \
+ GLubyte b = v2->color[2]; \
GLubyte p = LOOKUP(r,g,b);
#define INNER_LOOP( LEFT, RIGHT, Y ) \
{ \
-/* $Id: api_validate.c,v 1.2 2001/01/02 21:40:57 brianp Exp $ */
+/* $Id: api_validate.c,v 1.3 2001/01/05 02:26:48 keithw Exp $ */
/*
* Mesa 3-D graphics library
#include "mtypes.h"
#include "state.h"
+
GLboolean
_mesa_validate_DrawElements(GLcontext *ctx,
GLenum mode, GLsizei count, GLenum type,
-/* $Id: buffers.c,v 1.21 2000/12/26 05:09:27 keithw Exp $ */
+/* $Id: buffers.c,v 1.22 2001/01/05 02:26:48 keithw Exp $ */
/*
* Mesa 3-D graphics library
_mesa_ResizeBuffersMESA( void )
{
GLcontext *ctx = _mesa_get_current_context();
-
GLuint buf_width, buf_height;
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx );
+
if (MESA_VERBOSE & VERBOSE_API)
fprintf(stderr, "glResizeBuffersMESA\n");
-/* $Id: convolve.c,v 1.17 2000/12/26 05:09:28 keithw Exp $ */
+/* $Id: convolve.c,v 1.18 2001/01/05 02:26:48 keithw Exp $ */
/*
* Mesa 3-D graphics library
{
GET_CURRENT_CONTEXT(ctx);
GLuint c;
- ASSERT_OUTSIDE_BEGIN_END(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
switch (target) {
case GL_CONVOLUTION_1D:
-/* $Id: dd.h,v 1.44 2000/12/26 05:09:28 keithw Exp $ */
+/* $Id: dd.h,v 1.45 2001/01/05 02:26:48 keithw Exp $ */
/*
* Mesa 3-D graphics library
*/
typedef void (*points_func)( GLcontext *ctx, GLuint first, GLuint last );
-typedef void (*line_func)( GLcontext *ctx, GLuint v1, GLuint v2, GLuint pv );
+typedef void (*line_func)( GLcontext *ctx, GLuint v1, GLuint v2 );
typedef void (*triangle_func)( GLcontext *ctx,
- GLuint v1, GLuint v2, GLuint v3, GLuint pv );
+ GLuint v1, GLuint v2, GLuint v3 );
typedef void (*quad_func)( GLcontext *ctx, GLuint v1, GLuint v2,
- GLuint v3, GLuint v4, GLuint pv );
+ GLuint v3, GLuint v4 );
+
+typedef void (*render_func)( GLcontext *ctx, GLuint start, GLuint count,
+ GLuint flags );
/*
triangle_func TriangleFunc;
quad_func QuadFunc;
+ render_func *RenderTabVerts;
+ render_func *RenderTabElts;
+
void (*ResetLineStipple)( GLcontext *ctx );
-
void (*BuildProjectedVertices)( GLcontext *ctx,
GLuint start, GLuint end,
GLuint new_inputs);
- /* This function, if not NULL, is called whenever new vertices are
- * required for rendering. The vertices in question are those n
- * such that start <= n < end. The new_inputs parameter indicates
- * those fields of the vertex which need to be updated, if only a
- * partial repair of the vertex is required.
+ /* This function is called whenever new vertices are required for
+ * rendering. The vertices in question are those n such that start
+ * <= n < end. The new_inputs parameter indicates those fields of
+ * the vertex which need to be updated, if only a partial repair of
+ * the vertex is required.
*
- * This function is called only from _tnl_render_stage in tnl/t_render.c.
+ * This function is called only from _tnl_render_stage in tnl/t_render.c.
*/
-/* $Id: fog.c,v 1.31 2000/12/26 05:09:28 keithw Exp $ */
+/* $Id: fog.c,v 1.32 2001/01/05 02:26:48 keithw Exp $ */
/*
* Mesa 3-D graphics library
switch (pname) {
case GL_FOG_MODE:
m = (GLenum) (GLint) *params;
- if (ctx->Fog.Mode == m)
- return;
switch (m) {
case GL_LINEAR:
case GL_EXP:
gl_error( ctx, GL_INVALID_ENUM, "glFog" );
return;
}
+ if (ctx->Fog.Mode == m)
+ return;
FLUSH_VERTICES(ctx, _NEW_FOG);
ctx->Fog.Mode = m;
break;
ctx->Fog.Index = *params;
break;
case GL_FOG_COLOR:
- if (TEST_EQ_4V(ctx->Fog.Color, params))
+ if (TEST_EQ_4V(ctx->Fog.Color, params))
return;
FLUSH_VERTICES(ctx, _NEW_FOG);
ctx->Fog.Color[0] = params[0];
break;
case GL_FOG_COORDINATE_SOURCE_EXT: {
GLenum p = (GLenum)(GLint) *params;
- if (ctx->Fog.FogCoordinateSource == p)
- return;
if (p != GL_FOG_COORDINATE_EXT && p != GL_FRAGMENT_DEPTH_EXT) {
gl_error( ctx, GL_INVALID_ENUM, "glFog" );
return;
}
+ if (ctx->Fog.FogCoordinateSource == p)
+ return;
FLUSH_VERTICES(ctx, _NEW_FOG);
ctx->Fog.FogCoordinateSource = p;
break;
if (ctx->Driver.Fogfv) {
(*ctx->Driver.Fogfv)( ctx, pname, params );
}
-
- ctx->NewState |= _NEW_FOG;
}
-/* $Id: mtypes.h,v 1.9 2001/01/02 22:02:51 brianp Exp $ */
+/* $Id: mtypes.h,v 1.10 2001/01/05 02:26:48 keithw Exp $ */
/*
* Mesa 3-D graphics library
#include "glthread.h"
#include "math/m_matrix.h" /* GLmatrix */
-#include "math/m_translate.h" /* trans_XXX_func */
#if defined(MESA_TRACE)
#include "Trace/tr_context.h"
-/* $Id: s_aalinetemp.h,v 1.3 2001/01/04 15:32:32 brianp Exp $ */
+/* $Id: s_aalinetemp.h,v 1.4 2001/01/05 02:26:48 keithw Exp $ */
/*
* Mesa 3-D graphics library
v0->color[ACOMP], v1->color[ACOMP], line.aPlane);
}
else {
- constant_plane(v0->color[RCOMP], line.rPlane);
- constant_plane(v0->color[GCOMP], line.gPlane);
- constant_plane(v0->color[BCOMP], line.bPlane);
- constant_plane(v0->color[ACOMP], line.aPlane);
+ constant_plane(v1->color[RCOMP], line.rPlane);
+ constant_plane(v1->color[GCOMP], line.gPlane);
+ constant_plane(v1->color[BCOMP], line.bPlane);
+ constant_plane(v1->color[ACOMP], line.aPlane);
}
#endif
#ifdef DO_SPEC
v0->specular[BCOMP], v1->specular[BCOMP], line.sbPlane);
}
else {
- constant_plane(v0->specular[RCOMP], line.srPlane);
- constant_plane(v0->specular[GCOMP], line.sgPlane);
- constant_plane(v0->specular[BCOMP], line.sbPlane);
+ constant_plane(v1->specular[RCOMP], line.srPlane);
+ constant_plane(v1->specular[GCOMP], line.sgPlane);
+ constant_plane(v1->specular[BCOMP], line.sbPlane);
}
#endif
#ifdef DO_INDEX
v0->index, v1->index, line.iPlane);
}
else {
- constant_plane(v0->index, line.iPlane);
+ constant_plane(v1->index, line.iPlane);
}
#endif
#ifdef DO_TEX
-/* $Id: s_aatritemp.h,v 1.4 2000/11/19 23:10:26 brianp Exp $ */
+/* $Id: s_aatritemp.h,v 1.5 2001/01/05 02:26:49 keithw Exp $ */
/*
* Mesa 3-D graphics library
compute_plane(p0, p1, p2, v0->color[3], v1->color[3], v2->color[3], aPlane);
}
else {
- constant_plane(v0->color[RCOMP], rPlane);
- constant_plane(v0->color[GCOMP], gPlane);
- constant_plane(v0->color[BCOMP], bPlane);
- constant_plane(v0->color[ACOMP], aPlane);
+ constant_plane(v2->color[RCOMP], rPlane);
+ constant_plane(v2->color[GCOMP], gPlane);
+ constant_plane(v2->color[BCOMP], bPlane);
+ constant_plane(v2->color[ACOMP], aPlane);
}
#endif
#ifdef DO_INDEX
v1->index, v2->index, iPlane);
}
else {
- constant_plane(v0->index, iPlane);
+ constant_plane(v2->index, iPlane);
}
#endif
#ifdef DO_SPEC
- {
+ if (ctx->Light.ShadeModel == GL_SMOOTH) {
compute_plane(p0, p1, p2, v0->specular[0], v1->specular[0], v2->specular[0],srPlane);
compute_plane(p0, p1, p2, v0->specular[1], v1->specular[1], v2->specular[1],sgPlane);
compute_plane(p0, p1, p2, v0->specular[2], v1->specular[2], v2->specular[2],sbPlane);
}
+ else {
+ /* KW: added this */
+ constant_plane(v2->specular[RCOMP], srPlane);
+ constant_plane(v2->specular[GCOMP], sgPlane);
+ constant_plane(v2->specular[BCOMP], sbPlane);
+ }
#endif
#ifdef DO_TEX
{
-/* $Id: s_feedback.c,v 1.3 2000/11/19 23:10:26 brianp Exp $ */
+/* $Id: s_feedback.c,v 1.4 2001/01/05 02:26:49 keithw Exp $ */
/*
* Mesa 3-D graphics library
feedback_vertex( ctx, v1, v1 );
feedback_vertex( ctx, v2, v2 );
} else {
- feedback_vertex( ctx, v0, v0 );
- feedback_vertex( ctx, v1, v0 );
- feedback_vertex( ctx, v2, v0 );
+ feedback_vertex( ctx, v0, v2 );
+ feedback_vertex( ctx, v1, v2 );
+ feedback_vertex( ctx, v2, v2 );
}
}
}
feedback_vertex( ctx, v0, v0 );
feedback_vertex( ctx, v1, v1 );
} else {
- feedback_vertex( ctx, v0, v0 );
- feedback_vertex( ctx, v1, v0 );
+ feedback_vertex( ctx, v0, v1 );
+ feedback_vertex( ctx, v1, v1 );
}
swrast->StippleCounter++;
-/* $Id: s_triangle.c,v 1.7 2000/12/12 00:31:45 brianp Exp $ */
+/* $Id: s_triangle.c,v 1.8 2001/01/05 02:26:49 keithw Exp $ */
/*
* Mesa 3-D graphics library
fffog += fdfogdx; \
} \
gl_write_monocolor_span( ctx, n, LEFT, Y, zspan, \
- fogspan, v0->color, \
+ fogspan, v2->color, \
GL_POLYGON ); \
} \
}
GLboolean flat_shade = (ctx->Light.ShadeModel==GL_FLAT); \
GLint r, g, b, a; \
if (flat_shade) { \
- r = v0->color[0]; \
- g = v0->color[1]; \
- b = v0->color[2]; \
- a = v0->color[3]; \
+ r = v2->color[0]; \
+ g = v2->color[1]; \
+ b = v2->color[2]; \
+ a = v2->color[3]; \
}
#define INNER_LOOP( LEFT, RIGHT, Y ) \
{ \
GLboolean flat_shade = (ctx->Light.ShadeModel==GL_FLAT); \
GLint r, g, b, a, sr, sg, sb; \
if (flat_shade) { \
- r = v0->color[0]; \
- g = v0->color[1]; \
- b = v0->color[2]; \
- a = v0->color[3]; \
- sr = v0->specular[0]; \
- sg = v0->specular[1]; \
- sb = v0->specular[2]; \
+ r = v2->color[0]; \
+ g = v2->color[1]; \
+ b = v2->color[2]; \
+ a = v2->color[3]; \
+ sr = v2->specular[0]; \
+ sg = v2->specular[1]; \
+ sb = v2->specular[2]; \
}
#define INNER_LOOP( LEFT, RIGHT, Y ) \
{ \
const GLboolean flat_shade = (ctx->Light.ShadeModel==GL_FLAT); \
GLint r, g, b, a; \
if (flat_shade) { \
- r = v0->color[0]; \
- g = v0->color[1]; \
- b = v0->color[2]; \
- a = v0->color[3]; \
+ r = v2->color[0]; \
+ g = v2->color[1]; \
+ b = v2->color[2]; \
+ a = v2->color[3]; \
}
#define INNER_LOOP( LEFT, RIGHT, Y ) \
const GLboolean flat_shade = (ctx->Light.ShadeModel==GL_FLAT); \
GLint r, g, b, a, sr, sg, sb; \
if (flat_shade) { \
- r = v0->color[0]; \
- g = v0->color[1]; \
- b = v0->color[2]; \
- a = v0->color[3]; \
- sr = v0->specular[0]; \
- sg = v0->specular[1]; \
- sb = v0->specular[2]; \
+ r = v2->color[0]; \
+ g = v2->color[1]; \
+ b = v2->color[2]; \
+ a = v2->color[3]; \
+ sr = v2->specular[0]; \
+ sg = v2->specular[1]; \
+ sb = v2->specular[2]; \
}
#define INNER_LOOP( LEFT, RIGHT, Y ) \
GLfloat twidth[MAX_TEXTURE_UNITS], theight[MAX_TEXTURE_UNITS]; \
GLint r, g, b, a; \
if (flat_shade) { \
- r = v0->color[0]; \
- g = v0->color[1]; \
- b = v0->color[2]; \
- a = v0->color[3]; \
+ r = v2->color[0]; \
+ g = v2->color[1]; \
+ b = v2->color[2]; \
+ a = v2->color[3]; \
} \
{ \
GLuint unit; \
/* These will always render the correct point/line/triangle for the
* current state.
+ *
+ * For flatshaded primitives, the provoking vertex is the final one.
*/
extern void
_swrast_Point( GLcontext *ctx, const SWvertex *v );
extern void
_swrast_allow_pixel_fog( GLcontext *ctx, GLboolean value );
+/* Debug:
+ */
extern void
_swrast_print_vertex( GLcontext *ctx, const SWvertex *v );
-/* $Id: ss_context.c,v 1.5 2000/12/26 05:09:32 keithw Exp $ */
+/* $Id: ss_context.c,v 1.6 2001/01/05 02:26:49 keithw Exp $ */
/*
* Mesa 3-D graphics library
*/
static void
_swsetup_validate_quad( GLcontext *ctx, GLuint v0, GLuint v1,
- GLuint v2, GLuint v3, GLuint pv )
+ GLuint v2, GLuint v3 )
{
_swsetup_choose_trifuncs( ctx );
- SWSETUP_CONTEXT(ctx)->Quad( ctx, v0, v1, v2, v3, pv );
+ SWSETUP_CONTEXT(ctx)->Quad( ctx, v0, v1, v2, v3 );
}
static void
-_swsetup_validate_triangle( GLcontext *ctx, GLuint v0, GLuint v1,
- GLuint v2, GLuint pv )
+_swsetup_validate_triangle( GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2 )
{
_swsetup_choose_trifuncs( ctx );
- SWSETUP_CONTEXT(ctx)->Triangle( ctx, v0, v1, v2, pv );
+ SWSETUP_CONTEXT(ctx)->Triangle( ctx, v0, v1, v2 );
}
static void
-_swsetup_validate_line( GLcontext *ctx, GLuint v0, GLuint v1, GLuint pv )
+_swsetup_validate_line( GLcontext *ctx, GLuint v0, GLuint v1 )
{
_swsetup_choose_trifuncs( ctx );
- SWSETUP_CONTEXT(ctx)->Line( ctx, v0, v1, pv );
+ SWSETUP_CONTEXT(ctx)->Line( ctx, v0, v1 );
}
*/
void
_swsetup_Quad( GLcontext *ctx, GLuint v0, GLuint v1,
- GLuint v2, GLuint v3, GLuint pv )
+ GLuint v2, GLuint v3 )
{
- SWSETUP_CONTEXT(ctx)->Quad( ctx, v0, v1, v2, v3, pv );
+ SWSETUP_CONTEXT(ctx)->Quad( ctx, v0, v1, v2, v3 );
}
void
_swsetup_Triangle( GLcontext *ctx, GLuint v0, GLuint v1,
- GLuint v2, GLuint pv )
+ GLuint v2 )
{
- SWSETUP_CONTEXT(ctx)->Triangle( ctx, v0, v1, v2, pv );
+ SWSETUP_CONTEXT(ctx)->Triangle( ctx, v0, v1, v2 );
}
void
-_swsetup_Line( GLcontext *ctx, GLuint v0, GLuint v1, GLuint pv )
+_swsetup_Line( GLcontext *ctx, GLuint v0, GLuint v1 )
{
- SWSETUP_CONTEXT(ctx)->Line( ctx, v0, v1, pv );
+ SWSETUP_CONTEXT(ctx)->Line( ctx, v0, v1 );
}
GLuint start, GLuint end, GLuint new_inputs );
void (*Quad)( GLcontext *ctx, GLuint v0, GLuint v1,
- GLuint v2, GLuint v3, GLuint pv );
+ GLuint v2, GLuint v3 );
void (*Triangle)( GLcontext *ctx, GLuint v0, GLuint v1,
- GLuint v2, GLuint pv );
+ GLuint v2 );
- void (*Line)( GLcontext *ctx, GLuint v0, GLuint v1, GLuint pv );
+ void (*Line)( GLcontext *ctx, GLuint v0, GLuint v1 );
void (*Points)( GLcontext *ctx, GLuint first, GLuint last );
#include "ss_triangle.h"
#include "ss_context.h"
-#define SS_FLAT_BIT 0x1
+#define SS_RGBA_BIT 0x1
#define SS_OFFSET_BIT 0x2
#define SS_TWOSIDE_BIT 0x4
-#define SS_UNFILLED_BIT 0x10
-#define SS_RGBA_BIT 0x20
-#define SS_MAX_TRIFUNC 0x80
+#define SS_UNFILLED_BIT 0x8
+#define SS_MAX_TRIFUNC 0x10
static triangle_func tri_tab[SS_MAX_TRIFUNC];
-static line_func line_tab[SS_MAX_TRIFUNC];
static quad_func quad_tab[SS_MAX_TRIFUNC];
#define TAG(x) x
#include "ss_tritmp.h"
-#define IND (SS_FLAT_BIT)
-#define TAG(x) x##_flat
-#include "ss_tritmp.h"
-
#define IND (SS_OFFSET_BIT)
#define TAG(x) x##_offset
#include "ss_tritmp.h"
-#define IND (SS_FLAT_BIT|SS_OFFSET_BIT)
-#define TAG(x) x##_flat_offset
-#include "ss_tritmp.h"
-
#define IND (SS_TWOSIDE_BIT)
#define TAG(x) x##_twoside
#include "ss_tritmp.h"
-#define IND (SS_FLAT_BIT|SS_TWOSIDE_BIT)
-#define TAG(x) x##_flat_twoside
-#include "ss_tritmp.h"
-
#define IND (SS_OFFSET_BIT|SS_TWOSIDE_BIT)
#define TAG(x) x##_offset_twoside
#include "ss_tritmp.h"
-#define IND (SS_FLAT_BIT|SS_OFFSET_BIT|SS_TWOSIDE_BIT)
-#define TAG(x) x##_flat_offset_twoside
-#include "ss_tritmp.h"
-
#define IND (SS_UNFILLED_BIT)
#define TAG(x) x##_unfilled
#include "ss_tritmp.h"
-#define IND (SS_FLAT_BIT|SS_UNFILLED_BIT)
-#define TAG(x) x##_flat_unfilled
-#include "ss_tritmp.h"
-
#define IND (SS_OFFSET_BIT|SS_UNFILLED_BIT)
#define TAG(x) x##_offset_unfilled
#include "ss_tritmp.h"
-#define IND (SS_FLAT_BIT|SS_OFFSET_BIT|SS_UNFILLED_BIT)
-#define TAG(x) x##_flat_offset_unfilled
-#include "ss_tritmp.h"
-
#define IND (SS_TWOSIDE_BIT|SS_UNFILLED_BIT)
#define TAG(x) x##_twoside_unfilled
#include "ss_tritmp.h"
-#define IND (SS_FLAT_BIT|SS_TWOSIDE_BIT|SS_UNFILLED_BIT)
-#define TAG(x) x##_flat_twoside_unfilled
-#include "ss_tritmp.h"
-
#define IND (SS_OFFSET_BIT|SS_TWOSIDE_BIT|SS_UNFILLED_BIT)
#define TAG(x) x##_offset_twoside_unfilled
#include "ss_tritmp.h"
-#define IND (SS_FLAT_BIT|SS_OFFSET_BIT|SS_TWOSIDE_BIT|SS_UNFILLED_BIT)
-#define TAG(x) x##_flat_offset_twoside_unfilled
-#include "ss_tritmp.h"
-
#define IND (0|SS_RGBA_BIT)
#define TAG(x) x##_rgba
#include "ss_tritmp.h"
-#define IND (SS_FLAT_BIT|SS_RGBA_BIT)
-#define TAG(x) x##_flat_rgba
-#include "ss_tritmp.h"
-
#define IND (SS_OFFSET_BIT|SS_RGBA_BIT)
#define TAG(x) x##_offset_rgba
#include "ss_tritmp.h"
-#define IND (SS_FLAT_BIT|SS_OFFSET_BIT|SS_RGBA_BIT)
-#define TAG(x) x##_flat_offset_rgba
-#include "ss_tritmp.h"
-
#define IND (SS_TWOSIDE_BIT|SS_RGBA_BIT)
#define TAG(x) x##_twoside_rgba
#include "ss_tritmp.h"
-#define IND (SS_FLAT_BIT|SS_TWOSIDE_BIT|SS_RGBA_BIT)
-#define TAG(x) x##_flat_twoside_rgba
-#include "ss_tritmp.h"
-
#define IND (SS_OFFSET_BIT|SS_TWOSIDE_BIT|SS_RGBA_BIT)
#define TAG(x) x##_offset_twoside_rgba
#include "ss_tritmp.h"
-#define IND (SS_FLAT_BIT|SS_OFFSET_BIT|SS_TWOSIDE_BIT|SS_RGBA_BIT)
-#define TAG(x) x##_flat_offset_twoside_rgba
-#include "ss_tritmp.h"
-
#define IND (SS_UNFILLED_BIT|SS_RGBA_BIT)
#define TAG(x) x##_unfilled_rgba
#include "ss_tritmp.h"
-#define IND (SS_FLAT_BIT|SS_UNFILLED_BIT|SS_RGBA_BIT)
-#define TAG(x) x##_flat_unfilled_rgba
-#include "ss_tritmp.h"
-
#define IND (SS_OFFSET_BIT|SS_UNFILLED_BIT|SS_RGBA_BIT)
#define TAG(x) x##_offset_unfilled_rgba
#include "ss_tritmp.h"
-#define IND (SS_FLAT_BIT|SS_OFFSET_BIT|SS_UNFILLED_BIT|SS_RGBA_BIT)
-#define TAG(x) x##_flat_offset_unfilled_rgba
-#include "ss_tritmp.h"
-
#define IND (SS_TWOSIDE_BIT|SS_UNFILLED_BIT|SS_RGBA_BIT)
#define TAG(x) x##_twoside_unfilled_rgba
#include "ss_tritmp.h"
-#define IND (SS_FLAT_BIT|SS_TWOSIDE_BIT|SS_UNFILLED_BIT|SS_RGBA_BIT)
-#define TAG(x) x##_flat_twoside_unfilled_rgba
-#include "ss_tritmp.h"
-
#define IND (SS_OFFSET_BIT|SS_TWOSIDE_BIT|SS_UNFILLED_BIT|SS_RGBA_BIT)
#define TAG(x) x##_offset_twoside_unfilled_rgba
#include "ss_tritmp.h"
-#define IND (SS_FLAT_BIT|SS_OFFSET_BIT|SS_TWOSIDE_BIT|SS_UNFILLED_BIT|SS_RGBA_BIT)
-#define TAG(x) x##_flat_offset_twoside_unfilled_rgba
-#include "ss_tritmp.h"
-
void _swsetup_trifuncs_init( GLcontext *ctx )
{
(void) ctx;
init();
- init_flat();
init_offset();
- init_flat_offset();
init_twoside();
- init_flat_twoside();
init_offset_twoside();
- init_flat_offset_twoside();
init_unfilled();
- init_flat_unfilled();
init_offset_unfilled();
- init_flat_offset_unfilled();
init_twoside_unfilled();
- init_flat_twoside_unfilled();
init_offset_twoside_unfilled();
- init_flat_offset_twoside_unfilled();
init_rgba();
- init_flat_rgba();
init_offset_rgba();
- init_flat_offset_rgba();
init_twoside_rgba();
- init_flat_twoside_rgba();
init_offset_twoside_rgba();
- init_flat_offset_twoside_rgba();
init_unfilled_rgba();
- init_flat_unfilled_rgba();
init_offset_unfilled_rgba();
- init_flat_offset_unfilled_rgba();
init_twoside_unfilled_rgba();
- init_flat_twoside_unfilled_rgba();
init_offset_twoside_unfilled_rgba();
- init_flat_offset_twoside_unfilled_rgba();
}
}
}
+static void swsetup_line( GLcontext *ctx, GLuint v0, GLuint v1 )
+{
+ SWvertex *verts = SWSETUP_CONTEXT(ctx)->verts;
+ _swrast_Line( ctx, &verts[v0], &verts[v1] );
+}
+
+
+
void _swsetup_choose_trifuncs( GLcontext *ctx )
{
SScontext *swsetup = SWSETUP_CONTEXT(ctx);
GLuint ind = 0;
- if (ctx->Light.ShadeModel == GL_FLAT)
- ind |= SS_FLAT_BIT;
-
if (ctx->Polygon._OffsetAny)
ind |= SS_OFFSET_BIT;
ind |= SS_RGBA_BIT;
swsetup->Triangle = tri_tab[ind];
- swsetup->Line = line_tab[ind];
swsetup->Quad = quad_tab[ind];
+ swsetup->Line = swsetup_line;
swsetup->Points = swsetup_points;
}
*/
-static void TAG(triangle)(GLcontext *ctx,
- GLuint e0, GLuint e1, GLuint e2,
- GLuint pv)
+static void TAG(triangle)(GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 )
{
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
SWvertex *verts = SWSETUP_CONTEXT(ctx)->verts;
SWvertex *v[3];
- GLfloat offset;
GLfloat z[3];
- GLubyte c[3][4], s[3][4];
- GLuint i[3];
+ GLfloat offset;
GLenum mode = GL_FILL;
+ GLuint facing;
v[0] = &verts[e0];
v[1] = &verts[e1];
v[2] = &verts[e2];
- if (IND & (SS_TWOSIDE_BIT | SS_FLAT_BIT)) {
- if (IND & SS_RGBA_BIT) {
- SS_COLOR(c[0], v[0]->color);
- SS_SPEC(s[0], v[0]->specular);
-
- if (IND & SS_TWOSIDE_BIT) {
- SS_COLOR(c[1], v[1]->color);
- SS_COLOR(c[2], v[2]->color);
-
- SS_SPEC(s[1], v[1]->specular);
- SS_SPEC(s[2], v[2]->specular);
- }
- } else {
- SS_IND(i[0], v[0]->index);
-
- if (IND & SS_TWOSIDE_BIT) {
- SS_IND(i[1], v[1]->index);
- SS_IND(i[2], v[2]->index);
- }
- }
- }
if (IND & (SS_TWOSIDE_BIT | SS_OFFSET_BIT | SS_UNFILLED_BIT))
{
if (IND & (SS_TWOSIDE_BIT | SS_UNFILLED_BIT))
{
- GLuint facing = (cc < 0.0) ^ ctx->Polygon._FrontBit;
+ facing = (cc < 0.0) ^ ctx->Polygon._FrontBit;
if (IND & SS_UNFILLED_BIT)
mode = facing ? ctx->Polygon.BackMode : ctx->Polygon.FrontMode;
- if (IND & SS_TWOSIDE_BIT) {
- if (IND & SS_FLAT_BIT) {
+ if (facing == 1) {
+ if (IND & SS_TWOSIDE_BIT) {
if (IND & SS_RGBA_BIT) {
- GLubyte (*vbcolor)[4] = VB->ColorPtr[facing]->data;
- GLubyte (*vbspec)[4] = VB->SecondaryColorPtr[facing]->data;
-
- SS_COLOR(v[0]->color, vbcolor[pv]);
- SS_COLOR(v[1]->color, vbcolor[pv]);
- SS_COLOR(v[2]->color, vbcolor[pv]);
-
- SS_SPEC(v[0]->specular, vbspec[pv]);
- SS_SPEC(v[1]->specular, vbspec[pv]);
- SS_SPEC(v[2]->specular, vbspec[pv]);
- } else {
- GLuint *vbindex = VB->IndexPtr[facing]->data;
-
- SS_IND(v[0]->index, vbindex[pv]);
- SS_IND(v[1]->index, vbindex[pv]);
- SS_IND(v[2]->index, vbindex[pv]);
- }
- } else {
- if (IND & SS_RGBA_BIT) {
- GLubyte (*vbcolor)[4] = VB->ColorPtr[facing]->data;
- GLubyte (*vbspec)[4] = VB->SecondaryColorPtr[facing]->data;
-
+ GLubyte (*vbcolor)[4] = VB->ColorPtr[1]->data;
+ GLubyte (*vbspec)[4] = VB->SecondaryColorPtr[1]->data;
SS_COLOR(v[0]->color, vbcolor[e0]);
SS_COLOR(v[1]->color, vbcolor[e1]);
SS_COLOR(v[2]->color, vbcolor[e2]);
-
SS_SPEC(v[0]->specular, vbspec[e0]);
SS_SPEC(v[1]->specular, vbspec[e1]);
SS_SPEC(v[2]->specular, vbspec[e2]);
} else {
- GLuint *vbindex = VB->IndexPtr[facing]->data;
-
+ GLuint *vbindex = VB->IndexPtr[1]->data;
SS_IND(v[0]->index, vbindex[e0]);
SS_IND(v[1]->index, vbindex[e1]);
SS_IND(v[2]->index, vbindex[e2]);
}
}
}
- else if (IND & SS_FLAT_BIT)
- {
- if (IND & SS_RGBA_BIT) {
- GLubyte *color = VB->ColorPtr[0]->data[pv];
- GLubyte *spec = VB->SecondaryColorPtr[0]->data[pv];
-
- SS_COLOR(v[0]->color, color);
- SS_SPEC(v[0]->specular, spec);
- }
- else {
- GLuint index = VB->IndexPtr[0]->data[pv];
- SS_IND(v[0]->index, index);
- }
- }
if (mode == GL_POINT) {
- GLubyte *ef = VB->EdgeFlagPtr->data;
+ GLubyte *ef = VB->EdgeFlag;
if ((IND & SS_OFFSET_BIT) && ctx->Polygon.OffsetPoint) {
v[0]->win[2] += offset;
v[1]->win[2] += offset;
if (ef[e1]) _swrast_Point( ctx, v[1] );
if (ef[e2]) _swrast_Point( ctx, v[2] );
} else if (mode == GL_LINE) {
- GLubyte *ef = VB->EdgeFlagPtr->data;
+ GLubyte *ef = VB->EdgeFlag;
if ((IND & SS_OFFSET_BIT) && ctx->Polygon.OffsetLine) {
v[0]->win[2] += offset;
v[1]->win[2] += offset;
v[2]->win[2] = z[2];
}
- if (IND & (SS_FLAT_BIT | SS_TWOSIDE_BIT)) {
- if (IND & SS_RGBA_BIT) {
- SS_COLOR(v[0]->color, c[0]);
- SS_SPEC(v[0]->specular, s[0]);
-
- if (IND & SS_TWOSIDE_BIT) {
- SS_COLOR(v[1]->color, c[1]);
- SS_COLOR(v[2]->color, c[2]);
- SS_SPEC(v[1]->specular, s[1]);
- SS_SPEC(v[2]->specular, s[2]);
- }
- }
- else {
- SS_IND(v[0]->index, i[0]);
-
- if (IND & SS_TWOSIDE_BIT) {
- SS_IND(v[1]->index, i[1]);
- SS_IND(v[2]->index, i[2]);
+ if (IND & SS_TWOSIDE_BIT) {
+ if (facing == 1) {
+ if (IND & SS_RGBA_BIT) {
+ GLubyte (*vbcolor)[4] = VB->ColorPtr[0]->data;
+ GLubyte (*vbspec)[4] = VB->SecondaryColorPtr[0]->data;
+ SS_COLOR(v[0]->color, vbcolor[e0]);
+ SS_COLOR(v[1]->color, vbcolor[e1]);
+ SS_COLOR(v[2]->color, vbcolor[e2]);
+ SS_SPEC(v[0]->specular, vbspec[e0]);
+ SS_SPEC(v[1]->specular, vbspec[e1]);
+ SS_SPEC(v[2]->specular, vbspec[e2]);
+ } else {
+ GLuint *vbindex = VB->IndexPtr[0]->data;
+ SS_IND(v[0]->index, vbindex[e0]);
+ SS_IND(v[1]->index, vbindex[e1]);
+ SS_IND(v[2]->index, vbindex[e2]);
}
}
- }
+ }
}
/* Need to do something with edgeflags:
*/
static void TAG(quad)( GLcontext *ctx, GLuint v0,
- GLuint v1, GLuint v2, GLuint v3,
- GLuint pv )
+ GLuint v1, GLuint v2, GLuint v3 )
{
if (IND & SS_UNFILLED_BIT) {
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
- GLubyte ef1 = VB->EdgeFlagPtr->data[v1];
- GLubyte ef3 = VB->EdgeFlagPtr->data[v3];
- VB->EdgeFlagPtr->data[v1] = 0;
- TAG(triangle)( ctx, v0, v1, v3, pv );
- VB->EdgeFlagPtr->data[v1] = ef1;
- VB->EdgeFlagPtr->data[v3] = 0;
- TAG(triangle)( ctx, v1, v2, v3, pv );
- VB->EdgeFlagPtr->data[v3] = ef3;
+ GLubyte ef1 = VB->EdgeFlag[v1];
+ GLubyte ef3 = VB->EdgeFlag[v3];
+ VB->EdgeFlag[v1] = 0;
+ TAG(triangle)( ctx, v0, v1, v3 );
+ VB->EdgeFlag[v1] = ef1;
+ VB->EdgeFlag[v3] = 0;
+ TAG(triangle)( ctx, v1, v2, v3 );
+ VB->EdgeFlag[v3] = ef3;
} else {
- TAG(triangle)( ctx, v0, v1, v3, pv );
- TAG(triangle)( ctx, v1, v2, v3, pv );
+ TAG(triangle)( ctx, v0, v1, v3 );
+ TAG(triangle)( ctx, v1, v2, v3 );
}
}
-static void TAG(line)( GLcontext *ctx, GLuint v0, GLuint v1, GLuint pv )
-{
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
- SWvertex *verts = SWSETUP_CONTEXT(ctx)->verts;
- GLubyte c[2][4], s[2][4];
- GLuint i[2];
- SWvertex *vert0 = &verts[v0];
- SWvertex *vert1 = &verts[v1];
-
-
- if (IND & SS_FLAT_BIT) {
- if (IND & SS_RGBA_BIT) {
- GLubyte *color = VB->ColorPtr[0]->data[pv];
- GLubyte *spec = VB->SecondaryColorPtr[0]->data[pv];
-
- SS_COLOR(c[0], vert0->color);
- SS_COLOR(vert0->color, color);
-
- SS_SPEC(s[0], vert0->specular);
- SS_SPEC(vert0->specular, spec);
- }
- else {
- GLuint index = VB->IndexPtr[0]->data[pv];
-
- SS_IND(i[0], vert0->index);
- SS_IND(vert0->index, index);
- }
- }
-
- _swrast_Line( ctx, vert0, vert1 );
-
- if (IND & SS_FLAT_BIT) {
- if (IND & SS_RGBA_BIT) {
- SS_COLOR(vert0->color, c[0]);
- SS_SPEC(vert0->specular, s[0]);
- }
- else {
- SS_IND(vert0->index, i[0]);
- }
- }
-}
-
static void TAG(init)( void )
{
tri_tab[IND] = TAG(triangle);
quad_tab[IND] = TAG(quad);
- line_tab[IND] = TAG(line);
}
GLuint new_inputs );
extern void
-_swsetup_Quad( GLcontext *ctx, GLuint v0, GLuint v1,
- GLuint v2, GLuint v3, GLuint pv );
+_swsetup_Quad( GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3 );
extern void
-_swsetup_Triangle( GLcontext *ctx, GLuint v0, GLuint v1,
- GLuint v2, GLuint pv );
-
+_swsetup_Triangle( GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2 );
extern void
-_swsetup_Line( GLcontext *ctx, GLuint v0, GLuint v1, GLuint pv );
-
+_swsetup_Line( GLcontext *ctx, GLuint v0, GLuint v1 );
extern void
_swsetup_Points( GLcontext *ctx, GLuint first, GLuint last );
-extern void
-_swsetup_IndexedPoints( GLcontext *ctx, GLuint first, GLuint last );
-
#endif
-/* $Id: t_array_import.c,v 1.3 2000/12/28 22:11:05 keithw Exp $ */
+/* $Id: t_array_import.c,v 1.4 2001/01/05 02:26:49 keithw Exp $ */
/*
* Mesa 3-D graphics library
_tnl_import_texcoord( ctx, i, writeable, stride );
}
- if ((required & VERT_EDGE) && (VB->EdgeFlagPtr->flags & flags)) {
- ASSERT(VB->EdgeFlagPtr == &inputs->EdgeFlag);
- _tnl_import_edgeflag( ctx, writeable, stride );
- }
-
VB->importable_data &= ~required;
}
}
if (inputs & VERT_EDGE) {
- if (imports & VERT_EDGE) {
- _tnl_import_edgeflag( ctx, 0, 0 );
- tmp->EdgeFlag.count = VB->Count;
- }
- VB->EdgeFlagPtr = &tmp->EdgeFlag;
+ _tnl_import_edgeflag( ctx, GL_TRUE, sizeof(GLboolean) );
+ VB->EdgeFlag = (GLboolean *) tmp->EdgeFlag.data;
}
if (inputs & VERT_SPEC_RGB) {
-/* $Id: t_context.c,v 1.7 2000/12/26 05:09:32 keithw Exp $ */
+/* $Id: t_context.c,v 1.8 2001/01/05 02:26:49 keithw Exp $ */
/*
* Mesa 3-D graphics library
ctx->Driver.MakeCurrent = _tnl_MakeCurrent;
ctx->Driver.BeginCallList = _tnl_BeginCallList;
ctx->Driver.EndCallList = _tnl_EndCallList;
+
+ ctx->Driver.RenderTabElts = _tnl_render_tab_elts;
+ ctx->Driver.RenderTabVerts = _tnl_render_tab_verts;
}
/* Set a few default values in the driver struct.
*/
install_driver_callbacks(ctx);
- ctx->Driver.NeedFlush = FLUSH_UPDATE_CURRENT|FLUSH_STORED_VERTICES;
+ ctx->Driver.NeedFlush = FLUSH_UPDATE_CURRENT;
ctx->Driver.CurrentExecPrimitive = PRIM_OUTSIDE_BEGIN_END;
ctx->Driver.CurrentSavePrimitive = PRIM_UNKNOWN;
-/* $Id: t_context.h,v 1.8 2000/12/27 22:30:29 keithw Exp $ */
+/* $Id: t_context.h,v 1.9 2001/01/05 02:26:49 keithw Exp $ */
/*
* Mesa 3-D graphics library
typedef struct gl_material GLmaterial;
+typedef void (*interp_func)( GLcontext *ctx,
+ GLfloat t, GLuint dst, GLuint in, GLuint out,
+ GLboolean force_boundary );
+
+typedef void (*copy_pv_func)( GLcontext *ctx, GLuint dst, GLuint src );
+
/* Contains the current state of a running pipeline.
*/
typedef struct vertex_buffer
GLubyte *ClipMask; /* VERT_CLIP (4) */
GLvector3f *NormalPtr; /* VERT_NORM */
GLfloat *NormalLengthPtr; /* VERT_NORM (optional) */
- GLvector1ub *EdgeFlagPtr; /* VERT_EDGE */
+ GLboolean *EdgeFlag; /* VERT_EDGE */
GLvector4f *TexCoordPtr[MAX_TEXTURE_UNITS]; /* VERT_TEX_0..n */
GLvector1ui *IndexPtr[2]; /* VERT_INDEX */
GLvector4ub *ColorPtr[2]; /* VERT_RGBA */
*/
GLuint LastClipped;
- void *interpfunc;
- /* Two pieces of private data from _tnl_render_stage that have no
- * business being in this struct.
+ interp_func interpfunc;
+ copy_pv_func copypvfunc;
+ /* Private data from _tnl_render_stage that has no business being
+ * in this struct.
*/
} TNLvertexbuffer;
IM->FlushElt = 0;
}
- ctx->Driver.NeedFlush |= FLUSH_STORED_VERTICES;
+/* ctx->Driver.NeedFlush |= FLUSH_STORED_VERTICES; */
}
IM->BeginState = state;
-/* $Id: t_imm_exec.c,v 1.4 2000/12/28 22:11:05 keithw Exp $ */
+/* $Id: t_imm_exec.c,v 1.5 2001/01/05 02:26:49 keithw Exp $ */
/*
* Mesa 3-D graphics library
VB->NormalPtr = 0;
VB->NormalLengthPtr = 0;
VB->FogCoordPtr = 0;
- VB->EdgeFlagPtr = 0;
+ VB->EdgeFlag = 0;
VB->IndexPtr[0] = 0;
VB->IndexPtr[1] = 0;
VB->ColorPtr[0] = 0;
}
if (inputs & VERT_EDGE) {
- tmp->EdgeFlag.data = IM->EdgeFlag + start;
- tmp->EdgeFlag.start = IM->EdgeFlag + start;
- tmp->EdgeFlag.count = count;
- VB->EdgeFlagPtr = &tmp->EdgeFlag;
+ VB->EdgeFlag = IM->EdgeFlag + start;
}
if (inputs & VERT_RGBA) {
*/
_tnl_copy_immediate_vertices( ctx, IM );
-/* if (ctx->Driver.CurrentExecPrimitive == GL_POLYGON+1) */
-/* ctx->Driver.NeedFlush &= ~FLUSH_STORED_VERTICES; */
+ if (ctx->Driver.CurrentExecPrimitive == GL_POLYGON+1)
+ ctx->Driver.NeedFlush &= ~FLUSH_STORED_VERTICES;
}
-/* $Id: t_pipeline.h,v 1.4 2000/12/26 05:09:33 keithw Exp $ */
+/* $Id: t_pipeline.h,v 1.5 2001/01/05 02:26:49 keithw Exp $ */
/*
* Mesa 3-D graphics library
*/
extern const struct gl_pipeline_stage *_tnl_default_pipeline[];
+
+/* Convenience routines provided by t_vb_render.c:
+ */
+extern render_func _tnl_render_tab_elts[];
+extern render_func _tnl_render_tab_verts[];
+
#endif
-/* $Id: t_vb_cliptmp.h,v 1.4 2000/12/28 22:11:05 keithw Exp $ */
+/* $Id: t_vb_cliptmp.h,v 1.5 2001/01/05 02:26:49 keithw Exp $ */
/*
* Mesa 3-D graphics library
*/
-#define INSIDE( J ) !NEGATIVE(J)
-#define OUTSIDE( J ) NEGATIVE(J)
+#define CLIP_DOTPROD(K, A, B, C, D) X(K)*A + Y(K)*B + Z(K)*C + W(K)*D
-
-
-
-static GLuint TAG(userclip_line)( GLcontext *ctx,
- GLuint *i, GLuint *j,
- interp_func interp )
-{
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
- GLfloat (*coord)[4] = VB->ClipPtr->data;
- GLuint ii = *i;
- GLuint jj = *j;
- GLuint p;
-
- for (p=0;p<MAX_CLIP_PLANES;p++) {
- if (ctx->Transform.ClipEnabled[p]) {
- GLfloat a = ctx->Transform._ClipUserPlane[p][0];
- GLfloat b = ctx->Transform._ClipUserPlane[p][1];
- GLfloat c = ctx->Transform._ClipUserPlane[p][2];
- GLfloat d = ctx->Transform._ClipUserPlane[p][3];
-
- GLfloat dpI = d*W(ii) + c*Z(ii) + b*Y(ii) + a*X(ii);
- GLfloat dpJ = d*W(jj) + c*Z(jj) + b*Y(jj) + a*X(jj);
-
- GLuint flagI = OUTSIDE( dpI );
- GLuint flagJ = OUTSIDE( dpJ );
-
- if (flagI ^ flagJ) {
- if (flagJ) {
- GLfloat t = dpI / (dpI - dpJ);
- VB->ClipMask[jj] |= CLIP_USER_BIT;
- jj = interp( ctx, t, ii, jj, GL_FALSE );
- VB->ClipMask[jj] = 0;
- } else {
- GLfloat t = dpJ / (dpJ - dpI);
- VB->ClipMask[ii] |= CLIP_USER_BIT;
- ii = interp( ctx, t, jj, ii, GL_FALSE );
- VB->ClipMask[ii] = 0;
- }
- }
- else if (flagI)
- return 0;
- }
- }
-
- *i = ii;
- *j = jj;
- return 1;
-}
-
-
-static GLuint TAG(userclip_polygon)( GLcontext *ctx,
- GLuint n,
- GLuint vlist[],
- interp_func interp )
-{
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
- GLfloat (*coord)[4] = VB->ClipPtr->data;
- GLuint vlist2[MAX_CLIPPED_VERTICES];
- GLuint *inlist = vlist, *outlist = vlist2;
- GLubyte *clipmask = VB->ClipMask;
- GLuint p;
-
-#define CLIP_DOTPROD(xx) d*W(xx) + c*Z(xx) + b*Y(xx) + a*X(xx)
-
- /* Can be speeded up to if vertex_stage actually saves the
- * UserClipMask, and if it is used in this loop (after computing a
- * UserClipOrMask).
- */
- for (p=0;p<MAX_CLIP_PLANES;p++) {
- if (ctx->Transform.ClipEnabled[p]) {
- register float a = ctx->Transform._ClipUserPlane[p][0];
- register float b = ctx->Transform._ClipUserPlane[p][1];
- register float c = ctx->Transform._ClipUserPlane[p][2];
- register float d = ctx->Transform._ClipUserPlane[p][3];
-
- /* initialize prev to be last in the input list */
- GLuint idxPrev = inlist[n-1];
- GLfloat dpPrev = CLIP_DOTPROD(idxPrev);
- GLuint outcount = 0;
- GLuint i;
-
- for (i = 0 ; i < n ; i++) {
- GLuint idx = inlist[i];
- GLfloat dp = CLIP_DOTPROD(idx);
-
- if (!NEGATIVE(dpPrev)) {
- outlist[outcount++] = idxPrev;
- clipmask[idxPrev] &= ~CLIP_USER_BIT;
- } else {
- clipmask[idxPrev] |= CLIP_USER_BIT;
- }
-
-
- if (DIFFERENT_SIGNS(dp, dpPrev)) {
- GLuint newvert;
- if (NEGATIVE(dp)) {
- /* Going out of bounds. Avoid division by zero as we
- * know dp != dpPrev from DIFFERENT_SIGNS, above.
- */
- GLfloat t = dp / (dp - dpPrev);
- newvert = interp( ctx, t, idx, idxPrev, GL_TRUE );
- } else {
- /* Coming back in.
- */
- GLfloat t = dpPrev / (dpPrev - dp);
- newvert = interp( ctx, t, idxPrev, idx, GL_FALSE );
- }
- clipmask[newvert] = 0;
- outlist[outcount++] = newvert;
- }
-
- idxPrev = idx;
- dpPrev = dp;
- }
-
- if (outcount < 3)
- return 0;
-
- {
- GLuint *tmp;
- tmp = inlist;
- inlist = outlist;
- outlist = tmp;
- n = outcount;
- }
- } /* if */
- } /* for p */
-
- if (inlist!=vlist) {
- GLuint i;
- for (i = 0 ; i < n ; i++)
- vlist[i] = inlist[i];
- }
-
- return n;
-}
-
-
-/* This now calls the user clip functions if required.
- */
-static void TAG(viewclip_line)( GLcontext *ctx,
- GLuint i, GLuint j,
- GLubyte mask )
-{
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
- interp_func interp = (interp_func) VB->interpfunc;
- GLfloat (*coord)[4] = VB->ClipPtr->data;
- GLuint ii = i, jj = j;
- GLuint vlist[2];
- GLuint n;
-
- VB->LastClipped = VB->FirstClipped;
-
-/*
- * We use 6 instances of this code to clip against the 6 planes.
- */
-#define GENERAL_CLIP \
- if (mask & PLANE) { \
- GLfloat dpI = CLIP_DOTPROD( ii ); \
- GLfloat dpJ = CLIP_DOTPROD( jj ); \
- \
- if (DIFFERENT_SIGNS(dpI, dpJ)) { \
- if (NEGATIVE(dpJ)) { \
- GLfloat t = dpI / (dpI - dpJ); \
- VB->ClipMask[jj] |= PLANE; \
- jj = interp( ctx, t, ii, jj, GL_FALSE ); \
- VB->ClipMask[jj] = 0; \
- } else { \
- GLfloat t = dpJ / (dpJ - dpI); \
- VB->ClipMask[ii] |= PLANE; \
- ii = interp( ctx, t, jj, ii, GL_FALSE ); \
- VB->ClipMask[ii] = 0; \
- } \
- } \
- else if (NEGATIVE(dpI)) \
- return; \
- }
-
-#undef CLIP_DOTPROD
-#define PLANE CLIP_RIGHT_BIT
-#define CLIP_DOTPROD(K) (- X(K) + W(K))
-
- GENERAL_CLIP
-
-#undef CLIP_DOTPROD
-#undef PLANE
-#define PLANE CLIP_LEFT_BIT
-#define CLIP_DOTPROD(K) (X(K) + W(K))
-
- GENERAL_CLIP
-
-#undef CLIP_DOTPROD
-#undef PLANE
-#define PLANE CLIP_TOP_BIT
-#define CLIP_DOTPROD(K) (- Y(K) + W(K))
-
- GENERAL_CLIP
-
-#undef CLIP_DOTPROD
-#undef PLANE
-#define PLANE CLIP_BOTTOM_BIT
-#define CLIP_DOTPROD(K) (Y(K) + W(K))
-
- GENERAL_CLIP
-
-#undef CLIP_DOTPROD
-#undef PLANE
-#define PLANE CLIP_FAR_BIT
-#define CLIP_DOTPROD(K) (- Z(K) + W(K))
-
- if (SIZE >= 3) {
- GENERAL_CLIP
- }
-
-#undef CLIP_DOTPROD
-#undef PLANE
-#define PLANE CLIP_NEAR_BIT
-#define CLIP_DOTPROD(K) (Z(K) + W(K))
-
- if (SIZE >=3 ) {
- GENERAL_CLIP
- }
-
-#undef CLIP_DOTPROD
-#undef PLANE
-#undef GENERAL_CLIP
-
-
- if (mask & CLIP_USER_BIT) {
- if ( TAG(userclip_line)( ctx, &ii, &jj, interp ) == 0 )
- return;
- }
-
- vlist[0] = ii;
- vlist[1] = jj;
- n = 2;
-
- /* If necessary, project new vertices.
- */
- {
- GLuint i, j;
- GLfloat (*proj)[4] = VB->ProjectedClipPtr->data;
- GLuint start = VB->FirstClipped;
-
- for (i = 0; i < n; i++) {
- j = vlist[i];
- if (j >= start) {
- if (SIZE == 4 && W(j) != 0.0F) {
- GLfloat wInv = 1.0F / W(j);
- proj[j][0] = X(j) * wInv;
- proj[j][1] = Y(j) * wInv;
- proj[j][2] = Z(j) * wInv;
- proj[j][3] = wInv;
- } else {
- proj[j][0] = X(j);
- proj[j][1] = Y(j);
- proj[j][2] = Z(j);
- proj[j][3] = W(j);
- }
- }
- }
- }
-
- if (ctx->Driver.BuildProjectedVertices)
- ctx->Driver.BuildProjectedVertices(ctx,
- VB->FirstClipped,
- VB->LastClipped,
- ~0);
-
-
- /* Render the new line.
- */
- ctx->Driver.LineFunc( ctx, ii, jj, j );
-}
-
-/* We now clip polygon triangles individually. This is necessary to
- * avoid artifacts dependent on where the boundary of the VB falls
- * within the polygon. As a result, there is an upper bound on the
- * number of vertices which may be created, and the test against VB_SIZE
- * is redundant.
- */
-static void TAG(viewclip_polygon)( GLcontext *ctx,
- GLuint n, GLuint vlist[], GLuint pv,
- GLubyte mask )
-{
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
- interp_func interp = (interp_func) VB->interpfunc;
- GLfloat (*coord)[4] = VB->ClipPtr->data;
- GLuint vlist2[MAX_CLIPPED_VERTICES];
- GLuint *inlist = vlist, *outlist = vlist2;
- GLuint i;
- GLubyte *clipmask = VB->ClipMask;
-
- VB->LastClipped = VB->FirstClipped;
-
- if (mask & CLIP_ALL_BITS) {
-
-#define GENERAL_CLIP \
+#define POLY_CLIP( PLANE, A, B, C, D ) \
+do { \
if (mask & PLANE) { \
- GLuint idxPrev = inlist[n-1]; \
- GLfloat dpPrev = CLIP_DOTPROD(idxPrev); \
+ GLuint idxPrev = inlist[0]; \
+ GLfloat dpPrev = CLIP_DOTPROD(idxPrev, A, B, C, D ); \
GLuint outcount = 0; \
GLuint i; \
- \
- mask &= ~PLANE; \
- \
- for (i = 0; i < n; i++) { \
+ \
+ inlist[n] = inlist[0]; /* prevent rotation of vertices */ \
+ for (i = 1; i <= n; i++) { \
GLuint idx = inlist[i]; \
- GLfloat dp = CLIP_DOTPROD(idx); \
+ GLfloat dp = CLIP_DOTPROD(idx, A, B, C, D ); \
\
+ clipmask[idxPrev] |= PLANE; \
if (!NEGATIVE(dpPrev)) { \
outlist[outcount++] = idxPrev; \
clipmask[idxPrev] &= ~PLANE; \
} \
\
if (DIFFERENT_SIGNS(dp, dpPrev)) { \
- GLuint newvert; \
+ GLuint newvert = VB->LastClipped++; \
+ VB->ClipMask[newvert] = 0; \
+ outlist[outcount++] = newvert; \
if (NEGATIVE(dp)) { \
/* Going out of bounds. Avoid division by zero as we \
* know dp != dpPrev from DIFFERENT_SIGNS, above. \
*/ \
GLfloat t = dp / (dp - dpPrev); \
- newvert = interp( ctx, t, idx, idxPrev, GL_TRUE ); \
- } else { \
+ LINTERP_SZ( t, coord, newvert, idx, idxPrev, SIZE ); \
+ interp( ctx, t, newvert, idx, idxPrev, GL_TRUE ); \
+ } else { \
/* Coming back in. \
*/ \
GLfloat t = dpPrev / (dpPrev - dp); \
- newvert = interp( ctx, t, idxPrev, idx, GL_FALSE ); \
+ LINTERP_SZ( t, coord, newvert, idxPrev, idx, SIZE ); \
+ interp( ctx, t, newvert, idxPrev, idx, GL_FALSE ); \
} \
- clipmask[newvert] = mask; \
- outlist[outcount++] = newvert; \
} \
\
idxPrev = idx; \
outlist = tmp; \
n = outcount; \
} \
- }
-
-
-#define PLANE CLIP_RIGHT_BIT
-#define CLIP_DOTPROD(K) (- X(K) + W(K))
-
- GENERAL_CLIP
-
-#undef CLIP_DOTPROD
-#undef PLANE
-
-
-#define PLANE CLIP_LEFT_BIT
-#define CLIP_DOTPROD(K) (X(K) + W(K))
-
- GENERAL_CLIP
+ } \
+} while (0)
+
+
+#define LINE_CLIP(PLANE, A, B, C, D ) \
+do { \
+ if (mask & PLANE) { \
+ GLfloat dpI = CLIP_DOTPROD( ii, A, B, C, D ); \
+ GLfloat dpJ = CLIP_DOTPROD( jj, A, B, C, D ); \
+ \
+ if (DIFFERENT_SIGNS(dpI, dpJ)) { \
+ GLuint newvert = VB->LastClipped++; \
+ VB->ClipMask[newvert] = 0; \
+ if (NEGATIVE(dpJ)) { \
+ GLfloat t = dpI / (dpI - dpJ); \
+ VB->ClipMask[jj] |= PLANE; \
+ LINTERP_SZ( t, coord, newvert, ii, jj, SIZE ); \
+ interp( ctx, t, newvert, ii, jj, GL_FALSE ); \
+ jj = newvert; \
+ } else { \
+ GLfloat t = dpJ / (dpJ - dpI); \
+ VB->ClipMask[ii] |= PLANE; \
+ LINTERP_SZ( t, coord, newvert, jj, ii, SIZE ); \
+ interp( ctx, t, newvert, jj, ii, GL_FALSE ); \
+ ii = newvert; \
+ } \
+ } \
+ else if (NEGATIVE(dpI)) \
+ return; \
+ } \
+} while (0)
+
+
+/* Project if necessary.
+ */
+static void TAG(build_proj_verts)( GLcontext *ctx )
+{
+ struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
+ GLfloat (*coord)[4] = VB->ClipPtr->data;
+ GLfloat (*proj)[4] = VB->ProjectedClipPtr->data;
+ GLuint last = VB->LastClipped;
+ GLuint i;
-#undef CLIP_DOTPROD
-#undef PLANE
+ for (i = VB->FirstClipped; i < last; i++) {
+ if (VB->ClipMask[i] == 0) {
+ if (SIZE == 4 && W(i) != 0.0F) {
+ GLfloat wInv = 1.0F / W(i);
+ proj[i][0] = X(i) * wInv;
+ proj[i][1] = Y(i) * wInv;
+ proj[i][2] = Z(i) * wInv;
+ proj[i][3] = wInv;
+ } else {
+ proj[i][0] = X(i);
+ proj[i][1] = Y(i);
+ proj[i][2] = Z(i);
+ proj[i][3] = W(i);
+ }
+ }
+ }
-#define PLANE CLIP_TOP_BIT
-#define CLIP_DOTPROD(K) (- Y(K) + W(K))
+ ctx->Driver.BuildProjectedVertices(ctx,
+ VB->FirstClipped,
+ VB->LastClipped,
+ ~0);
+}
- GENERAL_CLIP
+/* Clip a line against the viewport and user clip planes.
+ */
+static void TAG(clip_line)( GLcontext *ctx,
+ GLuint i, GLuint j,
+ GLubyte mask )
+{
+ struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
+ interp_func interp = (interp_func) VB->interpfunc;
+ GLfloat (*coord)[4] = VB->ClipPtr->data;
+ GLuint ii = i, jj = j, p;
-#undef CLIP_DOTPROD
-#undef PLANE
+ VB->LastClipped = VB->FirstClipped;
-#define PLANE CLIP_BOTTOM_BIT
-#define CLIP_DOTPROD(K) (Y(K) + W(K))
+ if (mask & 0x3f) {
+ LINE_CLIP( CLIP_RIGHT_BIT, -1, 0, 0, 1 );
+ LINE_CLIP( CLIP_LEFT_BIT, 1, 0, 0, 1 );
+ LINE_CLIP( CLIP_TOP_BIT, 0, -1, 0, 1 );
+ LINE_CLIP( CLIP_BOTTOM_BIT, 0, 1, 0, 1 );
+ LINE_CLIP( CLIP_FAR_BIT, 0, 0, -1, 1 );
+ LINE_CLIP( CLIP_NEAR_BIT, 0, 0, 1, 1 );
+ }
- GENERAL_CLIP
+ if (mask & CLIP_USER_BIT) {
+ for (p=0;p<MAX_CLIP_PLANES;p++) {
+ if (ctx->Transform.ClipEnabled[p]) {
+ GLfloat a = ctx->Transform._ClipUserPlane[p][0];
+ GLfloat b = ctx->Transform._ClipUserPlane[p][1];
+ GLfloat c = ctx->Transform._ClipUserPlane[p][2];
+ GLfloat d = ctx->Transform._ClipUserPlane[p][3];
+ LINE_CLIP( CLIP_USER_BIT, a, b, c, d );
+ }
+ }
+ }
-#undef CLIP_DOTPROD
-#undef PLANE
+ TAG(build_proj_verts)( ctx );
-#define PLANE CLIP_FAR_BIT
-#define CLIP_DOTPROD(K) (- Z(K) + W(K))
+ if ((ctx->_TriangleCaps & DD_FLATSHADE) && j != jj)
+ VB->copypvfunc( ctx, jj, j );
- if (SIZE >= 3) {
- GENERAL_CLIP
- }
+ /* Render the new line.
+ */
+ ctx->Driver.LineFunc( ctx, ii, jj );
-#undef CLIP_DOTPROD
-#undef PLANE
+}
-#define PLANE CLIP_NEAR_BIT
-#define CLIP_DOTPROD(K) (Z(K) + W(K))
- if (SIZE >=3 ) {
- GENERAL_CLIP
- }
+/* Clip a triangle or quad against the viewport and user clip planes.
+ */
+static void TAG(clip_polygon)( GLcontext *ctx,
+ GLuint n, GLuint vlist[],
+ GLubyte mask )
+{
+ struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
+ interp_func interp = (interp_func) VB->interpfunc;
+ GLfloat (*coord)[4] = VB->ClipPtr->data;
+ GLuint pv = vlist[0];
+ GLuint vlist2[MAX_CLIPPED_VERTICES];
+ GLuint *inlist = vlist, *outlist = vlist2;
+ GLuint p;
+ GLubyte *clipmask = VB->ClipMask;
-#undef CLIP_DOTPROD
-#undef PLANE
-#undef GENERAL_CLIP
+ VB->LastClipped = VB->FirstClipped;
- if (inlist != vlist)
- for (i = 0 ; i < n ; i++)
- vlist[i] = inlist[i];
+ if (mask & 0x3f) {
+ POLY_CLIP( CLIP_RIGHT_BIT, -1, 0, 0, 1 );
+ POLY_CLIP( CLIP_LEFT_BIT, 1, 0, 0, 1 );
+ POLY_CLIP( CLIP_TOP_BIT, 0, -1, 0, 1 );
+ POLY_CLIP( CLIP_BOTTOM_BIT, 0, 1, 0, 1 );
+ POLY_CLIP( CLIP_FAR_BIT, 0, 0, -1, 1 );
+ POLY_CLIP( CLIP_NEAR_BIT, 0, 0, 1, 1 );
}
- /* Clip against user clipping planes in clip space.
- */
if (mask & CLIP_USER_BIT) {
- n = TAG(userclip_polygon)( ctx, n, vlist, interp );
- if (n < 3) return;
+ for (p=0;p<MAX_CLIP_PLANES;p++) {
+ if (ctx->Transform.ClipEnabled[p]) {
+ GLfloat a = ctx->Transform._ClipUserPlane[p][0];
+ GLfloat b = ctx->Transform._ClipUserPlane[p][1];
+ GLfloat c = ctx->Transform._ClipUserPlane[p][2];
+ GLfloat d = ctx->Transform._ClipUserPlane[p][3];
+ POLY_CLIP( CLIP_USER_BIT, a, b, c, d );
+ }
+ }
}
- /* Project if necessary.
- */
- {
- GLuint i;
- GLfloat (*proj)[4] = VB->ProjectedClipPtr->data;
- GLuint first = VB->FirstClipped;
-
- for (i = 0; i < n; i++) {
- GLuint j = vlist[i];
- if (j >= first) {
- if (SIZE == 4 && W(j) != 0.0F) {
- GLfloat wInv = 1.0F / W(j);
- proj[j][0] = X(j) * wInv;
- proj[j][1] = Y(j) * wInv;
- proj[j][2] = Z(j) * wInv;
- proj[j][3] = wInv;
- } else {
- proj[j][0] = X(j);
- proj[j][1] = Y(j);
- proj[j][2] = Z(j);
- proj[j][3] = W(j);
- }
- }
+ if (ctx->_TriangleCaps & DD_FLATSHADE) {
+ if (pv != inlist[0]) {
+ ASSERT( inlist[0] >= VB->FirstClipped );
+ VB->copypvfunc( ctx, inlist[0], pv );
}
}
- if (ctx->Driver.BuildProjectedVertices)
- ctx->Driver.BuildProjectedVertices(ctx,
- VB->FirstClipped,
- VB->LastClipped,
- ~0);
+ TAG(build_proj_verts)( ctx );
/* Render the new vertices as an unclipped polygon.
- * Argh - need to pass in pv...
*/
{
GLuint *tmp = VB->Elts;
- VB->Elts = vlist;
- render_poly_pv_raw_elts( ctx, 0, n, PRIM_BEGIN|PRIM_END, pv );
+ VB->Elts = inlist;
+ ctx->Driver.RenderTabElts[GL_POLYGON]( ctx, 0, n, PRIM_BEGIN|PRIM_END );
VB->Elts = tmp;
}
}
+
+
#undef W
#undef Z
#undef Y
#undef X
#undef SIZE
#undef TAG
-#undef INSIDE
-#undef OUTSIDE
+#undef POLY_CLIP
+#undef LINE_CLIP
-/* $Id: t_vb_render.c,v 1.5 2001/01/03 15:59:31 brianp Exp $ */
+/* $Id: t_vb_render.c,v 1.6 2001/01/05 02:26:49 keithw Exp $ */
/*
* Mesa 3-D graphics library
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Author:
+ * Keith Whitwell <keithw@valinux.com>
*/
* and triangle rasterizers via the function pointers:
*
* context->Driver.BuildProjectedVertices()
+ *
* context->Driver.PointsFunc()
* context->Driver.LineFunc()
* context->Driver.TriangleFunc()
* context->Driver.QuadFunc()
*
+ * context->Driver.RenderTabVerts[]
+ * context->Driver.RenderTabElts[]
+ *
+ * None of these may be null.
*/
#include "t_pipeline.h"
-typedef GLuint (*interp_func)( GLcontext *ctx,
- GLfloat t, GLuint in, GLuint out,
- GLboolean force_boundary );
typedef void (*clip_line_func)( GLcontext *ctx,
GLuint i, GLuint j,
typedef void (*clip_poly_func)( GLcontext *ctx,
GLuint n, GLuint vlist[],
- GLuint pv, GLubyte mask );
-
+ GLubyte mask );
-typedef void (*render_func)( GLcontext *ctx,
- GLuint start,
- GLuint count,
- GLuint flags );
/* Clipping functions for current state.
*/
- interp_func interp; /* Clip interpolation function */
- GLuint _ClipInputs; /* Inputs referenced by interpfunc */
-
+ interp_func interp; /* Clip interpolation function */
+ copy_pv_func copypv; /* Flatshade fixup function */
+ GLuint _ClipInputs; /* Inputs referenced by interpfunc */
};
#define RENDER_STAGE_DATA(stage) ((struct render_stage_data *)stage->private)
-static void render_poly_pv_raw_elts( GLcontext *ctx,
- GLuint start,
- GLuint count,
- GLuint flags,
- GLuint pv );
/**********************************************************************/
/* Interpolate between pairs of vertices */
/**********************************************************************/
-#define INTERP_RGBA 0x1
-#define INTERP_TEX 0x2
-#define INTERP_INDEX 0x4
-#define INTERP_SPEC 0x8
-#define INTERP_FOG 0x10
-#define INTERP_EDGE 0x20
-#define MAX_INTERP 0x40
-
-
#define LINTERP_SZ( t, vec, to, a, b, sz ) \
do { \
switch (sz) { \
-static interp_func interp_tab[0x80];
+#define INTERP_RGBA 0x1
+#define INTERP_TEX 0x2
+#define INTERP_INDEX 0x4
+#define INTERP_SPEC 0x8
+#define INTERP_FOG 0x10
+#define INTERP_EDGE 0x20
+#define MAX_INTERP 0x40
+
+static interp_func interp_tab[MAX_INTERP];
+static copy_pv_func copy_tab[MAX_INTERP];
+
+
+#define IND (0)
+#define NAME interp_none
+#include "t_vb_interptmp.h"
+
+#define IND (INTERP_FOG)
+#define NAME interp_FOG
+#include "t_vb_interptmp.h"
+
+#define IND (INTERP_TEX)
+#define NAME interp_TEX
+#include "t_vb_interptmp.h"
+
+#define IND (INTERP_FOG|INTERP_TEX)
+#define NAME interp_FOG_TEX
+#include "t_vb_interptmp.h"
+
+#define IND (INTERP_EDGE)
+#define NAME interp_EDGE
+#include "t_vb_interptmp.h"
+
+#define IND (INTERP_FOG|INTERP_EDGE)
+#define NAME interp_FOG_EDGE
+#include "t_vb_interptmp.h"
+
+#define IND (INTERP_TEX|INTERP_EDGE)
+#define NAME interp_TEX_EDGE
+#include "t_vb_interptmp.h"
+
+#define IND (INTERP_FOG|INTERP_TEX|INTERP_EDGE)
+#define NAME interp_FOG_TEX_EDGE
+#include "t_vb_interptmp.h"
#define IND (INTERP_RGBA)
#define NAME interp_RGBA
#include "t_vb_interptmp.h"
+#define IND (INTERP_RGBA)
+#define NAME copy_RGBA
+#include "t_vb_flattmp.h"
+
+#define IND (INTERP_RGBA|INTERP_SPEC)
+#define NAME copy_RGBA_SPEC
+#include "t_vb_flattmp.h"
+
+#define IND (INTERP_INDEX)
+#define NAME copy_INDEX
+#include "t_vb_flattmp.h"
+
+
+
-static GLuint interp_invalid( GLcontext *ctx,
- GLfloat t,
- GLuint in, GLuint out,
- GLboolean boundary )
+static void interp_invalid( GLcontext *ctx,
+ GLfloat t,
+ GLuint dst, GLuint in, GLuint out,
+ GLboolean boundary )
{
(void)(ctx && t && in && out && boundary);
fprintf(stderr, "Invalid interpolation function in t_vbrender.c\n");
- return in;
+}
+
+static void copy_invalid( GLcontext *ctx, GLuint dst, GLuint src )
+{
+ (void)(ctx && dst && src);
+ fprintf(stderr, "Invalid copy function in t_vbrender.c\n");
}
* the non-implemented combinations are reachable, but this gives
* some safety from crashes.
*/
- for (i = 0 ; i < Elements(interp_tab) ; i++)
+ for (i = 0 ; i < Elements(interp_tab) ; i++) {
interp_tab[i] = interp_invalid;
+ copy_tab[i] = copy_invalid;
+ }
+
+ interp_tab[0] = interp_none;
+ interp_tab[INTERP_FOG] = interp_FOG;
+ interp_tab[INTERP_TEX] = interp_TEX;
+ interp_tab[INTERP_FOG|INTERP_TEX] = interp_FOG_TEX;
+ interp_tab[INTERP_EDGE] = interp_EDGE;
+ interp_tab[INTERP_FOG|INTERP_EDGE] = interp_FOG_EDGE;
+ interp_tab[INTERP_TEX|INTERP_EDGE] = interp_TEX_EDGE;
+ interp_tab[INTERP_FOG|INTERP_TEX|INTERP_EDGE] = interp_FOG_TEX_EDGE;
interp_tab[INTERP_RGBA] = interp_RGBA;
interp_tab[INTERP_RGBA|INTERP_SPEC] = interp_RGBA_SPEC;
interp_tab[INTERP_RGBA|INTERP_TEX] = interp_RGBA_TEX;
interp_tab[INTERP_RGBA|INTERP_SPEC|INTERP_TEX] = interp_RGBA_SPEC_TEX;
interp_tab[INTERP_RGBA|INTERP_FOG|INTERP_TEX] = interp_RGBA_FOG_TEX;
- interp_tab[INTERP_RGBA|INTERP_SPEC|INTERP_FOG|INTERP_TEX] = interp_RGBA_SPEC_FOG_TEX;
+ interp_tab[INTERP_RGBA|INTERP_SPEC|INTERP_FOG|INTERP_TEX] =
+ interp_RGBA_SPEC_FOG_TEX;
interp_tab[INTERP_INDEX] = interp_INDEX;
interp_tab[INTERP_FOG|INTERP_INDEX] = interp_FOG_INDEX;
interp_tab[INTERP_TEX|INTERP_INDEX] = interp_TEX_INDEX;
interp_tab[INTERP_RGBA|INTERP_EDGE] = interp_RGBA_EDGE;
interp_tab[INTERP_RGBA|INTERP_SPEC|INTERP_EDGE] = interp_RGBA_SPEC_EDGE;
interp_tab[INTERP_RGBA|INTERP_FOG|INTERP_EDGE] = interp_RGBA_FOG_EDGE;
- interp_tab[INTERP_RGBA|INTERP_SPEC|INTERP_FOG|INTERP_EDGE] = interp_RGBA_SPEC_FOG_EDGE;
+ interp_tab[INTERP_RGBA|INTERP_SPEC|INTERP_FOG|INTERP_EDGE] =
+ interp_RGBA_SPEC_FOG_EDGE;
interp_tab[INTERP_RGBA|INTERP_TEX|INTERP_EDGE] = interp_RGBA_TEX_EDGE;
- interp_tab[INTERP_RGBA|INTERP_SPEC|INTERP_TEX|INTERP_EDGE] = interp_RGBA_SPEC_TEX_EDGE;
- interp_tab[INTERP_RGBA|INTERP_FOG|INTERP_TEX|INTERP_EDGE] = interp_RGBA_FOG_TEX_EDGE;
- interp_tab[INTERP_RGBA|INTERP_SPEC|INTERP_FOG|INTERP_TEX|INTERP_EDGE] = interp_RGBA_SPEC_FOG_TEX_EDGE;
+ interp_tab[INTERP_RGBA|INTERP_SPEC|INTERP_TEX|INTERP_EDGE] =
+ interp_RGBA_SPEC_TEX_EDGE;
+ interp_tab[INTERP_RGBA|INTERP_FOG|INTERP_TEX|INTERP_EDGE] =
+ interp_RGBA_FOG_TEX_EDGE;
+ interp_tab[INTERP_RGBA|INTERP_SPEC|INTERP_FOG|INTERP_TEX|INTERP_EDGE] =
+ interp_RGBA_SPEC_FOG_TEX_EDGE;
interp_tab[INTERP_INDEX|INTERP_EDGE] = interp_INDEX_EDGE;
interp_tab[INTERP_FOG|INTERP_INDEX|INTERP_EDGE] = interp_FOG_INDEX_EDGE;
interp_tab[INTERP_TEX|INTERP_INDEX|INTERP_EDGE] = interp_TEX_INDEX_EDGE;
- interp_tab[INTERP_FOG|INTERP_TEX|INTERP_INDEX|INTERP_EDGE] = interp_FOG_TEX_INDEX_EDGE;
+ interp_tab[INTERP_FOG|INTERP_TEX|INTERP_INDEX|INTERP_EDGE] =
+ interp_FOG_TEX_INDEX_EDGE;
+
+
+ copy_tab[INTERP_RGBA] = copy_RGBA;
+ copy_tab[INTERP_RGBA|INTERP_SPEC] = copy_RGBA_SPEC;
+ copy_tab[INTERP_INDEX] = copy_INDEX;
+
}
/**********************************************************************/
-#if 0
-#define NEGATIVE(x) ((*(int *)&x)<0)
-#define DIFFERENT_SIGNS(a,b) ((a*b) < 0)
+#if defined(USE_IEEE)
+#define NEGATIVE(x) ((*(GLuint *)&x) & (1<<31))
+#define DIFFERENT_SIGNS(x,y) (((*(GLuint *)&x)^(*(GLuint *)&y)) & (1<<31))
#else
#define NEGATIVE(x) (x < 0)
-#define DIFFERENT_SIGNS(a,b) ((a*b) < 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]
static clip_poly_func clip_poly_tab[5] = {
0,
0,
- viewclip_polygon_2,
- viewclip_polygon_3,
- viewclip_polygon_4
+ clip_polygon_2,
+ clip_polygon_3,
+ clip_polygon_4
};
static clip_line_func clip_line_tab[5] = {
0,
0,
- viewclip_line_2,
- viewclip_line_3,
- viewclip_line_4
+ clip_line_2,
+ clip_line_3,
+ clip_line_4
};
-
/**********************************************************************/
-/* Clip and render single primitives */
-/**********************************************************************/
-
-
-
-static INLINE void draw_line(GLcontext *ctx, GLuint v1, GLuint v2 )
-{
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
- GLubyte c1 = VB->ClipMask[v1], c2 = VB->ClipMask[v2];
- GLubyte ormask = c1|c2;
- if (!ormask)
- ctx->Driver.LineFunc( ctx, v1, v2, v2 );
- else if (!(c1 & c2 & 0x3f))
- clip_line_tab[VB->ClipPtr->size]( ctx, v1, v2, ormask );
-}
-
-static INLINE void draw_triangle(GLcontext *ctx,
- GLuint v1, GLuint v2, GLuint v3,
- GLuint pv )
-{
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
- GLubyte c1 = VB->ClipMask[v1], c2 = VB->ClipMask[v2], c3 = VB->ClipMask[v3];
- GLubyte ormask = c1|c2|c3;
- if (!ormask)
- ctx->Driver.TriangleFunc( ctx, v1, v2, v3, pv );
- else if (!(c1 & c2 & c3 & 0x3f)) {
- GLuint vlist[MAX_CLIPPED_VERTICES];
- ASSIGN_3V(vlist, v1, v2, v3 );
- clip_poly_tab[VB->ClipPtr->size]( ctx, 3, vlist, pv, ormask );
- }
-}
-
-
-static INLINE void draw_quad( GLcontext *ctx,
- GLuint v1, GLuint v2, GLuint v3,
- GLuint v4, GLuint pv )
-{
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
- GLubyte c1 = VB->ClipMask[v1], c2 = VB->ClipMask[v2];
- GLubyte c3 = VB->ClipMask[v3], c4 = VB->ClipMask[v4];
- GLubyte ormask = c1|c2|c3|c4;
- if (!ormask)
- ctx->Driver.QuadFunc( ctx, v1, v2, v3, v4, pv );
- else if (!(c1 & c2 & c3 & c4 & 0x3f)) {
- GLuint vlist[MAX_CLIPPED_VERTICES];
- ASSIGN_4V(vlist, v1, v2, v3, v4 );
- clip_poly_tab[VB->ClipPtr->size]( ctx, 4, vlist, pv, ormask );
- }
-}
-
-
-/**********************************************************************/
-/* Clip and render whole begin/end objects */
+/* Clip and render whole begin/end objects */
/**********************************************************************/
#define NEED_EDGEFLAG_SETUP (ctx->_TriangleCaps & DD_TRI_UNFILLED)
-#define EDGEFLAG_GET(idx) VB->EdgeFlagPtr->data[idx]
-#define EDGEFLAG_SET(idx, val) VB->EdgeFlagPtr->data[idx] = val
+#define EDGEFLAG_GET(idx) VB->EdgeFlag[idx]
+#define EDGEFLAG_SET(idx, val) VB->EdgeFlag[idx] = val
-/* Vertices, no clipping.
+/* Vertices, with the possibility of clipping.
*/
#define RENDER_POINTS( start, count ) \
- ctx->Driver.PointsFunc( ctx, start, count-1 )
+ ctx->Driver.PointsFunc( ctx, start, count )
-#define RENDER_LINE( i1, i ) \
- ctx->Driver.LineFunc( ctx, i1, i, i )
+#define RENDER_LINE( v1, v2 ) \
+do { \
+ GLubyte c1 = mask[v1], c2 = mask[v2]; \
+ GLubyte ormask = c1|c2; \
+ if (!ormask) \
+ LineFunc( ctx, v1, v2 ); \
+ else if (!(c1 & c2 & 0x3f)) \
+ clip_line_tab[sz]( ctx, v1, v2, ormask ); \
+} while (0)
-#define RENDER_TRI( i2, i1, i, pv, parity ) \
+#define RENDER_TRI( v1, v2, v3 ) \
do { \
- if (parity) \
- ctx->Driver.TriangleFunc( ctx, i1, i2, i, pv ); \
- else \
- ctx->Driver.TriangleFunc( ctx, i2, i1, i, pv ); \
+ GLubyte c1 = mask[v1], c2 = mask[v2], c3 = mask[v3]; \
+ GLubyte ormask = c1|c2|c3; \
+ if (!ormask) \
+ TriangleFunc( ctx, v1, v2, v3 ); \
+ else if (!(c1 & c2 & c3 & 0x3f)) { \
+ GLuint vlist[MAX_CLIPPED_VERTICES]; \
+ ASSIGN_3V(vlist, v3, v1, v2 ); \
+ clip_poly_tab[sz]( ctx, 3, vlist, ormask ); \
+ } \
} while (0)
-#define RENDER_QUAD( i3, i2, i1, i, pv ) \
- ctx->Driver.QuadFunc( ctx, i3, i2, i1, i, pv );
-
-#define TAG(x) x##_raw
+#define RENDER_QUAD( v1, v2, v3, v4 ) \
+do { \
+ GLubyte c1 = mask[v1], c2 = mask[v2]; \
+ GLubyte c3 = mask[v3], c4 = mask[v4]; \
+ GLubyte ormask = c1|c2|c3|c4; \
+ if (!ormask) \
+ QuadFunc( ctx, v1, v2, v3, v4 ); \
+ else if (!(c1 & c2 & c3 & c4 & 0x3f)) { \
+ GLuint vlist[MAX_CLIPPED_VERTICES]; \
+ ASSIGN_4V(vlist, v4, v1, v2, v3 ); \
+ clip_poly_tab[sz]( ctx, 4, vlist, ormask ); \
+ } \
+} while (0)
-#define LOCAL_VARS \
- struct vertex_buffer *VB = &(TNL_CONTEXT(ctx)->vb); \
- (void) VB;
+#define LOCAL_VARS \
+ struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; \
+ const GLuint * const elt = VB->Elts; \
+ const GLubyte *mask = VB->ClipMask; \
+ const GLuint sz = VB->ClipPtr->size; \
+ const line_func LineFunc = ctx->Driver.LineFunc; \
+ const triangle_func TriangleFunc = ctx->Driver.TriangleFunc; \
+ const quad_func QuadFunc = ctx->Driver.QuadFunc; \
+ (void) (LineFunc && TriangleFunc && QuadFunc); \
+ (void) elt; (void) mask; (void) sz;
+
+#define TAG(x) clip_##x##_verts
#define RESET_STIPPLE ctx->Driver.ResetLineStipple( ctx )
#define RESET_OCCLUSION ctx->OcclusionResult = GL_TRUE;
#define PRESERVE_VB_DEFS
#include "t_vb_rendertmp.h"
-/* Elts, no clipping.
+
+/* Elts, with the possibility of clipping.
*/
#undef ELT
#undef TAG
-#undef LOCAL_VARS
-#define TAG(x) x##_raw_elts
#define ELT(x) elt[x]
-#define LOCAL_VARS \
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; \
- const GLuint * const elt = VB->Elts; \
- (void) elt;
+#define TAG(x) clip_##x##_elts
#include "t_vb_rendertmp.h"
+/**********************************************************************/
+/* Render whole begin/end objects */
+/**********************************************************************/
+#define NEED_EDGEFLAG_SETUP (ctx->_TriangleCaps & DD_TRI_UNFILLED)
+#define EDGEFLAG_GET(idx) VB->EdgeFlag[idx]
+#define EDGEFLAG_SET(idx, val) VB->EdgeFlag[idx] = val
-/* Vertices, with the possibility of clipping.
+
+/* Vertices, no clipping.
*/
-#define RENDER_POINTS( start, count ) \
- ctx->Driver.PointsFunc( ctx, start, count-1 )
+#define RENDER_POINTS( start, count ) \
+ ctx->Driver.PointsFunc( ctx, start, count )
-#define RENDER_LINE( i1, i ) \
- draw_line( ctx, i1, i )
+#define RENDER_LINE( v1, v2 ) \
+ LineFunc( ctx, v1, v2 )
-#define RENDER_TRI( i2, i1, i, pv, parity) \
-do { \
- GLuint e2=i2, e1=i1; \
- if (parity) { GLuint t=e2; e2=e1; e1=t; } \
- draw_triangle(ctx,e2,e1,i,pv); \
-} while (0)
+#define RENDER_TRI( v1, v2, v3 ) \
+ TriangleFunc( ctx, v1, v2, v3 )
-#define RENDER_QUAD( i3, i2, i1, i, pv) \
- draw_quad(ctx,i3,i2,i1,i,pv)
+#define RENDER_QUAD( v1, v2, v3, v4 ) \
+ QuadFunc( ctx, v1, v2, v3, v4 )
+#define TAG(x) _tnl_##x##_verts
#define LOCAL_VARS \
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; \
- (void)VB;
+ struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; \
+ const GLuint * const elt = VB->Elts; \
+ const line_func LineFunc = ctx->Driver.LineFunc; \
+ const triangle_func TriangleFunc = ctx->Driver.TriangleFunc; \
+ const quad_func QuadFunc = ctx->Driver.QuadFunc; \
+ (void) (LineFunc && TriangleFunc && QuadFunc); \
+ (void) elt;
-#define TAG(x) x##_clipped
#define RESET_STIPPLE ctx->Driver.ResetLineStipple( ctx )
#define RESET_OCCLUSION ctx->OcclusionResult = GL_TRUE;
+#define RENDER_TAB_QUALIFIER
#define PRESERVE_VB_DEFS
#include "t_vb_rendertmp.h"
-
-/* Elts, with the possibility of clipping.
+/* Elts, no clipping.
*/
#undef ELT
-#undef TAG
-#undef LOCAL_VARS
+#define TAG(x) _tnl_##x##_elts
#define ELT(x) elt[x]
-#define LOCAL_VARS \
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; \
- const GLuint * const elt = VB->Elts; \
- (void) elt;
-#define TAG(x) x##_clipped_elts
-
#include "t_vb_rendertmp.h"
+
/**********************************************************************/
/* Clip and render whole vertex buffers */
/**********************************************************************/
render_func *tab;
GLint pass = 0;
-/* return GL_FALSE; */
+ VB->interpfunc = RENDER_STAGE_DATA(stage)->interp;
+ VB->copypvfunc = RENDER_STAGE_DATA(stage)->copypv;
- VB->interpfunc = (void *)RENDER_STAGE_DATA(stage)->interp;
+ /* Allow the drivers to lock before projected verts are built so
+ * that window coordinates are guarenteed not to change before
+ * rendering.
+ */
+ if (ctx->Driver.RenderStart)
+ ctx->Driver.RenderStart( ctx );
- if (new_inputs) {
- GLuint importable = new_inputs & VB->importable_data;
- GLuint interested = 0;
-
- if (VB->ClipOrMask)
- interested = ~0;
-
- if (ctx->_TriangleCaps & DD_TRI_UNFILLED)
- interested |= VERT_EDGE;
-
- importable &= interested;
-
- if (importable)
- VB->import_data( ctx, importable, VEC_NOT_WRITEABLE|VEC_BAD_STRIDE);
-
- if (ctx->Driver.BuildProjectedVertices)
- ctx->Driver.BuildProjectedVertices( ctx, 0, VB->Count, new_inputs);
- }
+ if (VB->ClipOrMask) {
+ tab = VB->Elts ? clip_render_tab_elts : clip_render_tab_verts;
- /* Rendering is considered a side-effect, and must be repeated each
- * time the stage is run, even if no inputs have changed.
- */
- if (VB->Elts) {
- tab = VB->ClipOrMask ? render_tab_clipped_elts : render_tab_raw_elts;
- } else {
- tab = VB->ClipOrMask ? render_tab_clipped : render_tab_raw;
+ if (new_inputs & VB->importable_data)
+ VB->import_data( ctx,
+ new_inputs & VB->importable_data,
+ VEC_NOT_WRITEABLE|VEC_BAD_STRIDE);
}
+ else {
+ tab = VB->Elts ? ctx->Driver.RenderTabElts : ctx->Driver.RenderTabVerts;
+ }
- if (ctx->Driver.RenderStart)
- ctx->Driver.RenderStart( ctx );
+ ctx->Driver.BuildProjectedVertices( ctx, 0, VB->Count, new_inputs );
do
{
length= VB->PrimitiveLength[i];
ASSERT(length || (flags & PRIM_LAST));
ASSERT((flags & PRIM_MODE_MASK) <= GL_POLYGON+1);
-/* fprintf(stderr, "render %s %d..%d\n", */
-/* _mesa_prim_name[flags & PRIM_MODE_MASK], */
-/* i, i+length); */
if (length)
tab[flags & PRIM_MODE_MASK]( ctx, i, i + length, flags );
}
{
struct render_stage_data *store = RENDER_STAGE_DATA(stage);
GLuint interp = 0;
+ GLuint copy = 0;
GLuint inputs = VERT_CLIP;
GLuint i;
inputs |= VERT_TEX_ANY;
}
+ if (ctx->_TriangleCaps & DD_FLATSHADE) {
+ copy = interp & (INTERP_RGBA|INTERP_SPEC|INTERP_INDEX);
+ interp &= ~copy;
+ }
+
+ store->copypv = copy_tab[copy];
store->interp = interp_tab[interp];
stage->inputs = inputs;
}
"render",
(_NEW_BUFFERS |
_DD_NEW_SEPERATE_SPECULAR |
+ _DD_NEW_FLATSHADE |
_NEW_TEXTURE|
_NEW_LIGHT|
_NEW_POINT|
-/* $Id: t_vb_rendertmp.h,v 1.3 2000/12/28 22:11:06 keithw Exp $ */
+/* $Id: t_vb_rendertmp.h,v 1.4 2001/01/05 02:26:49 keithw Exp $ */
/*
* Mesa 3-D graphics library
#define ELT(x) x
#endif
+#ifndef RENDER_TAB_QUALIFIER
+#define RENDER_TAB_QUALIFIER static
+#endif
+
static void TAG(render_points)( GLcontext *ctx,
GLuint start,
GLuint count,
LOCAL_VARS;
(void) flags;
-/* fprintf(stderr, "%s %d..%d\n", __FUNCTION__, start, count); */
RESET_OCCLUSION;
INIT(GL_POINTS);
RENDER_POINTS( start, count );
LOCAL_VARS;
(void) flags;
-/* fprintf(stderr, "%s %d..%d\n", __FUNCTION__, start, count); */
RESET_OCCLUSION;
INIT(GL_LINES);
for (j=start+1; j<count; j+=2 ) {
LOCAL_VARS;
(void) flags;
-/* fprintf(stderr, "%s %d..%d\n", __FUNCTION__, start, count); */
RESET_OCCLUSION;
INIT(GL_LINES);
(void) flags;
-/* fprintf(stderr, "%s %d..%d\n", __FUNCTION__, start, count); */
RESET_OCCLUSION;
INIT(GL_LINES);
LOCAL_VARS;
(void) flags;
-/* fprintf(stderr, "%s %d..%d\n", __FUNCTION__, start, count); */
INIT(GL_POLYGON);
if (NEED_EDGEFLAG_SETUP) {
for (j=start+2; j<count; j+=3) {
/* Leave the edgeflags as supplied by the user.
*/
- RENDER_TRI( ELT(j-2), ELT(j-1), ELT(j), ELT(j), 0 );
+ RENDER_TRI( ELT(j-2), ELT(j-1), ELT(j) );
RESET_STIPPLE;
}
} else {
for (j=start+2; j<count; j+=3) {
- RENDER_TRI( ELT(j-2), ELT(j-1), ELT(j), ELT(j), 0 );
+ RENDER_TRI( ELT(j-2), ELT(j-1), ELT(j) );
}
}
POSTFIX;
if (TEST_PRIM_PARITY(flags))
parity = 1;
-/* fprintf(stderr, "%s %d..%d\n", __FUNCTION__, start, count); */
INIT(GL_POLYGON);
if (NEED_EDGEFLAG_SETUP) {
for (j=start+2;j<count;j++,parity^=1) {
- /* All edges are boundary. Set edgeflags to 1, draw the
- * triangle, and restore them to the original values.
- */
- GLuint ej2 = ELT(j-2);
- GLuint ej1 = ELT(j-1);
+ GLuint ej2 = ELT(j-2+parity);
+ GLuint ej1 = ELT(j-1-parity);
GLuint ej = ELT(j);
GLboolean ef2 = EDGEFLAG_GET( ej2 );
GLboolean ef1 = EDGEFLAG_GET( ej1 );
EDGEFLAG_SET( ej2, GL_TRUE );
EDGEFLAG_SET( ej1, GL_TRUE );
EDGEFLAG_SET( ej, GL_TRUE );
- RENDER_TRI( ej2, ej1, ej, ej, parity );
+ RENDER_TRI( ej2, ej1, ej );
EDGEFLAG_SET( ej2, ef2 );
EDGEFLAG_SET( ej1, ef1 );
EDGEFLAG_SET( ej, ef );
RESET_STIPPLE;
}
} else {
- for (j=start+2;j<count;j++,parity^=1) {
- RENDER_TRI( ELT(j-2), ELT(j-1), ELT(j), ELT(j), parity );
+ for (j=start+2; j<count ; j++, parity^=1) {
+ RENDER_TRI( ELT(j-2+parity), ELT(j-1-parity), ELT(j) );
}
}
POSTFIX;
LOCAL_VARS;
(void) flags;
-/* fprintf(stderr, "%s %d..%d\n", __FUNCTION__, start, count); */
INIT(GL_POLYGON);
if (NEED_EDGEFLAG_SETUP) {
for (j=start+2;j<count;j++) {
EDGEFLAG_SET( ejs, GL_TRUE );
EDGEFLAG_SET( ej1, GL_TRUE );
EDGEFLAG_SET( ej, GL_TRUE );
- RENDER_TRI( ejs, ej1, ej, ej, 0);
+ RENDER_TRI( ejs, ej1, ej);
EDGEFLAG_SET( ejs, efs );
EDGEFLAG_SET( ej1, ef1 );
EDGEFLAG_SET( ej, ef );
}
} else {
for (j=start+2;j<count;j++) {
- RENDER_TRI( ELT(start), ELT(j-1), ELT(j), ELT(j), 0 );
+ RENDER_TRI( ELT(start), ELT(j-1), ELT(j) );
}
}
}
-/* This is a bit of a hack. Clipping produces polygons and really
- * wants to use this function to render them (in particular to get the
- * edgeflags right). However, the rule that pv==start for polys
- * doens't hold there, hence the extra arg and the wrapper below.
- */
-static void TAG(render_poly_pv)( GLcontext *ctx,
- GLuint start,
- GLuint count,
- GLuint flags,
- GLuint pv )
+static void TAG(render_poly)( GLcontext *ctx,
+ GLuint start,
+ GLuint count,
+ GLuint flags )
{
GLuint j = start+2;
LOCAL_VARS;
(void) flags;
-/* fprintf(stderr, "%s %d..%d\n", __FUNCTION__, start, count); */
INIT(GL_POLYGON);
if (NEED_EDGEFLAG_SETUP) {
GLboolean efstart = EDGEFLAG_GET( ELT(start) );
if (j<count-1) {
GLboolean ef = EDGEFLAG_GET( ELT(j) );
EDGEFLAG_SET( ELT(j), GL_FALSE );
- RENDER_TRI( ELT(start), ELT(j-1), ELT(j), ELT(pv), 0 );
+ RENDER_TRI( ELT(start), ELT(j-1), ELT(j) );
EDGEFLAG_SET( ELT(j), ef );
j++;
for (;j<count-1;j++) {
GLboolean efj = EDGEFLAG_GET( ELT(j) );
EDGEFLAG_SET( ELT(j), GL_FALSE );
- RENDER_TRI( ELT(start), ELT(j-1), ELT(j), ELT(pv), 0 );
+ RENDER_TRI( ELT(start), ELT(j-1), ELT(j) );
EDGEFLAG_SET( ELT(j), efj );
}
}
/* Draw the last or only triangle
*/
if (j < count)
- RENDER_TRI( ELT(start), ELT(j-1), ELT(j), ELT(pv), 0 );
+ RENDER_TRI( ELT(j-1), ELT(j), ELT(start) );
/* Restore the first and last edgeflags:
*/
}
else {
for (j=start+2;j<count;j++) {
- RENDER_TRI( ELT(start), ELT(j-1), ELT(j), ELT(start), 0 );
+ RENDER_TRI( ELT(j-1), ELT(j), ELT(start) );
}
}
POSTFIX;
}
-static void TAG(render_poly)( GLcontext *ctx,
- GLuint start,
- GLuint count,
- GLuint flags )
-{
-/* fprintf(stderr, "%s %d..%d\n", __FUNCTION__, start, count); */
- TAG(render_poly_pv)( ctx, start, count, flags, start );
-}
-
static void TAG(render_quads)( GLcontext *ctx,
GLuint start,
GLuint count,
LOCAL_VARS;
(void) flags;
-/* fprintf(stderr, "%s %d..%d\n", __FUNCTION__, start, count); */
INIT(GL_POLYGON);
if (NEED_EDGEFLAG_SETUP) {
for (j=start+3; j<count; j+=4) {
/* Use user-specified edgeflags for quads.
*/
- RENDER_QUAD( ELT(j-3), ELT(j-2), ELT(j-1), ELT(j), ELT(j) );
+ RENDER_QUAD( ELT(j-3), ELT(j-2), ELT(j-1), ELT(j) );
RESET_STIPPLE;
}
} else {
for (j=start+3; j<count; j+=4) {
- RENDER_QUAD( ELT(j-3), ELT(j-2), ELT(j-1), ELT(j), ELT(j) );
+ RENDER_QUAD( ELT(j-3), ELT(j-2), ELT(j-1), ELT(j) );
}
}
POSTFIX;
LOCAL_VARS;
(void) flags;
-/* fprintf(stderr, "%s %d..%d\n", __FUNCTION__, start, count); */
INIT(GL_POLYGON);
if (NEED_EDGEFLAG_SETUP) {
for (j=start+3;j<count;j+=2) {
EDGEFLAG_SET( ELT(j-2), GL_TRUE );
EDGEFLAG_SET( ELT(j-1), GL_TRUE );
EDGEFLAG_SET( ELT(j), GL_TRUE );
- RENDER_QUAD( ELT(j-3), ELT(j-2), ELT(j), ELT(j-1), ELT(j) );
+ RENDER_QUAD( ELT(j-1), ELT(j-3), ELT(j-2), ELT(j) );
EDGEFLAG_SET( ELT(j-3), ef3 );
EDGEFLAG_SET( ELT(j-2), ef2 );
EDGEFLAG_SET( ELT(j-1), ef1 );
}
} else {
for (j=start+3;j<count;j+=2) {
- RENDER_QUAD( ELT(j-3), ELT(j-2), ELT(j), ELT(j-1), ELT(j) );
+ RENDER_QUAD( ELT(j-1), ELT(j-3), ELT(j-2), ELT(j) );
}
}
POSTFIX;
GLuint count,
GLuint flags )
{
-/* fprintf(stderr, "%s %d..%d\n", __FUNCTION__, start, count); */
(void)(ctx && start && count && flags);
}
-static void (*TAG(render_tab)[GL_POLYGON+2])(GLcontext *,
- GLuint,
- GLuint,
- GLuint) =
+RENDER_TAB_QUALIFIER void (*TAG(render_tab)[GL_POLYGON+2])(GLcontext *,
+ GLuint,
+ GLuint,
+ GLuint) =
{
TAG(render_points),
TAG(render_lines),
#undef RESET_STIPPLE
#undef DBG
#undef ELT
+#undef RENDER_TAB_QUALIFIER
#endif
#ifndef PRESERVE_TAG