FrontendCommon: Remove WITH_IMGUI #ifdefs
We never compile FrontendCommon without imgui anyway.
This commit is contained in:
parent
e697d9aa33
commit
7a48bcc585
|
@ -10,12 +10,10 @@
|
|||
#include "display_ps.hlsl.h"
|
||||
#include "display_vs.hlsl.h"
|
||||
#include "frontend-common/postprocessing_shadergen.h"
|
||||
#include <array>
|
||||
#include <dxgi1_5.h>
|
||||
#ifdef WITH_IMGUI
|
||||
#include "imgui.h"
|
||||
#include "imgui_impl_dx11.h"
|
||||
#endif
|
||||
#include <array>
|
||||
#include <dxgi1_5.h>
|
||||
Log_SetChannel(D3D11HostDisplay);
|
||||
|
||||
namespace FrontendCommon {
|
||||
|
@ -469,13 +467,11 @@ bool D3D11HostDisplay::CreateSwapChainRTV()
|
|||
m_window_info.surface_width = backbuffer_desc.Width;
|
||||
m_window_info.surface_height = backbuffer_desc.Height;
|
||||
|
||||
#ifdef WITH_IMGUI
|
||||
if (ImGui::GetCurrentContext())
|
||||
{
|
||||
ImGui::GetIO().DisplaySize.x = static_cast<float>(backbuffer_desc.Width);
|
||||
ImGui::GetIO().DisplaySize.y = static_cast<float>(backbuffer_desc.Height);
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -662,28 +658,19 @@ void D3D11HostDisplay::DestroyResources()
|
|||
|
||||
bool D3D11HostDisplay::CreateImGuiContext()
|
||||
{
|
||||
#ifdef WITH_IMGUI
|
||||
ImGui::GetIO().DisplaySize.x = static_cast<float>(m_window_info.surface_width);
|
||||
ImGui::GetIO().DisplaySize.y = static_cast<float>(m_window_info.surface_height);
|
||||
if (!ImGui_ImplDX11_Init(m_device.Get(), m_context.Get()))
|
||||
return false;
|
||||
#endif
|
||||
|
||||
return true;
|
||||
return ImGui_ImplDX11_Init(m_device.Get(), m_context.Get());
|
||||
}
|
||||
|
||||
void D3D11HostDisplay::DestroyImGuiContext()
|
||||
{
|
||||
#ifdef WITH_IMGUI
|
||||
ImGui_ImplDX11_Shutdown();
|
||||
#endif
|
||||
}
|
||||
|
||||
bool D3D11HostDisplay::UpdateImGuiFontTexture()
|
||||
{
|
||||
#ifdef WITH_IMGUI
|
||||
ImGui_ImplDX11_CreateFontsTexture();
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -691,10 +678,8 @@ bool D3D11HostDisplay::Render()
|
|||
{
|
||||
if (ShouldSkipDisplayingFrame())
|
||||
{
|
||||
#ifdef WITH_IMGUI
|
||||
if (ImGui::GetCurrentContext())
|
||||
ImGui::Render();
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -705,10 +690,8 @@ bool D3D11HostDisplay::Render()
|
|||
|
||||
RenderDisplay();
|
||||
|
||||
#ifdef WITH_IMGUI
|
||||
if (ImGui::GetCurrentContext())
|
||||
RenderImGui();
|
||||
#endif
|
||||
|
||||
RenderSoftwareCursor();
|
||||
|
||||
|
@ -722,10 +705,8 @@ bool D3D11HostDisplay::Render()
|
|||
|
||||
void D3D11HostDisplay::RenderImGui()
|
||||
{
|
||||
#ifdef WITH_IMGUI
|
||||
ImGui::Render();
|
||||
ImGui_ImplDX11_RenderDrawData(ImGui::GetDrawData());
|
||||
#endif
|
||||
}
|
||||
|
||||
void D3D11HostDisplay::RenderDisplay()
|
||||
|
|
|
@ -83,11 +83,9 @@ protected:
|
|||
virtual bool CreateResources() override;
|
||||
virtual void DestroyResources() override;
|
||||
|
||||
#ifdef WITH_IMGUI
|
||||
virtual bool CreateImGuiContext() override;
|
||||
virtual void DestroyImGuiContext() override;
|
||||
virtual bool UpdateImGuiFontTexture() override;
|
||||
#endif
|
||||
|
||||
bool CreateSwapChain(const DXGI_MODE_DESC* fullscreen_mode);
|
||||
bool CreateSwapChainRTV();
|
||||
|
|
|
@ -2,13 +2,11 @@
|
|||
#include "common/align.h"
|
||||
#include "common/assert.h"
|
||||
#include "common/log.h"
|
||||
#include <array>
|
||||
#include <tuple>
|
||||
#ifdef WITH_IMGUI
|
||||
#include "imgui.h"
|
||||
#include "imgui_impl_opengl3.h"
|
||||
#endif
|
||||
#include "postprocessing_shadergen.h"
|
||||
#include <array>
|
||||
#include <tuple>
|
||||
Log_SetChannel(OpenGLHostDisplay);
|
||||
|
||||
namespace FrontendCommon {
|
||||
|
@ -62,9 +60,9 @@ void* OpenGLHostDisplay::GetRenderContext() const
|
|||
static constexpr std::array<std::tuple<GLenum, GLenum, GLenum>, static_cast<u32>(HostDisplayPixelFormat::Count)>
|
||||
s_display_pixel_format_mapping = {{
|
||||
{}, // Unknown
|
||||
{GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE}, // RGBA8
|
||||
{GL_RGBA8, GL_BGRA, GL_UNSIGNED_BYTE}, // BGRA8
|
||||
{GL_RGB565, GL_RGB, GL_UNSIGNED_SHORT_5_6_5}, // RGB565
|
||||
{GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE}, // RGBA8
|
||||
{GL_RGBA8, GL_BGRA, GL_UNSIGNED_BYTE}, // BGRA8
|
||||
{GL_RGB565, GL_RGB, GL_UNSIGNED_SHORT_5_6_5}, // RGB565
|
||||
{GL_RGB5_A1, GL_BGRA, GL_UNSIGNED_SHORT_1_5_5_5_REV} // RGBA5551
|
||||
}};
|
||||
|
||||
|
@ -408,13 +406,11 @@ bool OpenGLHostDisplay::ChangeRenderWindow(const WindowInfo& new_wi)
|
|||
m_window_info.surface_width = m_gl_context->GetSurfaceWidth();
|
||||
m_window_info.surface_height = m_gl_context->GetSurfaceHeight();
|
||||
|
||||
#ifdef WITH_IMGUI
|
||||
if (ImGui::GetCurrentContext())
|
||||
{
|
||||
ImGui::GetIO().DisplaySize.x = static_cast<float>(m_window_info.surface_width);
|
||||
ImGui::GetIO().DisplaySize.y = static_cast<float>(m_window_info.surface_height);
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -428,13 +424,11 @@ void OpenGLHostDisplay::ResizeRenderWindow(s32 new_window_width, s32 new_window_
|
|||
m_window_info.surface_width = m_gl_context->GetSurfaceWidth();
|
||||
m_window_info.surface_height = m_gl_context->GetSurfaceHeight();
|
||||
|
||||
#ifdef WITH_IMGUI
|
||||
if (ImGui::GetCurrentContext())
|
||||
{
|
||||
ImGui::GetIO().DisplaySize.x = static_cast<float>(m_window_info.surface_width);
|
||||
ImGui::GetIO().DisplaySize.y = static_cast<float>(m_window_info.surface_height);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool OpenGLHostDisplay::SupportsFullscreen() const
|
||||
|
@ -464,31 +458,20 @@ void OpenGLHostDisplay::DestroyRenderSurface()
|
|||
|
||||
bool OpenGLHostDisplay::CreateImGuiContext()
|
||||
{
|
||||
#ifdef WITH_IMGUI
|
||||
ImGui::GetIO().DisplaySize.x = static_cast<float>(m_window_info.surface_width);
|
||||
ImGui::GetIO().DisplaySize.y = static_cast<float>(m_window_info.surface_height);
|
||||
if (!ImGui_ImplOpenGL3_Init(GetGLSLVersionString()))
|
||||
return false;
|
||||
#endif
|
||||
|
||||
return true;
|
||||
return ImGui_ImplOpenGL3_Init(GetGLSLVersionString());
|
||||
}
|
||||
|
||||
void OpenGLHostDisplay::DestroyImGuiContext()
|
||||
{
|
||||
#ifdef WITH_IMGUI
|
||||
ImGui_ImplOpenGL3_Shutdown();
|
||||
#endif
|
||||
}
|
||||
|
||||
bool OpenGLHostDisplay::UpdateImGuiFontTexture()
|
||||
{
|
||||
#ifdef WITH_IMGUI
|
||||
ImGui_ImplOpenGL3_DestroyFontsTexture();
|
||||
return ImGui_ImplOpenGL3_CreateFontsTexture();
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool OpenGLHostDisplay::CreateResources()
|
||||
|
@ -679,10 +662,8 @@ bool OpenGLHostDisplay::Render()
|
|||
{
|
||||
if (ShouldSkipDisplayingFrame())
|
||||
{
|
||||
#ifdef WITH_IMGUI
|
||||
if (ImGui::GetCurrentContext())
|
||||
ImGui::Render();
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -694,10 +675,8 @@ bool OpenGLHostDisplay::Render()
|
|||
|
||||
RenderDisplay();
|
||||
|
||||
#ifdef WITH_IMGUI
|
||||
if (ImGui::GetCurrentContext())
|
||||
RenderImGui();
|
||||
#endif
|
||||
|
||||
RenderSoftwareCursor();
|
||||
|
||||
|
@ -707,11 +686,9 @@ bool OpenGLHostDisplay::Render()
|
|||
|
||||
void OpenGLHostDisplay::RenderImGui()
|
||||
{
|
||||
#ifdef WITH_IMGUI
|
||||
ImGui::Render();
|
||||
ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
|
||||
GL::Program::ResetLastProgram();
|
||||
#endif
|
||||
}
|
||||
|
||||
void OpenGLHostDisplay::RenderDisplay()
|
||||
|
|
|
@ -72,11 +72,9 @@ protected:
|
|||
virtual bool CreateResources() override;
|
||||
virtual void DestroyResources() override;
|
||||
|
||||
#ifdef WITH_IMGUI
|
||||
virtual bool CreateImGuiContext() override;
|
||||
virtual void DestroyImGuiContext() override;
|
||||
virtual bool UpdateImGuiFontTexture() override;
|
||||
#endif
|
||||
|
||||
void RenderDisplay();
|
||||
void RenderImGui();
|
||||
|
|
|
@ -12,10 +12,8 @@
|
|||
#include "core/shader_cache_version.h"
|
||||
#include "postprocessing_shadergen.h"
|
||||
#include <array>
|
||||
#ifdef WITH_IMGUI
|
||||
#include "imgui.h"
|
||||
#include "imgui_impl_vulkan.h"
|
||||
#endif
|
||||
Log_SetChannel(VulkanHostDisplay);
|
||||
|
||||
namespace FrontendCommon {
|
||||
|
@ -99,13 +97,11 @@ bool VulkanHostDisplay::ChangeRenderWindow(const WindowInfo& new_wi)
|
|||
m_window_info.surface_width = m_swap_chain->GetWidth();
|
||||
m_window_info.surface_height = m_swap_chain->GetHeight();
|
||||
|
||||
#ifdef WITH_IMGUI
|
||||
if (ImGui::GetCurrentContext())
|
||||
{
|
||||
ImGui::GetIO().DisplaySize.x = static_cast<float>(m_window_info.surface_width);
|
||||
ImGui::GetIO().DisplaySize.y = static_cast<float>(m_window_info.surface_height);
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -120,13 +116,11 @@ void VulkanHostDisplay::ResizeRenderWindow(s32 new_window_width, s32 new_window_
|
|||
m_window_info.surface_width = m_swap_chain->GetWidth();
|
||||
m_window_info.surface_height = m_swap_chain->GetHeight();
|
||||
|
||||
#ifdef WITH_IMGUI
|
||||
if (ImGui::GetCurrentContext())
|
||||
{
|
||||
ImGui::GetIO().DisplaySize.x = static_cast<float>(m_window_info.surface_width);
|
||||
ImGui::GetIO().DisplaySize.y = static_cast<float>(m_window_info.surface_height);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool VulkanHostDisplay::SupportsFullscreen() const
|
||||
|
@ -525,7 +519,6 @@ void VulkanHostDisplay::DestroyResources()
|
|||
|
||||
bool VulkanHostDisplay::CreateImGuiContext()
|
||||
{
|
||||
#ifdef WITH_IMGUI
|
||||
ImGui::GetIO().DisplaySize.x = static_cast<float>(m_window_info.surface_width);
|
||||
ImGui::GetIO().DisplaySize.y = static_cast<float>(m_window_info.surface_height);
|
||||
|
||||
|
@ -540,32 +533,21 @@ bool VulkanHostDisplay::CreateImGuiContext()
|
|||
vii.ImageCount = m_swap_chain->GetImageCount();
|
||||
vii.MSAASamples = VK_SAMPLE_COUNT_1_BIT;
|
||||
|
||||
if (!ImGui_ImplVulkan_Init(&vii, m_swap_chain->GetClearRenderPass()))
|
||||
return false;
|
||||
#endif
|
||||
|
||||
return true;
|
||||
return ImGui_ImplVulkan_Init(&vii, m_swap_chain->GetClearRenderPass());
|
||||
}
|
||||
|
||||
void VulkanHostDisplay::DestroyImGuiContext()
|
||||
{
|
||||
g_vulkan_context->WaitForGPUIdle();
|
||||
|
||||
#ifdef WITH_IMGUI
|
||||
ImGui_ImplVulkan_Shutdown();
|
||||
#endif
|
||||
}
|
||||
|
||||
bool VulkanHostDisplay::UpdateImGuiFontTexture()
|
||||
{
|
||||
#ifdef WITH_IMGUI
|
||||
// Just in case we were drawing something.
|
||||
g_vulkan_context->ExecuteCommandBuffer(true);
|
||||
ImGui_ImplVulkan_DestroyFontUploadObjects();
|
||||
return ImGui_ImplVulkan_CreateFontsTexture(g_vulkan_context->GetCurrentCommandBuffer());
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
void VulkanHostDisplay::DestroyRenderDevice()
|
||||
|
@ -596,10 +578,8 @@ bool VulkanHostDisplay::Render()
|
|||
{
|
||||
if (ShouldSkipDisplayingFrame())
|
||||
{
|
||||
#ifdef WITH_IMGUI
|
||||
if (ImGui::GetCurrentContext())
|
||||
ImGui::Render();
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -636,10 +616,8 @@ bool VulkanHostDisplay::Render()
|
|||
|
||||
RenderDisplay();
|
||||
|
||||
#ifdef WITH_IMGUI
|
||||
if (ImGui::GetCurrentContext())
|
||||
RenderImGui();
|
||||
#endif
|
||||
|
||||
RenderSoftwareCursor();
|
||||
|
||||
|
@ -729,10 +707,8 @@ void VulkanHostDisplay::RenderDisplay(s32 left, s32 top, s32 width, s32 height,
|
|||
|
||||
void VulkanHostDisplay::RenderImGui()
|
||||
{
|
||||
#ifdef WITH_IMGUI
|
||||
ImGui::Render();
|
||||
ImGui_ImplVulkan_RenderDrawData(ImGui::GetDrawData(), g_vulkan_context->GetCurrentCommandBuffer());
|
||||
#endif
|
||||
}
|
||||
|
||||
void VulkanHostDisplay::RenderSoftwareCursor()
|
||||
|
|
|
@ -98,11 +98,9 @@ protected:
|
|||
virtual bool CreateResources() override;
|
||||
virtual void DestroyResources() override;
|
||||
|
||||
#ifdef WITH_IMGUI
|
||||
virtual bool CreateImGuiContext() override;
|
||||
virtual void DestroyImGuiContext() override;
|
||||
virtual bool UpdateImGuiFontTexture() override;
|
||||
#endif
|
||||
|
||||
void BeginSwapChainRenderPass(VkFramebuffer framebuffer);
|
||||
void RenderDisplay();
|
||||
|
|
Loading…
Reference in New Issue