@@ -22,6 +22,8 @@ pub use winit::*;
22
22
23
23
/// Check for OpenGL error and report it using `tracing::error`.
24
24
///
25
+ /// Only active in debug builds!
26
+ ///
25
27
/// ``` no_run
26
28
/// # let glow_context = todo!();
27
29
/// use egui_glow::check_for_gl_error;
@@ -30,6 +32,30 @@ pub use winit::*;
30
32
/// ```
31
33
#[ macro_export]
32
34
macro_rules! check_for_gl_error {
35
+ ( $gl: expr) => { {
36
+ if cfg!( debug_assertions) {
37
+ $crate:: check_for_gl_error_impl( $gl, file!( ) , line!( ) , "" )
38
+ }
39
+ } } ;
40
+ ( $gl: expr, $context: literal) => { {
41
+ if cfg!( debug_assertions) {
42
+ $crate:: check_for_gl_error_impl( $gl, file!( ) , line!( ) , $context)
43
+ }
44
+ } } ;
45
+ }
46
+
47
+ /// Check for OpenGL error and report it using `tracing::error`.
48
+ ///
49
+ /// WARNING: slow! Only use during setup!
50
+ ///
51
+ /// ``` no_run
52
+ /// # let glow_context = todo!();
53
+ /// use egui_glow::check_for_gl_error_even_in_release;
54
+ /// check_for_gl_error_even_in_release!(glow_context);
55
+ /// check_for_gl_error_even_in_release!(glow_context, "during painting");
56
+ /// ```
57
+ #[ macro_export]
58
+ macro_rules! check_for_gl_error_even_in_release {
33
59
( $gl: expr) => { {
34
60
$crate:: check_for_gl_error_impl( $gl, file!( ) , line!( ) , "" )
35
61
} } ;
0 commit comments