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>
(cherry picked from commit 9c26a6b3bb)
This commit is contained in:
Francisco Jerez 2023-05-18 15:40:11 -07:00 committed by Eric Engestrom
parent 1794199bf8
commit a825322179
2 changed files with 5 additions and 5 deletions

View file

@ -2101,7 +2101,7 @@
"description": "anv: Fix calculation of guardband clipping region.",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "893fa30afed10394fdee266e0dc772ddd36dfde8"
},

View file

@ -3036,10 +3036,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);
}
@ -3059,9 +3059,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