Mesa (master): i965: Fix point coordinate replacement after airlied' s ffvertex changes.

Eric Anholt anholt at kemper.freedesktop.org
Tue May 18 00:47:24 UTC 2010


Module: Mesa
Branch: master
Commit: 64f5e9059b975e34885e63bc404b30b1b2c28de8
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=64f5e9059b975e34885e63bc404b30b1b2c28de8

Author: Eric Anholt <eric at anholt.net>
Date:   Mon May 17 17:07:33 2010 -0700

i965: Fix point coordinate replacement after airlied's ffvertex changes.

This basically restores the previous state, where a vertex result slot
is set up for the texcoord to be replaced with point coord.  Fixes
piglit point-sprite test.

Bug #27625

---

 src/mesa/drivers/dri/i965/brw_sf.c |    1 +
 src/mesa/drivers/dri/i965/brw_vs.c |   23 ++++++++++++++++++++++-
 src/mesa/drivers/dri/i965/brw_vs.h |    2 +-
 3 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_sf.c b/src/mesa/drivers/dri/i965/brw_sf.c
index e05a038..b0dd1ff 100644
--- a/src/mesa/drivers/dri/i965/brw_sf.c
+++ b/src/mesa/drivers/dri/i965/brw_sf.c
@@ -163,6 +163,7 @@ static void upload_sf_prog(struct brw_context *brw)
       break;
    }
 
+   /* _NEW_POINT */
    key.do_point_sprite = ctx->Point.PointSprite;
    if (key.do_point_sprite) {
       int i;
diff --git a/src/mesa/drivers/dri/i965/brw_vs.c b/src/mesa/drivers/dri/i965/brw_vs.c
index 44b085e..57ffb2d 100644
--- a/src/mesa/drivers/dri/i965/brw_vs.c
+++ b/src/mesa/drivers/dri/i965/brw_vs.c
@@ -48,6 +48,7 @@ static void do_vs_prog( struct brw_context *brw,
    const GLuint *program;
    struct brw_vs_compile c;
    int aux_size;
+   int i;
 
    memset(&c, 0, sizeof(c));
    memcpy(&c.key, key, sizeof(*key));
@@ -63,6 +64,17 @@ static void do_vs_prog( struct brw_context *brw,
       c.prog_data.inputs_read |= 1<<VERT_ATTRIB_EDGEFLAG;
    }
 
+   /* Put dummy slots into the VUE for the SF to put the replaced
+    * point sprite coords in.  We shouldn't need these dummy slots,
+    * which take up precious URB space, but it would mean that the SF
+    * doesn't get nice aligned pairs of input coords into output
+    * coords, which would be a pain to handle.
+    */
+   for (i = 0; i < 8; i++) {
+      if (c.key.point_coord_replace & (1 << i))
+	 c.prog_data.outputs_written |= BITFIELD64_BIT(VERT_RESULT_TEX0 + i);
+   }
+
    if (0)
       _mesa_print_program(&c.vp->program.Base);
 
@@ -106,6 +118,7 @@ static void brw_upload_vs_prog(struct brw_context *brw)
    struct brw_vs_prog_key key;
    struct brw_vertex_program *vp = 
       (struct brw_vertex_program *)brw->vertex_program;
+   int i;
 
    memset(&key, 0, sizeof(key));
 
@@ -117,6 +130,14 @@ static void brw_upload_vs_prog(struct brw_context *brw)
    key.copy_edgeflag = (ctx->Polygon.FrontMode != GL_FILL ||
 			ctx->Polygon.BackMode != GL_FILL);
 
+   /* _NEW_POINT */
+   if (ctx->Point.PointSprite) {
+      for (i = 0; i < 8; i++) {
+	 if (ctx->Point.CoordReplace[i])
+	    key.point_coord_replace |= (1 << i);
+      }
+   }
+
    /* Make an early check for the key.
     */
    dri_bo_unreference(brw->vs.prog_bo);
@@ -135,7 +156,7 @@ static void brw_upload_vs_prog(struct brw_context *brw)
  */
 const struct brw_tracked_state brw_vs_prog = {
    .dirty = {
-      .mesa  = _NEW_TRANSFORM | _NEW_POLYGON,
+      .mesa  = _NEW_TRANSFORM | _NEW_POLYGON | _NEW_POINT,
       .brw   = BRW_NEW_VERTEX_PROGRAM,
       .cache = 0
    },
diff --git a/src/mesa/drivers/dri/i965/brw_vs.h b/src/mesa/drivers/dri/i965/brw_vs.h
index 95e0501..6493744 100644
--- a/src/mesa/drivers/dri/i965/brw_vs.h
+++ b/src/mesa/drivers/dri/i965/brw_vs.h
@@ -43,7 +43,7 @@ struct brw_vs_prog_key {
    GLuint program_string_id;
    GLuint nr_userclip:4;
    GLuint copy_edgeflag:1;
-   GLuint pad:26;
+   GLuint point_coord_replace:8;
 };
 
 




More information about the mesa-commit mailing list