diff options
| author | Chris Forbes <chrisforbes@google.com> | 2016-08-22 15:20:11 +1200 |
|---|---|---|
| committer | Chris Forbes <chrisforbes@google.com> | 2016-08-23 13:12:40 +1200 |
| commit | 9a2addb243bfcd18f23cb1c615906de77784ad98 (patch) | |
| tree | b688a1a1979ac3ce32fc3b55c9d143f18abccf7b /layers/core_validation.cpp | |
| parent | 45a1ba195f27fefae738e600c89d70bacc4bfa74 (diff) | |
| download | usermoji-9a2addb243bfcd18f23cb1c615906de77784ad98.tar.xz | |
layers: Require every input attachment used by FS to be present.
Signed-off-by: Chris Forbes <chrisforbes@google.com>
Diffstat (limited to 'layers/core_validation.cpp')
| -rw-r--r-- | layers/core_validation.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp index aa305d0e..cf772cf3 100644 --- a/layers/core_validation.cpp +++ b/layers/core_validation.cpp @@ -2780,6 +2780,32 @@ static bool validate_pipeline_shader_stage(debug_report_data *report_data, } } + /* validate use of input attachments against subpass structure */ + if (pStage->stage == VK_SHADER_STAGE_FRAGMENT_BIT) { + std::vector<std::pair<uint32_t, interface_var>> input_attachment_uses; + collect_interface_by_input_attachment_index(report_data, module, accessible_ids, input_attachment_uses); + + auto rpci = pipeline->render_pass_ci.ptr(); + auto subpass = pipeline->graphicsPipelineCI.subpass; + + for (auto use : input_attachment_uses) { + auto input_attachments = rpci->pSubpasses[subpass].pInputAttachments; + auto index = (input_attachments && use.first < rpci->pSubpasses[subpass].inputAttachmentCount) ? + input_attachments[use.first].attachment : VK_ATTACHMENT_UNUSED; + + if (index == VK_ATTACHMENT_UNUSED) { + if (log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VkDebugReportObjectTypeEXT(0), 0, __LINE__, + SHADER_CHECKER_MISSING_INPUT_ATTACHMENT, "SC", + "Shader consumes input attachment index %d but not provided in subpass", + use.first)) { + pass = false; + } + } + + /* TODO: type match, etc */ + } + } + return pass; } |
