Skip to content

Commit

Permalink
[DebugOverlay|HUD] Now printing BGFX renderer instead of OpenGL info.
Browse files Browse the repository at this point in the history
  • Loading branch information
Unarelith committed Oct 29, 2023
1 parent 00fa948 commit d8b8974
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
22 changes: 11 additions & 11 deletions source/client/hud/DebugOverlay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down Expand Up @@ -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());
Expand Down
2 changes: 1 addition & 1 deletion source/client/hud/DebugOverlay.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions source/client/hud/HUD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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();

Expand Down
2 changes: 1 addition & 1 deletion source/client/hud/HUD.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit d8b8974

Please sign in to comment.