mesa: Branch 'glsl-compiler-1' - 2 commits

Brian Paul brianp at kemper.freedesktop.org
Fri Dec 22 00:50:37 UTC 2006


 src/mesa/swrast/s_linetemp.h       |   29 +++++++++++++++++++++++++++++
 src/mesa/swrast/s_tritemp.h        |    9 +++++----
 src/mesa/swrast/swrast.h           |    2 +-
 src/mesa/swrast_setup/ss_context.c |    2 +-
 4 files changed, 36 insertions(+), 6 deletions(-)

New commits:
diff-tree 392d9701e30f4c7b4cbd25cb8714a42ba2512bd4 (from eb2a6d62f9353d90be757fc1617040c7ccddac39)
Author: Brian <brian at nostromo.localnet.net>
Date:   Thu Dec 21 17:50:22 2006 -0700

    added INTERP_VARYING code

diff --git a/src/mesa/swrast/s_linetemp.h b/src/mesa/swrast/s_linetemp.h
index f5b2d95..61c338a 100644
--- a/src/mesa/swrast/s_linetemp.h
+++ b/src/mesa/swrast/s_linetemp.h
@@ -37,6 +37,7 @@
  *    INTERP_INDEX    - if defined, interpolate color index values
  *    INTERP_TEX      - if defined, interpolate unit 0 texcoords
  *    INTERP_MULTITEX - if defined, interpolate multi-texcoords
+ *    INTERP_VARYING  - if defined, interpolate GLSL varyings
  *
  * When one can directly address pixels in the color buffer the following
  * macros can be defined and used to directly compute pixel addresses during
@@ -333,6 +334,34 @@ NAME( GLcontext *ctx, const SWvertex *ve
       }
    }
 #endif
+#ifdef INTERP_VARYING
+   interpFlags |= SPAN_VARYING;
+   { /* XXX review this */
+      const GLfloat invLen = 1.0F / numPixels;
+      GLuint v;
+      for (v = 0; v < MAX_VARYING; v++) {
+         const GLfloat invw0 = vert0->win[3];
+         const GLfloat invw1 = vert1->win[3];
+         GLfloat ds, dt, dr, dq;
+         span.var[v][0] = invw0 * vert0->varying[v][0];
+         span.var[v][1] = invw0 * vert0->varying[v][1];
+         span.var[v][2] = invw0 * vert0->varying[v][2];
+         span.var[v][3] = invw0 * vert0->varying[v][3];
+         ds = (invw1 * vert1->varying[v][0]) - span.var[v][0];
+         dt = (invw1 * vert1->varying[v][1]) - span.var[v][1];
+         dr = (invw1 * vert1->varying[v][2]) - span.var[v][2];
+         dq = (invw1 * vert1->varying[v][3]) - span.var[v][3];
+         span.varStepX[v][0] = ds * invLen;
+         span.varStepX[v][1] = dt * invLen;
+         span.varStepX[v][2] = dr * invLen;
+         span.varStepX[v][3] = dq * invLen;
+         span.varStepY[v][0] = 0.0F;
+         span.varStepY[v][1] = 0.0F;
+         span.varStepY[v][2] = 0.0F;
+         span.varStepY[v][3] = 0.0F;
+      }
+   }
+#endif
 
    INIT_SPAN(span, GL_LINE, numPixels, interpFlags, SPAN_XY);
 
diff-tree eb2a6d62f9353d90be757fc1617040c7ccddac39 (from 2905385744a385bc8bc6cbd2d749673c93380462)
Author: Brian <brian at nostromo.localnet.net>
Date:   Thu Dec 21 17:50:07 2006 -0700

    s/attribute/varying/

diff --git a/src/mesa/swrast/s_tritemp.h b/src/mesa/swrast/s_tritemp.h
index 0ed1772..c85379b 100644
--- a/src/mesa/swrast/s_tritemp.h
+++ b/src/mesa/swrast/s_tritemp.h
@@ -41,7 +41,7 @@
  *    INTERP_TEX      - if defined, interpolate set 0 float STRQ texcoords
  *                         NOTE:  OpenGL STRQ = Mesa STUV (R was taken for red)
  *    INTERP_MULTITEX - if defined, interpolate N units of STRQ texcoords
- *    INTERP_VARYING  - if defined, interpolate M floats of GLSL varyings
+ *    INTERP_VARYING  - if defined, interpolate M GLSL varyings
  *
  * When one can directly address pixels in the color buffer the following
  * macros can be defined and used to compute pixel addresses during
@@ -144,6 +144,7 @@
 
 
 #ifdef INTERP_VARYING
+/* XXX need a varyingEnabled[] check */
 #define VARYING_LOOP(CODE)                     \
    {                                           \
       GLuint iv, ic;                           \
@@ -669,8 +670,8 @@ static void NAME(GLcontext *ctx, const S
          /* win[3] is 1/W */
          const GLfloat wMax = vMax->win[3], wMin = vMin->win[3], wMid = vMid->win[3];
          VARYING_LOOP(
-            GLfloat eMaj_dvar = vMax->attribute[iv][ic] * wMax - vMin->attribute[iv][ic] * wMin;
-            GLfloat eBot_dvar = vMid->attribute[iv][ic] * wMid - vMin->attribute[iv][ic] * wMin;
+            GLfloat eMaj_dvar = vMax->varying[iv][ic] * wMax - vMin->varying[iv][ic] * wMin;
+            GLfloat eBot_dvar = vMid->varying[iv][ic] * wMid - vMin->varying[iv][ic] * wMin;
             span.varStepX[iv][ic] = oneOverArea * (eMaj_dvar * eBot.dy - eMaj.dy * eBot_dvar);
             span.varStepY[iv][ic] = oneOverArea * (eMaj.dx * eBot_dvar - eMaj_dvar * eBot.dx);
          )
@@ -1060,7 +1061,7 @@ static void NAME(GLcontext *ctx, const S
 #ifdef INTERP_VARYING
                VARYING_LOOP(
                   const GLfloat invW = vLower->win[3];
-                  const GLfloat var0 = vLower->attribute[iv][ic] * invW;
+                  const GLfloat var0 = vLower->varying[iv][ic] * invW;
                   varLeft[iv][ic] = var0 + (span.varStepX[iv][ic] * adjx +
                      span.varStepY[iv][ic] * adjy) * (1.0f / FIXED_SCALE);
                   dvarOuter[iv][ic] = span.varStepY[iv][ic] + dxOuter * span.varStepX[iv][ic];
diff --git a/src/mesa/swrast/swrast.h b/src/mesa/swrast/swrast.h
index 09686c8..2c1c095 100644
--- a/src/mesa/swrast/swrast.h
+++ b/src/mesa/swrast/swrast.h
@@ -73,7 +73,7 @@ typedef struct {
    GLfloat fog;
    GLfloat index;
    GLfloat pointSize;
-   GLfloat attribute[MAX_VERTEX_ATTRIBS][4];
+   GLfloat varying[MAX_VERTEX_ATTRIBS][4];
 } SWvertex;
 
 
diff --git a/src/mesa/swrast_setup/ss_context.c b/src/mesa/swrast_setup/ss_context.c
index 924b423..f17e69b 100644
--- a/src/mesa/swrast_setup/ss_context.c
+++ b/src/mesa/swrast_setup/ss_context.c
@@ -156,7 +156,7 @@ _swsetup_RenderStart( GLcontext *ctx )
          for (i = 0; i < ctx->Const.MaxVarying; i++) {
             if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_GENERIC(i) )) {
                EMIT_ATTR( _TNL_ATTRIB_GENERIC(i), VARYING_EMIT_STYLE,
-                          attribute[i] );
+                          varying[i] );
             }
          }
       }



More information about the mesa-commit mailing list