From da329909f93597970afd169cee28ece3bee7127b Mon Sep 17 00:00:00 2001 From: HampusM Date: Sun, 15 Oct 2023 00:06:07 +0200 Subject: feat(engine): add logging OpenGL debug messages --- engine/src/opengl/util.rs | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 engine/src/opengl/util.rs (limited to 'engine/src/opengl/util.rs') diff --git a/engine/src/opengl/util.rs b/engine/src/opengl/util.rs new file mode 100644 index 0000000..e60778f --- /dev/null +++ b/engine/src/opengl/util.rs @@ -0,0 +1,30 @@ +// May only be used when certain crate features are enabled +#![allow(unused_macros, unused_imports)] + +macro_rules! gl_enum { + ( + $visibility: vis enum $name: ident + {$( + $variant: ident = gl::$gl_enum: ident, + )+} + ) => { + #[derive(Debug, Clone, Copy)] + #[repr(u32)] + $visibility enum $name + {$( + $variant = gl::$gl_enum, + )+} + + impl $name { + fn from_gl(num: gl::types::GLenum) -> Option + { + match num { + $(gl::$gl_enum => Some(Self::$variant),)+ + _ => None + } + } + } + }; +} + +pub(crate) use gl_enum; -- cgit v1.2.3-18-g5258