v3d: Handle a no-intersection scissor even if it's outside of the VP.
authorEric Anholt <eric@anholt.net>
Fri, 15 Jun 2018 01:05:50 +0000 (18:05 -0700)
committerEric Anholt <eric@anholt.net>
Fri, 15 Jun 2018 23:09:39 +0000 (16:09 -0700)
The min/maxes ended up producing a negative clip width/height for
dEQP-GLES3.functional.fragment_ops.scissor.outside_render_line.  Just make
sure they stay at 0 (or v3d 3.x's workaround) if that happens.

src/gallium/drivers/v3d/v3dx_emit.c

index ac93badfda89ef97150b6909414a7d1f9d8b8555..344f9e464f2d9e092a82a0f95ba3f178aa378699 100644 (file)
@@ -343,20 +343,18 @@ v3dX(emit_state)(struct pipe_context *pctx)
                 cl_emit(&job->bcl, CLIP_WINDOW, clip) {
                         clip.clip_window_left_pixel_coordinate = minx;
                         clip.clip_window_bottom_pixel_coordinate = miny;
-                        clip.clip_window_width_in_pixels = maxx - minx;
-                        clip.clip_window_height_in_pixels = maxy - miny;
-
-#if V3D_VERSION < 41
-                        /* The HW won't entirely clip out when scissor w/h is
-                         * 0.  Just treat it the same as rasterizer discard.
-                         */
-                        if (clip.clip_window_width_in_pixels == 0 ||
-                            clip.clip_window_height_in_pixels == 0) {
+                        if (maxx > minx && maxy > miny) {
+                                clip.clip_window_width_in_pixels = maxx - minx;
+                                clip.clip_window_height_in_pixels = maxy - miny;
+                        } else if (V3D_VERSION < 41) {
+                                /* The HW won't entirely clip out when scissor
+                                 * w/h is 0.  Just treat it the same as
+                                 * rasterizer discard.
+                                 */
                                 rasterizer_discard = true;
                                 clip.clip_window_width_in_pixels = 1;
                                 clip.clip_window_height_in_pixels = 1;
                         }
-#endif
                 }
 
                 job->draw_min_x = MIN2(job->draw_min_x, minx);