diff options
| author | Chris Forbes <chrisf@ijw.co.nz> | 2015-06-04 20:23:00 +1200 |
|---|---|---|
| committer | Chris Forbes <chrisf@ijw.co.nz> | 2015-06-05 10:17:04 +1200 |
| commit | 268185d6cc0a1ff6857a69043acb3fd97d155254 (patch) | |
| tree | ae22924e840f2c714bbe314f57020a2179ae7656 /layers/shader_checker.cpp | |
| parent | 2a06167cf033c0d662da683871e22d00519cbef8 (diff) | |
| download | usermoji-268185d6cc0a1ff6857a69043acb3fd97d155254.tar.xz | |
shader_checker: Extract pipeline validation into own function
There's about to be a second caller.
Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Courtney Goeltzenleuchter <courtney@lunarg.com>
Diffstat (limited to 'layers/shader_checker.cpp')
| -rw-r--r-- | layers/shader_checker.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
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 { |
