ffvertex: don't touch tex coords if coord replace is enabled.
authorDave Airlie <airlied@redhat.com>
Mon, 12 Apr 2010 05:40:29 +0000 (15:40 +1000)
committerDave Airlie <airlied@redhat.com>
Mon, 12 Apr 2010 23:19:39 +0000 (09:19 +1000)
The fixed function vertex program shouldn't need to deal or touch tex coords
if stuffing is enabled.

Though I'm not 100% this won't break assumption made elsewhere it seems like
the correct thing to do, and makes r300g point sprites a lot easier to implement.

draw: fix point-sprite when vertex program is used.

This commit regressed draw, so fix it as well to help bisection.

Signed-off-by: Dave Airlie <airlied@redhat.com>
src/gallium/auxiliary/draw/draw_pipe_wide_point.c
src/mesa/main/ffvertex_prog.c

index fdabce7d443d11a57347f4778ecc4e10f7614c6a..6864b4015b38f28128ae9f8e7f4acb5faad0b815 100644 (file)
@@ -113,7 +113,10 @@ static void set_texcoords(const struct widepoint_stage *wide,
       /* put gl_PointCoord into the extra vertex slot */
       uint slot = wide->stage.draw->extra_shader_outputs.slot;
       v->data[slot][0] = tc[0];
-      v->data[slot][1] = tc[1];
+      if (wide->texcoord_mode == PIPE_SPRITE_COORD_LOWER_LEFT)
+         v->data[slot][1] = 1.0f - tc[1];
+      else
+         v->data[slot][1] = tc[1];
       v->data[slot][2] = 0.0F;
       v->data[slot][3] = 1.0F;
    }
index ba94a38770bebdbd1a82909e936ba238753d161a..70ac47f36d77fd7135593b501991604a7478c6a4 100644 (file)
@@ -75,6 +75,7 @@ struct state_key {
       unsigned light_attenuated:1;
       unsigned texunit_really_enabled:1;
       unsigned texmat_enabled:1;
+      unsigned coord_replace:1;
       unsigned texgen_enabled:4;
       unsigned texgen_mode0:4;
       unsigned texgen_mode1:4;
@@ -225,6 +226,10 @@ static void make_state_key( GLcontext *ctx, struct state_key *key )
       if (texUnit->_ReallyEnabled)
         key->unit[i].texunit_really_enabled = 1;
 
+      if (ctx->Point.PointSprite)
+        if (ctx->Point.CoordReplace[i])
+           key->unit[i].coord_replace = 1;
+
       if (ctx->Texture._TexMatEnabled & ENABLE_TEXMAT(i))
         key->unit[i].texmat_enabled = 1;
 
@@ -1385,6 +1390,9 @@ static void build_texture_transform( struct tnl_program *p )
       if (!(p->state->fragprog_inputs_read & FRAG_BIT_TEX(i)))
         continue;
 
+      if (p->state->unit[i].coord_replace)
+        continue;
+
       if (p->state->unit[i].texgen_enabled ||
          p->state->unit[i].texmat_enabled) {