From: Eric Anholt Date: Fri, 12 Dec 2014 04:11:21 +0000 (-0800) Subject: vc4: Fix triangle-guardband-viewport piglit test. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0ae5e002e090c5e1bd237fa3f23549f9ab105a44;p=mesa.git vc4: Fix triangle-guardband-viewport piglit test. The original Broadcom driver also did this with the viewport. --- 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)) {