anv/image: Add a ussage_mask field to image_view_init

This allows us to avoid doing some unneeded work on the meta paths where we
know that the image view will be used for exactly one thing.  The meta
paths also sometimes do things that aren't quite valid like setting the
array slice on a 3-D texture and we want to limit the number of paths that
need to be able to sensibly handle the lies.
diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c
index 145db6d..4caab58 100644
--- a/src/intel/vulkan/anv_image.c
+++ b/src/intel/vulkan/anv_image.c
@@ -478,7 +478,8 @@
                     struct anv_device *device,
                     const VkImageViewCreateInfo* pCreateInfo,
                     struct anv_cmd_buffer *cmd_buffer,
-                    uint32_t offset)
+                    uint32_t offset,
+                    VkImageUsageFlags usage_mask)
 {
    ANV_FROM_HANDLE(anv_image, image, pCreateInfo->image);
    const VkImageSubresourceRange *range = &pCreateInfo->subresourceRange;
@@ -577,7 +578,7 @@
       cube_usage = 0;
    }
 
-   if (image->usage & VK_IMAGE_USAGE_SAMPLED_BIT) {
+   if (image->usage & usage_mask & VK_IMAGE_USAGE_SAMPLED_BIT) {
       iview->sampler_surface_state = alloc_surface_state(device, cmd_buffer);
 
       isl_view.usage = cube_usage | ISL_SURF_USAGE_TEXTURE_BIT;
@@ -594,7 +595,7 @@
       iview->sampler_surface_state.alloc_size = 0;
    }
 
-   if (image->usage & VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT) {
+   if (image->usage & usage_mask & VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT) {
       iview->color_rt_surface_state = alloc_surface_state(device, cmd_buffer);
 
       isl_view.usage = cube_usage | ISL_SURF_USAGE_RENDER_TARGET_BIT;
@@ -611,7 +612,7 @@
       iview->color_rt_surface_state.alloc_size = 0;
    }
 
-   if (image->usage & VK_IMAGE_USAGE_STORAGE_BIT) {
+   if (image->usage & usage_mask & VK_IMAGE_USAGE_STORAGE_BIT) {
       iview->storage_surface_state = alloc_surface_state(device, cmd_buffer);
 
       if (has_matching_storage_typed_format(device, format)) {
@@ -650,7 +651,7 @@
    if (view == NULL)
       return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
 
-   anv_image_view_init(view, device, pCreateInfo, NULL, 0);
+   anv_image_view_init(view, device, pCreateInfo, NULL, 0, ~0);
 
    *pView = anv_image_view_to_handle(view);