Bug 777028 - honor gfx.work-around-driver-bugs for Mesa WebGL workaround - r=jgilbert
authorBenoit Jacob <bjacob@mozilla.com>
Thu, 23 Aug 2012 14:56:17 -0400
changeset 105238 05d1a3fba90bd35e41719d48a28641952c9fb454
parent 105237 f4c286fc04f0a4275cdb24546a916f3750f58a8d
child 105239 156eaa94f73c9110bd521063f08fefff432209e0
push id55
push usershu@rfrn.org
push dateThu, 30 Aug 2012 01:33:09 +0000
reviewersjgilbert
bugs777028
milestone17.0a1
Bug 777028 - honor gfx.work-around-driver-bugs for Mesa WebGL workaround - r=jgilbert
content/canvas/src/WebGLContextGL.cpp
--- a/content/canvas/src/WebGLContextGL.cpp
+++ b/content/canvas/src/WebGLContextGL.cpp
@@ -3701,39 +3701,39 @@ WebGLContext::LinkProgram(nsIWebGLProgra
 void
 WebGLContext::LinkProgram(WebGLProgram *program, ErrorResult& rv)
 {
     if (!IsContextStable())
         return;
 
     if (!ValidateObject("linkProgram", program))
         return;
-    
+
     GLuint progname = program->GLName();
 
     if (!program->NextGeneration()) {
         return rv.Throw(NS_ERROR_FAILURE);
     }
 
     if (!program->HasBothShaderTypesAttached()) {
         GenerateWarning("linkProgram: this program doesn't have both a vertex shader"
                         " and a fragment shader");
         program->SetLinkStatus(false);
         return;
     }
 
     // bug 777028
     // Mesa can't handle more than 16 samplers per program, counting each array entry.
-    if (mIsMesa) {
-        if (program->UpperBoundNumSamplerUniforms() > 16) {
-            GenerateWarning("Programs with more than 16 samplers are disallowed on Mesa drivers "
-                            "to avoid a Mesa crasher.");
-            program->SetLinkStatus(false);
-            return;
-        }
+    if (gl->WorkAroundDriverBugs() &&
+        mIsMesa &&
+        program->UpperBoundNumSamplerUniforms() > 16)
+    {
+        GenerateWarning("Programs with more than 16 samplers are disallowed on Mesa drivers " "to avoid a Mesa crasher.");
+        program->SetLinkStatus(false);
+        return;
     }
 
     GLint ok;
     if (gl->WorkAroundDriverBugs() &&
         program->HasBadShaderAttached())
     {
         // it's a common driver bug, caught by program-test.html, that linkProgram doesn't
         // correctly preserve the state of an in-use program that has been attached a bad shader