summaryrefslogtreecommitdiff
path: root/src/mesa/state_tracker
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2008-07-02 19:07:11 -0600
committerBrian Paul <brian.paul@tungstengraphics.com>2008-07-02 19:07:11 -0600
commitdad8a7c90d96f37fedfe912a10ba3754c1666161 (patch)
tree23cf7bc1c64dc2b8ac966d6c9e659d1cf8713070 /src/mesa/state_tracker
parent8fb4d602db48d425380e5508e3fd71cbdc2e7095 (diff)
gallium: fix a bug in vertex program output mapping
Need to translate VERT_RESULT_PSIZ, BFC0, BFC1 to TGSI shader output slots after all other attributes have been handled. This fixes a bug where generic vertex program outputs (varying vars) could get mapped to the same slot at point size or back-face colors.
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r--src/mesa/state_tracker/st_atom_shader.c33
1 files changed, 24 insertions, 9 deletions
diff --git a/src/mesa/state_tracker/st_atom_shader.c b/src/mesa/state_tracker/st_atom_shader.c
index a62ea8161c..4fa304ede0 100644
--- a/src/mesa/state_tracker/st_atom_shader.c
+++ b/src/mesa/state_tracker/st_atom_shader.c
@@ -175,6 +175,7 @@ find_translated_vp(struct st_context *st,
GLuint outAttr, dummySlot;
const GLbitfield outputsWritten = stvp->Base.Base.OutputsWritten;
GLuint numVpOuts = 0;
+ GLboolean emitPntSize = GL_FALSE, emitBFC0 = GL_FALSE, emitBFC1 = GL_FALSE;
/* Compute mapping of vertex program outputs to slots, which depends
* on the fragment program's input->slot mapping.
@@ -199,19 +200,28 @@ find_translated_vp(struct st_context *st,
numVpOuts++;
}
}
- else if (outAttr == VERT_RESULT_PSIZ ||
- outAttr == VERT_RESULT_BFC0 ||
- outAttr == VERT_RESULT_BFC1) {
- /* backface colors go into last slots */
- xvp->output_to_slot[outAttr] = numVpOuts++;
- }
+ else if (outAttr == VERT_RESULT_PSIZ)
+ emitPntSize = GL_TRUE;
+ else if (outAttr == VERT_RESULT_BFC0)
+ emitBFC0 = GL_TRUE;
+ else if (outAttr == VERT_RESULT_BFC1)
+ emitBFC1 = GL_TRUE;
}
- /*
- printf("output_to_slot[%d] = %d\n", outAttr,
+#if 0 /*debug*/
+ printf("assign output_to_slot[%d] = %d\n", outAttr,
xvp->output_to_slot[outAttr]);
- */
+#endif
}
+ /* must do these last */
+ if (emitPntSize)
+ xvp->output_to_slot[VERT_RESULT_PSIZ] = numVpOuts++;
+ if (emitBFC0)
+ xvp->output_to_slot[VERT_RESULT_BFC0] = numVpOuts++;
+ if (emitBFC1)
+ xvp->output_to_slot[VERT_RESULT_BFC1] = numVpOuts++;
+
+
/* Unneeded vertex program outputs will go to this slot.
* We could use this info to do dead code elimination in the
* vertex program.
@@ -224,6 +234,11 @@ find_translated_vp(struct st_context *st,
if (xvp->output_to_slot[outAttr] == UNUSED)
xvp->output_to_slot[outAttr] = dummySlot;
}
+#if 0 /*debug*/
+ printf("output_to_slot[%d] = %d\n", outAttr,
+ xvp->output_to_slot[outAttr]);
+#endif
+
}
assert(stvp->Base.Base.NumInstructions > 1);