summaryrefslogtreecommitdiff
path: root/src/mesa/state_tracker/st_atom_shader.c
diff options
context:
space:
mode:
authorBrian <brian.paul@tungstengraphics.com>2008-01-31 14:05:04 -0700
committerBrian <brian.paul@tungstengraphics.com>2008-01-31 14:05:04 -0700
commit86787043fae59869133180474cb09dac4f2e619a (patch)
tree34570ca98a1b119f24594b35dbb108d15b0a84bd /src/mesa/state_tracker/st_atom_shader.c
parentacb81374c1d476ebffbcfc8405db7fff6cc6d6c3 (diff)
Fix problem in mapping vertex program outputs (found with "spring" game engine)
If the vertex program writes to an output that's not consumed by the fragment program, map the vp output to an unused slot.
Diffstat (limited to 'src/mesa/state_tracker/st_atom_shader.c')
-rw-r--r--src/mesa/state_tracker/st_atom_shader.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/mesa/state_tracker/st_atom_shader.c b/src/mesa/state_tracker/st_atom_shader.c
index 1ed9333556..9196918509 100644
--- a/src/mesa/state_tracker/st_atom_shader.c
+++ b/src/mesa/state_tracker/st_atom_shader.c
@@ -226,9 +226,11 @@ find_translated_vp(struct st_context *st,
GLint fpInAttrib = vp_out_to_fp_in(outAttr);
if (fpInAttrib >= 0) {
GLuint fpInSlot = stfp->input_to_slot[fpInAttrib];
- GLuint vpOutSlot = stfp->fs->state.input_map[fpInSlot];
- xvp->output_to_slot[outAttr] = vpOutSlot;
- numVpOuts++;
+ if (fpInSlot != ~0) {
+ GLuint vpOutSlot = stfp->fs->state.input_map[fpInSlot];
+ xvp->output_to_slot[outAttr] = vpOutSlot;
+ numVpOuts++;
+ }
}
else if (outAttr == VERT_RESULT_PSIZ ||
outAttr == VERT_RESULT_BFC0 ||
@@ -247,7 +249,7 @@ find_translated_vp(struct st_context *st,
* We could use this info to do dead code elimination in the
* vertex program.
*/
- dummySlot = stfp->num_input_slots;
+ dummySlot = numVpOuts;
/* Map vert program outputs that aren't used to the dummy slot */
for (outAttr = 0; outAttr < VERT_RESULT_MAX; outAttr++) {