Win32: Get 32-bit Windows build working
Also includes changes to allow simultaneous 32-bit and 64-bit Windows builds.
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 6397832..ebbe9fe 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -1,10 +1,22 @@
cmake_minimum_required(VERSION 2.8.11)
-if(NOT WIN32)
+# On Windows, we must pair Debug and Release appropriately
+if (WIN32)
+ # For Windows, since 32-bit and 64-bit items can co-exist, we build each in its own build directory.
+ # 32-bit target data goes in build32, and 64-bit target data goes into build64. So, include/link the
+ # appropriate data at build time.
+ if (CMAKE_CL_64)
+ set (BUILDTGT_DIR build64)
+ else ()
+ set (BUILDTGT_DIR build32)
+ endif()
+else()
include (FindPkgConfig)
find_package(XCB REQUIRED)
endif()
+set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
+
find_package(ImageMagick COMPONENTS MagickWand)
if(NOT ImageMagick_FOUND)
if(NOT WIN32)
@@ -45,18 +57,19 @@
# On Windows, we must pair Debug and Release appropriately
if (WIN32)
+
set_target_properties(glslang PROPERTIES
- IMPORTED_LOCATION "${GLSLANG_PREFIX}/build/glslang/Release/glslang.lib"
- IMPORTED_LOCATION_DEBUG "${GLSLANG_PREFIX}/build/glslang/Debug/glslang.lib")
+ IMPORTED_LOCATION "${GLSLANG_PREFIX}/${BUILDTGT_DIR}/glslang/Release/glslang.lib"
+ IMPORTED_LOCATION_DEBUG "${GLSLANG_PREFIX}/${BUILDTGT_DIR}/glslang/Debug/glslang.lib")
set_target_properties(OGLCompiler PROPERTIES
- IMPORTED_LOCATION "${GLSLANG_PREFIX}/build/OGLCompilersDLL/Release/OGLCompiler.lib"
- IMPORTED_LOCATION_DEBUG "${GLSLANG_PREFIX}/build/OGLCompilersDLL/Debug/OGLCompiler.lib")
+ IMPORTED_LOCATION "${GLSLANG_PREFIX}/${BUILDTGT_DIR}/OGLCompilersDLL/Release/OGLCompiler.lib"
+ IMPORTED_LOCATION_DEBUG "${GLSLANG_PREFIX}/${BUILDTGT_DIR}/OGLCompilersDLL/Debug/OGLCompiler.lib")
set_target_properties(OSDependent PROPERTIES
- IMPORTED_LOCATION "${GLSLANG_PREFIX}/build/glslang/OSDependent/Windows/Release/OSDependent.lib"
- IMPORTED_LOCATION_DEBUG "${GLSLANG_PREFIX}/build/glslang/OSDependent/Windows/Debug/OSDependent.lib")
+ IMPORTED_LOCATION "${GLSLANG_PREFIX}/${BUILDTGT_DIR}/glslang/OSDependent/Windows/Release/OSDependent.lib"
+ IMPORTED_LOCATION_DEBUG "${GLSLANG_PREFIX}/${BUILDTGT_DIR}/glslang/OSDependent/Windows/Debug/OSDependent.lib")
set_target_properties(SPIRV PROPERTIES
- IMPORTED_LOCATION "${GLSLANG_PREFIX}/build/SPIRV/Release/SPIRV.lib"
- IMPORTED_LOCATION_DEBUG "${GLSLANG_PREFIX}/build/SPIRV/Debug/SPIRV.lib")
+ IMPORTED_LOCATION "${GLSLANG_PREFIX}/${BUILDTGT_DIR}/SPIRV/Release/SPIRV.lib"
+ IMPORTED_LOCATION_DEBUG "${GLSLANG_PREFIX}/${BUILDTGT_DIR}/SPIRV/Debug/SPIRV.lib")
else ()
set_target_properties(glslang PROPERTIES
IMPORTED_LOCATION "${GLSLANG_PREFIX}/build/install/lib/libglslang.a")
diff --git a/tests/blit_tests.cpp b/tests/blit_tests.cpp
index 68e7938..af0b394 100644
--- a/tests/blit_tests.cpp
+++ b/tests/blit_tests.cpp
@@ -205,9 +205,9 @@
const VkSubresourceLayout &layout, void *data) const
{
//TODO handle array layers > 1
- for (int32_t z = 0; z < region.imageExtent.depth; z++) {
- for (int32_t y = 0; y < region.imageExtent.height; y++) {
- for (int32_t x = 0; x < region.imageExtent.width; x++) {
+ for (uint32_t z = 0; z < region.imageExtent.depth; z++) {
+ for (uint32_t y = 0; y < region.imageExtent.height; y++) {
+ for (uint32_t x = 0; x < region.imageExtent.width; x++) {
uint8_t *dst = static_cast<uint8_t *>(data);
dst += layout.offset + layout.depthPitch * z +
layout.rowPitch * y + buffer_cpp() * x;
diff --git a/tests/init.cpp b/tests/init.cpp
index 12d8dfd..c723d19 100644
--- a/tests/init.cpp
+++ b/tests/init.cpp
@@ -92,7 +92,7 @@
virtual void SetUp() {
VkResult err;
- int i;
+ size_t i;
this->app_info.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO;
this->app_info.pNext = NULL;
@@ -127,7 +127,7 @@
queue_props = this->m_device->phy().queue_properties();
for (i = 0; i < queue_props.size(); i++) {
if (queue_props[i].queueFlags & VK_QUEUE_GRAPHICS_BIT) {
- graphics_queue_node_index = i;
+ graphics_queue_node_index = (uint32_t)i;
break;
}
}
@@ -163,7 +163,7 @@
err = vkMapMemory(device(), gpu_mem, 0, VK_WHOLE_SIZE, 0, (void **) &pData);
ASSERT_VK_SUCCESS(err);
- memset(pData, 0x55, alloc_info.allocationSize);
+ memset(pData, 0x55, (size_t)alloc_info.allocationSize);
EXPECT_EQ(0x55, pData[0]) << "Memory read not same as write";
vkUnmapMemory(device(), gpu_mem);
diff --git a/tests/layer_validation_tests.cpp b/tests/layer_validation_tests.cpp
index 9598643..fa72840 100644
--- a/tests/layer_validation_tests.cpp
+++ b/tests/layer_validation_tests.cpp
@@ -207,7 +207,7 @@
VkBool32 m_msgFound;
};
-static VkBool32 myDbgFunc(
+static VKAPI_ATTR VkBool32 VKAPI_CALL myDbgFunc(
VkFlags msgFlags,
VkDebugReportObjectTypeEXT objType,
uint64_t srcObject,
diff --git a/tests/vkrenderframework.cpp b/tests/vkrenderframework.cpp
index a087a7c..f416990 100644
--- a/tests/vkrenderframework.cpp
+++ b/tests/vkrenderframework.cpp
@@ -495,7 +495,7 @@
// create VkDescriptorSetLayout
vector<VkDescriptorSetLayoutBinding> bindings;
bindings.resize(m_type_counts.size());
- for (int i = 0; i < m_type_counts.size(); i++) {
+ for (size_t i = 0; i < m_type_counts.size(); i++) {
bindings[i].binding = i;
bindings[i].descriptorType = m_type_counts[i].type;
bindings[i].descriptorCount = m_type_counts[i].descriptorCount;
@@ -807,7 +807,7 @@
const VkFormat tex_format = VK_FORMAT_B8G8R8A8_UNORM;
uint32_t tex_colors[2] = { 0xffff0000, 0xff00ff00 };
void *data;
- int32_t x, y;
+ uint32_t x, y;
VkImageObj stagingImage(device);
VkMemoryPropertyFlags reqs = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT;
@@ -1272,7 +1272,7 @@
info.stageCount = m_shaderObjs.size();
info.pStages = new VkPipelineShaderStageCreateInfo[info.stageCount];
- for (int i=0; i<m_shaderObjs.size(); i++)
+ for (size_t i=0; i<m_shaderObjs.size(); i++)
{
((VkPipelineShaderStageCreateInfo *) info.pStages)[i] =
m_shaderObjs[i]->GetStageCreateInfo();
diff --git a/tests/vktestbinding.cpp b/tests/vktestbinding.cpp
index e8efe7e..e01091c 100644
--- a/tests/vktestbinding.cpp
+++ b/tests/vktestbinding.cpp
@@ -271,7 +271,7 @@
const std::vector<VkQueueFamilyProperties> queue_props = phy_.queue_properties();
std::vector<VkDeviceQueueCreateInfo> queue_info;
queue_info.reserve(queue_props.size());
- for (int i = 0; i < queue_props.size(); i++) {
+ for (uint32_t i = 0; i < (uint32_t)queue_props.size(); i++) {
VkDeviceQueueCreateInfo qi = {};
qi.sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO;
qi.pNext = NULL;
diff --git a/tests/vktestframework.cpp b/tests/vktestframework.cpp
index ec2c41d..88213fe 100644
--- a/tests/vktestframework.cpp
+++ b/tests/vktestframework.cpp
@@ -498,7 +498,7 @@
void VkTestFramework::RecordImages(vector<VkImageObj *> images)
{
- for (int32_t i = 0; i < images.size(); i++) {
+ for (size_t i = 0; i < images.size(); i++) {
RecordImage(images[i]);
}
}
@@ -904,7 +904,7 @@
VkBool32 supportsPresent;
m_present_queue_node_index = UINT32_MAX;
std::vector<vk_testing::Queue *> queues = m_device.graphics_queues();
- for (int i=0; i < queues.size(); i++)
+ for (size_t i=0; i < queues.size(); i++)
{
int family_index = queues[i]->get_family_index();
m_fpGetPhysicalDeviceSurfaceSupportKHR(m_device.phy().handle(),