summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/llvmpipe/lp_rast.c
diff options
context:
space:
mode:
authorRoland Scheidegger <[email protected]>2015-03-27 16:49:54 +0100
committerRoland Scheidegger <[email protected]>2015-03-28 02:59:42 +0100
commitb2424fb0304cf4afd363b35c1dab49fb7edddb08 (patch)
tree3acdd6cdb1107fab78297567d0d22ca60572b85d /src/gallium/drivers/llvmpipe/lp_rast.c
parent764fc2be5ab61c86baaab746e7ea7702328c4f9f (diff)
llvmpipe: simplify address calculation for 4x4 blocks
These functions looked quite complicated, even though what they actually did was trivial (ever since we dropped swizzled rendering). Also drop lookup of format block per bytes done for each block, and do it once per scene instead. This improves everybody's favorite "benchmark" by 3% or so, though lp_rast_shade_quads_all() which calls this shows up still quite high for a function which does little more than call the jit function. (This would most likely be much better handled by the jit function itself, the strides are passed through anyway already, though for being able to handle layers it would definitely add some complexity.) Reviewed-by: Jose Fonseca <[email protected]>
Diffstat (limited to 'src/gallium/drivers/llvmpipe/lp_rast.c')
-rw-r--r--src/gallium/drivers/llvmpipe/lp_rast.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_rast.c b/src/gallium/drivers/llvmpipe/lp_rast.c
index 903e7c51002..7019acbda9d 100644
--- a/src/gallium/drivers/llvmpipe/lp_rast.c
+++ b/src/gallium/drivers/llvmpipe/lp_rast.c
@@ -91,6 +91,9 @@ lp_rast_tile_begin(struct lp_rasterizer_task *task,
const struct cmd_bin *bin,
int x, int y)
{
+ unsigned i;
+ struct lp_scene *scene = task->scene;
+
LP_DBG(DEBUG_RAST, "%s %d,%d\n", __FUNCTION__, x, y);
task->bin = bin;
@@ -104,9 +107,18 @@ lp_rast_tile_begin(struct lp_rasterizer_task *task,
task->thread_data.vis_counter = 0;
task->ps_invocations = 0;
- /* reset pointers to color and depth tile(s) */
- memset(task->color_tiles, 0, sizeof(task->color_tiles));
- task->depth_tile = NULL;
+ for (i = 0; i < task->scene->fb.nr_cbufs; i++) {
+ if (task->scene->fb.cbufs[i]) {
+ task->color_tiles[i] = scene->cbufs[i].map +
+ scene->cbufs[i].stride * task->y +
+ scene->cbufs[i].format_bytes * task->x;
+ }
+ }
+ if (task->scene->fb.zsbuf) {
+ task->depth_tile = scene->zsbuf.map +
+ scene->zsbuf.stride * task->y +
+ scene->zsbuf.format_bytes * task->x;
+ }
}
@@ -186,7 +198,7 @@ lp_rast_clear_zstencil(struct lp_rasterizer_task *task,
if (scene->fb.zsbuf) {
unsigned layer;
- uint8_t *dst_layer = lp_rast_get_depth_tile_pointer(task, LP_TEX_USAGE_READ_WRITE);
+ uint8_t *dst_layer = task->depth_tile;
block_size = util_format_get_blocksize(scene->fb.zsbuf->format);
clear_value &= clear_mask;