diff options
author | Keith Whitwell <keithw@vmware.com> | 2009-07-24 16:49:35 +0100 |
---|---|---|
committer | José Fonseca <jfonseca@vmware.com> | 2009-08-29 09:21:18 +0100 |
commit | bdbb4beb21876010b14785569a920fa65a67d1ad (patch) | |
tree | 40b8f2d0f6d4020c4229ab2e582f9b7e2a03bb5c /src/gallium/drivers/llvmpipe/lp_quad_fs.c | |
parent | 4486012245c5f526059d3872ac3561f53705d1cf (diff) |
llvmpipe: expand quad pipeline to process >1 quad at a time
This is part one -- we still only pass a single quad down, but
the code can now cope with more. The quads must all be from the same
tile.
Diffstat (limited to 'src/gallium/drivers/llvmpipe/lp_quad_fs.c')
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_quad_fs.c | 40 |
1 files changed, 30 insertions, 10 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_quad_fs.c b/src/gallium/drivers/llvmpipe/lp_quad_fs.c index cabc54155c..25518c09f4 100644 --- a/src/gallium/drivers/llvmpipe/lp_quad_fs.c +++ b/src/gallium/drivers/llvmpipe/lp_quad_fs.c @@ -68,21 +68,18 @@ quad_shade_stage(struct quad_stage *qs) /** * Execute fragment shader for the four fragments in the quad. */ -static void +static boolean shade_quad(struct quad_stage *qs, struct quad_header *quad) { struct quad_shade_stage *qss = quad_shade_stage( qs ); struct llvmpipe_context *llvmpipe = qs->llvmpipe; struct tgsi_exec_machine *machine = qss->machine; boolean z_written; - - /* Consts do not require 16 byte alignment. */ - machine->Consts = llvmpipe->mapped_constants[PIPE_SHADER_FRAGMENT]; - - machine->InterpCoefs = quad->coef; /* run shader */ quad->inout.mask &= llvmpipe->fs->run( llvmpipe->fs, machine, quad ); + if (quad->inout.mask == 0) + return FALSE; /* store outputs */ z_written = FALSE; @@ -129,11 +126,34 @@ shade_quad(struct quad_stage *qs, struct quad_header *quad) quad->output.depth[3] = z0 + dzdx + dzdy; } - /* shader may cull fragments */ - if (quad->inout.mask) { - qs->next->run( qs->next, quad ); + return TRUE; +} + +static void +shade_quads(struct quad_stage *qs, + struct quad_header *quads[], + unsigned nr) +{ + struct quad_shade_stage *qss = quad_shade_stage( qs ); + struct llvmpipe_context *llvmpipe = qs->llvmpipe; + struct tgsi_exec_machine *machine = qss->machine; + + unsigned i, pass = 0; + + machine->Consts = llvmpipe->mapped_constants[PIPE_SHADER_FRAGMENT]; + machine->InterpCoefs = quads[0]->coef; + + for (i = 0; i < nr; i++) { + if (shade_quad(qs, quads[i])) + quads[pass++] = quads[i]; } + + if (pass) + qs->next->run(qs->next, quads, pass); } + + + /** @@ -174,7 +194,7 @@ lp_quad_shade_stage( struct llvmpipe_context *llvmpipe ) qss->stage.llvmpipe = llvmpipe; qss->stage.begin = shade_begin; - qss->stage.run = shade_quad; + qss->stage.run = shade_quads; qss->stage.destroy = shade_destroy; qss->machine = tgsi_exec_machine_create(); |