aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Forbes <chrisforbes@google.com>2016-12-09 10:39:26 +1300
committerChris Forbes <chrisforbes@google.com>2016-12-14 15:25:29 +1300
commita6eb629273ca43dfadc2295a8c18b5b46761028c (patch)
treea1846c422031b1997272e619f22b7afc3dcc88a6
parent7857f328126220842fc0f8dadff167f007ce55de (diff)
downloadusermoji-a6eb629273ca43dfadc2295a8c18b5b46761028c.tar.xz
layers: Track whether a swapchain has been replaced
If a swapchain is used as VkSwapchainCreateInfoKHR::oldSwapchain, then it is replaced. This occurs even if the new swapchain creation fails. Signed-off-by: Chris Forbes <chrisforbes@google.com>
-rw-r--r--layers/core_validation.cpp3
-rw-r--r--layers/core_validation_types.h1
2 files changed, 4 insertions, 0 deletions
diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp
index 6992041a..7d79e2c6 100644
--- a/layers/core_validation.cpp
+++ b/layers/core_validation.cpp
@@ -11984,6 +11984,9 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateSwapchainKHR(VkDevice device, const VkSwapc
}
// Spec requires that even if CreateSwapchainKHR fails, oldSwapchain behaves as replaced.
+ if (old_swapchain_state) {
+ old_swapchain_state->replaced = true;
+ }
surface_state->old_swapchain = old_swapchain_state;
return result;
diff --git a/layers/core_validation_types.h b/layers/core_validation_types.h
index 838a82c2..298848a4 100644
--- a/layers/core_validation_types.h
+++ b/layers/core_validation_types.h
@@ -292,6 +292,7 @@ class SWAPCHAIN_NODE {
safe_VkSwapchainCreateInfoKHR createInfo;
VkSwapchainKHR swapchain;
std::vector<VkImage> images;
+ bool replaced = false;
SWAPCHAIN_NODE(const VkSwapchainCreateInfoKHR *pCreateInfo, VkSwapchainKHR swapchain)
: createInfo(pCreateInfo), swapchain(swapchain) {}
};