Fix GLuint compare bugs Fix RESET_STIPPLE callstags/mesa_4_1
/* $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 | ||||
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; | ||||
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; | ||||
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 & 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; | ||||
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 ); | ||||
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 ); | ||||
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; | ||||
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(); | ||||
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; | ||||
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; | ||||
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(); | ||||
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; | ||||
} | } | ||||
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 ); | ||||
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; | ||||
} | } | ||||
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(); | ||||
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 ); | ||||
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 ); | ||||
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) | ||||
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(); | ||||
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) |
/* $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 | ||||
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; | ||||
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) { | ||||
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", */ | |||||
/* __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 | /* 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. | ||||
} | } | ||||
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 { | ||||
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]); */ | |||||
} | } | ||||
} | } | ||||
} | } |
/* $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 | ||||
#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 | ||||
/* 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); | |||||
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 */ | /* light model */ | ||||
_mesa_LightModelfv(GL_LIGHT_MODEL_AMBIENT, | _mesa_LightModelfv(GL_LIGHT_MODEL_AMBIENT, | ||||
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); |
/* $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 | ||||
#include "mtypes.h" | #include "mtypes.h" | ||||
extern void | extern void | ||||
_mesa_PushAttrib( GLbitfield mask ); | _mesa_PushAttrib( GLbitfield mask ); | ||||
/* $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 | ||||
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); | ||||
void (*UnlockArraysEXT)( GLcontext *ctx ); | void (*UnlockArraysEXT)( GLcontext *ctx ); | ||||
/* Called by glLockArraysEXT() and glUnlockArraysEXT(), respectively. | /* Called by glLockArraysEXT() and glUnlockArraysEXT(), respectively. | ||||
*/ | */ | ||||
}; | }; | ||||
/* $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 | ||||
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) |
/* $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 | ||||
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) | ||||
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 ); | |||||
} | } | ||||
_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; | ||||
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; | ||||
} | } |
/* $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 | ||||
(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]; \ |
/* $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 | ||||
#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 | |||||
/* | /* |
/* $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 | ||||
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 | ||||
/* 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) | ||||
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 ); | ||||
} | } | ||||
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); | |||||
} | } | ||||
} | } | ||||
} | } | ||||
} | } | ||||
/* | /* | ||||
* 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 | ||||
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 | ||||
*/ | */ | ||||
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. | ||||
* | * | ||||
* 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 ); | ||||
#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. | |||||
*/ | |||||
} |
/* $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 | ||||
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 |
/* $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 | ||||
#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" | ||||
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; | ||||
_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; | |||||
} | } |
/* $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 | ||||
* 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 | ||||
***/ | ***/ | ||||
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: | ||||
*/ | */ |
/* $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 | ||||
_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; */ | |||||
} | } | ||||
_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; | ||||
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]) | ||||
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 ) |
/* $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 | ||||
} | } | ||||
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 ); |
/* $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 | ||||
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 ); | |||||
} | } | ||||
} | } | ||||
IM->Material[IM->LastMaterial], | IM->Material[IM->LastMaterial], | ||||
IM->MaterialOrMask ); | IM->MaterialOrMask ); | ||||
_mesa_validate_all_lighting_tables( ctx ); | |||||
TNL_CONTEXT(ctx)->Driver.NotifyMaterialChange( ctx ); | |||||
} | } | ||||
} | } | ||||
} | } | ||||
} | } | ||||
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; | ||||
} | } | ||||
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 && |
/* $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 | ||||
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 ); | ||||
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; | ||||
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->ExecCopyCount = 0; | |||||
tnl->ExecCopySource = next; next->ref_count++; | |||||
} | } | ||||
/* 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; | |||||
tnl->ExecCopySource = IM; IM->ref_count++; | |||||
tnl->ExecCopyCount = 0; | tnl->ExecCopyCount = 0; | ||||
tnl->ExecCopyTexSize = IM->CopyTexSize; | tnl->ExecCopyTexSize = IM->CopyTexSize; | ||||
/* $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 | ||||
/* 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... | ||||
*/ | */ |
/* $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 | ||||
_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]); | ||||
_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]); | ||||
_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. | ||||
_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], | ||||
_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; | ||||
/* $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 | ||||
#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" | ||||
(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 |
/* $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 | ||||
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; | ||||
} | } | ||||
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; | ||||
} | } | ||||
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) ); | ||||
} | } | ||||
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; | |||||
} | } | ||||
} | } | ||||
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) { | ||||
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 ); | ||||
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) { | ||||
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 ); | ||||
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++) { | ||||
*/ | */ | ||||
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. | ||||
/* 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) ); | ||||
*/ | */ | ||||
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) ); | ||||
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++) { | ||||
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) { | ||||
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 ); | ||||
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) { |
/* $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 | ||||
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 |