diff options
author | Brian Paul <[email protected]> | 2003-04-08 02:27:16 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 2003-04-08 02:27:16 +0000 |
commit | 36a0a3252e1e20df69b53f70ba93bc74c4a4bf0e (patch) | |
tree | 6c680de320af7a288fe70e5a95696bcf0f5faa56 /src/mesa/main | |
parent | 0cebd5822a39ad3b3d7621f8e59efab329bfb5b9 (diff) |
Added ctx->Texture._EnabledCoordUnits bitfield.
Fixed some vertex array / vertex program glitches with glDrawElements.
Fixed some fragment program runtime bugs.
Non-trivial Cg programs are running now.
Diffstat (limited to 'src/mesa/main')
-rw-r--r-- | src/mesa/main/mtypes.h | 9 | ||||
-rw-r--r-- | src/mesa/main/nvfragparse.c | 17 | ||||
-rw-r--r-- | src/mesa/main/nvprogram.c | 3 | ||||
-rw-r--r-- | src/mesa/main/state.c | 28 |
4 files changed, 31 insertions, 26 deletions
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 75117902e16..8935f0ad737 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1,10 +1,8 @@ -/* $Id: mtypes.h,v 1.109 2003/04/05 00:38:09 brianp Exp $ */ - /* * Mesa 3-D graphics library - * Version: 4.1 + * Version: 5.1 * - * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2003 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -1006,6 +1004,7 @@ struct gl_texture_attrib { GLuint CurrentUnit; /* Active texture unit */ GLuint _EnabledUnits; /* one bit set for each really-enabled unit */ + GLuint _EnabledCoordUnits; /* one bit per enabled coordinate unit */ GLuint _GenFlags; /* for texgen */ GLuint _TexGenEnabled; GLuint _TexMatEnabled; @@ -1562,7 +1561,7 @@ struct matrix_stack #define _NEW_ARRAY_TEXCOORD_5 VERT_BIT_TEX5 #define _NEW_ARRAY_TEXCOORD_6 VERT_BIT_TEX6 #define _NEW_ARRAY_TEXCOORD_7 VERT_BIT_TEX7 -#define _NEW_ARRAY_ATTRIB_0 0x10000 /* start at bit 16 */ +#define _NEW_ARRAY_ATTRIB_0 0x1 /* alias conventional arrays */ #define _NEW_ARRAY_ALL 0xffffffff diff --git a/src/mesa/main/nvfragparse.c b/src/mesa/main/nvfragparse.c index 5178dfd8d2b..d2c00bdfffd 100644 --- a/src/mesa/main/nvfragparse.c +++ b/src/mesa/main/nvfragparse.c @@ -1,5 +1,3 @@ -/* $Id: nvfragparse.c,v 1.19 2003/04/07 23:12:00 brianp Exp $ */ - /* * Mesa 3-D graphics library * Version: 5.1 @@ -24,7 +22,6 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - /** * \file nvfragparse.c * \brief NVIDIA fragment program parser. @@ -42,20 +39,6 @@ #include "nvprogram.h" -/* XXX move into imports.[ch] eventually */ -static void * -_mesa_realloc(void *oldBuffer, size_t oldSize, size_t newSize) -{ - size_t copySize = MIN2(oldSize, newSize); - void *newBuffer = _mesa_malloc(newSize); - if (newBuffer && copySize > 0) - _mesa_memcpy(newBuffer, oldBuffer, copySize); - if (oldBuffer) - _mesa_free(oldBuffer); - return newBuffer; -} - - #define INPUT_1V 1 #define INPUT_2V 2 #define INPUT_3V 3 diff --git a/src/mesa/main/nvprogram.c b/src/mesa/main/nvprogram.c index ae0a9081edc..48b56f27e3a 100644 --- a/src/mesa/main/nvprogram.c +++ b/src/mesa/main/nvprogram.c @@ -1,5 +1,3 @@ -/* $Id: nvprogram.c,v 1.11 2003/04/05 00:38:09 brianp Exp $ */ - /* * Mesa 3-D graphics library * Version: 5.1 @@ -1060,7 +1058,6 @@ _mesa_ProgramNamedParameter4fNV(GLuint id, GLsizei len, const GLubyte *name, fragProg = (struct fragment_program *) prog; for (i = 0; i < fragProg->NumParameters; i++) { - printf("test %d %s\n", i, fragProg->Parameters[i].Name); if (!_mesa_strcmp(fragProg->Parameters[i].Name, (const char *) name)) { ASSERT(!fragProg->Parameters[i].Constant); fragProg->Parameters[i].Values[0] = x; diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index 000a1fd578c..ed3499c8e6c 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -1,4 +1,4 @@ -/* $Id: state.c,v 1.102 2003/03/29 17:01:01 brianp Exp $ */ +/* $Id: state.c,v 1.103 2003/04/08 02:27:16 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -72,6 +72,9 @@ #if FEATURE_NV_vertex_program || FEATURE_NV_fragment_program #include "nvprogram.h" #endif +#if FEATURE_NV_fragment_program +#include "nvfragprog.h" +#endif #include "math/m_matrix.h" #include "math/m_xform.h" @@ -943,9 +946,30 @@ update_texture_state( GLcontext *ctx ) if (ctx->Texture._GenFlags & TEXGEN_NEED_EYE_COORD) { ctx->_NeedEyeCoords |= NEED_EYE_TEXGEN; } + + ctx->Texture._EnabledCoordUnits = ctx->Texture._EnabledUnits; + /* Fragment programs may need texture coordinates but not the + * corresponding texture images. + */ + if (ctx->FragmentProgram.Enabled && ctx->FragmentProgram.Current) { + ctx->Texture._EnabledCoordUnits |= + (ctx->FragmentProgram.Current->InputsRead >> FRAG_ATTRIB_TEX0); + } } +/* + * Update items which depend on vertex/fragment programs. + */ +static void +update_program( GLcontext *ctx ) +{ + if (ctx->FragmentProgram.Enabled && ctx->FragmentProgram.Current) { + if (ctx->FragmentProgram.Current->InputsRead & (1 << FRAG_ATTRIB_COL1)) + ctx->_TriangleCaps |= DD_SEPARATE_SPECULAR; + } +} + /* * If ctx->NewState is non-zero then this function MUST be called before @@ -1015,6 +1039,8 @@ void _mesa_update_state( GLcontext *ctx ) ctx->_NeedEyeCoords |= NEED_EYE_LIGHT_MODELVIEW; } + if (new_state & _NEW_PROGRAM) + update_program( ctx ); #if 0 /* XXX this is a bit of a hack. We should be checking elsewhere if |