diff --git a/CMakeLists.txt b/CMakeLists.txt index d27aeed51..fd3fe89e2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -86,6 +86,8 @@ option(ENABLE_VULKAN "Enables the Vulkan renderer" ON) option(USE_DISCORD_PRESENCE "Enables Discord Rich Presence" OFF) +option(ENABLE_MICROPROFILE "Enables microprofile capabilities" OFF) + # Compile options CMAKE_DEPENDENT_OPTION(COMPILE_WITH_DWARF "Add DWARF debugging information" ${IS_DEBUG_BUILD} "MINGW" OFF) option(ENABLE_LTO "Enable link time optimization" ${DEFAULT_ENABLE_LTO}) diff --git a/externals/CMakeLists.txt b/externals/CMakeLists.txt index 52265f54f..496b4c1a6 100644 --- a/externals/CMakeLists.txt +++ b/externals/CMakeLists.txt @@ -138,6 +138,11 @@ endif() # MicroProfile add_library(microprofile INTERFACE) target_include_directories(microprofile SYSTEM INTERFACE ./microprofile) +if (ENABLE_MICROPROFILE) + target_compile_definitions(microprofile INTERFACE MICROPROFILE_ENABLED=1) +else() + target_compile_definitions(microprofile INTERFACE MICROPROFILE_ENABLED=0) +endif() # Nihstro add_library(nihstro-headers INTERFACE) diff --git a/src/citra_qt/citra_qt.cpp b/src/citra_qt/citra_qt.cpp index b0148ba27..0e8c791d4 100644 --- a/src/citra_qt/citra_qt.cpp +++ b/src/citra_qt/citra_qt.cpp @@ -590,6 +590,11 @@ void GMainWindow::InitializeDebugWidgets() { microProfileDialog = new MicroProfileDialog(this); microProfileDialog->hide(); debug_menu->addAction(microProfileDialog->toggleViewAction()); +#else + auto micro_profile_stub = new QAction(tr("MicroProfile (unavailable)"), this); + micro_profile_stub->setEnabled(false); + micro_profile_stub->setChecked(false); + debug_menu->addAction(micro_profile_stub); #endif registersWidget = new RegistersWidget(system, this); @@ -3851,8 +3856,11 @@ static Qt::HighDpiScaleFactorRoundingPolicy GetHighDpiRoundingPolicy() { void LaunchQtFrontend(int argc, char* argv[]) { Common::DetachedTasks detached_tasks; + +#if MICROPROFILE_ENABLED MicroProfileOnThreadCreate("Frontend"); SCOPE_EXIT({ MicroProfileShutdown(); }); +#endif // Init settings params QCoreApplication::setOrganizationName(QStringLiteral("Azahar Developers")); diff --git a/src/citra_qt/citra_qt.h b/src/citra_qt/citra_qt.h index 19a3ff6a9..325d75ccb 100644 --- a/src/citra_qt/citra_qt.h +++ b/src/citra_qt/citra_qt.h @@ -42,7 +42,9 @@ class GRenderWindow; class IPCRecorderWidget; class LLEServiceModulesWidget; class LoadingScreen; +#if MICROPROFILE_ENABLED class MicroProfileDialog; +#endif class MultiplayerState; class ProfilerWidget; class QFileOpenEvent; @@ -383,7 +385,9 @@ private: // Debugger panes ProfilerWidget* profilerWidget; +#if MICROPROFILE_ENABLED MicroProfileDialog* microProfileDialog; +#endif RegistersWidget* registersWidget; GPUCommandStreamWidget* graphicsWidget; GPUCommandListWidget* graphicsCommandsWidget; diff --git a/src/citra_qt/debugger/profiler.cpp b/src/citra_qt/debugger/profiler.cpp index dbeade3cd..a10cef7bb 100644 --- a/src/citra_qt/debugger/profiler.cpp +++ b/src/citra_qt/debugger/profiler.cpp @@ -1,7 +1,9 @@ -// Copyright 2015 Citra Emulator Project +// Copyright Citra Emulator Project / Azahar Emulator Project // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#if MICROPROFILE_ENABLED + #include #include #include @@ -15,7 +17,7 @@ // Include the implementation of the UI in this file. This isn't in microprofile.cpp because the // non-Qt frontends don't need it (and don't implement the UI drawing hooks either). -#if MICROPROFILE_ENABLED + #define MICROPROFILEUI_IMPL 1 #include "common/microprofileui.h" @@ -44,8 +46,6 @@ private: qreal x_scale = 1.0, y_scale = 1.0; }; -#endif - MicroProfileDialog::MicroProfileDialog(QWidget* parent) : QWidget(parent, Qt::Dialog) { setObjectName(QStringLiteral("MicroProfile")); setWindowTitle(tr("MicroProfile")); @@ -53,8 +53,6 @@ MicroProfileDialog::MicroProfileDialog(QWidget* parent) : QWidget(parent, Qt::Di // Enable the maximize button setWindowFlags(windowFlags() | Qt::WindowMaximizeButtonHint); -#if MICROPROFILE_ENABLED - MicroProfileWidget* widget = new MicroProfileWidget(this); QLayout* layout = new QVBoxLayout(this); @@ -67,7 +65,6 @@ MicroProfileDialog::MicroProfileDialog(QWidget* parent) : QWidget(parent, Qt::Di setFocusProxy(widget); widget->setFocusPolicy(Qt::StrongFocus); widget->setFocus(); -#endif } QAction* MicroProfileDialog::toggleViewAction() { @@ -95,8 +92,6 @@ void MicroProfileDialog::hideEvent(QHideEvent* event) { QWidget::hideEvent(event); } -#if MICROPROFILE_ENABLED - /// There's no way to pass a user pointer to MicroProfile, so this variable is used to make the /// QPainter available inside the drawing callbacks. static QPainter* mp_painter = nullptr; diff --git a/src/citra_qt/debugger/profiler.h b/src/citra_qt/debugger/profiler.h index dc1b1346a..e64412d89 100644 --- a/src/citra_qt/debugger/profiler.h +++ b/src/citra_qt/debugger/profiler.h @@ -1,9 +1,11 @@ -// Copyright 2015 Citra Emulator Project +// Copyright Citra Emulator Project / Azahar Emulator Project // Licensed under GPLv2 or any later version // Refer to the license.txt file included. #pragma once +#if MICROPROFILE_ENABLED + #include #include "common/common_types.h" #include "common/microprofile.h" @@ -24,3 +26,5 @@ protected: private: QAction* toggle_view_action = nullptr; }; + +#endif \ No newline at end of file diff --git a/src/video_core/renderer_opengl/gl_resource_manager.h b/src/video_core/renderer_opengl/gl_resource_manager.h index 2d168a85a..426fc03d8 100644 --- a/src/video_core/renderer_opengl/gl_resource_manager.h +++ b/src/video_core/renderer_opengl/gl_resource_manager.h @@ -1,10 +1,11 @@ -// Copyright 2022 Citra Emulator Project +// Copyright Citra Emulator Project / Azahar Emulator Project // Licensed under GPLv2 or any later version // Refer to the license.txt file included. #pragma once #include +#include #include #include #include