- FX bug fixes.
- Polygon mode and edgeflag work properly.
- Clipping works with edgeflag.
- Driver.ReducedPrimitiveChange() callback so drivers
that implement lines & points as triangles can turn culling off
before rendering groups of these primitives.
- Cleaned up feedback & select primitives.
(ctx->Color.ColorMask[GCOMP]==ctx->Color.ColorMask[BCOMP]) &&
(ctx->Color.ColorMask[ACOMP]==ctx->Color.ColorMask[ACOMP])))
)
- return GL_FALSE;
-
+ {
+ return GL_FALSE;
+ }
/* Unsupported texture/multitexture cases */
if(fxMesa->emulateTwoTMUs) {
if (MESA_VERBOSE&(VERBOSE_DRIVER|VERBOSE_STATE))
fprintf(stderr,"fxmesa: fxDDUpdateDDPointers(...)\n");
- if (new_state & (NEW_RASTER_OPS|NEW_TEXTURING))
+ if (new_state & (NEW_RASTER_OPS|NEW_TEXTURING))
fxMesa->is_in_hardware = fxIsInHardware(ctx);
if (fxMesa->is_in_hardware) {
ctx->Driver.LineFunc=fxMesa->LineFunc;
ctx->Driver.TriangleFunc=fxMesa->TriangleFunc;
ctx->Driver.QuadFunc=fxMesa->QuadFunc;
- }
-
- ctx->Driver.AllocDepthBuffer=fxAllocDepthBuffer;
- ctx->Driver.DepthTestSpan=fxDDDepthTestSpanGeneric;
- ctx->Driver.DepthTestPixels=fxDDDepthTestPixelsGeneric;
- ctx->Driver.ReadDepthSpanFloat=fxDDReadDepthSpanFloat;
- ctx->Driver.ReadDepthSpanInt=fxDDReadDepthSpanInt;
- ctx->Driver.RenderStart = 0;
+ } else
+ fxMesa->render_index = FX_FALLBACK;
}
}
ctx->Driver.UpdateState=fxDDUpdateDDPointers;
+
+ ctx->Driver.AllocDepthBuffer=fxAllocDepthBuffer;
+ ctx->Driver.DepthTestSpan=fxDDDepthTestSpanGeneric;
+ ctx->Driver.DepthTestPixels=fxDDDepthTestPixelsGeneric;
+ ctx->Driver.ReadDepthSpanFloat=fxDDReadDepthSpanFloat;
+ ctx->Driver.ReadDepthSpanInt=fxDDReadDepthSpanInt;
ctx->Driver.GetString=fxDDGetString;
-/* $Id: attrib.c,v 1.2 1999/09/16 11:54:56 keithw Exp $ */
+/* $Id: attrib.c,v 1.3 1999/09/18 20:41:22 keithw Exp $ */
/*
* Mesa 3-D graphics library
(*ctx->Driver.ClearStencil)( ctx, ctx->Stencil.Clear );
if (ctx->Driver.Enable)
(*ctx->Driver.Enable)( ctx, GL_STENCIL_TEST, ctx->Stencil.Enabled );
-/* ctx->TriangleCaps &= ~DD_STENCIL; */
-/* if (ctx->Stencil.Enabled) */
-/* ctx->TriangleCaps |= DD_STENCIL; */
+ ctx->TriangleCaps &= ~DD_STENCIL;
+ if (ctx->Stencil.Enabled)
+ ctx->TriangleCaps |= DD_STENCIL;
break;
case GL_TRANSFORM_BIT:
-/* $Id: clip.c,v 1.1 1999/08/19 00:55:41 jtg Exp $ */
+/* $Id: clip.c,v 1.2 1999/09/18 20:41:22 keithw Exp $ */
/*
* Mesa 3-D graphics library
#else
#include <string.h>
#include <stdlib.h>
+#include <stdio.h>
#include "clip.h"
#include "context.h"
#include "macros.h"
#define CLIP_TEX1 0x8
#define CLIP_INDEX0 0x10
#define CLIP_INDEX1 0x20
-#define CLIP_EDGE 0x40
-/* This is sparsely populated: */
-static clip_interp_func clip_interp_tab[0x80];
+static clip_interp_func clip_interp_tab[0x40];
#define IND 0
#define NAME clip_nil
#define NAME clipINDEX0_INDEX1
#include "interp_tmp.h"
-#define IND (CLIP_RGBA0|CLIP_EDGE)
-#define NAME clipRGBA0_EDGE
-#include "interp_tmp.h"
-
-#define IND (CLIP_RGBA0|CLIP_RGBA1|CLIP_EDGE)
-#define NAME clipRGBA0_RGBA1_EDGE
-#include "interp_tmp.h"
-
-#define IND (CLIP_TEX0|CLIP_RGBA0|CLIP_EDGE)
-#define NAME clipTEX0_RGBA0_EDGE
-#include "interp_tmp.h"
-
-#define IND (CLIP_TEX0|CLIP_RGBA0|CLIP_RGBA1|CLIP_EDGE)
-#define NAME clipTEX0_RGBA0_RGBA1_EDGE
-#include "interp_tmp.h"
-
-#define IND (CLIP_TEX1|CLIP_TEX0|CLIP_RGBA0|CLIP_EDGE)
-#define NAME clipTEX1_TEX0_RGBA0_EDGE
-#include "interp_tmp.h"
-
-#define IND (CLIP_TEX1|CLIP_TEX0|CLIP_RGBA0|CLIP_RGBA1|CLIP_EDGE)
-#define NAME clipTEX1_TEX0_RGBA0_RGBA1_EDGE
-#include "interp_tmp.h"
-
-#define IND (CLIP_INDEX0|CLIP_EDGE)
-#define NAME clipINDEX0_EDGE
-#include "interp_tmp.h"
-
-#define IND (CLIP_INDEX0|CLIP_INDEX1|CLIP_EDGE)
-#define NAME clipINDEX0_INDEX1_EDGE
-#include "interp_tmp.h"
-
-clip_poly_func gl_poly_clip_tab[5];
-clip_line_func gl_line_clip_tab[5];
-
-
#if defined(__i386__)
#define NEGATIVE(x) ((*(int *)&x)<0)
#else
#define NEGATIVE(x) (x < 0)
#endif
+
+static clip_poly_func gl_poly_clip_tab[2][5];
+static clip_line_func gl_line_clip_tab[2][5];
+
#define W(i) coord[i][3]
#define Z(i) coord[i][2]
#define Y(i) coord[i][1]
#define X(i) coord[i][0]
#define SIZE 4
+#define IND 0
#define TAG(x) x##_4
#include "clip_funcs.h"
-
#define W(i) 1.0
#define Z(i) coord[i][2]
#define Y(i) coord[i][1]
#define X(i) coord[i][0]
#define SIZE 3
+#define IND 0
#define TAG(x) x##_3
#include "clip_funcs.h"
#define Y(i) coord[i][1]
#define X(i) coord[i][0]
#define SIZE 2
+#define IND 0
#define TAG(x) x##_2
#include "clip_funcs.h"
+#define W(i) coord[i][3]
+#define Z(i) coord[i][2]
+#define Y(i) coord[i][1]
+#define X(i) coord[i][0]
+#define SIZE 4
+#define IND CLIP_TAB_EDGEFLAG
+#define TAG(x) x##_4_edgeflag
+#include "clip_funcs.h"
+
+#define W(i) 1.0
+#define Z(i) coord[i][2]
+#define Y(i) coord[i][1]
+#define X(i) coord[i][0]
+#define SIZE 3
+#define IND CLIP_TAB_EDGEFLAG
+#define TAG(x) x##_3_edgeflag
+#include "clip_funcs.h"
+
+#define W(i) 1.0
+#define Z(i) 0.0
+#define Y(i) coord[i][1]
+#define X(i) coord[i][0]
+#define SIZE 2
+#define IND CLIP_TAB_EDGEFLAG
+#define TAG(x) x##_2_edgeflag
+#include "clip_funcs.h"
+
+
+
+
+void gl_update_clipmask( GLcontext *ctx )
+{
+ GLuint mask = 0;
+
+ if (ctx->Visual->RGBAflag)
+ {
+ if (ctx->Light.ShadeModel==GL_SMOOTH)
+ {
+ mask |= CLIP_RGBA0;
+
+ if (ctx->TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_SEPERATE_SPECULAR))
+ mask |= CLIP_RGBA1;
+ }
+
+ if (ctx->Texture.ReallyEnabled & 0xf0)
+ mask |= CLIP_TEX1|CLIP_TEX0;
+
+ if (ctx->Texture.ReallyEnabled & 0xf)
+ mask |= CLIP_TEX0;
+ }
+ else if (ctx->Light.ShadeModel==GL_SMOOTH)
+ {
+ mask |= CLIP_INDEX0;
+
+ if (ctx->TriangleCaps & DD_TRI_LIGHT_TWOSIDE)
+ mask |= CLIP_INDEX1;
+ }
+
+
+ ctx->ClipInterpFunc = clip_interp_tab[mask];
+ ctx->poly_clip_tab = gl_poly_clip_tab[0];
+ ctx->line_clip_tab = gl_line_clip_tab[0];
+
+ if (ctx->TriangleCaps & DD_TRI_UNFILLED) {
+ ctx->poly_clip_tab = gl_poly_clip_tab[1];
+ ctx->line_clip_tab = gl_line_clip_tab[0];
+ }
+}
+
+
#define USER_CLIPTEST(NAME, SZ) \
static void NAME( struct vertex_buffer *VB ) \
{ \
}
-
-static clip_interp_func get_interp_func( GLcontext *ctx )
-{
- GLuint mask = 0;
-
- if (ctx->Visual->RGBAflag)
- {
- if (ctx->Light.ShadeModel==GL_SMOOTH)
- {
- mask |= CLIP_RGBA0;
-
- if (ctx->TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_SEPERATE_SPECULAR))
- mask |= CLIP_RGBA1;
- }
-
- if (ctx->Texture.ReallyEnabled & 0xf0)
- mask |= CLIP_TEX1|CLIP_TEX0;
-
- if (ctx->Texture.ReallyEnabled & 0xf)
- mask |= CLIP_TEX0;
- }
- else if (ctx->Light.ShadeModel==GL_SMOOTH)
- {
- mask |= CLIP_INDEX0;
-
- if (ctx->TriangleCaps & DD_TRI_LIGHT_TWOSIDE)
- mask |= CLIP_INDEX1;
- }
-
-
- return clip_interp_tab[mask];
-}
-
-
-void gl_update_clipmask( GLcontext *ctx )
-{
- ctx->ClipInterpFunc = get_interp_func( ctx );
-}
-
void gl_init_clip(void)
{
init_clip_funcs_4();
init_clip_funcs_3();
init_clip_funcs_2();
+ init_clip_funcs_4_edgeflag();
+ init_clip_funcs_3_edgeflag();
+ init_clip_funcs_2_edgeflag();
+
clip_interp_tab[0] = clip_nil;
clip_interp_tab[CLIP_RGBA0] = clipRGBA0;
clip_interp_tab[CLIP_RGBA0|CLIP_RGBA1] = clipRGBA0_RGBA1;
clip_interp_tab[CLIP_TEX0|CLIP_RGBA0] = clipTEX0_RGBA0;
clip_interp_tab[CLIP_TEX0|CLIP_RGBA0|CLIP_RGBA1] = clipTEX0_RGBA0_RGBA1;
clip_interp_tab[CLIP_TEX1|CLIP_TEX0|CLIP_RGBA0] = clipTEX1_TEX0_RGBA0;
- clip_interp_tab[CLIP_TEX1|CLIP_TEX0|CLIP_RGBA0|CLIP_RGBA1] = clipTEX1_TEX0_RGBA0_RGBA1;
+ clip_interp_tab[CLIP_TEX1|CLIP_TEX0|CLIP_RGBA0|CLIP_RGBA1] =
+ clipTEX1_TEX0_RGBA0_RGBA1;
clip_interp_tab[CLIP_TEX0] = clipTEX0;
clip_interp_tab[CLIP_TEX1|CLIP_TEX0] = clipTEX1_TEX0;
clip_interp_tab[CLIP_INDEX0] = clipINDEX0;
clip_interp_tab[CLIP_INDEX0|CLIP_INDEX1] = clipINDEX0_INDEX1;
-
- clip_interp_tab[CLIP_RGBA0|CLIP_EDGE] = clipRGBA0_EDGE;
- clip_interp_tab[CLIP_RGBA0|CLIP_RGBA1|CLIP_EDGE] = clipRGBA0_RGBA1_EDGE;
- clip_interp_tab[CLIP_TEX0|CLIP_RGBA0|CLIP_EDGE] = clipTEX0_RGBA0_EDGE;
- clip_interp_tab[CLIP_TEX0|CLIP_RGBA0|CLIP_RGBA1|CLIP_EDGE] = clipTEX0_RGBA0_RGBA1_EDGE;
- clip_interp_tab[CLIP_TEX1|CLIP_TEX0|CLIP_RGBA0|CLIP_EDGE] = clipTEX1_TEX0_RGBA0_EDGE;
- clip_interp_tab[CLIP_TEX1|CLIP_TEX0|CLIP_RGBA0|CLIP_RGBA1|CLIP_EDGE] = clipTEX1_TEX0_RGBA0_RGBA1_EDGE;
- clip_interp_tab[CLIP_INDEX0|CLIP_EDGE] = clipINDEX0_EDGE;
- clip_interp_tab[CLIP_INDEX0|CLIP_INDEX1|CLIP_EDGE] = clipINDEX0_INDEX1_EDGE;
}
-/* $Id: clip.h,v 1.1 1999/08/19 00:55:41 jtg Exp $ */
+/* $Id: clip.h,v 1.2 1999/09/18 20:41:22 keithw Exp $ */
/*
* Mesa 3-D graphics library
-typedef GLuint (*clip_line_func)( struct vertex_buffer *VB,
- GLuint *i, GLuint *j,
- GLubyte mask);
-typedef GLuint (*clip_poly_func)( struct vertex_buffer *VB,
- GLuint n, GLuint vlist[],
- GLubyte mask );
-
-extern clip_poly_func gl_poly_clip_tab[5];
-extern clip_line_func gl_line_clip_tab[5];
+#define CLIP_TAB_EDGEFLAG 1
extern void gl_init_clip(void);
-/* $Id: context.c,v 1.7 1999/09/11 11:31:34 brianp Exp $ */
+/* $Id: context.c,v 1.8 1999/09/18 20:41:22 keithw Exp $ */
/*
* Mesa 3-D graphics library
ctx->Texture.Unit[1].LastEnvMode = ctx->Texture.Unit[1].EnvMode;
}
- if ((ctx->NewState & ~(NEW_CLIENT_STATE|NEW_TEXTURE_ENABLE)) == 0)
+ if ((ctx->NewState & ~(NEW_CLIENT_STATE|NEW_TEXTURE_ENABLE)) == 0) {
+
+ if (MESA_VERBOSE&VERBOSE_STATE)
+ fprintf(stderr, "update_state: goto finished\n");
+
goto finished;
+ }
if (ctx->NewState & NEW_TEXTURE_MATRIX) {
ctx->Enabled &= ~(ENABLE_TEXMAT0|ENABLE_TEXMAT1);
-/* $Id: dd.h,v 1.1 1999/08/19 00:55:41 jtg Exp $ */
+/* $Id: dd.h,v 1.2 1999/09/18 20:41:22 keithw Exp $ */
/*
* Mesa 3-D graphics library
*/
+ void (*ReducedPrimitiveChange)( GLcontext *ctx, GLenum primitive );
+ /* If registered, this will be called when rendering transitions between
+ * points, lines and triangles. It is not called on transitions between
+ * primtives such as GL_TRIANGLES and GL_TRIANGLE_STRIPS, or between
+ * triangles and quads or triangles and polygons.
+ */
+
GLuint TriangleCaps;
/* Holds a list of the reasons why we might normally want to call
* render_triangle, but which are in fact implemented by the
-/* $Id: drawpix.c,v 1.1 1999/08/19 00:55:41 jtg Exp $ */
+/* $Id: drawpix.c,v 1.2 1999/09/18 20:41:22 keithw Exp $ */
/*
* Mesa 3-D graphics library
texcoord[3] = ctx->Current.Texcoord[0][3];
FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_DRAW_PIXEL_TOKEN );
gl_feedback_vertex( ctx,
- ctx->Current.RasterPos[0],
- ctx->Current.RasterPos[1],
- ctx->Current.RasterPos[2],
- ctx->Current.RasterPos[3],
+ ctx->Current.RasterPos,
color, ctx->Current.Index, texcoord );
}
}
-/* $Id: enable.c,v 1.4 1999/09/07 22:31:30 brianp Exp $ */
+/* $Id: enable.c,v 1.5 1999/09/18 20:41:23 keithw Exp $ */
/*
* Mesa 3-D graphics library
if (ctx->Stencil.Enabled!=state) {
ctx->Stencil.Enabled = state;
ctx->NewState |= NEW_RASTER_OPS;
+ ctx->TriangleCaps ^= DD_STENCIL;
}
break;
case GL_TEXTURE_1D:
-/* $Id: feedback.c,v 1.1 1999/08/19 00:55:41 jtg Exp $ */
+/* $Id: feedback.c,v 1.2 1999/09/18 20:41:23 keithw Exp $ */
/*
* Mesa 3-D graphics library
#include "enums.h"
#include "feedback.h"
#include "macros.h"
+#include "mmath.h"
#include "types.h"
#ifdef XFree86Server
#include "GL/xf86glx.h"
* Put a vertex into the feedback buffer.
*/
void gl_feedback_vertex( GLcontext *ctx,
- GLfloat x, GLfloat y, GLfloat z, GLfloat w,
- const GLfloat color[4], GLfloat index,
+ const GLfloat win[4],
+ const GLfloat color[4],
+ GLuint index,
const GLfloat texcoord[4] )
{
- FEEDBACK_TOKEN( ctx, x );
- FEEDBACK_TOKEN( ctx, y );
+ FEEDBACK_TOKEN( ctx, win[0] );
+ FEEDBACK_TOKEN( ctx, win[1] );
if (ctx->Feedback.Mask & FB_3D) {
- FEEDBACK_TOKEN( ctx, z );
+ FEEDBACK_TOKEN( ctx, win[2] );
}
if (ctx->Feedback.Mask & FB_4D) {
- FEEDBACK_TOKEN( ctx, w );
+ FEEDBACK_TOKEN( ctx, win[3] );
}
if (ctx->Feedback.Mask & FB_INDEX) {
- FEEDBACK_TOKEN( ctx, index );
+ FEEDBACK_TOKEN( ctx, (GLfloat) index );
}
if (ctx->Feedback.Mask & FB_COLOR) {
FEEDBACK_TOKEN( ctx, color[0] );
+static void gl_do_feedback_vertex( GLcontext *ctx, GLuint v, GLuint pv )
+{
+ GLfloat win[4];
+ GLfloat color[4];
+ GLfloat tc[4];
+ GLuint texUnit = ctx->Texture.CurrentTransformUnit;
+ struct vertex_buffer *VB = ctx->VB;
+
+ win[0] = VB->Win.data[v][0];
+ win[1] = VB->Win.data[v][1];
+ win[2] = VB->Win.data[v][2] / DEPTH_SCALE;
+ win[3] = 1.0 / VB->Win.data[v][3];
+
+ if (ctx->Light.ShadeModel==GL_SMOOTH) pv = v;
+
+ UBYTE_RGBA_TO_FLOAT_RGBA( color, VB->ColorPtr->data[pv] );
+
+ if (VB->TexCoordPtr[texUnit]->size == 4 &&
+ VB->TexCoordPtr[texUnit]->data[v][3]!=0.0)
+ {
+ GLfloat invq = 1.0F / VB->TexCoordPtr[texUnit]->data[v][3];
+ tc[0] = VB->TexCoordPtr[texUnit]->data[v][0] * invq;
+ tc[1] = VB->TexCoordPtr[texUnit]->data[v][1] * invq;
+ tc[2] = VB->TexCoordPtr[texUnit]->data[v][2] * invq;
+ tc[3] = VB->TexCoordPtr[texUnit]->data[v][3];
+ } else {
+ ASSIGN_4V(tc, 0,0,0,1);
+ COPY_SZ_4V(tc,
+ VB->TexCoordPtr[texUnit]->size,
+ VB->TexCoordPtr[texUnit]->data[v]);
+ }
+
+ gl_feedback_vertex( ctx, win, color, VB->IndexPtr->data[v], tc );
+}
+
+
+
+/*
+ * Put triangle in feedback buffer.
+ */
+void gl_feedback_triangle( GLcontext *ctx,
+ GLuint v0, GLuint v1, GLuint v2, GLuint pv )
+{
+ if (gl_cull_triangle( ctx, v0, v1, v2 )) {
+ FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_POLYGON_TOKEN );
+ FEEDBACK_TOKEN( ctx, (GLfloat) 3 ); /* three vertices */
+
+ gl_do_feedback_vertex( ctx, v0, pv );
+ gl_do_feedback_vertex( ctx, v1, pv );
+ gl_do_feedback_vertex( ctx, v2, pv );
+ }
+}
+
+
+void gl_feedback_line( GLcontext *ctx, GLuint v1, GLuint v2, GLuint pv )
+{
+ GLenum token = GL_LINE_TOKEN;
+
+ if (ctx->StippleCounter==0)
+ token = GL_LINE_RESET_TOKEN;
+
+ FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) token );
+
+ gl_do_feedback_vertex( ctx, v1, pv );
+ gl_do_feedback_vertex( ctx, v2, pv );
+
+ ctx->StippleCounter++;
+}
+
+
+void gl_feedback_points( GLcontext *ctx, GLuint first, GLuint last )
+{
+ struct vertex_buffer *VB = ctx->VB;
+ GLuint i;
+
+ for (i=first;i<=last;i++)
+ if (VB->ClipMask[i]==0) {
+ FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_POINT_TOKEN );
+ gl_do_feedback_vertex( ctx, i, i );
+ }
+}
+
+
+
+
+
/**********************************************************************/
/* Selection */
/**********************************************************************/
}
}
+void gl_select_triangle( GLcontext *ctx,
+ GLuint v0, GLuint v1, GLuint v2, GLuint pv )
+{
+ struct vertex_buffer *VB = ctx->VB;
+
+ if (gl_cull_triangle( ctx, v0, v1, v2 )) {
+ gl_update_hitflag( ctx, VB->Win.data[v0][3] / DEPTH_SCALE );
+ gl_update_hitflag( ctx, VB->Win.data[v1][3] / DEPTH_SCALE );
+ gl_update_hitflag( ctx, VB->Win.data[v2][3] / DEPTH_SCALE );
+ }
+}
+
+
+void gl_select_line( GLcontext *ctx,
+ GLuint v0, GLuint v1, GLuint pv )
+{
+ struct vertex_buffer *VB = ctx->VB;
+
+ gl_update_hitflag( ctx, VB->Win.data[v0][3] / DEPTH_SCALE );
+ gl_update_hitflag( ctx, VB->Win.data[v1][3] / DEPTH_SCALE );
+}
+
+void gl_select_points( GLcontext *ctx, GLuint first, GLuint last )
+{
+ struct vertex_buffer *VB = ctx->VB;
+ GLuint i;
+
+ for (i=first;i<=last;i++)
+ if (VB->ClipMask[i]==0)
+ gl_update_hitflag( ctx, VB->Win.data[i][3] / DEPTH_SCALE);
+}
static void write_hit_record( GLcontext *ctx )
-/* $Id: feedback.h,v 1.1 1999/08/19 00:55:41 jtg Exp $ */
+/* $Id: feedback.h,v 1.2 1999/09/18 20:41:23 keithw Exp $ */
/*
* Mesa 3-D graphics library
#define FEEDBACK_TOKEN( CTX, T ) \
if (CTX->Feedback.Count < CTX->Feedback.BufferSize) { \
- CTX->Feedback.Buffer[CTX->Feedback.Count] = (T); \
+ CTX->Feedback.Buffer[CTX->Feedback.Count] = (GLfloat) (T); \
} \
CTX->Feedback.Count++;
extern void gl_feedback_vertex( GLcontext *ctx,
- GLfloat x, GLfloat y, GLfloat z, GLfloat w,
- const GLfloat color[4], GLfloat index,
+ const GLfloat win[4],
+ const GLfloat color[4],
+ GLuint index,
const GLfloat texcoord[4] );
extern GLint gl_RenderMode( GLcontext *ctx, GLenum mode );
+extern void gl_feedback_points( GLcontext *ctx, GLuint first, GLuint last );
+extern void gl_feedback_line( GLcontext *ctx, GLuint v1, GLuint v2, GLuint pv );
+extern void gl_feedback_triangle( GLcontext *ctx, GLuint v0, GLuint v1,
+ GLuint v2, GLuint pv );
+extern void gl_select_points( GLcontext *ctx, GLuint first, GLuint last );
+extern void gl_select_line( GLcontext *ctx, GLuint v1, GLuint v2, GLuint pv );
+extern void gl_select_triangle( GLcontext *ctx, GLuint v0, GLuint v1,
+ GLuint v2, GLuint pv );
#endif
-/* $Id: light.c,v 1.1 1999/08/19 00:55:41 jtg Exp $ */
+/* $Id: light.c,v 1.2 1999/09/18 20:41:23 keithw Exp $ */
/*
* Mesa 3-D graphics library
if (MESA_VERBOSE & VERBOSE_API)
fprintf(stderr, "glShadeModel %s\n", gl_lookup_enum_by_nr(mode));
+
switch (mode) {
- case GL_FLAT:
- case GL_SMOOTH:
- if (ctx->Light.ShadeModel!=mode) {
- ctx->Light.ShadeModel = mode;
- ctx->TriangleCaps ^= DD_FLATSHADE;
- ctx->NewState |= NEW_RASTER_OPS;
- }
- break;
- default:
- gl_error( ctx, GL_INVALID_ENUM, "glShadeModel" );
+ case GL_FLAT:
+ case GL_SMOOTH:
+ if (ctx->Light.ShadeModel!=mode) {
+ ctx->Light.ShadeModel = mode;
+ ctx->TriangleCaps ^= DD_FLATSHADE;
+ ctx->NewState |= NEW_RASTER_OPS;
+ }
+ break;
+ default:
+ gl_error( ctx, GL_INVALID_ENUM, "glShadeModel" );
}
if (ctx->Driver.ShadeModel)
break;
case GL_LIGHT_MODEL_COLOR_CONTROL:
ctx->TriangleCaps &= ~DD_SEPERATE_SPECULAR;
+ ctx->NewState |= NEW_RASTER_OPS;
if (params[0] == (GLfloat) GL_SINGLE_COLOR)
ctx->Light.Model.ColorControl = GL_SINGLE_COLOR;
else if (params[0] == (GLfloat) GL_SEPARATE_SPECULAR_COLOR) {
-/* $Id: lines.c,v 1.1 1999/08/19 00:55:41 jtg Exp $ */
+/* $Id: lines.c,v 1.2 1999/09/18 20:41:23 keithw Exp $ */
/*
* Mesa 3-D graphics library
-static void feedback_line( GLcontext *ctx, GLuint v1, GLuint v2, GLuint pv )
-{
- struct vertex_buffer *VB = ctx->VB;
- GLfloat x1, y1, z1, w1;
- GLfloat x2, y2, z2, w2;
- GLfloat tex1[4], tex2[4], invq;
- GLuint texUnit = ctx->Texture.CurrentTransformUnit;
-
- x1 = VB->Win.data[v1][0];
- y1 = VB->Win.data[v1][1];
- z1 = VB->Win.data[v1][2] / DEPTH_SCALE;
- w1 = (VB->ClipPtr->size == 4 ? VEC_ELT(VB->ClipPtr, GLfloat, v1)[3] : 1.0);
-
- x2 = VB->Win.data[v2][0];
- y2 = VB->Win.data[v2][1];
- z2 = VB->Win.data[v2][2] / DEPTH_SCALE;
- w2 = (VB->ClipPtr->size == 4 ? VEC_ELT(VB->ClipPtr, GLfloat, v2)[3] : 1.0);
-
-
- if (VB->TexCoordPtr[texUnit]->size == 4) {
- invq = (VB->TexCoordPtr[texUnit]->data[v1][3]==0.0
- ? 1.0
- : 1.0F / VB->TexCoordPtr[texUnit]->data[v1][3]);
-
- tex1[0] = VB->TexCoordPtr[texUnit]->data[v1][0] * invq;
- tex1[1] = VB->TexCoordPtr[texUnit]->data[v1][1] * invq;
- tex1[2] = VB->TexCoordPtr[texUnit]->data[v1][2] * invq;
- tex1[3] = VB->TexCoordPtr[texUnit]->data[v1][3];
-
- invq = (VB->TexCoordPtr[texUnit]->data[v2][3]==0.0
- ? 1.0
- : 1.0F / VB->TexCoordPtr[texUnit]->data[v2][3]);
-
- tex2[0] = VB->TexCoordPtr[texUnit]->data[v2][0] * invq;
- tex2[1] = VB->TexCoordPtr[texUnit]->data[v2][1] * invq;
- tex2[2] = VB->TexCoordPtr[texUnit]->data[v2][2] * invq;
- tex2[3] = VB->TexCoordPtr[texUnit]->data[v2][3];
- } else {
- ASSIGN_4V(tex1, 0,0,0,1);
- ASSIGN_4V(tex2, 0,0,0,1);
- COPY_SZ_4V(tex1,
- VB->TexCoordPtr[texUnit]->size,
- VB->TexCoordPtr[texUnit]->data[v1]);
- COPY_SZ_4V(tex2,
- VB->TexCoordPtr[texUnit]->size,
- VB->TexCoordPtr[texUnit]->data[v2]);
- }
-
-
- if (ctx->StippleCounter==0) {
- FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_LINE_RESET_TOKEN );
- }
- else {
- FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_LINE_TOKEN );
- }
-
- {
- GLfloat color[4];
- GLubyte *ubc = VB->ColorPtr->data[pv];
- GLuint index = VB->IndexPtr->data[pv];
-
- UBYTE_RGBA_TO_FLOAT_RGBA( color, ubc );
- gl_feedback_vertex( ctx, x1,y1,z1,w1, color, (GLfloat) index, tex1 );
- gl_feedback_vertex( ctx, x2,y2,z2,w2, color, (GLfloat) index, tex2 );
- }
-
- ctx->StippleCounter++;
-}
-
-
-
-static void select_line( GLcontext *ctx, GLuint v1, GLuint v2, GLuint pv )
-{
- (void) pv;
- gl_update_hitflag( ctx, ctx->VB->Win.data[v1][2] / DEPTH_SCALE );
- gl_update_hitflag( ctx, ctx->VB->Win.data[v2][2] / DEPTH_SCALE );
-}
}
}
else if (ctx->RenderMode==GL_FEEDBACK) {
- ctx->Driver.LineFunc = feedback_line;
+ ctx->Driver.LineFunc = gl_feedback_line;
}
else {
/* GL_SELECT mode */
- ctx->Driver.LineFunc = select_line;
+ ctx->Driver.LineFunc = gl_select_line;
}
}
-/* $Id: points.c,v 1.1 1999/08/19 00:55:41 jtg Exp $ */
+/* $Id: points.c,v 1.2 1999/09/18 20:41:23 keithw Exp $ */
/*
* Mesa 3-D graphics library
if (ctx->Point.Size != size) {
ctx->Point.Size = size;
- ctx->TriangleCaps &= DD_POINT_SIZE;
+ ctx->TriangleCaps &= ~DD_POINT_SIZE;
if (size != 1.0) ctx->TriangleCaps |= DD_POINT_SIZE;
ctx->NewState |= NEW_RASTER_OPS;
}
-/*
- * Put points in feedback buffer.
- */
-static void feedback_points( GLcontext *ctx, GLuint first, GLuint last )
-{
- struct vertex_buffer *VB = ctx->VB;
- GLuint texUnit = ctx->Texture.CurrentTransformUnit;
- GLuint tsize = VB->TexCoordPtr[texUnit]->size;
- GLuint i;
- GLfloat texcoord[4];
-
- ASSIGN_4V(texcoord, 0,0,0,1);
-
- for (i=first;i<=last;i++) {
- if (VB->ClipMask[i]==0) {
- GLfloat x, y, z, w, invq;
- GLfloat color[4];
- x = VB->Win.data[i][0];
- y = VB->Win.data[i][1];
- z = VB->Win.data[i][2] / DEPTH_SCALE;
- w = VB->ClipPtr->data[i][3];
-
- if (tsize == 4) {
- invq = 1.0F / VB->TexCoordPtr[texUnit]->data[i][3];
- texcoord[0] = VB->TexCoordPtr[texUnit]->data[i][0] * invq;
- texcoord[1] = VB->TexCoordPtr[texUnit]->data[i][1] * invq;
- texcoord[2] = VB->TexCoordPtr[texUnit]->data[i][2] * invq;
- texcoord[3] = VB->TexCoordPtr[texUnit]->data[i][3];
- } else {
- COPY_SZ_4V(texcoord, tsize, VB->TexCoordPtr[texUnit]->data[i]);
- }
-
- FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_POINT_TOKEN );
-
- UBYTE_RGBA_TO_FLOAT_RGBA( color, VB->ColorPtr->data[i] );
-
- gl_feedback_vertex( ctx, x, y, z, w, color,
- (GLfloat) VB->IndexPtr->data[i], texcoord
-);
- }
- }
-}
-
-
-
-/*
- * Put points in selection buffer.
- */
-static void select_points( GLcontext *ctx, GLuint first, GLuint last )
-{
- struct vertex_buffer *VB = ctx->VB;
- GLuint i;
-
- for (i=first;i<=last;i++) {
- if (VB->ClipMask[i]==0) {
- gl_update_hitflag( ctx, VB->Win.data[i][2] / DEPTH_SCALE );
- }
- }
-}
/*
}
}
else if (ctx->RenderMode==GL_FEEDBACK) {
- ctx->Driver.PointsFunc = feedback_points;
+ ctx->Driver.PointsFunc = gl_feedback_points;
}
else {
/* GL_SELECT mode */
- ctx->Driver.PointsFunc = select_points;
+ ctx->Driver.PointsFunc = gl_select_points;
}
}
-/* $Id: stencil.c,v 1.1 1999/08/19 00:55:41 jtg Exp $ */
+/* $Id: stencil.c,v 1.2 1999/09/18 20:41:23 keithw Exp $ */
/*
* Mesa 3-D graphics library
ctx->Buffer->Stencil = (GLstencil *) malloc(buffersize * sizeof(GLstencil));
if (!ctx->Buffer->Stencil) {
/* out of memory */
- ctx->Stencil.Enabled = GL_FALSE;
+ gl_set_enable( ctx, GL_STENCIL_TEST, GL_FALSE );
gl_error( ctx, GL_OUT_OF_MEMORY, "gl_alloc_stencil_buffer" );
}
}