ShaderChecker: do not crash if Shader output count == 0 and PSO attachments count > 0
authorscygan <slawomir.cygan@intel.com>
Mon, 1 Jun 2015 17:48:11 +0000 (19:48 +0200)
committerChris Forbes <chrisf@ijw.co.nz>
Wed, 3 Jun 2015 22:15:32 +0000 (10:15 +1200)
(cherry picked from commit 80bb5d63774f2e11bc14d9c5291bb3273f0e79cf)

layers/shader_checker.cpp

index 8e08b3728888b8eb431d517071e2d3ef8303222a..0fa081260d659968c85ca2c3e87c3f908f336e34 100644 (file)
@@ -715,7 +715,7 @@ validate_fs_outputs_against_cb(shader_source const *fs, VkPipelineCbStateCreateI
      */
 
     while ((outputs.size() > 0 && it != outputs.end()) || attachment < cb->attachmentCount) {
-        if (attachment == cb->attachmentCount || it->first < attachment) {
+        if (attachment == cb->attachmentCount || ( it != outputs.end() && it->first < attachment)) {
             sprintf(str, "FS writes to output location %d with no matching attachment", it->first);
             layerCbMsg(VK_DBG_MSG_WARNING, VK_VALIDATION_LEVEL_0, NULL, 0, SHADER_CHECKER_OUTPUT_NOT_CONSUMED, "SC", str);
             it++;