diff options
author | Jason Ekstrand <[email protected]> | 2016-02-24 19:49:12 -0800 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2016-02-27 10:26:14 -0800 |
commit | e9d126f23b66751ae644c3125668ecf5d1e0f86b (patch) | |
tree | ea0ae923323dc5dbd40f6ee9c5108183bd017eeb | |
parent | b4c16fd01a4ea7f2fd579ee30b8a6a8d00bdc3b3 (diff) |
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.
-rw-r--r-- | src/intel/vulkan/anv_image.c | 11 | ||||
-rw-r--r-- | src/intel/vulkan/anv_meta_blit.c | 20 | ||||
-rw-r--r-- | src/intel/vulkan/anv_meta_clear.c | 2 | ||||
-rw-r--r-- | src/intel/vulkan/anv_meta_resolve.c | 4 | ||||
-rw-r--r-- | src/intel/vulkan/anv_private.h | 3 |
5 files changed, 21 insertions, 19 deletions
diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c index 145db6de039..4caab5804ae 100644 --- a/src/intel/vulkan/anv_image.c +++ b/src/intel/vulkan/anv_image.c @@ -478,7 +478,8 @@ anv_image_view_init(struct anv_image_view *iview, 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 @@ anv_image_view_init(struct anv_image_view *iview, 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 @@ anv_image_view_init(struct anv_image_view *iview, 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 @@ anv_image_view_init(struct anv_image_view *iview, 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 @@ anv_CreateImageView(VkDevice _device, 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); diff --git a/src/intel/vulkan/anv_meta_blit.c b/src/intel/vulkan/anv_meta_blit.c index 8ef943aa512..2ec428b5f4a 100644 --- a/src/intel/vulkan/anv_meta_blit.c +++ b/src/intel/vulkan/anv_meta_blit.c @@ -451,7 +451,7 @@ do_buffer_copy(struct anv_cmd_buffer *cmd_buffer, .layerCount = 1 }, }, - cmd_buffer, 0); + cmd_buffer, 0, VK_IMAGE_USAGE_SAMPLED_BIT); struct anv_image_view dest_iview; anv_image_view_init(&dest_iview, cmd_buffer->device, @@ -468,7 +468,7 @@ do_buffer_copy(struct anv_cmd_buffer *cmd_buffer, .layerCount = 1, }, }, - cmd_buffer, 0); + cmd_buffer, 0, VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT); meta_emit_blit(cmd_buffer, anv_image_from_handle(src_image), @@ -711,7 +711,7 @@ void anv_CmdCopyImage( .layerCount = pRegions[r].dstSubresource.layerCount, }, }, - cmd_buffer, 0); + cmd_buffer, 0, VK_IMAGE_USAGE_SAMPLED_BIT); const uint32_t dest_base_array_slice = anv_meta_get_iview_layer(dest_image, &pRegions[r].dstSubresource, @@ -758,7 +758,7 @@ void anv_CmdCopyImage( .layerCount = 1 }, }, - cmd_buffer, img_o); + cmd_buffer, img_o, VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT); const VkExtent3D img_extent_el = meta_region_extent_el(dest_image->vk_format, &pRegions[r].extent); @@ -826,7 +826,7 @@ void anv_CmdBlitImage( .layerCount = 1 }, }, - cmd_buffer, 0); + cmd_buffer, 0, VK_IMAGE_USAGE_SAMPLED_BIT); const VkOffset3D dest_offset = { .x = pRegions[r].dstOffsets[0].x, @@ -876,7 +876,7 @@ void anv_CmdBlitImage( .layerCount = 1 }, }, - cmd_buffer, 0); + cmd_buffer, 0, VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT); meta_emit_blit(cmd_buffer, src_image, &src_iview, @@ -991,7 +991,7 @@ void anv_CmdCopyBufferToImage( .layerCount = 1, }, }, - cmd_buffer, 0); + cmd_buffer, 0, VK_IMAGE_USAGE_SAMPLED_BIT); uint32_t img_x = 0; uint32_t img_y = 0; @@ -1025,7 +1025,7 @@ void anv_CmdCopyBufferToImage( .layerCount = 1 }, }, - cmd_buffer, img_o); + cmd_buffer, img_o, VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT); const VkExtent3D img_extent_el = meta_region_extent_el(dest_image->vk_format, &pRegions[r].imageExtent); @@ -1104,7 +1104,7 @@ void anv_CmdCopyImageToBuffer( .layerCount = pRegions[r].imageSubresource.layerCount, }, }, - cmd_buffer, 0); + cmd_buffer, 0, VK_IMAGE_USAGE_SAMPLED_BIT); struct anv_image *dest_image = make_image_for_buffer(vk_device, destBuffer, src_image->vk_format, @@ -1140,7 +1140,7 @@ void anv_CmdCopyImageToBuffer( .layerCount = 1 }, }, - cmd_buffer, 0); + cmd_buffer, 0, VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT); meta_emit_blit(cmd_buffer, anv_image_from_handle(srcImage), diff --git a/src/intel/vulkan/anv_meta_clear.c b/src/intel/vulkan/anv_meta_clear.c index 739ae09582c..227f8f35115 100644 --- a/src/intel/vulkan/anv_meta_clear.c +++ b/src/intel/vulkan/anv_meta_clear.c @@ -811,7 +811,7 @@ anv_cmd_clear_image(struct anv_cmd_buffer *cmd_buffer, .layerCount = 1 }, }, - cmd_buffer, 0); + cmd_buffer, 0, VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT); VkFramebuffer fb; anv_CreateFramebuffer(device_h, diff --git a/src/intel/vulkan/anv_meta_resolve.c b/src/intel/vulkan/anv_meta_resolve.c index 8eb2548b5ae..19fb3ad3003 100644 --- a/src/intel/vulkan/anv_meta_resolve.c +++ b/src/intel/vulkan/anv_meta_resolve.c @@ -737,7 +737,7 @@ void anv_CmdResolveImage( .layerCount = 1, }, }, - cmd_buffer, 0); + cmd_buffer, 0, VK_IMAGE_USAGE_SAMPLED_BIT); struct anv_image_view dest_iview; anv_image_view_init(&dest_iview, cmd_buffer->device, @@ -754,7 +754,7 @@ void anv_CmdResolveImage( .layerCount = 1, }, }, - cmd_buffer, 0); + cmd_buffer, 0, VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT); VkFramebuffer fb_h; anv_CreateFramebuffer(device_h, diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index e50a6dbdbfe..05cb77c5509 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -1680,7 +1680,8 @@ void anv_image_view_init(struct anv_image_view *view, struct anv_device *device, const VkImageViewCreateInfo* pCreateInfo, struct anv_cmd_buffer *cmd_buffer, - uint32_t offset); + uint32_t offset, + VkImageUsageFlags usage_mask); void anv_fill_image_surface_state(struct anv_device *device, struct anv_state state, |