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_rast_priv.h | |
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_rast_priv.h')
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_rast_priv.h | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_rast_priv.h b/src/gallium/drivers/llvmpipe/lp_rast_priv.h index 4876d7472fb..6f03023eafe 100644 --- a/src/gallium/drivers/llvmpipe/lp_rast_priv.h +++ b/src/gallium/drivers/llvmpipe/lp_rast_priv.h @@ -203,7 +203,8 @@ lp_rast_get_unswizzled_depth_tile_pointer(struct lp_rasterizer_task *task, */ static INLINE uint8_t * lp_rast_get_unswizzled_color_block_pointer(struct lp_rasterizer_task *task, - unsigned buf, unsigned x, unsigned y) + unsigned buf, unsigned x, unsigned y, + unsigned layer) { unsigned px, py, pixel_offset, format_bytes; uint8_t *color; @@ -225,6 +226,10 @@ lp_rast_get_unswizzled_color_block_pointer(struct lp_rasterizer_task *task, color = color + pixel_offset; + if (layer) { + color += layer * task->scene->cbufs[buf].layer_stride; + } + assert(lp_check_alignment(color, llvmpipe_get_format_alignment(task->scene->fb.cbufs[buf]->format))); return color; } @@ -236,7 +241,7 @@ lp_rast_get_unswizzled_color_block_pointer(struct lp_rasterizer_task *task, */ static INLINE uint8_t * lp_rast_get_unswizzled_depth_block_pointer(struct lp_rasterizer_task *task, - unsigned x, unsigned y) + unsigned x, unsigned y, unsigned layer) { unsigned px, py, pixel_offset, format_bytes; uint8_t *depth; @@ -257,6 +262,10 @@ lp_rast_get_unswizzled_depth_block_pointer(struct lp_rasterizer_task *task, depth = depth + pixel_offset; + if (layer) { + depth += layer * task->scene->zsbuf.layer_stride; + } + assert(lp_check_alignment(depth, llvmpipe_get_format_alignment(task->scene->fb.zsbuf->format))); return depth; } @@ -278,19 +287,18 @@ lp_rast_shade_quads_all( struct lp_rasterizer_task *task, struct lp_fragment_shader_variant *variant = state->variant; uint8_t *color[PIPE_MAX_COLOR_BUFS]; unsigned stride[PIPE_MAX_COLOR_BUFS]; - void *depth = NULL; + uint8_t *depth = NULL; unsigned depth_stride = 0; unsigned i; /* color buffer */ for (i = 0; i < scene->fb.nr_cbufs; i++) { stride[i] = scene->cbufs[i].stride; - - color[i] = lp_rast_get_unswizzled_color_block_pointer(task, i, x, y); + color[i] = lp_rast_get_unswizzled_color_block_pointer(task, i, x, y, inputs->layer); } if (scene->zsbuf.map) { - depth = lp_rast_get_unswizzled_depth_block_pointer(task, x, y); + depth = lp_rast_get_unswizzled_depth_block_pointer(task, x, y, inputs->layer); depth_stride = scene->zsbuf.stride; } |