layers: draw_state VK_WHOLE_SIZE in barriers
authorMike Stroyan <stroyan@google.com>
Mon, 22 Feb 2016 16:15:19 +0000 (09:15 -0700)
committerTobin Ehlis <tobine@google.com>
Wed, 24 Feb 2016 15:58:35 +0000 (08:58 -0700)
Allow use of VK_WHOLE_SIZE in barriers validation.

layers/draw_state.cpp

index b67e9964b1ba7fceb134f93e0e47341d273f08fa..ffe239b2461bd0634e2450836f363e92d5903f86 100644 (file)
@@ -6335,19 +6335,31 @@ VkBool32 ValidateBarriers(VkCommandBuffer cmdBuffer, uint32_t memBarrierCount,
                                    ? reinterpret_cast<uint64_t &>(
                                          buffer_data->second.create_info->size)
                                    : 0;
-        if (buffer_data != dev_data->bufferMap.end() &&
-            mem_barrier->offset + mem_barrier->size > buffer_size) {
-            skip_call |=
-                log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT,
-                        (VkDebugReportObjectTypeEXT)0, 0, __LINE__,
-                        DRAWSTATE_INVALID_BARRIER, "DS",
-                        "Buffer Barrier 0x%" PRIx64 " has offset %" PRIu64
-                        " and size %" PRIu64
-                        " whose sum is greater than total size %" PRIu64 ".",
-                        reinterpret_cast<const uint64_t &>(mem_barrier->buffer),
-                        reinterpret_cast<const uint64_t &>(mem_barrier->offset),
-                        reinterpret_cast<const uint64_t &>(mem_barrier->size),
-                        buffer_size);
+        if (buffer_data != dev_data->bufferMap.end()) {
+            if (mem_barrier->offset >= buffer_size) {
+                skip_call |=
+                    log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT,
+                            (VkDebugReportObjectTypeEXT)0, 0, __LINE__,
+                            DRAWSTATE_INVALID_BARRIER, "DS",
+                            "Buffer Barrier 0x%" PRIx64 " has offset %" PRIu64
+                            " whose sum is not less than total size %" PRIu64 ".",
+                            reinterpret_cast<const uint64_t &>(mem_barrier->buffer),
+                            reinterpret_cast<const uint64_t &>(mem_barrier->offset),
+                            buffer_size);
+            } else if (mem_barrier->size != VK_WHOLE_SIZE &&
+                      (mem_barrier->offset + mem_barrier->size > buffer_size)) {
+                skip_call |=
+                    log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT,
+                            (VkDebugReportObjectTypeEXT)0, 0, __LINE__,
+                            DRAWSTATE_INVALID_BARRIER, "DS",
+                            "Buffer Barrier 0x%" PRIx64 " has offset %" PRIu64
+                            " and size %" PRIu64
+                            " whose sum is greater than total size %" PRIu64 ".",
+                            reinterpret_cast<const uint64_t &>(mem_barrier->buffer),
+                            reinterpret_cast<const uint64_t &>(mem_barrier->offset),
+                            reinterpret_cast<const uint64_t &>(mem_barrier->size),
+                            buffer_size);
+            }
         }
     }
     return skip_call;