summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mesa/drivers/glide/fxdd.c23
-rw-r--r--src/mesa/main/attrib.c8
-rw-r--r--src/mesa/main/clip.c176
-rw-r--r--src/mesa/main/clip.h12
-rw-r--r--src/mesa/main/context.c9
-rw-r--r--src/mesa/main/dd.h9
-rw-r--r--src/mesa/main/drawpix.c7
-rw-r--r--src/mesa/main/enable.c3
-rw-r--r--src/mesa/main/feedback.c135
-rw-r--r--src/mesa/main/feedback.h17
-rw-r--r--src/mesa/main/light.c24
-rw-r--r--src/mesa/main/lines.c83
-rw-r--r--src/mesa/main/points.c67
-rw-r--r--src/mesa/main/stencil.c4
14 files changed, 285 insertions, 292 deletions
diff --git a/src/mesa/drivers/glide/fxdd.c b/src/mesa/drivers/glide/fxdd.c
index 7dc921b900..0c0b827795 100644
--- a/src/mesa/drivers/glide/fxdd.c
+++ b/src/mesa/drivers/glide/fxdd.c
@@ -448,8 +448,9 @@ static GLboolean fxIsInHardware(GLcontext *ctx)
(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) {
@@ -525,7 +526,7 @@ static void fxDDUpdateDDPointers(GLcontext *ctx)
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) {
@@ -546,14 +547,8 @@ static void fxDDUpdateDDPointers(GLcontext *ctx)
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;
}
@@ -564,6 +559,12 @@ void fxSetupDDPointers(GLcontext *ctx)
}
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;
diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c
index 527cd2d8bb..c4dae95739 100644
--- a/src/mesa/main/attrib.c
+++ b/src/mesa/main/attrib.c
@@ -1,4 +1,4 @@
-/* $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
@@ -700,9 +700,9 @@ void gl_PopAttrib( GLcontext* ctx )
(*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:
diff --git a/src/mesa/main/clip.c b/src/mesa/main/clip.c
index 9feaf2472e..02b97aefa9 100644
--- a/src/mesa/main/clip.c
+++ b/src/mesa/main/clip.c
@@ -1,4 +1,4 @@
-/* $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
@@ -33,6 +33,7 @@
#else
#include <string.h>
#include <stdlib.h>
+#include <stdio.h>
#include "clip.h"
#include "context.h"
#include "macros.h"
@@ -73,10 +74,8 @@ do { \
#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
@@ -122,38 +121,6 @@ static clip_interp_func clip_interp_tab[0x80];
#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"
-
@@ -289,30 +256,31 @@ GLuint gl_userclip_point( GLcontext* ctx, const GLfloat v[] )
-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"
@@ -321,9 +289,80 @@ clip_line_func gl_line_clip_tab[5];
#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 ) \
{ \
@@ -389,72 +428,29 @@ void gl_user_cliptest( 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;
}
diff --git a/src/mesa/main/clip.h b/src/mesa/main/clip.h
index 03e09ca7e5..b8ea954dca 100644
--- a/src/mesa/main/clip.h
+++ b/src/mesa/main/clip.h
@@ -1,4 +1,4 @@
-/* $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
@@ -47,16 +47,8 @@
-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);
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index f823ece47a..9b12ad0ede 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -1,4 +1,4 @@
-/* $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
@@ -2082,8 +2082,13 @@ void gl_update_state( GLcontext *ctx )
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);
diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
index 479d73edd1..aae4d71473 100644
--- a/src/mesa/main/dd.h
+++ b/src/mesa/main/dd.h
@@ -1,4 +1,4 @@
-/* $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
@@ -459,6 +459,13 @@ struct dd_function_table {
*/
+ 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
diff --git a/src/mesa/main/drawpix.c b/src/mesa/main/drawpix.c
index a78f345a81..edf524409a 100644
--- a/src/mesa/main/drawpix.c
+++ b/src/mesa/main/drawpix.c
@@ -1,4 +1,4 @@
-/* $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
@@ -930,10 +930,7 @@ void gl_DrawPixels( GLcontext* ctx, struct gl_image *image )
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 );
}
}
diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
index 29d08283af..ac916d6a41 100644
--- a/src/mesa/main/enable.c
+++ b/src/mesa/main/enable.c
@@ -1,4 +1,4 @@
-/* $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
@@ -341,6 +341,7 @@ void gl_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
if (ctx->Stencil.Enabled!=state) {
ctx->Stencil.Enabled = state;
ctx->NewState |= NEW_RASTER_OPS;
+ ctx->TriangleCaps ^= DD_STENCIL;
}
break;
case GL_TEXTURE_1D:
diff --git a/src/mesa/main/feedback.c b/src/mesa/main/feedback.c
index 4251aae01a..433d0391e8 100644
--- a/src/mesa/main/feedback.c
+++ b/src/mesa/main/feedback.c
@@ -1,4 +1,4 @@
-/* $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
@@ -37,6 +37,7 @@
#include "enums.h"
#include "feedback.h"
#include "macros.h"
+#include "mmath.h"
#include "types.h"
#ifdef XFree86Server
#include "GL/xf86glx.h"
@@ -127,20 +128,21 @@ void gl_PassThrough( GLcontext *ctx, GLfloat token )
* 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] );
@@ -158,6 +160,92 @@ void gl_feedback_vertex( GLcontext *ctx,
+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 */
/**********************************************************************/
@@ -201,6 +289,37 @@ void gl_update_hitflag( GLcontext *ctx, GLfloat z )
}
}
+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 )
diff --git a/src/mesa/main/feedback.h b/src/mesa/main/feedback.h
index 99a4b7aeb1..08aee08519 100644
--- a/src/mesa/main/feedback.h
+++ b/src/mesa/main/feedback.h
@@ -1,4 +1,4 @@
-/* $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
@@ -37,14 +37,15 @@
#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] );
@@ -68,7 +69,15 @@ extern void gl_PopName( GLcontext *ctx );
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
diff --git a/src/mesa/main/light.c b/src/mesa/main/light.c
index cc396f85a5..893438d445 100644
--- a/src/mesa/main/light.c
+++ b/src/mesa/main/light.c
@@ -1,4 +1,4 @@
-/* $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
@@ -60,17 +60,18 @@ void gl_ShadeModel( GLcontext *ctx, GLenum mode )
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)
@@ -314,6 +315,7 @@ void gl_LightModelfv( GLcontext *ctx, GLenum pname, const GLfloat *params )
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) {
diff --git a/src/mesa/main/lines.c b/src/mesa/main/lines.c
index ed671d7a82..cee566e49a 100644
--- a/src/mesa/main/lines.c
+++ b/src/mesa/main/lines.c
@@ -1,4 +1,4 @@
-/* $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
@@ -99,83 +99,6 @@ void gl_LineStipple( GLcontext *ctx, GLint factor, GLushort pattern )
-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 );
-}
@@ -1136,11 +1059,11 @@ void gl_set_line_function( GLcontext *ctx )
}
}
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;
}
}
diff --git a/src/mesa/main/points.c b/src/mesa/main/points.c
index 928acc8891..6690b2a102 100644
--- a/src/mesa/main/points.c
+++ b/src/mesa/main/points.c
@@ -1,4 +1,4 @@
-/* $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
@@ -57,7 +57,7 @@ void gl_PointSize( GLcontext *ctx, GLfloat size )
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;
}
@@ -123,65 +123,6 @@ void gl_PointParameterfvEXT( GLcontext *ctx, GLenum pname,
-/*
- * 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 );
- }
- }
-}
/*
@@ -1333,11 +1274,11 @@ void gl_set_point_function( GLcontext *ctx )
}
}
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;
}
}
diff --git a/src/mesa/main/stencil.c b/src/mesa/main/stencil.c
index 69bd70188b..f03303de58 100644
--- a/src/mesa/main/stencil.c
+++ b/src/mesa/main/stencil.c
@@ -1,4 +1,4 @@
-/* $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
@@ -1057,7 +1057,7 @@ void gl_alloc_stencil_buffer( GLcontext *ctx )
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" );
}
}