From 8d20a9eda947c8b1fb8b3cf3a5277b0c8d960260 Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Mon, 22 Aug 2016 15:31:18 +1200 Subject: layers: Correctly handle input attachment collection w/ arrays Fixes the test added in the previous commit Signed-off-by: Chris Forbes --- layers/core_validation.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'layers/core_validation.cpp') diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp index cf772cf3..80e05490 100644 --- a/layers/core_validation.cpp +++ b/layers/core_validation.cpp @@ -1565,16 +1565,16 @@ static void collect_interface_by_input_attachment_index(debug_report_data *repor assert(def != src->end()); if (def.opcode() == spv::OpVariable && insn.word(3) == spv::StorageClassUniformConstant) { - /* TODO: arrays of input attachments: the descriptor - * side only consumes one binding, but each array - * element will consume an additional attachment index */ - interface_var v; - v.id = id; - v.type_id = def.word(1); - v.offset = 0; - v.is_patch = false; - v.is_block_member = false; - out.emplace_back(attachment_index, v); + auto num_locations = get_locations_consumed_by_type(src, def.word(1), false); + for (unsigned int offset = 0; offset < num_locations; offset++) { + interface_var v; + v.id = id; + v.type_id = def.word(1); + v.offset = offset; + v.is_patch = false; + v.is_block_member = false; + out.emplace_back(attachment_index + offset, v); + } } } } -- cgit v1.2.3