summaryrefslogtreecommitdiffstats
path: root/src/intel/vulkan/genX_cmd_buffer.c
diff options
context:
space:
mode:
authorNanley Chery <nanley.g.chery@intel.com>2016-10-07 12:07:31 -0700
committerNanley Chery <nanley.g.chery@intel.com>2016-10-07 12:54:18 -0700
commitd8aacc24cc37dc435e250668aba0817c36996ad1 (patch)
treede29be15d16e9acf5f973c0cd8abaea15a75ca78 /src/intel/vulkan/genX_cmd_buffer.c
parent78d074b87a75d599e65ef34f5b866da577b80de3 (diff)
downloadexternal_mesa3d-d8aacc24cc37dc435e250668aba0817c36996ad1.zip
external_mesa3d-d8aacc24cc37dc435e250668aba0817c36996ad1.tar.gz
external_mesa3d-d8aacc24cc37dc435e250668aba0817c36996ad1.tar.bz2
anv: Enable fast depth clears
Provides an FPS increase of ~30% on the Sascha triangle and multisampling demos. Signed-off-by: Nanley Chery <nanley.g.chery@intel.com> Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> Reviewed-by: Chad Versace <chadversary@chromium.org>
Diffstat (limited to 'src/intel/vulkan/genX_cmd_buffer.c')
-rw-r--r--src/intel/vulkan/genX_cmd_buffer.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c
index 7dd4039..b1fa6ee 100644
--- a/src/intel/vulkan/genX_cmd_buffer.c
+++ b/src/intel/vulkan/genX_cmd_buffer.c
@@ -1322,8 +1322,27 @@ cmd_buffer_emit_depth_stencil(struct anv_cmd_buffer *cmd_buffer)
anv_batch_emit(&cmd_buffer->batch, GENX(3DSTATE_STENCIL_BUFFER), sb);
}
- /* Clear the clear params. */
- anv_batch_emit(&cmd_buffer->batch, GENX(3DSTATE_CLEAR_PARAMS), cp);
+ /* From the IVB PRM Vol2P1, 11.5.5.4 3DSTATE_CLEAR_PARAMS:
+ *
+ * 3DSTATE_CLEAR_PARAMS must always be programmed in the along with
+ * the other Depth/Stencil state commands(i.e. 3DSTATE_DEPTH_BUFFER,
+ * 3DSTATE_STENCIL_BUFFER, or 3DSTATE_HIER_DEPTH_BUFFER)
+ *
+ * Testing also shows that some variant of this restriction may exist HSW+.
+ * On BDW+, it is not possible to emit 2 of these packets consecutively when
+ * both have DepthClearValueValid set. An analysis of such state programming
+ * on SKL showed that the GPU doesn't register the latter packet's clear
+ * value.
+ */
+ anv_batch_emit(&cmd_buffer->batch, GENX(3DSTATE_CLEAR_PARAMS), cp) {
+ if (has_hiz) {
+ cp.DepthClearValueValid = true;
+ const uint32_t ds =
+ cmd_buffer->state.subpass->depth_stencil_attachment;
+ cp.DepthClearValue =
+ cmd_buffer->state.attachments[ds].clear_value.depthStencil.depth;
+ }
+ }
}
static void
@@ -1336,6 +1355,7 @@ genX(cmd_buffer_set_subpass)(struct anv_cmd_buffer *cmd_buffer,
cmd_buffer_emit_depth_stencil(cmd_buffer);
genX(cmd_buffer_emit_hz_op)(cmd_buffer, BLORP_HIZ_OP_HIZ_RESOLVE);
+ genX(cmd_buffer_emit_hz_op)(cmd_buffer, BLORP_HIZ_OP_DEPTH_CLEAR);
anv_cmd_buffer_clear_subpass(cmd_buffer);
}