aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Forbes <chrisforbes@google.com>2016-10-11 16:21:32 +1300
committerChris Forbes <chrisforbes@google.com>2016-11-22 11:45:12 +1300
commitc82a17124103cfe9ba1cf3c4a9f1c78b5e9bcf54 (patch)
tree87af82162dadb0ba1e2cb45be1d2b1981594eb23
parent092f98388d93c0dca662bdff885d050f5af822c0 (diff)
downloadusermoji-c82a17124103cfe9ba1cf3c4a9f1c78b5e9bcf54.tar.xz
layers: Move caps query / swapchain creation interaction to CV
Signed-off-by: Chris Forbes <chrisforbes@google.com>
-rw-r--r--layers/core_validation.cpp7
-rw-r--r--layers/core_validation_error_enums.h1
-rw-r--r--layers/swapchain.cpp5
-rw-r--r--layers/vk_validation_layer_details.md1
4 files changed, 10 insertions, 4 deletions
diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp
index f073e118..696120aa 100644
--- a/layers/core_validation.cpp
+++ b/layers/core_validation.cpp
@@ -11610,6 +11610,13 @@ static bool PreCallValidateCreateSwapchainKHR(layer_data *dev_data, VkSwapchainC
"DS", "vkCreateSwapchainKHR(): pCreateInfo->oldSwapchain's surface is not pCreateInfo->surface"))
return true;
}
+ auto physical_device_state = getPhysicalDeviceState(dev_data->instance_data, dev_data->physical_device);
+ if (physical_device_state->vkGetPhysicalDeviceSurfaceCapabilitiesKHRState == UNCALLED) {
+ if (log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT,
+ reinterpret_cast<uint64_t>(dev_data->physical_device), __LINE__, DRAWSTATE_SWAPCHAIN_CREATE_BEFORE_QUERY, "DS",
+ "vkCreateSwapchainKHR(): surface capabilities not retrieved for this physical device"))
+ return true;
+ }
return false;
}
diff --git a/layers/core_validation_error_enums.h b/layers/core_validation_error_enums.h
index 9f2da576..83707572 100644
--- a/layers/core_validation_error_enums.h
+++ b/layers/core_validation_error_enums.h
@@ -238,6 +238,7 @@ enum DRAW_STATE_ERROR {
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
};
// Shader Checker ERROR codes
diff --git a/layers/swapchain.cpp b/layers/swapchain.cpp
index 45e00dc3..82578d6f 100644
--- a/layers/swapchain.cpp
+++ b/layers/swapchain.cpp
@@ -1234,10 +1234,7 @@ static bool validateCreateSwapchainKHR(VkDevice device, const VkSwapchainCreateI
// Validate pCreateInfo values with the results of
// vkGetPhysicalDeviceSurfaceCapabilitiesKHR():
if (!pPhysicalDevice || !pPhysicalDevice->gotSurfaceCapabilities) {
- skip_call |=
- log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT,
- reinterpret_cast<uint64_t>(device), __LINE__, SWAPCHAIN_CREATE_SWAP_WITHOUT_QUERY, swapchain_layer_name,
- "vkCreateSwapchainKHR() called before calling vkGetPhysicalDeviceSurfaceCapabilitiesKHR().");
+ // Check moved to CV
} else if (pCreateInfo) {
// Validate pCreateInfo->surface to make sure that
// vkGetPhysicalDeviceSurfaceSupportKHR() reported this as a supported
diff --git a/layers/vk_validation_layer_details.md b/layers/vk_validation_layer_details.md
index 15d91db5..647ed6bd 100644
--- a/layers/vk_validation_layer_details.md
+++ b/layers/vk_validation_layer_details.md
@@ -124,6 +124,7 @@ The Draw State portion of the core validation layer tracks state leading into Dr
| Can't present a non-owned image | Validates that application only presents images that it owns | SWAPCHAIN_IMAGE_NOT_ACQUIRED | vkQueuePresentKHR | TODO | None |
| Surface already has swapchain | Cannot create a swapchain for a surface that already has one [other than the swapchain being replaced] | SWAPCHAIN_ALREADY_EXISTS | vkCreateSwapchainKHR | TODO | None |
| Swapchain replacement | pCreateInfo->surface must match pCreateInfo->oldSwapchain's surface | SWAPCHAIN_WRONG_SURFACE | vkCreateSwapchainKHR | TODO | None |
+| Swapchain created without queries | Application must query capabilities etc before creating a swapchain | SWAPCHAIN_CREATE_BEFORE_QUERY | vkCreateSwapchainKHR | TODO | None |
### VK_LAYER_LUNARG_core_validation Draw State Pending Work