summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2016-03-30 15:20:11 -0700
committerJason Ekstrand <[email protected]>2016-04-08 15:57:55 -0700
commit4caba940869602b750e21a444523b068b1bea339 (patch)
tree5cb27628d4408ae91038f740b320819acac42fc9
parent4ee80e8816091869943d98cbe261c49406bb8039 (diff)
anv/image: Expose the guts of CreateBufferView for meta
Reviewed-by: Nanley Chery <[email protected]>
-rw-r--r--src/intel/vulkan/anv_image.c40
-rw-r--r--src/intel/vulkan/anv_private.h5
2 files changed, 29 insertions, 16 deletions
diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c
index 266fbe73ddc..759c8612005 100644
--- a/src/intel/vulkan/anv_image.c
+++ b/src/intel/vulkan/anv_image.c
@@ -646,20 +646,13 @@ anv_DestroyImageView(VkDevice _device, VkImageView _iview,
anv_free2(&device->alloc, pAllocator, iview);
}
-VkResult
-anv_CreateBufferView(VkDevice _device,
- const VkBufferViewCreateInfo *pCreateInfo,
- const VkAllocationCallbacks *pAllocator,
- VkBufferView *pView)
+
+void anv_buffer_view_init(struct anv_buffer_view *view,
+ struct anv_device *device,
+ const VkBufferViewCreateInfo* pCreateInfo,
+ struct anv_cmd_buffer *cmd_buffer)
{
- ANV_FROM_HANDLE(anv_device, device, _device);
ANV_FROM_HANDLE(anv_buffer, buffer, pCreateInfo->buffer);
- struct anv_buffer_view *view;
-
- view = anv_alloc2(&device->alloc, pAllocator, sizeof(*view), 8,
- VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
- if (!view)
- return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
const struct anv_format *format =
anv_format_for_vk_format(pCreateInfo->format);
@@ -671,8 +664,7 @@ anv_CreateBufferView(VkDevice _device,
buffer->size - view->offset : pCreateInfo->range;
if (buffer->usage & VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT) {
- view->surface_state =
- anv_state_pool_alloc(&device->surface_state_pool, 64, 64);
+ view->surface_state = alloc_surface_state(device, cmd_buffer);
anv_fill_buffer_surface_state(device, view->surface_state,
view->format,
@@ -683,8 +675,7 @@ anv_CreateBufferView(VkDevice _device,
}
if (buffer->usage & VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT) {
- view->storage_surface_state =
- anv_state_pool_alloc(&device->surface_state_pool, 64, 64);
+ view->storage_surface_state = alloc_surface_state(device, cmd_buffer);
enum isl_format storage_format =
has_matching_storage_typed_format(device, view->format) ?
@@ -703,6 +694,23 @@ anv_CreateBufferView(VkDevice _device,
} else {
view->storage_surface_state = (struct anv_state){ 0 };
}
+}
+
+VkResult
+anv_CreateBufferView(VkDevice _device,
+ const VkBufferViewCreateInfo *pCreateInfo,
+ const VkAllocationCallbacks *pAllocator,
+ VkBufferView *pView)
+{
+ ANV_FROM_HANDLE(anv_device, device, _device);
+ struct anv_buffer_view *view;
+
+ view = anv_alloc2(&device->alloc, pAllocator, sizeof(*view), 8,
+ VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
+ if (!view)
+ return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
+
+ anv_buffer_view_init(view, device, pCreateInfo, NULL);
*pView = anv_buffer_view_to_handle(view);
diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h
index 1a18dd15e65..a394fe8a683 100644
--- a/src/intel/vulkan/anv_private.h
+++ b/src/intel/vulkan/anv_private.h
@@ -1682,6 +1682,11 @@ struct anv_buffer_view {
struct brw_image_param storage_image_param;
};
+void anv_buffer_view_init(struct anv_buffer_view *view,
+ struct anv_device *device,
+ const VkBufferViewCreateInfo* pCreateInfo,
+ struct anv_cmd_buffer *cmd_buffer);
+
const struct anv_format *
anv_format_for_descriptor_type(VkDescriptorType type);