Add render stage for unclipped vb's to fx driver.

Bump MAX_TEXTURE_UNITS to 8
Fix mem. leak in destroy_lists
Fix crash in q3 (cva generally)
This commit is contained in:
Keith Whitwell
2000-12-28 22:11:04 +00:00
parent e5d6fb20a5
commit 88f3b89a2c
17 changed files with 197 additions and 62 deletions

View File

@@ -1,4 +1,4 @@
# $Id: Makefile.X11,v 1.36 2000/12/26 05:09:27 keithw Exp $ # $Id: Makefile.X11,v 1.37 2000/12/28 22:11:04 keithw Exp $
# Mesa 3-D graphics library # Mesa 3-D graphics library
# Version: 3.5 # Version: 3.5
@@ -160,6 +160,7 @@ DRIVER_SOURCES = \
FX/fxtexman.c \ FX/fxtexman.c \
FX/fxtris.c \ FX/fxtris.c \
FX/fxvb.c \ FX/fxvb.c \
FX/fxsimplerender.c \
FX/fxglidew.c \ FX/fxglidew.c \
X/glxapi.c \ X/glxapi.c \
X/fakeglx.c \ X/fakeglx.c \

View File

@@ -1,4 +1,4 @@
/* $Id: ac_import.c,v 1.1 2000/12/26 15:14:04 keithw Exp $ */ /* $Id: ac_import.c,v 1.2 2000/12/28 22:11:05 keithw Exp $ */
/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
@@ -45,6 +45,8 @@ static void reset_texcoord( GLcontext *ctx, GLuint unit )
{ {
ACcontext *ac = AC_CONTEXT(ctx); ACcontext *ac = AC_CONTEXT(ctx);
/* fprintf(stderr, "%s %d\n", __FUNCTION__, unit); */
if (ctx->Array._Enabled & _NEW_ARRAY_TEXCOORD(unit)) if (ctx->Array._Enabled & _NEW_ARRAY_TEXCOORD(unit))
ac->Current.TexCoord[unit] = &ctx->Array.TexCoord[unit]; ac->Current.TexCoord[unit] = &ctx->Array.TexCoord[unit];
else { else {
@@ -69,6 +71,8 @@ static void reset_vertex( GLcontext *ctx )
ac->Current.Vertex = &ctx->Array.Vertex; ac->Current.Vertex = &ctx->Array.Vertex;
ac->Writeable.Vertex = GL_FALSE; ac->Writeable.Vertex = GL_FALSE;
ac->NewArrayState &= ~_NEW_ARRAY_VERTEX; ac->NewArrayState &= ~_NEW_ARRAY_VERTEX;
/* fprintf(stderr, "%s\n", __FUNCTION__); */
} }
@@ -178,6 +182,8 @@ static void import_texcoord( GLcontext *ctx, GLuint unit,
ASSERT(stride == 4*sizeof(GLfloat) || stride == 0); ASSERT(stride == 4*sizeof(GLfloat) || stride == 0);
ASSERT(ac->count - ac->start < ctx->Const.MaxArrayLockSize); ASSERT(ac->count - ac->start < ctx->Const.MaxArrayLockSize);
/* fprintf(stderr, "%s %d old ptr %p\n", __FUNCTION__, unit, from->Ptr); */
_math_trans_4f( to->Ptr, _math_trans_4f( to->Ptr,
from->Ptr, from->Ptr,
from->StrideB, from->StrideB,
@@ -191,6 +197,8 @@ static void import_texcoord( GLcontext *ctx, GLuint unit,
to->Type = GL_FLOAT; to->Type = GL_FLOAT;
ac->Current.TexCoord[unit] = to; ac->Current.TexCoord[unit] = to;
ac->Writeable.TexCoord[unit] = GL_TRUE; ac->Writeable.TexCoord[unit] = GL_TRUE;
/* fprintf(stderr, "%s %d new ptr %p\n", __FUNCTION__, unit, to->Ptr); */
} }
static void import_vertex( GLcontext *ctx, static void import_vertex( GLcontext *ctx,
@@ -200,6 +208,8 @@ static void import_vertex( GLcontext *ctx,
struct gl_client_array *from = ac->Current.Vertex; struct gl_client_array *from = ac->Current.Vertex;
struct gl_client_array *to = &ac->Cache.Vertex; struct gl_client_array *to = &ac->Cache.Vertex;
/* fprintf(stderr, "(ac) %s\n", __FUNCTION__); */
/* Limited choices at this stage: /* Limited choices at this stage:
*/ */
ASSERT(type == GL_FLOAT); ASSERT(type == GL_FLOAT);

View File

@@ -61,6 +61,8 @@
#include "tnl/tnl.h" #include "tnl/tnl.h"
#include "array_cache/acache.h" #include "array_cache/acache.h"
#include "tnl/t_pipeline.h"
/* These lookup table are used to extract RGB values in [0,255] from /* These lookup table are used to extract RGB values in [0,255] from
* 16-bit pixel values. * 16-bit pixel values.
*/ */
@@ -645,25 +647,21 @@ static const GLubyte *fxDDGetString(GLcontext *ctx, GLenum name)
} }
} }
#if 0 static const struct gl_pipeline_stage *fx_pipeline[] = {
static const struct gl_pipeline_stage * const fx_pipeline[] = {
&_tnl_update_material_stage, &_tnl_update_material_stage,
/* TODO: Add the fastpath here */
&_tnl_vertex_transform_stage, &_tnl_vertex_transform_stage,
&_tnl_normal_transform_stage, &_tnl_normal_transform_stage,
&_tnl_lighting_stage, /* OMIT: fog coordinate stage */ &_tnl_lighting_stage,
&_tnl_fog_coordinate_stage, /* TODO: Omit fog stage */
&_tnl_texgen_stage, &_tnl_texgen_stage,
&_tnl_texture_transform_stage, &_tnl_texture_transform_stage,
&_tnl_point_attenuation_stage, &_tnl_point_attenuation_stage,
&_fx_fast_render_stage, /* ADD: the fastpath as a render stage */ &fx_render_stage, /* ADD: render simple unclipped vb's */
&_tnl_render_stage, /* KEEP: the old render stage for fallbacks */ &_tnl_render_stage, /* KEEP: the old render stage for fallbacks */
0 0,
}; };
#else
/* Need to turn off tnl fogging, both the stage and the clipping in
* _tnl_render_stage. Could insert a dummy stage that did nothing but
* provided storage that clipping could spin on?
*/
#endif
@@ -771,6 +769,9 @@ int fxDDInitFxMesaContext( fxMesaContext fxMesa )
_tnl_CreateContext( fxMesa->glCtx ); _tnl_CreateContext( fxMesa->glCtx );
_swsetup_CreateContext( fxMesa->glCtx ); _swsetup_CreateContext( fxMesa->glCtx );
_tnl_destroy_pipeline( fxMesa->glCtx );
_tnl_install_pipeline( fxMesa->glCtx, fx_pipeline );
fxAllocVB( fxMesa->glCtx ); fxAllocVB( fxMesa->glCtx );
fxSetupDDPointers(fxMesa->glCtx); fxSetupDDPointers(fxMesa->glCtx);
@@ -780,6 +781,11 @@ int fxDDInitFxMesaContext( fxMesaContext fxMesa )
_swrast_allow_vertex_fog( fxMesa->glCtx, GL_FALSE ); _swrast_allow_vertex_fog( fxMesa->glCtx, GL_FALSE );
_swrast_allow_pixel_fog( fxMesa->glCtx, GL_TRUE ); _swrast_allow_pixel_fog( fxMesa->glCtx, GL_TRUE );
/* Tell tnl not to calculate or use vertex fog factors. (Needed to
* tell render stage not to clip fog coords).
*/
/* _tnl_calculate_vertex_fog( fxMesa->glCtx, GL_FALSE ); */
fxDDInitExtensions(fxMesa->glCtx); fxDDInitExtensions(fxMesa->glCtx);
#ifdef FXVTXFMT #ifdef FXVTXFMT

View File

@@ -100,7 +100,6 @@ typedef union {
typedef struct { typedef struct {
GrVertex v; GrVertex v;
GLfloat clip[4]; GLfloat clip[4];
GLfloat win[4];
GLfloat texcoord[2][2]; GLfloat texcoord[2][2];
GLubyte mask; GLubyte mask;
GLfloat normal[3]; /* for replay & fallback */ GLfloat normal[3]; /* for replay & fallback */
@@ -630,4 +629,8 @@ extern void fxDDCheckVtxfmt( GLcontext *ctx );
extern void fx_update_lighting( GLcontext *ctx ); extern void fx_update_lighting( GLcontext *ctx );
extern void fxDDInitVtxfmt( GLcontext *ctx ); extern void fxDDInitVtxfmt( GLcontext *ctx );
/* fxsimplerender
*/
extern const struct gl_pipeline_stage fx_render_stage;
#endif #endif

View File

@@ -56,8 +56,47 @@ static void NAME(GLcontext *ctx, GLuint start, GLuint end, GLuint newinputs)
if (IND & SETUP_RGBA) if (IND & SETUP_RGBA)
color = VB->ColorPtr[0]->data; color = VB->ColorPtr[0]->data;
for (i = start ; i < end ; i++, v++) { if (VB->ClipOrMask) {
if (!clipmask[i]) { for (i = start ; i < end ; i++, v++) {
if (!clipmask[i]) {
if (IND & SETUP_XYZW) {
v->v.x = s[0] * proj[i][0] + s[12];
v->v.y = s[5] * proj[i][1] + s[13];
v->v.ooz = s[10] * proj[i][2] + s[14];
v->v.oow = proj[i][3];
if (IND & SETUP_SNAP) {
#if defined(USE_IEEE)
const float snapper = (3L<<18);
v->v.x += snapper;
v->v.x -= snapper;
v->v.y += snapper;
v->v.y -= snapper;
#else
v->v.x = ((int)(v->v.x*16.0f)) * (1.0f/16.0f);
v->v.y = ((int)(v->v.y*16.0f)) * (1.0f/16.0f);
#endif
}
}
if (IND & SETUP_RGBA) {
UBYTE_COLOR_TO_FLOAT_255_COLOR2(v->v.r, color[i][0]);
UBYTE_COLOR_TO_FLOAT_255_COLOR2(v->v.g, color[i][1]);
UBYTE_COLOR_TO_FLOAT_255_COLOR2(v->v.b, color[i][2]);
UBYTE_COLOR_TO_FLOAT_255_COLOR2(v->v.a, color[i][3]);
}
if (IND & SETUP_TMU0) {
v->v.tmuvtx[0].sow = sscale0*tmu0_data[i][0]*v->v.oow;
v->v.tmuvtx[0].tow = tscale0*tmu0_data[i][1]*v->v.oow;
}
if (IND & SETUP_TMU1) {
v->v.tmuvtx[1].sow = sscale1*tmu1_data[i][0]*v->v.oow;
v->v.tmuvtx[1].tow = tscale1*tmu1_data[i][1]*v->v.oow;
}
}
}
}
else {
for (i = start ; i < end ; i++, v++) {
if (IND & SETUP_XYZW) { if (IND & SETUP_XYZW) {
v->v.x = s[0] * proj[i][0] + s[12]; v->v.x = s[0] * proj[i][0] + s[12];
v->v.y = s[5] * proj[i][1] + s[13]; v->v.y = s[5] * proj[i][1] + s[13];

View File

@@ -1,4 +1,4 @@
# $Id: Makefile.X11,v 1.36 2000/12/26 05:09:27 keithw Exp $ # $Id: Makefile.X11,v 1.37 2000/12/28 22:11:04 keithw Exp $
# Mesa 3-D graphics library # Mesa 3-D graphics library
# Version: 3.5 # Version: 3.5
@@ -160,6 +160,7 @@ DRIVER_SOURCES = \
FX/fxtexman.c \ FX/fxtexman.c \
FX/fxtris.c \ FX/fxtris.c \
FX/fxvb.c \ FX/fxvb.c \
FX/fxsimplerender.c \
FX/fxglidew.c \ FX/fxglidew.c \
X/glxapi.c \ X/glxapi.c \
X/fakeglx.c \ X/fakeglx.c \

View File

@@ -1,4 +1,4 @@
/* $Id: config.h,v 1.25 2000/12/26 05:09:28 keithw Exp $ */ /* $Id: config.h,v 1.26 2000/12/28 22:11:05 keithw Exp $ */
/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
@@ -103,7 +103,7 @@
#define MAX_TEXTURE_LEVELS 12 #define MAX_TEXTURE_LEVELS 12
/* Number of texture units - GL_ARB_multitexture */ /* Number of texture units - GL_ARB_multitexture */
#define MAX_TEXTURE_UNITS 4 #define MAX_TEXTURE_UNITS 8
/* Maximum viewport/image size: */ /* Maximum viewport/image size: */
#define MAX_WIDTH 2048 #define MAX_WIDTH 2048

View File

@@ -1,4 +1,4 @@
/* $Id: varray.c,v 1.34 2000/12/26 05:09:29 keithw Exp $ */ /* $Id: varray.c,v 1.35 2000/12/28 22:11:05 keithw Exp $ */
/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
@@ -411,6 +411,8 @@ _mesa_TexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr
ctx->NewState |= _NEW_ARRAY; ctx->NewState |= _NEW_ARRAY;
ctx->Array.NewState |= _NEW_ARRAY_VERTEX; ctx->Array.NewState |= _NEW_ARRAY_VERTEX;
/* fprintf(stderr, "%s ptr %p\n", __FUNCTION__, ptr); */
if (ctx->Driver.TexCoordPointer) if (ctx->Driver.TexCoordPointer)
ctx->Driver.TexCoordPointer( ctx, size, type, stride, ptr ); ctx->Driver.TexCoordPointer( ctx, size, type, stride, ptr );
} }

View File

@@ -1,4 +1,4 @@
/* $Id: m_norm_tmp.h,v 1.2 2000/11/19 23:42:33 jtaylor Exp $ */ /* $Id: m_norm_tmp.h,v 1.3 2000/12/28 22:11:05 keithw Exp $ */
/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
@@ -77,8 +77,6 @@ TAG(transform_normalize_normals)( const GLmatrix *mat,
} }
} }
else { else {
/* scale has been snapped to 1.0 if it is close.
*/
if (scale != 1.0) { if (scale != 1.0) {
m0 *= scale, m4 *= scale, m8 *= scale; m0 *= scale, m4 *= scale, m8 *= scale;
m1 *= scale, m5 *= scale, m9 *= scale; m1 *= scale, m5 *= scale, m9 *= scale;

View File

@@ -1,4 +1,4 @@
/* $Id: t_array_import.c,v 1.2 2000/12/27 19:57:37 keithw Exp $ */ /* $Id: t_array_import.c,v 1.3 2000/12/28 22:11:05 keithw Exp $ */
/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
@@ -62,7 +62,7 @@ static void _tnl_import_vertex( GLcontext *ctx,
inputs->Obj.stride = tmp->StrideB; inputs->Obj.stride = tmp->StrideB;
inputs->Obj.size = tmp->Size; inputs->Obj.size = tmp->Size;
inputs->Obj.flags &= ~(VEC_BAD_STRIDE|VEC_NOT_WRITEABLE); inputs->Obj.flags &= ~(VEC_BAD_STRIDE|VEC_NOT_WRITEABLE);
if (stride != 4*sizeof(GLfloat)) if (inputs->Obj.stride != 4*sizeof(GLfloat))
inputs->Obj.flags |= VEC_BAD_STRIDE; inputs->Obj.flags |= VEC_BAD_STRIDE;
if (!is_writeable) if (!is_writeable)
inputs->Obj.flags |= VEC_NOT_WRITEABLE; inputs->Obj.flags |= VEC_NOT_WRITEABLE;
@@ -84,7 +84,7 @@ static void _tnl_import_normal( GLcontext *ctx,
inputs->Normal.start = (GLfloat *)tmp->Ptr; inputs->Normal.start = (GLfloat *)tmp->Ptr;
inputs->Normal.stride = tmp->StrideB; inputs->Normal.stride = tmp->StrideB;
inputs->Normal.flags &= ~(VEC_BAD_STRIDE|VEC_NOT_WRITEABLE); inputs->Normal.flags &= ~(VEC_BAD_STRIDE|VEC_NOT_WRITEABLE);
if (stride != 3*sizeof(GLfloat)) if (inputs->Normal.stride != 3*sizeof(GLfloat))
inputs->Normal.flags |= VEC_BAD_STRIDE; inputs->Normal.flags |= VEC_BAD_STRIDE;
if (!is_writeable) if (!is_writeable)
inputs->Normal.flags |= VEC_NOT_WRITEABLE; inputs->Normal.flags |= VEC_NOT_WRITEABLE;
@@ -110,7 +110,7 @@ static void _tnl_import_color( GLcontext *ctx,
inputs->Color.start = (GLubyte *)tmp->Ptr; inputs->Color.start = (GLubyte *)tmp->Ptr;
inputs->Color.stride = tmp->StrideB; inputs->Color.stride = tmp->StrideB;
inputs->Color.flags &= ~(VEC_BAD_STRIDE|VEC_NOT_WRITEABLE); inputs->Color.flags &= ~(VEC_BAD_STRIDE|VEC_NOT_WRITEABLE);
if (stride != 4*sizeof(GLubyte)) if (inputs->Color.stride != 4*sizeof(GLubyte))
inputs->Color.flags |= VEC_BAD_STRIDE; inputs->Color.flags |= VEC_BAD_STRIDE;
if (!is_writeable) if (!is_writeable)
inputs->Color.flags |= VEC_NOT_WRITEABLE; inputs->Color.flags |= VEC_NOT_WRITEABLE;
@@ -135,7 +135,7 @@ static void _tnl_import_secondarycolor( GLcontext *ctx,
inputs->SecondaryColor.start = (GLubyte *)tmp->Ptr; inputs->SecondaryColor.start = (GLubyte *)tmp->Ptr;
inputs->SecondaryColor.stride = tmp->StrideB; inputs->SecondaryColor.stride = tmp->StrideB;
inputs->SecondaryColor.flags &= ~(VEC_BAD_STRIDE|VEC_NOT_WRITEABLE); inputs->SecondaryColor.flags &= ~(VEC_BAD_STRIDE|VEC_NOT_WRITEABLE);
if (stride != 4*sizeof(GLubyte)) if (inputs->SecondaryColor.stride != 4*sizeof(GLubyte))
inputs->SecondaryColor.flags |= VEC_BAD_STRIDE; inputs->SecondaryColor.flags |= VEC_BAD_STRIDE;
if (!is_writeable) if (!is_writeable)
inputs->SecondaryColor.flags |= VEC_NOT_WRITEABLE; inputs->SecondaryColor.flags |= VEC_NOT_WRITEABLE;
@@ -157,7 +157,7 @@ static void _tnl_import_fogcoord( GLcontext *ctx,
inputs->FogCoord.start = (GLfloat *)tmp->Ptr; inputs->FogCoord.start = (GLfloat *)tmp->Ptr;
inputs->FogCoord.stride = tmp->StrideB; inputs->FogCoord.stride = tmp->StrideB;
inputs->FogCoord.flags &= ~(VEC_BAD_STRIDE|VEC_NOT_WRITEABLE); inputs->FogCoord.flags &= ~(VEC_BAD_STRIDE|VEC_NOT_WRITEABLE);
if (stride != sizeof(GLfloat)) if (inputs->FogCoord.stride != sizeof(GLfloat))
inputs->FogCoord.flags |= VEC_BAD_STRIDE; inputs->FogCoord.flags |= VEC_BAD_STRIDE;
if (!is_writeable) if (!is_writeable)
inputs->FogCoord.flags |= VEC_NOT_WRITEABLE; inputs->FogCoord.flags |= VEC_NOT_WRITEABLE;
@@ -179,7 +179,7 @@ static void _tnl_import_index( GLcontext *ctx,
inputs->Index.start = (GLuint *)tmp->Ptr; inputs->Index.start = (GLuint *)tmp->Ptr;
inputs->Index.stride = tmp->StrideB; inputs->Index.stride = tmp->StrideB;
inputs->Index.flags &= ~(VEC_BAD_STRIDE|VEC_NOT_WRITEABLE); inputs->Index.flags &= ~(VEC_BAD_STRIDE|VEC_NOT_WRITEABLE);
if (stride != sizeof(GLuint)) if (inputs->Index.stride != sizeof(GLuint))
inputs->Index.flags |= VEC_BAD_STRIDE; inputs->Index.flags |= VEC_BAD_STRIDE;
if (!is_writeable) if (!is_writeable)
inputs->Index.flags |= VEC_NOT_WRITEABLE; inputs->Index.flags |= VEC_NOT_WRITEABLE;
@@ -195,6 +195,9 @@ static void _tnl_import_texcoord( GLcontext *ctx,
struct gl_client_array *tmp; struct gl_client_array *tmp;
GLboolean is_writeable = 0; GLboolean is_writeable = 0;
/* fprintf(stderr, "%s %d before wr %d ptr %p\n", __FUNCTION__, i, writeable, */
/* inputs->TexCoord[i].data); */
tmp = _ac_import_texcoord(ctx, i, GL_FLOAT, tmp = _ac_import_texcoord(ctx, i, GL_FLOAT,
stride ? 4*sizeof(GLfloat) : 0, stride ? 4*sizeof(GLfloat) : 0,
0, 0,
@@ -206,10 +209,13 @@ static void _tnl_import_texcoord( GLcontext *ctx,
inputs->TexCoord[i].stride = tmp->StrideB; inputs->TexCoord[i].stride = tmp->StrideB;
inputs->TexCoord[i].size = tmp->Size; inputs->TexCoord[i].size = tmp->Size;
inputs->TexCoord[i].flags &= ~(VEC_BAD_STRIDE|VEC_NOT_WRITEABLE); inputs->TexCoord[i].flags &= ~(VEC_BAD_STRIDE|VEC_NOT_WRITEABLE);
if (stride != 4*sizeof(GLfloat)) if (inputs->TexCoord[i].stride != 4*sizeof(GLfloat))
inputs->TexCoord[i].flags |= VEC_BAD_STRIDE; inputs->TexCoord[i].flags |= VEC_BAD_STRIDE;
if (!is_writeable) if (!is_writeable)
inputs->TexCoord[i].flags |= VEC_NOT_WRITEABLE; inputs->TexCoord[i].flags |= VEC_NOT_WRITEABLE;
/* fprintf(stderr, "%s %d before wr %d ptr %p\n", __FUNCTION__, i, is_writeable, */
/* inputs->TexCoord[i].data); */
} }
@@ -230,7 +236,7 @@ static void _tnl_import_edgeflag( GLcontext *ctx,
inputs->EdgeFlag.start = (GLubyte *)tmp->Ptr; inputs->EdgeFlag.start = (GLubyte *)tmp->Ptr;
inputs->EdgeFlag.stride = tmp->StrideB; inputs->EdgeFlag.stride = tmp->StrideB;
inputs->EdgeFlag.flags &= ~(VEC_BAD_STRIDE|VEC_NOT_WRITEABLE); inputs->EdgeFlag.flags &= ~(VEC_BAD_STRIDE|VEC_NOT_WRITEABLE);
if (stride != sizeof(GLubyte)) if (inputs->EdgeFlag.stride != sizeof(GLubyte))
inputs->EdgeFlag.flags |= VEC_BAD_STRIDE; inputs->EdgeFlag.flags |= VEC_BAD_STRIDE;
if (!is_writeable) if (!is_writeable)
inputs->EdgeFlag.flags |= VEC_NOT_WRITEABLE; inputs->EdgeFlag.flags |= VEC_NOT_WRITEABLE;
@@ -256,6 +262,8 @@ static void _tnl_upgrade_client_data( GLcontext *ctx,
if ((required & VERT_CLIP) && VB->ClipPtr == VB->ObjPtr) if ((required & VERT_CLIP) && VB->ClipPtr == VB->ObjPtr)
required |= VERT_OBJ; required |= VERT_OBJ;
/* _tnl_print_vert_flags("_tnl_upgrade_client_data", required); */
if ((required & VERT_OBJ) && (VB->ObjPtr->flags & flags)) { if ((required & VERT_OBJ) && (VB->ObjPtr->flags & flags)) {
ASSERT(VB->ObjPtr == &inputs->Obj); ASSERT(VB->ObjPtr == &inputs->Obj);
_tnl_import_vertex( ctx, writeable, stride ); _tnl_import_vertex( ctx, writeable, stride );
@@ -330,9 +338,9 @@ void _tnl_vb_bind_arrays( GLcontext *ctx, GLint start, GLsizei count )
VB->Material = 0; VB->Material = 0;
VB->Flag = 0; VB->Flag = 0;
/* _tnl_print_vert_flags("_tnl_print_vert_flags: inputs", inputs); */ /* _tnl_print_vert_flags("_tnl_vb_bind_arrays: inputs", inputs); */
/* _tnl_print_vert_flags("_tnl_print_vert_flags: imports", imports); */ /* _tnl_print_vert_flags("_tnl_vb_bind_arrays: imports", imports); */
/* _tnl_print_vert_flags("_tnl_print_vert_flags: _Enabled", ctx->Array._Enabled); */ /* _tnl_print_vert_flags("_tnl_vb_bind_arrays: _Enabled", ctx->Array._Enabled); */
if (inputs & VERT_OBJ) { if (inputs & VERT_OBJ) {
if (imports & VERT_OBJ) { if (imports & VERT_OBJ) {
@@ -409,7 +417,9 @@ void _tnl_vb_bind_arrays( GLcontext *ctx, GLint start, GLsizei count )
VB->Primitive = tnl->tmp_primitive; VB->Primitive = tnl->tmp_primitive;
VB->PrimitiveLength = tnl->tmp_primitive_length; VB->PrimitiveLength = tnl->tmp_primitive_length;
VB->import_data = _tnl_upgrade_client_data; VB->import_data = _tnl_upgrade_client_data;
VB->importable_data = imports; VB->importable_data = imports & VERT_FIXUP;
/* _tnl_print_vert_flags("_tnl_vb_bind_arrays: importable", VB->importable_data); */
} }

View File

@@ -1,4 +1,4 @@
/* $Id: t_imm_alloc.c,v 1.1 2000/12/26 05:09:32 keithw Exp $ */ /* $Id: t_imm_alloc.c,v 1.2 2000/12/28 22:11:05 keithw Exp $ */
/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
@@ -34,10 +34,10 @@
#include "t_imm_alloc.h" #include "t_imm_alloc.h"
static int id = 0;
struct immediate *_tnl_alloc_immediate( GLcontext *ctx ) struct immediate *_tnl_alloc_immediate( GLcontext *ctx )
{ {
static int id = 0;
struct immediate *IM = ALIGN_MALLOC_STRUCT( immediate, 32 ); struct immediate *IM = ALIGN_MALLOC_STRUCT( immediate, 32 );
GLuint j; GLuint j;
@@ -80,6 +80,7 @@ struct immediate *_tnl_alloc_immediate( GLcontext *ctx )
void _tnl_free_immediate( struct immediate *IM ) void _tnl_free_immediate( struct immediate *IM )
{ {
static int freed = 0;
GLuint j; GLuint j;
if (IM->NormalLengths) { if (IM->NormalLengths) {
@@ -92,12 +93,15 @@ void _tnl_free_immediate( struct immediate *IM )
FREE( IM->MaterialMask ); FREE( IM->MaterialMask );
IM->Material = 0; IM->Material = 0;
IM->MaterialMask = 0; IM->MaterialMask = 0;
for (j = 1; j < IM->MaxTextureUnits; j++)
ALIGN_FREE( IM->TexCoord[j] );
} }
for (j = 1; j < IM->MaxTextureUnits; j++)
ALIGN_FREE( IM->TexCoord[j] );
ALIGN_FREE( IM ); ALIGN_FREE( IM );
freed++;
/* printf("outstanding %d\n", id - freed); */
} }

View File

@@ -1,4 +1,4 @@
/* $Id: t_imm_dlist.c,v 1.3 2000/12/27 21:49:40 keithw Exp $ */ /* $Id: t_imm_dlist.c,v 1.4 2000/12/28 22:11:05 keithw Exp $ */
/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
@@ -112,6 +112,8 @@ _tnl_compile_cassette( GLcontext *ctx, struct immediate *IM )
return; return;
node->IM = im; im->ref_count++; node->IM = im; im->ref_count++;
/* fprintf(stderr, "%s id %d refcount %d\n", __FUNCTION__, */
/* im->id, im->ref_count); */
node->Start = im->Start; node->Start = im->Start;
node->Count = im->Count; node->Count = im->Count;
node->BeginState = im->BeginState; node->BeginState = im->BeginState;
@@ -142,6 +144,10 @@ _tnl_compile_cassette( GLcontext *ctx, struct immediate *IM )
if (!new_im) return; if (!new_im) return;
new_im->ref_count++; new_im->ref_count++;
im->ref_count--; /* remove CURRENT_IM reference */ im->ref_count--; /* remove CURRENT_IM reference */
/* fprintf(stderr, "%s id %d refcount %d\n", __FUNCTION__, */
/* im->id, im->ref_count); */
/* fprintf(stderr, "%s id %d refcount %d\n", __FUNCTION__, */
/* new_im->id, new_im->ref_count); */
ASSERT(im->ref_count > 0); ASSERT(im->ref_count > 0);
SET_IMMEDIATE( ctx, new_im ); SET_IMMEDIATE( ctx, new_im );
_tnl_reset_input( ctx, IMM_MAX_COPIED_VERTS, _tnl_reset_input( ctx, IMM_MAX_COPIED_VERTS,
@@ -230,20 +236,23 @@ execute_compiled_cassette( GLcontext *ctx, void *data )
} }
/* Lazy optimization of the cassette. /* Lazy optimization of the cassette. Need to make these switchable
* or otherwise more useful for t&l cards.
*/ */
/* if (ctx->Transform.Normalize && !node->have_normal_lengths) { */ #if 0
if (ctx->Transform.Normalize && !node->have_normal_lengths) {
/* if (!IM->NormalLengths) */ if (!IM->NormalLengths)
/* IM->NormalLengths = (GLfloat *)MALLOC(sizeof(GLfloat) * IMM_SIZE); */ IM->NormalLengths = (GLfloat *)MALLOC(sizeof(GLfloat) * IMM_SIZE);
/* calc_normal_lengths( IM->NormalLengths + IM->Start, */ calc_normal_lengths( IM->NormalLengths + IM->Start,
/* (const GLfloat (*)[3])(IM->Normal + IM->Start), */ (const GLfloat (*)[3])(IM->Normal + IM->Start),
/* IM->Flag + IM->Start, */ IM->Flag + IM->Start,
/* IM->Count - IM->Start); */ IM->Count - IM->Start);
/* node->have_normal_lengths = GL_TRUE; */ node->have_normal_lengths = GL_TRUE;
/* } */ }
#endif
#if 0 #if 0
@@ -268,6 +277,10 @@ destroy_compiled_cassette( GLcontext *ctx, void *data )
{ {
TNLvertexcassette *node = (TNLvertexcassette *)data; TNLvertexcassette *node = (TNLvertexcassette *)data;
/* fprintf(stderr, "destroy_compiled_cassette node->IM id %d ref_count: %d\n", */
/* node->IM->id, */
/* node->IM->ref_count-1); */
if ( --node->IM->ref_count == 0 ) if ( --node->IM->ref_count == 0 )
_tnl_free_immediate( node->IM ); _tnl_free_immediate( node->IM );
} }
@@ -328,9 +341,20 @@ _tnl_EndList( GLcontext *ctx )
TNLcontext *tnl = TNL_CONTEXT(ctx); TNLcontext *tnl = TNL_CONTEXT(ctx);
struct immediate *IM = TNL_CURRENT_IM(ctx); struct immediate *IM = TNL_CURRENT_IM(ctx);
ctx->swtnl_im = 0;
IM->ref_count--; IM->ref_count--;
if (IM == tnl->ExecCopySource) /* fprintf(stderr, "%s id %d refcount %d\n", __FUNCTION__, */
/* IM->id, IM->ref_count); */
if (IM == tnl->ExecCopySource) {
IM->ref_count--; IM->ref_count--;
/* fprintf(stderr, "%s id %d refcount %d\n", __FUNCTION__, */
/* IM->id, IM->ref_count); */
} else {
/* fprintf(stderr, "%s id %d refcount %d\n", __FUNCTION__, */
/* tnl->ExecCopySource->id, tnl->ExecCopySource->ref_count-1); */
if ( --tnl->ExecCopySource->ref_count == 0 )
_tnl_free_immediate( tnl->ExecCopySource );
}
/* If this one isn't free, get a clean one. (Otherwise we'll be /* If this one isn't free, get a clean one. (Otherwise we'll be
* using one that's already half full). * using one that's already half full).
@@ -342,9 +366,14 @@ _tnl_EndList( GLcontext *ctx )
tnl->ExecCopySource = IM; tnl->ExecCopySource = IM;
IM->ref_count++; IM->ref_count++;
/* fprintf(stderr, "%s id %d refcount %d\n", __FUNCTION__, */
/* IM->id, IM->ref_count); */
SET_IMMEDIATE( ctx, IM ); SET_IMMEDIATE( ctx, IM );
IM->ref_count++; IM->ref_count++;
/* fprintf(stderr, "%s id %d refcount %d\n", __FUNCTION__, */
/* IM->id, IM->ref_count); */
_tnl_reset_input( ctx, IMM_MAX_COPIED_VERTS, 0, 0 ); _tnl_reset_input( ctx, IMM_MAX_COPIED_VERTS, 0, 0 );

View File

@@ -1,4 +1,4 @@
/* $Id: t_imm_exec.c,v 1.3 2000/12/27 22:52:45 keithw Exp $ */ /* $Id: t_imm_exec.c,v 1.4 2000/12/28 22:11:05 keithw Exp $ */
/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
@@ -474,11 +474,15 @@ void _tnl_imm_init( GLcontext *ctx )
ctx->swtnl_im = _tnl_alloc_immediate( ctx ); ctx->swtnl_im = _tnl_alloc_immediate( ctx );
TNL_CURRENT_IM(ctx)->ref_count++; TNL_CURRENT_IM(ctx)->ref_count++;
/* fprintf(stderr, "%s id %d refcount %d\n", __FUNCTION__, */
/* TNL_CURRENT_IM(ctx)->id, TNL_CURRENT_IM(ctx)->ref_count); */
tnl->ExecCopyTexSize = 0; tnl->ExecCopyTexSize = 0;
tnl->ExecCopyCount = 0; tnl->ExecCopyCount = 0;
tnl->ExecCopySource = TNL_CURRENT_IM(ctx); tnl->ExecCopySource = TNL_CURRENT_IM(ctx);
TNL_CURRENT_IM(ctx)->ref_count++; TNL_CURRENT_IM(ctx)->ref_count++;
/* fprintf(stderr, "%s id %d refcount %d\n", __FUNCTION__, */
/* TNL_CURRENT_IM(ctx)->id, TNL_CURRENT_IM(ctx)->ref_count); */
TNL_CURRENT_IM(ctx)->CopyStart = IMM_MAX_COPIED_VERTS; TNL_CURRENT_IM(ctx)->CopyStart = IMM_MAX_COPIED_VERTS;
gl_vector4f_init( &tmp->Obj, 0, 0 ); gl_vector4f_init( &tmp->Obj, 0, 0 );

View File

@@ -1,4 +1,4 @@
/* $Id: t_imm_fixup.c,v 1.1 2000/12/26 05:09:32 keithw Exp $ */ /* $Id: t_imm_fixup.c,v 1.2 2000/12/28 22:11:05 keithw Exp $ */
/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
@@ -432,11 +432,17 @@ static void copy_vertices( GLcontext *ctx,
} }
ASSERT(prev == tnl->ExecCopySource); ASSERT(prev == tnl->ExecCopySource);
/* fprintf(stderr, "%s id %d refcount %d\n", __FUNCTION__, */
/* tnl->ExecCopySource->id, tnl->ExecCopySource->ref_count-1); */
if (--tnl->ExecCopySource->ref_count == 0) if (--tnl->ExecCopySource->ref_count == 0)
_tnl_free_immediate( tnl->ExecCopySource ); _tnl_free_immediate( tnl->ExecCopySource );
next->ref_count++; next->ref_count++;
tnl->ExecCopySource = next; tnl->ExecCopySource = next;
/* fprintf(stderr, "%s id %d refcount %d\n", __FUNCTION__, */
/* next->id, next->ref_count); */
tnl->ExecCopyElts[0] = next->Start-3; tnl->ExecCopyElts[0] = next->Start-3;
tnl->ExecCopyElts[1] = next->Start-2; tnl->ExecCopyElts[1] = next->Start-2;
tnl->ExecCopyElts[2] = next->Start-1; tnl->ExecCopyElts[2] = next->Start-1;
@@ -726,10 +732,14 @@ _tnl_get_exec_copy_verts( GLcontext *ctx, struct immediate *IM )
if (tnl->ExecCopySource != IM) { if (tnl->ExecCopySource != IM) {
/* fprintf(stderr, "%s id %d refcount %d\n", __FUNCTION__, */
/* tnl->ExecCopySource->id, tnl->ExecCopySource->ref_count-1); */
if (--tnl->ExecCopySource->ref_count == 0) if (--tnl->ExecCopySource->ref_count == 0)
_tnl_free_immediate( tnl->ExecCopySource ); _tnl_free_immediate( tnl->ExecCopySource );
IM->ref_count++; IM->ref_count++;
tnl->ExecCopySource = IM; tnl->ExecCopySource = IM;
/* fprintf(stderr, "%s id %d refcount %d\n", __FUNCTION__, */
/* tnl->ExecCopySource->id, tnl->ExecCopySource->ref_count); */
} }
if (prim == GL_POLYGON+1) { if (prim == GL_POLYGON+1) {

View File

@@ -1,4 +1,4 @@
/* $Id: t_vb_cliptmp.h,v 1.3 2000/12/27 21:49:40 keithw Exp $ */ /* $Id: t_vb_cliptmp.h,v 1.4 2000/12/28 22:11:05 keithw Exp $ */
/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
@@ -361,7 +361,7 @@ static void TAG(viewclip_polygon)( GLcontext *ctx,
newvert = interp( ctx, t, idxPrev, idx, GL_FALSE ); \ newvert = interp( ctx, t, idxPrev, idx, GL_FALSE ); \
} \ } \
clipmask[newvert] = mask; \ clipmask[newvert] = mask; \
outlist[outcount++] = newvert; \ outlist[outcount++] = newvert; \
} \ } \
\ \
idxPrev = idx; \ idxPrev = idx; \

View File

@@ -1,4 +1,4 @@
/* $Id: t_vb_render.c,v 1.3 2000/12/27 21:49:40 keithw Exp $ */ /* $Id: t_vb_render.c,v 1.4 2000/12/28 22:11:06 keithw Exp $ */
/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
@@ -520,6 +520,8 @@ static GLboolean run_render( GLcontext *ctx,
render_func *tab; render_func *tab;
GLint pass = 0; GLint pass = 0;
/* return GL_FALSE; */
VB->interpfunc = (void *)RENDER_STAGE_DATA(stage)->interp; VB->interpfunc = (void *)RENDER_STAGE_DATA(stage)->interp;
if (new_inputs) { if (new_inputs) {
@@ -615,7 +617,7 @@ static void check_render( GLcontext *ctx, struct gl_pipeline_stage *stage )
} }
} }
} }
else if (ctx->Light.ShadeModel==GL_SMOOTH) else
{ {
interp |= INTERP_INDEX; interp |= INTERP_INDEX;
inputs |= VERT_INDEX; inputs |= VERT_INDEX;

View File

@@ -1,4 +1,4 @@
/* $Id: t_vb_rendertmp.h,v 1.2 2000/12/27 19:57:37 keithw Exp $ */ /* $Id: t_vb_rendertmp.h,v 1.3 2000/12/28 22:11:06 keithw Exp $ */
/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
@@ -39,7 +39,7 @@
#ifndef NEED_EDGEFLAG_SETUP #ifndef NEED_EDGEFLAG_SETUP
#define NEED_EDGEFLAG_SETUP 0 #define NEED_EDGEFLAG_SETUP 0
#define EDGEFLAG_GET(a) 0 #define EDGEFLAG_GET(a) 0
#define EDGEFLAG_SET(a,b) #define EDGEFLAG_SET(a,b) (void)b
#endif #endif
#ifndef RESET_STIPPLE #ifndef RESET_STIPPLE
@@ -68,6 +68,7 @@ static void TAG(render_points)( GLcontext *ctx,
LOCAL_VARS; LOCAL_VARS;
(void) flags; (void) flags;
/* fprintf(stderr, "%s %d..%d\n", __FUNCTION__, start, count); */
RESET_OCCLUSION; RESET_OCCLUSION;
INIT(GL_POINTS); INIT(GL_POINTS);
RENDER_POINTS( start, count ); RENDER_POINTS( start, count );
@@ -83,6 +84,7 @@ static void TAG(render_lines)( GLcontext *ctx,
LOCAL_VARS; LOCAL_VARS;
(void) flags; (void) flags;
/* fprintf(stderr, "%s %d..%d\n", __FUNCTION__, start, count); */
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 ) {
@@ -102,6 +104,7 @@ static void TAG(render_line_strip)( GLcontext *ctx,
LOCAL_VARS; LOCAL_VARS;
(void) flags; (void) flags;
/* fprintf(stderr, "%s %d..%d\n", __FUNCTION__, start, count); */
RESET_OCCLUSION; RESET_OCCLUSION;
INIT(GL_LINES); INIT(GL_LINES);
@@ -125,6 +128,7 @@ static void TAG(render_line_loop)( GLcontext *ctx,
(void) flags; (void) flags;
/* fprintf(stderr, "%s %d..%d\n", __FUNCTION__, start, count); */
RESET_OCCLUSION; RESET_OCCLUSION;
INIT(GL_LINES); INIT(GL_LINES);
@@ -156,6 +160,7 @@ static void TAG(render_triangles)( GLcontext *ctx,
LOCAL_VARS; LOCAL_VARS;
(void) flags; (void) flags;
/* fprintf(stderr, "%s %d..%d\n", __FUNCTION__, start, count); */
INIT(GL_POLYGON); INIT(GL_POLYGON);
if (NEED_EDGEFLAG_SETUP) { if (NEED_EDGEFLAG_SETUP) {
for (j=start+2; j<count; j+=3) { for (j=start+2; j<count; j+=3) {
@@ -186,6 +191,7 @@ static void TAG(render_tri_strip)( GLcontext *ctx,
if (TEST_PRIM_PARITY(flags)) if (TEST_PRIM_PARITY(flags))
parity = 1; parity = 1;
/* fprintf(stderr, "%s %d..%d\n", __FUNCTION__, start, count); */
INIT(GL_POLYGON); INIT(GL_POLYGON);
if (NEED_EDGEFLAG_SETUP) { if (NEED_EDGEFLAG_SETUP) {
for (j=start+2;j<count;j++,parity^=1) { for (j=start+2;j<count;j++,parity^=1) {
@@ -225,6 +231,7 @@ static void TAG(render_tri_fan)( GLcontext *ctx,
LOCAL_VARS; LOCAL_VARS;
(void) flags; (void) flags;
/* fprintf(stderr, "%s %d..%d\n", __FUNCTION__, start, count); */
INIT(GL_POLYGON); INIT(GL_POLYGON);
if (NEED_EDGEFLAG_SETUP) { if (NEED_EDGEFLAG_SETUP) {
for (j=start+2;j<count;j++) { for (j=start+2;j<count;j++) {
@@ -270,6 +277,7 @@ static void TAG(render_poly_pv)( GLcontext *ctx,
LOCAL_VARS; LOCAL_VARS;
(void) flags; (void) flags;
/* fprintf(stderr, "%s %d..%d\n", __FUNCTION__, start, count); */
INIT(GL_POLYGON); INIT(GL_POLYGON);
if (NEED_EDGEFLAG_SETUP) { if (NEED_EDGEFLAG_SETUP) {
GLboolean efstart = EDGEFLAG_GET( ELT(start) ); GLboolean efstart = EDGEFLAG_GET( ELT(start) );
@@ -335,6 +343,7 @@ static void TAG(render_poly)( GLcontext *ctx,
GLuint count, GLuint count,
GLuint flags ) GLuint flags )
{ {
/* fprintf(stderr, "%s %d..%d\n", __FUNCTION__, start, count); */
TAG(render_poly_pv)( ctx, start, count, flags, start ); TAG(render_poly_pv)( ctx, start, count, flags, start );
} }
@@ -347,6 +356,7 @@ static void TAG(render_quads)( GLcontext *ctx,
LOCAL_VARS; LOCAL_VARS;
(void) flags; (void) flags;
/* fprintf(stderr, "%s %d..%d\n", __FUNCTION__, start, count); */
INIT(GL_POLYGON); INIT(GL_POLYGON);
if (NEED_EDGEFLAG_SETUP) { if (NEED_EDGEFLAG_SETUP) {
for (j=start+3; j<count; j+=4) { for (j=start+3; j<count; j+=4) {
@@ -372,6 +382,7 @@ static void TAG(render_quad_strip)( GLcontext *ctx,
LOCAL_VARS; LOCAL_VARS;
(void) flags; (void) flags;
/* fprintf(stderr, "%s %d..%d\n", __FUNCTION__, start, count); */
INIT(GL_POLYGON); INIT(GL_POLYGON);
if (NEED_EDGEFLAG_SETUP) { if (NEED_EDGEFLAG_SETUP) {
for (j=start+3;j<count;j+=2) { for (j=start+3;j<count;j+=2) {
@@ -406,10 +417,15 @@ static void TAG(render_noop)( GLcontext *ctx,
GLuint count, GLuint count,
GLuint flags ) GLuint flags )
{ {
/* fprintf(stderr, "%s %d..%d\n", __FUNCTION__, start, count); */
(void)(ctx && start && count && flags); (void)(ctx && start && count && flags);
} }
static render_func TAG(render_tab)[GL_POLYGON+2] = { static void (*TAG(render_tab)[GL_POLYGON+2])(GLcontext *,
GLuint,
GLuint,
GLuint) =
{
TAG(render_points), TAG(render_points),
TAG(render_lines), TAG(render_lines),
TAG(render_line_loop), TAG(render_line_loop),