aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/lima
diff options
context:
space:
mode:
authorVasily Khoruzhick <[email protected]>2020-01-10 19:35:11 -0800
committerVasily Khoruzhick <[email protected]>2020-01-12 00:10:04 -0800
commitb936b1f9b49b0eb5c5ca3048790f032aa9b02ecb (patch)
tree261c3b19bfb14927c51a32fa9fb3d707a4702421 /src/gallium/drivers/lima
parent997a30d709b2cc207c4f524ed1fb59a9ac6547e3 (diff)
lima: fix viewport clipping
Apparently Mali4x0 doesn't do viewport clipping, so anything rendered beyond viewport is still rendered. Looks like we need to use scissors to do clipping. Fixes most of dEQP-GLES2.functional.clipping.*, 6 out of 7 remaining failures fail on blob as well. Remaining [1] fails on many other gallium drivers. [1] dEQP-GLES2.functional.clipping.triangle_vertex.clip_three.clip_neg_x_neg_z_and_pos_x_pos_z_and_neg_x_neg_y_pos_z Suggested-by: Ilia Mirkin <[email protected]> Reviewed-by: Qiang Yu <[email protected]> Tested-by: Andreas Baierl <[email protected]> Signed-off-by: Vasily Khoruzhick <[email protected]>
Diffstat (limited to 'src/gallium/drivers/lima')
-rw-r--r--src/gallium/drivers/lima/lima_draw.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/src/gallium/drivers/lima/lima_draw.c b/src/gallium/drivers/lima/lima_draw.c
index 0a0c60dbb94..d8ca64c9253 100644
--- a/src/gallium/drivers/lima/lima_draw.c
+++ b/src/gallium/drivers/lima/lima_draw.c
@@ -827,6 +827,7 @@ lima_pack_plbu_cmd(struct lima_context *ctx, const struct pipe_draw_info *info)
{
struct lima_context_framebuffer *fb = &ctx->framebuffer;
struct lima_vs_shader_state *vs = ctx->vs;
+ unsigned minx, maxx, miny, maxy;
lima_pack_head_plbu_cmd(ctx);
@@ -876,14 +877,25 @@ lima_pack_plbu_cmd(struct lima_context *ctx, const struct pipe_draw_info *info)
*/
if (ctx->rasterizer->base.scissor) {
struct pipe_scissor_state *scissor = &ctx->scissor;
- PLBU_CMD_SCISSORS(scissor->minx, scissor->maxx, scissor->miny, scissor->maxy);
- lima_damage_rect_union(ctx, scissor->minx, scissor->maxx,
- scissor->miny, scissor->maxy);
+ minx = scissor->minx;
+ maxx = scissor->maxx;
+ miny = scissor->miny;
+ maxy = scissor->maxy;
} else {
- PLBU_CMD_SCISSORS(0, fb->base.width, 0, fb->base.height);
- lima_damage_rect_union(ctx, 0, fb->base.width, 0, fb->base.height);
+ minx = 0;
+ maxx = fb->base.width;
+ miny = 0;
+ maxy = fb->base.height;
}
+ minx = MAX2(minx, ctx->viewport.left);
+ maxx = MIN2(maxx, ctx->viewport.right);
+ miny = MAX2(miny, ctx->viewport.bottom);
+ maxy = MIN2(maxy, ctx->viewport.top);
+
+ PLBU_CMD_SCISSORS(minx, maxx, miny, maxy);
+ lima_damage_rect_union(ctx, minx, maxx, miny, maxy);
+
PLBU_CMD_UNKNOWN1();
PLBU_CMD_DEPTH_RANGE_NEAR(fui(ctx->viewport.near));