diff options
Diffstat (limited to 'src/mesa/main')
-rw-r--r-- | src/mesa/main/enable.c | 4 | ||||
-rw-r--r-- | src/mesa/main/nvfragparse.c | 16 | ||||
-rw-r--r-- | src/mesa/main/nvfragprog.h | 17 | ||||
-rw-r--r-- | src/mesa/main/state.c | 27 |
4 files changed, 37 insertions, 27 deletions
diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c index eb46976abb0..9192abd4aca 100644 --- a/src/mesa/main/enable.c +++ b/src/mesa/main/enable.c @@ -1,4 +1,4 @@ -/* $Id: enable.c,v 1.75 2003/03/01 01:50:20 brianp Exp $ */ +/* $Id: enable.c,v 1.76 2003/03/15 17:33:25 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -884,7 +884,7 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) CHECK_EXTENSION(NV_fragment_program, cap); if (ctx->FragmentProgram.Enabled == state) return; - FLUSH_VERTICES(ctx, _NEW_PROGRAM); + FLUSH_VERTICES(ctx, _NEW_PROGRAM | _NEW_TEXTURE); ctx->FragmentProgram.Enabled = state; break; #endif /* FEATURE_NV_fragment_program */ diff --git a/src/mesa/main/nvfragparse.c b/src/mesa/main/nvfragparse.c index 60b15bcd06e..0f75d6c36f6 100644 --- a/src/mesa/main/nvfragparse.c +++ b/src/mesa/main/nvfragparse.c @@ -1,4 +1,4 @@ -/* $Id: nvfragparse.c,v 1.13 2003/03/14 15:40:59 brianp Exp $ */ +/* $Id: nvfragparse.c,v 1.14 2003/03/15 17:33:26 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -42,20 +42,6 @@ #include "nvprogram.h" -#define FRAG_ATTRIB_WPOS 0 -#define FRAG_ATTRIB_COL0 1 -#define FRAG_ATTRIB_COL1 2 -#define FRAG_ATTRIB_FOGC 3 -#define FRAG_ATTRIB_TEX0 4 -#define FRAG_ATTRIB_TEX1 5 -#define FRAG_ATTRIB_TEX2 6 -#define FRAG_ATTRIB_TEX3 7 -#define FRAG_ATTRIB_TEX4 8 -#define FRAG_ATTRIB_TEX5 9 -#define FRAG_ATTRIB_TEX6 10 -#define FRAG_ATTRIB_TEX7 11 - - #define INPUT_1V 1 #define INPUT_2V 2 #define INPUT_3V 3 diff --git a/src/mesa/main/nvfragprog.h b/src/mesa/main/nvfragprog.h index d7e23627a42..8d1ed13f217 100644 --- a/src/mesa/main/nvfragprog.h +++ b/src/mesa/main/nvfragprog.h @@ -1,4 +1,4 @@ -/* $Id: nvfragprog.h,v 1.4 2003/03/14 15:40:59 brianp Exp $ */ +/* $Id: nvfragprog.h,v 1.5 2003/03/15 17:33:26 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -36,6 +36,21 @@ #include "config.h" +/* Fragment input registers / attributes */ +#define FRAG_ATTRIB_WPOS 0 +#define FRAG_ATTRIB_COL0 1 +#define FRAG_ATTRIB_COL1 2 +#define FRAG_ATTRIB_FOGC 3 +#define FRAG_ATTRIB_TEX0 4 +#define FRAG_ATTRIB_TEX1 5 +#define FRAG_ATTRIB_TEX2 6 +#define FRAG_ATTRIB_TEX3 7 +#define FRAG_ATTRIB_TEX4 8 +#define FRAG_ATTRIB_TEX5 9 +#define FRAG_ATTRIB_TEX6 10 +#define FRAG_ATTRIB_TEX7 11 + + /* Location of register sets within the whole register file */ #define FP_INPUT_REG_START 0 #define FP_INPUT_REG_END (FP_INPUT_REG_START + MAX_NV_FRAGMENT_PROGRAM_INPUTS - 1) diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index 1051bda11da..f4f6a1cb6ef 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -1,4 +1,4 @@ -/* $Id: state.c,v 1.99 2003/03/01 01:50:22 brianp Exp $ */ +/* $Id: state.c,v 1.100 2003/03/15 17:33:26 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -813,17 +813,26 @@ update_texture_state( GLcontext *ctx ) */ for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) { struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; + GLuint enableBits; texUnit->_ReallyEnabled = 0; texUnit->_GenFlags = 0; - if (!texUnit->Enabled) - continue; + /* Get the bitmask of texture enables */ + if (ctx->FragmentProgram.Enabled && ctx->FragmentProgram.Current) { + enableBits = ctx->FragmentProgram.Current->TexturesUsed[unit]; + } + else { + if (!texUnit->Enabled) + continue; + enableBits = texUnit->Enabled; + } /* Look for the highest-priority texture target that's enabled and - * complete. That's the one we'll use for texturing. + * complete. That's the one we'll use for texturing. If we're using + * a fragment program we're guaranteed that bitcount(enabledBits) <= 1. */ - if (texUnit->Enabled & TEXTURE_CUBE_BIT) { + if (enableBits & TEXTURE_CUBE_BIT) { struct gl_texture_object *texObj = texUnit->CurrentCubeMap; if (!texObj->Complete) { _mesa_test_texobj_completeness(ctx, texObj); @@ -834,7 +843,7 @@ update_texture_state( GLcontext *ctx ) } } - if (!texUnit->_ReallyEnabled && (texUnit->Enabled & TEXTURE_3D_BIT)) { + if (!texUnit->_ReallyEnabled && (enableBits & TEXTURE_3D_BIT)) { struct gl_texture_object *texObj = texUnit->Current3D; if (!texObj->Complete) { _mesa_test_texobj_completeness(ctx, texObj); @@ -845,7 +854,7 @@ update_texture_state( GLcontext *ctx ) } } - if (!texUnit->_ReallyEnabled && (texUnit->Enabled & TEXTURE_RECT_BIT)) { + if (!texUnit->_ReallyEnabled && (enableBits & TEXTURE_RECT_BIT)) { struct gl_texture_object *texObj = texUnit->CurrentRect; if (!texObj->Complete) { _mesa_test_texobj_completeness(ctx, texObj); @@ -856,7 +865,7 @@ update_texture_state( GLcontext *ctx ) } } - if (!texUnit->_ReallyEnabled && (texUnit->Enabled & TEXTURE_2D_BIT)) { + if (!texUnit->_ReallyEnabled && (enableBits & TEXTURE_2D_BIT)) { struct gl_texture_object *texObj = texUnit->Current2D; if (!texObj->Complete) { _mesa_test_texobj_completeness(ctx, texObj); @@ -867,7 +876,7 @@ update_texture_state( GLcontext *ctx ) } } - if (!texUnit->_ReallyEnabled && (texUnit->Enabled & TEXTURE_1D_BIT)) { + if (!texUnit->_ReallyEnabled && (enableBits & TEXTURE_1D_BIT)) { struct gl_texture_object *texObj = texUnit->Current1D; if (!texObj->Complete) { _mesa_test_texobj_completeness(ctx, texObj); |