From 9a4da5af0a10e101d61d134f078a62c8b58dc382 Mon Sep 17 00:00:00 2001 From: Michael Lentine Date: Tue, 9 Feb 2016 10:31:11 -0600 Subject: layers: Validate no active queries unless enabled. --- layers/draw_state.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'layers/draw_state.cpp') diff --git a/layers/draw_state.cpp b/layers/draw_state.cpp index bac580cb..bb6d4ad7 100644 --- a/layers/draw_state.cpp +++ b/layers/draw_state.cpp @@ -3148,6 +3148,14 @@ VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateDevice(VkPhysicalDevice g my_instance_data->instance_dispatch_table->GetPhysicalDeviceQueueFamilyProperties(gpu, &count, nullptr); my_device_data->physDevProperties.queue_family_properties.resize(count); my_instance_data->instance_dispatch_table->GetPhysicalDeviceQueueFamilyProperties(gpu, &count, &my_device_data->physDevProperties.queue_family_properties[0]); + // TODO: device limits should make sure these are compatible + if (pCreateInfo->pEnabledFeatures) { + my_device_data->physDevProperties.features = + *pCreateInfo->pEnabledFeatures; + } else { + my_instance_data->instance_dispatch_table->GetPhysicalDeviceFeatures( + gpu, &my_device_data->physDevProperties.features); + } loader_platform_thread_unlock_mutex(&globalLock); return result; } @@ -6624,6 +6632,19 @@ VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdExecuteCommands(VkCommandBuffer pCB->beginInfo.flags &= ~VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT; } } + if (!pCB->activeQueries.empty() && + !dev_data->physDevProperties.features.inheritedQueries) { + skipCall |= log_msg( + dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, + VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, + reinterpret_cast(pCommandBuffers[i]), __LINE__, + DRAWSTATE_INVALID_COMMAND_BUFFER, "DS", + "vkCmdExecuteCommands(): Secondary Command Buffer " + "(%#" PRIxLEAST64 ") cannot be submitted with a query in " + "flight and inherited queries not " + "supported on this device.", + reinterpret_cast(pCommandBuffers[i])); + } pSubCB->primaryCommandBuffer = pCB->commandBuffer; pCB->secondaryCommandBuffers.insert(pSubCB->commandBuffer); dev_data->globalInFlightCmdBuffers.insert(pSubCB->commandBuffer); -- cgit v1.2.3