From 0b50e7e7d8a79874fc72ecb74cbbd8e33e7bc367 Mon Sep 17 00:00:00 2001
From: Vanessa Karolek <vaka1997@uni-koblenz.de>
Date: Fri, 25 Jun 2021 00:21:40 +0200
Subject: [PATCH] [#60][Fix] fix MSVC build error

Here the output, if this is not fixed:

C:\Users\Vayuni\workspace\git\cg-fp_vulkan\vkcv-framework\modules\gui\src\vkcv\gui\GUI.cpp(76): error C2440: '=': cannot convert from 'const vk::Instance' to 'VkInstance'
C:\Users\Vayuni\workspace\git\cg-fp_vulkan\vkcv-framework\modules\gui\src\vkcv\gui\GUI.cpp(76): note: No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
C:\Users\Vayuni\workspace\git\cg-fp_vulkan\vkcv-framework\modules\gui\src\vkcv\gui\GUI.cpp(77): error C2440: '=': cannot convert from 'const vk::PhysicalDevice' to 'VkPhysicalDevice'
C:\Users\Vayuni\workspace\git\cg-fp_vulkan\vkcv-framework\modules\gui\src\vkcv\gui\GUI.cpp(77): note: No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
C:\Users\Vayuni\workspace\git\cg-fp_vulkan\vkcv-framework\modules\gui\src\vkcv\gui\GUI.cpp(78): error C2440: '=': cannot convert from 'const vk::Device' to 'VkDevice'
C:\Users\Vayuni\workspace\git\cg-fp_vulkan\vkcv-framework\modules\gui\src\vkcv\gui\GUI.cpp(78): note: No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
C:\Users\Vayuni\workspace\git\cg-fp_vulkan\vkcv-framework\modules\gui\src\vkcv\gui\GUI.cpp(80): error C2440: '=': cannot convert from 'const vk::Queue' to 'VkQueue'
C:\Users\Vayuni\workspace\git\cg-fp_vulkan\vkcv-framework\modules\gui\src\vkcv\gui\GUI.cpp(80): note: No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
C:\Users\Vayuni\workspace\git\cg-fp_vulkan\vkcv-framework\modules\gui\src\vkcv\gui\GUI.cpp(81): error C2440: '=': cannot convert from 'nullptr' to 'VkPipelineCache'
C:\Users\Vayuni\workspace\git\cg-fp_vulkan\vkcv-framework\modules\gui\src\vkcv\gui\GUI.cpp(81): note: A native nullptr can only be converted to bool or, using reinterpret_cast, to an integral type
C:\Users\Vayuni\workspace\git\cg-fp_vulkan\vkcv-framework\modules\gui\src\vkcv\gui\GUI.cpp(82): error C2440: '=': cannot convert from 'vk::DescriptorPool' to 'VkDescriptorPool'
C:\Users\Vayuni\workspace\git\cg-fp_vulkan\vkcv-framework\modules\gui\src\vkcv\gui\GUI.cpp(82): note: No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
C:\Users\Vayuni\workspace\git\cg-fp_vulkan\vkcv-framework\modules\gui\src\vkcv\gui\GUI.cpp(140): error C2664: 'bool ImGui_ImplVulkan_Init(ImGui_ImplVulkan_InitInfo *,VkRenderPass)': cannot convert argument 2 from 'vk::RenderPass' to 'VkRenderPass'
C:\Users\Vayuni\workspace\git\cg-fp_vulkan\vkcv-framework\modules\gui\src\vkcv\gui\GUI.cpp(140): note: No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
C:\Users\Vayuni\workspace\git\cg-fp_vulkan\vkcv-framework\modules\gui\lib\imgui/backends/imgui_impl_vulkan.h(65): note: see declaration of 'ImGui_ImplVulkan_Init'
C:\Users\Vayuni\workspace\git\cg-fp_vulkan\vkcv-framework\modules\gui\src\vkcv\gui\GUI.cpp(145): error C2664: 'bool ImGui_ImplVulkan_CreateFontsTexture(VkCommandBuffer)': cannot convert argument 1 from 'const vk::CommandBuffer' to 'VkCommandBuffer'
C:\Users\Vayuni\workspace\git\cg-fp_vulkan\vkcv-framework\modules\gui\src\vkcv\gui\GUI.cpp(145): note: No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
C:\Users\Vayuni\workspace\git\cg-fp_vulkan\vkcv-framework\modules\gui\lib\imgui/backends/imgui_impl_vulkan.h(69): note: see declaration of 'ImGui_ImplVulkan_CreateFontsTexture'
C:\Users\Vayuni\workspace\git\cg-fp_vulkan\vkcv-framework\modules\gui\src\vkcv\gui\GUI.cpp(233): error C2664: 'void ImGui_ImplVulkan_RenderDrawData(ImDrawData *,VkCommandBuffer,VkPipeline)': cannot convert argument 2 from 'const vk::CommandBuffer' to 'VkCommandBuffer'
C:\Users\Vayuni\workspace\git\cg-fp_vulkan\vkcv-framework\modules\gui\src\vkcv\gui\GUI.cpp(233): note: No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
C:\Users\Vayuni\workspace\git\cg-fp_vulkan\vkcv-framework\modules\gui\lib\imgui/backends/imgui_impl_vulkan.h(68): note: see declaration of 'ImGui_ImplVulkan_RenderDrawData'
NMAKE : fatal error U1077: 'C:\PROGRA~2\MICROS~2\2019\COMMUN~1\VC\Tools\MSVC\1428~1.299\bin\Hostx86\x86\cl.exe' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\bin\HostX86\x86\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\bin\HostX86\x86\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\bin\HostX86\x86\nmake.exe"' : return code '0x2'
Stop.
---
 modules/gui/src/vkcv/gui/GUI.cpp | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/modules/gui/src/vkcv/gui/GUI.cpp b/modules/gui/src/vkcv/gui/GUI.cpp
index a9a8bd01..38bb6894 100644
--- a/modules/gui/src/vkcv/gui/GUI.cpp
+++ b/modules/gui/src/vkcv/gui/GUI.cpp
@@ -73,13 +73,13 @@ namespace vkcv::gui {
 		);
 		
 		ImGui_ImplVulkan_InitInfo init_info = {};
-		init_info.Instance = m_context.getInstance();
-		init_info.PhysicalDevice = m_context.getPhysicalDevice();
-		init_info.Device = m_context.getDevice();
+		init_info.Instance = static_cast<VkInstance>(m_context.getInstance());
+		init_info.PhysicalDevice = static_cast<VkPhysicalDevice>(m_context.getPhysicalDevice());
+		init_info.Device = static_cast<VkDevice>(m_context.getDevice());
 		init_info.QueueFamily = graphicsQueueFamilyIndex;
-		init_info.Queue = m_context.getQueueManager().getGraphicsQueues()[0].handle;
-		init_info.PipelineCache = nullptr;
-		init_info.DescriptorPool = m_descriptor_pool;
+		init_info.Queue = static_cast<VkQueue>(m_context.getQueueManager().getGraphicsQueues()[0].handle);
+		init_info.PipelineCache = 0;
+		init_info.DescriptorPool = static_cast<VkDescriptorPool>(m_descriptor_pool);
 		init_info.Allocator = nullptr;
 		init_info.MinImageCount = swapchain.getImageCount();
 		init_info.ImageCount = swapchain.getImageCount();
@@ -137,12 +137,12 @@ namespace vkcv::gui {
 		
 		m_render_pass = m_context.getDevice().createRenderPass(passCreateInfo);
 		
-		ImGui_ImplVulkan_Init(&init_info, m_render_pass);
+		ImGui_ImplVulkan_Init(&init_info, static_cast<VkRenderPass>(m_render_pass));
 		
 		const SubmitInfo submitInfo { QueueType::Graphics, {}, {} };
 		
 		m_core.recordAndSubmitCommandsImmediate(submitInfo, [](const vk::CommandBuffer& commandBuffer) {
-			ImGui_ImplVulkan_CreateFontsTexture(commandBuffer);
+			ImGui_ImplVulkan_CreateFontsTexture(static_cast<VkCommandBuffer>(commandBuffer));
 		}, []() {
 			ImGui_ImplVulkan_DestroyFontUploadObjects();
 		});
@@ -230,7 +230,7 @@ namespace vkcv::gui {
 			
 			commandBuffer.beginRenderPass(beginInfo, vk::SubpassContents::eInline);
 			
-			ImGui_ImplVulkan_RenderDrawData(drawData, commandBuffer);
+			ImGui_ImplVulkan_RenderDrawData(drawData, static_cast<VkCommandBuffer>(commandBuffer));
 			
 			commandBuffer.endRenderPass();
 		}, [&]() {
-- 
GitLab