anv: Add a ralloc context to anv_pipeline
authorJason Ekstrand <jason@jlekstrand.net>
Wed, 24 Apr 2019 07:21:01 +0000 (02:21 -0500)
committerJason Ekstrand <jason@jlekstrand.net>
Mon, 12 Aug 2019 22:56:07 +0000 (22:56 +0000)
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
src/intel/vulkan/anv_pipeline.c
src/intel/vulkan/anv_private.h
src/intel/vulkan/genX_pipeline.c

index 1d0226676f6edaaef00b3385d6bdf4715df673c6..fc492844cce3f9830a245eedf5fbd7289d216d9e 100644 (file)
@@ -297,6 +297,9 @@ void anv_DestroyPipeline(
 
    anv_reloc_list_finish(&pipeline->batch_relocs,
                          pAllocator ? pAllocator : &device->alloc);
+
+   ralloc_free(pipeline->mem_ctx);
+
    if (pipeline->blend_state.map)
       anv_state_pool_free(&device->dynamic_state_pool, pipeline->blend_state);
 
@@ -1794,6 +1797,7 @@ anv_pipeline_init(struct anv_pipeline *pipeline,
    pipeline->batch.relocs = &pipeline->batch_relocs;
    pipeline->batch.status = VK_SUCCESS;
 
+   pipeline->mem_ctx = ralloc_context(NULL);
    pipeline->flags = pCreateInfo->flags;
 
    copy_non_dynamic_state(pipeline, pCreateInfo);
@@ -1822,6 +1826,7 @@ anv_pipeline_init(struct anv_pipeline *pipeline,
 
    result = anv_pipeline_compile_graphics(pipeline, cache, pCreateInfo);
    if (result != VK_SUCCESS) {
+      ralloc_free(pipeline->mem_ctx);
       anv_reloc_list_finish(&pipeline->batch_relocs, alloc);
       return result;
    }
index ad2de7fae76133c503be84dd9376b10627e45f54..5682e838abfa31de46b86cff6e36c7f9e3ecdac6 100644 (file)
@@ -2802,6 +2802,8 @@ struct anv_pipeline {
    anv_cmd_dirty_mask_t                         dynamic_state_mask;
    struct anv_dynamic_state                     dynamic_state;
 
+   void *                                       mem_ctx;
+
    VkPipelineCreateFlags                        flags;
    struct anv_subpass *                         subpass;
 
index 0fc25f8f9ff89f659b34327286fc0f3b3acc4947..e0e723c13a41b9f72248c8d32c6f3947f63804ff 100644 (file)
@@ -2226,6 +2226,7 @@ compute_pipeline_create(
    pipeline->batch.relocs = &pipeline->batch_relocs;
    pipeline->batch.status = VK_SUCCESS;
 
+   pipeline->mem_ctx = ralloc_context(NULL);
    pipeline->flags = pCreateInfo->flags;
 
    /* When we free the pipeline, we detect stages based on the NULL status
@@ -2242,6 +2243,7 @@ compute_pipeline_create(
                                     pCreateInfo->stage.pName,
                                     pCreateInfo->stage.pSpecializationInfo);
    if (result != VK_SUCCESS) {
+      ralloc_free(pipeline->mem_ctx);
       vk_free2(&device->alloc, pAllocator, pipeline);
       return result;
    }