Bug 860466: Properly deal with SharedTextureHostOGL. r=nical
There were a number of issues with the current implementation. It couldn't deal with NULL mSharedHandles. Additionally it was binding things to the wrong samplers. Finally it was not properly setting the texture transform (which defaults to all 0). Finally in a debug build an assert would be hit upon client shutdown due to it not clearing mDescriptor. This patch fixes all of those issues which makes flash work again.
This commit is contained in:
@@ -51,20 +51,19 @@ CreateTextureHostOGL(SurfaceDescriptorType aDescriptorType,
|
||||
}
|
||||
|
||||
static void
|
||||
MakeTextureIfNeeded(gl::GLContext* gl, GLenum aTarget, GLuint& aTexture)
|
||||
MakeTextureIfNeeded(gl::GLContext* gl, GLuint& aTexture)
|
||||
{
|
||||
if (aTexture != 0)
|
||||
return;
|
||||
|
||||
gl->fGenTextures(1, &aTexture);
|
||||
|
||||
gl->fActiveTexture(LOCAL_GL_TEXTURE0);
|
||||
gl->fBindTexture(aTarget, aTexture);
|
||||
gl->fBindTexture(LOCAL_GL_TEXTURE_2D, aTexture);
|
||||
|
||||
gl->fTexParameteri(aTarget, LOCAL_GL_TEXTURE_MIN_FILTER, LOCAL_GL_LINEAR);
|
||||
gl->fTexParameteri(aTarget, LOCAL_GL_TEXTURE_MAG_FILTER, LOCAL_GL_LINEAR);
|
||||
gl->fTexParameteri(aTarget, LOCAL_GL_TEXTURE_WRAP_S, LOCAL_GL_CLAMP_TO_EDGE);
|
||||
gl->fTexParameteri(aTarget, LOCAL_GL_TEXTURE_WRAP_T, LOCAL_GL_CLAMP_TO_EDGE);
|
||||
gl->fTexParameteri(LOCAL_GL_TEXTURE_2D, LOCAL_GL_TEXTURE_MIN_FILTER, LOCAL_GL_LINEAR);
|
||||
gl->fTexParameteri(LOCAL_GL_TEXTURE_2D, LOCAL_GL_TEXTURE_MAG_FILTER, LOCAL_GL_LINEAR);
|
||||
gl->fTexParameteri(LOCAL_GL_TEXTURE_2D, LOCAL_GL_TEXTURE_WRAP_S, LOCAL_GL_CLAMP_TO_EDGE);
|
||||
gl->fTexParameteri(LOCAL_GL_TEXTURE_2D, LOCAL_GL_TEXTURE_WRAP_T, LOCAL_GL_CLAMP_TO_EDGE);
|
||||
}
|
||||
|
||||
static gl::TextureImage::Flags
|
||||
@@ -251,21 +250,27 @@ SharedTextureHostOGL::SwapTexturesImpl(const SurfaceDescriptor& aImage,
|
||||
if (texture.inverted()) {
|
||||
mFlags |= NeedsYFlip;
|
||||
}
|
||||
|
||||
if (mSharedHandle && mSharedHandle != newHandle) {
|
||||
mGL->ReleaseSharedHandle(mShareType, mSharedHandle);
|
||||
}
|
||||
|
||||
mShareType = texture.shareType();
|
||||
mSharedHandle = newHandle;
|
||||
|
||||
GLContext::SharedHandleDetails handleDetails;
|
||||
if (mGL->GetSharedHandleDetails(mShareType, mSharedHandle, handleDetails)) {
|
||||
if (mSharedHandle && mGL->GetSharedHandleDetails(mShareType, mSharedHandle, handleDetails)) {
|
||||
mTextureTarget = handleDetails.mTarget;
|
||||
mShaderProgram = handleDetails.mProgramType;
|
||||
mFormat = FormatFromShaderType(mShaderProgram);
|
||||
mTextureTransform = handleDetails.mTextureTransform;
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
SharedTextureHostOGL::Lock()
|
||||
{
|
||||
MakeTextureIfNeeded(mGL, mTextureTarget, mTextureHandle);
|
||||
MakeTextureIfNeeded(mGL, mTextureHandle);
|
||||
|
||||
mGL->fActiveTexture(LOCAL_GL_TEXTURE0);
|
||||
mGL->fBindTexture(mTextureTarget, mTextureHandle);
|
||||
|
||||
Reference in New Issue
Block a user