xo-imgui: restore opengl + vulkan builds
This commit is contained in:
parent
d817c649aa
commit
d9aa1ddc81
15 changed files with 202 additions and 194 deletions
|
|
@ -1,18 +1,5 @@
|
|||
if (XO_ENABLE_EXAMPLES)
|
||||
# imgui dependency
|
||||
|
||||
find_path(IMGUI_INCLUDE_DIR
|
||||
NAMES imgui/imgui.h
|
||||
DOC "path to imgui header"
|
||||
)
|
||||
if (IMGUI_INCLUDE_DIR)
|
||||
message(STATUS "found imgui/imgui.h in IMGUI_INCLUDE_DIR=[${IMGUI_INCLUDE_DIR}]")
|
||||
else()
|
||||
message(FATAL_ERROR "unable to find imgui.h")
|
||||
endif()
|
||||
|
||||
# target executable
|
||||
|
||||
set(SELF_EXE imgui_ex4)
|
||||
add_executable(${SELF_EXE} imgui_ex4.cpp
|
||||
AppState.cpp
|
||||
|
|
@ -20,54 +7,13 @@ if (XO_ENABLE_EXAMPLES)
|
|||
GcStateDescription.cpp
|
||||
AnimateGcCopyCb.cpp
|
||||
GenerationLayout.cpp
|
||||
# ${IMGUI_INCLUDE_DIR}/imgui/imgui.cpp
|
||||
# ${IMGUI_INCLUDE_DIR}/imgui/imgui_demo.cpp
|
||||
# ${IMGUI_INCLUDE_DIR}/imgui/imgui_draw.cpp
|
||||
# ${IMGUI_INCLUDE_DIR}/imgui/imgui_widgets.cpp
|
||||
# ${IMGUI_INCLUDE_DIR}/imgui/imgui_tables.cpp
|
||||
# ${IMGUI_INCLUDE_DIR}/imgui/backends/imgui_impl_sdl2.cpp
|
||||
#${IMGUI_INCLUDE_DIR}/imgui/backends/imgui_impl_opengl3.cpp
|
||||
#${IMGUI_INCLUDE_DIR}/imgui/backends/imgui_impl_glfw.cpp
|
||||
# ${IMGUI_INCLUDE_DIR}/imgui/backends/imgui_impl_vulkan.cpp
|
||||
)
|
||||
xo_include_options2(${SELF_EXE})
|
||||
|
||||
# OpenGL dependency
|
||||
|
||||
# have to choose between
|
||||
# libGL.so
|
||||
# or
|
||||
# libOpenGL.so + libGLX.so # GLVND = OpenGL Vendor Neutral Dispatch (e.g. mesa|nvda)
|
||||
#
|
||||
# expect in .build/CMakeCache.txt:
|
||||
# OPENGL_opengl_LIBRARY:FILEPATH=/path/to/libOpenGL.so
|
||||
# OpenGL_DIR:PATH=OpenGL_DIR-NOTFOUND # no cmake config file
|
||||
|
||||
# set(OpenGL_GL_PREFERENCE GLVND) # or LEGACY
|
||||
# find_package(OpenGL REQUIRED) # find_package(OpenGL CONFIG REQUIRE) won't work
|
||||
# target_link_libraries(${SELF_EXE} PUBLIC OpenGL::GL)
|
||||
|
||||
find_package(Vulkan REQUIRED)
|
||||
target_link_libraries(${SELF_EXE} PUBLIC Vulkan::Vulkan)
|
||||
|
||||
# GLEW dependency
|
||||
xo_external_pkgconfig_dependency(${SELF_EXE} GLEW glew)
|
||||
|
||||
# GLFW dependency
|
||||
#find_package(glfw3 CONFIG REQUIRED)
|
||||
#target_link_libraries(${SELF_EXE} PUBLIC glfw) # want -lglfw
|
||||
|
||||
# SDL2 dependency
|
||||
xo_external_pkgconfig_dependency(${SELF_EXE} SDL2 sdl2)
|
||||
|
||||
# would prefer to use just IMGUI_INCLUDE_DIR,
|
||||
# but imgui/backends/ .h files don't quote the imgui/ stem
|
||||
#
|
||||
target_include_directories(${SELF_EXE} PUBLIC ${IMGUI_INCLUDE_DIR}/imgui)
|
||||
|
||||
xo_self_dependency(${SELF_EXE} xo_imgui)
|
||||
xo_dependency(${SELF_EXE} xo_object)
|
||||
xo_dependency(${SELF_EXE} randomgen)
|
||||
xo_dependency(${SELF_EXE} xo_flatstring)
|
||||
xo_dependency(${SELF_EXE} xo_alloc)
|
||||
xo_dependency(${SELF_EXE} indentlog)
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -251,7 +251,7 @@ DrawState::write_gc_history_tooltip(gc_history_headline headline,
|
|||
{
|
||||
xo::flatstring<512> retval;
|
||||
|
||||
xo::flatstring<512> headline_str;
|
||||
xo::flatstring<256> headline_str;
|
||||
switch (headline) {
|
||||
case gc_history_headline::survive:
|
||||
snprintf(headline_str.data(), headline_str.capacity(),
|
||||
|
|
@ -288,10 +288,8 @@ DrawState::write_gc_history_tooltip(gc_history_headline headline,
|
|||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
snprintf(retval.data(), retval.capacity(),
|
||||
"%s\n"
|
||||
"%.*s\n"
|
||||
"\n"
|
||||
" gcseq: %lu\n"
|
||||
" type: %s\n"
|
||||
|
|
@ -304,7 +302,7 @@ DrawState::write_gc_history_tooltip(gc_history_headline headline,
|
|||
" garbage\u2099: %lu\n" /*garbageN*/
|
||||
" effort: %lu dt: %.1lfus\n"
|
||||
" copy efficiency: %.1lf%% collection rate: %.0lf bytes/sec",
|
||||
headline_str.c_str(),
|
||||
static_cast<int>(headline_str.capacity()), headline_str.c_str(),
|
||||
stats.gc_seq_,
|
||||
(stats.upto_ == generation::nursery) ? "incremental" : "FULL",
|
||||
stats.new_alloc_z_,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
/* GenerationLayout.hpp */
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "GcGenerationDescription.hpp"
|
||||
#include "xo/imgui/ImRect.hpp"
|
||||
|
||||
|
|
@ -90,4 +92,5 @@ struct GenerationLayout {
|
|||
ImRect mem_rect_to_;
|
||||
};
|
||||
|
||||
|
||||
/* GenerationLayout.hpp */
|
||||
|
|
|
|||
|
|
@ -1,11 +1,16 @@
|
|||
/* imgui_ex4.cpp */
|
||||
|
||||
#include "xo/imgui/VulkanApp.hpp"
|
||||
#ifdef TEMPORARILY_REMOVE
|
||||
#include "xo/imgui/ImRect.hpp"
|
||||
#endif
|
||||
#include "AppState.hpp"
|
||||
#include "DrawState.hpp"
|
||||
#include <backends/imgui_impl_sdl2.h>
|
||||
#include <backends/imgui_impl_vulkan.h>
|
||||
|
||||
#include "xo/indentlog/scope.hpp"
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
|
|
@ -14,6 +19,7 @@ namespace {
|
|||
using xo::scope;
|
||||
using xo::xtag;
|
||||
|
||||
|
||||
void
|
||||
app_duty_cycle_top(AppState * p_app_state,
|
||||
DrawState * p_draw_state)
|
||||
|
|
@ -173,6 +179,11 @@ namespace {
|
|||
}
|
||||
|
||||
int main() {
|
||||
printf("Hello world\n");
|
||||
|
||||
scope log(XO_DEBUG(true));
|
||||
log && log("starting main");
|
||||
|
||||
AppState app_state;
|
||||
DrawState draw_state;
|
||||
draw_state.gcstate_ = app_state.snapshot_gc_state();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue