From d7cc9929bb5c82ded45f3a6345c4141348514c85 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Fri, 6 Nov 2015 13:16:15 -0800 Subject: [PATCH] anv: Remove all support for BufferViews We never *actually* supported them, we just used them for binding UBOs. Now that we have BufferInfo and we aren't supporting texture buffers yet, we should get rid of them until we can do them properly. --- src/vulkan/anv_cmd_buffer.c | 5 ----- src/vulkan/anv_device.c | 37 ++++++------------------------------- src/vulkan/anv_private.h | 15 --------------- src/vulkan/gen7_state.c | 24 ------------------------ src/vulkan/gen8_state.c | 24 ------------------------ 5 files changed, 6 insertions(+), 99 deletions(-) diff --git a/src/vulkan/anv_cmd_buffer.c b/src/vulkan/anv_cmd_buffer.c index 5ce57f1d98e..be8a537f656 100644 --- a/src/vulkan/anv_cmd_buffer.c +++ b/src/vulkan/anv_cmd_buffer.c @@ -605,11 +605,6 @@ anv_cmd_buffer_emit_binding_table(struct anv_cmd_buffer *cmd_buffer, case ANV_DESCRIPTOR_TYPE_SAMPLER: /* Nothing for us to do here */ continue; - case ANV_DESCRIPTOR_TYPE_BUFFER_VIEW: - surface_state = desc->buffer_view->surface_state; - bo = desc->buffer_view->bo; - bo_offset = desc->buffer_view->offset; - break; case ANV_DESCRIPTOR_TYPE_BUFFER_AND_OFFSET: { bo = desc->buffer->bo; bo_offset = desc->buffer->offset + desc->offset; diff --git a/src/vulkan/anv_device.c b/src/vulkan/anv_device.c index af5f8d25de1..2e330e6bbad 100644 --- a/src/vulkan/anv_device.c +++ b/src/vulkan/anv_device.c @@ -1429,44 +1429,19 @@ anv_fill_buffer_surface_state(struct anv_device *device, void *state, } } -VkResult -anv_buffer_view_create( - struct anv_device * device, - const VkBufferViewCreateInfo* pCreateInfo, - struct anv_buffer_view ** bview_out) +VkResult anv_CreateBufferView( + VkDevice _device, + const VkBufferViewCreateInfo* pCreateInfo, + VkBufferView* pView) { - ANV_FROM_HANDLE(anv_buffer, buffer, pCreateInfo->buffer); - struct anv_buffer_view *bview; - - assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO); - - bview = anv_device_alloc(device, sizeof(*bview), 8, - VK_SYSTEM_ALLOC_TYPE_API_OBJECT); - if (bview == NULL) - return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY); - - *bview = (struct anv_buffer_view) { - .bo = buffer->bo, - .offset = buffer->offset + pCreateInfo->offset, - .surface_state = anv_state_pool_alloc(&device->surface_state_pool, 64, 64), - .format = anv_format_for_vk_format(pCreateInfo->format), - .range = pCreateInfo->range, - }; - - *bview_out = bview; - - return VK_SUCCESS; + stub_return(VK_UNSUPPORTED); } void anv_DestroyBufferView( VkDevice _device, VkBufferView _bview) { - ANV_FROM_HANDLE(anv_device, device, _device); - ANV_FROM_HANDLE(anv_buffer_view, bview, _bview); - - anv_state_pool_free(&device->surface_state_pool, bview->surface_state); - anv_device_free(device, bview); + stub(); } void anv_DestroySampler( diff --git a/src/vulkan/anv_private.h b/src/vulkan/anv_private.h index 8000e9f5396..25f88fc8b84 100644 --- a/src/vulkan/anv_private.h +++ b/src/vulkan/anv_private.h @@ -726,7 +726,6 @@ struct anv_descriptor_set_layout { enum anv_descriptor_type { ANV_DESCRIPTOR_TYPE_EMPTY = 0, - ANV_DESCRIPTOR_TYPE_BUFFER_VIEW, ANV_DESCRIPTOR_TYPE_BUFFER_AND_OFFSET, ANV_DESCRIPTOR_TYPE_IMAGE_VIEW, ANV_DESCRIPTOR_TYPE_SAMPLER, @@ -739,7 +738,6 @@ struct anv_descriptor { union { struct { union { - struct anv_buffer_view *buffer_view; struct anv_image_view *image_view; }; struct anv_sampler *sampler; @@ -1317,14 +1315,6 @@ struct anv_image { }; }; -struct anv_buffer_view { - struct anv_state surface_state; /**< RENDER_SURFACE_STATE */ - struct anv_bo *bo; - uint32_t offset; /**< Offset into bo. */ - uint32_t range; /**< VkBufferViewCreateInfo::range */ - const struct anv_format *format; /**< VkBufferViewCreateInfo::format */ -}; - struct anv_image_view { const struct anv_image *image; /**< VkImageViewCreateInfo::image */ const struct anv_format *format; /**< VkImageViewCreateInfo::format */ @@ -1371,10 +1361,6 @@ gen8_image_view_init(struct anv_image_view *iview, const VkImageViewCreateInfo* pCreateInfo, struct anv_cmd_buffer *cmd_buffer); -VkResult anv_buffer_view_create(struct anv_device *device, - const VkBufferViewCreateInfo *pCreateInfo, - struct anv_buffer_view **bview_out); - void anv_fill_buffer_surface_state(struct anv_device *device, void *state, const struct anv_format *format, uint32_t offset, uint32_t range); @@ -1482,7 +1468,6 @@ ANV_DEFINE_HANDLE_CASTS(anv_queue, VkQueue) ANV_DEFINE_NONDISP_HANDLE_CASTS(anv_cmd_pool, VkCmdPool) ANV_DEFINE_NONDISP_HANDLE_CASTS(anv_buffer, VkBuffer) -ANV_DEFINE_NONDISP_HANDLE_CASTS(anv_buffer_view, VkBufferView); ANV_DEFINE_NONDISP_HANDLE_CASTS(anv_descriptor_set, VkDescriptorSet) ANV_DEFINE_NONDISP_HANDLE_CASTS(anv_descriptor_set_layout, VkDescriptorSetLayout) ANV_DEFINE_NONDISP_HANDLE_CASTS(anv_device_memory, VkDeviceMemory) diff --git a/src/vulkan/gen7_state.c b/src/vulkan/gen7_state.c index aef97838e17..0d67be4a99b 100644 --- a/src/vulkan/gen7_state.c +++ b/src/vulkan/gen7_state.c @@ -59,30 +59,6 @@ gen7_fill_buffer_surface_state(void *state, const struct anv_format *format, GEN7_RENDER_SURFACE_STATE_pack(NULL, state, &surface_state); } -VkResult gen7_CreateBufferView( - VkDevice _device, - const VkBufferViewCreateInfo* pCreateInfo, - VkBufferView* pView) -{ - ANV_FROM_HANDLE(anv_device, device, _device); - struct anv_buffer_view *bview; - VkResult result; - - result = anv_buffer_view_create(device, pCreateInfo, &bview); - if (result != VK_SUCCESS) - return result; - - const struct anv_format *format = - anv_format_for_vk_format(pCreateInfo->format); - - gen7_fill_buffer_surface_state(bview->surface_state.map, format, - bview->offset, pCreateInfo->range); - - *pView = anv_buffer_view_to_handle(bview); - - return VK_SUCCESS; -} - static const uint32_t vk_to_gen_tex_filter[] = { [VK_TEX_FILTER_NEAREST] = MAPFILTER_NEAREST, [VK_TEX_FILTER_LINEAR] = MAPFILTER_LINEAR diff --git a/src/vulkan/gen8_state.c b/src/vulkan/gen8_state.c index d9438127f2a..61aede99ad4 100644 --- a/src/vulkan/gen8_state.c +++ b/src/vulkan/gen8_state.c @@ -63,30 +63,6 @@ gen8_fill_buffer_surface_state(void *state, const struct anv_format *format, GEN8_RENDER_SURFACE_STATE_pack(NULL, state, &surface_state); } -VkResult gen8_CreateBufferView( - VkDevice _device, - const VkBufferViewCreateInfo* pCreateInfo, - VkBufferView* pView) -{ - ANV_FROM_HANDLE(anv_device, device, _device); - struct anv_buffer_view *bview; - VkResult result; - - result = anv_buffer_view_create(device, pCreateInfo, &bview); - if (result != VK_SUCCESS) - return result; - - const struct anv_format *format = - anv_format_for_vk_format(pCreateInfo->format); - - gen8_fill_buffer_surface_state(bview->surface_state.map, format, - bview->offset, pCreateInfo->range); - - *pView = anv_buffer_view_to_handle(bview); - - return VK_SUCCESS; -} - static const uint8_t anv_halign[] = { [4] = HALIGN4, [8] = HALIGN8, -- 2.30.2