layers: Fix Windows compiler warnings
diff --git a/layers/device_limits.cpp b/layers/device_limits.cpp
index 32327b2..b8a2bc9 100644
--- a/layers/device_limits.cpp
+++ b/layers/device_limits.cpp
@@ -240,6 +240,7 @@
log_msg(my_data->report_data, VK_DBG_REPORT_ERROR_BIT, VK_OBJECT_TYPE_INSTANCE, 0, 0, DEVLIMITS_INVALID_INSTANCE, "DL",
"Invalid instance (%#" PRIxLEAST64 ") passed into vkEnumeratePhysicalDevices().", instance);
}
+ return VK_ERROR_VALIDATION_FAILED;
}
VK_LAYER_EXPORT VkResult VKAPI vkGetPhysicalDeviceFeatures(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures* pFeatures)
@@ -311,6 +312,7 @@
log_msg(phy_dev_data->report_data, VK_DBG_REPORT_ERROR_BIT, VK_OBJECT_TYPE_PHYSICAL_DEVICE, 0, 0, DEVLIMITS_INVALID_PHYSICAL_DEVICE, "DL",
"Invalid physicalDevice (%#" PRIxLEAST64 ") passed into vkGetPhysicalDeviceQueueFamilyProperties().", physicalDevice);
}
+ return VK_ERROR_VALIDATION_FAILED;
}
VK_LAYER_EXPORT VkResult VKAPI vkGetPhysicalDeviceMemoryProperties(VkPhysicalDevice physicalDevice, VkPhysicalDeviceMemoryProperties* pMemoryProperties)
@@ -504,7 +506,6 @@
{
VkBool32 skipCall = VK_FALSE;
VkResult result = VK_ERROR_VALIDATION_FAILED;
- VkImageType type;
VkImageFormatProperties ImageFormatProperties = {0};
layer_data *dev_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map);
@@ -520,7 +521,7 @@
"CreateImage called before querying device properties ");
}
- uint32_t imageGranularity = phy_dev_data->physicalDeviceProperties->limits.bufferImageGranularity;
+ VkDeviceSize imageGranularity = phy_dev_data->physicalDeviceProperties->limits.bufferImageGranularity;
imageGranularity = imageGranularity == 1 ? 0 : imageGranularity;
if ((pCreateInfo->extent.depth > ImageFormatProperties.maxExtent.depth) ||
diff --git a/tests/image_tests.cpp b/tests/image_tests.cpp
index aec9460..2d7ff5f 100644
--- a/tests/image_tests.cpp
+++ b/tests/image_tests.cpp
@@ -59,7 +59,6 @@
#include <string.h>
#include <vulkan.h>
-#include "gtest-1.7.0/include/gtest/gtest.h"
#include "vktestbinding.h"
#include "test_common.h"
@@ -110,7 +109,7 @@
ASSERT_LE(this->gpu_count, ARRAY_SIZE(objs)) << "Too many GPUs";
err = vkEnumeratePhysicalDevices(this->inst, &this->gpu_count, objs);
ASSERT_VK_SUCCESS(err);
- ASSERT_GE(this->gpu_count, 1) << "No GPU available";
+ ASSERT_GE(this->gpu_count, (uint32_t) 1) << "No GPU available";
this->m_device = new vk_testing::Device(objs[0]);
this->m_device->init();
diff --git a/tests/init.cpp b/tests/init.cpp
index e32a29b..0c058ea 100644
--- a/tests/init.cpp
+++ b/tests/init.cpp
@@ -59,7 +59,6 @@
#include <string.h>
#include <vulkan.h>
-#include "gtest-1.7.0/include/gtest/gtest.h"
#include "vktestbinding.h"
#include "test_common.h"
@@ -116,7 +115,7 @@
ASSERT_LE(this->gpu_count, ARRAY_SIZE(objs)) << "Too many GPUs";
err = vkEnumeratePhysicalDevices(inst, &this->gpu_count, objs);
ASSERT_VK_SUCCESS(err);
- ASSERT_GE(this->gpu_count, 1) << "No GPU available";
+ ASSERT_GE(this->gpu_count, (uint32_t) 1) << "No GPU available";
m_device_id = 0;
this->m_device = new vk_testing::Device(objs[m_device_id]);
diff --git a/tests/layer_validation_tests.cpp b/tests/layer_validation_tests.cpp
index dc56a4e..aef6ca2 100644
--- a/tests/layer_validation_tests.cpp
+++ b/tests/layer_validation_tests.cpp
@@ -1,6 +1,6 @@
#include <vulkan.h>
#include "vk_debug_report_lunarg.h"
-#include "gtest-1.7.0/include/gtest/gtest.h"
+#include "test_common.h"
#include "vkrenderframework.h"
#include "vk_layer_config.h"
#include "../icd/common/icd-spv.h"
@@ -4043,7 +4043,7 @@
* provide a uniform buffer in 0.0
*/
msgFlags = m_errorMonitor->GetState(&msgString);
- ASSERT_TRUE(msgFlags & VK_DBG_REPORT_ERROR_BIT);
+ ASSERT_TRUE((msgFlags & VK_DBG_REPORT_ERROR_BIT) == VK_DBG_REPORT_ERROR_BIT);
if (!strstr(msgString.c_str(),"not declared in pipeline layout")) {
FAIL() << "Incorrect error: " << msgString;
}
diff --git a/tests/render_tests.cpp b/tests/render_tests.cpp
index fe42c43..6118e26 100644
--- a/tests/render_tests.cpp
+++ b/tests/render_tests.cpp
@@ -70,7 +70,7 @@
#ifdef DEBUG_CALLBACK
#include <vk_debug_report_lunarg.h>
#endif
-#include "gtest-1.7.0/include/gtest/gtest.h"
+#include "test_common.h"
#include "icd-spv.h"
diff --git a/tests/test_common.h b/tests/test_common.h
index 1551653..5827417 100644
--- a/tests/test_common.h
+++ b/tests/test_common.h
@@ -10,8 +10,22 @@
#include <vulkan.h>
#include <vk_sdk_platform.h>
+#ifdef WIN32
+#pragma warning( push )
+/*
+ warnings 4251 and 4275 have to do with potential dll-interface mismatch
+ between library (gtest) and users. Since we build the gtest library
+ as part of the test build we know that the dll-interface will match and
+ can disable these warnings.
+ */
+#pragma warning(disable: 4251)
+#pragma warning(disable: 4275)
+#endif
#include "gtest/gtest.h"
#include "gtest-1.7.0/include/gtest/gtest.h"
+#ifdef WIN32
+#pragma warning( pop )
+#endif
#include "vktestbinding.h"
#define ASSERT_VK_SUCCESS(err) ASSERT_EQ(VK_SUCCESS, err) << vk_result_string(err)
diff --git a/tests/test_environment.h b/tests/test_environment.h
index 9f6891e..23a610f 100644
--- a/tests/test_environment.h
+++ b/tests/test_environment.h
@@ -20,7 +20,7 @@
private:
VkApplicationInfo app_;
- int default_dev_;
+ uint32_t default_dev_;
VkInstance inst;
std::vector<Device *> devs_;
diff --git a/tests/vkrenderframework.cpp b/tests/vkrenderframework.cpp
index 13fff54..87cdaca 100644
--- a/tests/vkrenderframework.cpp
+++ b/tests/vkrenderframework.cpp
@@ -111,7 +111,7 @@
ASSERT_VK_SUCCESS(err);
err = vkEnumeratePhysicalDevices(inst, &this->gpu_count, objs);
ASSERT_VK_SUCCESS(err);
- ASSERT_GE(this->gpu_count, 1) << "No GPU available";
+ ASSERT_GE(this->gpu_count, (uint32_t) 1) << "No GPU available";
if (dbgFunction) {
m_dbgCreateMsgCallback = (PFN_vkDbgCreateMsgCallback) vkGetInstanceProcAddr(this->inst, "vkDbgCreateMsgCallback");
ASSERT_NE(m_dbgCreateMsgCallback, (PFN_vkDbgCreateMsgCallback) NULL) << "Did not get function pointer for DbgCreateMsgCallback";
diff --git a/tests/vktestframework.h b/tests/vktestframework.h
index ea8dce3..99ca276 100644
--- a/tests/vktestframework.h
+++ b/tests/vktestframework.h
@@ -23,7 +23,7 @@
#ifndef VKTESTFRAMEWORK_H
#define VKTESTFRAMEWORK_H
-#include "gtest-1.7.0/include/gtest/gtest.h"
+//#include "gtest-1.7.0/include/gtest/gtest.h"
#include "glslang/Public/ShaderLang.h"
#include "SPIRV/GLSL.std.450.h"
#include "icd-spv.h"