Mesa (gallium-mesa-7.4): mesa: fix tnl-> render_inputs_bitset setup for fragment program texcoords

Alan Hourihane alanh at kemper.freedesktop.org
Mon Feb 9 13:47:48 UTC 2009


Module: Mesa
Branch: gallium-mesa-7.4
Commit: e0933185e0935d0547a2251ede40bab920de959e
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=e0933185e0935d0547a2251ede40bab920de959e

Author: Brian Paul <brianp at vmware.com>
Date:   Sat Feb  7 12:03:37 2009 -0700

mesa: fix tnl->render_inputs_bitset setup for fragment program texcoords

Handle the case where there's no per-vertex texcoords but the fragment shader
needs texcoords.

Fixes piglit shaders/fp-generic/dph test.

(cherry picked from master, commit f6d23943cd289ed2b60ec01006fb155f22969749)

---

 src/mesa/tnl/t_context.c |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/src/mesa/tnl/t_context.c b/src/mesa/tnl/t_context.c
index fdf4534..7bfc7b0 100644
--- a/src/mesa/tnl/t_context.c
+++ b/src/mesa/tnl/t_context.c
@@ -112,24 +112,28 @@ _tnl_InvalidateState( GLcontext *ctx, GLuint new_state )
 
    tnl->pipeline.new_state |= new_state;
 
-   /* Calculate tnl->render_inputs:
+   /* Calculate tnl->render_inputs.  This bitmask indicates which vertex
+    * attributes need to be emitted to the rasterizer.
     */
    if (ctx->Visual.rgbMode) {
       GLuint i;
 
       RENDERINPUTS_ZERO( tnl->render_inputs_bitset );
       RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_POS );
+
       if (!fp || (fp->Base.InputsRead & FRAG_BIT_COL0)) {
          RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_COLOR0 );
       }
+
+      if (NEED_SECONDARY_COLOR(ctx))
+         RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_COLOR1 );
+
       for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) {
-         if (ctx->Texture._EnabledCoordUnits & (1 << i)) {
+         if (ctx->Texture._EnabledCoordUnits & (1 << i) ||
+             (fp && fp->Base.InputsRead & FRAG_BIT_TEX(i))) {
             RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_TEX(i) );
          }
       }
-
-      if (NEED_SECONDARY_COLOR(ctx))
-         RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_COLOR1 );
    }
    else {
       RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_POS );




More information about the mesa-commit mailing list