aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Bolz <jbolz@nvidia.com>2019-08-21 13:24:11 -0500
committerMark Lobodzinski <mark@lunarg.com>2019-08-22 16:00:21 -0600
commit6d243119f4465ae838f8b07c335e6fc8b4be4879 (patch)
treeb8fc95ec876960aacbefde4212dc7ed78a9ab388
parent87304ec428ead84b876599cb3e44005b61fff527 (diff)
downloadvulkan-validation-layers-6d243119f4465ae838f8b07c335e6fc8b4be4879.tar.gz
layers: Remove QueueInfo tracking from ObjectLifetimes
Move VUID-vkQueueBindSparse-queuetype to core validation and remove the QueueInfo tracking from ObjectLifetimes since it's no longer necessary.
-rw-r--r--layers/core_validation.cpp9
-rw-r--r--layers/object_lifetime_validation.h22
-rw-r--r--layers/object_tracker_utils.cpp76
3 files changed, 14 insertions, 93 deletions
diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp
index 69986f53c..989af3c07 100644
--- a/layers/core_validation.cpp
+++ b/layers/core_validation.cpp
@@ -12112,12 +12112,21 @@ void CoreChecks::PreCallRecordSetEvent(VkDevice device, VkEvent event) {
bool CoreChecks::PreCallValidateQueueBindSparse(VkQueue queue, uint32_t bindInfoCount, const VkBindSparseInfo *pBindInfo,
VkFence fence) {
+ auto queue_data = GetQueueState(queue);
auto pFence = GetFenceState(fence);
bool skip = ValidateFenceForSubmit(pFence);
if (skip) {
return true;
}
+ auto queueFlags = GetPhysicalDeviceState()->queue_family_properties[queue_data->queueFamilyIndex].queueFlags;
+ if (!(queueFlags & VK_QUEUE_SPARSE_BINDING_BIT)) {
+ skip |= log_msg(
+ report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_QUEUE_EXT, HandleToUint64(queue),
+ "VUID-vkQueueBindSparse-queuetype",
+ "Attempting vkQueueBindSparse on a non-memory-management capable queue -- VK_QUEUE_SPARSE_BINDING_BIT not set.");
+ }
+
unordered_set<VkSemaphore> signaled_semaphores;
unordered_set<VkSemaphore> unsignaled_semaphores;
unordered_set<VkSemaphore> internal_semaphores;
diff --git a/layers/object_lifetime_validation.h b/layers/object_lifetime_validation.h
index a5bdc6a5f..cfd080f97 100644
--- a/layers/object_lifetime_validation.h
+++ b/layers/object_lifetime_validation.h
@@ -54,14 +54,8 @@ extern uint64_t object_track_index;
typedef VkFlags ObjectStatusFlags;
enum ObjectStatusFlagBits {
OBJSTATUS_NONE = 0x00000000, // No status is set
- OBJSTATUS_FENCE_IS_SUBMITTED = 0x00000001, // Fence has been submitted
- OBJSTATUS_VIEWPORT_BOUND = 0x00000002, // Viewport state object has been bound
- OBJSTATUS_RASTER_BOUND = 0x00000004, // Viewport state object has been bound
- OBJSTATUS_COLOR_BLEND_BOUND = 0x00000008, // Viewport state object has been bound
- OBJSTATUS_DEPTH_STENCIL_BOUND = 0x00000010, // Viewport state object has been bound
- OBJSTATUS_GPU_MEM_MAPPED = 0x00000020, // Memory object is currently mapped
- OBJSTATUS_COMMAND_BUFFER_SECONDARY = 0x00000040, // Command Buffer is of type SECONDARY
- OBJSTATUS_CUSTOM_ALLOCATOR = 0x00000080, // Allocated with custom allocator
+ OBJSTATUS_COMMAND_BUFFER_SECONDARY = 0x00000001, // Command Buffer is of type SECONDARY
+ OBJSTATUS_CUSTOM_ALLOCATOR = 0x00000002, // Allocated with custom allocator
};
// Object and state information structure
@@ -73,12 +67,6 @@ struct ObjTrackState {
std::unique_ptr<std::unordered_set<uint64_t> > child_objects; // Child objects (used for VkDescriptorPool only)
};
-// Track Queue information
-struct ObjTrackQueueInfo {
- uint32_t queue_node_index;
- VkQueue queue;
-};
-
typedef std::unordered_map<uint64_t, ObjTrackState *> object_map_type;
class ObjectLifetimes : public ValidationObject {
@@ -100,10 +88,6 @@ class ObjectLifetimes : public ValidationObject {
std::vector<object_map_type> object_map;
// Special-case map for swapchain images
std::unordered_map<uint64_t, ObjTrackState *> swapchainImageMap;
- // Map of queue information structures, one per queue
- std::unordered_map<VkQueue, ObjTrackQueueInfo *> queue_info_map;
-
- std::vector<VkQueueFamilyProperties> queue_family_properties;
// Constructor for object lifetime tracking
ObjectLifetimes() : num_objects{}, num_total_objects(0), object_map{} { object_map.resize(kVulkanObjectTypeMax + 1); }
@@ -111,8 +95,6 @@ class ObjectLifetimes : public ValidationObject {
bool DeviceReportUndestroyedObjects(VkDevice device, VulkanObjectType object_type, const std::string &error_code);
void DeviceDestroyUndestroyedObjects(VkDevice device, VulkanObjectType object_type);
void CreateQueue(VkDevice device, VkQueue vkObj);
- void AddQueueInfo(VkDevice device, uint32_t queue_node_index, VkQueue queue);
- void ValidateQueueFlags(VkQueue queue, const char *function);
void AllocateCommandBuffer(VkDevice device, const VkCommandPool command_pool, const VkCommandBuffer command_buffer,
VkCommandBufferLevel level);
void AllocateDescriptorSet(VkDevice device, VkDescriptorPool descriptor_pool, VkDescriptorSet descriptor_set);
diff --git a/layers/object_tracker_utils.cpp b/layers/object_tracker_utils.cpp
index 9a98d2014..6262a2baa 100644
--- a/layers/object_tracker_utils.cpp
+++ b/layers/object_tracker_utils.cpp
@@ -34,31 +34,8 @@ VulkanTypedHandle ObjTrackStateTypedHandle(const ObjTrackState &track_state) {
return typed_handle;
}
-// Add new queue to head of global queue list
-void ObjectLifetimes::AddQueueInfo(VkDevice device, uint32_t queue_node_index, VkQueue queue) {
- auto queueItem = queue_info_map.find(queue);
- if (queueItem == queue_info_map.end()) {
- ObjTrackQueueInfo *p_queue_info = new ObjTrackQueueInfo;
- if (p_queue_info != NULL) {
- memset(p_queue_info, 0, sizeof(ObjTrackQueueInfo));
- p_queue_info->queue = queue;
- p_queue_info->queue_node_index = queue_node_index;
- queue_info_map[queue] = p_queue_info;
- } else {
- log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_QUEUE_EXT, HandleToUint64(queue),
- kVUID_ObjectTracker_InternalError,
- "ERROR: VK_ERROR_OUT_OF_HOST_MEMORY -- could not allocate memory for Queue Information");
- }
- }
-}
-
// Destroy memRef lists and free all memory
void ObjectLifetimes::DestroyQueueDataStructures(VkDevice device) {
- for (auto queue_item : queue_info_map) {
- delete queue_item.second;
- }
- queue_info_map.clear();
-
// Destroy the items in the queue map
auto queue = object_map[kVulkanObjectTypeQueue].begin();
while (queue != object_map[kVulkanObjectTypeQueue].end()) {
@@ -72,21 +49,6 @@ void ObjectLifetimes::DestroyQueueDataStructures(VkDevice device) {
}
}
-// Check Queue type flags for selected queue operations
-void ObjectLifetimes::ValidateQueueFlags(VkQueue queue, const char *function) {
- auto queue_item = queue_info_map.find(queue);
- if (queue_item != queue_info_map.end()) {
- ObjTrackQueueInfo *pQueueInfo = queue_item->second;
- if (pQueueInfo != NULL) {
- if ((queue_family_properties[pQueueInfo->queue_node_index].queueFlags & VK_QUEUE_SPARSE_BINDING_BIT) == 0) {
- log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_QUEUE_EXT, HandleToUint64(queue),
- "VUID-vkQueueBindSparse-queuetype",
- "Attempting %s on a non-memory-management capable queue -- VK_QUEUE_SPARSE_BINDING_BIT not set.", function);
- }
- }
- }
-}
-
// Look for this device object in any of the instance child devices lists.
// NOTE: This is of dubious value. In most circumstances Vulkan will die a flaming death if a dispatchable object is invalid.
// However, if this layer is loaded first and GetProcAddress is used to make API calls, it will detect bad DOs.
@@ -403,7 +365,6 @@ void ObjectLifetimes::PostCallRecordGetDeviceQueue(VkDevice device, uint32_t que
VkQueue *pQueue) {
auto lock = write_shared_lock();
CreateQueue(device, *pQueue);
- AddQueueInfo(device, queueFamilyIndex, *pQueue);
}
bool ObjectLifetimes::PreCallValidateGetDeviceQueue2(VkDevice device, const VkDeviceQueueInfo2 *pQueueInfo, VkQueue *pQueue) {
@@ -415,7 +376,6 @@ bool ObjectLifetimes::PreCallValidateGetDeviceQueue2(VkDevice device, const VkDe
void ObjectLifetimes::PostCallRecordGetDeviceQueue2(VkDevice device, const VkDeviceQueueInfo2 *pQueueInfo, VkQueue *pQueue) {
auto lock = write_shared_lock();
CreateQueue(device, *pQueue);
- AddQueueInfo(device, pQueueInfo->queueFamilyIndex, *pQueue);
}
bool ObjectLifetimes::PreCallValidateUpdateDescriptorSets(VkDevice device, uint32_t descriptorWriteCount,
@@ -607,17 +567,7 @@ bool ObjectLifetimes::PreCallValidateGetPhysicalDeviceQueueFamilyProperties(VkPh
void ObjectLifetimes::PostCallRecordGetPhysicalDeviceQueueFamilyProperties(VkPhysicalDevice physicalDevice,
uint32_t *pQueueFamilyPropertyCount,
- VkQueueFamilyProperties *pQueueFamilyProperties) {
- auto lock = write_shared_lock();
- if (pQueueFamilyProperties != NULL) {
- if (queue_family_properties.size() < *pQueueFamilyPropertyCount) {
- queue_family_properties.resize(*pQueueFamilyPropertyCount);
- }
- for (uint32_t i = 0; i < *pQueueFamilyPropertyCount; i++) {
- queue_family_properties[i] = pQueueFamilyProperties[i];
- }
- }
-}
+ VkQueueFamilyProperties *pQueueFamilyProperties) {}
void ObjectLifetimes::PostCallRecordCreateInstance(const VkInstanceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator,
VkInstance *pInstance, VkResult result) {
@@ -850,30 +800,10 @@ bool ObjectLifetimes::PreCallValidateGetPhysicalDeviceQueueFamilyProperties2KHR(
void ObjectLifetimes::PostCallRecordGetPhysicalDeviceQueueFamilyProperties2(VkPhysicalDevice physicalDevice,
uint32_t *pQueueFamilyPropertyCount,
- VkQueueFamilyProperties2KHR *pQueueFamilyProperties) {
- auto lock = write_shared_lock();
- if (pQueueFamilyProperties != NULL) {
- if (queue_family_properties.size() < *pQueueFamilyPropertyCount) {
- queue_family_properties.resize(*pQueueFamilyPropertyCount);
- }
- for (uint32_t i = 0; i < *pQueueFamilyPropertyCount; i++) {
- queue_family_properties[i] = pQueueFamilyProperties[i].queueFamilyProperties;
- }
- }
-}
+ VkQueueFamilyProperties2KHR *pQueueFamilyProperties) {}
void ObjectLifetimes::PostCallRecordGetPhysicalDeviceQueueFamilyProperties2KHR(
- VkPhysicalDevice physicalDevice, uint32_t *pQueueFamilyPropertyCount, VkQueueFamilyProperties2KHR *pQueueFamilyProperties) {
- auto lock = write_shared_lock();
- if (pQueueFamilyProperties != NULL) {
- if (queue_family_properties.size() < *pQueueFamilyPropertyCount) {
- queue_family_properties.resize(*pQueueFamilyPropertyCount);
- }
- for (uint32_t i = 0; i < *pQueueFamilyPropertyCount; i++) {
- queue_family_properties[i] = pQueueFamilyProperties[i].queueFamilyProperties;
- }
- }
-}
+ VkPhysicalDevice physicalDevice, uint32_t *pQueueFamilyPropertyCount, VkQueueFamilyProperties2KHR *pQueueFamilyProperties) {}
bool ObjectLifetimes::PreCallValidateGetPhysicalDeviceDisplayPropertiesKHR(VkPhysicalDevice physicalDevice,
uint32_t *pPropertyCount,