So I've been trying to make r300g do point sprites for a few days now,
and I've pulled out quite a lot of hair blaming pieces of hardware
along with random r300g states.

I finally noticed I was getting vertex emits for texcoords, which I
really shouldn't have, and the radeon hw once the VP gets asked to
emit something to the rasteriser, its overwrites the stuffing values,
so nothing ever gets stuffed which is quite annoying.

So I tracked back why the vertex shader was touching texcoords as
there was no reason for it to in the point sprite case, and this patch
is the result.

It seems like the correct thing to do but comment as to what it might
violate are welcome.

Thanks,
Dave.
From 7422f33c41c94848663b520023b768509c0ddde7 Mon Sep 17 00:00:00 2001
From: Dave Airlie <[email protected]>
Date: Mon, 12 Apr 2010 15:40:29 +1000
Subject: [PATCH] ffvertex: don't touch tex coords if coord replace is enabled.

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.

Signed-off-by: Dave Airlie <[email protected]>
---
 src/mesa/main/ffvertex_prog.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/src/mesa/main/ffvertex_prog.c b/src/mesa/main/ffvertex_prog.c
index ba94a38..70ac47f 100644
--- a/src/mesa/main/ffvertex_prog.c
+++ b/src/mesa/main/ffvertex_prog.c
@@ -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) {
 
-- 
1.7.0.1

_______________________________________________
mesa-dev mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to