mesa: Branch 'master'

Jerome Glisse glisse at kemper.freedesktop.org
Sun Jan 14 18:32:37 UTC 2007


 src/mesa/drivers/dri/r300/r300_vertexprog.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

New commits:
diff-tree 9a4e49aef2abb277544138640c2b71169badaa42 (from 6dd967e74ff4cb03220d5785bd583203464d299d)
Author: Jerome Glisse <glisse at freedesktop.org>
Date:   Sun Jan 14 19:31:30 2007 +0100

    r300: Fix vertex program position invariant bug, force position reading.
    
    When we have a position invariant program we need to force routing the
    position otherwise you may handle transform quite random data which might
    be funny but unlikely what you want :).

diff --git a/src/mesa/drivers/dri/r300/r300_vertexprog.c b/src/mesa/drivers/dri/r300/r300_vertexprog.c
index 2492a4a..c08c987 100644
--- a/src/mesa/drivers/dri/r300/r300_vertexprog.c
+++ b/src/mesa/drivers/dri/r300/r300_vertexprog.c
@@ -1072,6 +1072,8 @@ static void insert_wpos(struct r300_vert
 	vpi = &prog->Instructions[prog->NumInstructions-1];
 
 	assert(vpi->Opcode == OPCODE_END);
+	/* we need position, don't we ? :) */
+	prog->InputsRead |= (1 << VERT_ATTRIB_POS);
 }
 
 static void pos_as_texcoord(struct r300_vertex_program *vp,
@@ -1101,8 +1103,9 @@ static struct r300_vertex_program *build
 
 	vp->wpos_idx = wpos_idx;
 
-	if(mesa_vp->IsPositionInvariant)
+	if(mesa_vp->IsPositionInvariant) {
 		position_invariant(&mesa_vp->Base);
+	}
 
 	if(wpos_idx > -1)
 		pos_as_texcoord(vp, &mesa_vp->Base);
@@ -1158,6 +1161,10 @@ void r300_select_vertex_shader(r300Conte
 			wanted_key.OutputsWritten |= 1 << (VERT_RESULT_TEX0 + i);
 
 	wanted_key.InputsRead = vpc->mesa_program.Base.InputsRead;
+	if(vpc->mesa_program.IsPositionInvariant) {
+		/* we wan't position don't we ? */
+		wanted_key.InputsRead |= (1 << VERT_ATTRIB_POS);
+	}
 
 	for (vp = vpc->progs; vp; vp = vp->next)
 		if (_mesa_memcmp(&vp->key, &wanted_key, sizeof(wanted_key)) == 0) {
@@ -1170,6 +1177,5 @@ void r300_select_vertex_shader(r300Conte
 	vp = build_program(&wanted_key, &vpc->mesa_program, wpos_idx);
 	vp->next = vpc->progs;
 	vpc->progs = vp;
-
 	r300->selected_vp = vp;
 }



More information about the mesa-commit mailing list