summaryrefslogtreecommitdiffstats
path: root/src/intel/vulkan/anv_image.c
diff options
context:
space:
mode:
authorJason Ekstrand <jason.ekstrand@intel.com>2016-02-24 19:49:12 -0800
committerJason Ekstrand <jason.ekstrand@intel.com>2016-02-27 10:26:14 -0800
commite9d126f23b66751ae644c3125668ecf5d1e0f86b (patch)
treeea0ae923323dc5dbd40f6ee9c5108183bd017eeb /src/intel/vulkan/anv_image.c
parentb4c16fd01a4ea7f2fd579ee30b8a6a8d00bdc3b3 (diff)
downloadexternal_mesa3d-e9d126f23b66751ae644c3125668ecf5d1e0f86b.zip
external_mesa3d-e9d126f23b66751ae644c3125668ecf5d1e0f86b.tar.gz
external_mesa3d-e9d126f23b66751ae644c3125668ecf5d1e0f86b.tar.bz2
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.
Diffstat (limited to 'src/intel/vulkan/anv_image.c')
-rw-r--r--src/intel/vulkan/anv_image.c11
1 files changed, 6 insertions, 5 deletions
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 @@ 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);