diff --git a/src/gallium/drivers/llvmpipe/lp_rast.h b/src/gallium/drivers/llvmpipe/lp_rast.h index 6e7a16ed649..cc07b2083e7 100644 --- a/src/gallium/drivers/llvmpipe/lp_rast.h +++ b/src/gallium/drivers/llvmpipe/lp_rast.h @@ -110,9 +110,8 @@ struct lp_rast_blit { struct lp_rast_shader_inputs { unsigned frontfacing:1; /** True for front-facing */ unsigned disable:1; /** Partially binned, disable this command */ - unsigned opaque:1; /** Is opaque */ unsigned is_blit:1; /* blit */ - unsigned pad0:12; /* wasted space */ + unsigned pad0:13; /* wasted space */ unsigned view_index:16; unsigned stride; /* how much to advance data between a0, dadx, dady */ unsigned layer; /* the layer to render to (from gs, already clamped) */ diff --git a/src/gallium/drivers/llvmpipe/lp_setup_context.h b/src/gallium/drivers/llvmpipe/lp_setup_context.h index 1f51f0bee10..6764e8ae5a1 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_context.h +++ b/src/gallium/drivers/llvmpipe/lp_setup_context.h @@ -229,7 +229,7 @@ boolean lp_setup_flush_and_restart(struct lp_setup_context *setup); boolean lp_setup_whole_tile(struct lp_setup_context *setup, const struct lp_rast_shader_inputs *inputs, - int tx, int ty); + int tx, int ty, boolean opaque); boolean lp_setup_is_blit(const struct lp_setup_context *setup, @@ -280,13 +280,15 @@ boolean lp_setup_bin_triangle(struct lp_setup_context *setup, struct lp_rast_triangle *tri, boolean use_32bits, + boolean opaque, const struct u_rect *bbox, int nr_planes, unsigned scissor_index); boolean lp_setup_bin_rectangle(struct lp_setup_context *setup, - struct lp_rast_rectangle *rect); + struct lp_rast_rectangle *rect, + boolean opaque); #endif diff --git a/src/gallium/drivers/llvmpipe/lp_setup_line.c b/src/gallium/drivers/llvmpipe/lp_setup_line.c index f08a16e57a3..e89d7b9aed4 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_line.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_line.c @@ -663,7 +663,6 @@ try_setup_line( struct lp_setup_context *setup, setup_line_coefficients(setup, &info); line->inputs.disable = FALSE; - line->inputs.opaque = FALSE; line->inputs.layer = layer; line->inputs.viewport_index = viewport_index; line->inputs.view_index = setup->view_index; @@ -718,7 +717,7 @@ try_setup_line( struct lp_setup_context *setup, lp_setup_add_scissor_planes(scissor, &plane[4], s_planes, setup->multisample); } - return lp_setup_bin_triangle(setup, line, use_32bits, &bboxpos, nr_planes, viewport_index); + return lp_setup_bin_triangle(setup, line, use_32bits, false, &bboxpos, nr_planes, viewport_index); } diff --git a/src/gallium/drivers/llvmpipe/lp_setup_point.c b/src/gallium/drivers/llvmpipe/lp_setup_point.c index 22aa60be937..d07d3a40c46 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_point.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_point.c @@ -509,7 +509,6 @@ try_setup_point( struct lp_setup_context *setup, point->inputs.disable = FALSE; point->inputs.is_blit = FALSE; - point->inputs.opaque = setup->fs.current.variant->opaque; point->inputs.layer = layer; point->inputs.viewport_index = viewport_index; point->inputs.view_index = setup->view_index; @@ -549,7 +548,9 @@ try_setup_point( struct lp_setup_context *setup, (bbox.y1 - (bbox.y0 & ~3))); boolean use_32bits = max_szorig <= MAX_FIXED_LENGTH32; - return lp_setup_bin_triangle(setup, point, use_32bits, &bbox, nr_planes, viewport_index); + return lp_setup_bin_triangle(setup, point, use_32bits, + setup->fs.current.variant->opaque, + &bbox, nr_planes, viewport_index); } else { struct lp_rast_rectangle *point; @@ -592,12 +593,11 @@ try_setup_point( struct lp_setup_context *setup, point->inputs.disable = FALSE; point->inputs.is_blit = FALSE; - point->inputs.opaque = setup->fs.current.variant->opaque; point->inputs.layer = layer; point->inputs.viewport_index = viewport_index; point->inputs.view_index = setup->view_index; - return lp_setup_bin_rectangle(setup, point); + return lp_setup_bin_rectangle(setup, point, setup->fs.current.variant->opaque); } } diff --git a/src/gallium/drivers/llvmpipe/lp_setup_rect.c b/src/gallium/drivers/llvmpipe/lp_setup_rect.c index 4b1e0cc1a99..d9d9e595e11 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_rect.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_rect.c @@ -93,14 +93,14 @@ lp_setup_alloc_rectangle(struct lp_scene *scene, unsigned nr_inputs) boolean lp_setup_whole_tile(struct lp_setup_context *setup, const struct lp_rast_shader_inputs *inputs, - int tx, int ty) + int tx, int ty, boolean opaque) { struct lp_scene *scene = setup->scene; LP_COUNT(nr_fully_covered_64); /* if variant is opaque and scissor doesn't effect the tile */ - if (inputs->opaque) { + if (opaque) { /* Several things prevent this optimization from working: * - For layered rendering we can't determine if this covers the same layer * as previous rendering (or in case of clears those actually always cover @@ -207,6 +207,7 @@ lp_setup_is_blit(const struct lp_setup_context *setup, static inline void partial(struct lp_setup_context *setup, const struct lp_rast_rectangle *rect, + boolean opaque, unsigned ix, unsigned iy, unsigned mask) { @@ -216,7 +217,7 @@ partial(struct lp_setup_context *setup, assert(rect->box.x1 >= (ix+1) * TILE_SIZE - 1); assert(rect->box.y1 >= (iy+1) * TILE_SIZE - 1); - lp_setup_whole_tile(setup, &rect->inputs, ix, iy); + lp_setup_whole_tile(setup, &rect->inputs, ix, iy, opaque); } else { LP_COUNT(nr_partially_covered_64); @@ -353,18 +354,18 @@ try_rect_cw(struct lp_setup_context *setup, rect->inputs.frontfacing = frontfacing; rect->inputs.disable = FALSE; rect->inputs.is_blit = lp_setup_is_blit(setup, &rect->inputs); - rect->inputs.opaque = variant->opaque; rect->inputs.layer = layer; rect->inputs.viewport_index = viewport_index; rect->inputs.view_index = setup->view_index; - return lp_setup_bin_rectangle(setup, rect); + return lp_setup_bin_rectangle(setup, rect, variant->opaque); } boolean lp_setup_bin_rectangle(struct lp_setup_context *setup, - struct lp_rast_rectangle *rect) + struct lp_rast_rectangle *rect, + boolean opaque) { struct lp_scene *scene = setup->scene; unsigned ix0, iy0, ix1, iy1; @@ -409,48 +410,48 @@ lp_setup_bin_rectangle(struct lp_setup_context *setup, /* Determine which tile(s) intersect the rectangle's bounding box */ if (iy0 == iy1 && ix0 == ix1) { - partial(setup, rect, ix0, iy0, + partial(setup, rect, opaque, ix0, iy0, (left_mask | right_mask | top_mask | bottom_mask)); } else if (ix0 == ix1) { unsigned mask = left_mask | right_mask; - partial(setup, rect, ix0, iy0, mask | top_mask); + partial(setup, rect, opaque, ix0, iy0, mask | top_mask); for (i = iy0 + 1; i < iy1; i++) - partial(setup, rect, ix0, i, mask); - partial(setup, rect, ix0, iy1, mask | bottom_mask); + partial(setup, rect, opaque, ix0, i, mask); + partial(setup, rect, opaque, ix0, iy1, mask | bottom_mask); } else if (iy0 == iy1) { unsigned mask = top_mask | bottom_mask; - partial(setup, rect, ix0, iy0, mask | left_mask); + partial(setup, rect, opaque, ix0, iy0, mask | left_mask); for (i = ix0 + 1; i < ix1; i++) - partial(setup, rect, i, iy0, mask); - partial(setup, rect, ix1, iy0, mask | right_mask); + partial(setup, rect, opaque, i, iy0, mask); + partial(setup, rect, opaque, ix1, iy0, mask | right_mask); } else { - partial(setup, rect, ix0, iy0, left_mask | top_mask); - partial(setup, rect, ix0, iy1, left_mask | bottom_mask); - partial(setup, rect, ix1, iy0, right_mask | top_mask); - partial(setup, rect, ix1, iy1, right_mask | bottom_mask); + partial(setup, rect, opaque, ix0, iy0, left_mask | top_mask); + partial(setup, rect, opaque, ix0, iy1, left_mask | bottom_mask); + partial(setup, rect, opaque, ix1, iy0, right_mask | top_mask); + partial(setup, rect, opaque, ix1, iy1, right_mask | bottom_mask); /* Top/Bottom fringes */ for (i = ix0 + 1; i < ix1; i++) { - partial(setup, rect, i, iy0, top_mask); - partial(setup, rect, i, iy1, bottom_mask); + partial(setup, rect, opaque, i, iy0, top_mask); + partial(setup, rect, opaque, i, iy1, bottom_mask); } /* Left/Right fringes */ for (i = iy0 + 1; i < iy1; i++) { - partial(setup, rect, ix0, i, left_mask); - partial(setup, rect, ix1, i, right_mask); + partial(setup, rect, opaque, ix0, i, left_mask); + partial(setup, rect, opaque, ix1, i, right_mask); } /* Full interior tiles */ for (j = iy0 + 1; j < iy1; j++) { for (i = ix0 + 1; i < ix1; i++) { - lp_setup_whole_tile(setup, &rect->inputs, i, j); + lp_setup_whole_tile(setup, &rect->inputs, i, j, opaque); } } } diff --git a/src/gallium/drivers/llvmpipe/lp_setup_tri.c b/src/gallium/drivers/llvmpipe/lp_setup_tri.c index 088ddf39def..e988ddfe641 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_tri.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_tri.c @@ -462,7 +462,6 @@ do_triangle_ccw(struct lp_setup_context *setup, tri->inputs.frontfacing = frontfacing; tri->inputs.disable = FALSE; tri->inputs.is_blit = FALSE; - tri->inputs.opaque = check_opaque(setup, v0, v1, v2); tri->inputs.layer = layer; tri->inputs.viewport_index = viewport_index; tri->inputs.view_index = setup->view_index; @@ -743,7 +742,9 @@ do_triangle_ccw(struct lp_setup_context *setup, lp_setup_add_scissor_planes(scissor, &plane[3], s_planes, setup->multisample); } - return lp_setup_bin_triangle(setup, tri, use_32bits, &bbox, nr_planes, viewport_index); + return lp_setup_bin_triangle(setup, tri, use_32bits, + check_opaque(setup, v0, v1, v2), + &bbox, nr_planes, viewport_index); } /* @@ -778,6 +779,7 @@ boolean lp_setup_bin_triangle(struct lp_setup_context *setup, struct lp_rast_triangle *tri, boolean use_32bits, + boolean opaque, const struct u_rect *bbox, int nr_planes, unsigned viewport_index) @@ -980,7 +982,7 @@ lp_setup_bin_triangle(struct lp_setup_context *setup, /* triangle covers the whole tile- shade whole tile */ LP_COUNT(nr_fully_covered_64); in = TRUE; - if (!lp_setup_whole_tile(setup, &tri->inputs, x, y)) + if (!lp_setup_whole_tile(setup, &tri->inputs, x, y, opaque)) goto fail; }