summaryrefslogtreecommitdiff
path: root/src/mesa/pipe/softpipe
diff options
context:
space:
mode:
authorBrian <brian.paul@tungstengraphics.com>2007-10-09 14:55:22 -0600
committerBrian <brian.paul@tungstengraphics.com>2007-10-09 14:55:22 -0600
commitbc139a19b00f8686caa8db7c56af2087f26e369a (patch)
tree4e598ff84144599ad115ed9abdaf8b21cc2f33b0 /src/mesa/pipe/softpipe
parent342bc50c3d8765ea4ab50aa7d77df5c86c478c61 (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/pipe/softpipe')
-rwxr-xr-xsrc/mesa/pipe/softpipe/sp_quad_fs.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/mesa/pipe/softpipe/sp_quad_fs.c b/src/mesa/pipe/softpipe/sp_quad_fs.c
index 2b0c4366bd..b6005c6a69 100755
--- a/src/mesa/pipe/softpipe/sp_quad_fs.c
+++ b/src/mesa/pipe/softpipe/sp_quad_fs.c
@@ -78,6 +78,7 @@ shade_quad(
const float fx = (float) quad->x0;
const float fy = (float) quad->y0;
struct tgsi_exec_machine *machine = &qss->machine;
+ uint colorOut;
/* Consts does not require 16 byte alignment. */
machine->Consts = softpipe->mapped_constants[PIPE_SHADER_FRAGMENT];
@@ -109,28 +110,32 @@ shade_quad(
quad->mask &= tgsi_exec_machine_run( machine );
}
- /* store result color (always in output[1]) */
- memcpy(
- quad->outputs.color,
- &machine->Outputs[1].xyzw[0].f[0],
- sizeof( quad->outputs.color ) );
-
- /* Z */
- if (qss->stage.softpipe->fs->outputs_written & 0x1) {
+ if (qss->stage.softpipe->fs->output_semantic_name[0] == TGSI_SEMANTIC_POSITION) {
/* output[0] is new Z */
uint i;
for (i = 0; i < 4; i++) {
quad->outputs.depth[i] = machine->Outputs[0].xyzw[2].f[i];
}
+ colorOut = 1;
}
else {
- /* pass input Z to output Z */
+ /* pass input Z (which was interpolated by the executor) to output Z */
uint i;
for (i = 0; i < 4; i++) {
quad->outputs.depth[i] = machine->Inputs[0].xyzw[2].f[i];
}
+ colorOut = 0;
}
+ /* store result color */
+ /* XXX need to handle multiple color outputs someday */
+ assert(qss->stage.softpipe->fs->output_semantic_name[colorOut]
+ == TGSI_SEMANTIC_COLOR);
+ memcpy(
+ quad->outputs.color,
+ &machine->Outputs[colorOut].xyzw[0].f[0],
+ sizeof( quad->outputs.color ) );
+
/* shader may cull fragments */
if( quad->mask ) {
qs->next->run( qs->next, quad );