diff options
author | Eric Anholt <[email protected]> | 2019-11-26 16:42:24 -0800 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2019-12-04 20:32:15 -0800 |
commit | 70d6428be5f4dc5545191059474804d21c6bdbac (patch) | |
tree | f279e8b07adb89b217e899a049934ed980f8f733 /src/freedreno/vulkan | |
parent | e46da7dbeae4b1138fc9e0db7a144d8edbed50e5 (diff) |
turnip: Refactor the graphics pipeline create implementation.
The loop over the pipelines to create (and the failure handling) was
noisy, and the stub for compute setup looked nicer to me.
Reviewed-by: Jonathan Marek <[email protected]>
Diffstat (limited to 'src/freedreno/vulkan')
-rw-r--r-- | src/freedreno/vulkan/tu_pipeline.c | 46 |
1 files changed, 31 insertions, 15 deletions
diff --git a/src/freedreno/vulkan/tu_pipeline.c b/src/freedreno/vulkan/tu_pipeline.c index 547115b0359..0e35d4e60dc 100644 --- a/src/freedreno/vulkan/tu_pipeline.c +++ b/src/freedreno/vulkan/tu_pipeline.c @@ -1901,6 +1901,32 @@ tu_pipeline_builder_init_graphics( } } +static VkResult +tu_graphics_pipeline_create(VkDevice device, + VkPipelineCache pipelineCache, + const VkGraphicsPipelineCreateInfo *pCreateInfo, + const VkAllocationCallbacks *pAllocator, + VkPipeline *pPipeline) +{ + TU_FROM_HANDLE(tu_device, dev, device); + TU_FROM_HANDLE(tu_pipeline_cache, cache, pipelineCache); + + struct tu_pipeline_builder builder; + tu_pipeline_builder_init_graphics(&builder, dev, cache, + pCreateInfo, pAllocator); + + struct tu_pipeline *pipeline = NULL; + VkResult result = tu_pipeline_builder_build(&builder, &pipeline); + tu_pipeline_builder_finish(&builder); + + if (result == VK_SUCCESS) + *pPipeline = tu_pipeline_to_handle(pipeline); + else + *pPipeline = NULL; + + return result; +} + VkResult tu_CreateGraphicsPipelines(VkDevice device, VkPipelineCache pipelineCache, @@ -1909,25 +1935,15 @@ tu_CreateGraphicsPipelines(VkDevice device, const VkAllocationCallbacks *pAllocator, VkPipeline *pPipelines) { - TU_FROM_HANDLE(tu_device, dev, device); - TU_FROM_HANDLE(tu_pipeline_cache, cache, pipelineCache); VkResult final_result = VK_SUCCESS; for (uint32_t i = 0; i < count; i++) { - struct tu_pipeline_builder builder; - tu_pipeline_builder_init_graphics(&builder, dev, cache, - &pCreateInfos[i], pAllocator); - - struct tu_pipeline *pipeline = NULL; - VkResult result = tu_pipeline_builder_build(&builder, &pipeline); - tu_pipeline_builder_finish(&builder); - - if (result == VK_SUCCESS) { - pPipelines[i] = tu_pipeline_to_handle(pipeline); - } else { - pPipelines[i] = NULL; + VkResult result = tu_graphics_pipeline_create(device, pipelineCache, + &pCreateInfos[i], pAllocator, + &pPipelines[i]); + + if (result != VK_SUCCESS) final_result = result; - } } return final_result; |