2019-02-25 16:52:53 +00:00
|
|
|
/*
|
|
|
|
Copyright 2019 flyinghead
|
|
|
|
|
|
|
|
This file is part of reicast.
|
|
|
|
|
|
|
|
reicast is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
reicast is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with reicast. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
*/
|
2020-03-28 16:58:01 +00:00
|
|
|
#pragma once
|
|
|
|
|
2019-02-25 16:52:53 +00:00
|
|
|
#include <string>
|
|
|
|
|
2019-10-05 09:50:14 +00:00
|
|
|
#include "types.h"
|
|
|
|
#include "imgui/imgui.h"
|
|
|
|
#include "vulkan/imgui_impl_vulkan.h"
|
|
|
|
#include "gles/imgui_impl_opengl3.h"
|
2019-11-29 18:28:22 +00:00
|
|
|
#include "vulkan/vulkan_context.h"
|
2019-12-25 12:09:54 +00:00
|
|
|
#include "gui.h"
|
2019-10-05 09:50:14 +00:00
|
|
|
|
2019-02-25 16:52:53 +00:00
|
|
|
typedef void (*StringCallback)(bool cancelled, std::string selection);
|
|
|
|
|
|
|
|
void select_directory_popup(const char *prompt, float scaling, StringCallback callback);
|
2019-10-05 09:50:14 +00:00
|
|
|
|
|
|
|
static inline void ImGui_impl_RenderDrawData(ImDrawData *draw_data, bool save_background = false)
|
|
|
|
{
|
|
|
|
#ifdef USE_VULKAN
|
|
|
|
if (!settings.pvr.IsOpenGL())
|
|
|
|
{
|
|
|
|
VulkanContext *context = VulkanContext::Instance();
|
2019-10-05 21:29:39 +00:00
|
|
|
bool rendering = context->IsRendering();
|
2019-12-25 12:09:54 +00:00
|
|
|
const std::vector<vk::UniqueCommandBuffer> *vmuCmdBuffers = nullptr;
|
2019-10-05 21:29:39 +00:00
|
|
|
if (!rendering)
|
|
|
|
{
|
|
|
|
context->NewFrame();
|
2019-12-25 12:09:54 +00:00
|
|
|
vmuCmdBuffers = context->PrepareVMUs();
|
2019-10-05 21:29:39 +00:00
|
|
|
context->BeginRenderPass();
|
2019-11-30 11:14:36 +00:00
|
|
|
context->PresentLastFrame();
|
2019-12-25 12:09:54 +00:00
|
|
|
context->DrawVMUs(gui_get_scaling());
|
2019-10-05 21:29:39 +00:00
|
|
|
}
|
2019-10-05 09:50:14 +00:00
|
|
|
// Record Imgui Draw Data and draw funcs into command buffer
|
2019-10-15 14:52:02 +00:00
|
|
|
ImGui_ImplVulkan_RenderDrawData(draw_data, (VkCommandBuffer)context->GetCurrentCommandBuffer());
|
2019-10-05 21:29:39 +00:00
|
|
|
if (!rendering)
|
2019-12-25 12:09:54 +00:00
|
|
|
context->EndFrame(vmuCmdBuffers);
|
2019-10-05 09:50:14 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
{
|
|
|
|
ImGui_ImplOpenGL3_RenderDrawData(draw_data, save_background);
|
|
|
|
}
|
|
|
|
}
|