message: Updated ImGui example to support recent ImGui version
  Refs
diff: @@ -74,10 +74,12 @@ public:
  ImGUI(VulkanExampleBase *example) : example(example)
  {
  device = example->vulkanDevice;
  + ImGui::CreateContext();
  };
  ~ImGUI()
  {
  + ImGui::DestroyContext();
  // Release all Vulkan resources required for rendering imGui
  vertexBuffer.destroy();
  indexBuffer.destroy();
  @@ -375,7 +377,7 @@ public:
  ImGui::End();
  ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiSetCond_FirstUseEver);
  - ImGui::ShowTestWindow();
  + ImGui::ShowDemoWindow();
  // Render to generate draw buffers
  ImGui::Render();
  @@ -390,6 +392,10 @@ public:
  VkDeviceSize vertexBufferSize = imDrawData->TotalVtxCount * sizeof(ImDrawVert);
  VkDeviceSize indexBufferSize = imDrawData->TotalIdxCount * sizeof(ImDrawIdx);
  + if ((vertexBufferSize == 0) || (indexBufferSize == 0)) {
  + return;
  + }
  +
  // Update buffers only if vertex or index count has been changed compared to current buffer size
  // Vertex buffer
  @@ -437,11 +443,6 @@ public:
  vkCmdBindDescriptorSets(commandBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, pipelineLayout, 0, 1, &descriptorSet, 0, nullptr);
  vkCmdBindPipeline(commandBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline);
  - // Bind vertex and index buffer
  - VkDeviceSize offsets[1] = { 0 };
  - vkCmdBindVertexBuffers(commandBuffer, 0, 1, &vertexBuffer.buffer, offsets);
  - vkCmdBindIndexBuffer(commandBuffer, indexBuffer.buffer, 0, VK_INDEX_TYPE_UINT16);
  -
  VkViewport viewport = vks::initializers::viewport(ImGui::GetIO().DisplaySize.x, ImGui::GetIO().DisplaySize.y, 0.0f, 1.0f);
  vkCmdSetViewport(commandBuffer, 0, 1, &viewport);
  @@ -454,6 +455,13 @@ public:
  ImDrawData* imDrawData = ImGui::GetDrawData();
  int32_t vertexOffset = 0;
  int32_t indexOffset = 0;
  +
  + if (imDrawData->CmdListsCount > 0) {
  +
  + VkDeviceSize offsets[1] = { 0 };
  + vkCmdBindVertexBuffers(commandBuffer, 0, 1, &vertexBuffer.buffer, offsets);
  + vkCmdBindIndexBuffer(commandBuffer, indexBuffer.buffer, 0, VK_INDEX_TYPE_UINT16);
  +
  for (int32_t i = 0; i < imDrawData->CmdListsCount; i++)
  {
  const ImDrawList* cmd_list = imDrawData->CmdLists[i];
  @@ -472,6 +480,7 @@ public:
  vertexOffset += cmd_list->VtxBuffer.Size;
  }
  }
  + }
  };
  