From 208cb56f145ca9db2606b6b1c6beb4c5e60c3c30 Mon Sep 17 00:00:00 2001 From: Benoit Jacob Date: Thu, 19 Apr 2012 23:28:01 -0400 Subject: [PATCH] Bug 696495 - set tex min filter before generateMipmap calls, to work around driver bugs - r=jgilbert, a=akeybl --- content/canvas/src/WebGLContextGL.cpp | 14 +++++++++++++- content/canvas/test/webgl/failing_tests_mac.txt | 2 -- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/content/canvas/src/WebGLContextGL.cpp b/content/canvas/src/WebGLContextGL.cpp index 12495555f04..344ceb77379 100644 --- a/content/canvas/src/WebGLContextGL.cpp +++ b/content/canvas/src/WebGLContextGL.cpp @@ -1933,7 +1933,19 @@ WebGLContext::GenerateMipmap(WebGLenum target) 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; } diff --git a/content/canvas/test/webgl/failing_tests_mac.txt b/content/canvas/test/webgl/failing_tests_mac.txt index 40a171eaba4..34b47c326b3 100644 --- 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