diff options
author | Jason Ekstrand <jason@jlekstrand.net> | 2020-06-13 13:57:32 -0500 |
---|---|---|
committer | Marge Bot <eric+marge@anholt.net> | 2020-06-16 17:02:44 +0000 |
commit | 8f9b8af78250fe7644622580c53559caa81d155e (patch) | |
tree | 006181a4c81e35bdd177137860f1cff19c9d77a0 /src/intel/vulkan/genX_pipeline.c | |
parent | 1b693341ac9c0e07b794307180a105d357d09e61 (diff) |
anv: Add anv_pipeline_init/finish helpers
This cleans up pipline create/destroy a bit after the compute/gfx split.
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5457>
Diffstat (limited to 'src/intel/vulkan/genX_pipeline.c')
-rw-r--r-- | src/intel/vulkan/genX_pipeline.c | 26 |
1 files changed, 7 insertions, 19 deletions
diff --git a/src/intel/vulkan/genX_pipeline.c b/src/intel/vulkan/genX_pipeline.c index d83716bfedf..cfb9fedb201 100644 --- a/src/intel/vulkan/genX_pipeline.c +++ b/src/intel/vulkan/genX_pipeline.c @@ -2168,8 +2168,8 @@ genX(graphics_pipeline_create)( if (pipeline == NULL) return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY); - result = anv_pipeline_init(pipeline, device, cache, - pCreateInfo, pAllocator); + result = anv_graphics_pipeline_init(pipeline, device, cache, + pCreateInfo, pAllocator); if (result != VK_SUCCESS) { vk_free2(&device->vk.alloc, pAllocator, pipeline); return result; @@ -2285,38 +2285,26 @@ compute_pipeline_create( if (pipeline == NULL) return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY); - vk_object_base_init(&device->vk, &pipeline->base.base, - VK_OBJECT_TYPE_PIPELINE); - pipeline->base.device = device; - pipeline->base.type = ANV_PIPELINE_COMPUTE; - - const VkAllocationCallbacks *alloc = - pAllocator ? pAllocator : &device->vk.alloc; - - result = anv_reloc_list_init(&pipeline->base.batch_relocs, alloc); + result = anv_pipeline_init(&pipeline->base, device, + ANV_PIPELINE_COMPUTE, pCreateInfo->flags, + pAllocator); if (result != VK_SUCCESS) { vk_free2(&device->vk.alloc, pAllocator, pipeline); return result; } - pipeline->base.batch.alloc = alloc; - pipeline->base.batch.relocs = &pipeline->base.batch_relocs; - pipeline->base.batch.status = VK_SUCCESS; + anv_batch_set_storage(&pipeline->base.batch, ANV_NULL_ADDRESS, pipeline->batch_data, sizeof(pipeline->batch_data)); - pipeline->base.mem_ctx = ralloc_context(NULL); - pipeline->base.flags = pCreateInfo->flags; pipeline->cs = NULL; - util_dynarray_init(&pipeline->base.executables, pipeline->base.mem_ctx); - assert(pCreateInfo->stage.stage == VK_SHADER_STAGE_COMPUTE_BIT); ANV_FROM_HANDLE(anv_shader_module, module, pCreateInfo->stage.module); result = anv_pipeline_compile_cs(pipeline, cache, pCreateInfo, module, pCreateInfo->stage.pName, pCreateInfo->stage.pSpecializationInfo); if (result != VK_SUCCESS) { - ralloc_free(pipeline->base.mem_ctx); + anv_pipeline_finish(&pipeline->base, device, pAllocator); vk_free2(&device->vk.alloc, pAllocator, pipeline); return result; } |