From d8b89746ecfc9cbcb2a7e354fa5fb5a8c7ac6082 Mon Sep 17 00:00:00 2001 From: Quentin Bazin Date: Sun, 22 Oct 2023 13:31:06 +0200 Subject: [PATCH] [DebugOverlay|HUD] Now printing BGFX renderer instead of OpenGL info. --- source/client/hud/DebugOverlay.cpp | 22 +++++++++++----------- source/client/hud/DebugOverlay.hpp | 2 +- source/client/hud/HUD.cpp | 4 ++-- source/client/hud/HUD.hpp | 2 +- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/source/client/hud/DebugOverlay.cpp b/source/client/hud/DebugOverlay.cpp index f2a10d03..cb2463d2 100644 --- a/source/client/hud/DebugOverlay.cpp +++ b/source/client/hud/DebugOverlay.cpp @@ -58,7 +58,7 @@ DebugOverlay::DebugOverlay(const ClientPlayer &player, const ClientWorld &world) m_positionText.setColor(gk::Color::White); } -void DebugOverlay::update(bool printOpenGLInfo) { +void DebugOverlay::update(bool printRendererInfo) { s32 px = (s32)std::floor(m_player.x()); s32 py = (s32)std::floor(m_player.y()); s32 pz = (s32)std::floor(m_player.z()); @@ -110,16 +110,16 @@ void DebugOverlay::update(bool printOpenGLInfo) { if (Config::isProfilerWindowEnabled) stream << "Press F3 to return to profiler\n"; - if (printOpenGLInfo) { - GLint major, minor; - glGetIntegerv(GL_MAJOR_VERSION, &major); - glGetIntegerv(GL_MINOR_VERSION, &minor); - - stream << "GL Vendor: " << glGetString(GL_VENDOR) << '\n'; - stream << "GL Renderer: " << glGetString(GL_RENDERER) << '\n'; - stream << "GL Version (string): " << glGetString(GL_VERSION) << '\n'; - stream << "GL Version (integer): " << major << "." << minor << '\n'; - stream << "GLSL Version: " << glGetString(GL_SHADING_LANGUAGE_VERSION) << '\n'; + if (printRendererInfo) { + auto rendererType = bgfx::getRendererType(); + if (rendererType == bgfx::RendererType::OpenGL) + stream << "BGFX renderer: OpenGL" << '\n'; + else if (rendererType == bgfx::RendererType::Vulkan) + stream << "BGFX renderer: Vulkan" << '\n'; + else if (rendererType == bgfx::RendererType::Direct3D11) + stream << "BGFX renderer: D3D11" << '\n'; + else if (rendererType == bgfx::RendererType::Direct3D12) + stream << "BGFX renderer: D3D12" << '\n'; } m_positionText.setString(stream.str()); diff --git a/source/client/hud/DebugOverlay.hpp b/source/client/hud/DebugOverlay.hpp index 28013c8e..3ecc985c 100644 --- a/source/client/hud/DebugOverlay.hpp +++ b/source/client/hud/DebugOverlay.hpp @@ -36,7 +36,7 @@ class DebugOverlay : public gk::Transformable, public Drawable { public: DebugOverlay(const ClientPlayer &player, const ClientWorld &world); - void update(bool printOpenGLInfo); + void update(bool printRendererInfo); private: void draw(RenderTarget &target, RenderStates states) const override; diff --git a/source/client/hud/HUD.cpp b/source/client/hud/HUD.cpp index 9306b42d..f5df9e1e 100644 --- a/source/client/hud/HUD.cpp +++ b/source/client/hud/HUD.cpp @@ -77,7 +77,7 @@ void HUD::setup() { void HUD::onEvent(const SDL_Event &event) { if (event.type == SDL_KEYDOWN && event.key.keysym.sym == SDLK_F3) { m_isDebugOverlayVisible ^= 1; - m_printOpenGLInfo = event.key.keysym.mod & KMOD_SHIFT; + m_printRendererInfo = event.key.keysym.mod & KMOD_SHIFT; } if (Config::isHotbarVisible) @@ -109,7 +109,7 @@ void HUD::update() { m_blockCursor.update(m_hotbar); if (m_isDebugOverlayVisible) - m_debugOverlay.update(m_printOpenGLInfo); + m_debugOverlay.update(m_printRendererInfo); else if (Config::isProfilerWindowEnabled) m_debugProfilerWindow.update(); diff --git a/source/client/hud/HUD.hpp b/source/client/hud/HUD.hpp index a430d726..76edd5b5 100644 --- a/source/client/hud/HUD.hpp +++ b/source/client/hud/HUD.hpp @@ -76,7 +76,7 @@ class HUD : public gk::Transformable, public Drawable { DebugOverlay m_debugOverlay; bool m_isDebugOverlayVisible = false; - bool m_printOpenGLInfo = false; + bool m_printRendererInfo = false; BlockInfoWidget m_blockInfoWidget;