This commit is contained in:
lachrymaLF 2024-06-24 11:53:45 -04:00
parent b43765b2c7
commit c864b0da32
3 changed files with 14 additions and 3 deletions

View file

@ -2,7 +2,10 @@
#include "Graphics.h" #include "Graphics.h"
#include "UI.h" #include "UI.h"
#if BX_PLATFORM_LINUX && WL_EGL_PLATFORM
#include <wayland-egl.h> #include <wayland-egl.h>
#endif
#include <SDL3/SDL.h> #include <SDL3/SDL.h>
#include <SDL3/SDL_timer.h> #include <SDL3/SDL_timer.h>
@ -107,10 +110,11 @@ namespace K {
const bgfx::Caps *caps = bgfx::getCaps(); const bgfx::Caps *caps = bgfx::getCaps();
bgfx::dbgTextClear(); bgfx::dbgTextClear();
bgfx::dbgTextPrintf(0, app_state.window_height/16 - 8, 0xf8, bgfx::dbgTextPrintf(0, app_state.window_height/16 - 8, 0xf8,
" lachrymal.net :: %s Renderer :: Max Views %u :: Max FBs %u :: Max Texture Samplers %u :: Blitting %s :: %u FPS", " lachrymal.net :: %s Renderer :: %u/%u Views :: %u FBs :: %u Samplers :: Blit %s :: %s :: %u FPS",
caps->supported & BGFX_CAPS_RENDERER_MULTITHREADED ? "Multithreaded" : "Singlethreaded", caps->supported & BGFX_CAPS_RENDERER_MULTITHREADED ? "Multithreaded" : "Singlethreaded",
caps->limits.maxViews, caps->limits.maxFrameBuffers, app_state.n_views, caps->limits.maxViews, caps->limits.maxFrameBuffers,
caps->limits.maxTextureSamplers, caps->supported & BGFX_CAPS_TEXTURE_BLIT ? "OK" : "NO", caps->limits.maxTextureSamplers, caps->supported & BGFX_CAPS_TEXTURE_BLIT ? "OK" : "NO",
SDL_GetCurrentVideoDriver(),
stat->cpuTimerFreq / stat->cpuTimeFrame); stat->cpuTimerFreq / stat->cpuTimeFrame);
bgfx::dbgTextPrintf(0, app_state.window_height/16 - 7, 0xf8, bgfx::dbgTextPrintf(0, app_state.window_height/16 - 7, 0xf8,
" Project Keishiki :: %s :: Build %s %s :: SDL %i.%i.%i :: bgfx 1.%i :: Dear ImGui %s :: %s", " Project Keishiki :: %s :: Build %s %s :: SDL %i.%i.%i :: bgfx 1.%i :: Dear ImGui %s :: %s",
@ -147,7 +151,11 @@ namespace K {
K::UI::Shutdown(state); K::UI::Shutdown(state);
K::Resource::Shutdown(); K::Resource::Shutdown();
bgfx::shutdown(); bgfx::shutdown();
SDL_DestroyWindow(app_state.window);
#if !(BX_PLATFORM_LINUX && WL_EGL_PLATFORM)
SDL_DestroyWindow(app_state.window);
#endif
SDL_Quit(); SDL_Quit();
} }
} }

View file

@ -401,6 +401,8 @@ namespace K::UI {
} }
ImGui::EndDisabled(); ImGui::EndDisabled();
app_state.n_views = Graphics::K_VIEW_COMP_COMPOSITE + view_count;
ImGui::SetNextItemWidth(50.0f); ImGui::SetNextItemWidth(50.0f);
ImGui::DragFloat("FPS", &s.fps, 1.0f, 1.0f, 120.0f); ImGui::DragFloat("FPS", &s.fps, 1.0f, 1.0f, 120.0f);

View file

@ -41,6 +41,7 @@ namespace K {
u64 init_time{}, last_time{}, current_time{}, delta_t{}; u64 init_time{}, last_time{}, current_time{}, delta_t{};
u32 bgfx_frame{}; u32 bgfx_frame{};
u32 n_views{};
std::atomic_bool running {true}; std::atomic_bool running {true};
} app_state; // global ! } app_state; // global !
} }