Bug 728631 - remove a bunch of accidentally-committed debug code.
authorJoe Drew <joe@drew.ca>
Tue, 21 Feb 2012 13:15:39 -0800
changeset 89205 181ba66322a009a0b84d117a015980ea91e54eb3
parent 89204 75fdc3a367da0a5d0f314e1d1dd752af36d0cf39
child 89206 40b477c54da38dd3bd36846658aba222f5839905
push id22242
push userkgupta@mozilla.com
push dateWed, 14 Mar 2012 15:19:09 +0000
treeherdermozilla-central@936ef50fa498 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs728631
milestone13.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 728631 - remove a bunch of accidentally-committed debug code.
gfx/gl/GLContext.cpp
gfx/gl/GLContext.h
gfx/gl/GLContextProviderEGL.cpp
--- a/gfx/gl/GLContext.cpp
+++ b/gfx/gl/GLContext.cpp
@@ -57,17 +57,17 @@
 #include "mozilla/Preferences.h"
 #include "mozilla/Util.h" // for DebugOnly
 
 using namespace mozilla::gfx;
 
 namespace mozilla {
 namespace gl {
 
-#if 1
+#ifdef DEBUG
 // see comment near declaration in GLContext.h. Should be thread-local.
 GLContext* GLContext::sCurrentGLContext = nsnull;
 #endif
 
 PRUint32 GLContext::sDebugMode = 0;
 
 // define this here since it's global to GLContextProvider, not any
 // specific implementation
@@ -421,17 +421,17 @@ GLContext::InitWithPrefix(const char *pr
             if (DoesStringMatch(glRendererString, rendererMatchStrings[i])) {
                 mRenderer = i;
                 break;
             }
         }
     }
 
     if (mInitialized) {
-#if 1
+#ifdef DEBUG
         static bool once = false;
         if (!once) {
             const char *vendors[VendorOther] = {
                 "Intel",
                 "NVIDIA",
                 "ATI",
                 "Qualcomm"
             };
@@ -540,17 +540,17 @@ GLContext::InitWithPrefix(const char *pr
                 if (auxFormat == LOCAL_GL_BGRA && auxType == LOCAL_GL_UNSIGNED_BYTE)
                     mSupport_ES_ReadPixels_BGRA_UByte = true;
             }
         }
 
         UpdateActualFormat();
     }
 
-#if 1
+#ifdef DEBUG
     if (PR_GetEnv("MOZ_GL_DEBUG"))
         sDebugMode |= DebugEnabled;
 
     // enables extra verbose output, informing of the start and finish of every GL call.
     // useful e.g. to record information to investigate graphics system crashes/lockups
     if (PR_GetEnv("MOZ_GL_DEBUG_VERBOSE"))
         sDebugMode |= DebugTrace;
 
@@ -571,17 +571,17 @@ GLContext::InitWithPrefix(const char *pr
 
 void
 GLContext::InitExtensions()
 {
     MakeCurrent();
     const GLubyte *extensions = fGetString(LOCAL_GL_EXTENSIONS);
     char *exts = strdup((char *)extensions);
 
-#if 1
+#ifdef DEBUG
     static bool once = false;
 #else
     const bool once = true;
 #endif
 
     if (!once) {
         printf_stderr("GL extensions: %s\n", exts);
     }
@@ -605,17 +605,17 @@ GLContext::InitExtensions()
             }
         }
 
         s = space+1;
     }
 
     free(exts);
 
-#if 1
+#ifdef DEBUG
     once = true;
 #endif
 }
 
 // Take texture data in a given buffer and copy it into a larger buffer,
 // padding out the edge pixels for filtering if necessary
 static void
 CopyAndPadTextureData(const GLvoid* srcBuffer,
@@ -1454,27 +1454,27 @@ GLContext::ResizeOffscreenFBO(const gfxI
     // We should be all resized.  Check for framebuffer completeness.
     GLenum status;
     bool framebuffersComplete = true;
 
     fBindFramebuffer(LOCAL_GL_FRAMEBUFFER, newOffscreenDrawFBO);
     status = fCheckFramebufferStatus(LOCAL_GL_FRAMEBUFFER);
     if (status != LOCAL_GL_FRAMEBUFFER_COMPLETE) {
         NS_WARNING("DrawFBO: Incomplete");
-#if 1
+#ifdef DEBUG
         printf_stderr("Framebuffer status: %X\n", status);
 #endif
         framebuffersComplete = false;
     }
 
     fBindFramebuffer(LOCAL_GL_FRAMEBUFFER, newOffscreenReadFBO);
     status = fCheckFramebufferStatus(LOCAL_GL_FRAMEBUFFER);
     if (status != LOCAL_GL_FRAMEBUFFER_COMPLETE) {
         NS_WARNING("ReadFBO: Incomplete");
-#if 1
+#ifdef DEBUG
         printf_stderr("Framebuffer status: %X\n", status);
 #endif
         framebuffersComplete = false;
     }
 
     if (!framebuffersComplete) {
         NS_WARNING("Error resizing offscreen framebuffer -- framebuffer(s) not complete");
 
@@ -1526,17 +1526,17 @@ GLContext::ResizeOffscreenFBO(const gfxI
     mOffscreenDepthRB = newOffscreenDepthRB;
     mOffscreenStencilRB = newOffscreenStencilRB;
 
     mOffscreenSize = aSize;
     mOffscreenActualSize = aSize;
 
     mActualFormat = cf;
 
-#if 1
+#ifdef DEBUG
     if (DebugMode()) {
         printf_stderr("Resized %dx%d offscreen FBO: r: %d g: %d b: %d a: %d depth: %d stencil: %d samples: %d\n",
                       mOffscreenActualSize.width, mOffscreenActualSize.height,
                       mActualFormat.red, mActualFormat.green, mActualFormat.blue, mActualFormat.alpha,
                       mActualFormat.depth, mActualFormat.stencil, mActualFormat.samples);
     }
 #endif
 
@@ -2714,17 +2714,17 @@ GLContext::SetBlitFramebufferForDestText
         // Note: if you are hitting this, it is likely that
         // your texture is not texture complete -- that is, you
         // allocated a texture name, but didn't actually define its
         // size via a call to TexImage2D.
         NS_RUNTIMEABORT(msg.get());
     }
 }
 
-#if 1
+#ifdef DEBUG
 
 void
 GLContext::CreatedProgram(GLContext *aOrigin, GLuint aName)
 {
     mTrackedPrograms.AppendElement(NamedResource(aOrigin, aName));
 }
 
 void
--- a/gfx/gl/GLContext.h
+++ b/gfx/gl/GLContext.h
@@ -564,26 +564,26 @@ public:
         mFlipped(false),
         mBlitProgram(0),
         mBlitFramebuffer(0),
         mOffscreenDrawFBO(0),
         mOffscreenReadFBO(0),
         mOffscreenColorRB(0),
         mOffscreenDepthRB(0),
         mOffscreenStencilRB(0)
-#if 1
+#ifdef DEBUG
         , mGLError(LOCAL_GL_NO_ERROR)
 #endif
     {
         mUserData.Init();
     }
 
     virtual ~GLContext() {
         NS_ASSERTION(IsDestroyed(), "GLContext implementation must call MarkDestroyed in destructor!");
-#if 1
+#ifdef DEBUG
         if (mSharedContext) {
             GLContext *tip = mSharedContext;
             while (tip->mSharedContext)
                 tip = tip->mSharedContext;
             tip->SharedContextDestroyed(this);
             tip->ReportOutstandingNames();
         }
 #endif
@@ -598,17 +598,17 @@ public:
         ContextTypeOSMesa
     };
 
     virtual GLContextType GetContextType() { return ContextTypeUnknown; }
 
     virtual bool MakeCurrentImpl(bool aForce = false) = 0;
 
     bool MakeCurrent(bool aForce = false) {
-#if 1
+#ifdef DEBUG
         sCurrentGLContext = this;
 #endif
         return MakeCurrentImpl(aForce);
     }
 
     bool IsContextLost() { return mContextLost; }
 
     virtual bool SetupLookupFunction() = 0;
@@ -928,17 +928,17 @@ public:
 
           default:
             raw_fBindFramebuffer(target, framebuffer);
             break;
         }
     }
 
     GLuint GetBoundDrawFBO() {
-#if 1
+#ifdef DEBUG
         GLint ret = 0;
         // Don't need a branch here, because:
         // LOCAL_GL_DRAW_FRAMEBUFFER_BINDING_EXT == LOCAL_GL_FRAMEBUFFER_BINDING == 0x8CA6
         // We use raw_ here because this is debug code and we need to see what
         // the driver thinks.
         raw_fGetIntegerv(LOCAL_GL_DRAW_FRAMEBUFFER_BINDING_EXT, &ret);
 
         if (mInternalBoundDrawFBO != (GLuint)ret) {
@@ -947,17 +947,17 @@ public:
         }
 #endif
 
         // We only ever expose the user's bound FBOs
         return mUserBoundDrawFBO;
     }
 
     GLuint GetBoundReadFBO() {
-#if 1
+#ifdef DEBUG
         GLint ret = 0;
         // We use raw_ here because this is debug code and we need to see what
         // the driver thinks.
         if (SupportsOffscreenSplit())
             raw_fGetIntegerv(LOCAL_GL_READ_FRAMEBUFFER_BINDING_EXT, &ret);
         else
             raw_fGetIntegerv(LOCAL_GL_FRAMEBUFFER_BINDING, &ret);
 
@@ -1489,31 +1489,31 @@ public:
         DebugEnabled = 1 << 0,
         DebugTrace = 1 << 1,
         DebugAbortOnError = 1 << 2
     };
 
     static PRUint32 sDebugMode;
 
     static PRUint32 DebugMode() {
-#if 1
+#ifdef DEBUG
         return sDebugMode;
 #else
         return 0;
 #endif
     }
 
 protected:
 
     ContextFormat mCreationFormat;
     nsRefPtr<GLContext> mSharedContext;
 
     GLContextSymbols mSymbols;
 
-#if 1
+#ifdef DEBUG
     // this should be thread-local, but that is slightly annoying to implement because on Mac
     // we don't have any __thread-like keyword. So for now, MOZ_GL_DEBUG assumes (and asserts)
     // that only the main thread is doing OpenGL calls.
     static THEBES_API GLContext* sCurrentGLContext;
 #endif
 
     void UpdateActualFormat();
     ContextFormat mActualFormat;
@@ -1612,17 +1612,17 @@ public:
         if (error) {
             // clear all pending errors
             while(fGetError()) {}
         }
         
         return error;
     }
 
-#if 1
+#ifdef DEBUG
 
 #ifndef MOZ_FUNCTION_NAME
 # ifdef __GNUC__
 #  define MOZ_FUNCTION_NAME __PRETTY_FUNCTION__
 # elif defined(_MSC_VER)
 #  define MOZ_FUNCTION_NAME __FUNCTION__
 # else
 #  define MOZ_FUNCTION_NAME __func__  // defined in C99, supported in various C++ compilers. Just raw function name.
@@ -1713,17 +1713,17 @@ public:
 #define BEFORE_GL_CALL do { } while (0)
 #define AFTER_GL_CALL do { } while (0)
 
 #endif
 
     /*** In GL debug mode, we completely override glGetError ***/
 
     GLenum fGetError() {
-#if 1
+#ifdef DEBUG
         // debug mode ends up eating the error in AFTER_GL_CALL
         if (DebugMode()) {
             GLenum err = mGLError;
             mGLError = LOCAL_GL_NO_ERROR;
             return err;
         }
 #endif
 
@@ -2641,17 +2641,17 @@ public:
     realGLboolean fUnmapBuffer(GLenum target) {
         BEFORE_GL_CALL;
         realGLboolean ret = mSymbols.fUnmapBuffer(target);
         AFTER_GL_CALL;
         return ret;
     }
 
 
-#if 1
+#ifdef DEBUG
      GLContext *TrackingContext() {
          GLContext *tip = this;
          while (tip->mSharedContext)
              tip = tip->mSharedContext;
          return tip;
      }
 
 #define TRACKING_CONTEXT(a) do { TrackingContext()->a; } while (0)
@@ -2751,17 +2751,17 @@ public:
 
      GLenum GLAPIENTRY fGetGraphicsResetStatus() {
          BEFORE_GL_CALL;
          GLenum ret = mHasRobustness ? mSymbols.fGetGraphicsResetStatus() : 0;
          AFTER_GL_CALL;
          return ret;
      }
 
-#if 1
+#ifdef DEBUG
     void THEBES_API CreatedProgram(GLContext *aOrigin, GLuint aName);
     void THEBES_API CreatedShader(GLContext *aOrigin, GLuint aName);
     void THEBES_API CreatedBuffers(GLContext *aOrigin, GLsizei aCount, GLuint *aNames);
     void THEBES_API CreatedTextures(GLContext *aOrigin, GLsizei aCount, GLuint *aNames);
     void THEBES_API CreatedFramebuffers(GLContext *aOrigin, GLsizei aCount, GLuint *aNames);
     void THEBES_API CreatedRenderbuffers(GLContext *aOrigin, GLsizei aCount, GLuint *aNames);
     void THEBES_API DeletedProgram(GLContext *aOrigin, GLuint aName);
     void THEBES_API DeletedShader(GLContext *aOrigin, GLuint aName);
--- a/gfx/gl/GLContextProviderEGL.cpp
+++ b/gfx/gl/GLContextProviderEGL.cpp
@@ -247,17 +247,17 @@ is_power_of_two(int v)
     NS_ASSERTION(v >= 0, "bad value");
 
     if (v == 0)
         return true;
 
     return (v & (v-1)) == 0;
 }
 
-#if 1
+#ifdef DEBUG
 #undef BEFORE_GL_CALL
 #undef AFTER_GL_CALL
 
 #define BEFORE_GL_CALL do {          \
     BeforeGLCall(MOZ_FUNCTION_NAME); \
 } while (0)
 
 #define AFTER_GL_CALL do {           \
@@ -992,32 +992,32 @@ public:
         , mBound(false)
         , mIsPBuffer(false)
         , mIsDoubleBuffered(false)
         , mPBufferCanBindToTexture(false)
     {
         // any EGL contexts will always be GLESv2
         SetIsGLES2(true);
 
-#if 1
+#ifdef DEBUG
         printf_stderr("Initializing context %p surface %p on display %p\n", mContext, mSurface, EGL_DISPLAY());
 #endif
     }
 
     ~GLContextEGL()
     {
         MarkDestroyed();
 
         // If mGLWidget is non-null, then we've been given it by the GL context provider,
         // and it's managed by the widget implementation. In this case, We can't destroy
         // our contexts.
         if (mPlatformContext)
             return;
 
-#if 1
+#ifdef DEBUG
         printf_stderr("Destroying context %p surface %p on display %p\n", mContext, mSurface, EGL_DISPLAY());
 #endif
 
         sEGLLibrary.fDestroyContext(EGL_DISPLAY(), mContext);
         if (mSurface && !mPlatformContext) {
             sEGLLibrary.fDestroySurface(EGL_DISPLAY(), mSurface);
         }
     }
@@ -2211,17 +2211,17 @@ CreateConfig(EGLConfig* aConfig)
     return false;
 }
 
 static EGLSurface
 CreateSurfaceForWindow(nsIWidget *aWidget, EGLConfig config)
 {
     EGLSurface surface;
 
-#if 1
+#ifdef DEBUG
     sEGLLibrary.DumpEGLConfig(config);
 #endif
 
 #ifdef MOZ_JAVA_COMPOSITOR
     printf_stderr("... requesting window surface from bridge\n");
     surface = mozilla::AndroidBridge::Bridge()->ProvideEGLSurface();
     printf_stderr("got surface %p\n", surface);
     return surface;
@@ -2420,17 +2420,17 @@ TRY_ATTRIBS_AGAIN:
 
         // no configs? no pbuffers!
         return nsnull;
     }
 
     // XXX do some smarter matching here, perhaps instead of the more complex
     // minimum overrides above
     config = configs[0];
-#if 1
+#ifdef DEBUG
     sEGLLibrary.DumpEGLConfig(config);
 #endif
 
     gfxIntSize pbsize(aSize);
     surface = GLContextEGL::CreatePBufferSurfaceTryingPowerOfTwo(config,
                                                                  configCanBindToTexture
                                                                  ? (aFormat.minAlpha
                                                                     ? LOCAL_EGL_TEXTURE_RGBA