diff options
| author | Dustin Graves <dustin@lunarg.com> | 2016-04-06 10:16:05 -0600 |
|---|---|---|
| committer | Dustin Graves <dustin@lunarg.com> | 2016-04-06 12:03:51 -0600 |
| commit | 8cfaf1beebcfc3bfcd26d060257b3339df25972d (patch) | |
| tree | dbcec476c19c019b95e7d640fa64d2bfc8020e45 | |
| parent | 6eae0eb4a02dfb28c5e80c8f369f8defc648f9b7 (diff) | |
| download | usermoji-8cfaf1beebcfc3bfcd26d060257b3339df25972d.tar.xz | |
demos/tests: Fix MSVS type warnings
Fixes the following MSVS warnings:
- C4800 - forcing value to bool 'true' or 'false'
- C4244 - conversion from type1 to type2, possible loss of data
- C4267 - conversion from size_t to type, possible loss of data
Change-Id: I78576c48c5d42e4c9116a83c5f4a4f4a5035e0fc
| -rw-r--r-- | demos/smoke/Meshes.cpp | 4 | ||||
| -rw-r--r-- | demos/smoke/ShellWin32.cpp | 3 | ||||
| -rw-r--r-- | demos/smoke/Simulation.cpp | 7 | ||||
| -rw-r--r-- | demos/smoke/Smoke.cpp | 11 |
4 files changed, 12 insertions, 13 deletions
diff --git a/demos/smoke/Meshes.cpp b/demos/smoke/Meshes.cpp index 5fdb8fad..b65674ab 100644 --- a/demos/smoke/Meshes.cpp +++ b/demos/smoke/Meshes.cpp @@ -116,7 +116,7 @@ public: uint32_t vertex_count() const { - return positions_.size(); + return static_cast<uint32_t>(positions_.size()); } VkDeviceSize vertex_buffer_size() const @@ -142,7 +142,7 @@ public: uint32_t index_count() const { - return faces_.size() * 3; + return static_cast<uint32_t>(faces_.size()) * 3; } VkDeviceSize index_buffer_size() const diff --git a/demos/smoke/ShellWin32.cpp b/demos/smoke/ShellWin32.cpp index 1a1a844c..4f205a92 100644 --- a/demos/smoke/ShellWin32.cpp +++ b/demos/smoke/ShellWin32.cpp @@ -140,7 +140,8 @@ PFN_vkGetInstanceProcAddr ShellWin32::load_vk() bool ShellWin32::can_present(VkPhysicalDevice phy, uint32_t queue_family) { - return vk::GetPhysicalDeviceWin32PresentationSupportKHR(phy, queue_family); + return vk::GetPhysicalDeviceWin32PresentationSupportKHR( + phy, queue_family) == VK_TRUE; } VkSurfaceKHR ShellWin32::create_surface(VkInstance instance) diff --git a/demos/smoke/Simulation.cpp b/demos/smoke/Simulation.cpp index dab45d70..c219647e 100644 --- a/demos/smoke/Simulation.cpp +++ b/demos/smoke/Simulation.cpp @@ -297,11 +297,8 @@ Simulation::Simulation(int object_count) float scale = mesh.scale(type); objects_.emplace_back(Object{ - type, - glm::vec3(0.5 + 0.5 * (float) i / object_count), - color.pick(), - Animation(random_dev_(), scale), - Path(random_dev_()), + type, glm::vec3(0.5f + 0.5f * (float)i / object_count), + color.pick(), Animation(random_dev_(), scale), Path(random_dev_()), }); } } diff --git a/demos/smoke/Smoke.cpp b/demos/smoke/Smoke.cpp index ed6e0178..8f72bdb8 100644 --- a/demos/smoke/Smoke.cpp +++ b/demos/smoke/Smoke.cpp @@ -74,7 +74,8 @@ void Smoke::init_workers() worker_count = 1; } - const int object_per_worker = sim_.objects().size() / worker_count; + const int object_per_worker = + static_cast<int>(sim_.objects().size()) / worker_count; int object_begin = 0, object_end = 0; workers_.reserve(worker_count); @@ -83,7 +84,7 @@ void Smoke::init_workers() if (i < worker_count - 1) object_end += object_per_worker; else - object_end = sim_.objects().size(); + object_end = static_cast<int>(sim_.objects().size()); Worker *worker = new Worker(*this, i, object_begin, object_end); workers_.emplace_back(std::unique_ptr<Worker>(worker)); @@ -471,7 +472,7 @@ void Smoke::create_buffers() object_data_size += alignment - (object_data_size % alignment); // update simulation - sim_.set_frame_data_size(object_data_size); + sim_.set_frame_data_size(static_cast<uint32_t>(object_data_size)); VkBufferCreateInfo buf_info = {}; buf_info.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO; @@ -525,11 +526,11 @@ void Smoke::create_descriptor_sets() { VkDescriptorPoolSize desc_pool_size = {}; desc_pool_size.type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC; - desc_pool_size.descriptorCount = frame_data_.size(); + desc_pool_size.descriptorCount = static_cast<uint32_t>(frame_data_.size()); VkDescriptorPoolCreateInfo desc_pool_info = {}; desc_pool_info.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO; - desc_pool_info.maxSets = frame_data_.size(); + desc_pool_info.maxSets = static_cast<uint32_t>(frame_data_.size()); desc_pool_info.poolSizeCount = 1; desc_pool_info.pPoolSizes = &desc_pool_size; |
