diff options
author | Nicolai Haehnle <[email protected]> | 2008-06-29 14:53:04 +0200 |
---|---|---|
committer | Nicolai Haehnle <[email protected]> | 2008-07-04 18:22:15 +0200 |
commit | 845e3f701dec29f08e5759969c165b3d812e5afe (patch) | |
tree | d0c5d1c2b69aec27464fc65b55d3ef74f59bacf5 | |
parent | 1f4d0748ba92ff2c44faadc31a99f07e1bea28fb (diff) |
Enable TexGen based on InputsRead when a fragment program is active
The old behaviour depended on which texture images the fragment program
reads from, which seems to contradict the shader specifications.
Note: Piglit's general/texgen test checks for this problem.
-rw-r--r-- | src/mesa/main/texstate.c | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c index 626c2648631..a6c92cb1af4 100644 --- a/src/mesa/main/texstate.c +++ b/src/mesa/main/texstate.c @@ -2999,6 +2999,24 @@ update_texture_state( GLcontext *ctx ) _mesa_problem(ctx, "invalid Alpha combine mode in update_texture_state"); break; } + } + + /* Determine which texture coordinate sets are actually needed */ + if (fprog) { + const GLuint coordMask = (1 << MAX_TEXTURE_COORD_UNITS) - 1; + ctx->Texture._EnabledCoordUnits + = (fprog->Base.InputsRead >> FRAG_ATTRIB_TEX0) & coordMask; + } + else { + ctx->Texture._EnabledCoordUnits = ctx->Texture._EnabledUnits; + } + + /* Setup texgen for those texture coordinate sets that are in use */ + for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) { + struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; + + if (!(ctx->Texture._EnabledCoordUnits & (1 << unit))) + continue; if (texUnit->TexGenEnabled) { if (texUnit->TexGenEnabled & S_BIT) { @@ -3021,16 +3039,6 @@ update_texture_state( GLcontext *ctx ) if (ctx->TextureMatrixStack[unit].Top->type != MATRIX_IDENTITY) ctx->Texture._TexMatEnabled |= ENABLE_TEXMAT(unit); } - - /* Determine which texture coordinate sets are actually needed */ - if (fprog) { - const GLuint coordMask = (1 << MAX_TEXTURE_COORD_UNITS) - 1; - ctx->Texture._EnabledCoordUnits - = (fprog->Base.InputsRead >> FRAG_ATTRIB_TEX0) & coordMask; - } - else { - ctx->Texture._EnabledCoordUnits = ctx->Texture._EnabledUnits; - } } |