HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
RE_OGLErrorChecker.h
Go to the documentation of this file.
1 #ifndef __RE_OGLErrorChecker__
2 #define __RE_OGLErrorChecker__
3 
4 #include "RE_API.h"
5 #include <UT/UT_Defines.h>
6 
7 class RE_OGLRender;
8 
9 //
10 // functions for checking the OpenGL state for invalid operations
11 //
12 // RE_CHECK_STATE ERROR CHECKING (cumulative):
13 //
14 // 0 No checking performed.
15 // 1 Check for valid context, errors checked on swapbuffers
16 // 2 errors checked by RE_CheckNoErrors...()
17 // 3 errors checked every glEnd...() call.
18 // 4 OpenGL state verified for each RE call (debug RE).
19 //
20 // NOTE: If you have GL_KHR_DEBUG, you should use the environment variable
21 // HOUDINI_OGL_DEBUG instead (also 0...4, though different meanings:
22 //
23 // 0 Off
24 // 1 Errors and high-priority messages
25 // 2 Medium priority (Performance warnings)
26 // 3 Low priority (portability & deprecation)
27 // 4 Messages (Houdini annotations via debug group)
28 //
29 // The priority is defined by the driver, and may differ between vendors.
30 
31 // HOUDINI_OGL_DEBUG has no noticeable performance hit (unlike
32 // RE_CHECK_STATE) and you can also get reasonable stack traces from it.
33 // You can also exclude specific message types via
34 // HOUDINI_OGL_DEBUG_EXCLUDE:
35 // portability, error, performance, undefined (behaviour), deprecated,
36 // annotation, other, opengl, compiler, window (glX,wGL)
37 // thirdparty, houdini (app-posted msgs), group (group annotations).
38 // ie. export HOUDINI_OGL_DEBUG_EXCLUDE="portability window annotation"
39 //
40 
41 // by default, we check for a valid context, and for errors on swapbuffers().
42 #ifndef RE_CHECK_STATE
43 # ifdef MBSD_COCOA
44 # ifdef UT_DEBUG
45 # define RE_CHECK_STATE 4
46 # else
47 # define RE_CHECK_STATE 0
48 # endif
49 # else
50 # define RE_CHECK_STATE 0
51 # endif
52 #endif
53 
54 
55 #if (RE_CHECK_STATE >= 1)
56  #define RE_VerifyState()
57  #define RE_CheckForErrorsOnSwap() REcheckForErrorsOnSwap()
58  #define RE_CheckValidContext() REcheckValidContext()
59  #define RE_CheckNoErrors(string) REcheckNoErrors( \
60  __FILE__, __LINE__, string)
61  #define RE_CheckContextErrors(r, string) REcheckContextErrors(r, \
62  __FILE__, __LINE__, string)
63  #define RE_SetLockedContext(render) REsetLockedContext(render)
64 
65  #define RE_EnableDebugMode( enable ) REenableDebugMode(enable)
66  #define RE_DebugModeEnabled() REdebugModeEnabled()
67  #define RE_CHECK_ERRORS() REcheckNoErrors( \
68  __FILE__, __LINE__, 0)
69 #else /* RE_CHECK_STATE */
70  #define RE_VerifyState
71  #define RE_CheckForErrorsOnSwap()
72  #define RE_CheckValidContext()
73  #define RE_CheckNoErrors(string)
74  #define RE_CheckContextErrors(r, string)
75  #define RE_SetLockedContext(render)
76  #define RE_EnableDebugMode( enable )
77  #define RE_DebugModeEnabled() false
78  #define RE_CHECK_ERRORS()
79 #endif /* RE_CHECK_STATE */
80 
81 // Actual implemention
82 RE_API extern void REcheckForErrorsOnSwap();
83 RE_API extern void REcheckValidContext();
84 RE_API extern void REcheckNoErrors(const char *file, int line,
85  const char *message);
86 RE_API extern void REcheckContextErrors(const RE_OGLRender *r,
87  const char *file, int line,
88  const char *message);
89 RE_API extern void REenableDebugMode(bool enable);
90 RE_API extern bool REdebugModeEnabled();
91 RE_API extern void REsetLockedContext(const RE_OGLRender * render);
92 
93 #endif /* __RE_OGLErrorChecker__ */
RE_API void REcheckContextErrors(const RE_OGLRender *r, const char *file, int line, const char *message)
#define RE_API
Definition: RE_API.h:10
RE_API bool REdebugModeEnabled()
IFDmantra you can see code vm_image_mplay_direction endcode When SOHO starts a render
Definition: HDK_Image.dox:266
RE_API void REcheckValidContext()
RE_API void REcheckNoErrors(const char *file, int line, const char *message)
GLuint GLsizei const GLchar * message
Definition: glcorearb.h:2542
RE_API void REcheckForErrorsOnSwap()
GLboolean r
Definition: glcorearb.h:1221
RE_API void REsetLockedContext(const RE_OGLRender *render)
RE_API void REenableDebugMode(bool enable)