diff options
author | Alyssa Rosenzweig <[email protected]> | 2019-07-17 16:30:09 -0700 |
---|---|---|
committer | Alyssa Rosenzweig <[email protected]> | 2019-07-18 10:42:43 -0700 |
commit | fad76470d54a1c87677e4659fcd65f19ba81d58d (patch) | |
tree | 5a9739f5c2ea32e688d599e8dfbf27c38ac51384 /src | |
parent | 5c554e235dc5376a0b2d1a8847a527f9e06f4873 (diff) |
panfrost: Make scissor test more robust
See v3d implementation.
Signed-off-by: Alyssa Rosenzweig <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/drivers/panfrost/pan_context.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c index c022e950c00..c3e191403fb 100644 --- a/src/gallium/drivers/panfrost/pan_context.c +++ b/src/gallium/drivers/panfrost/pan_context.c @@ -1371,19 +1371,26 @@ panfrost_emit_for_draw(struct panfrost_context *ctx, bool with_vertex_data) }; /* Always scissor to the viewport by default. */ - int minx = (int) (vp->translate[0] - vp->scale[0]); - int maxx = (int) (vp->translate[0] + vp->scale[0]); + float vp_minx = (int) (vp->translate[0] - fabsf(vp->scale[0])); + float vp_maxx = (int) (vp->translate[0] + fabsf(vp->scale[0])); - int miny = (int) (vp->translate[1] - vp->scale[1]); - int maxy = (int) (vp->translate[1] + vp->scale[1]); + float vp_miny = (int) (vp->translate[1] - fabsf(vp->scale[1])); + float vp_maxy = (int) (vp->translate[1] + fabsf(vp->scale[1])); /* Apply the scissor test */ + unsigned minx, miny, maxx, maxy; + if (ss && ctx->rasterizer && ctx->rasterizer->base.scissor) { - minx = ss->minx; - maxx = ss->maxx; - miny = ss->miny; - maxy = ss->maxy; + minx = MAX2(ss->minx, vp_minx); + miny = MAX2(ss->miny, vp_miny); + maxx = MIN2(ss->maxx, vp_maxx); + maxy = MIN2(ss->maxy, vp_maxy); + } else { + minx = vp_minx; + miny = vp_miny; + maxx = vp_maxx; + maxy = vp_maxy; } /* Hardware needs the min/max to be strictly ordered, so flip if we |