diff options
author | Brian <[email protected]> | 2007-10-09 14:55:22 -0600 |
---|---|---|
committer | Brian <[email protected]> | 2007-10-09 14:55:22 -0600 |
commit | bc139a19b00f8686caa8db7c56af2087f26e369a (patch) | |
tree | 4e598ff84144599ad115ed9abdaf8b21cc2f33b0 /src/mesa/state_tracker/st_program.c | |
parent | 342bc50c3d8765ea4ab50aa7d77df5c86c478c61 (diff) |
Pack fragment program outputs to be consistant with vertex programs.
Previously, output[0] was always Z and output[1] was color. Now output[0]
will be color if Z is not written.
In shade_quad() use the semantic info to determine which quantity is in
which output slot.
Diffstat (limited to 'src/mesa/state_tracker/st_program.c')
-rw-r--r-- | src/mesa/state_tracker/st_program.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c index 86aaaad6bb3..0b14830353c 100644 --- a/src/mesa/state_tracker/st_program.c +++ b/src/mesa/state_tracker/st_program.c @@ -160,8 +160,6 @@ st_translate_vertex_program(struct st_context *st, defaultOutputMapping[attr] = slot; } - vs.outputs_written |= (1 << slot); - /* printf("Output %u -> slot %u\n", attr, slot); */ @@ -346,35 +344,33 @@ st_translate_fragment_program(struct st_context *st, } /* - * Semantics for outputs + * Semantics and mapping for outputs */ { uint numColors = 0; GLbitfield outputsWritten = stfp->Base.Base.OutputsWritten; - /* output[0] is always Z, but may not really be written */ - fs.output_semantic_name[fs.num_outputs] = TGSI_SEMANTIC_POSITION; - fs.output_semantic_index[fs.num_outputs] = 0; - outputMapping[FRAG_RESULT_DEPR] = fs.num_outputs; - fs.num_outputs++; - + /* if z is written, emit that first */ if (outputsWritten & (1 << FRAG_RESULT_DEPR)) { - fs.outputs_written |= 0x1; + fs.output_semantic_name[fs.num_outputs] = TGSI_SEMANTIC_POSITION; + fs.output_semantic_index[fs.num_outputs] = 0; + outputMapping[FRAG_RESULT_DEPR] = fs.num_outputs; + fs.num_outputs++; outputsWritten &= ~(1 << FRAG_RESULT_DEPR); } - /* color outputs begin at output [1] */ + /* handle remaning outputs (color) */ for (attr = 0; attr < FRAG_RESULT_MAX; attr++) { if (outputsWritten & (1 << attr)) { switch (attr) { case FRAG_RESULT_DEPR: + /* handled above */ assert(0); break; case FRAG_RESULT_COLR: fs.output_semantic_name[fs.num_outputs] = TGSI_SEMANTIC_COLOR; fs.output_semantic_index[fs.num_outputs] = numColors; outputMapping[attr] = fs.num_outputs; - fs.outputs_written |= (0x2 << numColors); numColors++; break; default: |