Bug 696495 - texture-mips.html failures might be workaroundable by setting minification filter before glGenerateMipmap call - r=jgilbert
authorBenoit Jacob <jacob.benoit.1@gmail.com>
Tue, 24 Jan 2012 16:12:31 -0500
changeset 86498 23ec123586baa1ed8fe569d029ca61e2ad8e42e2
parent 86497 a4e932fb3c3d893e60d34ad925ec48f1e54dab1c
child 86499 0a4bc12a0d9870d4d48eb7f6c36cd21e9c6a6eba
push id805
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 18:17:35 +0000
treeherdermozilla-aurora@6fb3bf232436 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgilbert
bugs696495
milestone12.0a1
Bug 696495 - texture-mips.html failures might be workaroundable by setting minification filter before glGenerateMipmap call - r=jgilbert
content/canvas/src/WebGLContextGL.cpp
content/canvas/test/webgl/failing_tests_linux.txt
--- a/content/canvas/src/WebGLContextGL.cpp
+++ b/content/canvas/src/WebGLContextGL.cpp
@@ -1898,17 +1898,25 @@ WebGLContext::GenerateMipmap(WebGLenum t
 
     if (!tex->AreAllLevel0ImageInfosEqual()) {
         return ErrorInvalidOperation("generateMipmap: the six faces of this cube map have different dimensions, format, or type.");
     }
 
     tex->SetGeneratedMipmap();
 
     MakeContextCurrent();
+    
+    // bug 696495 - to work around failures in the texture-mips.html test, at least on WinXP and Mac, 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());
     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_linux.txt
+++ b/content/canvas/test/webgl/failing_tests_linux.txt
@@ -1,13 +1,12 @@
 conformance/context/premultiplyalpha-test.html
 conformance/glsl/misc/glsl-long-variable-names.html
 conformance/glsl/misc/shader-with-256-character-identifier.frag.html
 conformance/glsl/misc/shader-with-long-line.html
 conformance/misc/uninitialized-test.html
 conformance/programs/gl-get-active-attribute.html
-conformance/textures/texture-mips.html
 conformance/uniforms/gl-uniform-bool.html
 conformance/more/conformance/quickCheckAPI-S_V.html
 conformance/more/functions/uniformfArrayLen1.html
 conformance/glsl/misc/attrib-location-length-limits.html
 conformance/glsl/misc/uniform-location-length-limits.html
 conformance/renderbuffers/framebuffer-object-attachment.html