зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1082902 - Make it possible to have GL debugging in release builds. r=jgilbert
This commit is contained in:
Родитель
fb7b2630ab
Коммит
cc1383c2fc
|
@ -49,7 +49,7 @@ namespace gl {
|
|||
using namespace mozilla::gfx;
|
||||
using namespace mozilla::layers;
|
||||
|
||||
#ifdef DEBUG
|
||||
#ifdef MOZ_GL_DEBUG
|
||||
unsigned GLContext::sCurrentGLContextTLS = -1;
|
||||
#endif
|
||||
|
||||
|
@ -292,7 +292,7 @@ GLContext::GLContext(const SurfaceCaps& caps,
|
|||
mVendor(GLVendor::Other),
|
||||
mRenderer(GLRenderer::Other),
|
||||
mHasRobustness(false),
|
||||
#ifdef DEBUG
|
||||
#ifdef MOZ_GL_DEBUG
|
||||
mIsInLocalErrorCheck(false),
|
||||
#endif
|
||||
mSharedContext(sharedContext),
|
||||
|
@ -312,7 +312,7 @@ GLContext::GLContext(const SurfaceCaps& caps,
|
|||
|
||||
GLContext::~GLContext() {
|
||||
NS_ASSERTION(IsDestroyed(), "GLContext implementation must call MarkDestroyed in destructor!");
|
||||
#ifdef DEBUG
|
||||
#ifdef MOZ_GL_DEBUG
|
||||
if (mSharedContext) {
|
||||
GLContext *tip = mSharedContext;
|
||||
while (tip->mSharedContext)
|
||||
|
@ -511,7 +511,7 @@ GLContext::InitWithPrefix(const char *prefix, bool trygl)
|
|||
|
||||
ParseGLVersion(this, &version);
|
||||
|
||||
#ifdef DEBUG
|
||||
#ifdef MOZ_GL_DEBUG
|
||||
printf_stderr("OpenGL version detected: %u\n", version);
|
||||
printf_stderr("OpenGL vendor: %s\n", fGetString(LOCAL_GL_VENDOR));
|
||||
printf_stderr("OpenGL renderer: %s\n", fGetString(LOCAL_GL_RENDERER));
|
||||
|
@ -631,7 +631,7 @@ GLContext::InitWithPrefix(const char *prefix, bool trygl)
|
|||
}
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
#ifdef MOZ_GL_DEBUG
|
||||
if (PR_GetEnv("MOZ_GL_DEBUG"))
|
||||
sDebugMode |= DebugEnabled;
|
||||
|
||||
|
@ -646,7 +646,7 @@ GLContext::InitWithPrefix(const char *prefix, bool trygl)
|
|||
#endif
|
||||
|
||||
if (mInitialized) {
|
||||
#ifdef DEBUG
|
||||
#ifdef MOZ_GL_DEBUG
|
||||
static bool firstRun = true;
|
||||
if (firstRun && DebugMode()) {
|
||||
const char *vendors[size_t(GLVendor::Other)] = {
|
||||
|
@ -1608,7 +1608,7 @@ GLContext::InitExtensions()
|
|||
if (!extensions)
|
||||
return;
|
||||
|
||||
#ifdef DEBUG
|
||||
#ifdef MOZ_GL_DEBUG
|
||||
static bool firstRun = true;
|
||||
#else
|
||||
// Non-DEBUG, so never spew.
|
||||
|
@ -1659,7 +1659,7 @@ GLContext::InitExtensions()
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
#ifdef MOZ_GL_DEBUG
|
||||
firstRun = false;
|
||||
#endif
|
||||
}
|
||||
|
@ -1749,7 +1749,7 @@ void
|
|||
GLContext::UpdatePixelFormat()
|
||||
{
|
||||
PixelBufferFormat format = QueryPixelFormat();
|
||||
#ifdef DEBUG
|
||||
#ifdef MOZ_GL_DEBUG
|
||||
const SurfaceCaps& caps = Caps();
|
||||
MOZ_ASSERT(!caps.any, "Did you forget to DetermineCaps()?");
|
||||
|
||||
|
@ -1973,7 +1973,7 @@ GLContext::AssembleOffscreenFBs(const GLuint colorMSRB,
|
|||
|
||||
if (!IsFramebufferComplete(drawFB, &status)) {
|
||||
NS_WARNING("DrawFBO: Incomplete");
|
||||
#ifdef DEBUG
|
||||
#ifdef MOZ_GL_DEBUG
|
||||
if (DebugMode()) {
|
||||
printf_stderr("Framebuffer status: %X\n", status);
|
||||
}
|
||||
|
@ -1983,7 +1983,7 @@ GLContext::AssembleOffscreenFBs(const GLuint colorMSRB,
|
|||
|
||||
if (!IsFramebufferComplete(readFB, &status)) {
|
||||
NS_WARNING("ReadFBO: Incomplete");
|
||||
#ifdef DEBUG
|
||||
#ifdef MOZ_GL_DEBUG
|
||||
if (DebugMode()) {
|
||||
printf_stderr("Framebuffer status: %X\n", status);
|
||||
}
|
||||
|
@ -2107,7 +2107,7 @@ GLContext::MarkDestroyed()
|
|||
mSymbols.Zero();
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
#ifdef MOZ_GL_DEBUG
|
||||
/* static */ void
|
||||
GLContext::AssertNotPassingStackBufferToTheGL(const void* ptr)
|
||||
{
|
||||
|
|
|
@ -26,6 +26,12 @@
|
|||
#undef GetClassName
|
||||
#endif
|
||||
|
||||
// Define MOZ_GL_DEBUG unconditionally to enable GL debugging in opt
|
||||
// builds.
|
||||
#ifdef DEBUG
|
||||
#define MOZ_GL_DEBUG 1
|
||||
#endif
|
||||
|
||||
#include "mozilla/UniquePtr.h"
|
||||
|
||||
#include "GLDefs.h"
|
||||
|
@ -643,7 +649,7 @@ private:
|
|||
////////////////////////////////////
|
||||
// Use this safer option.
|
||||
private:
|
||||
#ifdef DEBUG
|
||||
#ifdef MOZ_GL_DEBUG
|
||||
bool mIsInLocalErrorCheck;
|
||||
#endif
|
||||
|
||||
|
@ -657,7 +663,7 @@ public:
|
|||
: mGL(gl)
|
||||
, mHasBeenChecked(false)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
#ifdef MOZ_GL_DEBUG
|
||||
MOZ_ASSERT(!mGL->mIsInLocalErrorCheck);
|
||||
mGL->mIsInLocalErrorCheck = true;
|
||||
#endif
|
||||
|
@ -665,7 +671,7 @@ public:
|
|||
}
|
||||
|
||||
GLenum GetLocalError() {
|
||||
#ifdef DEBUG
|
||||
#ifdef MOZ_GL_DEBUG
|
||||
MOZ_ASSERT(mGL->mIsInLocalErrorCheck);
|
||||
mGL->mIsInLocalErrorCheck = false;
|
||||
#endif
|
||||
|
@ -704,7 +710,7 @@ private:
|
|||
#undef BEFORE_GL_CALL
|
||||
#undef AFTER_GL_CALL
|
||||
|
||||
#ifdef DEBUG
|
||||
#ifdef MOZ_GL_DEBUG
|
||||
|
||||
#ifndef MOZ_FUNCTION_NAME
|
||||
# ifdef __GNUC__
|
||||
|
@ -792,7 +798,7 @@ private:
|
|||
|
||||
#define ASSERT_NOT_PASSING_STACK_BUFFER_TO_GL(ptr) AssertNotPassingStackBufferToTheGL(ptr)
|
||||
|
||||
#else // ifdef DEBUG
|
||||
#else // ifdef MOZ_GL_DEBUG
|
||||
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
// Record the name of the GL call for better hang stacks on Android.
|
||||
|
@ -804,7 +810,7 @@ private:
|
|||
#define TRACKING_CONTEXT(a) do {} while (0)
|
||||
#define ASSERT_NOT_PASSING_STACK_BUFFER_TO_GL(ptr) do {} while (0)
|
||||
|
||||
#endif // ifdef DEBUG
|
||||
#endif // ifdef MOZ_GL_DEBUG
|
||||
|
||||
#define ASSERT_SYMBOL_PRESENT(func) \
|
||||
do {\
|
||||
|
@ -3200,7 +3206,7 @@ protected:
|
|||
virtual bool MakeCurrentImpl(bool aForce) = 0;
|
||||
|
||||
public:
|
||||
#ifdef DEBUG
|
||||
#ifdef MOZ_GL_DEBUG
|
||||
static void StaticInit() {
|
||||
PR_NewThreadPrivateIndex(&sCurrentGLContextTLS, nullptr);
|
||||
}
|
||||
|
@ -3210,7 +3216,7 @@ public:
|
|||
if (IsDestroyed()) {
|
||||
return false;
|
||||
}
|
||||
#ifdef DEBUG
|
||||
#ifdef MOZ_GL_DEBUG
|
||||
PR_SetThreadPrivate(sCurrentGLContextTLS, this);
|
||||
|
||||
// XXX this assertion is disabled because it's triggering on Mac;
|
||||
|
@ -3385,7 +3391,7 @@ public:
|
|||
static uint32_t sDebugMode;
|
||||
|
||||
static uint32_t DebugMode() {
|
||||
#ifdef DEBUG
|
||||
#ifdef MOZ_GL_DEBUG
|
||||
return sDebugMode;
|
||||
#else
|
||||
return 0;
|
||||
|
@ -3400,7 +3406,7 @@ protected:
|
|||
|
||||
GLContextSymbols mSymbols;
|
||||
|
||||
#ifdef DEBUG
|
||||
#ifdef MOZ_GL_DEBUG
|
||||
// GLDebugMode will check that we don't send call
|
||||
// to a GLContext that isn't current on the current
|
||||
// thread.
|
||||
|
@ -3641,7 +3647,7 @@ public:
|
|||
|
||||
#undef ASSERT_SYMBOL_PRESENT
|
||||
|
||||
#ifdef DEBUG
|
||||
#ifdef MOZ_GL_DEBUG
|
||||
void CreatedProgram(GLContext *aOrigin, GLuint aName);
|
||||
void CreatedShader(GLContext *aOrigin, GLuint aName);
|
||||
void CreatedBuffers(GLContext *aOrigin, GLsizei aCount, GLuint *aNames);
|
||||
|
|
|
@ -382,7 +382,7 @@ gfxPlatform::Init()
|
|||
#error "No gfxPlatform implementation available"
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
#ifdef MOZ_GL_DEBUG
|
||||
mozilla::gl::GLContext::StaticInit();
|
||||
#endif
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче