aboutsummaryrefslogtreecommitdiff
path: root/layers/core_validation.cpp
diff options
context:
space:
mode:
authorChris Forbes <chrisforbes@google.com>2016-04-21 15:00:58 +1200
committerChris Forbes <chrisforbes@google.com>2016-04-21 15:00:58 +1200
commit3e2f58b5b8dd321462366d9d6c6cf54e8c9b4b07 (patch)
tree843af61a25ebef7a857e24c80f0d47b6ce5ab7be /layers/core_validation.cpp
parentb43155b2d84dcecd4cd803a9eb6e80191cbe0cbe (diff)
downloadusermoji-3e2f58b5b8dd321462366d9d6c6cf54e8c9b4b07.tar.xz
layers: Consider #locations consumed by large VkFormats
Signed-off-by: Chris Forbes <chrisforbes@google.com>
Diffstat (limited to 'layers/core_validation.cpp')
-rw-r--r--layers/core_validation.cpp22
1 files changed, 20 insertions, 2 deletions
diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp
index 77a2421e..454de2ef 100644
--- a/layers/core_validation.cpp
+++ b/layers/core_validation.cpp
@@ -1265,6 +1265,20 @@ static unsigned get_locations_consumed_by_type(shader_module const *src, unsigne
}
}
+static unsigned get_locations_consumed_by_format(VkFormat format) {
+ switch (format) {
+ case VK_FORMAT_R64G64B64A64_SFLOAT:
+ case VK_FORMAT_R64G64B64A64_SINT:
+ case VK_FORMAT_R64G64B64A64_UINT:
+ case VK_FORMAT_R64G64B64_SFLOAT:
+ case VK_FORMAT_R64G64B64_SINT:
+ case VK_FORMAT_R64G64B64_UINT:
+ return 2;
+ default:
+ return 1;
+ }
+}
+
typedef std::pair<unsigned, unsigned> location_t;
typedef std::pair<unsigned, unsigned> descriptor_slot_t;
@@ -1700,8 +1714,12 @@ static bool validate_vi_against_vs_inputs(layer_data *my_data, VkPipelineVertexI
/* Build index by location */
std::map<uint32_t, VkVertexInputAttributeDescription const *> attribs;
if (vi) {
- for (unsigned i = 0; i < vi->vertexAttributeDescriptionCount; i++)
- attribs[vi->pVertexAttributeDescriptions[i].location] = &vi->pVertexAttributeDescriptions[i];
+ for (unsigned i = 0; i < vi->vertexAttributeDescriptionCount; i++) {
+ auto num_locations = get_locations_consumed_by_format(vi->pVertexAttributeDescriptions[i].format);
+ for (auto j = 0u; j < num_locations; j++) {
+ attribs[vi->pVertexAttributeDescriptions[i].location + j] = &vi->pVertexAttributeDescriptions[i];
+ }
+ }
}
auto it_a = attribs.begin();