Skip to content

Commit

Permalink
-
Browse files Browse the repository at this point in the history
  • Loading branch information
aiekick committed Oct 8, 2023
1 parent e2a3e7a commit 7515368
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 34 deletions.
2 changes: 1 addition & 1 deletion 3rdparty/SoGLSL
Submodule SoGLSL updated 1212 files
31 changes: 31 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,37 @@ add_executable(${PROJECT}
${PROJECT_SRC_RECURSE}
${APP_ICON_RESOURCE_WINDOWS})

if (USE_IMPLOT)
target_compile_definitions(${PROJECT} PUBLIC USE_IMPLOT)
endif()
if (USE_IMCOOL_BAR)
target_compile_definitions(${PROJECT} PUBLIC USE_IMCOOL_BAR)
endif()
if (USE_IM_GRADIENT_HDR)
target_compile_definitions(${PROJECT} PUBLIC USE_IM_GRADIENT_HDR)
endif()
if (USE_IMGUI_FILE_DIALOG)
target_compile_definitions(${PROJECT} PUBLIC USE_IMGUI_FILE_DIALOG)
endif()
if (USE_IM_GUIZMO)
target_compile_definitions(${PROJECT} PUBLIC USE_IM_GUIZMO)
endif()
if (USE_IM_TOOLS)
target_compile_definitions(${PROJECT} PUBLIC USE_IM_TOOLS)
endif()
if (USE_IMGUI_NODE_EDITOR)
target_compile_definitions(${PROJECT} PUBLIC USE_IMGUI_NODE_EDITOR)
endif()
if (USE_IMGUI_MARKDOW)
target_compile_definitions(${PROJECT} PUBLIC USE_IMGUI_MARKDOW)
endif()
if (USE_IMGUI_COLOR_TEXT_EDIT)
target_compile_definitions(${PROJECT} PUBLIC USE_IMGUI_COLOR_TEXT_EDIT)
endif()
if (USE_IN_APP_GPU_PROFILER)
target_compile_definitions(${PROJECT} PUBLIC USE_IN_APP_GPU_PROFILER)
endif()

## will put dependencies in output dir
##add_custom_command(TARGET ${PROJECT} POST_BUILD
## COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_RUNTIME_DLLS:${PROJECT}> $<TARGET_FILE_DIR:${PROJECT}>
Expand Down
49 changes: 16 additions & 33 deletions src/Headers/CustomInAppGpuProfiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,68 +22,51 @@
// without that you will have many linker error
#include <GLFW/glfw3.h>

// #define GPU_CONTEXT void*
#define GPU_CONTEXT GLFWwindow*
// #define IAGP_GPU_CONTEXT void*
#define IAGP_GPU_CONTEXT GLFWwindow*

//#define GET_CURRENT_CONTEXT GetCurrentContext
inline GPU_CONTEXT GetCurrentContext() {
//#define IAGP_GET_CURRENT_CONTEXT GetCurrentContext
inline IAGP_GPU_CONTEXT GetCurrentContext() {
return glfwGetCurrentContext();
}
#define GET_CURRENT_CONTEXT GetCurrentContext
#define IAGP_GET_CURRENT_CONTEXT GetCurrentContext

// #define SET_CURRENT_CONTEXT SetCurrentContext
inline void SetCurrentContext(GPU_CONTEXT vContext) {
// #define IAGP_SET_CURRENT_CONTEXT SetCurrentContext
inline void SetCurrentContext(IAGP_GPU_CONTEXT vContext) {
glfwMakeContextCurrent(vContext);
}
#define SET_CURRENT_CONTEXT SetCurrentContext
#define IAGP_SET_CURRENT_CONTEXT SetCurrentContext

////////////////////////////////////////////////////////////////
// OPTIONNAL ///////////////////////////////////////////////////
////////////////////////////////////////////////////////////////

// the title of the profiler detail imgui windows
#define AIGP_DETAILS_TITLE "Profiler Details"
#define IAGP_DETAILS_TITLE "Profiler Details"

// the max level of recursion for profiler queries
#define RECURSIVE_LEVELS_COUNT 20U
#define IAGP_RECURSIVE_LEVELS_COUNT 20U

// the mean average level
// all the values will be smoothed on 60 frames (1s of 60fps diosplay)
#define MEAN_AVERAGE_LEVELS_COUNT 60U
#define IAGP_MEAN_AVERAGE_LEVELS_COUNT 60U

// the minimal size of imgui sub window, when you openif by click right on a progiler bar
#define SUB_AIGP_WINDOW_MIN_SIZE ImVec2(500, 120)
#define IAGP_SUB_WINDOW_MIN_SIZE ImVec2(500, 120)

// the imgui button to use in IAGP
#define IAGP_IMGUI_BUTTON ImGui::ContrastedButton

// the Imgui Play/Pause button to use
// #define IMGUI_PLAY_PAUSE_BUTTON
#define ICON_NDP_PLAY u8"\uffd4"
#define ICON_NDP_PAUSE u8"\uffd2"
inline bool PlayPauseButton(bool& vIsPaused) {
bool res = false;
const char* play_pause_label = ICON_NDP_PAUSE;
if (vIsPaused) {
play_pause_label = ICON_NDP_PLAY;
}
if (ImGui::ContrastedButton(play_pause_label)) {
vIsPaused = !vIsPaused;
res = true;
}
if (ImGui::IsItemHovered()) {
ImGui::SetTooltip("Play/Pause Profiling");
}
return res;
}
#define IMGUI_PLAY_PAUSE_BUTTON PlayPauseButton
#define IAGP_IMGUI_PLAY_LABEL u8"\uffd4"
#define IAGP_IMGUI_PAUSE_LABEL u8"\uffd2"

// define your fucntion for log error message of IAGP
// #define LOG_ERROR_MESSAGE LogError
#include <ctools/Logger.h>
#define LOG_ERROR_MESSAGE LogVarError
#define IAGP_LOG_ERROR_MESSAGE LogVarError

// define your fucntion for log error message of IAGP only in debug
// #define LOG_DEBUG_ERROR_MESSAGE LogDebugError
#define LOG_DEBUG_ERROR_MESSAGE LogVarDebugError
#define IAGP_LOG_DEBUG_ERROR_MESSAGE LogVarDebugError

0 comments on commit 7515368

Please sign in to comment.