Go to the documentation of this file.
18 #ifndef ION_GFX_GRAPHICSMANAGERMACRODEFS_H_
19 #define ION_GFX_GRAPHICSMANAGERMACRODEFS_H_
24 #if defined(ION_ANALYTICS_ENABLED)
25 # define ION_PROFILE_GL_FUNC(name) \
26 ION_PROFILE_FUNCTION("ion::gfx::GraphicsManager::" #name)
28 # define ION_PROFILE_GL_FUNC(name)
31 #define ION_WRAP_NON_PROD_GL_FUNC(name, return_type, typed_args, args, trace) \
34 return_type name typed_args { \
35 ION_PROFILE_GL_FUNC(name); \
36 DCHECK(name##_wrapper_.Get()); \
38 static const bool do_trace = strcmp(#name, "GetError") && \
39 strcmp(#name, "PushGroupMarker") && \
40 strcmp(#name, "PopGroupMarker"); \
41 if (tracing_ostream_ && do_trace) { \
42 *tracing_ostream_ << tracing_prefix_ << name##_wrapper_.GetFuncName() \
43 << "(" << trace << ")\n"; \
45 if (is_error_checking_enabled_) { \
47 std::ostringstream call; \
48 call << name##_wrapper_.GetFuncName() << "(" << trace << ")"; \
49 ErrorChecker error_checker(this, call.str()); \
50 return (*name##_wrapper_.Get())args; \
52 return (*name##_wrapper_.Get())args; \
59 #define ION_WRAP_PROD_GL_FUNC(name, return_type, typed_args, args, trace) \
62 return_type name typed_args { \
63 ION_PROFILE_GL_FUNC(name); \
64 return (*name ## _wrapper_.Get())args; \
67 #define ION_DECLARE_GL_WRAPPER(group, name, return_type, typed_args, args) \
70 typedef return_type(ION_APIENTRY* name ## _Type) typed_args; \
73 class name ## _Wrapper : public WrapperBase { \
75 name ## _Wrapper() : WrapperBase(#name, k ## group) {} \
76 name ## _Type Get() { return reinterpret_cast<name ## _Type>(ptr_); } \
80 name ## _Wrapper name ## _wrapper_;
83 #define ION_WRAP_GL_FUNC(group, name, return_type, typed_args, args, trace) \
84 ION_WRAP_PROD_GL_FUNC(name, return_type, typed_args, args, trace) \
85 ION_DECLARE_GL_WRAPPER(group, name, return_type, typed_args, args)
87 #define ION_WRAP_GL_FUNC(group, name, return_type, typed_args, args, trace) \
88 ION_WRAP_NON_PROD_GL_FUNC(name, return_type, typed_args, args, trace) \
89 ION_DECLARE_GL_WRAPPER(group, name, return_type, typed_args, args)
93 #define ION_TRACE_ARG(name, type, arg) \
94 #arg << " = " << tracing_helper_.ToString(#type, arg)
96 #endif // ION_GFX_GRAPHICSMANAGERMACRODEFS_H_