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