anv: Fix calculation of guardband clipping region.

The existing guardband region calculation was mixing up x/y_min with
x/y_max in cmd_buffer_emit_viewport(), causing the calculated viewport
area to always be an empty region.  Luckily intel_calculate_guardband_size()
returns a non-empty but bogus guardband region in that case, so this
doesn't seem to have led to conformance regressions, but the
off-center guardbands could potentially impact performance in
geometry-heavy rendering.

Fixes: 893fa30afe ("anv: Include scissors in viewport calculations")
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23174>
This commit is contained in:
Francisco Jerez
2023-05-18 15:40:11 -07:00
parent 744e9cb213
commit 9c26a6b3bb
+4 -4
View File
@@ -2889,10 +2889,10 @@ cmd_buffer_emit_viewport(struct anv_cmd_buffer *cmd_buffer)
if (gfx->render_area.extent.width > 0 &&
gfx->render_area.extent.height > 0) {
x_min = MAX2(x_min, gfx->render_area.offset.x);
x_max = MIN2(x_min, gfx->render_area.offset.x +
x_max = MIN2(x_max, gfx->render_area.offset.x +
gfx->render_area.extent.width);
y_min = MAX2(y_min, gfx->render_area.offset.y);
y_max = MIN2(y_min, gfx->render_area.offset.y +
y_max = MIN2(y_max, gfx->render_area.offset.y +
gfx->render_area.extent.height);
}
@@ -2912,9 +2912,9 @@ cmd_buffer_emit_viewport(struct anv_cmd_buffer *cmd_buffer)
if (i < dyn->vp.scissor_count) {
const VkRect2D *scissor = &dyn->vp.scissors[i];
x_min = MAX2(x_min, scissor->offset.x);
x_max = MIN2(x_min, scissor->offset.x + scissor->extent.width);
x_max = MIN2(x_max, scissor->offset.x + scissor->extent.width);
y_min = MAX2(y_min, scissor->offset.y);
y_max = MIN2(y_min, scissor->offset.y + scissor->extent.height);
y_max = MIN2(y_max, scissor->offset.y + scissor->extent.height);
}
/* Only bother calculating the guardband if our known render area is