From b980b2eeb62dc48101a7481d02d196c80b9da397 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Mon, 8 Jan 2001 04:09:41 +0000 Subject: Add a 'RenderPrimitive' callback to t_vb_render.c. Helps out drivers that used to require a 'ReducedPrimitiveChange' callback. Various compilation fixes for XFree86. Reverted to the older version of glcore.h used internally in XFree86, and moved it to 'Mesa/include/GL/internal/glcore.h', for compatibility with XFree86. --- src/mesa/main/context.c | 5 +++-- src/mesa/main/dd.h | 4 +++- src/mesa/main/dispatch.c | 17 +---------------- src/mesa/main/feedback.c | 5 ++++- src/mesa/main/glheader.h | 4 ++-- src/mesa/main/imports.c | 15 ++++++++++----- src/mesa/main/lines.c | 6 +++++- src/mesa/main/macros.h | 4 ++-- src/mesa/main/mtypes.h | 3 ++- src/mesa/math/m_xform.c | 3 ++- src/mesa/math/mathmod.h | 2 -- src/mesa/swrast_setup/ss_context.c | 8 +++++++- src/mesa/swrast_setup/swrast_setup.h | 2 ++ src/mesa/tnl/t_array_import.c | 10 ++++++++-- src/mesa/tnl/t_vb_light.c | 8 ++++++-- src/mesa/tnl/t_vb_render.c | 3 ++- src/mesa/tnl/t_vb_rendertmp.h | 16 ++++++++-------- 17 files changed, 67 insertions(+), 48 deletions(-) diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 8624cb62e7..4b951c89f7 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -1,4 +1,4 @@ -/* $Id: context.c,v 1.115 2001/01/05 05:31:42 keithw Exp $ */ +/* $Id: context.c,v 1.116 2001/01/08 04:09:41 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -131,7 +131,8 @@ __glCoreCreateContext(__GLimports *imports, __GLcontextModes *modes) modes->accumAlphaBits, 0); - _mesa_initialize_context(ctx, &ctx->Visual, NULL, imports->wscx, GL_FALSE); + /* KW: was imports->wscx */ + _mesa_initialize_context(ctx, &ctx->Visual, NULL, imports->other, GL_FALSE); ctx->exports.destroyContext = _mesa_DestroyContext; diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h index 9c600783dc..d3cd4f8a6e 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -1,4 +1,4 @@ -/* $Id: dd.h,v 1.45 2001/01/05 02:26:48 keithw Exp $ */ +/* $Id: dd.h,v 1.46 2001/01/08 04:09:41 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -746,6 +746,7 @@ struct dd_function_table { void (*RenderStart)( GLcontext *ctx ); + void (*RenderPrimitive)( GLcontext *ctx, GLenum mode ); void (*RenderFinish)( GLcontext *ctx ); /* Wrap around all rendering functions. Suitable for * grabbing/releasing hardware locks. @@ -895,6 +896,7 @@ struct dd_function_table { void (*LogicOpcode)(GLcontext *ctx, GLenum opcode); void (*PolygonMode)(GLcontext *ctx, GLenum face, GLenum mode); void (*PolygonStipple)(GLcontext *ctx, const GLubyte *mask ); + void (*RenderMode)(GLcontext *ctx, GLenum mode ); void (*Scissor)(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h); void (*ShadeModel)(GLcontext *ctx, GLenum mode); void (*StencilFunc)(GLcontext *ctx, GLenum func, GLint ref, GLuint mask); diff --git a/src/mesa/main/dispatch.c b/src/mesa/main/dispatch.c index e5de63c0ec..3c19e562e5 100644 --- a/src/mesa/main/dispatch.c +++ b/src/mesa/main/dispatch.c @@ -1,4 +1,4 @@ -/* $Id: dispatch.c,v 1.18 2001/01/02 10:07:34 joukj Exp $ */ +/* $Id: dispatch.c,v 1.19 2001/01/08 04:09:41 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -98,8 +98,6 @@ trace(void) #else -#ifdef THREADS - #define DISPATCH(FUNC, ARGS, MESSAGE) \ const struct _glapi_table *dispatch; \ dispatch = _glapi_Dispatch ? _glapi_Dispatch : _glapi_get_dispatch();\ @@ -110,19 +108,6 @@ trace(void) dispatch = _glapi_Dispatch ? _glapi_Dispatch : _glapi_get_dispatch();\ return (dispatch->FUNC) ARGS -#else - - -#define DISPATCH(FUNC, ARGS, MESSAGE) \ -__asm__ ("jmp *(%%eax) ;" : : "a" (&(_glapi_Dispatch->FUNC)) ) - -#define RETURN_DISPATCH(FUNC, ARGS, MESSAGE) \ - const struct _glapi_table *dispatch; \ - dispatch = _glapi_Dispatch;\ - return (dispatch->FUNC) ARGS - -#endif - #endif diff --git a/src/mesa/main/feedback.c b/src/mesa/main/feedback.c index 4a1ebe0b97..4d6941a576 100644 --- a/src/mesa/main/feedback.c +++ b/src/mesa/main/feedback.c @@ -1,4 +1,4 @@ -/* $Id: feedback.c,v 1.18 2000/12/26 05:09:28 keithw Exp $ */ +/* $Id: feedback.c,v 1.19 2001/01/08 04:09:41 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -406,6 +406,9 @@ _mesa_RenderMode( GLenum mode ) } ctx->RenderMode = mode; + if (ctx->Driver.RenderMode) + ctx->Driver.RenderMode( ctx, mode ); + return result; } diff --git a/src/mesa/main/glheader.h b/src/mesa/main/glheader.h index f98e9885bb..bd8f39dba2 100644 --- a/src/mesa/main/glheader.h +++ b/src/mesa/main/glheader.h @@ -1,4 +1,4 @@ -/* $Id: glheader.h,v 1.15 2000/09/26 20:53:53 brianp Exp $ */ +/* $Id: glheader.h,v 1.16 2001/01/08 04:09:41 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -177,7 +177,7 @@ typedef struct tagPIXELFORMATDESCRIPTOR PIXELFORMATDESCRIPTOR, *PPIXELFORMATDESC #ifndef CAPI #define CAPI #endif -#include "glcore.h" +#include diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c index bb3c49376c..93fb906f35 100644 --- a/src/mesa/main/imports.c +++ b/src/mesa/main/imports.c @@ -1,4 +1,4 @@ -/* $Id: imports.c,v 1.3 2000/11/22 07:32:17 joukj Exp $ */ +/* $Id: imports.c,v 1.4 2001/01/08 04:09:41 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -76,6 +76,11 @@ _mesa_warning(__GLcontext *gc, char *str) #ifdef DEBUG debug = GL_TRUE; #else +/* Whacko XFree86 macro: + */ +#ifdef getenv +#undef getenv +#endif if (gc->imports.getenv(gc, "MESA_DEBUG")) { debug = GL_TRUE; } @@ -99,7 +104,7 @@ static char * _mesa_getenv(__GLcontext *gc, const char *var) { (void) gc; - return getenv(var); + return gc->imports.getenv(gc, var); } static int @@ -153,12 +158,12 @@ _mesa_InitDefaultImports(__GLimports *imports, void *driverCtx, void *other) imports->warning = _mesa_warning; imports->fatal = _mesa_fatal; imports->getenv = _mesa_getenv; - imports->atoi = _mesa_atoi; +/* imports->atoi = _mesa_atoi; */ imports->sprintf = _mesa_sprintf; imports->fopen = _mesa_fopen; imports->fclose = _mesa_fclose; imports->fprintf = _mesa_fprintf; imports->getDrawablePrivate = _mesa_GetDrawablePrivate; - imports->wscx = driverCtx; - imports->other = other; +/* imports->wscx = driverCtx; */ + imports->other = driverCtx; } diff --git a/src/mesa/main/lines.c b/src/mesa/main/lines.c index c54f108b23..730e3f572f 100644 --- a/src/mesa/main/lines.c +++ b/src/mesa/main/lines.c @@ -1,4 +1,4 @@ -/* $Id: lines.c,v 1.24 2000/12/26 05:09:29 keithw Exp $ */ +/* $Id: lines.c,v 1.25 2001/01/08 04:09:41 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -57,6 +57,10 @@ _mesa_LineWidth( GLfloat width ) FLUSH_VERTICES(ctx, _NEW_LINE); ctx->Line.Width = width; + ctx->Line._Width = CLAMP(width, + ctx->Const.MinLineWidth, + ctx->Const.MaxLineWidth); + if (width != 1.0) ctx->_TriangleCaps |= DD_LINE_WIDTH; diff --git a/src/mesa/main/macros.h b/src/mesa/main/macros.h index a77e2fc65b..a8694a96c3 100644 --- a/src/mesa/main/macros.h +++ b/src/mesa/main/macros.h @@ -1,4 +1,4 @@ -/* $Id: macros.h,v 1.16 2000/12/26 05:09:29 keithw Exp $ */ +/* $Id: macros.h,v 1.17 2001/01/08 04:09:41 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -73,7 +73,7 @@ #define STRIDE_F(p, i) (p = (GLfloat *)((GLubyte *)p + i)) #define STRIDE_UI(p, i) (p = (GLuint *)((GLubyte *)p + i)) #define STRIDE_4UB(p, i) (p = (GLubyte (*)[4])((GLubyte *)p + i)) -#define STRIDE_T(p, t, i) (p = (t *)((GLubyte *)p + i)) +#define STRIDE_T(p, t, i) (p = (t)((GLubyte *)p + i)) #define ZERO_2V( DST ) (DST)[0] = (DST)[1] = 0 diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index ee46c6d888..4cb966f7d2 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1,4 +1,4 @@ -/* $Id: mtypes.h,v 1.11 2001/01/06 22:46:13 gareth Exp $ */ +/* $Id: mtypes.h,v 1.12 2001/01/08 04:09:41 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -516,6 +516,7 @@ struct gl_line_attrib { GLushort StipplePattern; /* Stipple pattern */ GLint StippleFactor; /* Stipple repeat factor */ GLfloat Width; /* Line width */ + GLfloat _Width; /* Clamped Line width */ }; diff --git a/src/mesa/math/m_xform.c b/src/mesa/math/m_xform.c index 72aec3a06a..77acce922e 100644 --- a/src/mesa/math/m_xform.c +++ b/src/mesa/math/m_xform.c @@ -1,4 +1,4 @@ -/* $Id: m_xform.c,v 1.5 2000/12/26 05:09:31 keithw Exp $ */ +/* $Id: m_xform.c,v 1.6 2001/01/08 04:09:41 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -45,6 +45,7 @@ #include "m_matrix.h" #include "m_translate.h" #include "m_xform.h" +#include "mathmod.h" #ifdef DEBUG diff --git a/src/mesa/math/mathmod.h b/src/mesa/math/mathmod.h index 35091a7aae..f27427d81b 100644 --- a/src/mesa/math/mathmod.h +++ b/src/mesa/math/mathmod.h @@ -1,8 +1,6 @@ #ifndef _MESA_MATH_H_ #define _MESA_MATH_H_ -#include - extern void _math_init( void ); #endif diff --git a/src/mesa/swrast_setup/ss_context.c b/src/mesa/swrast_setup/ss_context.c index 408438ca0b..de3f36288a 100644 --- a/src/mesa/swrast_setup/ss_context.c +++ b/src/mesa/swrast_setup/ss_context.c @@ -1,4 +1,4 @@ -/* $Id: ss_context.c,v 1.6 2001/01/05 02:26:49 keithw Exp $ */ +/* $Id: ss_context.c,v 1.7 2001/01/08 04:09:41 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -211,3 +211,9 @@ _swsetup_DestroyContext( GLcontext *ctx ) } +void +_swsetup_RenderPrimNoop( GLcontext *ctx, GLenum mode ) +{ + (void) ctx; + (void) mode; +} diff --git a/src/mesa/swrast_setup/swrast_setup.h b/src/mesa/swrast_setup/swrast_setup.h index fd9c94d4e5..70b1113c90 100644 --- a/src/mesa/swrast_setup/swrast_setup.h +++ b/src/mesa/swrast_setup/swrast_setup.h @@ -58,5 +58,7 @@ _swsetup_Line( GLcontext *ctx, GLuint v0, GLuint v1 ); extern void _swsetup_Points( GLcontext *ctx, GLuint first, GLuint last ); +extern void +_swsetup_RenderPrimNoop( GLcontext *ctx, GLenum mode ); #endif diff --git a/src/mesa/tnl/t_array_import.c b/src/mesa/tnl/t_array_import.c index 008cc23c64..087852febe 100644 --- a/src/mesa/tnl/t_array_import.c +++ b/src/mesa/tnl/t_array_import.c @@ -1,4 +1,4 @@ -/* $Id: t_array_import.c,v 1.4 2001/01/05 02:26:49 keithw Exp $ */ +/* $Id: t_array_import.c,v 1.5 2001/01/08 04:09:41 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -267,31 +267,37 @@ static void _tnl_upgrade_client_data( GLcontext *ctx, if ((required & VERT_OBJ) && (VB->ObjPtr->flags & flags)) { ASSERT(VB->ObjPtr == &inputs->Obj); _tnl_import_vertex( ctx, writeable, stride ); + VB->importable_data &= ~(VERT_OBJ|VERT_CLIP); } if ((required & VERT_NORM) && (VB->NormalPtr->flags & flags)) { ASSERT(VB->NormalPtr == &inputs->Normal); _tnl_import_normal( ctx, writeable, stride ); + VB->importable_data &= ~VERT_NORM; } if ((required & VERT_RGBA) && (VB->ColorPtr[0]->flags & flags)) { ASSERT(VB->ColorPtr[0] == &inputs->Color); _tnl_import_color( ctx, writeable, stride ); + VB->importable_data &= ~VERT_RGBA; } if ((required & VERT_SPEC_RGB) && (VB->SecondaryColorPtr[0]->flags&flags)) { ASSERT(VB->SecondaryColorPtr[0] == &inputs->SecondaryColor); _tnl_import_secondarycolor( ctx, writeable, stride ); + VB->importable_data &= ~VERT_SPEC_RGB; } if ((required & VERT_FOG_COORD) && (VB->FogCoordPtr->flags & flags)) { ASSERT(VB->FogCoordPtr == &inputs->FogCoord); _tnl_import_fogcoord( ctx, writeable, stride ); + VB->importable_data &= ~VERT_FOG_COORD; } if ((required & VERT_INDEX) && (VB->IndexPtr[0]->flags & flags)) { ASSERT(VB->IndexPtr[0] == &inputs->Index); _tnl_import_index( ctx, writeable, stride ); + VB->importable_data &= ~VERT_INDEX; } if (required & VERT_TEX_ANY) @@ -299,9 +305,9 @@ static void _tnl_upgrade_client_data( GLcontext *ctx, if ((required & VERT_TEX(i)) && (VB->TexCoordPtr[i]->flags & flags)) { ASSERT(VB->TexCoordPtr[i] == &inputs->TexCoord[i]); _tnl_import_texcoord( ctx, i, writeable, stride ); + VB->importable_data &= ~VERT_TEX(i); } - VB->importable_data &= ~required; } diff --git a/src/mesa/tnl/t_vb_light.c b/src/mesa/tnl/t_vb_light.c index 043eb7302f..48c8e09313 100644 --- a/src/mesa/tnl/t_vb_light.c +++ b/src/mesa/tnl/t_vb_light.c @@ -1,4 +1,4 @@ -/* $Id: t_vb_light.c,v 1.2 2000/12/27 19:57:37 keithw Exp $ */ +/* $Id: t_vb_light.c,v 1.3 2001/01/08 04:09:42 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -246,6 +246,10 @@ static void check_lighting( GLcontext *ctx, struct gl_pipeline_stage *stage ) stage->inputs |= VERT_EYE; /* effectively, even when lighting in obj */ if (ctx->Light.ColorMaterialEnabled) stage->inputs |= VERT_RGBA; + + stage->outputs = VERT_RGBA; + if (ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR) + stage->outputs |= VERT_SPEC_RGB; } } @@ -273,7 +277,7 @@ const struct gl_pipeline_stage _tnl_lighting_stage = _NEW_LIGHT|_NEW_MODELVIEW, /* recalc -- modelview dependency * otherwise not captured by inputs * (which may be VERT_OBJ) */ - 0,0,VERT_RGBA, /* active, inputs, outputs */ + 0,0,0, /* active, inputs, outputs */ 0,0, /* changed_inputs, private_data */ dtr, /* destroy */ check_lighting, /* check */ diff --git a/src/mesa/tnl/t_vb_render.c b/src/mesa/tnl/t_vb_render.c index 2616d294d3..7279dc17ba 100644 --- a/src/mesa/tnl/t_vb_render.c +++ b/src/mesa/tnl/t_vb_render.c @@ -1,4 +1,4 @@ -/* $Id: t_vb_render.c,v 1.6 2001/01/05 02:26:49 keithw Exp $ */ +/* $Id: t_vb_render.c,v 1.7 2001/01/08 04:09:42 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -487,6 +487,7 @@ do { \ (void) elt; (void) mask; (void) sz; #define TAG(x) clip_##x##_verts +#define INIT(x) ctx->Driver.RenderPrimitive( ctx, x ) #define RESET_STIPPLE ctx->Driver.ResetLineStipple( ctx ) #define RESET_OCCLUSION ctx->OcclusionResult = GL_TRUE; #define PRESERVE_VB_DEFS diff --git a/src/mesa/tnl/t_vb_rendertmp.h b/src/mesa/tnl/t_vb_rendertmp.h index 9c9271ff22..194dd85190 100644 --- a/src/mesa/tnl/t_vb_rendertmp.h +++ b/src/mesa/tnl/t_vb_rendertmp.h @@ -1,4 +1,4 @@ -/* $Id: t_vb_rendertmp.h,v 1.4 2001/01/05 02:26:49 keithw Exp $ */ +/* $Id: t_vb_rendertmp.h,v 1.5 2001/01/08 04:09:42 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -107,7 +107,7 @@ static void TAG(render_line_strip)( GLcontext *ctx, (void) flags; RESET_OCCLUSION; - INIT(GL_LINES); + INIT(GL_LINE_STRIP); for (j=start+1; j