Examples: Vulkan: FIxed warnings in 32-bit modes (vulkan uses VkDeviceSize which is always 64-bit long)

This commit is contained in:
omar 2018-01-28 20:03:41 +01:00
parent 94090eb08f
commit 66d5712a8a

View File

@ -36,7 +36,7 @@ static VkDescriptorPool g_DescriptorPool = VK_NULL_HANDLE;
static void (*g_CheckVkResult)(VkResult err) = NULL; static void (*g_CheckVkResult)(VkResult err) = NULL;
static VkCommandBuffer g_CommandBuffer = VK_NULL_HANDLE; static VkCommandBuffer g_CommandBuffer = VK_NULL_HANDLE;
static size_t g_BufferMemoryAlignment = 256; static VkDeviceSize g_BufferMemoryAlignment = 256;
static VkPipelineCreateFlags g_PipelineCreateFlags = 0; static VkPipelineCreateFlags g_PipelineCreateFlags = 0;
static int g_FrameIndex = 0; static int g_FrameIndex = 0;
@ -52,8 +52,8 @@ static VkImageView g_FontView = VK_NULL_HANDLE;
static VkDeviceMemory g_VertexBufferMemory[IMGUI_VK_QUEUED_FRAMES] = {}; static VkDeviceMemory g_VertexBufferMemory[IMGUI_VK_QUEUED_FRAMES] = {};
static VkDeviceMemory g_IndexBufferMemory[IMGUI_VK_QUEUED_FRAMES] = {}; static VkDeviceMemory g_IndexBufferMemory[IMGUI_VK_QUEUED_FRAMES] = {};
static size_t g_VertexBufferSize[IMGUI_VK_QUEUED_FRAMES] = {}; static VkDeviceSize g_VertexBufferSize[IMGUI_VK_QUEUED_FRAMES] = {};
static size_t g_IndexBufferSize[IMGUI_VK_QUEUED_FRAMES] = {}; static VkDeviceSize g_IndexBufferSize[IMGUI_VK_QUEUED_FRAMES] = {};
static VkBuffer g_VertexBuffer[IMGUI_VK_QUEUED_FRAMES] = {}; static VkBuffer g_VertexBuffer[IMGUI_VK_QUEUED_FRAMES] = {};
static VkBuffer g_IndexBuffer[IMGUI_VK_QUEUED_FRAMES] = {}; static VkBuffer g_IndexBuffer[IMGUI_VK_QUEUED_FRAMES] = {};
@ -164,7 +164,7 @@ void ImGui_ImplGlfwVulkan_RenderDrawLists(ImDrawData* draw_data)
vkDestroyBuffer(g_Device, g_VertexBuffer[g_FrameIndex], g_Allocator); vkDestroyBuffer(g_Device, g_VertexBuffer[g_FrameIndex], g_Allocator);
if (g_VertexBufferMemory[g_FrameIndex]) if (g_VertexBufferMemory[g_FrameIndex])
vkFreeMemory(g_Device, g_VertexBufferMemory[g_FrameIndex], g_Allocator); vkFreeMemory(g_Device, g_VertexBufferMemory[g_FrameIndex], g_Allocator);
size_t vertex_buffer_size = ((vertex_size-1) / g_BufferMemoryAlignment+1) * g_BufferMemoryAlignment; VkDeviceSize vertex_buffer_size = ((vertex_size-1) / g_BufferMemoryAlignment+1) * g_BufferMemoryAlignment;
VkBufferCreateInfo buffer_info = {}; VkBufferCreateInfo buffer_info = {};
buffer_info.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO; buffer_info.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO;
buffer_info.size = vertex_buffer_size; buffer_info.size = vertex_buffer_size;
@ -194,7 +194,7 @@ void ImGui_ImplGlfwVulkan_RenderDrawLists(ImDrawData* draw_data)
vkDestroyBuffer(g_Device, g_IndexBuffer[g_FrameIndex], g_Allocator); vkDestroyBuffer(g_Device, g_IndexBuffer[g_FrameIndex], g_Allocator);
if (g_IndexBufferMemory[g_FrameIndex]) if (g_IndexBufferMemory[g_FrameIndex])
vkFreeMemory(g_Device, g_IndexBufferMemory[g_FrameIndex], g_Allocator); vkFreeMemory(g_Device, g_IndexBufferMemory[g_FrameIndex], g_Allocator);
size_t index_buffer_size = ((index_size-1) / g_BufferMemoryAlignment+1) * g_BufferMemoryAlignment; VkDeviceSize index_buffer_size = ((index_size-1) / g_BufferMemoryAlignment+1) * g_BufferMemoryAlignment;
VkBufferCreateInfo buffer_info = {}; VkBufferCreateInfo buffer_info = {};
buffer_info.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO; buffer_info.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO;
buffer_info.size = index_buffer_size; buffer_info.size = index_buffer_size;