|
View:
New views
1 Messages
—
Rating Filter:
Alert me
|
|
|
[patch] TexGen / fragment program interaction bug?Hi there,
it seems to me that (software rendering) Mesa has an incorrect interaction between TexGen enables and fragment programs. The way I understand the specifications, TexGen acts on texture *coordinate* sets, independently of whether or not the currently enabled fragment program reads the texture *image* of the same unit. For example, if a fragment program only contains the single instruction MOV result.color, fragment.texcoord[0]; and texture coordinate generation is enabled for the first texture unit, then TexGen should have an effect on the resulting image, even though the fragment program doesn't actually use the texture image of this unit. I've just added a test to Piglit (general/texgen) that tests for this, among other things, and I've attached a patch for Mesa to fix this problem. Am I reading the specifications correctly, and if so, is there a better way to fix the issue? cu, Nicolai [0001-Enable-TexGen-based-on-InputsRead-when-a-fragment-pr.patch] From 236a9e50f16b0702c9497d4e0aa1af8587b0aeb5 Mon Sep 17 00:00:00 2001 From: Nicolai Haehnle <nhaehnle@...> Date: Sun, 29 Jun 2008 14:53:04 +0200 Subject: [PATCH] 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. --- 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 626c264..a6c92cb 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; - } } -- 1.5.4.3 ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ Mesa3d-dev mailing list Mesa3d-dev@... https://lists.sourceforge.net/lists/listinfo/mesa3d-dev |
| Free Forum Powered by Nabble | Forum Help |