diff options
| author | Ian Elliott <ianelliott@google.com> | 2016-01-20 09:22:13 -0700 |
|---|---|---|
| committer | Jon Ashburn <jon@lunarg.com> | 2016-01-28 11:18:43 -0700 |
| commit | f4ecee92e1989705e83291bf15692893355b9c92 (patch) | |
| tree | d45b5dd35c4b1f26536e5c018897318062ebbd4d | |
| parent | abd5cabfa6e0f56ed231c2f18b6de2e3cc302e90 (diff) | |
| download | usermoji-f4ecee92e1989705e83291bf15692893355b9c92.tar.xz | |
Swapchain: Check that pCreateInfo->preTransform has one bit set.
| -rw-r--r-- | layers/swapchain.cpp | 9 |
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: |
