aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Forbes <chrisforbes@google.com>2016-10-12 10:21:19 +1300
committerChris Forbes <chrisforbes@google.com>2016-11-22 11:45:12 +1300
commit89fba1d446ca0aea1008835be82926ec9bb34f56 (patch)
tree6629178b9f2d9c35fc3a37328e9064ac3f5b33ce
parentfc25df6e6d16e337fdd33e45fea0a6115c80da53 (diff)
downloadusermoji-89fba1d446ca0aea1008835be82926ec9bb34f56.tar.xz
layers: Move complaints about presenting on bad queues to CV
Signed-off-by: Chris Forbes <chrisforbes@google.com>
-rw-r--r--layers/core_validation.cpp24
-rw-r--r--layers/core_validation_error_enums.h55
-rw-r--r--layers/swapchain.cpp37
3 files changed, 59 insertions, 57 deletions
diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp
index 155d5bd6..01ab4496 100644
--- a/layers/core_validation.cpp
+++ b/layers/core_validation.cpp
@@ -11735,6 +11735,8 @@ VKAPI_ATTR VkResult VKAPI_CALL QueuePresentKHR(VkQueue queue, const VkPresentInf
bool skip_call = false;
std::lock_guard<std::mutex> lock(global_lock);
+ auto queue_state = getQueueNode(dev_data, queue);
+
for (uint32_t i = 0; i < pPresentInfo->waitSemaphoreCount; ++i) {
auto pSemaphore = getSemaphoreNode(dev_data, pPresentInfo->pWaitSemaphores[i]);
if (pSemaphore && !pSemaphore->signaled) {
@@ -11781,6 +11783,28 @@ VKAPI_ATTR VkResult VKAPI_CALL QueuePresentKHR(VkQueue queue, const VkPresentInf
}
}
}
+
+ // All physical devices and queue families are required to be able
+ // to present to any native window on Android; require the
+ // application to have established support on any other platform.
+ if (!dev_data->instance_data->androidSurfaceExtensionEnabled) {
+ auto surface_state = getSurfaceState(dev_data->instance_data, swapchain_data->createInfo.surface);
+ auto support_it = surface_state->gpu_queue_support.find({dev_data->physical_device, queue_state->queueFamilyIndex});
+
+ if (support_it == surface_state->gpu_queue_support.end()) {
+ skip_call |=
+ log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_SWAPCHAIN_KHR_EXT,
+ reinterpret_cast<uint64_t const &>(pPresentInfo->pSwapchains[i]), __LINE__,
+ DRAWSTATE_SWAPCHAIN_UNSUPPORTED_QUEUE, "DS", "vkQueuePresentKHR: Presenting image without calling "
+ "vkGetPhysicalDeviceSurfaceSupportKHR");
+ } else if (!support_it->second) {
+ skip_call |= log_msg(
+ dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_SWAPCHAIN_KHR_EXT,
+ reinterpret_cast<uint64_t const &>(pPresentInfo->pSwapchains[i]), __LINE__,
+ DRAWSTATE_SWAPCHAIN_UNSUPPORTED_QUEUE, "DS", "vkQueuePresentKHR: Presenting image on queue that cannot "
+ "present to this surface");
+ }
+ }
}
}
diff --git a/layers/core_validation_error_enums.h b/layers/core_validation_error_enums.h
index 83707572..5ebd5094 100644
--- a/layers/core_validation_error_enums.h
+++ b/layers/core_validation_error_enums.h
@@ -46,7 +46,8 @@ enum MEM_TRACK_ERROR {
// Draw State ERROR codes
enum DRAW_STATE_ERROR {
- // TODO: Remove the comments here or expand them. There isn't any additional information in the
+ // TODO: Remove the comments here or expand them. There isn't any additional
+ // information in the
// comments than in the name in almost all cases.
DRAWSTATE_NONE, // Used for INFO & other non-error messages
DRAWSTATE_INTERNAL_ERROR, // Error with DrawState internal data structures
@@ -141,7 +142,8 @@ enum DRAW_STATE_ERROR {
DRAWSTATE_FRAMEBUFFER_INCOMPATIBLE, // Incompatible framebuffer between
// secondary cmdBuffer and active
// renderPass
- DRAWSTATE_INVALID_FRAMEBUFFER_CREATE_INFO, // Invalid VkFramebufferCreateInfo state
+ DRAWSTATE_INVALID_FRAMEBUFFER_CREATE_INFO, // Invalid VkFramebufferCreateInfo
+ // state
DRAWSTATE_INVALID_RENDERPASS, // Use of a NULL or otherwise invalid
// RenderPass object
DRAWSTATE_INVALID_RENDERPASS_CMD, // Invalid cmd submitted while a
@@ -180,16 +182,16 @@ enum DRAW_STATE_ERROR {
// was allocated from Pool w/o
// VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT
// bit set
- DRAWSTATE_VIEWPORT_SCISSOR_MISMATCH, // Count for viewports and scissors
- // mismatch and/or state doesn't match
- // count
- DRAWSTATE_INVALID_IMAGE_ASPECT, // Image aspect is invalid for the current
- // operation
- DRAWSTATE_MISSING_ATTACHMENT_REFERENCE, // Attachment reference must be
- // present in active subpass
- DRAWSTATE_SAMPLER_DESCRIPTOR_ERROR, // A Descriptor of *_SAMPLER type is
- // being updated with an invalid or bad
- // Sampler
+ DRAWSTATE_VIEWPORT_SCISSOR_MISMATCH, // Count for viewports and scissors
+ // mismatch and/or state doesn't match
+ // count
+ DRAWSTATE_INVALID_IMAGE_ASPECT, // Image aspect is invalid for the current
+ // operation
+ DRAWSTATE_MISSING_ATTACHMENT_REFERENCE, // Attachment reference must be
+ // present in active subpass
+ DRAWSTATE_SAMPLER_DESCRIPTOR_ERROR, // A Descriptor of *_SAMPLER type is
+ // being updated with an invalid or bad
+ // Sampler
DRAWSTATE_INCONSISTENT_IMMUTABLE_SAMPLER_UPDATE, // Descriptors of
// *COMBINED_IMAGE_SAMPLER
// type are being updated
@@ -223,22 +225,33 @@ enum DRAW_STATE_ERROR {
// violate device limit
DRAWSTATE_INDEPENDENT_BLEND, // If independent blending is not enabled, all
// elements of pAttachmentsMustBeIdentical
- DRAWSTATE_DISABLED_LOGIC_OP, // If logic operations is not enabled, logicOpEnable
+ DRAWSTATE_DISABLED_LOGIC_OP, // If logic operations is not enabled,
+ // logicOpEnable
// must be VK_FALSE
DRAWSTATE_INVALID_QUEUE_INDEX, // Specified queue index exceeds number
// of queried queue families
DRAWSTATE_INVALID_QUEUE_FAMILY, // Command buffer submitted on queue is from
// a different queue family
- DRAWSTATE_IMAGE_TRANSFER_GRANULARITY, // Violation of queue family's image transfer
+ DRAWSTATE_IMAGE_TRANSFER_GRANULARITY, // Violation of queue family's image
+ // transfer
// granularity
DRAWSTATE_PUSH_CONSTANTS_ERROR, // Push constants exceed maxPushConstantSize
- DRAWSTATE_INVALID_SUBPASS_INDEX, // Stepping beyond last subpass, or not reaching it
- DRAWSTATE_SWAPCHAIN_NO_SYNC_FOR_ACQUIRE, // AcquireNextImageKHR with no sync object
- DRAWSTATE_SWAPCHAIN_INVALID_IMAGE, // QueuePresentKHR with image index out of range
- DRAWSTATE_SWAPCHAIN_IMAGE_NOT_ACQUIRED, // QueuePresentKHR with image not acquired by app
- DRAWSTATE_SWAPCHAIN_ALREADY_EXISTS, // Surface has an existing swapchain that is not being replaced
- DRAWSTATE_SWAPCHAIN_WRONG_SURFACE, // Swapchain being replaced is not attached to the same surface
- DRAWSTATE_SWAPCHAIN_CREATE_BEFORE_QUERY, // Surface capabilities not queried before creating swapchain
+ DRAWSTATE_INVALID_SUBPASS_INDEX, // Stepping beyond last subpass, or not
+ // reaching it
+ DRAWSTATE_SWAPCHAIN_NO_SYNC_FOR_ACQUIRE, // AcquireNextImageKHR with no sync
+ // object
+ DRAWSTATE_SWAPCHAIN_INVALID_IMAGE, // QueuePresentKHR with image index out of
+ // range
+ DRAWSTATE_SWAPCHAIN_IMAGE_NOT_ACQUIRED, // QueuePresentKHR with image not
+ // acquired by app
+ DRAWSTATE_SWAPCHAIN_ALREADY_EXISTS, // Surface has an existing swapchain that
+ // is not being replaced
+ DRAWSTATE_SWAPCHAIN_WRONG_SURFACE, // Swapchain being replaced is not
+ // attached to the same surface
+ DRAWSTATE_SWAPCHAIN_CREATE_BEFORE_QUERY, // Surface capabilities not queried
+ // before creating swapchain
+ DRAWSTATE_SWAPCHAIN_UNSUPPORTED_QUEUE, // Presentation on queue that cannot
+ // support presentation
};
// Shader Checker ERROR codes
diff --git a/layers/swapchain.cpp b/layers/swapchain.cpp
index 82578d6f..3ae9bd4c 100644
--- a/layers/swapchain.cpp
+++ b/layers/swapchain.cpp
@@ -1715,45 +1715,10 @@ VKAPI_ATTR VkResult VKAPI_CALL QueuePresentKHR(VkQueue queue, const VkPresentInf
bool skip_call = false;
layer_data *my_data = get_my_data_ptr(get_dispatch_key(queue), layer_data_map);
- // Note: pPresentInfo->pResults is allowed to be NULL
-
- std::unique_lock<std::mutex> lock(global_lock);
- for (uint32_t i = 0; pPresentInfo && (i < pPresentInfo->swapchainCount); i++) {
- SwpSwapchain *pSwapchain = NULL;
- {
- auto it = my_data->swapchainMap.find(pPresentInfo->pSwapchains[i]);
- pSwapchain = (it == my_data->swapchainMap.end()) ? NULL : &it->second;
- }
- if (pSwapchain) {
- SwpQueue *pQueue = NULL;
- {
- auto it = my_data->queueMap.find(queue);
- pQueue = (it == my_data->queueMap.end()) ? NULL : &it->second;
- }
- SwpSurface *pSurface = pSwapchain->pSurface;
- if (pQueue && pSurface && pSurface->numQueueFamilyIndexSupport) {
- uint32_t queueFamilyIndex = pQueue->queueFamilyIndex;
- // Note: the 1st test is to ensure queueFamilyIndex is in range,
- // and the 2nd test is the validation check:
- if ((pSurface->numQueueFamilyIndexSupport > queueFamilyIndex) &&
- (!pSurface->pQueueFamilyIndexSupport[queueFamilyIndex])) {
- skip_call |=
- log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_SWAPCHAIN_KHR_EXT,
- reinterpret_cast<const uint64_t &>(pPresentInfo->pSwapchains[i]), __LINE__,
- SWAPCHAIN_SURFACE_NOT_SUPPORTED_WITH_QUEUE, swapchain_layer_name,
- "vkQueuePresentKHR() called with a swapchain whose surface is not supported for presention "
- "on this device with the queueFamilyIndex (i.e. %d) of the given queue.",
- queueFamilyIndex);
- }
- }
- }
- }
- lock.unlock();
-
if (!skip_call) {
// Call down the call chain:
result = my_data->device_dispatch_table->QueuePresentKHR(queue, pPresentInfo);
- lock.lock();
+ std::unique_lock<std::mutex> lock(global_lock);
if (pPresentInfo && ((result == VK_SUCCESS) || (result == VK_SUBOPTIMAL_KHR))) {
for (uint32_t i = 0; i < pPresentInfo->swapchainCount; i++) {