[Mesa-dev] [PATCH] anv: ensure that we do not emit negative Depth in 3DSTATE_DEPTH_BUFFER

Iago Toral Quiroga itoral at igalia.com
Wed Feb 22 14:45:52 UTC 2017


This fixes a number of new CTS tests that would crash otherwise:
dEQP-VK.pipeline.render_to_image.*
---
 src/intel/vulkan/genX_cmd_buffer.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c
index 40a72f4..cdd4501 100644
--- a/src/intel/vulkan/genX_cmd_buffer.c
+++ b/src/intel/vulkan/genX_cmd_buffer.c
@@ -2270,7 +2270,8 @@ cmd_buffer_emit_depth_stencil(struct anv_cmd_buffer *cmd_buffer)
          assert(image->depth_surface.isl.dim != ISL_SURF_DIM_3D);
          db.Depth =
          db.RenderTargetViewExtent =
-            iview->isl.array_len - iview->isl.base_array_layer - 1;
+            iview->isl.array_len <= iview->isl.base_array_layer
+               ? 0 : iview->isl.array_len - iview->isl.base_array_layer - 1;
 
 #if GEN_GEN >= 8
          db.SurfaceQPitch =
-- 
2.7.4



More information about the mesa-dev mailing list