summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/vc4/vc4_emit.c19
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)) {