[Mesa-dev] [PATCH 05/22] anv: Enable HiZ support for multiple subpasses
Nanley Chery
nanleychery at gmail.com
Thu Jan 12 01:54:51 UTC 2017
We'll be using layout transitions later on in the series which can occur
within and between subpasses. Turn this on now to simplify the change
later.
Signed-off-by: Nanley Chery <nanley.g.chery at intel.com>
---
src/intel/vulkan/TODO | 2 +-
src/intel/vulkan/gen8_cmd_buffer.c | 11 +++++------
src/intel/vulkan/genX_cmd_buffer.c | 8 ++------
3 files changed, 8 insertions(+), 13 deletions(-)
diff --git a/src/intel/vulkan/TODO b/src/intel/vulkan/TODO
index 5c33725700..37fd16b437 100644
--- a/src/intel/vulkan/TODO
+++ b/src/intel/vulkan/TODO
@@ -9,7 +9,7 @@ Missing Features:
Performance:
- Sampling from HiZ (Nanley)
- - Multi-{sampled/gen8,LOD,subpass} HiZ
+ - Multi-{sampled/gen8,LOD} HiZ
- Compressed multisample support
- Pushing pieces of UBOs?
- Enable guardband clipping
diff --git a/src/intel/vulkan/gen8_cmd_buffer.c b/src/intel/vulkan/gen8_cmd_buffer.c
index 892a035304..81d7727130 100644
--- a/src/intel/vulkan/gen8_cmd_buffer.c
+++ b/src/intel/vulkan/gen8_cmd_buffer.c
@@ -340,10 +340,6 @@ genX(cmd_buffer_emit_hz_op)(struct anv_cmd_buffer *cmd_buffer,
if (iview == NULL || iview->image->aux_usage != ISL_AUX_USAGE_HIZ)
return;
- /* FINISHME: Implement multi-subpass HiZ */
- if (cmd_buffer->state.pass->subpass_count > 1)
- return;
-
const uint32_t ds = cmd_state->subpass->depth_stencil_attachment;
/* Section 7.4. of the Vulkan 1.0.27 spec states:
@@ -366,6 +362,8 @@ genX(cmd_buffer_emit_hz_op)(struct anv_cmd_buffer *cmd_buffer,
/* This variable corresponds to the Pixel Dim column in the table below */
struct isl_extent2d px_dim;
+ const uint32_t subpass_idx = cmd_state->subpass - cmd_state->pass->subpasses;
+
/* Validate that we can perform the HZ operation and that it's necessary. */
switch (op) {
case BLORP_HIZ_OP_DEPTH_CLEAR:
@@ -446,7 +444,8 @@ genX(cmd_buffer_emit_hz_op)(struct anv_cmd_buffer *cmd_buffer,
break;
case BLORP_HIZ_OP_DEPTH_RESOLVE:
if (cmd_buffer->state.pass->attachments[ds].store_op !=
- VK_ATTACHMENT_STORE_OP_STORE)
+ VK_ATTACHMENT_STORE_OP_STORE &&
+ subpass_idx == cmd_state->pass->subpass_count - 1)
return;
break;
case BLORP_HIZ_OP_HIZ_RESOLVE:
@@ -461,7 +460,7 @@ genX(cmd_buffer_emit_hz_op)(struct anv_cmd_buffer *cmd_buffer,
*/
if (full_surface_op &&
cmd_buffer->state.pass->attachments[ds].load_op !=
- VK_ATTACHMENT_LOAD_OP_LOAD)
+ VK_ATTACHMENT_LOAD_OP_LOAD && subpass_idx == 0)
return;
break;
case BLORP_HIZ_OP_NONE:
diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c
index 47d3322e48..b670d00e2d 100644
--- a/src/intel/vulkan/genX_cmd_buffer.c
+++ b/src/intel/vulkan/genX_cmd_buffer.c
@@ -2105,12 +2105,7 @@ cmd_buffer_emit_depth_stencil(struct anv_cmd_buffer *cmd_buffer)
depth_stencil_surface_type(image->depth_surface.isl.dim);
db.DepthWriteEnable = true;
db.StencilWriteEnable = has_stencil;
-
- if (cmd_buffer->state.pass->subpass_count == 1) {
- db.HierarchicalDepthBufferEnable = has_hiz;
- } else {
- anv_finishme("Multiple-subpass HiZ not implemented");
- }
+ db.HierarchicalDepthBufferEnable = has_hiz;
db.SurfaceFormat = isl_surf_get_depth_format(&device->isl_dev,
&image->depth_surface.isl);
@@ -2287,6 +2282,7 @@ void genX(CmdNextSubpass)(
assert(cmd_buffer->level == VK_COMMAND_BUFFER_LEVEL_PRIMARY);
+ genX(cmd_buffer_emit_hz_op)(cmd_buffer, BLORP_HIZ_OP_DEPTH_RESOLVE);
anv_cmd_buffer_resolve_subpass(cmd_buffer);
genX(cmd_buffer_set_subpass)(cmd_buffer, cmd_buffer->state.subpass + 1);
}
--
2.11.0
More information about the mesa-dev
mailing list