layers: Support VK_EXT_memory_priority
diff --git a/layers/parameter_validation_utils.cpp b/layers/parameter_validation_utils.cpp
index 87346fb..a83cdac 100644
--- a/layers/parameter_validation_utils.cpp
+++ b/layers/parameter_validation_utils.cpp
@@ -3009,3 +3009,18 @@
// Track the state necessary for checking vkCreateGraphicsPipeline (subpass usage of depth and color attachments)
renderpasses_states.erase(renderPass);
}
+
+bool StatelessValidation::manual_PreCallValidateAllocateMemory(VkDevice device, const VkMemoryAllocateInfo *pAllocateInfo,
+ const VkAllocationCallbacks *pAllocator, VkDeviceMemory *pMemory) {
+ bool skip = false;
+
+ if (pAllocateInfo) {
+ auto chained_prio_struct = lvl_find_in_chain<VkMemoryPriorityAllocateInfoEXT>(pAllocateInfo->pNext);
+ if (chained_prio_struct && (chained_prio_struct->priority < 0.0f || chained_prio_struct->priority > 1.0f)) {
+ skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0,
+ "VUID-VkMemoryPriorityAllocateInfoEXT-priority-02602",
+ "priority (=%f) must be between `0` and `1`, inclusive.", chained_prio_struct->priority);
+ }
+ }
+ return skip;
+}
diff --git a/layers/stateless_validation.h b/layers/stateless_validation.h
index c9e1585..bfa0e4a 100644
--- a/layers/stateless_validation.h
+++ b/layers/stateless_validation.h
@@ -1,7 +1,7 @@
-/* Copyright (c) 2015-2018 The Khronos Group Inc.
- * Copyright (c) 2015-2018 Valve Corporation
- * Copyright (c) 2015-2018 LunarG, Inc.
- * Copyright (C) 2015-2018 Google Inc.
+/* Copyright (c) 2015-2019 The Khronos Group Inc.
+ * Copyright (c) 2015-2019 Valve Corporation
+ * Copyright (c) 2015-2019 LunarG, Inc.
+ * Copyright (C) 2015-2019 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -1044,5 +1044,7 @@
bool manual_PreCallValidateEnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice, const char *pLayerName,
uint32_t *pPropertyCount, VkExtensionProperties *pProperties);
+ bool manual_PreCallValidateAllocateMemory(VkDevice device, const VkMemoryAllocateInfo *pAllocateInfo,
+ const VkAllocationCallbacks *pAllocator, VkDeviceMemory *pMemory);
#include "parameter_validation.h"
}; // Class StatelessValidation
diff --git a/scripts/parameter_validation_generator.py b/scripts/parameter_validation_generator.py
index efa797c..4310a66 100644
--- a/scripts/parameter_validation_generator.py
+++ b/scripts/parameter_validation_generator.py
@@ -128,7 +128,7 @@
inline_custom_source_preamble = """
"""
- # These functions have additional, custome-written checks in the utils cpp file. CodeGen will automatically add a call
+ # These functions have additional, custom-written checks in the utils cpp file. CodeGen will automatically add a call
# to those functions of the form 'bool manual_PreCallValidateAPIName', where the 'vk' is dropped.
# see 'manual_PreCallValidateCreateGraphicsPipelines' as an example.
self.functions_with_manual_checks = [
@@ -175,6 +175,7 @@
'vkCmdDrawMeshTasksNV',
'vkCmdDrawMeshTasksIndirectNV',
'vkCmdDrawMeshTasksIndirectCountNV',
+ 'vkAllocateMemory',
]
# Commands to ignore