Mesa (master): anv: Clamp depth buffer dimensions to be at least 1.

Kenneth Graunke kwg at kemper.freedesktop.org
Tue Jan 10 22:04:12 UTC 2017


Module: Mesa
Branch: master
Commit: dcca706b4e2d2086b90d77cced0cff6ce4eac953
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=dcca706b4e2d2086b90d77cced0cff6ce4eac953

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Thu Sep 29 11:53:17 2016 -0700

anv: Clamp depth buffer dimensions to be at least 1.

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 at whitecape.org>
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>

---

 src/intel/vulkan/genX_cmd_buffer.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c
index 6131cfb..0c638d6 100644
--- a/src/intel/vulkan/genX_cmd_buffer.c
+++ b/src/intel/vulkan/genX_cmd_buffer.c
@@ -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;
       }
    }




More information about the mesa-commit mailing list