diff options
| author | Chris Forbes <chrisforbes@google.com> | 2016-03-04 11:52:03 +1300 |
|---|---|---|
| committer | Tobin Ehlis <tobine@google.com> | 2016-03-07 07:12:23 -0700 |
| commit | 97b1b117e0e1224bf49d94820f5ddadc855e6c13 (patch) | |
| tree | 7ceb4ded17919856d374d1b2a805a47507517843 /layers/draw_state.cpp | |
| parent | 62147617e0011a0d53d106b97402e140abed5004 (diff) | |
| download | usermoji-97b1b117e0e1224bf49d94820f5ddadc855e6c13.tar.xz | |
layers: Validate subpass index in CreateGraphicsPipelines
Not validating this upfront meant that users got really weird errors
about mismatches between their FS outputs and color attachments. Now
they should hit the real problem first.
Fixes GH #75
V2: Run through git-clang-format.
Signed-off-by: Chris Forbes <chrisforbes@google.com>
Diffstat (limited to 'layers/draw_state.cpp')
| -rw-r--r-- | layers/draw_state.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/layers/draw_state.cpp b/layers/draw_state.cpp index 32e1521f..161dd63f 100644 --- a/layers/draw_state.cpp +++ b/layers/draw_state.cpp @@ -2032,6 +2032,23 @@ static VkBool32 verifyPipelineCreateState(layer_data* my_data, const VkDevice de } } + // Ensure the subpass index is valid. If not, then validate_pipeline_shaders + // produces nonsense errors that confuse users. Other layers should already + // emit errors for renderpass being invalid. + auto rp_data = + my_data->renderPassMap.find(pPipeline->graphicsPipelineCI.renderPass); + if (rp_data != my_data->renderPassMap.end() && + pPipeline->graphicsPipelineCI.subpass >= + rp_data->second->pCreateInfo->subpassCount) { + skipCall |= log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, + (VkDebugReportObjectTypeEXT)0, 0, __LINE__, + DRAWSTATE_INVALID_PIPELINE_CREATE_STATE, "DS", + "Invalid Pipeline CreateInfo State: Subpass index %u " + "is out of range for this renderpass (0..%u)", + pPipeline->graphicsPipelineCI.subpass, + rp_data->second->pCreateInfo->subpassCount - 1); + } + if (!validate_pipeline_shaders(my_data, device, pPipeline)) { skipCall = VK_TRUE; } |
