Skip to content

Commit

Permalink
Small fixes and tweaks.
Browse files Browse the repository at this point in the history
OpenGL performance callbacks are not treated as crash errors.
Window set_size always called to ensure initialisation of m_last_size_windowed.
  • Loading branch information
MStachowicz committed Nov 29, 2024
1 parent 4a87054 commit 7ec41eb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
13 changes: 5 additions & 8 deletions source/Platform/Core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,21 +82,18 @@ namespace Platform
auto sv = severity_map.at(severity);
auto tp = error_type_map.at(type);

if (severity == GL_DEBUG_SEVERITY_HIGH)
if (type == GL_DEBUG_TYPE_PERFORMANCE ||
severity == GL_DEBUG_SEVERITY_NOTIFICATION || severity == GL_DEBUG_SEVERITY_LOW)
{
ASSERT_FAIL("[OpenGL][{}][{}][{}]: {}", src, sv, tp, message);
LOG_WARN(false, "[OpenGL][{}][{}][{}]: {}", src, sv, tp, message);
}
else if (severity == GL_DEBUG_SEVERITY_MEDIUM)
{
ASSERT_FAIL("[OpenGL][{}][{}][{}]: {}", src, sv, tp, message);
}
else if (severity == GL_DEBUG_SEVERITY_LOW)
else if (severity == GL_DEBUG_SEVERITY_HIGH)
{
LOG_WARN(false, "[OpenGL][{}][{}][{}]: {}", src, sv, tp, message);
}
else if (severity == GL_DEBUG_SEVERITY_NOTIFICATION)
{
LOG_WARN(false, "[OpenGL][{}][{}][{}]: {}", src, sv, tp, message);
ASSERT_FAIL("[OpenGL][{}][{}][{}]: {}", src, sv, tp, message);
}
};

Expand Down
5 changes: 2 additions & 3 deletions source/Platform/Window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,8 @@ namespace Platform
m_handle = glfwCreateWindow(desired_size_windowed.x, desired_size_windowed.y, Config::Is_Debug ? "Spirit - Debug" : "Spirit", NULL, NULL);
ASSERT(m_handle != nullptr, "[WINDOW] Failed to construct Window");

// Check the actual size of the window after creation. Per GLFW docs, this may not be the same as the requested size.
if (size() != glm::uvec2(desired_size_windowed))
set_size(desired_size_windowed);
// set_size again as per GLFW docs, glfwCreateWindow may not set the window to the desired size.
set_size(desired_size_windowed);

const glm::ivec2 desired_position_windowed =
{
Expand Down

0 comments on commit 7ec41eb

Please sign in to comment.