summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/common/t_dd_dmatmp.h54
-rw-r--r--src/mesa/drivers/common/t_dd_vbtmp.h16
-rw-r--r--src/mesa/main/attrib.c41
-rw-r--r--src/mesa/main/attrib.h3
-rw-r--r--src/mesa/main/dd.h6
-rw-r--r--src/mesa/main/enable.c7
-rw-r--r--src/mesa/main/light.c14
-rw-r--r--src/mesa/main/macros.h9
-rw-r--r--src/mesa/main/mtypes.h3
-rw-r--r--src/mesa/main/state.c42
-rw-r--r--src/mesa/main/state.h4
-rw-r--r--src/mesa/tnl/t_context.c20
-rw-r--r--src/mesa/tnl/t_context.h9
-rw-r--r--src/mesa/tnl/t_imm_api.c19
-rw-r--r--src/mesa/tnl/t_imm_dlist.c3
-rw-r--r--src/mesa/tnl/t_imm_exec.c10
-rw-r--r--src/mesa/tnl/t_imm_fixup.c21
-rw-r--r--src/mesa/tnl/t_vb_light.c4
-rw-r--r--src/mesa/tnl/t_vb_lighttmp.h12
-rw-r--r--src/mesa/tnl/t_vb_render.c6
-rw-r--r--src/mesa/tnl/t_vb_rendertmp.h39
-rw-r--r--src/mesa/tnl/tnl.h5
22 files changed, 231 insertions, 116 deletions
diff --git a/src/mesa/drivers/common/t_dd_dmatmp.h b/src/mesa/drivers/common/t_dd_dmatmp.h
index 5aa0ec9bd3..d358c3b010 100644
--- a/src/mesa/drivers/common/t_dd_dmatmp.h
+++ b/src/mesa/drivers/common/t_dd_dmatmp.h
@@ -1,4 +1,4 @@
-/* $Id: t_dd_dmatmp.h,v 1.11 2001/12/11 15:13:57 keithw Exp $ */
+/* $Id: t_dd_dmatmp.h,v 1.12 2002/02/13 00:53:20 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -201,7 +201,7 @@ static void TAG(render_line_strip_verts)( GLcontext *ctx,
if (currentsz < 8)
currentsz = dmasz;
- for (j = start; j < count - 1; j += nr - 1 ) {
+ for (j = start; j + 1 < count; j += nr - 1 ) {
nr = MIN2( currentsz, count - j );
EMIT_VERTS( ctx, j, nr );
currentsz = dmasz;
@@ -242,7 +242,7 @@ static void TAG(render_line_loop_verts)( GLcontext *ctx,
if (currentsz < 8)
currentsz = dmasz;
- for ( ; j < count - 1; j += nr - 1 ) {
+ for ( ; j + 1 < count; j += nr - 1 ) {
nr = MIN2( currentsz, count - j );
EMIT_VERTS( ctx, j, nr );
currentsz = dmasz;
@@ -306,7 +306,7 @@ static void TAG(render_tri_strip_verts)( GLcontext *ctx,
currentsz = GET_CURRENT_VB_MAX_VERTS();
if (currentsz < 8) {
- FIRE_VERTICES();
+ NEW_BUFFER();
currentsz = dmasz;
}
@@ -323,7 +323,7 @@ static void TAG(render_tri_strip_verts)( GLcontext *ctx,
dmasz -= (dmasz & 1);
currentsz -= (currentsz & 1);
- for (j = start ; j < count - 2; j += nr - 2 ) {
+ for (j = start ; j + 2 < count; j += nr - 2 ) {
nr = MIN2( currentsz, count - j );
EMIT_VERTS( ctx, j, nr );
currentsz = dmasz;
@@ -351,11 +351,11 @@ static void TAG(render_tri_fan_verts)( GLcontext *ctx,
INIT(GL_TRIANGLE_FAN);
if (currentsz < 8) {
- FIRE_VERTICES();
+ NEW_BUFFER();
currentsz = dmasz;
}
- for (j = start + 1 ; j < count - 1; j += nr - 1 ) {
+ for (j = start + 1 ; j + 1 < count; j += nr - 1 ) {
nr = MIN2( currentsz, count - j + 1 );
EMIT_VERTS( ctx, start, 1 );
EMIT_VERTS( ctx, j, nr - 1 );
@@ -389,11 +389,11 @@ static void TAG(render_poly_verts)( GLcontext *ctx,
INIT(GL_POLYGON);
if (currentsz < 8) {
- FIRE_VERTICES();
+ NEW_BUFFER();
currentsz = dmasz;
}
- for (j = start + 1 ; j < count - 1 ; j += nr - 1 ) {
+ for (j = start + 1 ; j + 1 < count ; j += nr - 1 ) {
nr = MIN2( currentsz, count - j + 1 );
EMIT_VERTS( ctx, start, 1 );
EMIT_VERTS( ctx, j, nr - 1 );
@@ -429,14 +429,14 @@ static void TAG(render_quad_strip_verts)( GLcontext *ctx,
currentsz = GET_CURRENT_VB_MAX_VERTS();
if (currentsz < 8) {
- FIRE_VERTICES();
+ NEW_BUFFER();
currentsz = dmasz;
}
dmasz -= (dmasz & 2);
currentsz -= (currentsz & 2);
- for (j = start ; j < count - 3; j += nr - 2 ) {
+ for (j = start ; j + 3 < count; j += nr - 2 ) {
nr = MIN2( currentsz, count - j );
EMIT_VERTS( ctx, j, nr );
currentsz = dmasz;
@@ -444,7 +444,7 @@ static void TAG(render_quad_strip_verts)( GLcontext *ctx,
FINISH;
- } else if (HAVE_TRI_STRIPS && ctx->_TriangleCaps & DD_FLATSHADE) {
+ } else if (HAVE_TRI_STRIPS && (ctx->_TriangleCaps & DD_FLATSHADE)) {
if (TAG(emit_elt_verts)( ctx, start, count )) {
LOCAL_VARS;
int dmasz = GET_SUBSEQUENT_VB_MAX_ELTS();
@@ -470,7 +470,7 @@ static void TAG(render_quad_strip_verts)( GLcontext *ctx,
currentsz = currentsz/6*2;
dmasz = dmasz/6*2;
- for (j = start; j < count - 3; j += nr - 2 ) {
+ for (j = start; j + 3 < count; j += nr - 2 ) {
nr = MIN2( currentsz, count - j );
if (nr >= 4) {
GLint quads = (nr/2)-1;
@@ -518,11 +518,11 @@ static void TAG(render_quad_strip_verts)( GLcontext *ctx,
count -= (count-start) & 1;
if (currentsz < 8) {
- FIRE_VERTICES();
+ NEW_BUFFER();
currentsz = dmasz;
}
- for (j = start; j < count - 3; j += nr - 2 ) {
+ for (j = start; j + 3 < count; j += nr - 2 ) {
nr = MIN2( currentsz, count - j );
EMIT_VERTS( ctx, j, nr );
currentsz = dmasz;
@@ -739,7 +739,7 @@ static void TAG(render_line_strip_elts)( GLcontext *ctx,
if (currentsz < 8)
currentsz = dmasz;
- for (j = start; j < count - 1; j += nr - 1 ) {
+ for (j = start; j + 1 < count; j += nr - 1 ) {
nr = MIN2( currentsz, count - j );
TAG(emit_elts)( ctx, elts+j, nr );
NEW_PRIMITIVE();
@@ -775,7 +775,7 @@ static void TAG(render_line_loop_elts)( GLcontext *ctx,
currentsz = GET_CURRENT_VB_MAX_ELTS();
if (currentsz < 8) {
- FIRE_VERTICES();
+ NEW_BUFFER();
currentsz = dmasz;
}
@@ -784,7 +784,7 @@ static void TAG(render_line_loop_elts)( GLcontext *ctx,
currentsz--;
dmasz--;
- for ( ; j < count - 1; j += nr - 1 ) {
+ for ( ; j + 1 < count; j += nr - 1 ) {
nr = MIN2( currentsz, count - j );
/* NEW_PRIMITIVE(); */
TAG(emit_elts)( ctx, elts+j, nr );
@@ -857,7 +857,7 @@ static void TAG(render_tri_strip_elts)( GLcontext *ctx,
currentsz = GET_CURRENT_VB_MAX_ELTS();
if (currentsz < 8) {
- FIRE_VERTICES();
+ NEW_BUFFER();
currentsz = dmasz;
}
@@ -870,7 +870,7 @@ static void TAG(render_tri_strip_elts)( GLcontext *ctx,
dmasz -= (dmasz & 1);
currentsz -= (currentsz & 1);
- for (j = start ; j < count - 2; j += nr - 2 ) {
+ for (j = start ; j + 2 < count; j += nr - 2 ) {
nr = MIN2( currentsz, count - j );
TAG(emit_elts)( ctx, elts+j, nr );
NEW_PRIMITIVE();
@@ -899,11 +899,11 @@ static void TAG(render_tri_fan_elts)( GLcontext *ctx,
currentsz = GET_CURRENT_VB_MAX_ELTS();
if (currentsz < 8) {
- FIRE_VERTICES();
+ NEW_BUFFER();
currentsz = dmasz;
}
- for (j = start + 1 ; j < count - 1; j += nr - 1 ) {
+ for (j = start + 1 ; j + 1 < count; j += nr - 1 ) {
nr = MIN2( currentsz, count - j + 1 );
TAG(emit_elts)( ctx, elts+start, 1 );
TAG(emit_elts)( ctx, elts+j, nr - 1 );
@@ -935,11 +935,11 @@ static void TAG(render_poly_elts)( GLcontext *ctx,
currentsz = GET_CURRENT_VB_MAX_ELTS();
if (currentsz < 8) {
- FIRE_VERTICES();
+ NEW_BUFFER();
currentsz = dmasz;
}
- for (j = start + 1 ; j < count - 1 ; j += nr - 1 ) {
+ for (j = start + 1 ; j + 1 < count ; j += nr - 1 ) {
nr = MIN2( currentsz, count - j + 1 );
TAG(emit_elts)( ctx, elts+start, 1 );
TAG(emit_elts)( ctx, elts+j, nr - 1 );
@@ -983,7 +983,7 @@ static void TAG(render_quad_strip_elts)( GLcontext *ctx,
currentsz = currentsz/6*2;
dmasz = dmasz/6*2;
- for (j = start; j < count - 3; j += nr - 2 ) {
+ for (j = start; j + 3 < count; j += nr - 2 ) {
nr = MIN2( currentsz, count - j );
if (nr >= 4)
@@ -1012,7 +1012,7 @@ static void TAG(render_quad_strip_elts)( GLcontext *ctx,
else {
ELT_INIT( GL_TRIANGLE_STRIP );
- for (j = start; j < count - 3; j += nr - 2 ) {
+ for (j = start; j + 3 < count; j += nr - 2 ) {
nr = MIN2( currentsz, count - j );
TAG(emit_elts)( ctx, elts+j, nr );
NEW_PRIMITIVE();
@@ -1053,7 +1053,7 @@ static void TAG(render_quads_elts)( GLcontext *ctx,
if (currentsz < 8)
currentsz = dmasz;
- for (j = start; j < count - 3; j += nr - 2 ) {
+ for (j = start; j + 3 < count; j += nr - 2 ) {
nr = MIN2( currentsz, count - j );
if (nr >= 4)
diff --git a/src/mesa/drivers/common/t_dd_vbtmp.h b/src/mesa/drivers/common/t_dd_vbtmp.h
index 5e58d1b6d8..5d07beb3e7 100644
--- a/src/mesa/drivers/common/t_dd_vbtmp.h
+++ b/src/mesa/drivers/common/t_dd_vbtmp.h
@@ -1,4 +1,4 @@
-/* $Id: t_dd_vbtmp.h,v 1.15 2001/12/20 09:54:20 keithw Exp $ */
+/* $Id: t_dd_vbtmp.h,v 1.16 2002/02/13 00:53:20 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -136,6 +136,9 @@ static void TAG(emit)( GLcontext *ctx,
const GLubyte *mask = VB->ClipMask;
int i;
+/* fprintf(stderr, "%s(big) importable %d %d..%d\n", */
+/* __FUNCTION__, VB->importable_data, start, end); */
+
if (HAVE_HW_VIEWPORT && HAVE_HW_DIVIDE && CHECK_HW_DIVIDE) {
(void) s;
coord = VB->ClipPtr->data;
@@ -226,6 +229,8 @@ static void TAG(emit)( GLcontext *ctx,
VIEWPORT_Z(v->v.z, coord[0][2]);
v->v.w = coord[0][3];
}
+/* fprintf(stderr, "vert %d: %.2f %.2f %.2f %.2f\n", */
+/* i, v->v.x, v->v.y, v->v.z, v->v.w); */
coord = (GLfloat (*)[4])((GLubyte *)coord + coord_stride);
}
if (DO_RGBA) {
@@ -417,8 +422,8 @@ static void TAG(emit)( GLcontext *ctx, GLuint start, GLuint end,
col_stride = VB->ColorPtr[0]->StrideB;
ASSERT(VB->ColorPtr[0]->Type == GL_UNSIGNED_BYTE);
-/* fprintf(stderr, "%s stride %d importable %d\n", */
-/* __FUNCTION__, col_stride, VB->importable_data); */
+/* fprintf(stderr, "%s(small) importable %x\n", */
+/* __FUNCTION__, VB->importable_data); */
/* Pack what's left into a 4-dword vertex. Color is in a different
* place, and there is no 'w' coordinate.
@@ -449,6 +454,8 @@ static void TAG(emit)( GLcontext *ctx, GLuint start, GLuint end,
}
STRIDE_4UB( col, col_stride );
}
+/* fprintf(stderr, "vert %d: %.2f %.2f %.2f %x\n", */
+/* i, v[0], v[1], v[2], *(int *)&v[3]); */
}
}
else {
@@ -470,6 +477,9 @@ static void TAG(emit)( GLcontext *ctx, GLuint start, GLuint end,
b[3] = col[i][3];
}
}
+/* fprintf(stderr, "vert %d: %.2f %.2f %.2f %x\n", */
+/* i, v[0], v[1], v[2], *(int *)&v[3]); */
+
}
}
}
diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c
index 81365a6153..139a5d030f 100644
--- a/src/mesa/main/attrib.c
+++ b/src/mesa/main/attrib.c
@@ -1,4 +1,4 @@
-/* $Id: attrib.c,v 1.59 2002/01/05 21:53:20 brianp Exp $ */
+/* $Id: attrib.c,v 1.60 2002/02/13 00:53:19 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -52,6 +52,7 @@
#include "texobj.h"
#include "texstate.h"
#include "mtypes.h"
+#include "math/m_xform.h"
#endif
@@ -917,11 +918,30 @@ _mesa_PopAttrib(void)
/* lighting enable */
_mesa_set_enable(ctx, GL_LIGHTING, light->Enabled);
/* per-light state */
+
+ if (ctx->ModelviewMatrixStack.Top->flags & MAT_DIRTY_INVERSE)
+ _math_matrix_analyse( ctx->ModelviewMatrixStack.Top );
+
for (i = 0; i < MAX_LIGHTS; i++) {
GLenum lgt = (GLenum) (GL_LIGHT0 + i);
- _mesa_set_enable(ctx, lgt, light->Light[i].Enabled);
- MEMCPY(&ctx->Light.Light[i], &light->Light[i],
- sizeof(struct gl_light));
+ const struct gl_light *l = &light->Light[i];
+ GLfloat tmp[4];
+ _mesa_set_enable(ctx, lgt, l->Enabled);
+ _mesa_Lightfv( lgt, GL_AMBIENT, l->Ambient );
+ _mesa_Lightfv( lgt, GL_DIFFUSE, l->Diffuse );
+ _mesa_Lightfv( lgt, GL_SPECULAR, l->Specular );
+ TRANSFORM_POINT( tmp, ctx->ModelviewMatrixStack.Top->inv, l->EyePosition );
+ _mesa_Lightfv( lgt, GL_POSITION, tmp );
+ TRANSFORM_POINT( tmp, ctx->ModelviewMatrixStack.Top->m, l->EyeDirection );
+ _mesa_Lightfv( lgt, GL_SPOT_DIRECTION, tmp );
+ _mesa_Lightfv( lgt, GL_SPOT_EXPONENT, &l->SpotExponent );
+ _mesa_Lightfv( lgt, GL_SPOT_CUTOFF, &l->SpotCutoff );
+ _mesa_Lightfv( lgt, GL_CONSTANT_ATTENUATION,
+ &l->ConstantAttenuation );
+ _mesa_Lightfv( lgt, GL_LINEAR_ATTENUATION,
+ &l->LinearAttenuation );
+ _mesa_Lightfv( lgt, GL_QUADRATIC_ATTENUATION,
+ &l->QuadraticAttenuation );
}
/* light model */
_mesa_LightModelfv(GL_LIGHT_MODEL_AMBIENT,
@@ -1030,15 +1050,16 @@ _mesa_PopAttrib(void)
const struct gl_transform_attrib *xform;
xform = (const struct gl_transform_attrib *) attr->data;
_mesa_MatrixMode(xform->MatrixMode);
- /* clip planes */
- MEMCPY(ctx->Transform.EyeUserPlane, xform->EyeUserPlane,
- sizeof(xform->EyeUserPlane));
- MEMCPY(ctx->Transform._ClipUserPlane, xform->_ClipUserPlane,
- sizeof(xform->EyeUserPlane));
- /* clip plane enable flags */
for (i = 0; i < MAX_CLIP_PLANES; i++) {
+ GLdouble equation[4];
+ const GLfloat *eq = xform->EyeUserPlane[i];
_mesa_set_enable(ctx, GL_CLIP_PLANE0 + i,
xform->ClipEnabled[i]);
+ equation[0] = (GLdouble) eq[0];
+ equation[1] = (GLdouble) eq[1];
+ equation[2] = (GLdouble) eq[2];
+ equation[3] = (GLdouble) eq[3];
+ _mesa_ClipPlane( GL_CLIP_PLANE0 + i, equation );
}
/* normalize/rescale */
_mesa_set_enable(ctx, GL_NORMALIZE, ctx->Transform.Normalize);
diff --git a/src/mesa/main/attrib.h b/src/mesa/main/attrib.h
index 5ce75fcd91..fabe3e0d03 100644
--- a/src/mesa/main/attrib.h
+++ b/src/mesa/main/attrib.h
@@ -1,4 +1,4 @@
-/* $Id: attrib.h,v 1.5 2001/03/12 00:48:37 gareth Exp $ */
+/* $Id: attrib.h,v 1.6 2002/02/13 00:53:19 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -31,7 +31,6 @@
#include "mtypes.h"
-
extern void
_mesa_PushAttrib( GLbitfield mask );
diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
index f22aa94319..b96a132b42 100644
--- a/src/mesa/main/dd.h
+++ b/src/mesa/main/dd.h
@@ -1,4 +1,4 @@
-/* $Id: dd.h,v 1.65 2001/12/14 02:50:01 brianp Exp $ */
+/* $Id: dd.h,v 1.66 2002/02/13 00:53:19 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -474,10 +474,11 @@ struct dd_function_table {
void (*ClearDepth)(GLcontext *ctx, GLclampd d);
void (*ClearIndex)(GLcontext *ctx, GLuint index);
void (*ClearStencil)(GLcontext *ctx, GLint s);
+ void (*ClipPlane)(GLcontext *ctx, GLenum plane, const GLfloat *equation );
void (*ColorMask)(GLcontext *ctx, GLboolean rmask, GLboolean gmask,
GLboolean bmask, GLboolean amask );
+ void (*ColorMaterial)(GLcontext *ctx, GLenum face, GLenum mode);
void (*CullFace)(GLcontext *ctx, GLenum mode);
- void (*ClipPlane)(GLcontext *ctx, GLenum plane, const GLfloat *equation );
void (*FrontFace)(GLcontext *ctx, GLenum mode);
void (*DepthFunc)(GLcontext *ctx, GLenum func);
void (*DepthMask)(GLcontext *ctx, GLboolean flag);
@@ -634,7 +635,6 @@ struct dd_function_table {
void (*UnlockArraysEXT)( GLcontext *ctx );
/* Called by glLockArraysEXT() and glUnlockArraysEXT(), respectively.
*/
-
};
diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
index 755f74ac39..366c2cef84 100644
--- a/src/mesa/main/enable.c
+++ b/src/mesa/main/enable.c
@@ -1,4 +1,4 @@
-/* $Id: enable.c,v 1.56 2002/01/22 18:40:46 brianp Exp $ */
+/* $Id: enable.c,v 1.57 2002/02/13 00:53:19 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -307,6 +307,11 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
FLUSH_VERTICES(ctx, _NEW_LIGHT);
ctx->Light.Enabled = state;
+ if (ctx->Light.Enabled && ctx->Light.Model.TwoSide)
+ ctx->_TriangleCaps |= DD_TRI_LIGHT_TWOSIDE;
+ else
+ ctx->_TriangleCaps &= ~DD_TRI_LIGHT_TWOSIDE;
+
if ((ctx->Light.Enabled &&
ctx->Light.Model.ColorControl==GL_SEPARATE_SPECULAR_COLOR)
|| ctx->Fog.ColorSumEnabled)
diff --git a/src/mesa/main/light.c b/src/mesa/main/light.c
index 9286642d3a..ee9d9d177e 100644
--- a/src/mesa/main/light.c
+++ b/src/mesa/main/light.c
@@ -1,4 +1,4 @@
-/* $Id: light.c,v 1.48 2001/12/18 04:06:45 brianp Exp $ */
+/* $Id: light.c,v 1.49 2002/02/13 00:53:19 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -407,6 +407,11 @@ _mesa_LightModelfv( GLenum pname, const GLfloat *params )
return;
FLUSH_VERTICES(ctx, _NEW_LIGHT);
ctx->Light.Model.TwoSide = newbool;
+
+ if (ctx->Light.Enabled && ctx->Light.Model.TwoSide)
+ ctx->_TriangleCaps |= DD_TRI_LIGHT_TWOSIDE;
+ else
+ ctx->_TriangleCaps &= ~DD_TRI_LIGHT_TWOSIDE;
break;
case GL_LIGHT_MODEL_COLOR_CONTROL:
if (params[0] == (GLfloat) GL_SINGLE_COLOR)
@@ -883,6 +888,9 @@ _mesa_ColorMaterial( GLenum face, GLenum mode )
FLUSH_CURRENT( ctx, 0 );
_mesa_update_color_material(ctx,ctx->Current.Attrib[VERT_ATTRIB_COLOR0]);
}
+
+ if (ctx->Driver.ColorMaterial)
+ (*ctx->Driver.ColorMaterial)( ctx, face, mode );
}
@@ -1162,7 +1170,6 @@ void
_mesa_update_lighting( GLcontext *ctx )
{
struct gl_light *light;
- ctx->_TriangleCaps &= ~DD_TRI_LIGHT_TWOSIDE;
ctx->_NeedEyeCoords &= ~NEED_EYE_LIGHT;
ctx->_NeedNormals &= ~NEED_NORMALS_LIGHT;
ctx->Light._Flags = 0;
@@ -1172,9 +1179,6 @@ _mesa_update_lighting( GLcontext *ctx )
ctx->_NeedNormals |= NEED_NORMALS_LIGHT;
- if (ctx->Light.Model.TwoSide)
- ctx->_TriangleCaps |= DD_TRI_LIGHT_TWOSIDE;
-
foreach(light, &ctx->Light.EnabledList) {
ctx->Light._Flags |= light->_Flags;
}
diff --git a/src/mesa/main/macros.h b/src/mesa/main/macros.h
index d4cd6b858a..bb83b30d5d 100644
--- a/src/mesa/main/macros.h
+++ b/src/mesa/main/macros.h
@@ -1,4 +1,4 @@
-/* $Id: macros.h,v 1.24 2001/06/11 07:52:51 joukj Exp $ */
+/* $Id: macros.h,v 1.25 2002/02/13 00:53:19 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -270,6 +270,13 @@ do { \
(DST)[2] = (SRCA)[2] * (SRCB)[2]; \
} while (0)
+#define SELF_SCALE_3V( DST, SRC ) \
+do { \
+ (DST)[0] *= (SRC)[0]; \
+ (DST)[1] *= (SRC)[1]; \
+ (DST)[2] *= (SRC)[2]; \
+} while (0)
+
#define ACC_3V( DST, SRC ) \
do { \
(DST)[0] += (SRC)[0]; \
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 0dec13c3ae..14b9f0188a 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1,4 +1,4 @@
-/* $Id: mtypes.h,v 1.63 2002/01/22 14:35:16 brianp Exp $ */
+/* $Id: mtypes.h,v 1.64 2002/02/13 00:53:19 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -1591,6 +1591,7 @@ struct matrix_stack
#define NEED_EYE_LIGHT 0x2
#define NEED_EYE_LIGHT_MODELVIEW 0x4
#define NEED_EYE_POINT_ATTEN 0x8
+#define NEED_EYE_DRIVER 0x10
/*
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index 3d093de48e..f100fe6ffc 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -1,4 +1,4 @@
-/* $Id: state.c,v 1.76 2002/01/12 02:55:30 brianp Exp $ */
+/* $Id: state.c,v 1.77 2002/02/13 00:53:19 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -555,13 +555,11 @@ update_polygon( GLcontext *ctx )
static void
calculate_model_project_matrix( GLcontext *ctx )
{
- if (!ctx->_NeedEyeCoords) {
_math_matrix_mul_matrix( &ctx->_ModelProjectMatrix,
ctx->ProjectionMatrixStack.Top,
ctx->ModelviewMatrixStack.Top );
_math_matrix_analyse( &ctx->_ModelProjectMatrix );
- }
}
static void
@@ -595,7 +593,6 @@ update_tnl_spaces( GLcontext *ctx, GLuint oldneedeyecoords )
/* Recalculate all state that depends on _NeedEyeCoords.
*/
update_modelview_scale(ctx);
- calculate_model_project_matrix(ctx);
_mesa_compute_light_positions( ctx );
if (ctx->Driver.LightingSpaceChange)
@@ -610,9 +607,6 @@ update_tnl_spaces( GLcontext *ctx, GLuint oldneedeyecoords )
if (new_state & _NEW_MODELVIEW)
update_modelview_scale(ctx);
- if (new_state & (_NEW_MODELVIEW|_NEW_PROJECTION))
- calculate_model_project_matrix(ctx);
-
if (new_state & (_NEW_LIGHT|_NEW_MODELVIEW))
_mesa_compute_light_positions( ctx );
}
@@ -757,12 +751,12 @@ update_texture_matrices( GLcontext *ctx )
if (ctx->TextureMatrixStack[i].Top->flags & MAT_DIRTY) {
_math_matrix_analyse( ctx->TextureMatrixStack[i].Top );
- if (ctx->Driver.TextureMatrix)
- ctx->Driver.TextureMatrix( ctx, i, ctx->TextureMatrixStack[i].Top);
-
if (ctx->Texture.Unit[i]._ReallyEnabled &&
ctx->TextureMatrixStack[i].Top->type != MATRIX_IDENTITY)
ctx->Texture._TexMatEnabled |= ENABLE_TEXMAT(i);
+
+ if (ctx->Driver.TextureMatrix)
+ ctx->Driver.TextureMatrix( ctx, i, ctx->TextureMatrixStack[i].Top);
}
}
}
@@ -889,6 +883,7 @@ update_texture_state( GLcontext *ctx )
}
+
/*
* If ctx->NewState is non-zero then this function MUST be called before
* rendering any primitive. Basically, function pointers and miscellaneous
@@ -957,6 +952,8 @@ void _mesa_update_state( GLcontext *ctx )
ctx->_NeedEyeCoords |= NEED_EYE_LIGHT_MODELVIEW;
}
+
+#if 0
/* XXX this is a bit of a hack. We should be checking elsewhere if
* vertex program mode is enabled. We set _NeedEyeCoords to zero to
* ensure that the combined modelview/projection matrix is computed
@@ -964,6 +961,15 @@ void _mesa_update_state( GLcontext *ctx )
*/
if (ctx->VertexProgram.Enabled)
ctx->_NeedEyeCoords = 0;
+ /* KW: it's now always computed.
+ */
+#endif
+
+ /* Keep ModelviewProject uptodate always to allow tnl
+ * implementations that go model->clip even when eye is required.
+ */
+ if (new_state & (_NEW_MODELVIEW|_NEW_PROJECTION))
+ calculate_model_project_matrix(ctx);
/* ctx->_NeedEyeCoords is now uptodate.
*
@@ -975,7 +981,6 @@ void _mesa_update_state( GLcontext *ctx )
* light positions & normal transforms for other reasons.
*/
if (new_state & (_NEW_MODELVIEW |
- _NEW_PROJECTION |
_NEW_LIGHT |
_MESA_NEW_NEED_EYE_COORDS))
update_tnl_spaces( ctx, oldneedeyecoords );
@@ -1034,3 +1039,18 @@ void _mesa_update_state( GLcontext *ctx )
#endif
}
}
+
+/* Is this helpful?
+ */
+void
+_mesa_allow_light_in_model( GLcontext *ctx, GLboolean flag )
+{
+ if (flag)
+ ctx->_NeedEyeCoords &= ~NEED_EYE_DRIVER;
+ else
+ ctx->_NeedEyeCoords |= NEED_EYE_DRIVER;
+
+ ctx->NewState |= _NEW_POINT; /* one of the bits from
+ * _MESA_NEW_NEED_EYE_COORDS.
+ */
+}
diff --git a/src/mesa/main/state.h b/src/mesa/main/state.h
index 67a62c3d4e..641c0c3413 100644
--- a/src/mesa/main/state.h
+++ b/src/mesa/main/state.h
@@ -1,4 +1,4 @@
-/* $Id: state.h,v 1.7 2001/03/12 00:48:38 gareth Exp $ */
+/* $Id: state.h,v 1.8 2002/02/13 00:53:19 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -46,5 +46,7 @@ _mesa_print_state( const char *msg, GLuint state );
extern void
_mesa_print_enable_flags( const char *msg, GLuint flags );
+extern void
+_mesa_allow_light_in_model( GLcontext *ctx, GLboolean flag );
#endif
diff --git a/src/mesa/tnl/t_context.c b/src/mesa/tnl/t_context.c
index ae1d7f5361..2cea4b1dcd 100644
--- a/src/mesa/tnl/t_context.c
+++ b/src/mesa/tnl/t_context.c
@@ -1,4 +1,4 @@
-/* $Id: t_context.c,v 1.23 2001/12/18 04:06:46 brianp Exp $ */
+/* $Id: t_context.c,v 1.24 2002/02/13 00:53:20 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -33,6 +33,7 @@
#include "mtypes.h"
#include "mem.h"
#include "dlist.h"
+#include "light.h"
#include "vtxfmt.h"
#include "t_context.h"
@@ -125,6 +126,8 @@ _tnl_CreateContext( GLcontext *ctx )
tnl->Driver.Render.PrimTabElts = _tnl_render_tab_elts;
tnl->Driver.Render.PrimTabVerts = _tnl_render_tab_verts;
+ tnl->Driver.NotifyMaterialChange = _mesa_validate_all_lighting_tables;
+
return GL_TRUE;
@@ -220,16 +223,19 @@ void
_tnl_need_dlist_loopback( GLcontext *ctx, GLboolean mode )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
- if (tnl->LoopbackDListCassettes != mode) {
- tnl->LoopbackDListCassettes = mode;
- }
+ tnl->LoopbackDListCassettes = mode;
}
void
_tnl_need_dlist_norm_lengths( GLcontext *ctx, GLboolean mode )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
- if (tnl->CalcDListNormalLengths != mode) {
- tnl->CalcDListNormalLengths = mode;
- }
+ tnl->CalcDListNormalLengths = mode;
+}
+
+void
+_tnl_isolate_materials( GLcontext *ctx, GLboolean mode )
+{
+ TNLcontext *tnl = TNL_CONTEXT(ctx);
+ tnl->IsolateMaterials = mode;
}
diff --git a/src/mesa/tnl/t_context.h b/src/mesa/tnl/t_context.h
index db0bd7a474..98ff545604 100644
--- a/src/mesa/tnl/t_context.h
+++ b/src/mesa/tnl/t_context.h
@@ -1,4 +1,4 @@
-/* $Id: t_context.h,v 1.37 2002/01/22 14:35:16 brianp Exp $ */
+/* $Id: t_context.h,v 1.38 2002/02/13 00:53:20 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -386,6 +386,12 @@ struct tnl_device_driver {
* and grab/release hardware locks.
*/
+ void (*NotifyMaterialChange)(GLcontext *ctx);
+ /* Alert tnl-aware drivers of changes to material, especially in
+ * exec_empty_cassette, which doesn't otherwise reach the driver.
+ * --> Need to be able to disable exec_empty_cassette???
+ */
+
/***
*** Rendering -- These functions called only from t_vb_render.c
***/
@@ -524,6 +530,7 @@ typedef struct {
GLboolean NeedNdcCoords;
GLboolean LoopbackDListCassettes;
GLboolean CalcDListNormalLengths;
+ GLboolean IsolateMaterials;
/* Derived state and storage for _tnl_eval_vb:
*/
diff --git a/src/mesa/tnl/t_imm_api.c b/src/mesa/tnl/t_imm_api.c
index dd90dbe540..d19f6a6e00 100644
--- a/src/mesa/tnl/t_imm_api.c
+++ b/src/mesa/tnl/t_imm_api.c
@@ -1,4 +1,4 @@
-/* $Id: t_imm_api.c,v 1.24 2002/01/22 14:35:16 brianp Exp $ */
+/* $Id: t_imm_api.c,v 1.25 2002/02/13 00:53:20 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -553,6 +553,8 @@ static void
_tnl_Normal3fv( const GLfloat *v )
{
NORMALF( v[0], v[1], v[2] );
+/* struct immediate *IM = (struct immediate *)(((GLcontext *) _glapi_Context)->swtnl_im); */
+/* IM->Flag[IM->Count] = VERT_NORM; */
}
@@ -1154,6 +1156,7 @@ static void
_tnl_Materialfv( GLenum face, GLenum pname, const GLfloat *params )
{
GET_CURRENT_CONTEXT(ctx);
+ TNLcontext *tnl = TNL_CONTEXT(ctx);
struct immediate *IM = TNL_CURRENT_IM(ctx);
GLuint count = IM->Count;
struct gl_material *mat;
@@ -1162,6 +1165,14 @@ _tnl_Materialfv( GLenum face, GLenum pname, const GLfloat *params )
if (bitmask == 0)
return;
+ if (tnl->IsolateMaterials &&
+ !(IM->BeginState & VERT_BEGIN_1)) /* heuristic */
+ {
+ _tnl_flush_immediate( IM );
+ IM = TNL_CURRENT_IM(ctx);
+ count = IM->Count;
+ }
+
if (!(IM->Flag[count] & VERT_BIT_MATERIAL)) {
if (!IM->Material) {
IM->Material = (struct gl_material (*)[2])
@@ -1227,6 +1238,12 @@ _tnl_Materialfv( GLenum face, GLenum pname, const GLfloat *params )
mat[1].DiffuseIndex = params[1];
mat[1].SpecularIndex = params[2];
}
+
+ if (tnl->IsolateMaterials &&
+ !(IM->BeginState & VERT_BEGIN_1)) /* heuristic */
+ {
+ _tnl_flush_immediate( IM );
+ }
}
void _tnl_imm_vtxfmt_init( GLcontext *ctx )
diff --git a/src/mesa/tnl/t_imm_dlist.c b/src/mesa/tnl/t_imm_dlist.c
index 125dbc5ed6..dfc4e7795d 100644
--- a/src/mesa/tnl/t_imm_dlist.c
+++ b/src/mesa/tnl/t_imm_dlist.c
@@ -1,4 +1,4 @@
-/* $Id: t_imm_dlist.c,v 1.37 2002/01/22 14:35:16 brianp Exp $ */
+/* $Id: t_imm_dlist.c,v 1.38 2002/02/13 00:53:20 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -339,6 +339,7 @@ execute_compiled_cassette( GLcontext *ctx, void *data )
}
if (tnl->LoopbackDListCassettes) {
+/* (tnl->IsolateMaterials && (IM->OrFlag & VERT_MATERIAL)) ) { */
fixup_compiled_primitives( ctx, IM );
loopback_compiled_cassette( ctx, IM );
restore_compiled_primitives( ctx, IM );
diff --git a/src/mesa/tnl/t_imm_exec.c b/src/mesa/tnl/t_imm_exec.c
index 056df78d0a..bc35480acc 100644
--- a/src/mesa/tnl/t_imm_exec.c
+++ b/src/mesa/tnl/t_imm_exec.c
@@ -1,4 +1,4 @@
-/* $Id: t_imm_exec.c,v 1.35 2002/01/22 14:35:16 brianp Exp $ */
+/* $Id: t_imm_exec.c,v 1.36 2002/02/13 00:53:20 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -149,7 +149,7 @@ void _tnl_copy_to_current( GLcontext *ctx, struct immediate *IM,
if (ctx->Light.ColorMaterialEnabled) {
_mesa_update_color_material( ctx,
ctx->Current.Attrib[VERT_ATTRIB_COLOR0] );
- _mesa_validate_all_lighting_tables( ctx );
+ TNL_CONTEXT(ctx)->Driver.NotifyMaterialChange( ctx );
}
}
@@ -175,7 +175,7 @@ void _tnl_copy_to_current( GLcontext *ctx, struct immediate *IM,
IM->Material[IM->LastMaterial],
IM->MaterialOrMask );
- _mesa_validate_all_lighting_tables( ctx );
+ TNL_CONTEXT(ctx)->Driver.NotifyMaterialChange( ctx );
}
}
@@ -356,7 +356,7 @@ static void _tnl_vb_bind_immediate( GLcontext *ctx, struct immediate *IM )
}
}
- if ((inputs & VERT_BIT_MATERIAL) && IM->Material) {
+ if ((inputs & IM->OrFlag & VERT_BIT_MATERIAL) && IM->Material) {
VB->MaterialMask = IM->MaterialMask + start;
VB->Material = IM->Material + start;
}
@@ -482,7 +482,7 @@ void _tnl_execute_cassette( GLcontext *ctx, struct immediate *IM )
if (tnl->pipeline.build_state_changes)
_tnl_validate_pipeline( ctx );
- if (IM->CopyStart == IM->Count) {
+ if (0 && IM->CopyStart == IM->Count) {
exec_empty_cassette( ctx, IM );
}
else if ((IM->CopyOrFlag & VERT_BITS_DATA) == VERT_BIT_ELT &&
diff --git a/src/mesa/tnl/t_imm_fixup.c b/src/mesa/tnl/t_imm_fixup.c
index d08c162efe..8e3f52e621 100644
--- a/src/mesa/tnl/t_imm_fixup.c
+++ b/src/mesa/tnl/t_imm_fixup.c
@@ -1,4 +1,4 @@
-/* $Id: t_imm_fixup.c,v 1.33 2002/01/22 14:35:16 brianp Exp $ */
+/* $Id: t_imm_fixup.c,v 1.34 2002/02/13 00:53:20 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -396,6 +396,8 @@ copy_material( struct immediate *next,
struct immediate *prev,
GLuint dst, GLuint src )
{
+/* fprintf(stderr, "%s\n", __FUNCTION__); */
+
if (next->Material == 0) {
next->Material = (struct gl_material (*)[2])
MALLOC( sizeof(struct gl_material) * IMM_SIZE * 2 );
@@ -461,6 +463,7 @@ void _tnl_copy_immediate_vertices( GLcontext *ctx, struct immediate *next )
GLuint dst = next->CopyStart+i;
next->Elt[dst] = prev->Elt[src];
next->Flag[dst] = VERT_BIT_ELT;
+ elts[i+offset] = dst;
}
/* fprintf(stderr, "ADDING VERT_BIT_ELT!\n"); */
next->CopyOrFlag |= VERT_BIT_ELT;
@@ -551,14 +554,14 @@ void _tnl_copy_immediate_vertices( GLcontext *ctx, struct immediate *next )
next->CopyOrFlag |= prev->Flag[src] & (VERT_BITS_FIXUP|
VERT_BIT_MATERIAL|
VERT_BIT_POS);
+ elts[i+offset] = dst;
}
}
- if (--tnl->ExecCopySource->ref_count == 0)
+ if (--tnl->ExecCopySource->ref_count == 0)
_tnl_free_immediate( tnl->ExecCopySource );
-
- tnl->ExecCopySource = 0;
- tnl->ExecCopyCount = 0;
+
+ tnl->ExecCopySource = next; next->ref_count++;
}
@@ -766,17 +769,19 @@ _tnl_get_exec_copy_verts( GLcontext *ctx, struct immediate *IM )
/* fprintf(stderr, "_tnl_get_exec_copy_verts %s\n", */
/* _mesa_lookup_enum_by_nr(prim)); */
- ASSERT(tnl->ExecCopySource == 0);
+ if (tnl->ExecCopySource)
+ if (--tnl->ExecCopySource->ref_count == 0)
+ _tnl_free_immediate( tnl->ExecCopySource );
if (prim == GL_POLYGON+1) {
+ tnl->ExecCopySource = 0;
tnl->ExecCopyCount = 0;
tnl->ExecCopyTexSize = 0;
tnl->ExecParity = 0;
} else {
/* Remember this immediate as the one to copy from.
*/
- IM->ref_count++;
- tnl->ExecCopySource = IM;
+ tnl->ExecCopySource = IM; IM->ref_count++;
tnl->ExecCopyCount = 0;
tnl->ExecCopyTexSize = IM->CopyTexSize;
diff --git a/src/mesa/tnl/t_vb_light.c b/src/mesa/tnl/t_vb_light.c
index 32444ee3aa..99f15d8036 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.17 2002/01/22 14:35:17 brianp Exp $ */
+/* $Id: t_vb_light.c,v 1.18 2002/02/13 00:53:20 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -232,7 +232,7 @@ static GLboolean run_validate_lighting( GLcontext *ctx,
/* This and the above should only be done on _NEW_LIGHT:
*/
- _mesa_validate_all_lighting_tables( ctx );
+ TNL_CONTEXT(ctx)->Driver.NotifyMaterialChange( ctx );
/* Now run the stage...
*/
diff --git a/src/mesa/tnl/t_vb_lighttmp.h b/src/mesa/tnl/t_vb_lighttmp.h
index ef25cd69bc..aac8890180 100644
--- a/src/mesa/tnl/t_vb_lighttmp.h
+++ b/src/mesa/tnl/t_vb_lighttmp.h
@@ -1,4 +1,4 @@
-/* $Id: t_vb_lighttmp.h,v 1.24 2002/01/22 14:35:17 brianp Exp $ */
+/* $Id: t_vb_lighttmp.h,v 1.25 2002/02/13 00:53:20 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -163,7 +163,7 @@ static void TAG(light_rgba_spec)( GLcontext *ctx,
_mesa_update_material( ctx, new_material[j], new_material_mask[j] );
if ( CHECK_VALIDATE(j) ) {
- _mesa_validate_all_lighting_tables( ctx );
+ TNL_CONTEXT(ctx)->Driver.NotifyMaterialChange( ctx );
UNCLAMPED_FLOAT_TO_CHAN(sumA[0], ctx->Light.Material[0].Diffuse[3]);
if (IDX & LIGHT_TWOSIDE)
UNCLAMPED_FLOAT_TO_CHAN(sumA[1], ctx->Light.Material[1].Diffuse[3]);
@@ -375,7 +375,7 @@ static void TAG(light_rgba)( GLcontext *ctx,
_mesa_update_material( ctx, new_material[j], new_material_mask[j] );
if ( CHECK_VALIDATE(j) ) {
- _mesa_validate_all_lighting_tables( ctx );
+ TNL_CONTEXT(ctx)->Driver.NotifyMaterialChange( ctx );
UNCLAMPED_FLOAT_TO_CHAN(sumA[0], ctx->Light.Material[0].Diffuse[3]);
if (IDX & LIGHT_TWOSIDE)
UNCLAMPED_FLOAT_TO_CHAN(sumA[1], ctx->Light.Material[1].Diffuse[3]);
@@ -576,7 +576,7 @@ static void TAG(light_fast_rgba_single)( GLcontext *ctx,
_mesa_update_material( ctx, new_material[j], new_material_mask[j] );
if ( CHECK_VALIDATE(j) )
- _mesa_validate_all_lighting_tables( ctx );
+ TNL_CONTEXT(ctx)->Driver.NotifyMaterialChange( ctx );
/* No attenuation, so incoporate _MatAmbient into base color.
@@ -708,7 +708,7 @@ static void TAG(light_fast_rgba)( GLcontext *ctx,
_mesa_update_material( ctx, new_material[j], new_material_mask[j] );
if ( CHECK_VALIDATE(j) ) {
- _mesa_validate_all_lighting_tables( ctx );
+ TNL_CONTEXT(ctx)->Driver.NotifyMaterialChange( ctx );
UNCLAMPED_FLOAT_TO_CHAN(sumA[0], ctx->Light.Material[0].Diffuse[3]);
if (IDX & LIGHT_TWOSIDE)
UNCLAMPED_FLOAT_TO_CHAN(sumA[1],
@@ -853,7 +853,7 @@ static void TAG(light_ci)( GLcontext *ctx,
_mesa_update_material( ctx, new_material[j], new_material_mask[j] );
if ( CHECK_VALIDATE(j) )
- _mesa_validate_all_lighting_tables( ctx );
+ TNL_CONTEXT(ctx)->Driver.NotifyMaterialChange( ctx );
diffuse[0] = specular[0] = 0.0F;
diff --git a/src/mesa/tnl/t_vb_render.c b/src/mesa/tnl/t_vb_render.c
index 5ccec25cb2..1721b88323 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.27 2002/01/22 14:35:17 brianp Exp $ */
+/* $Id: t_vb_render.c,v 1.28 2002/02/13 00:53:20 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -142,7 +142,7 @@ do { \
#define TAG(x) clip_##x##_verts
#define INIT(x) tnl->Driver.Render.PrimitiveNotify( ctx, x )
-#define RESET_STIPPLE tnl->Driver.Render.ResetLineStipple( ctx )
+#define RESET_STIPPLE if (stipple) tnl->Driver.Render.ResetLineStipple( ctx )
#define RESET_OCCLUSION ctx->OcclusionResult = GL_TRUE
#define PRESERVE_VB_DEFS
#include "t_vb_rendertmp.h"
@@ -229,7 +229,7 @@ static void clip_elt_triangles( GLcontext *ctx,
(void) (LineFunc && TriangleFunc && QuadFunc); \
(void) elt; (void) stipple
-#define RESET_STIPPLE tnl->Driver.Render.ResetLineStipple( ctx )
+#define RESET_STIPPLE if (stipple) tnl->Driver.Render.ResetLineStipple( ctx )
#define RESET_OCCLUSION ctx->OcclusionResult = GL_TRUE
#define INIT(x) tnl->Driver.Render.PrimitiveNotify( ctx, x )
#define RENDER_TAB_QUALIFIER
diff --git a/src/mesa/tnl/t_vb_rendertmp.h b/src/mesa/tnl/t_vb_rendertmp.h
index 7e9f6842c7..16528db6ad 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.8 2001/03/12 00:48:44 gareth Exp $ */
+/* $Id: t_vb_rendertmp.h,v 1.9 2002/02/13 00:53:20 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -90,8 +90,8 @@ static void TAG(render_lines)( GLcontext *ctx,
RESET_OCCLUSION;
INIT(GL_LINES);
for (j=start+1; j<count; j+=2 ) {
- RENDER_LINE( ELT(j-1), ELT(j) );
RESET_STIPPLE;
+ RENDER_LINE( ELT(j-1), ELT(j) );
}
POSTFIX;
}
@@ -109,12 +109,13 @@ static void TAG(render_line_strip)( GLcontext *ctx,
RESET_OCCLUSION;
INIT(GL_LINE_STRIP);
+ if (TEST_PRIM_BEGIN(flags)) {
+ RESET_STIPPLE;
+ }
+
for (j=start+1; j<count; j++ )
RENDER_LINE( ELT(j-1), ELT(j) );
- if (TEST_PRIM_END(flags))
- RESET_STIPPLE;
-
POSTFIX;
}
@@ -134,6 +135,7 @@ static void TAG(render_line_loop)( GLcontext *ctx,
if (start+1 < count) {
if (TEST_PRIM_BEGIN(flags)) {
+ RESET_STIPPLE;
RENDER_LINE( ELT(start), ELT(start+1) );
}
@@ -143,7 +145,6 @@ static void TAG(render_line_loop)( GLcontext *ctx,
if ( TEST_PRIM_END(flags)) {
RENDER_LINE( ELT(count-1), ELT(start) );
- RESET_STIPPLE;
}
}
@@ -165,8 +166,8 @@ static void TAG(render_triangles)( GLcontext *ctx,
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) );
RESET_STIPPLE;
+ RENDER_TRI( ELT(j-2), ELT(j-1), ELT(j) );
}
} else {
for (j=start+2; j<count; j+=3) {
@@ -199,6 +200,9 @@ static void TAG(render_tri_strip)( GLcontext *ctx,
GLboolean ef2 = EDGEFLAG_GET( ej2 );
GLboolean ef1 = EDGEFLAG_GET( ej1 );
GLboolean ef = EDGEFLAG_GET( ej );
+ if (TEST_PRIM_BEGIN(flags)) {
+ RESET_STIPPLE;
+ }
EDGEFLAG_SET( ej2, GL_TRUE );
EDGEFLAG_SET( ej1, GL_TRUE );
EDGEFLAG_SET( ej, GL_TRUE );
@@ -206,7 +210,6 @@ static void TAG(render_tri_strip)( GLcontext *ctx,
EDGEFLAG_SET( ej2, ef2 );
EDGEFLAG_SET( ej1, ef1 );
EDGEFLAG_SET( ej, ef );
- RESET_STIPPLE;
}
} else {
for (j=start+2; j<count ; j++, parity^=1) {
@@ -237,6 +240,9 @@ static void TAG(render_tri_fan)( GLcontext *ctx,
GLboolean efs = EDGEFLAG_GET( ejs );
GLboolean ef1 = EDGEFLAG_GET( ej1 );
GLboolean ef = EDGEFLAG_GET( ej );
+ if (TEST_PRIM_BEGIN(flags)) {
+ RESET_STIPPLE;
+ }
EDGEFLAG_SET( ejs, GL_TRUE );
EDGEFLAG_SET( ej1, GL_TRUE );
EDGEFLAG_SET( ej, GL_TRUE );
@@ -244,7 +250,6 @@ static void TAG(render_tri_fan)( GLcontext *ctx,
EDGEFLAG_SET( ejs, efs );
EDGEFLAG_SET( ej1, ef1 );
EDGEFLAG_SET( ej, ef );
- RESET_STIPPLE;
}
} else {
for (j=start+2;j<count;j++) {
@@ -275,6 +280,9 @@ static void TAG(render_poly)( GLcontext *ctx,
*/
if (!TEST_PRIM_BEGIN(flags))
EDGEFLAG_SET( ELT(start), GL_FALSE );
+ else {
+ RESET_STIPPLE;
+ }
/* If the primitive does not end here, the final edge is
* non-boundary.
@@ -284,7 +292,7 @@ static void TAG(render_poly)( GLcontext *ctx,
/* Draw the first triangles (possibly zero)
*/
- if (j<count-1) {
+ if (j+1<count) {
GLboolean ef = EDGEFLAG_GET( ELT(j) );
EDGEFLAG_SET( ELT(j), GL_FALSE );
RENDER_TRI( ELT(j-1), ELT(j), ELT(start) );
@@ -295,7 +303,7 @@ static void TAG(render_poly)( GLcontext *ctx,
*/
EDGEFLAG_SET( ELT(start), GL_FALSE );
- for (;j<count-1;j++) {
+ for (;j+1<count;j++) {
GLboolean efj = EDGEFLAG_GET( ELT(j) );
EDGEFLAG_SET( ELT(j), GL_FALSE );
RENDER_TRI( ELT(j-1), ELT(j), ELT(start) );
@@ -313,9 +321,6 @@ static void TAG(render_poly)( GLcontext *ctx,
EDGEFLAG_SET( ELT(count-1), efcount );
EDGEFLAG_SET( ELT(start), efstart );
- if (TEST_PRIM_END(flags)) {
- RESET_STIPPLE;
- }
}
else {
for (j=start+2;j<count;j++) {
@@ -339,8 +344,8 @@ static void TAG(render_quads)( GLcontext *ctx,
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) );
RESET_STIPPLE;
+ RENDER_QUAD( ELT(j-3), ELT(j-2), ELT(j-1), ELT(j) );
}
} else {
for (j=start+3; j<count; j+=4) {
@@ -369,6 +374,9 @@ static void TAG(render_quad_strip)( GLcontext *ctx,
GLboolean ef2 = EDGEFLAG_GET( ELT(j-2) );
GLboolean ef1 = EDGEFLAG_GET( ELT(j-1) );
GLboolean ef = EDGEFLAG_GET( ELT(j) );
+ if (TEST_PRIM_BEGIN(flags)) {
+ RESET_STIPPLE;
+ }
EDGEFLAG_SET( ELT(j-3), GL_TRUE );
EDGEFLAG_SET( ELT(j-2), GL_TRUE );
EDGEFLAG_SET( ELT(j-1), GL_TRUE );
@@ -378,7 +386,6 @@ static void TAG(render_quad_strip)( GLcontext *ctx,
EDGEFLAG_SET( ELT(j-2), ef2 );
EDGEFLAG_SET( ELT(j-1), ef1 );
EDGEFLAG_SET( ELT(j), ef );
- RESET_STIPPLE;
}
} else {
for (j=start+3;j<count;j+=2) {
diff --git a/src/mesa/tnl/tnl.h b/src/mesa/tnl/tnl.h
index 16470295f4..c3c3ad7adb 100644
--- a/src/mesa/tnl/tnl.h
+++ b/src/mesa/tnl/tnl.h
@@ -1,4 +1,4 @@
-/* $Id: tnl.h,v 1.8 2001/06/28 17:34:14 keithw Exp $ */
+/* $Id: tnl.h,v 1.9 2002/02/13 00:53:20 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -72,4 +72,7 @@ _tnl_need_dlist_loopback( GLcontext *ctx, GLboolean flag );
extern void
_tnl_need_dlist_norm_lengths( GLcontext *ctx, GLboolean flag );
+extern void
+_tnl_isolate_materials( GLcontext *ctx, GLboolean flag );
+
#endif