From 3eebf3686be3de10cbeda8acd884e82df3e1438a Mon Sep 17 00:00:00 2001 From: Chad Versace Date: Thu, 4 Feb 2016 11:58:05 -0800 Subject: [PATCH] anv: Drop anv_image::needs_*_surface_state anv_image::needs_sampler_surface_state was a redundant member, identical to (usage & VK_IMAGE_USAGE_SAMPLED_BIT). Likewise for the other needs_* members. --- src/vulkan/anv_image.c | 24 ++++++------------------ src/vulkan/anv_private.h | 4 ---- 2 files changed, 6 insertions(+), 22 deletions(-) diff --git a/src/vulkan/anv_image.c b/src/vulkan/anv_image.c index be91cdc5d92..da71406cf27 100644 --- a/src/vulkan/anv_image.c +++ b/src/vulkan/anv_image.c @@ -215,18 +215,6 @@ anv_image_create(VkDevice _device, image->usage = anv_image_get_full_usage(pCreateInfo); image->tiling = pCreateInfo->tiling; - if (image->usage & VK_IMAGE_USAGE_SAMPLED_BIT) { - image->needs_sampler_surface_state = true; - } - - if (image->usage & VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT) { - image->needs_color_rt_surface_state = true; - } - - if (image->usage & VK_IMAGE_USAGE_STORAGE_BIT) { - image->needs_storage_surface_state = true; - } - if (likely(anv_format_is_color(image->format))) { r = make_surface(device, image, create_info, VK_IMAGE_ASPECT_COLOR_BIT); @@ -570,7 +558,7 @@ anv_image_view_init(struct anv_image_view *iview, .depth = anv_minify(iview->level_0_extent.depth , range->baseMipLevel), }; - if (image->needs_sampler_surface_state) { + if (image->usage & VK_IMAGE_USAGE_SAMPLED_BIT) { iview->sampler_surface_state = alloc_surface_state(device, cmd_buffer); anv_fill_image_surface_state(device, iview->sampler_surface_state, @@ -580,7 +568,7 @@ anv_image_view_init(struct anv_image_view *iview, iview->sampler_surface_state.alloc_size = 0; } - if (image->needs_color_rt_surface_state) { + if (image->usage & VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT) { iview->color_rt_surface_state = alloc_surface_state(device, cmd_buffer); anv_fill_image_surface_state(device, iview->color_rt_surface_state, @@ -590,7 +578,7 @@ anv_image_view_init(struct anv_image_view *iview, iview->color_rt_surface_state.alloc_size = 0; } - if (image->needs_storage_surface_state) { + if (image->usage & VK_IMAGE_USAGE_STORAGE_BIT) { iview->storage_surface_state = alloc_surface_state(device, cmd_buffer); if (has_matching_storage_typed_format(device, iview->format)) @@ -636,17 +624,17 @@ anv_DestroyImageView(VkDevice _device, VkImageView _iview, ANV_FROM_HANDLE(anv_device, device, _device); ANV_FROM_HANDLE(anv_image_view, iview, _iview); - if (iview->image->needs_color_rt_surface_state) { + if (iview->color_rt_surface_state.alloc_size > 0) { anv_state_pool_free(&device->surface_state_pool, iview->color_rt_surface_state); } - if (iview->image->needs_sampler_surface_state) { + if (iview->sampler_surface_state.alloc_size > 0) { anv_state_pool_free(&device->surface_state_pool, iview->sampler_surface_state); } - if (iview->image->needs_storage_surface_state) { + if (iview->storage_surface_state.alloc_size > 0) { anv_state_pool_free(&device->surface_state_pool, iview->storage_surface_state); } diff --git a/src/vulkan/anv_private.h b/src/vulkan/anv_private.h index 8c4136b8cfd..8e12792456b 100644 --- a/src/vulkan/anv_private.h +++ b/src/vulkan/anv_private.h @@ -1552,10 +1552,6 @@ struct anv_image { struct anv_bo *bo; VkDeviceSize offset; - bool needs_sampler_surface_state:1; - bool needs_color_rt_surface_state:1; - bool needs_storage_surface_state:1; - /** * Image subsurfaces * -- 2.30.2