diff options
author | Roland Scheidegger <[email protected]> | 2013-06-07 21:03:40 +0200 |
---|---|---|
committer | Roland Scheidegger <[email protected]> | 2013-06-07 21:15:01 +0200 |
commit | d8146f240e628e70d4c07f7e805a179f70c36e23 (patch) | |
tree | edfc30c3469fc1cb24ff96891453d1c9806e41d3 /src/gallium/drivers/llvmpipe/lp_setup_tri.c | |
parent | 0f4c08aea2da3bd808109d09dbcdc249d1fb6b74 (diff) |
llvmpipe: add support for layered rendering
Mostly just make sure the layer parameter gets passed through to the right
places (and get clamped, can do this at setup time), fix up clears to
clear all layers and disable opaque optimization. Luckily don't need to
touch the jitted code.
(Clears invoked via pipe's clear_render_target method will not work however
since the pipe_util_clear function used for it doesn't handle clearing
multiple layers yet.)
v2: per Brian's suggestion, prettify var initialization and add some comments,
add assertion for impossible layer specification for surface.
Reviewed-by: Brian Paul <[email protected]>
Reviewed-by: Jose Fonseca <[email protected]>
Diffstat (limited to 'src/gallium/drivers/llvmpipe/lp_setup_tri.c')
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_setup_tri.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_setup_tri.c b/src/gallium/drivers/llvmpipe/lp_setup_tri.c index e0aaa196c9a..2ca47bca43e 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_tri.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_tri.c @@ -203,7 +203,14 @@ lp_setup_whole_tile(struct lp_setup_context *setup, LP_COUNT(nr_fully_covered_64); /* if variant is opaque and scissor doesn't effect the tile */ - if (inputs->opaque) { + /* + * Need to disable this optimization for layered rendering and cannot use + * setup->layer_slot here to determine it, because it could incorrectly + * reset the tile if a previous shader used layer_slot but not this one + * (or maybe even "undo" clears). So determine this from presence of layers + * instead (in which case layer_slot will have no effect). + */ + if (inputs->opaque && scene->fb_max_layer == 0) { if (!scene->fb.zsbuf) { /* * All previous rendering will be overwritten so reset the bin. @@ -247,6 +254,7 @@ do_triangle_ccw(struct lp_setup_context *setup, unsigned tri_bytes; int nr_planes = 3; unsigned scissor_index = 0; + unsigned layer = 0; /* Area should always be positive here */ assert(position->area > 0); @@ -264,6 +272,10 @@ do_triangle_ccw(struct lp_setup_context *setup, else { nr_planes = 3; } + if (setup->layer_slot > 0) { + layer = *(unsigned*)v1[setup->layer_slot]; + layer = MIN2(layer, scene->fb_max_layer); + } /* Bounding rectangle (in pixels) */ { @@ -334,6 +346,7 @@ do_triangle_ccw(struct lp_setup_context *setup, tri->inputs.frontfacing = frontfacing; tri->inputs.disable = FALSE; tri->inputs.opaque = setup->fs.current.variant->opaque; + tri->inputs.layer = layer; if (0) lp_dump_setup_coef(&setup->setup.variant->key, @@ -519,7 +532,7 @@ do_triangle_ccw(struct lp_setup_context *setup, plane[6].eo = 0; } - return lp_setup_bin_triangle( setup, tri, &bbox, nr_planes, scissor_index ); + return lp_setup_bin_triangle(setup, tri, &bbox, nr_planes, scissor_index); } /* |