From d343bbd9c14d152ab8523718f5de309842b667b4 Mon Sep 17 00:00:00 2001 From: HampusM Date: Sun, 15 Oct 2023 12:25:21 +0200 Subject: feat(engine): add log backtrace for OpenGL error debug messages --- engine/src/renderer/mod.rs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'engine/src') diff --git a/engine/src/renderer/mod.rs b/engine/src/renderer/mod.rs index cc1631f..8ca85e2 100644 --- a/engine/src/renderer/mod.rs +++ b/engine/src/renderer/mod.rs @@ -63,6 +63,8 @@ fn opengl_debug_message_cb( message: &str, ) { + use std::backtrace::{Backtrace, BacktraceStatus}; + use tracing::{event, Level}; macro_rules! create_event { @@ -74,6 +76,12 @@ fn opengl_debug_message_cb( match ty { MessageType::Error => { create_event!(Level::ERROR); + + let backtrace = Backtrace::capture(); + + if matches!(backtrace.status(), BacktraceStatus::Captured) { + event!(Level::TRACE, "{backtrace}"); + } } MessageType::Other => { create_event!(Level::INFO); -- cgit v1.2.3-18-g5258