anv: Add support for depth bounds testing.
authorPlamena Manolova <plamena.manolova@intel.com>
Thu, 24 Oct 2019 20:05:11 +0000 (21:05 +0100)
committerPlamena Manolova <plamena.manolova@intel.com>
Mon, 28 Oct 2019 14:13:04 +0000 (14:13 +0000)
In gen12 we use the 3DSTATE_DEPTH_BOUNDS instruction
to enable depth bounds testing.

Signed-off-by: Plamena Manolova <plamena.manolova@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/intel/vulkan/anv_private.h
src/intel/vulkan/gen8_cmd_buffer.c
src/intel/vulkan/genX_pipeline.c

index ef246e4612ef52271d37f0016b180689df0ff856..cce986b74126a0d037957a5cdbfe4cf11751f31e 100644 (file)
@@ -2886,6 +2886,7 @@ struct anv_pipeline {
    bool                                         depth_clip_enable;
    bool                                         sample_shading_enable;
    bool                                         kill_pixel;
+   bool                                         depth_bounds_test_enable;
 
    struct {
       uint32_t                                  sf[7];
index e4f0c1410fb2be06cc3c4323e7b936c6fc7792dd..58e41f29315a8884084b8eeebfb19f4f079e367f 100644 (file)
@@ -542,6 +542,19 @@ genX(cmd_buffer_flush_dynamic_state)(struct anv_cmd_buffer *cmd_buffer)
    }
 #endif
 
+#if GEN_GEN >= 12
+   if(cmd_buffer->state.gfx.dirty & (ANV_CMD_DIRTY_PIPELINE |
+                                     ANV_CMD_DIRTY_DYNAMIC_DEPTH_BOUNDS)) {
+      anv_batch_emit(&cmd_buffer->batch, GENX(3DSTATE_DEPTH_BOUNDS), db) {
+         db.DepthBoundsTestValueModifyDisable = false;
+         db.DepthBoundsTestEnableModifyDisable = false;
+         db.DepthBoundsTestEnable = pipeline->depth_bounds_test_enable;
+         db.DepthBoundsTestMinValue = d->depth_bounds.min;
+         db.DepthBoundsTestMaxValue = d->depth_bounds.max;
+      }
+   }
+#endif
+
    if (cmd_buffer->state.gfx.dirty & ANV_CMD_DIRTY_DYNAMIC_LINE_STIPPLE) {
       anv_batch_emit(&cmd_buffer->batch, GENX(3DSTATE_LINE_STIPPLE), ls) {
          ls.LineStipplePattern = d->line_stipple.pattern;
index 88f5b358faf264f835bf37672893fd234a18b746..203b1f25310cc1e2988feda4fd4d32c60a97cb66 100644 (file)
@@ -1021,6 +1021,7 @@ emit_ds_state(struct anv_pipeline *pipeline,
    pipeline->stencil_test_enable = info.stencilTestEnable;
    pipeline->writes_depth = info.depthWriteEnable;
    pipeline->depth_test_enable = info.depthTestEnable;
+   pipeline->depth_bounds_test_enable = info.depthBoundsTestEnable;
 
    /* VkBool32 depthBoundsTestEnable; // optional (depth_bounds_test) */