mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 704788 - Add inlined function to allow easy compile-time pruning of mDebugMode branches in GLContext - r=bjacob
This commit is contained in:
parent
4c79a4cdc1
commit
1109fc2523
@ -1392,7 +1392,7 @@ GLContext::ResizeOffscreenFBO(const gfxIntSize& aSize, const bool aUseReadFBO, c
|
||||
mActualFormat = cf;
|
||||
|
||||
#ifdef DEBUG
|
||||
if (mDebugMode) {
|
||||
if (DebugMode()) {
|
||||
printf_stderr("%s %dx%d offscreen FBO: r: %d g: %d b: %d a: %d depth: %d stencil: %d samples: %d\n",
|
||||
firstTime ? "Created" : "Resized",
|
||||
mOffscreenActualSize.width, mOffscreenActualSize.height,
|
||||
|
@ -1372,6 +1372,14 @@ protected:
|
||||
|
||||
PRUint32 mDebugMode;
|
||||
|
||||
inline PRUint32 DebugMode() {
|
||||
#ifdef DEBUG
|
||||
return mDebugMode;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
ContextFormat mCreationFormat;
|
||||
nsRefPtr<GLContext> mSharedContext;
|
||||
|
||||
@ -1407,7 +1415,7 @@ protected:
|
||||
if (!mCreationFormat.samples)
|
||||
return false;
|
||||
|
||||
if (mDebugMode) {
|
||||
if (DebugMode()) {
|
||||
printf_stderr("Requested level of multisampling is unavailable, continuing without multisampling\n");
|
||||
}
|
||||
|
||||
@ -1499,7 +1507,7 @@ protected:
|
||||
public:
|
||||
|
||||
void BeforeGLCall(const char* glFunction) {
|
||||
if (mDebugMode) {
|
||||
if (DebugMode()) {
|
||||
// since the static member variable sCurrentGLContext is not thread-local as it should,
|
||||
// we have to assert that we're in the main thread. Note that sCurrentGLContext is only used
|
||||
// for the OpenGL debug mode.
|
||||
@ -1509,7 +1517,7 @@ public:
|
||||
"It needs to be patched by making GLContext::sCurrentGLContext be thread-local.\n");
|
||||
NS_ABORT();
|
||||
}
|
||||
if (mDebugMode & DebugTrace)
|
||||
if (DebugMode() & DebugTrace)
|
||||
printf_stderr("[gl:%p] > %s\n", this, glFunction);
|
||||
if (this != sCurrentGLContext) {
|
||||
printf_stderr("Fatal: %s called on non-current context %p. "
|
||||
@ -1521,20 +1529,20 @@ public:
|
||||
}
|
||||
|
||||
void AfterGLCall(const char* glFunction) {
|
||||
if (mDebugMode) {
|
||||
if (DebugMode()) {
|
||||
// calling fFinish() immediately after every GL call makes sure that if this GL command crashes,
|
||||
// the stack trace will actually point to it. Otherwise, OpenGL being an asynchronous API, stack traces
|
||||
// tend to be meaningless
|
||||
mSymbols.fFinish();
|
||||
mGLError = mSymbols.fGetError();
|
||||
if (mDebugMode & DebugTrace)
|
||||
if (DebugMode() & DebugTrace)
|
||||
printf_stderr("[gl:%p] < %s [0x%04x]\n", this, glFunction, mGLError);
|
||||
if (mGLError != LOCAL_GL_NO_ERROR) {
|
||||
printf_stderr("GL ERROR: %s generated GL error %s(0x%04x)\n",
|
||||
glFunction,
|
||||
GLErrorToString(mGLError),
|
||||
mGLError);
|
||||
if (mDebugMode & DebugAbortOnError)
|
||||
if (DebugMode() & DebugAbortOnError)
|
||||
NS_ABORT();
|
||||
}
|
||||
}
|
||||
@ -1584,7 +1592,7 @@ public:
|
||||
GLenum fGetError() {
|
||||
#ifdef DEBUG
|
||||
// debug mode ends up eating the error in AFTER_GL_CALL
|
||||
if (mDebugMode) {
|
||||
if (DebugMode()) {
|
||||
GLenum err = mGLError;
|
||||
mGLError = LOCAL_GL_NO_ERROR;
|
||||
return err;
|
||||
|
Loading…
Reference in New Issue
Block a user