From 268185d6cc0a1ff6857a69043acb3fd97d155254 Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Thu, 4 Jun 2015 20:23:00 +1200 Subject: shader_checker: Extract pipeline validation into own function There's about to be a second caller. Signed-off-by: Chris Forbes Reviewed-by: Courtney Goeltzenleuchter --- layers/shader_checker.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'layers/shader_checker.cpp') diff --git a/layers/shader_checker.cpp b/layers/shader_checker.cpp index 1b00b5d3..fcad389a 100644 --- a/layers/shader_checker.cpp +++ b/layers/shader_checker.cpp @@ -765,9 +765,8 @@ validate_fs_outputs_against_cb(shader_source const *fs, VkPipelineCbStateCreateI } -VK_LAYER_EXPORT VkResult VKAPI vkCreateGraphicsPipeline(VkDevice device, - const VkGraphicsPipelineCreateInfo *pCreateInfo, - VkPipeline *pPipeline) +static bool +validate_graphics_pipeline(VkGraphicsPipelineCreateInfo const *pCreateInfo) { /* TODO: run cross-stage validation for GS, TCS, TES stages */ @@ -822,14 +821,22 @@ VK_LAYER_EXPORT VkResult VKAPI vkCreateGraphicsPipeline(VkDevice device, pass = validate_fs_outputs_against_cb(fs_source, cb) && pass; } - VkLayerDispatchTable *pTable = tableMap[(VkBaseLayerObject *)device]; - loader_platform_thread_unlock_mutex(&globalLock); + return pass; +} + + +VK_LAYER_EXPORT VkResult VKAPI vkCreateGraphicsPipeline(VkDevice device, + const VkGraphicsPipelineCreateInfo *pCreateInfo, + VkPipeline *pPipeline) +{ + bool pass = validate_graphics_pipeline(pCreateInfo); if (pass) { /* The driver is allowed to crash if passed junk. Only actually create the * pipeline if we didn't run into any showstoppers above. */ + VkLayerDispatchTable *pTable = tableMap[(VkBaseLayerObject *)device]; return pTable->CreateGraphicsPipeline(device, pCreateInfo, pPipeline); } else { -- cgit v1.2.3