diff options
author | Eric Anholt <[email protected]> | 2014-12-11 20:11:21 -0800 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2014-12-11 21:31:27 -0800 |
commit | 0ae5e002e090c5e1bd237fa3f23549f9ab105a44 (patch) | |
tree | 0ae402ab10c31eeab0b9b685ddf1edd019781906 /src/gallium/drivers | |
parent | 87db578268012ffc7ca09b737441490144340c6e (diff) |
vc4: Fix triangle-guardband-viewport piglit test.
The original Broadcom driver also did this with the viewport.
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r-- | src/gallium/drivers/vc4/vc4_emit.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/gallium/drivers/vc4/vc4_emit.c b/src/gallium/drivers/vc4/vc4_emit.c index 8df7073e56c..68564410afc 100644 --- a/src/gallium/drivers/vc4/vc4_emit.c +++ b/src/gallium/drivers/vc4/vc4_emit.c @@ -28,12 +28,21 @@ vc4_emit_state(struct pipe_context *pctx) { struct vc4_context *vc4 = vc4_context(pctx); - if (vc4->dirty & VC4_DIRTY_SCISSOR) { + if (vc4->dirty & (VC4_DIRTY_SCISSOR | VC4_DIRTY_VIEWPORT)) { + float *vpscale = vc4->viewport.scale; + float *vptranslate = vc4->viewport.translate; + float vp_minx = -fabs(vpscale[0]) + vptranslate[0]; + float vp_maxx = fabs(vpscale[0]) + vptranslate[0]; + float vp_miny = -fabs(vpscale[1]) + vptranslate[1]; + float vp_maxy = fabs(vpscale[1]) + vptranslate[1]; + uint32_t minx = MAX2(vc4->scissor.minx, vp_minx); + uint32_t miny = MAX2(vc4->scissor.miny, vp_miny); + cl_u8(&vc4->bcl, VC4_PACKET_CLIP_WINDOW); - cl_u16(&vc4->bcl, vc4->scissor.minx); - cl_u16(&vc4->bcl, vc4->scissor.miny); - cl_u16(&vc4->bcl, vc4->scissor.maxx - vc4->scissor.minx); - cl_u16(&vc4->bcl, vc4->scissor.maxy - vc4->scissor.miny); + cl_u16(&vc4->bcl, minx); + cl_u16(&vc4->bcl, miny); + cl_u16(&vc4->bcl, MIN2(vc4->scissor.maxx, vp_maxx) - minx); + cl_u16(&vc4->bcl, MIN2(vc4->scissor.maxy, vp_maxy) - miny); } if (vc4->dirty & (VC4_DIRTY_RASTERIZER | VC4_DIRTY_ZSA)) { |