llvmpipe/setup: remove opaque from setup triangle

This isn't used in the rast side of things, so just pass it out here.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14846>
This commit is contained in:
Dave Airlie 2022-02-03 12:46:35 +10:00 committed by Marge Bot
parent 66188e8693
commit fb17da6c50
6 changed files with 38 additions and 35 deletions

View File

@ -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) */

View File

@ -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

View File

@ -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);
}

View File

@ -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);
}
}

View File

@ -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);
}
}
}

View File

@ -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;
}