Move render debug state setup into GL backend

This commit is contained in:
2026-06-04 20:12:54 +02:00
parent 1b771287f9
commit 51601adf6d
7 changed files with 123 additions and 21 deletions

View File

@@ -48,16 +48,6 @@ static CONSOLE_SCREEN_BUFFER_INFO render_debug_console_info;
return static_cast<GLenum>(pp::renderer::gl::debug_severity_high());
}
[[nodiscard]] GLenum debug_output_state() noexcept
{
return static_cast<GLenum>(pp::renderer::gl::debug_output_state());
}
[[nodiscard]] GLenum debug_output_synchronous_state() noexcept
{
return static_cast<GLenum>(pp::renderer::gl::debug_output_synchronous_state());
}
void handle_gl_callback(
GLenum source,
GLenum type,
@@ -93,6 +83,11 @@ void handle_gl_callback(
}
}
void enable_gl_capability(std::uint32_t state) noexcept
{
glEnable(static_cast<GLenum>(state));
}
void show_cursor(bool visible)
{
std::lock_guard<std::mutex> lock(main_task_mutex);
@@ -337,8 +332,12 @@ public:
void apply_render_platform_hints() override
{
glEnable(static_cast<GLenum>(pp::renderer::gl::program_point_size_state()));
glEnable(static_cast<GLenum>(pp::renderer::gl::line_smooth_state()));
const auto status = pp::renderer::gl::apply_opengl_render_platform_hints(
pp::renderer::gl::OpenGlRenderPlatformHintDispatch {
.enable = enable_gl_capability,
});
if (!status.ok())
LOG("OpenGL render platform hints failed: %s", status.message);
}
void install_render_debug_callback() override
@@ -349,8 +348,12 @@ public:
// colors: http://stackoverflow.com/questions/4053837/colorizing-text-in-the-console-with-c
GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &render_debug_console_info);
glDebugMessageCallback(handle_gl_callback, nullptr);
glEnable(debug_output_state());
glEnable(debug_output_synchronous_state());
const auto status = pp::renderer::gl::apply_opengl_debug_output_states(
pp::renderer::gl::OpenGlDebugOutputStateDispatch {
.enable = enable_gl_capability,
});
if (!status.ok())
LOG("OpenGL debug output states failed: %s", status.message);
}
void begin_render_capture_frame() override