Bug 696495 - set tex min filter before generateMipmap calls, to work around driver bugs - r=jgilbert, a=akeybl
authorBenoit Jacob <bjacob@mozilla.com>
Thu, 19 Apr 2012 23:28:01 -0400
changeset 92021 eb53fd36832405f3a4b041ff50e31ad5b1d22a5a
parent 92020 83faa1da3db83f3abec690d67f09e711af98d0f9
child 92022 7b59d08bd69a3c2396680ce6068dfbffa1a07c3b
push id22497
push usereakhgari@mozilla.com
push dateFri, 20 Apr 2012 17:10:37 +0000
treeherdermozilla-central@17af008937e3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgilbert, akeybl
bugs696495
milestone14.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 696495 - set tex min filter before generateMipmap calls, to work around driver bugs - r=jgilbert, a=akeybl
content/canvas/src/WebGLContextGL.cpp
content/canvas/test/webgl/failing_tests_mac.txt
--- a/content/canvas/src/WebGLContextGL.cpp
+++ b/content/canvas/src/WebGLContextGL.cpp
@@ -1928,17 +1928,29 @@ WebGLContext::GenerateMipmap(WebGLenum t
         return ErrorInvalidOperation("generateMipmap: Texture data at level zero is compressed.");
 
     if (!tex->AreAllLevel0ImageInfosEqual())
         return ErrorInvalidOperation("generateMipmap: The six faces of this cube map have different dimensions, format, or type.");
 
     tex->SetGeneratedMipmap();
 
     MakeContextCurrent();
-    gl->fGenerateMipmap(target);
+
+    if (gl->WorkAroundDriverBugs()) {
+        // bug 696495 - to work around failures in the texture-mips.html test on various drivers, we
+        // set the minification filter before calling glGenerateMipmap. This should not carry a significant performance
+        // overhead so we do it unconditionally.
+        //
+        // note that the choice of GL_NEAREST_MIPMAP_NEAREST really matters. See Chromium bug 101105.
+        gl->fTexParameteri(target, LOCAL_GL_TEXTURE_MIN_FILTER, LOCAL_GL_NEAREST_MIPMAP_NEAREST);
+        gl->fGenerateMipmap(target);
+        gl->fTexParameteri(target, LOCAL_GL_TEXTURE_MIN_FILTER, tex->MinFilter());
+    } else {
+        gl->fGenerateMipmap(target);
+    }
     return NS_OK;
 }
 
 NS_IMETHODIMP
 WebGLContext::GetActiveUniform(nsIWebGLProgram *pobj, PRUint32 index, nsIWebGLActiveInfo **retval)
 {
     if (!IsContextStable())
         return NS_OK;
--- a/content/canvas/test/webgl/failing_tests_mac.txt
+++ b/content/canvas/test/webgl/failing_tests_mac.txt
@@ -1,4 +1,2 @@
 conformance/glsl/misc/glsl-function-nodes.html
 conformance/programs/program-test.html
-conformance/textures/texture-mips.html
-conformance/textures/texture-npot.html