Mesa (master): nv40: support all 10 texcoords

Luca Barbieri lb at kemper.freedesktop.org
Sat Sep 4 02:06:27 UTC 2010


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

Author: Luca Barbieri <luca at luca-barbieri.com>
Date:   Sat Sep  4 03:35:22 2010 +0200

nv40: support all 10 texcoords

---

 src/gallium/drivers/nvfx/nvfx_fragprog.c |    7 ++++---
 src/gallium/drivers/nvfx/nvfx_screen.c   |    4 ++--
 src/gallium/drivers/nvfx/nvfx_vertprog.c |   20 +++++++++++++-------
 3 files changed, 19 insertions(+), 12 deletions(-)

diff --git a/src/gallium/drivers/nvfx/nvfx_fragprog.c b/src/gallium/drivers/nvfx/nvfx_fragprog.c
index 79dd224..159db99 100644
--- a/src/gallium/drivers/nvfx/nvfx_fragprog.c
+++ b/src/gallium/drivers/nvfx/nvfx_fragprog.c
@@ -948,12 +948,13 @@ nvfx_fragprog_prepare(struct nvfx_context* nvfx, struct nvfx_fpc *fpc)
 	struct util_semantic_set set;
 	float const0v[4] = {0, 0, 0, 0};
 	struct nvfx_reg const0;
+	unsigned num_texcoords = nvfx->is_nv4x ? 10 : 8;
 
 	fpc->fp->num_slots = util_semantic_set_from_program_file(&set, fpc->pfp->pipe.tokens, TGSI_FILE_INPUT);
-	if(fpc->fp->num_slots > 8)
+	if(fpc->fp->num_slots > num_texcoords)
 		return FALSE;
-	util_semantic_layout_from_set(fpc->fp->slot_to_generic, &set, 0, 8);
-	util_semantic_table_from_layout(fpc->generic_to_slot, fpc->fp->slot_to_generic, 0, 8);
+	util_semantic_layout_from_set(fpc->fp->slot_to_generic, &set, 0, num_texcoords);
+	util_semantic_table_from_layout(fpc->generic_to_slot, fpc->fp->slot_to_generic, 0, num_texcoords);
 
 	memset(fpc->fp->slot_to_fp_input, 0xff, sizeof(fpc->fp->slot_to_fp_input));
 
diff --git a/src/gallium/drivers/nvfx/nvfx_screen.c b/src/gallium/drivers/nvfx/nvfx_screen.c
index 6412ca9..9e7266b 100644
--- a/src/gallium/drivers/nvfx/nvfx_screen.c
+++ b/src/gallium/drivers/nvfx/nvfx_screen.c
@@ -87,7 +87,7 @@ nvfx_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
 		   value (nv30:0/nv40:4) ? */
 		return screen->is_nv4x ? 4 : 0;
 	case PIPE_CAP_MAX_FS_INPUTS:
-		return 10;
+		return screen->is_nv4x ? 12 : 10;
 	case PIPE_CAP_MAX_FS_CONSTS:
 		return screen->is_nv4x ? 224 : 32;
 	case PIPE_CAP_MAX_FS_TEMPS:
@@ -319,7 +319,7 @@ static void nv40_screen_init(struct nvfx_screen *screen)
 	OUT_RING(chan, 0x06144321);
 	OUT_RING(chan, RING_3D(0x1fc8, 2));
 	OUT_RING(chan, 0xedcba987);
-	OUT_RING(chan, 0x00000021);
+	OUT_RING(chan, 0x0000006f);
 	OUT_RING(chan, RING_3D(0x1fd0, 1));
 	OUT_RING(chan, 0x00171615);
 	OUT_RING(chan, RING_3D(0x1fd4, 1));
diff --git a/src/gallium/drivers/nvfx/nvfx_vertprog.c b/src/gallium/drivers/nvfx/nvfx_vertprog.c
index 838c3aa..d761d5b 100644
--- a/src/gallium/drivers/nvfx/nvfx_vertprog.c
+++ b/src/gallium/drivers/nvfx/nvfx_vertprog.c
@@ -782,8 +782,13 @@ nvfx_vertprog_parse_decl_output(struct nvfx_context* nvfx, struct nvfx_vpc *vpc,
 		hw = NVFX_VP(INST_DEST_PSZ);
 		break;
 	case TGSI_SEMANTIC_GENERIC:
-		hw = (vpc->vp->generic_to_fp_input[fdec->Semantic.Index] & 0xf)
-			+ NVFX_VP(INST_DEST_TC(0)) - NVFX_FP_OP_INPUT_SRC_TC(0);
+		hw = (vpc->vp->generic_to_fp_input[fdec->Semantic.Index] & 0xf) - NVFX_FP_OP_INPUT_SRC_TC(0);
+		if(hw <= 8)
+			hw = NVFX_VP(INST_DEST_TC(hw));
+		else if(hw == 9) /* TODO: this is correct, but how does this overlapping work exactly? */
+			hw = NV40_VP_INST_DEST_PSZ;
+		else
+			assert(0);
 		break;
 	case TGSI_SEMANTIC_EDGEFLAG:
 		/* not really an error just a fallback */
@@ -804,20 +809,21 @@ nvfx_vertprog_prepare(struct nvfx_context* nvfx, struct nvfx_vpc *vpc)
 	struct tgsi_parse_context p;
 	int high_const = -1, high_temp = -1, high_addr = -1, nr_imm = 0, i;
 	struct util_semantic_set set;
-	unsigned char sem_layout[8];
+	unsigned char sem_layout[10];
 	unsigned num_outputs;
+	unsigned num_texcoords = nvfx->is_nv4x ? 10 : 8;
 
 	num_outputs = util_semantic_set_from_program_file(&set, vpc->vp->pipe.tokens, TGSI_FILE_OUTPUT);
 
-	if(num_outputs > 8) {
+	if(num_outputs > num_texcoords) {
 		NOUVEAU_ERR("too many vertex program outputs: %i\n", num_outputs);
 		return FALSE;
 	}
-	util_semantic_layout_from_set(sem_layout, &set, 8, 8);
+	util_semantic_layout_from_set(sem_layout, &set, num_texcoords, num_texcoords);
 
 	/* hope 0xf is (0, 0, 0, 1) initialized; otherwise, we are _probably_ not required to do this */
 	memset(vpc->vp->generic_to_fp_input, 0x0f, sizeof(vpc->vp->generic_to_fp_input));
-	for(int i = 0; i < 8; ++i) {
+	for(int i = 0; i < 10; ++i) {
 		if(sem_layout[i] == 0xff)
 			continue;
 		//printf("vp: GENERIC[%i] to fpreg %i\n", sem_layout[i], NVFX_FP_OP_INPUT_SRC_TC(0) + i);
@@ -825,7 +831,7 @@ nvfx_vertprog_prepare(struct nvfx_context* nvfx, struct nvfx_vpc *vpc)
 	}
 
 	vpc->vp->sprite_fp_input = -1;
-	for(int i = 0; i < 8; ++i)
+	for(int i = 0; i < 10; ++i)
 	{
 		if(sem_layout[i] == 0xff)
 		{




More information about the mesa-commit mailing list