aboutsummaryrefslogtreecommitdiff
path: root/layers/draw_state.cpp
diff options
context:
space:
mode:
authorTobin Ehlis <tobine@google.com>2016-03-15 07:59:11 -0600
committerTobin Ehlis <tobine@google.com>2016-03-15 13:52:27 -0600
commitc3b43b19f0c7efd9596a7fb223f3e4929740fc5d (patch)
tree934fa7ae636a4ea5688a46ecb4e6e46ac2070bd4 /layers/draw_state.cpp
parentcf1a24a97d2ecc54a2ecec523112289f676f3c82 (diff)
downloadusermoji-c3b43b19f0c7efd9596a7fb223f3e4929740fc5d.tar.xz
layers: GH130 Fix to correctly get type/flags from set binding
We were using bindingToIndexMap to do look-ups into type and stage vectors which is incorrect. bindingToIndexMap is to index into the original pBindings map that was passed in when the layout was created. This fix does this to correctly pull type and stage of a binding in draw_state.
Diffstat (limited to 'layers/draw_state.cpp')
-rw-r--r--layers/draw_state.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/layers/draw_state.cpp b/layers/draw_state.cpp
index 503d4207..f5435e4f 100644
--- a/layers/draw_state.cpp
+++ b/layers/draw_state.cpp
@@ -1341,11 +1341,13 @@ static bool has_descriptor_binding(layer_data *my_data, vector<VkDescriptorSetLa
auto const layout_node = my_data->descriptorSetLayoutMap[(*pipelineLayout)[slot.first]];
auto bindingIt = layout_node->bindingToIndexMap.find(slot.second);
- if (bindingIt == layout_node->bindingToIndexMap.end())
+ if ((bindingIt == layout_node->bindingToIndexMap.end()) || (layout_node->createInfo.pBindings == NULL))
return false;
- type = layout_node->descriptorTypes[bindingIt->second];
- stage_flags = layout_node->stageFlags[bindingIt->second];
+ assert(bindingIt->second < layout_node->createInfo.bindingCount);
+ VkDescriptorSetLayoutBinding binding = layout_node->createInfo.pBindings[bindingIt->second];
+ type = binding.descriptorType;
+ stage_flags = binding.stageFlags;
return true;
}