layers: Fix reporting of multiple allowed image view types
authorChris Forbes <chrisforbes@google.com>
Wed, 31 Aug 2016 19:58:14 +0000 (12:58 -0700)
committerChris Forbes <chrisforbes@google.com>
Thu, 1 Sep 2016 15:32:53 +0000 (08:32 -0700)
This isn't the problem we were hitting in #890, but we'd produce a misleading message if multiple bits were allowed

Signed-off-by: Chris Forbes <chrisforbes@google.com>
layers/descriptor_sets.cpp

index 00c0d19..9b20638 100644 (file)
@@ -323,14 +323,19 @@ cvdescriptorset::DescriptorSet::~DescriptorSet() {
 }
 
 
-static char const * string_descriptor_req_view_type(descriptor_req req) {
+static std::string string_descriptor_req_view_type(descriptor_req req) {
+    std::string result("");
     for (unsigned i = 0; i <= VK_IMAGE_VIEW_TYPE_END_RANGE; i++) {
         if (req & (1 << i)) {
-            return string_VkImageViewType(VkImageViewType(i));
+            if (result.size()) result += ", ";
+            result += string_VkImageViewType(VkImageViewType(i));
         }
     }
 
-    return "(none)";
+    if (!result.size())
+        result = "(none)";
+
+    return result;
 }