Bug 879304 - Add "webgl.max-warnings-per-context" preference. r=bjacob

This commit is contained in:
Guillaume Abadie 2013-06-04 15:44:08 -04:00
parent 402c1c9beb
commit a29fd38573
3 changed files with 13 additions and 1 deletions

View File

@ -189,6 +189,12 @@ WebGLContext::WebGLContext()
mAlreadyGeneratedWarnings = 0;
mAlreadyWarnedAboutFakeVertexAttrib0 = false;
mMaxWarnings = Preferences::GetInt("webgl.max-warnings-per-context", 32);
if (mMaxWarnings < -1)
{
GenerateWarning("webgl.max-warnings-per-context size is too large (seems like a negative value wrapped)");
mMaxWarnings = 0;
}
mLastUseIndex = 0;

View File

@ -1134,10 +1134,15 @@ protected:
int mDrawCallsSinceLastFlush;
int mAlreadyGeneratedWarnings;
int mMaxWarnings;
bool mAlreadyWarnedAboutFakeVertexAttrib0;
bool ShouldGenerateWarnings() const {
return mAlreadyGeneratedWarnings < 32;
if (mMaxWarnings == -1) {
return true;
}
return mAlreadyGeneratedWarnings < mMaxWarnings;
}
uint64_t mLastUseIndex;

View File

@ -3962,6 +3962,7 @@ pref("webgl.default-no-alpha", false);
pref("webgl.force-layers-readback", false);
pref("webgl.lose-context-on-heap-minimize", false);
pref("webgl.can-lose-context-in-foreground", true);
pref("webgl.max-warnings-per-context", 32);
// Stagefright prefs
pref("stagefright.force-enabled", false);