Skip to content

Commit

Permalink
Core: Purge WITH_IMGUI define
Browse files Browse the repository at this point in the history
  • Loading branch information
stenzek committed Mar 27, 2022
1 parent d5128a5 commit fd76f43
Show file tree
Hide file tree
Showing 10 changed files with 8 additions and 40 deletions.
1 change: 0 additions & 1 deletion src/core/CMakeLists.txt
Expand Up @@ -118,7 +118,6 @@ target_include_directories(core PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/..")
target_include_directories(core PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/..")
target_link_libraries(core PUBLIC Threads::Threads common zlib vulkan-loader)
target_link_libraries(core PRIVATE glad stb xxhash imgui)
target_compile_definitions(core PUBLIC "-DWITH_IMGUI=1")

if(WIN32)
target_sources(core PRIVATE
Expand Down
6 changes: 1 addition & 5 deletions src/core/cdrom.cpp
Expand Up @@ -5,14 +5,12 @@
#include "common/platform.h"
#include "common/state_wrapper.h"
#include "dma.h"
#include "imgui.h"
#include "interrupt_controller.h"
#include "settings.h"
#include "spu.h"
#include "system.h"
#include <cmath>
#ifdef WITH_IMGUI
#include "imgui.h"
#endif
Log_SetChannel(CDROM);

#if defined(CPU_X64)
Expand Down Expand Up @@ -2722,7 +2720,6 @@ void CDROM::ClearSectorBuffers()

void CDROM::DrawDebugWindow()
{
#ifdef WITH_IMGUI
static const ImVec4 active_color{1.0f, 1.0f, 1.0f, 1.0f};
static const ImVec4 inactive_color{0.4f, 0.4f, 0.4f, 1.0f};
const float framebuffer_scale = ImGui::GetIO().DisplayFramebufferScale.x;
Expand Down Expand Up @@ -2919,5 +2916,4 @@ void CDROM::DrawDebugWindow()
}

ImGui::End();
#endif
}
3 changes: 1 addition & 2 deletions src/core/core.props
Expand Up @@ -4,7 +4,6 @@

<ItemDefinitionGroup>
<ClCompile>
<PreprocessorDefinitions>WITH_IMGUI=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(Platform)'=='x64' Or '$(Platform)'=='ARM' Or '$(Platform)'=='ARM64'">WITH_RECOMPILER=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="('$(Platform)'=='x64' Or '$(Platform)'=='ARM64') And ('$(BuildingForUWP)'!='true')">WITH_MMAP_FASTMEM=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>

Expand All @@ -21,4 +20,4 @@
<AdditionalDependencies Condition="'$(Platform)'=='ARM64'">$(RootBuildDir)vixl\vixl.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Lib>
</ItemDefinitionGroup>
</Project>
</Project>
6 changes: 1 addition & 5 deletions src/core/dma.cpp
Expand Up @@ -7,14 +7,12 @@
#include "cpu_code_cache.h"
#include "cpu_core.h"
#include "gpu.h"
#include "imgui.h"
#include "interrupt_controller.h"
#include "mdec.h"
#include "pad.h"
#include "spu.h"
#include "system.h"
#ifdef WITH_IMGUI
#include "imgui.h"
#endif
Log_SetChannel(DMA);

static u32 GetAddressMask()
Expand Down Expand Up @@ -621,7 +619,6 @@ TickCount DMA::TransferDeviceToMemory(Channel channel, u32 address, u32 incremen

void DMA::DrawDebugStateWindow()
{
#ifdef WITH_IMGUI
static constexpr u32 NUM_COLUMNS = 10;
static constexpr std::array<const char*, NUM_COLUMNS> column_names = {
{"#", "Req", "Direction", "Chopping", "Mode", "Busy", "Enable", "Priority", "IRQ", "Flag"}};
Expand Down Expand Up @@ -697,5 +694,4 @@ void DMA::DrawDebugStateWindow()

ImGui::Columns(1);
ImGui::End();
#endif
}
6 changes: 1 addition & 5 deletions src/core/gpu.cpp
Expand Up @@ -7,15 +7,13 @@
#include "dma.h"
#include "host_display.h"
#include "host_interface.h"
#include "imgui.h"
#include "interrupt_controller.h"
#include "settings.h"
#include "stb_image_write.h"
#include "system.h"
#include "timers.h"
#include <cmath>
#ifdef WITH_IMGUI
#include "imgui.h"
#endif
Log_SetChannel(GPU);

std::unique_ptr<GPU> g_gpu;
Expand Down Expand Up @@ -1553,7 +1551,6 @@ bool GPU::DumpVRAMToFile(const char* filename, u32 width, u32 height, u32 stride

void GPU::DrawDebugStateWindow()
{
#ifdef WITH_IMGUI
const float framebuffer_scale = ImGui::GetIO().DisplayFramebufferScale.x;

ImGui::SetNextWindowSize(ImVec2(450.0f * framebuffer_scale, 550.0f * framebuffer_scale), ImGuiCond_FirstUseEver);
Expand Down Expand Up @@ -1671,7 +1668,6 @@ void GPU::DrawDebugStateWindow()
}

ImGui::End();
#endif
}

void GPU::DrawRendererStats(bool is_idle_frame) {}
6 changes: 1 addition & 5 deletions src/core/gpu_hw.cpp
Expand Up @@ -5,15 +5,13 @@
#include "common/state_wrapper.h"
#include "cpu_core.h"
#include "gpu_sw_backend.h"
#include "imgui.h"
#include "pgxp.h"
#include "settings.h"
#include "system.h"
#include <cmath>
#include <sstream>
#include <tuple>
#ifdef WITH_IMGUI
#include "imgui.h"
#endif
Log_SetChannel(GPU_HW);

template<typename T>
Expand Down Expand Up @@ -1403,7 +1401,6 @@ void GPU_HW::DrawRendererStats(bool is_idle_frame)
m_renderer_stats = {};
}

#ifdef WITH_IMGUI
if (ImGui::CollapsingHeader("Renderer Statistics", ImGuiTreeNodeFlags_DefaultOpen))
{
static const ImVec4 active_color{1.0f, 1.0f, 1.0f, 1.0f};
Expand Down Expand Up @@ -1472,7 +1469,6 @@ void GPU_HW::DrawRendererStats(bool is_idle_frame)

ImGui::Columns(1);
}
#endif
}

GPU_HW::ShaderCompileProgressTracker::ShaderCompileProgressTracker(std::string title, u32 total)
Expand Down
2 changes: 0 additions & 2 deletions src/core/host_display.h
Expand Up @@ -123,12 +123,10 @@ class HostDisplay

virtual void SetVSync(bool enabled) = 0;

#ifdef WITH_IMGUI
/// ImGui context management, usually called by derived classes.
virtual bool CreateImGuiContext() = 0;
virtual void DestroyImGuiContext() = 0;
virtual bool UpdateImGuiFontTexture() = 0;
#endif

const void* GetDisplayTextureHandle() const { return m_display_texture_handle; }
const s32 GetDisplayTopMargin() const { return m_display_top_margin; }
Expand Down
6 changes: 1 addition & 5 deletions src/core/mdec.cpp
Expand Up @@ -3,11 +3,9 @@
#include "common/state_wrapper.h"
#include "cpu_core.h"
#include "dma.h"
#include "imgui.h"
#include "interrupt_controller.h"
#include "system.h"
#ifdef WITH_IMGUI
#include "imgui.h"
#endif
Log_SetChannel(MDEC);

MDEC g_mdec;
Expand Down Expand Up @@ -724,7 +722,6 @@ void MDEC::HandleSetScaleCommand()

void MDEC::DrawDebugStateWindow()
{
#ifdef WITH_IMGUI
const float framebuffer_scale = ImGui::GetIO().DisplayFramebufferScale.x;

ImGui::SetNextWindowSize(ImVec2(300.0f * framebuffer_scale, 350.0f * framebuffer_scale), ImGuiCond_FirstUseEver);
Expand Down Expand Up @@ -762,5 +759,4 @@ void MDEC::DrawDebugStateWindow()
}

ImGui::End();
#endif
}
6 changes: 1 addition & 5 deletions src/core/spu.cpp
Expand Up @@ -7,11 +7,9 @@
#include "common/wav_writer.h"
#include "dma.h"
#include "host_interface.h"
#include "imgui.h"
#include "interrupt_controller.h"
#include "system.h"
#ifdef WITH_IMGUI
#include "imgui.h"
#endif
Log_SetChannel(SPU);

SPU g_spu;
Expand Down Expand Up @@ -1921,7 +1919,6 @@ void SPU::UpdateEventInterval()

void SPU::DrawDebugStateWindow()
{
#ifdef WITH_IMGUI
static const ImVec4 active_color{1.0f, 1.0f, 1.0f, 1.0f};
static const ImVec4 inactive_color{0.4f, 0.4f, 0.4f, 1.0f};
const float framebuffer_scale = ImGui::GetIO().DisplayFramebufferScale.x;
Expand Down Expand Up @@ -2102,5 +2099,4 @@ void SPU::DrawDebugStateWindow()
}

ImGui::End();
#endif
}
6 changes: 1 addition & 5 deletions src/core/timers.cpp
Expand Up @@ -2,11 +2,9 @@
#include "common/log.h"
#include "common/state_wrapper.h"
#include "gpu.h"
#include "imgui.h"
#include "interrupt_controller.h"
#include "system.h"
#ifdef WITH_IMGUI
#include "imgui.h"
#endif
Log_SetChannel(Timers);

Timers g_timers;
Expand Down Expand Up @@ -394,7 +392,6 @@ void Timers::UpdateSysClkEvent()

void Timers::DrawDebugStateWindow()
{
#ifdef WITH_IMGUI
static constexpr u32 NUM_COLUMNS = 10;
static constexpr std::array<const char*, NUM_COLUMNS> column_names = {
{"#", "Value", "Target", "Sync", "Reset", "IRQ", "IRQRepeat", "IRQToggle", "Clock Source", "Reached"}};
Expand Down Expand Up @@ -463,5 +460,4 @@ void Timers::DrawDebugStateWindow()

ImGui::Columns(1);
ImGui::End();
#endif
}

0 comments on commit fd76f43

Please sign in to comment.