diff options
author | Samuel Pitoiset <[email protected]> | 2018-11-23 17:04:11 +0100 |
---|---|---|
committer | Samuel Pitoiset <[email protected]> | 2018-11-29 10:18:42 +0100 |
commit | 93f5ce8fa7ec777cb49bfa6f7afa3e140cfc5944 (patch) | |
tree | aaa8b3d15e44bc741ea96cab818ac4d07375f477 /src/amd/vulkan | |
parent | aeaf8dbd0970c5ea72b71f12fe5afd90aa280e44 (diff) |
radv: add radv_image_view_can_fast_clear() helper
Signed-off-by: Samuel Pitoiset <[email protected]>
Reviewed-by: Bas Nieuwenhuizen <[email protected]>
Diffstat (limited to 'src/amd/vulkan')
-rw-r--r-- | src/amd/vulkan/radv_meta_clear.c | 47 |
1 files changed, 27 insertions, 20 deletions
diff --git a/src/amd/vulkan/radv_meta_clear.c b/src/amd/vulkan/radv_meta_clear.c index d9acd194ce5..9c124c9b677 100644 --- a/src/amd/vulkan/radv_meta_clear.c +++ b/src/amd/vulkan/radv_meta_clear.c @@ -909,6 +909,31 @@ radv_image_can_fast_clear(struct radv_device *device, struct radv_image *image) return true; } +/** + * Determine if the given image view can be fast cleared. + */ +static bool +radv_image_view_can_fast_clear(struct radv_device *device, + const struct radv_image_view *iview) +{ + struct radv_image *image = iview->image; + + /* Only fast clear if the image itself can be fast cleared. */ + if (!radv_image_can_fast_clear(device, image)) + return false; + + /* Only fast clear if all layers are bound. */ + if (iview->base_layer > 0 || + iview->layer_count != image->info.array_size) + return false; + + /* Only fast clear if the view covers the whole image. */ + if (!radv_image_extent_compare(image, &iview->extent)) + return false; + + return true; +} + static bool emit_fast_htile_clear(struct radv_cmd_buffer *cmd_buffer, const VkClearAttachment *clear_att, @@ -926,21 +951,12 @@ emit_fast_htile_clear(struct radv_cmd_buffer *cmd_buffer, uint32_t clear_word, flush_bits; uint32_t htile_mask; - if (!radv_image_can_fast_clear(cmd_buffer->device, iview->image)) + if (!radv_image_view_can_fast_clear(cmd_buffer->device, iview)) return false; if (!radv_layout_is_htile_compressed(iview->image, image_layout, radv_image_queue_family_mask(iview->image, cmd_buffer->queue_family_index, cmd_buffer->queue_family_index))) return false; - /* all layers are bound */ - if (iview->base_layer > 0) - return false; - if (iview->image->info.array_size != iview->layer_count) - return false; - - if (!radv_image_extent_compare(iview->image, &iview->extent)) - return false; - if (clear_rect->rect.offset.x || clear_rect->rect.offset.y || clear_rect->rect.extent.width != iview->image->info.width || clear_rect->rect.extent.height != iview->image->info.height) @@ -1369,21 +1385,12 @@ emit_fast_color_clear(struct radv_cmd_buffer *cmd_buffer, uint32_t cmask_clear_value; bool ret; - if (!radv_image_can_fast_clear(cmd_buffer->device, iview->image)) + if (!radv_image_view_can_fast_clear(cmd_buffer->device, iview)) return false; if (!radv_layout_can_fast_clear(iview->image, image_layout, radv_image_queue_family_mask(iview->image, cmd_buffer->queue_family_index, cmd_buffer->queue_family_index))) return false; - /* all layers are bound */ - if (iview->base_layer > 0) - return false; - if (iview->image->info.array_size != iview->layer_count) - return false; - - if (!radv_image_extent_compare(iview->image, &iview->extent)) - return false; - if (clear_rect->rect.offset.x || clear_rect->rect.offset.y || clear_rect->rect.extent.width != iview->image->info.width || clear_rect->rect.extent.height != iview->image->info.height) |