summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorKeith Whitwell <[email protected]>2000-11-24 15:21:59 +0000
committerKeith Whitwell <[email protected]>2000-11-24 15:21:59 +0000
commit9aff6cfdc37f83a2528463179ad0b50893bf0c58 (patch)
tree0bb5482717e276ab6b95b47ba2eb3ff8685094bf /src/mesa
parent65dcc30599348c2bfd7952b888db27edd1670fc6 (diff)
Fixed a couple of bugs that crept into last commit
- Eval not compiled correctly - Material colors computed incorrectly Reworked the VERT_TEX flags, now support upto 12 texture units in tnl.
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/Makefile.X114
-rw-r--r--src/mesa/main/Makefile.X114
-rw-r--r--src/mesa/main/api_loopback.c2
-rw-r--r--src/mesa/main/dlist.c11
-rw-r--r--src/mesa/main/dlist.h6
-rw-r--r--src/mesa/main/light.c6
-rw-r--r--src/mesa/tnl/t_context.c24
-rw-r--r--src/mesa/tnl/t_context.h104
-rw-r--r--src/mesa/tnl/t_pipeline.c51
9 files changed, 84 insertions, 128 deletions
diff --git a/src/mesa/Makefile.X11 b/src/mesa/Makefile.X11
index 84384f4c81e..00debd391d1 100644
--- a/src/mesa/Makefile.X11
+++ b/src/mesa/Makefile.X11
@@ -1,4 +1,4 @@
-# $Id: Makefile.X11,v 1.34 2000/11/24 10:25:05 keithw Exp $
+# $Id: Makefile.X11,v 1.35 2000/11/24 15:21:59 keithw Exp $
# Mesa 3-D graphics library
# Version: 3.5
@@ -188,8 +188,8 @@ ASM_SOURCES =
ADDITIONAL_OBJ =
OBJECTS = $(ASM_SOURCES:.S=.o) \
- $(DRIVER_SOURCES:.c=.o) \
$(CORE_SOURCES:.c=.o) \
+ $(DRIVER_SOURCES:.c=.o) \
$(ADDITIONAL_OBJ)
diff --git a/src/mesa/main/Makefile.X11 b/src/mesa/main/Makefile.X11
index 84384f4c81e..00debd391d1 100644
--- a/src/mesa/main/Makefile.X11
+++ b/src/mesa/main/Makefile.X11
@@ -1,4 +1,4 @@
-# $Id: Makefile.X11,v 1.34 2000/11/24 10:25:05 keithw Exp $
+# $Id: Makefile.X11,v 1.35 2000/11/24 15:21:59 keithw Exp $
# Mesa 3-D graphics library
# Version: 3.5
@@ -188,8 +188,8 @@ ASM_SOURCES =
ADDITIONAL_OBJ =
OBJECTS = $(ASM_SOURCES:.S=.o) \
- $(DRIVER_SOURCES:.c=.o) \
$(CORE_SOURCES:.c=.o) \
+ $(DRIVER_SOURCES:.c=.o) \
$(ADDITIONAL_OBJ)
diff --git a/src/mesa/main/api_loopback.c b/src/mesa/main/api_loopback.c
index fd6a83e82f5..1ad51a65774 100644
--- a/src/mesa/main/api_loopback.c
+++ b/src/mesa/main/api_loopback.c
@@ -10,7 +10,7 @@
* hence 'loopback'.
*
* The driver must supply all of the remaining entry points, which are
- * listed in vtxfmt.h. The easiest way for a driver to do this is to
+ * listed in dd.h. The easiest way for a driver to do this is to
* install the supplied software t&l module.
*/
#define DRIVER(x) gl##x
diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c
index 171ae32ae19..22779cc56a3 100644
--- a/src/mesa/main/dlist.c
+++ b/src/mesa/main/dlist.c
@@ -1,4 +1,4 @@
-/* $Id: dlist.c,v 1.53 2000/11/24 10:25:05 keithw Exp $ */
+/* $Id: dlist.c,v 1.54 2000/11/24 15:21:59 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -1659,7 +1659,7 @@ static void save_Enable( GLenum cap )
-static void save_EvalMesh1( GLenum mode, GLint i1, GLint i2 )
+void _mesa_save_EvalMesh1( GLenum mode, GLint i1, GLint i2 )
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
@@ -1676,8 +1676,7 @@ static void save_EvalMesh1( GLenum mode, GLint i1, GLint i2 )
}
-static void save_EvalMesh2(
- GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 )
+void _mesa_save_EvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 )
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
@@ -4931,8 +4930,8 @@ _mesa_init_dlist_table( struct _glapi_table *table, GLuint tableSize )
table->DrawPixels = save_DrawPixels;
table->Enable = save_Enable;
table->EndList = _mesa_EndList;
- table->EvalMesh1 = save_EvalMesh1;
- table->EvalMesh2 = save_EvalMesh2;
+ table->EvalMesh1 = _mesa_save_EvalMesh1;
+ table->EvalMesh2 = _mesa_save_EvalMesh2;
table->Finish = _mesa_Finish;
table->Flush = _mesa_Flush;
table->Fogf = save_Fogf;
diff --git a/src/mesa/main/dlist.h b/src/mesa/main/dlist.h
index 7ec6c2e681b..5d6faf97afa 100644
--- a/src/mesa/main/dlist.h
+++ b/src/mesa/main/dlist.h
@@ -1,4 +1,4 @@
-/* $Id: dlist.h,v 1.8 2000/11/22 07:32:16 joukj Exp $ */
+/* $Id: dlist.h,v 1.9 2000/11/24 15:21:59 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -66,5 +66,9 @@ _mesa_alloc_opcode( GLcontext *ctx, GLuint sz,
void (*destroy)( GLcontext *, void * ),
void (*print)( GLcontext *, void * ) );
+extern void _mesa_save_EvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 );
+extern void _mesa_save_EvalMesh1( GLenum mode, GLint i1, GLint i2 );
+
+
#endif
diff --git a/src/mesa/main/light.c b/src/mesa/main/light.c
index af274eabcea..07571cd9656 100644
--- a/src/mesa/main/light.c
+++ b/src/mesa/main/light.c
@@ -1,4 +1,4 @@
-/* $Id: light.c,v 1.28 2000/11/24 10:25:05 keithw Exp $ */
+/* $Id: light.c,v 1.29 2000/11/24 15:21:59 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -601,14 +601,14 @@ void gl_update_material( GLcontext *ctx,
struct gl_material *mat = &ctx->Light.Material[0];
COPY_4FV( mat->Specular, src[0].Specular );
foreach (light, list) {
- ACC_SCALE_3V( light->_MatSpecular[0], light->Specular, mat->Specular);
+ SCALE_3V( light->_MatSpecular[0], light->Specular, mat->Specular);
}
}
if (bitmask & BACK_SPECULAR_BIT) {
struct gl_material *mat = &ctx->Light.Material[1];
COPY_4FV( mat->Specular, src[1].Specular );
foreach (light, list) {
- ACC_SCALE_3V( light->_MatSpecular[1], light->Specular, mat->Specular);
+ SCALE_3V( light->_MatSpecular[1], light->Specular, mat->Specular);
}
}
diff --git a/src/mesa/tnl/t_context.c b/src/mesa/tnl/t_context.c
index 457aa1c85fc..b8b608e356c 100644
--- a/src/mesa/tnl/t_context.c
+++ b/src/mesa/tnl/t_context.c
@@ -1,5 +1,6 @@
#include "mtypes.h"
#include "mem.h"
+#include "dlist.h"
#include "vtxfmt.h"
#include "t_context.h"
@@ -149,24 +150,16 @@ _tnl_CreateContext( GLcontext *ctx )
_tnl_reset_input( ctx, 0, 0 ); /* initially outside begin/end */
- tnl->_CurrentFlag = (VERT_NORM |
- VERT_INDEX |
- VERT_RGBA |
- VERT_SPEC_RGB |
- VERT_FOG_COORD |
- VERT_EDGE |
- VERT_TEX0_12 |
- VERT_TEX1_12 |
- VERT_TEX2_12 |
- VERT_TEX3_12 |
- VERT_MATERIAL);
-
+ tnl->_CurrentTex3Flag = 0;
+ tnl->_CurrentTex4Flag = 0;
tnl->_CurrentPrimitive = GL_POLYGON+1;
/* Hook our functions into exec and compile dispatch tables.
*/
- _mesa_install_save_vtxfmt( ctx, &tnl->vtxfmt );
_mesa_install_exec_vtxfmt( ctx, &tnl->vtxfmt );
+ _mesa_install_save_vtxfmt( ctx, &tnl->vtxfmt );
+ ctx->Save->EvalMesh1 = _mesa_save_EvalMesh1; /* fixme */
+ ctx->Save->EvalMesh2 = _mesa_save_EvalMesh2;
/* Set a few default values in the driver struct.
*/
@@ -250,7 +243,8 @@ _tnl_wakeup_exec( GLcontext *ctx )
/* Special state not restored by other methods:
*/
- _tnl_recalc_current_flag( ctx );
+ _tnl_validate_current_tex_flags( ctx, ~0 );
+
}
void
@@ -262,5 +256,7 @@ _tnl_wakeup_save_exec( GLcontext *ctx )
_tnl_wakeup_exec( ctx );
_mesa_install_save_vtxfmt( ctx, &tnl->vtxfmt );
+ ctx->Save->EvalMesh1 = _mesa_save_EvalMesh1; /* fixme */
+ ctx->Save->EvalMesh2 = _mesa_save_EvalMesh2;
}
diff --git a/src/mesa/tnl/t_context.h b/src/mesa/tnl/t_context.h
index 5f6de86aac0..720db4b7f9d 100644
--- a/src/mesa/tnl/t_context.h
+++ b/src/mesa/tnl/t_context.h
@@ -1,5 +1,5 @@
-/* $Id: t_context.h,v 1.4 2000/11/24 10:25:12 keithw Exp $ */
+/* $Id: t_context.h,v 1.5 2000/11/24 15:22:00 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -91,24 +91,24 @@
#define VERT_EDGE 0x200 /* glEdgeFlag */
#define VERT_MATERIAL 0x400 /* glMaterial */
#define VERT_END_VB 0x800 /* end vb marker */
-#define VERT_TEX0_12 0x1000
-#define VERT_TEX0_3 0x2000
-#define VERT_TEX0_4 0x4000
-#define VERT_TEX1_12 0x8000
-#define VERT_TEX1_3 0x10000
-#define VERT_TEX1_4 0x20000
-#define VERT_TEX2_12 0x40000
-#define VERT_TEX2_3 0x80000
-#define VERT_TEX2_4 0x100000
-#define VERT_TEX3_12 0x200000
-#define VERT_TEX3_3 0x400000
-#define VERT_TEX3_4 0x800000
+#define VERT_TEX0 0x1000
+#define VERT_TEX1 0x2000
+#define VERT_TEX2 0x3000
+#define VERT_TEX3 0x4000
+#define VERT_TEX4 0x10000
+#define VERT_TEX5 0x20000
+#define VERT_TEX6 0x30000
+#define VERT_TEX7 0x40000
+#define VERT_TEX8 0x100000
+#define VERT_TEX9 0x200000
+#define VERT_TEX10 0x300000
+#define VERT_TEX11 0x400000
#define VERT_EVAL_C1 0x1000000 /* could reuse OBJ bits for this? */
#define VERT_EVAL_C2 0x2000000 /* - or just use 3 bits */
#define VERT_EVAL_P1 0x4000000 /* */
#define VERT_EVAL_P2 0x8000000 /* */
#define VERT_SPEC_RGB 0x10000000
-#define VERT_FOG_COORD 0x20000000 /* internal use only, currently */
+#define VERT_FOG_COORD 0x20000000
#define VERT_EYE VERT_BEGIN /* reuse */
#define VERT_WIN VERT_END /* reuse */
@@ -117,7 +117,6 @@
/* Shorthands.
*/
-#define VERT_TEX0_SHIFT 11
#define VERT_EVAL_ANY (VERT_EVAL_C1|VERT_EVAL_P1| \
VERT_EVAL_C2|VERT_EVAL_P2)
@@ -126,43 +125,30 @@
#define VERT_OBJ_234 (VERT_OBJ_4|VERT_OBJ_23)
#define VERT_OBJ_ANY VERT_OBJ_2
-#define VERT_TEX0_123 (VERT_TEX0_3|VERT_TEX0_12)
-#define VERT_TEX0_1234 (VERT_TEX0_4|VERT_TEX0_123)
-#define VERT_TEX0_ANY VERT_TEX0_12
-
-#define VERT_TEX1_123 (VERT_TEX1_3|VERT_TEX1_12)
-#define VERT_TEX1_1234 (VERT_TEX1_4|VERT_TEX1_123)
-#define VERT_TEX1_ANY VERT_TEX1_12
-
-#define VERT_TEX2_123 (VERT_TEX2_3|VERT_TEX2_12)
-#define VERT_TEX2_1234 (VERT_TEX2_4|VERT_TEX2_123)
-#define VERT_TEX2_ANY VERT_TEX2_12
-
-#define VERT_TEX3_123 (VERT_TEX3_3|VERT_TEX3_12)
-#define VERT_TEX3_1234 (VERT_TEX3_4|VERT_TEX3_123)
-#define VERT_TEX3_ANY VERT_TEX3_12
-
-#define VERT_TEX_ANY_ANY (VERT_TEX0_ANY|VERT_TEX1_ANY| \
- VERT_TEX2_ANY|VERT_TEX3_ANY)
-
-#define NR_TEXSIZE_BITS 3
-#define VERT_TEX_ANY(i) (VERT_TEX0_ANY << ((i) * NR_TEXSIZE_BITS))
-
-#define VERT_FIXUP (VERT_TEX0_ANY | \
- VERT_TEX1_ANY | \
- VERT_TEX2_ANY | \
- VERT_TEX3_ANY | \
- VERT_RGBA | \
- VERT_SPEC_RGB | \
- VERT_FOG_COORD | \
- VERT_INDEX | \
- VERT_EDGE | \
+#define VERT_TEX0_SHIFT 11
+#define VERT_TEX(i) (VERT_TEX0 << i)
+#define VERT_TEX_ANY (VERT_TEX0 | \
+ VERT_TEX1 | \
+ VERT_TEX2 | \
+ VERT_TEX3 | \
+ VERT_TEX4 | \
+ VERT_TEX5 | \
+ VERT_TEX6 | \
+ VERT_TEX7 | \
+ VERT_TEX8 | \
+ VERT_TEX9 | \
+ VERT_TEX10 | \
+ VERT_TEX11)
+
+#define VERT_FIXUP (VERT_TEX_ANY | \
+ VERT_RGBA | \
+ VERT_SPEC_RGB | \
+ VERT_FOG_COORD | \
+ VERT_INDEX | \
+ VERT_EDGE | \
VERT_NORM)
-#define VERT_DATA (VERT_TEX0_ANY | \
- VERT_TEX1_ANY | \
- VERT_TEX2_ANY | \
- VERT_TEX3_ANY | \
+#define VERT_DATA (VERT_TEX_ANY | \
VERT_RGBA | \
VERT_SPEC_RGB | \
VERT_FOG_COORD | \
@@ -256,6 +242,7 @@ struct immediate
GLuint Start, Count;
GLuint LastData; /* count or count+1 */
GLuint AndFlag, OrFlag;
+ GLuint Tex3Flag, Tex4Flag; /* keep track of texcoord sizes */
GLuint BeginState, SavedBeginState;
GLuint LastPrimitive;
@@ -264,11 +251,6 @@ struct immediate
GLuint ArrayEltFlush;
GLuint FlushElt;
- GLuint TF1[MAX_TEXTURE_UNITS]; /* precalc'ed for glTexCoord */
- GLuint TF2[MAX_TEXTURE_UNITS];
- GLuint TF3[MAX_TEXTURE_UNITS];
- GLuint TF4[MAX_TEXTURE_UNITS];
-
GLuint Primitive[VB_SIZE]; /* GLubyte would do... */
GLuint NextPrimitive[VB_SIZE];
@@ -338,6 +320,8 @@ typedef struct vertex_buffer
GLuint PurgeFlags;
GLuint IndirectCount; /* defaults to count */
GLuint OrFlag, SavedOrFlag;
+ GLuint Tex3Flag, Tex4Flag;
+ GLuint SavedTex3Flag, SavedTex4Flag;
GLuint EarlyCull;
GLuint Culled, CullDone;
@@ -457,10 +441,7 @@ typedef GLuint (*clip_poly_func)( struct vertex_buffer *VB,
#define PIPE_OP_NORM_XFORM 0x2
#define PIPE_OP_LIGHT 0x4
#define PIPE_OP_FOG 0x8
-#define PIPE_OP_TEX0 0x10
-#define PIPE_OP_TEX1 0x20
-#define PIPE_OP_TEX2 0x40
-#define PIPE_OP_TEX3 0x80
+#define PIPE_OP_TEX 0x10
#define PIPE_OP_RAST_SETUP_0 0x100
#define PIPE_OP_RAST_SETUP_1 0x200
#define PIPE_OP_RENDER 0x400
@@ -561,6 +542,8 @@ typedef struct tnl_context {
GLuint _ArrayFlags;
GLuint _ArraySummary; /* Like flags, but no size information */
GLuint _ArrayNewState; /* Tracks which arrays have been changed. */
+ GLuint _ArrayTex3Flag;
+ GLuint _ArrayTex4Flag;
/* Pipeline stages - shared between the two pipelines,
@@ -592,7 +575,8 @@ typedef struct tnl_context {
shade_func *_shade_func_tab; /* Current shading function table */
GLenum _CurrentPrimitive; /* Prim or GL_POLYGON+1 */
- GLuint _CurrentFlag;
+ GLuint _CurrentTex3Flag;
+ GLuint _CurrentTex4Flag;
GLboolean _ReplayHardBeginEnd; /* Display list execution of rect, etc */
diff --git a/src/mesa/tnl/t_pipeline.c b/src/mesa/tnl/t_pipeline.c
index 42b9d051556..082f53a43ab 100644
--- a/src/mesa/tnl/t_pipeline.c
+++ b/src/mesa/tnl/t_pipeline.c
@@ -1,4 +1,4 @@
-/* $Id: t_pipeline.c,v 1.4 2000/11/24 10:25:12 keithw Exp $ */
+/* $Id: t_pipeline.c,v 1.5 2000/11/24 15:22:00 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -67,10 +67,7 @@ void _tnl_print_pipe_ops( const char *msg, GLuint flags )
(flags & PIPE_OP_NORM_XFORM) ? "norm-xform, " : "",
(flags & PIPE_OP_LIGHT) ? "light, " : "",
(flags & PIPE_OP_FOG) ? "fog, " : "",
- (flags & PIPE_OP_TEX0) ? "tex-0, " : "",
- (flags & PIPE_OP_TEX1) ? "tex-1, " : "",
- (flags & PIPE_OP_TEX2) ? "tex-2, " : "",
- (flags & PIPE_OP_TEX3) ? "tex-3, " : "",
+ (flags & PIPE_OP_TEX) ? "tex-gen/tex-mat, " : "",
(flags & PIPE_OP_RAST_SETUP_0) ? "rast-0, " : "",
(flags & PIPE_OP_RAST_SETUP_1) ? "rast-1, " : "",
(flags & PIPE_OP_RENDER) ? "render, " : "");
@@ -164,16 +161,9 @@ void _tnl_pipeline_init( GLcontext *ctx )
-#define MINIMAL_VERT_DATA (VERT_DATA & ~(VERT_TEX0_4 | \
- VERT_TEX1_4 | \
- VERT_TEX2_4 | \
- VERT_TEX3_4 | \
- VERT_EVAL_ANY))
+#define MINIMAL_VERT_DATA (VERT_DATA & ~VERT_EVAL_ANY)
-#define VERT_CURRENT_DATA (VERT_TEX0_1234 | \
- VERT_TEX1_1234 | \
- VERT_TEX2_1234 | \
- VERT_TEX3_1234 | \
+#define VERT_CURRENT_DATA (VERT_TEX_ANY | \
VERT_RGBA | \
VERT_SPEC_RGB | \
VERT_FOG_COORD | \
@@ -197,7 +187,7 @@ static void build_full_precalc_pipeline( GLcontext *ctx )
GLuint changed_ops = 0;
GLuint oldoutputs = pre->outputs;
GLuint oldinputs = pre->inputs;
- GLuint fallback = (VERT_CURRENT_DATA & tnl->_CurrentFlag &
+ GLuint fallback = (VERT_CURRENT_DATA &
~tnl->_ArraySummary);
GLuint changed_outputs = (tnl->_ArrayNewState |
(fallback & cva->orflag));
@@ -414,6 +404,7 @@ void _tnl_update_pipelines( GLcontext *ctx )
cva->orflag != cva->last_orflag ||
tnl->_ArrayFlags != cva->last_array_flags)
{
+ GLuint j;
GLuint flags = VERT_WIN;
if (ctx->Visual.RGBAflag) {
@@ -423,20 +414,10 @@ void _tnl_update_pipelines( GLcontext *ctx )
} else
flags |= VERT_INDEX;
- if (ctx->Texture._ReallyEnabled & TEXTURE0_ANY)
- flags |= VERT_TEX0_ANY;
-
- if (ctx->Texture._ReallyEnabled & TEXTURE1_ANY)
- flags |= VERT_TEX1_ANY;
-
-#if MAX_TEXTURE_UNITS > 2
- if (ctx->Texture._ReallyEnabled & TEXTURE2_ANY)
- flags |= VERT_TEX2_ANY;
-#endif
-#if MAX_TEXTURE_UNITS > 3
- if (ctx->Texture._ReallyEnabled & TEXTURE3_ANY)
- flags |= VERT_TEX3_ANY;
-#endif
+ for (j = 0 ; j < ctx->Const.MaxTextureUnits ; j++) {
+ if (ctx->Texture.Unit[j]._ReallyEnabled)
+ flags |= VERT_TEX(j);
+ }
if (ctx->Polygon._Unfilled)
flags |= VERT_EDGE;
@@ -445,16 +426,8 @@ void _tnl_update_pipelines( GLcontext *ctx )
flags |= VERT_FOG_COORD;
if (ctx->RenderMode==GL_FEEDBACK) {
- flags = (VERT_WIN | VERT_RGBA | VERT_INDEX | VERT_NORM | VERT_EDGE
- | VERT_TEX0_ANY
- | VERT_TEX1_ANY
-#if MAX_TEXTURE_UNITS > 2
- | VERT_TEX2_ANY
-#endif
-#if MAX_TEXTURE_UNITS > 3
- | VERT_TEX3_ANY
-#endif
- );
+ flags = (VERT_WIN | VERT_RGBA | VERT_INDEX | VERT_NORM |
+ VERT_EDGE | VERT_TEX_ANY);
}
tnl->_RenderFlags = flags;