mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 21:31:04 +00:00
Bug 1089018 - Centralize GLContext spew control. - r=jrmuizel
This commit is contained in:
parent
c2d741db42
commit
37012e9ef6
@ -504,11 +504,11 @@ GLContext::InitWithPrefix(const char *prefix, bool trygl)
|
||||
uint32_t version = 0;
|
||||
ParseGLVersion(this, &version);
|
||||
|
||||
#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));
|
||||
#endif
|
||||
if (ShouldSpew()) {
|
||||
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));
|
||||
}
|
||||
|
||||
if (version >= mVersion) {
|
||||
mVersion = version;
|
||||
@ -639,10 +639,8 @@ GLContext::InitWithPrefix(const char *prefix, bool trygl)
|
||||
#endif
|
||||
|
||||
if (mInitialized) {
|
||||
#ifdef MOZ_GL_DEBUG
|
||||
static bool firstRun = true;
|
||||
if (firstRun && DebugMode()) {
|
||||
const char *vendors[size_t(GLVendor::Other)] = {
|
||||
if (ShouldSpew()) {
|
||||
const char* vendors[size_t(GLVendor::Other)] = {
|
||||
"Intel",
|
||||
"NVIDIA",
|
||||
"ATI",
|
||||
@ -657,8 +655,6 @@ GLContext::InitWithPrefix(const char *prefix, bool trygl)
|
||||
printf_stderr("OpenGL vendor ('%s') unrecognized\n", glVendorString);
|
||||
}
|
||||
}
|
||||
firstRun = false;
|
||||
#endif
|
||||
|
||||
InitExtensions();
|
||||
InitFeatures();
|
||||
@ -1601,14 +1597,8 @@ GLContext::InitExtensions()
|
||||
if (!extensions)
|
||||
return;
|
||||
|
||||
#ifdef MOZ_GL_DEBUG
|
||||
static bool firstRun = true;
|
||||
#else
|
||||
// Non-DEBUG, so never spew.
|
||||
const bool firstRun = false;
|
||||
#endif
|
||||
|
||||
InitializeExtensionsBitSet(mAvailableExtensions, extensions, sExtensionNames, firstRun && DebugMode());
|
||||
InitializeExtensionsBitSet(mAvailableExtensions, extensions,
|
||||
sExtensionNames);
|
||||
|
||||
if (WorkAroundDriverBugs() &&
|
||||
Vendor() == GLVendor::Qualcomm) {
|
||||
@ -1651,10 +1641,6 @@ GLContext::InitExtensions()
|
||||
MarkExtensionUnsupported(EXT_texture_compression_s3tc);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_GL_DEBUG
|
||||
firstRun = false;
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
@ -2291,7 +2277,7 @@ ReportArrayContents(const char *title, const nsTArray<GLContext::NamedResource>&
|
||||
void
|
||||
GLContext::ReportOutstandingNames()
|
||||
{
|
||||
if (!DebugMode())
|
||||
if (!ShouldSpew())
|
||||
return;
|
||||
|
||||
printf_stderr("== GLContext %p Outstanding ==\n", this);
|
||||
@ -2307,7 +2293,6 @@ GLContext::ReportOutstandingNames()
|
||||
|
||||
#endif /* DEBUG */
|
||||
|
||||
|
||||
void
|
||||
GLContext::GuaranteeResolve()
|
||||
{
|
||||
@ -2455,5 +2440,12 @@ DoesStringMatch(const char* aString, const char *aWantedString)
|
||||
return true;
|
||||
}
|
||||
|
||||
/*static*/ bool
|
||||
GLContext::ShouldSpew()
|
||||
{
|
||||
static bool spew = PR_GetEnv("MOZ_GL_SPEW");
|
||||
return spew;
|
||||
}
|
||||
|
||||
} /* namespace gl */
|
||||
} /* namespace mozilla */
|
||||
|
@ -465,15 +465,15 @@ public:
|
||||
mAvailableExtensions[aKnownExtension] = 1;
|
||||
}
|
||||
|
||||
|
||||
public:
|
||||
|
||||
template<size_t N>
|
||||
static void InitializeExtensionsBitSet(std::bitset<N>& extensionsBitset, const char* extStr, const char** extList, bool verbose = false)
|
||||
static void InitializeExtensionsBitSet(std::bitset<N>& extensionsBitset,
|
||||
const char* extStr,
|
||||
const char** extList)
|
||||
{
|
||||
char* exts = ::strdup(extStr);
|
||||
|
||||
if (verbose)
|
||||
if (ShouldSpew())
|
||||
printf_stderr("Extensions: %s\n", exts);
|
||||
|
||||
char* cur = exts;
|
||||
@ -488,7 +488,7 @@ public:
|
||||
|
||||
for (int i = 0; extList[i]; ++i) {
|
||||
if (PL_strcasecmp(cur, extList[i]) == 0) {
|
||||
if (verbose)
|
||||
if (ShouldSpew())
|
||||
printf_stderr("Found extension %s\n", cur);
|
||||
extensionsBitset[i] = true;
|
||||
}
|
||||
@ -500,11 +500,9 @@ public:
|
||||
free(exts);
|
||||
}
|
||||
|
||||
|
||||
protected:
|
||||
std::bitset<Extensions_Max> mAvailableExtensions;
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Feature queries
|
||||
/*
|
||||
@ -3698,6 +3696,7 @@ protected:
|
||||
|
||||
public:
|
||||
void FlushIfHeavyGLCallsSinceLastFlush();
|
||||
static bool ShouldSpew();
|
||||
};
|
||||
|
||||
bool DoesStringMatch(const char* aString, const char *aWantedString);
|
||||
|
@ -805,7 +805,7 @@ GLContextEGL::CreateEGLPBufferOffscreenContext(const gfxIntSize& size)
|
||||
|
||||
// We absolutely don't care, so just pick the first one.
|
||||
config = configs[0];
|
||||
if (GLContext::DebugMode())
|
||||
if (GLContext::ShouldSpew())
|
||||
sEGLLibrary.DumpEGLConfig(config);
|
||||
|
||||
gfxIntSize pbSize(size);
|
||||
|
@ -123,7 +123,7 @@ GLLibraryEGL::EnsureInitialized()
|
||||
|
||||
#ifdef MOZ_B2G
|
||||
if (!sCurrentContext.init())
|
||||
MOZ_CRASH("Tls init failed");
|
||||
MOZ_CRASH("Tls init failed");
|
||||
#endif
|
||||
|
||||
#ifdef XP_WIN
|
||||
@ -409,22 +409,8 @@ GLLibraryEGL::InitExtensions()
|
||||
return;
|
||||
}
|
||||
|
||||
bool debugMode = false;
|
||||
#ifdef DEBUG
|
||||
if (PR_GetEnv("MOZ_GL_DEBUG"))
|
||||
debugMode = true;
|
||||
|
||||
static bool firstRun = true;
|
||||
#else
|
||||
// Non-DEBUG, so never spew.
|
||||
const bool firstRun = false;
|
||||
#endif
|
||||
|
||||
GLContext::InitializeExtensionsBitSet(mAvailableExtensions, extensions, sEGLExtensionNames, firstRun && debugMode);
|
||||
|
||||
#ifdef DEBUG
|
||||
firstRun = false;
|
||||
#endif
|
||||
GLContext::InitializeExtensionsBitSet(mAvailableExtensions, extensions,
|
||||
sEGLExtensionNames);
|
||||
}
|
||||
|
||||
void
|
||||
|
Loading…
Reference in New Issue
Block a user