Mesa (master): nvfx: remove gl_PointCoord hack

Luca Barbieri lb at kemper.freedesktop.org
Wed Sep 22 08:03:22 UTC 2010


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

Author: Luca Barbieri <luca at luca-barbieri.com>
Date:   Wed Sep 22 07:17:38 2010 +0200

nvfx: remove gl_PointCoord hack

Now Gallium has the proper fix, thanks to Brian Paul.

---

 src/gallium/drivers/nvfx/nvfx_fragprog.c |   13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/src/gallium/drivers/nvfx/nvfx_fragprog.c b/src/gallium/drivers/nvfx/nvfx_fragprog.c
index d97cab8..23fdb08 100644
--- a/src/gallium/drivers/nvfx/nvfx_fragprog.c
+++ b/src/gallium/drivers/nvfx/nvfx_fragprog.c
@@ -1235,10 +1235,9 @@ nvfx_fragprog_validate(struct nvfx_context *nvfx)
 	struct nouveau_channel* chan = nvfx->screen->base.channel;
 	struct nvfx_pipe_fragment_program *pfp = nvfx->fragprog;
 	struct nvfx_vertex_program* vp;
-	/* Gallium always puts the point coord in GENERIC[0]
-	 * TODO: this is wrong, Gallium needs to be fixed
-	 */
-	unsigned sprite_coord_enable = nvfx->rasterizer->pipe.point_quad_rasterization * (nvfx->rasterizer->pipe.sprite_coord_enable | 1);
+
+	// TODO: the multiplication by point_quad_rasterization is probably superfluous
+	unsigned sprite_coord_enable = nvfx->rasterizer->pipe.point_quad_rasterization * nvfx->rasterizer->pipe.sprite_coord_enable;
 
 	boolean emulate_sprite_flipping = sprite_coord_enable && nvfx->rasterizer->pipe.sprite_coord_mode;
 	unsigned key = emulate_sprite_flipping;
@@ -1297,7 +1296,7 @@ nvfx_fragprog_validate(struct nvfx_context *nvfx)
 				unsigned used_texcoords = 0;
 				for(unsigned i = 0; i < fp->num_slots; ++i) {
 					unsigned generic = fp->slot_to_generic[i];
-					if(!((1 << generic) & sprite_coord_enable))
+					if((generic < 32) && !((1 << generic) & sprite_coord_enable))
 					{
 						unsigned char slot_mask = vp->generic_to_fp_input[generic];
 						if(slot_mask >= 0xf0)
@@ -1320,7 +1319,7 @@ nvfx_fragprog_validate(struct nvfx_context *nvfx)
 
 		for(i = 0; i < fp->num_slots; ++i) {
 			unsigned generic = fp->slot_to_generic[i];
-			if((1 << generic) & sprite_coord_enable)
+			if((generic < 32) && ((1 << generic) & sprite_coord_enable))
 			{
 				if(fp->slot_to_fp_input[i] != sprite_reloc_input)
 					goto update_slots;
@@ -1346,7 +1345,7 @@ update_slots:
 			for(; i < fp->num_slots; ++i)
 			{
 				unsigned generic = fp->slot_to_generic[i];
-				if((1 << generic) & sprite_coord_enable)
+				if((generic < 32) && ((1 << generic) & sprite_coord_enable))
 					fp->slot_to_fp_input[i] = sprite_reloc_input;
 				else
 					fp->slot_to_fp_input[i] = vp->generic_to_fp_input[generic] & 0xf;




More information about the mesa-commit mailing list