anv: Clamp depth buffer dimensions to be at least 1.
authorKenneth Graunke <kenneth@whitecape.org>
Thu, 29 Sep 2016 18:53:17 +0000 (11:53 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Tue, 10 Jan 2017 21:27:31 +0000 (13:27 -0800)
When there are no framebuffer attachments, fb->width and fb->height will
be 0.  Subtracting 1 results in 4294967295 which is too large for the
field, causing genxml assertions when trying to create the packet.

In this case, we can just program it to 1.

Caught by dEQP-VK.tessellation.tesscoord.triangles_equal_spacing.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/intel/vulkan/genX_cmd_buffer.c

index 6131cfb60e38e7d2a9ffceb8e9c09a6b27aceb23..0c638d6b02dccfbca61516475bcb9fd2e6ae098e 100644 (file)
@@ -2159,8 +2159,8 @@ cmd_buffer_emit_depth_stencil(struct anv_cmd_buffer *cmd_buffer)
             db.SurfaceType       = SURFTYPE_2D;
          }
          db.SurfaceFormat        = D32_FLOAT;
-         db.Width                = fb->width - 1;
-         db.Height               = fb->height - 1;
+         db.Width                = MAX2(fb->width, 1) - 1;
+         db.Height               = MAX2(fb->height, 1) - 1;
          db.StencilWriteEnable   = has_stencil;
       }
    }