summaryrefslogtreecommitdiff
path: root/src/mesa/swrast/s_context.c
diff options
context:
space:
mode:
authorBrian <brian@nostromo.localnet.net>2007-04-23 21:21:52 -0600
committerBrian <brian@nostromo.localnet.net>2007-04-23 21:21:52 -0600
commit0bdf216dd06d5136b8529297297aa962bab548c2 (patch)
treebb7c516d3d6f2e818f2cbb0f8865a45fecf053c6 /src/mesa/swrast/s_context.c
parentd59e6f233b02ffe2c36c2fb89ec26c208a421540 (diff)
Improve the code for interpolating fragment attributes a little. More to come...
Diffstat (limited to 'src/mesa/swrast/s_context.c')
-rw-r--r--src/mesa/swrast/s_context.c30
1 files changed, 14 insertions, 16 deletions
diff --git a/src/mesa/swrast/s_context.c b/src/mesa/swrast/s_context.c
index 55b835bf85..d4782aacb9 100644
--- a/src/mesa/swrast/s_context.c
+++ b/src/mesa/swrast/s_context.c
@@ -505,45 +505,43 @@ _swrast_update_texture_samplers(GLcontext *ctx)
/**
- * Update the swrast->_FragmentAttribs field.
+ * Update swrast->_ActiveAttribs and swrast->_NumActiveAttribs
*/
static void
_swrast_update_fragment_attribs(GLcontext *ctx)
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
+ GLuint attribsMask;
if (ctx->FragmentProgram._Current) {
- swrast->_FragmentAttribs
- = ctx->FragmentProgram._Current->Base.InputsRead;
+ attribsMask = ctx->FragmentProgram._Current->Base.InputsRead;
}
else {
GLuint u;
- swrast->_FragmentAttribs = 0x0;
+ attribsMask = 0x0;
if (ctx->Depth.Test)
- swrast->_FragmentAttribs |= FRAG_BIT_WPOS;
+ attribsMask |= FRAG_BIT_WPOS;
if (NEED_SECONDARY_COLOR(ctx))
- swrast->_FragmentAttribs |= FRAG_BIT_COL1;
+ attribsMask |= FRAG_BIT_COL1;
if (swrast->_FogEnabled)
- swrast->_FragmentAttribs |= FRAG_BIT_FOGC;
+ attribsMask |= FRAG_BIT_FOGC;
for (u = 0; u < ctx->Const.MaxTextureUnits; u++) {
if (ctx->Texture.Unit[u]._ReallyEnabled) {
- swrast->_FragmentAttribs |= FRAG_BIT_TEX(u);
+ attribsMask |= FRAG_BIT_TEX(u);
}
}
}
- /* Find lowest, highest bit set in _FragmentAttribs */
+ /* Update _ActiveAttribs[] list */
{
- GLuint bits = swrast->_FragmentAttribs;
- GLuint i = 0;;
- while (bits) {
- i++;
- bits = bits >> 1;
+ GLuint i, num = 0;
+ for (i = 0; i < FRAG_ATTRIB_MAX; i++) {
+ if (attribsMask & (1 << i))
+ swrast->_ActiveAttribs[num++] = i;
}
- swrast->_MaxFragmentAttrib = i;
- swrast->_MinFragmentAttrib = FRAG_ATTRIB_TEX0; /* XXX temporary */
+ swrast->_NumActiveAttribs = num;
}
}