Bug 959171 - Fix how to bind EGLImage in GrallocTextureHostOGL. r=nical

This commit is contained in:
Sotaro Ikeda 2014-01-24 08:30:41 -05:00
parent 8491906784
commit b2a19661db
2 changed files with 12 additions and 0 deletions

View File

@ -122,6 +122,10 @@ void GrallocTextureSourceOGL::BindTexture(GLenum aTextureUnit)
gl()->fActiveTexture(aTextureUnit);
gl()->fBindTexture(textureTarget, tex);
if (!mEGLImage) {
mEGLImage = EGLImageCreateFromNativeBuffer(gl(), mGraphicBuffer->getNativeBuffer());
}
gl()->fEGLImageTargetTexture2D(textureTarget, mEGLImage);
gl()->fActiveTexture(LOCAL_GL_TEXTURE0);
}
@ -173,6 +177,13 @@ GrallocTextureSourceOGL::SetCompositableBackendSpecificData(CompositableBackendS
}
if (!mNeedsReset) {
// Update binding to the EGLImage
gl()->MakeCurrent();
GLuint tex = GetGLTexture();
GLuint textureTarget = GetTextureTarget();
gl()->fActiveTexture(LOCAL_GL_TEXTURE0);
gl()->fBindTexture(textureTarget, tex);
gl()->fEGLImageTargetTexture2D(textureTarget, mEGLImage);
return;
}

View File

@ -225,6 +225,7 @@ CompositableDataGonkOGL::DeleteTextureIfPresent()
if (gl()->MakeCurrent()) {
gl()->fDeleteTextures(1, &mTexture);
}
mTexture = 0;
}
}