vulkan: some ui

This commit is contained in:
Flyinghead 2019-10-15 16:52:02 +02:00
parent d28a7f45c5
commit 43d87877be
2 changed files with 40 additions and 9 deletions

View File

@ -34,7 +34,9 @@
#include "linux-dist/main.h" // FIXME for kcode[] #include "linux-dist/main.h" // FIXME for kcode[]
#include "gui_util.h" #include "gui_util.h"
#include "gui_android.h" #include "gui_android.h"
#ifdef USE_VULKAN
#include "rend/vulkan/vulkan.h"
#endif
#include "version.h" #include "version.h"
#include "oslib/audiostream.h" #include "oslib/audiostream.h"
@ -44,6 +46,7 @@ extern void dc_savestate();
extern void dc_stop(); extern void dc_stop();
extern void dc_reset(bool manual); extern void dc_reset(bool manual);
extern void dc_resume(); extern void dc_resume();
extern void dc_term();
extern void dc_start_game(const char *path); extern void dc_start_game(const char *path);
extern void UpdateInputState(u32 port); extern void UpdateInputState(u32 port);
extern bool game_started; extern bool game_started;
@ -643,6 +646,7 @@ static void gui_display_settings()
int dynarec_enabled = settings.dynarec.Enable; int dynarec_enabled = settings.dynarec.Enable;
u32 renderer = settings.pvr.rend; u32 renderer = settings.pvr.rend;
bool vulkan = renderer == 4;
if (!settings_opening && settings.pvr.IsOpenGL()) if (!settings_opening && settings.pvr.IsOpenGL())
ImGui_ImplOpenGL3_DrawBackground(); ImGui_ImplOpenGL3_DrawBackground();
@ -978,11 +982,13 @@ static void gui_display_settings()
switch (renderer) switch (renderer)
{ {
case 0: case 0:
settings.pvr.rend = 0; if (settings.pvr.rend == 3)
settings.pvr.rend = 0;
settings.rend.PerStripSorting = false; settings.rend.PerStripSorting = false;
break; break;
case 1: case 1:
settings.pvr.rend = 0; if (settings.pvr.rend == 3)
settings.pvr.rend = 0;
settings.rend.PerStripSorting = true; settings.rend.PerStripSorting = true;
break; break;
case 2: case 2:
@ -1022,6 +1028,9 @@ static void gui_display_settings()
ImGui::Checkbox("Delay Frame Swapping", &settings.rend.DelayFrameSwapping); ImGui::Checkbox("Delay Frame Swapping", &settings.rend.DelayFrameSwapping);
ImGui::SameLine(); ImGui::SameLine();
ShowHelpMarker("Useful to avoid flashing screen or glitchy videos. Not recommended on slow platforms"); ShowHelpMarker("Useful to avoid flashing screen or glitchy videos. Not recommended on slow platforms");
ImGui::Checkbox("Use Vulkan Renderer", &vulkan);
ImGui::SameLine();
ShowHelpMarker("Use Vulkan instead of Open GL/GLES. Experimental");
ImGui::SliderInt("Scaling", (int *)&settings.rend.ScreenScaling, 1, 100); ImGui::SliderInt("Scaling", (int *)&settings.rend.ScreenScaling, 1, 100);
ImGui::SameLine(); ImGui::SameLine();
ShowHelpMarker("Downscaling factor relative to native screen resolution. Higher is better"); ShowHelpMarker("Downscaling factor relative to native screen resolution. Higher is better");
@ -1301,11 +1310,27 @@ static void gui_display_settings()
#endif #endif
); );
} }
if (ImGui::CollapsingHeader("Open GL", ImGuiTreeNodeFlags_DefaultOpen)) if (settings.pvr.IsOpenGL())
{ {
ImGui::Text("Renderer: %s", (const char *)glGetString(GL_RENDERER)); if (ImGui::CollapsingHeader("Open GL", ImGuiTreeNodeFlags_DefaultOpen))
ImGui::Text("Version: %s", (const char *)glGetString(GL_VERSION)); {
} ImGui::Text("Renderer: %s", (const char *)glGetString(GL_RENDERER));
ImGui::Text("Version: %s", (const char *)glGetString(GL_VERSION));
}
}
#ifdef USE_VULKAN
else if (settings.pvr.rend == 4)
{
if (ImGui::CollapsingHeader("Vulkan", ImGuiTreeNodeFlags_DefaultOpen))
{
std::string name = VulkanContext::Instance()->GetDriverName();
ImGui::Text("Driver Name: %s", name.c_str());
std::string version = VulkanContext::Instance()->GetDriverVersion();
ImGui::Text("Version: %s", version.c_str());
}
}
#endif
#ifdef __ANDROID__ #ifdef __ANDROID__
ImGui::Separator(); ImGui::Separator();
if (ImGui::Button("Send Logs")) { if (ImGui::Button("Send Logs")) {
@ -1325,6 +1350,12 @@ static void gui_display_settings()
ImGui::Render(); ImGui::Render();
ImGui_impl_RenderDrawData(ImGui::GetDrawData(), false); ImGui_impl_RenderDrawData(ImGui::GetDrawData(), false);
if (vulkan ^ (settings.pvr.rend == 4))
{
settings.pvr.rend = vulkan ? 4 : 0;
dc_term();
exit(0);
}
if (renderer != settings.pvr.rend) if (renderer != settings.pvr.rend)
renderer_changed = true; renderer_changed = true;
settings.dynarec.Enable = (bool)dynarec_enabled; settings.dynarec.Enable = (bool)dynarec_enabled;

View File

@ -41,7 +41,7 @@ static inline void ImGui_impl_RenderDrawData(ImDrawData *draw_data, bool save_ba
context->BeginRenderPass(); context->BeginRenderPass();
} }
// Record Imgui Draw Data and draw funcs into command buffer // Record Imgui Draw Data and draw funcs into command buffer
ImGui_ImplVulkan_RenderDrawData(draw_data, context->GetCurrentCommandBuffer()); ImGui_ImplVulkan_RenderDrawData(draw_data, (VkCommandBuffer)context->GetCurrentCommandBuffer());
if (!rendering) if (!rendering)
context->EndFrame(); context->EndFrame();
} }