Module: Mesa
Branch: main
Commit: 1cd7d6ce37951f51b79056124a22701e75d14d3a
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=1cd7d6ce37951f51b79056124a22701e75d14d3a

Author: Lionel Landwerlin <[email protected]>
Date:   Wed Mar  9 16:37:49 2022 +0200

anv: allow baking of 3DSTATE_DEPTH_BOUNDS in pipeline batch

If it's not dynamic.

Signed-off-by: Lionel Landwerlin <[email protected]>
Reviewed-by: Tapani Pälli <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15310>

---

 src/intel/vulkan/anv_pipeline.c  |  4 +++-
 src/intel/vulkan/genX_pipeline.c | 13 +++++++++++++
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/src/intel/vulkan/anv_pipeline.c b/src/intel/vulkan/anv_pipeline.c
index 3915872bc46..52b6430bb32 100644
--- a/src/intel/vulkan/anv_pipeline.c
+++ b/src/intel/vulkan/anv_pipeline.c
@@ -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);
 }
 
 /**
diff --git a/src/intel/vulkan/genX_pipeline.c b/src/intel/vulkan/genX_pipeline.c
index c9b8aea2201..a78bc3007c9 100644
--- a/src/intel/vulkan/genX_pipeline.c
+++ b/src/intel/vulkan/genX_pipeline.c
@@ -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

Reply via email to