Bug 684882 - back out db67bdba5ca8

This commit is contained in:
Benoit Jacob 2011-09-29 10:13:49 -04:00
Родитель 428af685fc
Коммит 085fec0117
2 изменённых файлов: 0 добавлений и 22 удалений

Просмотреть файл

@ -1154,7 +1154,6 @@ public:
mWrapT = aWrapT;
SetDontKnowIfNeedFakeBlack();
}
WebGLenum MinFilter() const { return mMinFilter; }
bool DoesMinFilterRequireMipmap() const {

Просмотреть файл

@ -1777,28 +1777,7 @@ WebGLContext::GenerateMipmap(WebGLenum target)
tex->SetGeneratedMipmap();
MakeContextCurrent();
#ifdef XP_MACOSX
// On Mac, glGenerateMipmap on a texture whose minification filter does NOT require a mipmap at the time of the call,
// will happily grab random video memory into certain mipmap levels. See bug 684882. Also, this is Apple bug 9129398.
// Thanks to Kenneth Russell / Google for figuring this out.
// So we temporarily spoof the minification filter, call glGenerateMipmap,
// and restore it. If that turned out to not be enough, we would have to avoid calling glGenerateMipmap altogether and
// emulate it.
if (tex->DoesMinFilterRequireMipmap()) {
gl->fGenerateMipmap(target);
} else {
// spoof the min filter as something that requires a mipmap. The particular choice of a filter doesn't matter as
// we're not rendering anything here. Since LINEAR_MIPMAP_LINEAR is by far the most common use case, and we're trying
// to work around a bug triggered by "unexpected" min filters, it seems to be the safest choice.
gl->fTexParameteri(target, LOCAL_GL_TEXTURE_MIN_FILTER, LOCAL_GL_LINEAR_MIPMAP_LINEAR);
gl->fGenerateMipmap(target);
gl->fTexParameteri(target, LOCAL_GL_TEXTURE_MIN_FILTER, tex->MinFilter());
}
#else
gl->fGenerateMipmap(target);
#endif
return NS_OK;
}