layers: Add VU 791,803 (bind mem w/existing binding)
authorCort <github@dangerware.org>
Wed, 18 Jan 2017 02:09:09 +0000 (18:09 -0800)
committerCort <cdwfs@users.noreply.github.com>
Tue, 14 Feb 2017 22:22:47 +0000 (14:22 -0800)
layers/core_validation.cpp
layers/vk_validation_error_database.txt

index fcf7773..319c797 100644 (file)
@@ -759,13 +759,19 @@ static bool SetMemBinding(layer_data *dev_data, VkDeviceMemory mem, uint64_t han
         if (mem_info) {
             DEVICE_MEM_INFO *prev_binding = GetMemObjInfo(dev_data, mem_binding->binding.mem);
             if (prev_binding) {
-                // TODO: VALIDATION_ERROR_00791 and VALIDATION_ERROR_00803
+                UNIQUE_VALIDATION_ERROR_CODE error_code = VALIDATION_ERROR_00803;
+                if (strcmp(apiName, "vkBindBufferMemory") == 0) {
+                    error_code = VALIDATION_ERROR_00791;
+                } else {
+                    assert(strcmp(apiName, "vkBindImageMemory") == 0);
+                }
                 skip_call |=
                     log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_MEMORY_EXT,
-                            reinterpret_cast<uint64_t &>(mem), __LINE__, MEMTRACK_REBIND_OBJECT, "MEM",
+                            reinterpret_cast<uint64_t &>(mem), __LINE__, error_code, "MEM",
                             "In %s, attempting to bind memory (0x%" PRIxLEAST64 ") to object (0x%" PRIxLEAST64
-                            ") which has already been bound to mem object 0x%" PRIxLEAST64,
-                            apiName, reinterpret_cast<uint64_t &>(mem), handle, reinterpret_cast<uint64_t &>(prev_binding->mem));
+                            ") which has already been bound to mem object 0x%" PRIxLEAST64 ". %s",
+                            apiName, reinterpret_cast<uint64_t &>(mem), handle, reinterpret_cast<uint64_t &>(prev_binding->mem),
+                            validation_error_map[error_code]);
             } else if (mem_binding->binding.mem == MEMORY_UNBOUND) {
                 skip_call |=
                     log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_MEMORY_EXT,
index e0be081..1462cfe 100644 (file)
@@ -779,7 +779,7 @@ VALIDATION_ERROR_00787~^~Y~^~None~^~vkGetImageMemoryRequirements~^~For more info
 VALIDATION_ERROR_00788~^~Y~^~CreateUnknownObject~^~vkGetImageMemoryRequirements~^~For more information refer to Vulkan Spec Section '11.6. Resource Memory Association' which states 'image must be a valid VkImage handle' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#vkGetImageMemoryRequirements)~^~implicit
 VALIDATION_ERROR_00789~^~N~^~Unknown~^~vkGetImageMemoryRequirements~^~For more information refer to Vulkan Spec Section '11.6. Resource Memory Association' which states 'pMemoryRequirements must be a pointer to a VkMemoryRequirements structure' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#vkGetImageMemoryRequirements)~^~implicit
 VALIDATION_ERROR_00790~^~N~^~Unknown~^~vkGetImageMemoryRequirements~^~For more information refer to Vulkan Spec Section '11.6. Resource Memory Association' which states 'image must have been created, allocated, or retrieved from device' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#vkGetImageMemoryRequirements)~^~implicit
-VALIDATION_ERROR_00791~^~N~^~Unknown~^~vkBindBufferMemory~^~For more information refer to Vulkan Spec Section '11.6. Resource Memory Association' which states 'buffer must not already be backed by a memory object' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#vkBindBufferMemory)~^~
+VALIDATION_ERROR_00791~^~Y~^~Unknown~^~vkBindBufferMemory~^~For more information refer to Vulkan Spec Section '11.6. Resource Memory Association' which states 'buffer must not already be backed by a memory object' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#vkBindBufferMemory)~^~
 VALIDATION_ERROR_00792~^~Y~^~Unknown~^~vkBindBufferMemory~^~For more information refer to Vulkan Spec Section '11.6. Resource Memory Association' which states 'buffer must not have been created with any sparse memory binding flags' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#vkBindBufferMemory)~^~
 VALIDATION_ERROR_00793~^~N~^~Unknown~^~vkBindBufferMemory~^~For more information refer to Vulkan Spec Section '11.6. Resource Memory Association' which states 'memoryOffset must be less than the size of memory' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#vkBindBufferMemory)~^~
 VALIDATION_ERROR_00794~^~Y~^~Unknown~^~vkBindBufferMemory~^~For more information refer to Vulkan Spec Section '11.6. Resource Memory Association' which states 'If buffer was created with the VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT or VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT, memoryOffset must be a multiple of VkPhysicalDeviceLimits::minTexelBufferOffsetAlignment' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#vkBindBufferMemory)~^~
@@ -791,7 +791,7 @@ VALIDATION_ERROR_00799~^~Y~^~VertexBufferInvalid~^~vkBindBufferMemory~^~For more
 VALIDATION_ERROR_00800~^~Y~^~Unknown~^~vkBindBufferMemory~^~For more information refer to Vulkan Spec Section '11.6. Resource Memory Association' which states 'memory must be a valid VkDeviceMemory handle' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#vkBindBufferMemory)~^~implicit
 VALIDATION_ERROR_00801~^~N~^~Unknown~^~vkBindBufferMemory~^~For more information refer to Vulkan Spec Section '11.6. Resource Memory Association' which states 'buffer must have been created, allocated, or retrieved from device' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#vkBindBufferMemory)~^~implicit
 VALIDATION_ERROR_00802~^~N~^~Unknown~^~vkBindBufferMemory~^~For more information refer to Vulkan Spec Section '11.6. Resource Memory Association' which states 'memory must have been created, allocated, or retrieved from device' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#vkBindBufferMemory)~^~implicit
-VALIDATION_ERROR_00803~^~N~^~Unknown~^~vkBindImageMemory~^~For more information refer to Vulkan Spec Section '11.6. Resource Memory Association' which states 'image must not already be backed by a memory object' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#vkBindImageMemory)~^~
+VALIDATION_ERROR_00803~^~Y~^~Unknown~^~vkBindImageMemory~^~For more information refer to Vulkan Spec Section '11.6. Resource Memory Association' which states 'image must not already be backed by a memory object' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#vkBindImageMemory)~^~
 VALIDATION_ERROR_00804~^~Y~^~Unknown~^~vkBindImageMemory~^~For more information refer to Vulkan Spec Section '11.6. Resource Memory Association' which states 'image must not have been created with any sparse memory binding flags' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#vkBindImageMemory)~^~
 VALIDATION_ERROR_00805~^~N~^~Unknown~^~vkBindImageMemory~^~For more information refer to Vulkan Spec Section '11.6. Resource Memory Association' which states 'memoryOffset must be less than the size of memory' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#vkBindImageMemory)~^~
 VALIDATION_ERROR_00806~^~Y~^~Unknown~^~vkBindImageMemory~^~For more information refer to Vulkan Spec Section '11.6. Resource Memory Association' which states 'memory must have been allocated using one of the memory types allowed in the memoryTypeBits member of the VkMemoryRequirements structure returned from a call to vkGetImageMemoryRequirements with image' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#vkBindImageMemory)~^~