From f4ecee92e1989705e83291bf15692893355b9c92 Mon Sep 17 00:00:00 2001 From: Ian Elliott Date: Wed, 20 Jan 2016 09:22:13 -0700 Subject: Swapchain: Check that pCreateInfo->preTransform has one bit set. --- layers/swapchain.cpp | 9 ++++++--- 1 file 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: -- cgit v1.2.3