X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fintel%2Fvulkan%2Fanv_descriptor_set.c;h=2926e7a259141667fddf923cdefddc902603240b;hb=d6545f234593fb00d02fdc07f9b2a803d2b569f6;hp=4ab1802facb9649103041b89f4d5380dbdc80e01;hpb=d316cec1c1e3a77f63332f99883ffeeeb21a6f5e;p=mesa.git diff --git a/src/intel/vulkan/anv_descriptor_set.c b/src/intel/vulkan/anv_descriptor_set.c index 4ab1802facb..2926e7a2591 100644 --- a/src/intel/vulkan/anv_descriptor_set.c +++ b/src/intel/vulkan/anv_descriptor_set.c @@ -58,7 +58,7 @@ VkResult anv_CreateDescriptorSetLayout( (max_binding + 1) * sizeof(set_layout->binding[0]) + immutable_sampler_count * sizeof(struct anv_sampler *); - set_layout = anv_alloc2(&device->alloc, pAllocator, size, 8, + set_layout = vk_alloc2(&device->alloc, pAllocator, size, 8, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT); if (!set_layout) return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY); @@ -200,7 +200,10 @@ void anv_DestroyDescriptorSetLayout( ANV_FROM_HANDLE(anv_device, device, _device); ANV_FROM_HANDLE(anv_descriptor_set_layout, set_layout, _set_layout); - anv_free2(&device->alloc, pAllocator, set_layout); + if (!set_layout) + return; + + vk_free2(&device->alloc, pAllocator, set_layout); } static void @@ -228,7 +231,7 @@ VkResult anv_CreatePipelineLayout( assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO); - layout = anv_alloc2(&device->alloc, pAllocator, sizeof(*layout), 8, + layout = vk_alloc2(&device->alloc, pAllocator, sizeof(*layout), 8, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT); if (layout == NULL) return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY); @@ -282,7 +285,10 @@ void anv_DestroyPipelineLayout( ANV_FROM_HANDLE(anv_device, device, _device); ANV_FROM_HANDLE(anv_pipeline_layout, pipeline_layout, _pipelineLayout); - anv_free2(&device->alloc, pAllocator, pipeline_layout); + if (!pipeline_layout) + return; + + vk_free2(&device->alloc, pAllocator, pipeline_layout); } /* @@ -329,7 +335,7 @@ VkResult anv_CreateDescriptorPool( descriptor_count * sizeof(struct anv_descriptor) + buffer_count * sizeof(struct anv_buffer_view); - pool = anv_alloc2(&device->alloc, pAllocator, size, 8, + pool = vk_alloc2(&device->alloc, pAllocator, size, 8, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT); if (!pool) return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY); @@ -355,8 +361,11 @@ void anv_DestroyDescriptorPool( ANV_FROM_HANDLE(anv_device, device, _device); ANV_FROM_HANDLE(anv_descriptor_pool, pool, _pool); + if (!pool) + return; + anv_state_stream_finish(&pool->surface_state_stream); - anv_free2(&device->alloc, pAllocator, pool); + vk_free2(&device->alloc, pAllocator, pool); } VkResult anv_ResetDescriptorPool( @@ -393,7 +402,7 @@ layout_size(const struct anv_descriptor_set_layout *layout) struct surface_state_free_list_entry { void *next; - uint32_t offset; + struct anv_state state; }; VkResult @@ -463,10 +472,9 @@ anv_descriptor_set_create(struct anv_device *device, struct anv_state state; if (entry) { - state.map = entry; - state.offset = entry->offset; - state.alloc_size = 64; + state = entry->state; pool->surface_state_free_list = entry->next; + assert(state.alloc_size == 64); } else { state = anv_state_stream_alloc(&pool->surface_state_stream, 64, 64); } @@ -489,6 +497,7 @@ anv_descriptor_set_destroy(struct anv_device *device, struct surface_state_free_list_entry *entry = set->buffer_views[b].surface_state.map; entry->next = pool->surface_state_free_list; + entry->state = set->buffer_views[b].surface_state; pool->surface_state_free_list = entry; } @@ -546,6 +555,9 @@ VkResult anv_FreeDescriptorSets( for (uint32_t i = 0; i < count; i++) { ANV_FROM_HANDLE(anv_descriptor_set, set, pDescriptorSets[i]); + if (!set) + continue; + anv_descriptor_set_destroy(device, pool, set); } @@ -605,6 +617,7 @@ void anv_UpdateDescriptorSets( case VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE: case VK_DESCRIPTOR_TYPE_STORAGE_IMAGE: + case VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT: for (uint32_t j = 0; j < write->descriptorCount; j++) { ANV_FROM_HANDLE(anv_image_view, iview, write->pImageInfo[j].imageView); @@ -629,10 +642,6 @@ void anv_UpdateDescriptorSets( } break; - case VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT: - anv_finishme("input attachments not implemented"); - break; - case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER: case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER: case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC: