Bug 573889, part 0: Move the DEBUG_GL_ERROR_CHECK() macro into GLContext.h. r=vlad

This commit is contained in:
Chris Jones 2010-07-01 11:30:38 -05:00
parent e4744c5e63
commit 7be702f00b
2 changed files with 17 additions and 10 deletions

View File

@ -384,16 +384,6 @@ protected:
LayerManagerOGL *mOGLManager;
};
#ifdef DEBUG
#define DEBUG_GL_ERROR_CHECK(cx) do { \
/*fprintf (stderr, "trace %s %d\n", __FILE__, __LINE__);*/ \
GLenum err = (cx)->fGetError(); \
if (err) { fprintf (stderr, "GL ERROR: 0x%04x at %s:%d\n", err, __FILE__, __LINE__); } \
} while (0)
#else
#define DEBUG_GL_ERROR_CHECK(cx) do { } while (0)
#endif
} /* layers */
} /* mozilla */

View File

@ -41,6 +41,8 @@
#ifndef GLCONTEXT_H_
#define GLCONTEXT_H_
#include <stdio.h>
#ifdef WIN32
#include <windows.h>
#endif
@ -512,6 +514,21 @@ public:
};
inline void
GLDebugPrintError(GLContext* aCx, const char* const aFile, int aLine)
{
GLenum err = aCx->fGetError();
if (err) {
fprintf(stderr, "GL ERROR: 0x%04x at %s:%d\n", err, aFile, aLine);
}
}
#ifdef DEBUG
# define DEBUG_GL_ERROR_CHECK(cx) mozilla::gl::GLDebugPrintError(cx, __FILE__, __LINE__)
#else
# define DEBUG_GL_ERROR_CHECK(cx) do { } while (0)
#endif
} /* namespace gl */
} /* namespace mozilla */