Bug 822114 - Save and restore bound tex unit in DeleteTexture - r=bjacob

This commit is contained in:
Jeff Gilbert 2012-12-18 16:47:03 -08:00
parent d632f81273
commit 4b5ec843d1

View File

@ -1064,6 +1064,7 @@ WebGLContext::DeleteTexture(WebGLTexture *tex)
if (mBoundFramebuffer)
mBoundFramebuffer->DetachTexture(tex);
WebGLUint activeTexture = mActiveTexture;
for (int32_t i = 0; i < mGLMaxTextureUnits; i++) {
if ((tex->Target() == LOCAL_GL_TEXTURE_2D && mBound2DTextures[i] == tex) ||
(tex->Target() == LOCAL_GL_TEXTURE_CUBE_MAP && mBoundCubeMapTextures[i] == tex))
@ -1072,7 +1073,7 @@ WebGLContext::DeleteTexture(WebGLTexture *tex)
BindTexture(tex->Target(), static_cast<WebGLTexture*>(nullptr));
}
}
ActiveTexture(LOCAL_GL_TEXTURE0 + mActiveTexture);
ActiveTexture(LOCAL_GL_TEXTURE0 + activeTexture);
tex->RequestDelete();
}