summaryrefslogtreecommitdiff
path: root/src/mesa/tnl/t_context.c
diff options
context:
space:
mode:
authorMichal Krol <mjkrol@gmail.org>2006-04-11 11:41:11 +0000
committerMichal Krol <mjkrol@gmail.org>2006-04-11 11:41:11 +0000
commitbb38cadb1c5f2dc13096a091bdaf61dc3e3cfa4d (patch)
tree8474881f1f529e1217d3442a98defb1a667b8403 /src/mesa/tnl/t_context.c
parentd90ad3fd876860b7a2ba763c031e46f76e4c47c6 (diff)
More GLSL code:
- use macros to access and modify render inputs bit-field; - un-alias generic vertex attributes for ARB vertex calls; - use MAX_VERTEX_PROGRAM_ATTRIBS (NV code) or MAX_VERTEX_ATTRIBS (ARB code) in place of VERT_ATTRIB_MAX; - define VERT_ATTRIB_GENERIC0..15 for un-aliased vertex attributes for ARB_vertex_shader; - fix generic attribute index range check in arbprogparse.c; - interface GLSL varyings between vertex and fragment shader; - use 64-bit optimised bitset (bitset.h) for render inputs;
Diffstat (limited to 'src/mesa/tnl/t_context.c')
-rw-r--r--src/mesa/tnl/t_context.c35
1 files changed, 23 insertions, 12 deletions
diff --git a/src/mesa/tnl/t_context.c b/src/mesa/tnl/t_context.c
index d9777bfe6d..ad972fa7b7 100644
--- a/src/mesa/tnl/t_context.c
+++ b/src/mesa/tnl/t_context.c
@@ -2,7 +2,7 @@
* Mesa 3-D graphics library
* Version: 6.5
*
- * Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2006 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"),
@@ -170,32 +170,43 @@ _tnl_InvalidateState( GLcontext *ctx, GLuint new_state )
/* Calculate tnl->render_inputs:
*/
if (ctx->Visual.rgbMode) {
- tnl->render_inputs = (_TNL_BIT_POS|
- _TNL_BIT_COLOR0|
- (ctx->Texture._EnabledCoordUnits << _TNL_ATTRIB_TEX0));
+ GLuint i;
+
+ RENDERINPUTS_ZERO( tnl->render_inputs_bitset );
+ RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_POS );
+ RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_COLOR0 );
+ for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) {
+ if (ctx->Texture._EnabledCoordUnits & (1 << i)) {
+ RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_TEX(i) );
+ }
+ }
if (NEED_SECONDARY_COLOR(ctx))
- tnl->render_inputs |= _TNL_BIT_COLOR1;
+ RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_COLOR1 );
}
else {
- tnl->render_inputs |= (_TNL_BIT_POS|_TNL_BIT_INDEX);
+ RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_POS );
+ RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_INDEX );
}
-
+
if (ctx->Fog.Enabled ||
(ctx->FragmentProgram._Active &&
- ctx->FragmentProgram._Current->FogOption != GL_NONE))
- tnl->render_inputs |= _TNL_BIT_FOG;
+ ctx->FragmentProgram._Current->FogOption != GL_NONE))
+ RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_FOG );
if (ctx->Polygon.FrontMode != GL_FILL ||
ctx->Polygon.BackMode != GL_FILL)
- tnl->render_inputs |= _TNL_BIT_EDGEFLAG;
+ RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_EDGEFLAG );
if (ctx->RenderMode == GL_FEEDBACK)
- tnl->render_inputs |= _TNL_BIT_TEX0;
+ RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_TEX0 );
if (ctx->Point._Attenuated ||
(ctx->VertexProgram._Enabled && ctx->VertexProgram.PointSizeEnabled))
- tnl->render_inputs |= _TNL_BIT_POINTSIZE;
+ RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_POINTSIZE );
+
+ if (ctx->ShaderObjects._VertexShaderPresent || ctx->ShaderObjects._FragmentShaderPresent)
+ RENDERINPUTS_SET_RANGE( tnl->render_inputs_bitset, _TNL_FIRST_ATTRIBUTE, _TNL_LAST_ATTRIBUTE );
}