[Mesa-dev] [PATCH 09/11] anv/image: zalloc image views

Jason Ekstrand jason at jlekstrand.net
Wed Jul 12 00:04:38 UTC 2017


This allows us to avoid some extra zeroing.
---
 src/intel/vulkan/anv_image.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c
index 7c4655d..af50ebd 100644
--- a/src/intel/vulkan/anv_image.c
+++ b/src/intel/vulkan/anv_image.c
@@ -567,7 +567,7 @@ anv_CreateImageView(VkDevice _device,
    ANV_FROM_HANDLE(anv_image, image, pCreateInfo->image);
    struct anv_image_view *iview;
 
-   iview = vk_alloc2(&device->alloc, pAllocator, sizeof(*iview), 8,
+   iview = vk_zalloc2(&device->alloc, pAllocator, sizeof(*iview), 8,
                       VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
    if (iview == NULL)
       return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
@@ -694,9 +694,6 @@ anv_CreateImageView(VkDevice _device,
 
       anv_state_flush(device, iview->optimal_sampler_surface_state);
       anv_state_flush(device, iview->general_sampler_surface_state);
-   } else {
-      iview->optimal_sampler_surface_state.alloc_size = 0;
-      iview->general_sampler_surface_state.alloc_size = 0;
    }
 
    /* NOTE: This one needs to go last since it may stomp isl_view.format */
@@ -747,9 +744,6 @@ anv_CreateImageView(VkDevice _device,
 
       anv_state_flush(device, iview->storage_surface_state);
       anv_state_flush(device, iview->writeonly_storage_surface_state);
-   } else {
-      iview->storage_surface_state.alloc_size = 0;
-      iview->writeonly_storage_surface_state.alloc_size = 0;
    }
 
    *pView = anv_image_view_to_handle(iview);
-- 
2.5.0.400.gff86faf



More information about the mesa-dev mailing list