aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2018-01-19 12:07:12 -0800
committerJason Ekstrand <[email protected]>2018-02-08 16:35:31 -0800
commit1810f965c8e490eac164732883d5242748b5911f (patch)
treecdaceb10132d5b84f515cc408dd51befd2f29c45
parentde3be6180169f95b781308398b31fbdd3db319e1 (diff)
anv: Allow fast-clearing the first slice of a multi-slice image
Now that we're tracking aux properly per-slice, we can enable this for applications which actually care. Reviewed-by: Topi Pohjolainen <[email protected]> Reviewed-by: Nanley Chery <[email protected]>
-rw-r--r--src/intel/vulkan/anv_blorp.c23
-rw-r--r--src/intel/vulkan/genX_cmd_buffer.c12
2 files changed, 23 insertions, 12 deletions
diff --git a/src/intel/vulkan/anv_blorp.c b/src/intel/vulkan/anv_blorp.c
index fc3b717982f..3939173bb16 100644
--- a/src/intel/vulkan/anv_blorp.c
+++ b/src/intel/vulkan/anv_blorp.c
@@ -1206,6 +1206,9 @@ anv_cmd_buffer_clear_subpass(struct anv_cmd_buffer *cmd_buffer)
image, VK_IMAGE_ASPECT_COLOR_BIT,
att_state->aux_usage, &surf);
+ uint32_t base_layer = iview->planes[0].isl.base_array_layer;
+ uint32_t layer_count = fb->layers;
+
if (att_state->fast_clear) {
surf.clear_color = vk_to_isl_color(att_state->clear_value.color);
@@ -1228,29 +1231,33 @@ anv_cmd_buffer_clear_subpass(struct anv_cmd_buffer *cmd_buffer)
cmd_buffer->state.pending_pipe_bits |=
ANV_PIPE_RENDER_TARGET_CACHE_FLUSH_BIT | ANV_PIPE_CS_STALL_BIT;
+ /* We only support fast-clears on the first layer */
+ assert(iview->planes[0].isl.base_level == 0);
+ assert(iview->planes[0].isl.base_array_layer == 0);
+
assert(image->n_planes == 1);
- blorp_fast_clear(&batch, &surf, iview->planes[0].isl.format,
- iview->planes[0].isl.base_level,
- iview->planes[0].isl.base_array_layer, fb->layers,
+ blorp_fast_clear(&batch, &surf, iview->planes[0].isl.format, 0, 0, 1,
render_area.offset.x, render_area.offset.y,
render_area.offset.x + render_area.extent.width,
render_area.offset.y + render_area.extent.height);
+ base_layer++;
+ layer_count--;
cmd_buffer->state.pending_pipe_bits |=
ANV_PIPE_RENDER_TARGET_CACHE_FLUSH_BIT | ANV_PIPE_CS_STALL_BIT;
- } else {
+ }
+
+ if (layer_count > 0) {
assert(image->n_planes == 1);
anv_cmd_buffer_mark_image_written(cmd_buffer, image,
VK_IMAGE_ASPECT_COLOR_BIT,
att_state->aux_usage,
iview->planes[0].isl.base_level,
- iview->planes[0].isl.base_array_layer,
- fb->layers);
+ base_layer, layer_count);
blorp_clear(&batch, &surf, iview->planes[0].isl.format,
anv_swizzle_for_render(iview->planes[0].isl.swizzle),
- iview->planes[0].isl.base_level,
- iview->planes[0].isl.base_array_layer, fb->layers,
+ iview->planes[0].isl.base_level, base_layer, layer_count,
render_area.offset.x, render_area.offset.y,
render_area.offset.x + render_area.extent.width,
render_area.offset.y + render_area.extent.height,
diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c
index 89654c221e0..f42860b411a 100644
--- a/src/intel/vulkan/genX_cmd_buffer.c
+++ b/src/intel/vulkan/genX_cmd_buffer.c
@@ -329,12 +329,16 @@ color_attachment_compute_aux_usage(struct anv_device * device,
*/
if (att_state->fast_clear &&
(iview->planes[0].isl.base_level > 0 ||
- iview->image->extent.depth > 0 ||
- iview->image->array_size > 0)) {
+ iview->planes[0].isl.base_array_layer > 0)) {
anv_perf_warn(device->instance, iview->image,
- "Rendering to a multi-LOD or multi-layer framebuffer "
- "with LOAD_OP_CLEAR. Not fast-clearing");
+ "Rendering with multi-lod or multi-layer framebuffer "
+ "with LOAD_OP_LOAD and baseMipLevel > 0 or "
+ "baseArrayLayer > 0. Not fast clearing.");
att_state->fast_clear = false;
+ } else if (att_state->fast_clear && cmd_state->framebuffer->layers > 1) {
+ anv_perf_warn(device->instance, iview->image,
+ "Rendering to a multi-layer framebuffer with "
+ "LOAD_OP_CLEAR. Only fast-clearing the first slice");
}
if (att_state->fast_clear) {