aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Elliott <ianelliott@google.com>2016-01-20 09:22:13 -0700
committerJon Ashburn <jon@lunarg.com>2016-01-28 11:18:43 -0700
commitf4ecee92e1989705e83291bf15692893355b9c92 (patch)
treed45b5dd35c4b1f26536e5c018897318062ebbd4d
parentabd5cabfa6e0f56ed231c2f18b6de2e3cc302e90 (diff)
downloadusermoji-f4ecee92e1989705e83291bf15692893355b9c92.tar.xz
Swapchain: Check that pCreateInfo->preTransform has one bit set.
-rw-r--r--layers/swapchain.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/layers/swapchain.cpp b/layers/swapchain.cpp
index ea9d8be4..baa00d9e 100644
--- a/layers/swapchain.cpp
+++ b/layers/swapchain.cpp
@@ -1296,9 +1296,12 @@ static VkBool32 validateCreateSwapchainKHR(
pCapabilities->currentExtent.width,
pCapabilities->currentExtent.height);
}
- // Validate pCreateInfo->preTransform against
- // VkSurfaceCapabilitiesKHR::supportedTransforms:
- if (!((pCreateInfo->preTransform) & pCapabilities->supportedTransforms)) {
+ // Validate pCreateInfo->preTransform has one bit set (1st two
+ // lines of if-statement), which bit is also set in
+ // VkSurfaceCapabilitiesKHR::supportedTransforms (3rd line of if-statement):
+ if (!pCreateInfo->preTransform ||
+ (pCreateInfo->preTransform & (pCreateInfo->preTransform - 1)) ||
+ !(pCreateInfo->preTransform & pCapabilities->supportedTransforms)) {
// This is an error situation; one for which we'd like to give
// the developer a helpful, multi-line error message. Build it
// up a little at a time, and then log it: