diff options
author | HampusM <hampus@hampusmat.com> | 2023-10-15 12:25:21 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2023-10-15 12:25:21 +0200 |
commit | d343bbd9c14d152ab8523718f5de309842b667b4 (patch) | |
tree | cff633c8cadb381a498ea9b85f0aee2e0508fadc /engine/src/renderer/mod.rs | |
parent | 1abf0f04f3de26f62eecf0881056575c089c4533 (diff) |
feat(engine): add log backtrace for OpenGL error debug messages
Diffstat (limited to 'engine/src/renderer/mod.rs')
-rw-r--r-- | engine/src/renderer/mod.rs | 8 |
1 files changed, 8 insertions, 0 deletions
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); |