From 82562158b13a295bb27e405da58452225ff74813 Mon Sep 17 00:00:00 2001 From: Tobin Ehlis Date: Wed, 16 Sep 2015 10:33:53 -0600 Subject: layers: Update DrawState to handle creation of multiple gfx pipelines --- layers/draw_state.cpp | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) (limited to 'layers/draw_state.cpp') diff --git a/layers/draw_state.cpp b/layers/draw_state.cpp index 8a51043e..d7df9228 100644 --- a/layers/draw_state.cpp +++ b/layers/draw_state.cpp @@ -1734,30 +1734,37 @@ VkResult VKAPI vkMergePipelineCaches( VK_LAYER_EXPORT VkResult VKAPI vkCreateGraphicsPipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t count, const VkGraphicsPipelineCreateInfo* pCreateInfos, VkPipeline* pPipelines) { VkResult result = VK_SUCCESS; - //TODO handle count > 1 and handle pipelineCache + //TODO What to do with pipelineCache? // The order of operations here is a little convoluted but gets the job done // 1. Pipeline create state is first shadowed into PIPELINE_NODE struct // 2. Create state is then validated (which uses flags setup during shadowing) // 3. If everything looks good, we'll then create the pipeline and add NODE to pipelineMap + VkBool32 skipCall = VK_FALSE; + PIPELINE_NODE* pPipeNode[count] = {}; + uint32_t i=0; loader_platform_thread_lock_mutex(&globalLock); - PIPELINE_NODE* pPipeNode = initPipeline(pCreateInfos, NULL); - VkBool32 skipCall = verifyPipelineCreateState(device, pPipeNode); + for (i=0; iCreateGraphicsPipelines(device, pipelineCache, count, pCreateInfos, pPipelines); - log_msg(mdd(device), VK_DBG_REPORT_INFO_BIT, VK_OBJECT_TYPE_PIPELINE, (*pPipelines).handle, 0, DRAWSTATE_NONE, "DS", - "Created Gfx Pipeline %#" PRIxLEAST64, (*pPipelines).handle); loader_platform_thread_lock_mutex(&globalLock); - pPipeNode->pipeline = *pPipelines; - pipelineMap[pPipeNode->pipeline.handle] = pPipeNode; + for (i=0; ipipeline = pPipelines[i]; + pipelineMap[pPipeNode[i]->pipeline.handle] = pPipeNode[i]; + } loader_platform_thread_unlock_mutex(&globalLock); } else { - if (pPipeNode) { - // If we allocated a pipeNode, need to clean it up here - delete[] pPipeNode->pVertexBindingDescriptions; - delete[] pPipeNode->pVertexAttributeDescriptions; - delete[] pPipeNode->pAttachments; - delete pPipeNode; + for (i=0; ipVertexBindingDescriptions; + delete[] pPipeNode[i]->pVertexAttributeDescriptions; + delete[] pPipeNode[i]->pAttachments; + delete pPipeNode[i]; + } } return VK_ERROR_VALIDATION_FAILED; } -- cgit v1.2.3