anv: allow baking of 3DSTATE_DEPTH_BOUNDS in pipeline batch
authorLionel Landwerlin <lionel.g.landwerlin@intel.com>
Wed, 9 Mar 2022 14:37:49 +0000 (16:37 +0200)
committerMarge Bot <emma+marge@anholt.net>
Thu, 24 Mar 2022 10:49:07 +0000 (10:49 +0000)
If it's not dynamic.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15310>

src/intel/vulkan/anv_pipeline.c
src/intel/vulkan/genX_pipeline.c

index 3915872..52b6430 100644 (file)
@@ -2398,7 +2398,9 @@ copy_non_dynamic_state(struct anv_graphics_pipeline *pipeline,
        ANV_CMD_DIRTY_DYNAMIC_SHADING_RATE |
        ANV_CMD_DIRTY_DYNAMIC_RASTERIZER_DISCARD_ENABLE |
        ANV_CMD_DIRTY_DYNAMIC_LOGIC_OP |
-       ANV_CMD_DIRTY_DYNAMIC_PRIMITIVE_TOPOLOGY);
+       ANV_CMD_DIRTY_DYNAMIC_PRIMITIVE_TOPOLOGY |
+       ANV_CMD_DIRTY_DYNAMIC_DEPTH_BOUNDS |
+       ANV_CMD_DIRTY_DYNAMIC_DEPTH_BOUNDS_TEST_ENABLE);
 }
 
 /**
index c9b8aea..a78bc30 100644 (file)
@@ -1295,6 +1295,19 @@ emit_ds_state(struct anv_graphics_pipeline *pipeline,
 #else
    GENX(3DSTATE_WM_DEPTH_STENCIL_pack)(NULL, depth_stencil_dw, &depth_stencil);
 #endif
+
+#if GFX_VER >= 12
+   if ((dynamic_states & (ANV_CMD_DIRTY_DYNAMIC_DEPTH_BOUNDS |
+                          ANV_CMD_DIRTY_DYNAMIC_DEPTH_BOUNDS_TEST_ENABLE)) == 0) {
+      anv_batch_emit(&pipeline->base.batch, GENX(3DSTATE_DEPTH_BOUNDS), db) {
+         db.DepthBoundsTestValueModifyDisable = false;
+         db.DepthBoundsTestEnableModifyDisable = false;
+         db.DepthBoundsTestEnable = pCreateInfo->depthBoundsTestEnable;
+         db.DepthBoundsTestMinValue = pCreateInfo->minDepthBounds;
+         db.DepthBoundsTestMaxValue = pCreateInfo->maxDepthBounds;
+      }
+   }
+#endif
 }
 
 static bool