More suport for t&l drivers

Fix GLuint compare bugs
Fix RESET_STIPPLE calls
This commit is contained in:
Keith Whitwell
2002-02-13 00:53:19 +00:00
parent 12a1024d9d
commit 0cb28418d0
22 changed files with 231 additions and 116 deletions

View File

@@ -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 * Mesa 3-D graphics library
@@ -201,7 +201,7 @@ static void TAG(render_line_strip_verts)( GLcontext *ctx,
if (currentsz < 8) if (currentsz < 8)
currentsz = dmasz; 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 ); nr = MIN2( currentsz, count - j );
EMIT_VERTS( ctx, j, nr ); EMIT_VERTS( ctx, j, nr );
currentsz = dmasz; currentsz = dmasz;
@@ -242,7 +242,7 @@ static void TAG(render_line_loop_verts)( GLcontext *ctx,
if (currentsz < 8) if (currentsz < 8)
currentsz = dmasz; currentsz = dmasz;
for ( ; j < count - 1; j += nr - 1 ) { for ( ; j + 1 < count; j += nr - 1 ) {
nr = MIN2( currentsz, count - j ); nr = MIN2( currentsz, count - j );
EMIT_VERTS( ctx, j, nr ); EMIT_VERTS( ctx, j, nr );
currentsz = dmasz; currentsz = dmasz;
@@ -306,7 +306,7 @@ static void TAG(render_tri_strip_verts)( GLcontext *ctx,
currentsz = GET_CURRENT_VB_MAX_VERTS(); currentsz = GET_CURRENT_VB_MAX_VERTS();
if (currentsz < 8) { if (currentsz < 8) {
FIRE_VERTICES(); NEW_BUFFER();
currentsz = dmasz; currentsz = dmasz;
} }
@@ -323,7 +323,7 @@ static void TAG(render_tri_strip_verts)( GLcontext *ctx,
dmasz -= (dmasz & 1); dmasz -= (dmasz & 1);
currentsz -= (currentsz & 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 ); nr = MIN2( currentsz, count - j );
EMIT_VERTS( ctx, j, nr ); EMIT_VERTS( ctx, j, nr );
currentsz = dmasz; currentsz = dmasz;
@@ -351,11 +351,11 @@ static void TAG(render_tri_fan_verts)( GLcontext *ctx,
INIT(GL_TRIANGLE_FAN); INIT(GL_TRIANGLE_FAN);
if (currentsz < 8) { if (currentsz < 8) {
FIRE_VERTICES(); NEW_BUFFER();
currentsz = dmasz; 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 ); nr = MIN2( currentsz, count - j + 1 );
EMIT_VERTS( ctx, start, 1 ); EMIT_VERTS( ctx, start, 1 );
EMIT_VERTS( ctx, j, nr - 1 ); EMIT_VERTS( ctx, j, nr - 1 );
@@ -389,11 +389,11 @@ static void TAG(render_poly_verts)( GLcontext *ctx,
INIT(GL_POLYGON); INIT(GL_POLYGON);
if (currentsz < 8) { if (currentsz < 8) {
FIRE_VERTICES(); NEW_BUFFER();
currentsz = dmasz; 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 ); nr = MIN2( currentsz, count - j + 1 );
EMIT_VERTS( ctx, start, 1 ); EMIT_VERTS( ctx, start, 1 );
EMIT_VERTS( ctx, j, nr - 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(); currentsz = GET_CURRENT_VB_MAX_VERTS();
if (currentsz < 8) { if (currentsz < 8) {
FIRE_VERTICES(); NEW_BUFFER();
currentsz = dmasz; currentsz = dmasz;
} }
dmasz -= (dmasz & 2); dmasz -= (dmasz & 2);
currentsz -= (currentsz & 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 ); nr = MIN2( currentsz, count - j );
EMIT_VERTS( ctx, j, nr ); EMIT_VERTS( ctx, j, nr );
currentsz = dmasz; currentsz = dmasz;
@@ -444,7 +444,7 @@ static void TAG(render_quad_strip_verts)( GLcontext *ctx,
FINISH; 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 )) { if (TAG(emit_elt_verts)( ctx, start, count )) {
LOCAL_VARS; LOCAL_VARS;
int dmasz = GET_SUBSEQUENT_VB_MAX_ELTS(); int dmasz = GET_SUBSEQUENT_VB_MAX_ELTS();
@@ -470,7 +470,7 @@ static void TAG(render_quad_strip_verts)( GLcontext *ctx,
currentsz = currentsz/6*2; currentsz = currentsz/6*2;
dmasz = dmasz/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 ); nr = MIN2( currentsz, count - j );
if (nr >= 4) { if (nr >= 4) {
GLint quads = (nr/2)-1; GLint quads = (nr/2)-1;
@@ -518,11 +518,11 @@ static void TAG(render_quad_strip_verts)( GLcontext *ctx,
count -= (count-start) & 1; count -= (count-start) & 1;
if (currentsz < 8) { if (currentsz < 8) {
FIRE_VERTICES(); NEW_BUFFER();
currentsz = dmasz; 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 ); nr = MIN2( currentsz, count - j );
EMIT_VERTS( ctx, j, nr ); EMIT_VERTS( ctx, j, nr );
currentsz = dmasz; currentsz = dmasz;
@@ -739,7 +739,7 @@ static void TAG(render_line_strip_elts)( GLcontext *ctx,
if (currentsz < 8) if (currentsz < 8)
currentsz = dmasz; 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 ); nr = MIN2( currentsz, count - j );
TAG(emit_elts)( ctx, elts+j, nr ); TAG(emit_elts)( ctx, elts+j, nr );
NEW_PRIMITIVE(); NEW_PRIMITIVE();
@@ -775,7 +775,7 @@ static void TAG(render_line_loop_elts)( GLcontext *ctx,
currentsz = GET_CURRENT_VB_MAX_ELTS(); currentsz = GET_CURRENT_VB_MAX_ELTS();
if (currentsz < 8) { if (currentsz < 8) {
FIRE_VERTICES(); NEW_BUFFER();
currentsz = dmasz; currentsz = dmasz;
} }
@@ -784,7 +784,7 @@ static void TAG(render_line_loop_elts)( GLcontext *ctx,
currentsz--; currentsz--;
dmasz--; dmasz--;
for ( ; j < count - 1; j += nr - 1 ) { for ( ; j + 1 < count; j += nr - 1 ) {
nr = MIN2( currentsz, count - j ); nr = MIN2( currentsz, count - j );
/* NEW_PRIMITIVE(); */ /* NEW_PRIMITIVE(); */
TAG(emit_elts)( ctx, elts+j, nr ); 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(); currentsz = GET_CURRENT_VB_MAX_ELTS();
if (currentsz < 8) { if (currentsz < 8) {
FIRE_VERTICES(); NEW_BUFFER();
currentsz = dmasz; currentsz = dmasz;
} }
@@ -870,7 +870,7 @@ static void TAG(render_tri_strip_elts)( GLcontext *ctx,
dmasz -= (dmasz & 1); dmasz -= (dmasz & 1);
currentsz -= (currentsz & 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 ); nr = MIN2( currentsz, count - j );
TAG(emit_elts)( ctx, elts+j, nr ); TAG(emit_elts)( ctx, elts+j, nr );
NEW_PRIMITIVE(); NEW_PRIMITIVE();
@@ -899,11 +899,11 @@ static void TAG(render_tri_fan_elts)( GLcontext *ctx,
currentsz = GET_CURRENT_VB_MAX_ELTS(); currentsz = GET_CURRENT_VB_MAX_ELTS();
if (currentsz < 8) { if (currentsz < 8) {
FIRE_VERTICES(); NEW_BUFFER();
currentsz = dmasz; 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 ); nr = MIN2( currentsz, count - j + 1 );
TAG(emit_elts)( ctx, elts+start, 1 ); TAG(emit_elts)( ctx, elts+start, 1 );
TAG(emit_elts)( ctx, elts+j, nr - 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(); currentsz = GET_CURRENT_VB_MAX_ELTS();
if (currentsz < 8) { if (currentsz < 8) {
FIRE_VERTICES(); NEW_BUFFER();
currentsz = dmasz; 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 ); nr = MIN2( currentsz, count - j + 1 );
TAG(emit_elts)( ctx, elts+start, 1 ); TAG(emit_elts)( ctx, elts+start, 1 );
TAG(emit_elts)( ctx, elts+j, nr - 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; currentsz = currentsz/6*2;
dmasz = dmasz/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 ); nr = MIN2( currentsz, count - j );
if (nr >= 4) if (nr >= 4)
@@ -1012,7 +1012,7 @@ static void TAG(render_quad_strip_elts)( GLcontext *ctx,
else { else {
ELT_INIT( GL_TRIANGLE_STRIP ); 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 ); nr = MIN2( currentsz, count - j );
TAG(emit_elts)( ctx, elts+j, nr ); TAG(emit_elts)( ctx, elts+j, nr );
NEW_PRIMITIVE(); NEW_PRIMITIVE();
@@ -1053,7 +1053,7 @@ static void TAG(render_quads_elts)( GLcontext *ctx,
if (currentsz < 8) if (currentsz < 8)
currentsz = dmasz; 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 ); nr = MIN2( currentsz, count - j );
if (nr >= 4) if (nr >= 4)

View File

@@ -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 * Mesa 3-D graphics library
@@ -136,6 +136,9 @@ static void TAG(emit)( GLcontext *ctx,
const GLubyte *mask = VB->ClipMask; const GLubyte *mask = VB->ClipMask;
int i; 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) { if (HAVE_HW_VIEWPORT && HAVE_HW_DIVIDE && CHECK_HW_DIVIDE) {
(void) s; (void) s;
coord = VB->ClipPtr->data; coord = VB->ClipPtr->data;
@@ -226,6 +229,8 @@ static void TAG(emit)( GLcontext *ctx,
VIEWPORT_Z(v->v.z, coord[0][2]); VIEWPORT_Z(v->v.z, coord[0][2]);
v->v.w = coord[0][3]; 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); coord = (GLfloat (*)[4])((GLubyte *)coord + coord_stride);
} }
if (DO_RGBA) { if (DO_RGBA) {
@@ -417,8 +422,8 @@ static void TAG(emit)( GLcontext *ctx, GLuint start, GLuint end,
col_stride = VB->ColorPtr[0]->StrideB; col_stride = VB->ColorPtr[0]->StrideB;
ASSERT(VB->ColorPtr[0]->Type == GL_UNSIGNED_BYTE); ASSERT(VB->ColorPtr[0]->Type == GL_UNSIGNED_BYTE);
/* fprintf(stderr, "%s stride %d importable %d\n", */ /* fprintf(stderr, "%s(small) importable %x\n", */
/* __FUNCTION__, col_stride, VB->importable_data); */ /* __FUNCTION__, VB->importable_data); */
/* Pack what's left into a 4-dword vertex. Color is in a different /* Pack what's left into a 4-dword vertex. Color is in a different
* place, and there is no 'w' coordinate. * 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 ); 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 { else {
@@ -470,6 +477,9 @@ static void TAG(emit)( GLcontext *ctx, GLuint start, GLuint end,
b[3] = col[i][3]; b[3] = col[i][3];
} }
} }
/* fprintf(stderr, "vert %d: %.2f %.2f %.2f %x\n", */
/* i, v[0], v[1], v[2], *(int *)&v[3]); */
} }
} }
} }

View File

@@ -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 * Mesa 3-D graphics library
@@ -52,6 +52,7 @@
#include "texobj.h" #include "texobj.h"
#include "texstate.h" #include "texstate.h"
#include "mtypes.h" #include "mtypes.h"
#include "math/m_xform.h"
#endif #endif
@@ -917,11 +918,30 @@ _mesa_PopAttrib(void)
/* lighting enable */ /* lighting enable */
_mesa_set_enable(ctx, GL_LIGHTING, light->Enabled); _mesa_set_enable(ctx, GL_LIGHTING, light->Enabled);
/* per-light state */ /* per-light state */
if (ctx->ModelviewMatrixStack.Top->flags & MAT_DIRTY_INVERSE)
_math_matrix_analyse( ctx->ModelviewMatrixStack.Top );
for (i = 0; i < MAX_LIGHTS; i++) { for (i = 0; i < MAX_LIGHTS; i++) {
GLenum lgt = (GLenum) (GL_LIGHT0 + i); GLenum lgt = (GLenum) (GL_LIGHT0 + i);
_mesa_set_enable(ctx, lgt, light->Light[i].Enabled); const struct gl_light *l = &light->Light[i];
MEMCPY(&ctx->Light.Light[i], &light->Light[i], GLfloat tmp[4];
sizeof(struct gl_light)); _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 */ /* light model */
_mesa_LightModelfv(GL_LIGHT_MODEL_AMBIENT, _mesa_LightModelfv(GL_LIGHT_MODEL_AMBIENT,
@@ -1030,15 +1050,16 @@ _mesa_PopAttrib(void)
const struct gl_transform_attrib *xform; const struct gl_transform_attrib *xform;
xform = (const struct gl_transform_attrib *) attr->data; xform = (const struct gl_transform_attrib *) attr->data;
_mesa_MatrixMode(xform->MatrixMode); _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++) { 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, _mesa_set_enable(ctx, GL_CLIP_PLANE0 + i,
xform->ClipEnabled[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 */ /* normalize/rescale */
_mesa_set_enable(ctx, GL_NORMALIZE, ctx->Transform.Normalize); _mesa_set_enable(ctx, GL_NORMALIZE, ctx->Transform.Normalize);

View File

@@ -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 * Mesa 3-D graphics library
@@ -31,7 +31,6 @@
#include "mtypes.h" #include "mtypes.h"
extern void extern void
_mesa_PushAttrib( GLbitfield mask ); _mesa_PushAttrib( GLbitfield mask );

View File

@@ -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 * Mesa 3-D graphics library
@@ -474,10 +474,11 @@ struct dd_function_table {
void (*ClearDepth)(GLcontext *ctx, GLclampd d); void (*ClearDepth)(GLcontext *ctx, GLclampd d);
void (*ClearIndex)(GLcontext *ctx, GLuint index); void (*ClearIndex)(GLcontext *ctx, GLuint index);
void (*ClearStencil)(GLcontext *ctx, GLint s); void (*ClearStencil)(GLcontext *ctx, GLint s);
void (*ClipPlane)(GLcontext *ctx, GLenum plane, const GLfloat *equation );
void (*ColorMask)(GLcontext *ctx, GLboolean rmask, GLboolean gmask, void (*ColorMask)(GLcontext *ctx, GLboolean rmask, GLboolean gmask,
GLboolean bmask, GLboolean amask ); GLboolean bmask, GLboolean amask );
void (*ColorMaterial)(GLcontext *ctx, GLenum face, GLenum mode);
void (*CullFace)(GLcontext *ctx, GLenum mode); void (*CullFace)(GLcontext *ctx, GLenum mode);
void (*ClipPlane)(GLcontext *ctx, GLenum plane, const GLfloat *equation );
void (*FrontFace)(GLcontext *ctx, GLenum mode); void (*FrontFace)(GLcontext *ctx, GLenum mode);
void (*DepthFunc)(GLcontext *ctx, GLenum func); void (*DepthFunc)(GLcontext *ctx, GLenum func);
void (*DepthMask)(GLcontext *ctx, GLboolean flag); void (*DepthMask)(GLcontext *ctx, GLboolean flag);
@@ -634,7 +635,6 @@ struct dd_function_table {
void (*UnlockArraysEXT)( GLcontext *ctx ); void (*UnlockArraysEXT)( GLcontext *ctx );
/* Called by glLockArraysEXT() and glUnlockArraysEXT(), respectively. /* Called by glLockArraysEXT() and glUnlockArraysEXT(), respectively.
*/ */
}; };

View File

@@ -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 * Mesa 3-D graphics library
@@ -307,6 +307,11 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
FLUSH_VERTICES(ctx, _NEW_LIGHT); FLUSH_VERTICES(ctx, _NEW_LIGHT);
ctx->Light.Enabled = state; 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 && if ((ctx->Light.Enabled &&
ctx->Light.Model.ColorControl==GL_SEPARATE_SPECULAR_COLOR) ctx->Light.Model.ColorControl==GL_SEPARATE_SPECULAR_COLOR)
|| ctx->Fog.ColorSumEnabled) || ctx->Fog.ColorSumEnabled)

View File

@@ -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 * Mesa 3-D graphics library
@@ -407,6 +407,11 @@ _mesa_LightModelfv( GLenum pname, const GLfloat *params )
return; return;
FLUSH_VERTICES(ctx, _NEW_LIGHT); FLUSH_VERTICES(ctx, _NEW_LIGHT);
ctx->Light.Model.TwoSide = newbool; 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; break;
case GL_LIGHT_MODEL_COLOR_CONTROL: case GL_LIGHT_MODEL_COLOR_CONTROL:
if (params[0] == (GLfloat) GL_SINGLE_COLOR) if (params[0] == (GLfloat) GL_SINGLE_COLOR)
@@ -883,6 +888,9 @@ _mesa_ColorMaterial( GLenum face, GLenum mode )
FLUSH_CURRENT( ctx, 0 ); FLUSH_CURRENT( ctx, 0 );
_mesa_update_color_material(ctx,ctx->Current.Attrib[VERT_ATTRIB_COLOR0]); _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 ) _mesa_update_lighting( GLcontext *ctx )
{ {
struct gl_light *light; struct gl_light *light;
ctx->_TriangleCaps &= ~DD_TRI_LIGHT_TWOSIDE;
ctx->_NeedEyeCoords &= ~NEED_EYE_LIGHT; ctx->_NeedEyeCoords &= ~NEED_EYE_LIGHT;
ctx->_NeedNormals &= ~NEED_NORMALS_LIGHT; ctx->_NeedNormals &= ~NEED_NORMALS_LIGHT;
ctx->Light._Flags = 0; ctx->Light._Flags = 0;
@@ -1172,9 +1179,6 @@ _mesa_update_lighting( GLcontext *ctx )
ctx->_NeedNormals |= NEED_NORMALS_LIGHT; ctx->_NeedNormals |= NEED_NORMALS_LIGHT;
if (ctx->Light.Model.TwoSide)
ctx->_TriangleCaps |= DD_TRI_LIGHT_TWOSIDE;
foreach(light, &ctx->Light.EnabledList) { foreach(light, &ctx->Light.EnabledList) {
ctx->Light._Flags |= light->_Flags; ctx->Light._Flags |= light->_Flags;
} }

View File

@@ -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 * Mesa 3-D graphics library
@@ -270,6 +270,13 @@ do { \
(DST)[2] = (SRCA)[2] * (SRCB)[2]; \ (DST)[2] = (SRCA)[2] * (SRCB)[2]; \
} while (0) } 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 ) \ #define ACC_3V( DST, SRC ) \
do { \ do { \
(DST)[0] += (SRC)[0]; \ (DST)[0] += (SRC)[0]; \

View File

@@ -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 * Mesa 3-D graphics library
@@ -1591,6 +1591,7 @@ struct matrix_stack
#define NEED_EYE_LIGHT 0x2 #define NEED_EYE_LIGHT 0x2
#define NEED_EYE_LIGHT_MODELVIEW 0x4 #define NEED_EYE_LIGHT_MODELVIEW 0x4
#define NEED_EYE_POINT_ATTEN 0x8 #define NEED_EYE_POINT_ATTEN 0x8
#define NEED_EYE_DRIVER 0x10
/* /*

View File

@@ -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 * Mesa 3-D graphics library
@@ -555,13 +555,11 @@ update_polygon( GLcontext *ctx )
static void static void
calculate_model_project_matrix( GLcontext *ctx ) calculate_model_project_matrix( GLcontext *ctx )
{ {
if (!ctx->_NeedEyeCoords) {
_math_matrix_mul_matrix( &ctx->_ModelProjectMatrix, _math_matrix_mul_matrix( &ctx->_ModelProjectMatrix,
ctx->ProjectionMatrixStack.Top, ctx->ProjectionMatrixStack.Top,
ctx->ModelviewMatrixStack.Top ); ctx->ModelviewMatrixStack.Top );
_math_matrix_analyse( &ctx->_ModelProjectMatrix ); _math_matrix_analyse( &ctx->_ModelProjectMatrix );
}
} }
static void static void
@@ -595,7 +593,6 @@ update_tnl_spaces( GLcontext *ctx, GLuint oldneedeyecoords )
/* Recalculate all state that depends on _NeedEyeCoords. /* Recalculate all state that depends on _NeedEyeCoords.
*/ */
update_modelview_scale(ctx); update_modelview_scale(ctx);
calculate_model_project_matrix(ctx);
_mesa_compute_light_positions( ctx ); _mesa_compute_light_positions( ctx );
if (ctx->Driver.LightingSpaceChange) if (ctx->Driver.LightingSpaceChange)
@@ -610,9 +607,6 @@ update_tnl_spaces( GLcontext *ctx, GLuint oldneedeyecoords )
if (new_state & _NEW_MODELVIEW) if (new_state & _NEW_MODELVIEW)
update_modelview_scale(ctx); update_modelview_scale(ctx);
if (new_state & (_NEW_MODELVIEW|_NEW_PROJECTION))
calculate_model_project_matrix(ctx);
if (new_state & (_NEW_LIGHT|_NEW_MODELVIEW)) if (new_state & (_NEW_LIGHT|_NEW_MODELVIEW))
_mesa_compute_light_positions( ctx ); _mesa_compute_light_positions( ctx );
} }
@@ -757,12 +751,12 @@ update_texture_matrices( GLcontext *ctx )
if (ctx->TextureMatrixStack[i].Top->flags & MAT_DIRTY) { if (ctx->TextureMatrixStack[i].Top->flags & MAT_DIRTY) {
_math_matrix_analyse( ctx->TextureMatrixStack[i].Top ); _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 && if (ctx->Texture.Unit[i]._ReallyEnabled &&
ctx->TextureMatrixStack[i].Top->type != MATRIX_IDENTITY) ctx->TextureMatrixStack[i].Top->type != MATRIX_IDENTITY)
ctx->Texture._TexMatEnabled |= ENABLE_TEXMAT(i); 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 * If ctx->NewState is non-zero then this function MUST be called before
* rendering any primitive. Basically, function pointers and miscellaneous * rendering any primitive. Basically, function pointers and miscellaneous
@@ -957,6 +952,8 @@ void _mesa_update_state( GLcontext *ctx )
ctx->_NeedEyeCoords |= NEED_EYE_LIGHT_MODELVIEW; ctx->_NeedEyeCoords |= NEED_EYE_LIGHT_MODELVIEW;
} }
#if 0
/* XXX this is a bit of a hack. We should be checking elsewhere if /* 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 * vertex program mode is enabled. We set _NeedEyeCoords to zero to
* ensure that the combined modelview/projection matrix is computed * ensure that the combined modelview/projection matrix is computed
@@ -964,6 +961,15 @@ void _mesa_update_state( GLcontext *ctx )
*/ */
if (ctx->VertexProgram.Enabled) if (ctx->VertexProgram.Enabled)
ctx->_NeedEyeCoords = 0; 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. /* ctx->_NeedEyeCoords is now uptodate.
* *
@@ -975,7 +981,6 @@ void _mesa_update_state( GLcontext *ctx )
* light positions & normal transforms for other reasons. * light positions & normal transforms for other reasons.
*/ */
if (new_state & (_NEW_MODELVIEW | if (new_state & (_NEW_MODELVIEW |
_NEW_PROJECTION |
_NEW_LIGHT | _NEW_LIGHT |
_MESA_NEW_NEED_EYE_COORDS)) _MESA_NEW_NEED_EYE_COORDS))
update_tnl_spaces( ctx, oldneedeyecoords ); update_tnl_spaces( ctx, oldneedeyecoords );
@@ -1034,3 +1039,18 @@ void _mesa_update_state( GLcontext *ctx )
#endif #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.
*/
}

View File

@@ -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 * Mesa 3-D graphics library
@@ -46,5 +46,7 @@ _mesa_print_state( const char *msg, GLuint state );
extern void extern void
_mesa_print_enable_flags( const char *msg, GLuint flags ); _mesa_print_enable_flags( const char *msg, GLuint flags );
extern void
_mesa_allow_light_in_model( GLcontext *ctx, GLboolean flag );
#endif #endif

View File

@@ -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 * Mesa 3-D graphics library
@@ -33,6 +33,7 @@
#include "mtypes.h" #include "mtypes.h"
#include "mem.h" #include "mem.h"
#include "dlist.h" #include "dlist.h"
#include "light.h"
#include "vtxfmt.h" #include "vtxfmt.h"
#include "t_context.h" #include "t_context.h"
@@ -125,6 +126,8 @@ _tnl_CreateContext( GLcontext *ctx )
tnl->Driver.Render.PrimTabElts = _tnl_render_tab_elts; tnl->Driver.Render.PrimTabElts = _tnl_render_tab_elts;
tnl->Driver.Render.PrimTabVerts = _tnl_render_tab_verts; tnl->Driver.Render.PrimTabVerts = _tnl_render_tab_verts;
tnl->Driver.NotifyMaterialChange = _mesa_validate_all_lighting_tables;
return GL_TRUE; return GL_TRUE;
@@ -220,16 +223,19 @@ void
_tnl_need_dlist_loopback( GLcontext *ctx, GLboolean mode ) _tnl_need_dlist_loopback( GLcontext *ctx, GLboolean mode )
{ {
TNLcontext *tnl = TNL_CONTEXT(ctx); TNLcontext *tnl = TNL_CONTEXT(ctx);
if (tnl->LoopbackDListCassettes != mode) { tnl->LoopbackDListCassettes = mode;
tnl->LoopbackDListCassettes = mode;
}
} }
void void
_tnl_need_dlist_norm_lengths( GLcontext *ctx, GLboolean mode ) _tnl_need_dlist_norm_lengths( GLcontext *ctx, GLboolean mode )
{ {
TNLcontext *tnl = TNL_CONTEXT(ctx); 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;
} }

View File

@@ -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 * Mesa 3-D graphics library
@@ -386,6 +386,12 @@ struct tnl_device_driver {
* and grab/release hardware locks. * 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 *** Rendering -- These functions called only from t_vb_render.c
***/ ***/
@@ -524,6 +530,7 @@ typedef struct {
GLboolean NeedNdcCoords; GLboolean NeedNdcCoords;
GLboolean LoopbackDListCassettes; GLboolean LoopbackDListCassettes;
GLboolean CalcDListNormalLengths; GLboolean CalcDListNormalLengths;
GLboolean IsolateMaterials;
/* Derived state and storage for _tnl_eval_vb: /* Derived state and storage for _tnl_eval_vb:
*/ */

View File

@@ -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 * Mesa 3-D graphics library
@@ -553,6 +553,8 @@ static void
_tnl_Normal3fv( const GLfloat *v ) _tnl_Normal3fv( const GLfloat *v )
{ {
NORMALF( v[0], v[1], v[2] ); 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 ) _tnl_Materialfv( GLenum face, GLenum pname, const GLfloat *params )
{ {
GET_CURRENT_CONTEXT(ctx); GET_CURRENT_CONTEXT(ctx);
TNLcontext *tnl = TNL_CONTEXT(ctx);
struct immediate *IM = TNL_CURRENT_IM(ctx); struct immediate *IM = TNL_CURRENT_IM(ctx);
GLuint count = IM->Count; GLuint count = IM->Count;
struct gl_material *mat; struct gl_material *mat;
@@ -1162,6 +1165,14 @@ _tnl_Materialfv( GLenum face, GLenum pname, const GLfloat *params )
if (bitmask == 0) if (bitmask == 0)
return; 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->Flag[count] & VERT_BIT_MATERIAL)) {
if (!IM->Material) { if (!IM->Material) {
IM->Material = (struct gl_material (*)[2]) 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].DiffuseIndex = params[1];
mat[1].SpecularIndex = params[2]; 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 ) void _tnl_imm_vtxfmt_init( GLcontext *ctx )

View File

@@ -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 * Mesa 3-D graphics library
@@ -339,6 +339,7 @@ execute_compiled_cassette( GLcontext *ctx, void *data )
} }
if (tnl->LoopbackDListCassettes) { if (tnl->LoopbackDListCassettes) {
/* (tnl->IsolateMaterials && (IM->OrFlag & VERT_MATERIAL)) ) { */
fixup_compiled_primitives( ctx, IM ); fixup_compiled_primitives( ctx, IM );
loopback_compiled_cassette( ctx, IM ); loopback_compiled_cassette( ctx, IM );
restore_compiled_primitives( ctx, IM ); restore_compiled_primitives( ctx, IM );

View File

@@ -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 * Mesa 3-D graphics library
@@ -149,7 +149,7 @@ void _tnl_copy_to_current( GLcontext *ctx, struct immediate *IM,
if (ctx->Light.ColorMaterialEnabled) { if (ctx->Light.ColorMaterialEnabled) {
_mesa_update_color_material( ctx, _mesa_update_color_material( ctx,
ctx->Current.Attrib[VERT_ATTRIB_COLOR0] ); 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->Material[IM->LastMaterial],
IM->MaterialOrMask ); 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->MaterialMask = IM->MaterialMask + start;
VB->Material = IM->Material + 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) if (tnl->pipeline.build_state_changes)
_tnl_validate_pipeline( ctx ); _tnl_validate_pipeline( ctx );
if (IM->CopyStart == IM->Count) { if (0 && IM->CopyStart == IM->Count) {
exec_empty_cassette( ctx, IM ); exec_empty_cassette( ctx, IM );
} }
else if ((IM->CopyOrFlag & VERT_BITS_DATA) == VERT_BIT_ELT && else if ((IM->CopyOrFlag & VERT_BITS_DATA) == VERT_BIT_ELT &&

View File

@@ -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 * Mesa 3-D graphics library
@@ -396,6 +396,8 @@ copy_material( struct immediate *next,
struct immediate *prev, struct immediate *prev,
GLuint dst, GLuint src ) GLuint dst, GLuint src )
{ {
/* fprintf(stderr, "%s\n", __FUNCTION__); */
if (next->Material == 0) { if (next->Material == 0) {
next->Material = (struct gl_material (*)[2]) next->Material = (struct gl_material (*)[2])
MALLOC( sizeof(struct gl_material) * IMM_SIZE * 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; GLuint dst = next->CopyStart+i;
next->Elt[dst] = prev->Elt[src]; next->Elt[dst] = prev->Elt[src];
next->Flag[dst] = VERT_BIT_ELT; next->Flag[dst] = VERT_BIT_ELT;
elts[i+offset] = dst;
} }
/* fprintf(stderr, "ADDING VERT_BIT_ELT!\n"); */ /* fprintf(stderr, "ADDING VERT_BIT_ELT!\n"); */
next->CopyOrFlag |= VERT_BIT_ELT; 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| next->CopyOrFlag |= prev->Flag[src] & (VERT_BITS_FIXUP|
VERT_BIT_MATERIAL| VERT_BIT_MATERIAL|
VERT_BIT_POS); 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_free_immediate( tnl->ExecCopySource );
tnl->ExecCopySource = 0; tnl->ExecCopySource = next; next->ref_count++;
tnl->ExecCopyCount = 0;
} }
@@ -766,17 +769,19 @@ _tnl_get_exec_copy_verts( GLcontext *ctx, struct immediate *IM )
/* fprintf(stderr, "_tnl_get_exec_copy_verts %s\n", */ /* fprintf(stderr, "_tnl_get_exec_copy_verts %s\n", */
/* _mesa_lookup_enum_by_nr(prim)); */ /* _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) { if (prim == GL_POLYGON+1) {
tnl->ExecCopySource = 0;
tnl->ExecCopyCount = 0; tnl->ExecCopyCount = 0;
tnl->ExecCopyTexSize = 0; tnl->ExecCopyTexSize = 0;
tnl->ExecParity = 0; tnl->ExecParity = 0;
} else { } else {
/* Remember this immediate as the one to copy from. /* Remember this immediate as the one to copy from.
*/ */
IM->ref_count++; tnl->ExecCopySource = IM; IM->ref_count++;
tnl->ExecCopySource = IM;
tnl->ExecCopyCount = 0; tnl->ExecCopyCount = 0;
tnl->ExecCopyTexSize = IM->CopyTexSize; tnl->ExecCopyTexSize = IM->CopyTexSize;

View File

@@ -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 * 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: /* 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... /* Now run the stage...
*/ */

View File

@@ -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 * 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] ); _mesa_update_material( ctx, new_material[j], new_material_mask[j] );
if ( CHECK_VALIDATE(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]); UNCLAMPED_FLOAT_TO_CHAN(sumA[0], ctx->Light.Material[0].Diffuse[3]);
if (IDX & LIGHT_TWOSIDE) if (IDX & LIGHT_TWOSIDE)
UNCLAMPED_FLOAT_TO_CHAN(sumA[1], ctx->Light.Material[1].Diffuse[3]); 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] ); _mesa_update_material( ctx, new_material[j], new_material_mask[j] );
if ( CHECK_VALIDATE(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]); UNCLAMPED_FLOAT_TO_CHAN(sumA[0], ctx->Light.Material[0].Diffuse[3]);
if (IDX & LIGHT_TWOSIDE) if (IDX & LIGHT_TWOSIDE)
UNCLAMPED_FLOAT_TO_CHAN(sumA[1], ctx->Light.Material[1].Diffuse[3]); 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] ); _mesa_update_material( ctx, new_material[j], new_material_mask[j] );
if ( CHECK_VALIDATE(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. /* 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] ); _mesa_update_material( ctx, new_material[j], new_material_mask[j] );
if ( CHECK_VALIDATE(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]); UNCLAMPED_FLOAT_TO_CHAN(sumA[0], ctx->Light.Material[0].Diffuse[3]);
if (IDX & LIGHT_TWOSIDE) if (IDX & LIGHT_TWOSIDE)
UNCLAMPED_FLOAT_TO_CHAN(sumA[1], 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] ); _mesa_update_material( ctx, new_material[j], new_material_mask[j] );
if ( CHECK_VALIDATE(j) ) if ( CHECK_VALIDATE(j) )
_mesa_validate_all_lighting_tables( ctx ); TNL_CONTEXT(ctx)->Driver.NotifyMaterialChange( ctx );
diffuse[0] = specular[0] = 0.0F; diffuse[0] = specular[0] = 0.0F;

View File

@@ -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 * Mesa 3-D graphics library
@@ -142,7 +142,7 @@ do { \
#define TAG(x) clip_##x##_verts #define TAG(x) clip_##x##_verts
#define INIT(x) tnl->Driver.Render.PrimitiveNotify( ctx, x ) #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 RESET_OCCLUSION ctx->OcclusionResult = GL_TRUE
#define PRESERVE_VB_DEFS #define PRESERVE_VB_DEFS
#include "t_vb_rendertmp.h" #include "t_vb_rendertmp.h"
@@ -229,7 +229,7 @@ static void clip_elt_triangles( GLcontext *ctx,
(void) (LineFunc && TriangleFunc && QuadFunc); \ (void) (LineFunc && TriangleFunc && QuadFunc); \
(void) elt; (void) stipple (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 RESET_OCCLUSION ctx->OcclusionResult = GL_TRUE
#define INIT(x) tnl->Driver.Render.PrimitiveNotify( ctx, x ) #define INIT(x) tnl->Driver.Render.PrimitiveNotify( ctx, x )
#define RENDER_TAB_QUALIFIER #define RENDER_TAB_QUALIFIER

View File

@@ -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 * Mesa 3-D graphics library
@@ -90,8 +90,8 @@ static void TAG(render_lines)( GLcontext *ctx,
RESET_OCCLUSION; RESET_OCCLUSION;
INIT(GL_LINES); INIT(GL_LINES);
for (j=start+1; j<count; j+=2 ) { for (j=start+1; j<count; j+=2 ) {
RENDER_LINE( ELT(j-1), ELT(j) );
RESET_STIPPLE; RESET_STIPPLE;
RENDER_LINE( ELT(j-1), ELT(j) );
} }
POSTFIX; POSTFIX;
} }
@@ -109,12 +109,13 @@ static void TAG(render_line_strip)( GLcontext *ctx,
RESET_OCCLUSION; RESET_OCCLUSION;
INIT(GL_LINE_STRIP); INIT(GL_LINE_STRIP);
if (TEST_PRIM_BEGIN(flags)) {
RESET_STIPPLE;
}
for (j=start+1; j<count; j++ ) for (j=start+1; j<count; j++ )
RENDER_LINE( ELT(j-1), ELT(j) ); RENDER_LINE( ELT(j-1), ELT(j) );
if (TEST_PRIM_END(flags))
RESET_STIPPLE;
POSTFIX; POSTFIX;
} }
@@ -134,6 +135,7 @@ static void TAG(render_line_loop)( GLcontext *ctx,
if (start+1 < count) { if (start+1 < count) {
if (TEST_PRIM_BEGIN(flags)) { if (TEST_PRIM_BEGIN(flags)) {
RESET_STIPPLE;
RENDER_LINE( ELT(start), ELT(start+1) ); RENDER_LINE( ELT(start), ELT(start+1) );
} }
@@ -143,7 +145,6 @@ static void TAG(render_line_loop)( GLcontext *ctx,
if ( TEST_PRIM_END(flags)) { if ( TEST_PRIM_END(flags)) {
RENDER_LINE( ELT(count-1), ELT(start) ); 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) { for (j=start+2; j<count; j+=3) {
/* Leave the edgeflags as supplied by the user. /* Leave the edgeflags as supplied by the user.
*/ */
RENDER_TRI( ELT(j-2), ELT(j-1), ELT(j) );
RESET_STIPPLE; RESET_STIPPLE;
RENDER_TRI( ELT(j-2), ELT(j-1), ELT(j) );
} }
} else { } else {
for (j=start+2; j<count; j+=3) { 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 ef2 = EDGEFLAG_GET( ej2 );
GLboolean ef1 = EDGEFLAG_GET( ej1 ); GLboolean ef1 = EDGEFLAG_GET( ej1 );
GLboolean ef = EDGEFLAG_GET( ej ); GLboolean ef = EDGEFLAG_GET( ej );
if (TEST_PRIM_BEGIN(flags)) {
RESET_STIPPLE;
}
EDGEFLAG_SET( ej2, GL_TRUE ); EDGEFLAG_SET( ej2, GL_TRUE );
EDGEFLAG_SET( ej1, GL_TRUE ); EDGEFLAG_SET( ej1, GL_TRUE );
EDGEFLAG_SET( ej, 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( ej2, ef2 );
EDGEFLAG_SET( ej1, ef1 ); EDGEFLAG_SET( ej1, ef1 );
EDGEFLAG_SET( ej, ef ); EDGEFLAG_SET( ej, ef );
RESET_STIPPLE;
} }
} else { } else {
for (j=start+2; j<count ; j++, parity^=1) { 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 efs = EDGEFLAG_GET( ejs );
GLboolean ef1 = EDGEFLAG_GET( ej1 ); GLboolean ef1 = EDGEFLAG_GET( ej1 );
GLboolean ef = EDGEFLAG_GET( ej ); GLboolean ef = EDGEFLAG_GET( ej );
if (TEST_PRIM_BEGIN(flags)) {
RESET_STIPPLE;
}
EDGEFLAG_SET( ejs, GL_TRUE ); EDGEFLAG_SET( ejs, GL_TRUE );
EDGEFLAG_SET( ej1, GL_TRUE ); EDGEFLAG_SET( ej1, GL_TRUE );
EDGEFLAG_SET( ej, 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( ejs, efs );
EDGEFLAG_SET( ej1, ef1 ); EDGEFLAG_SET( ej1, ef1 );
EDGEFLAG_SET( ej, ef ); EDGEFLAG_SET( ej, ef );
RESET_STIPPLE;
} }
} else { } else {
for (j=start+2;j<count;j++) { for (j=start+2;j<count;j++) {
@@ -275,6 +280,9 @@ static void TAG(render_poly)( GLcontext *ctx,
*/ */
if (!TEST_PRIM_BEGIN(flags)) if (!TEST_PRIM_BEGIN(flags))
EDGEFLAG_SET( ELT(start), GL_FALSE ); EDGEFLAG_SET( ELT(start), GL_FALSE );
else {
RESET_STIPPLE;
}
/* If the primitive does not end here, the final edge is /* If the primitive does not end here, the final edge is
* non-boundary. * non-boundary.
@@ -284,7 +292,7 @@ static void TAG(render_poly)( GLcontext *ctx,
/* Draw the first triangles (possibly zero) /* Draw the first triangles (possibly zero)
*/ */
if (j<count-1) { if (j+1<count) {
GLboolean ef = EDGEFLAG_GET( ELT(j) ); GLboolean ef = EDGEFLAG_GET( ELT(j) );
EDGEFLAG_SET( ELT(j), GL_FALSE ); EDGEFLAG_SET( ELT(j), GL_FALSE );
RENDER_TRI( ELT(j-1), ELT(j), ELT(start) ); 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 ); EDGEFLAG_SET( ELT(start), GL_FALSE );
for (;j<count-1;j++) { for (;j+1<count;j++) {
GLboolean efj = EDGEFLAG_GET( ELT(j) ); GLboolean efj = EDGEFLAG_GET( ELT(j) );
EDGEFLAG_SET( ELT(j), GL_FALSE ); EDGEFLAG_SET( ELT(j), GL_FALSE );
RENDER_TRI( ELT(j-1), ELT(j), ELT(start) ); 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(count-1), efcount );
EDGEFLAG_SET( ELT(start), efstart ); EDGEFLAG_SET( ELT(start), efstart );
if (TEST_PRIM_END(flags)) {
RESET_STIPPLE;
}
} }
else { else {
for (j=start+2;j<count;j++) { 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) { for (j=start+3; j<count; j+=4) {
/* Use user-specified edgeflags for quads. /* Use user-specified edgeflags for quads.
*/ */
RENDER_QUAD( ELT(j-3), ELT(j-2), ELT(j-1), ELT(j) );
RESET_STIPPLE; RESET_STIPPLE;
RENDER_QUAD( ELT(j-3), ELT(j-2), ELT(j-1), ELT(j) );
} }
} else { } else {
for (j=start+3; j<count; j+=4) { 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 ef2 = EDGEFLAG_GET( ELT(j-2) );
GLboolean ef1 = EDGEFLAG_GET( ELT(j-1) ); GLboolean ef1 = EDGEFLAG_GET( ELT(j-1) );
GLboolean ef = EDGEFLAG_GET( ELT(j) ); GLboolean ef = EDGEFLAG_GET( ELT(j) );
if (TEST_PRIM_BEGIN(flags)) {
RESET_STIPPLE;
}
EDGEFLAG_SET( ELT(j-3), GL_TRUE ); EDGEFLAG_SET( ELT(j-3), GL_TRUE );
EDGEFLAG_SET( ELT(j-2), GL_TRUE ); EDGEFLAG_SET( ELT(j-2), GL_TRUE );
EDGEFLAG_SET( ELT(j-1), 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-2), ef2 );
EDGEFLAG_SET( ELT(j-1), ef1 ); EDGEFLAG_SET( ELT(j-1), ef1 );
EDGEFLAG_SET( ELT(j), ef ); EDGEFLAG_SET( ELT(j), ef );
RESET_STIPPLE;
} }
} else { } else {
for (j=start+3;j<count;j+=2) { for (j=start+3;j<count;j+=2) {

View File

@@ -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 * Mesa 3-D graphics library
@@ -72,4 +72,7 @@ _tnl_need_dlist_loopback( GLcontext *ctx, GLboolean flag );
extern void extern void
_tnl_need_dlist_norm_lengths( GLcontext *ctx, GLboolean flag ); _tnl_need_dlist_norm_lengths( GLcontext *ctx, GLboolean flag );
extern void
_tnl_isolate_materials( GLcontext *ctx, GLboolean flag );
#endif #endif