Bug 1125709. Avoiding using MacIOSurfaceTextureSourceOGL in MacIOSurfaceTextureHostOGL. r=nical

Using GLTextureSource gives us better performance because we don't need to call
CGLTexImageIOSurface2D everytime we draw.

This will eventually let us drop MacIOSurfaceTextureSourceOGL once WebGL on OS
X is using MacIOSurfaceTextureHostOGL.

--HG--
extra : rebase_source : 95a9b0888d7ddfeae520141e7f932f8555fa58d5
This commit is contained in:
Jeff Muizelaar 2015-01-19 21:23:42 -05:00
Родитель f66a1df681
Коммит 3402e21567
2 изменённых файлов: 14 добавлений и 2 удалений

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

@ -27,7 +27,19 @@ MacIOSurfaceTextureHostOGL::Lock()
}
if (!mTextureSource) {
mTextureSource = new MacIOSurfaceTextureSourceOGL(mCompositor, mSurface);
GLuint textureHandle;
gl::GLContext* gl = mCompositor->gl();
gl->fGenTextures(1, &textureHandle);
gl->fBindTexture(LOCAL_GL_TEXTURE_RECTANGLE_ARB, textureHandle);
gl->fTexParameteri(LOCAL_GL_TEXTURE_RECTANGLE_ARB, LOCAL_GL_TEXTURE_WRAP_T, LOCAL_GL_CLAMP_TO_EDGE);
gl->fTexParameteri(LOCAL_GL_TEXTURE_RECTANGLE_ARB, LOCAL_GL_TEXTURE_WRAP_S, LOCAL_GL_CLAMP_TO_EDGE);
mSurface->CGLTexImageIOSurface2D(gl::GLContextCGL::Cast(gl)->GetCGLContext());
mTextureSource = new GLTextureSource(mCompositor, textureHandle, LOCAL_GL_TEXTURE_RECTANGLE_ARB,
gfx::IntSize(mSurface->GetDevicePixelWidth(),
mSurface->GetDevicePixelHeight()),
mSurface->HasAlpha() ? gfx::SurfaceFormat::R8G8B8A8:
gfx::SurfaceFormat::R8G8B8X8);
}
return true;
}

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

@ -94,7 +94,7 @@ public:
protected:
RefPtr<CompositorOGL> mCompositor;
RefPtr<MacIOSurfaceTextureSourceOGL> mTextureSource;
RefPtr<GLTextureSource> mTextureSource;
RefPtr<MacIOSurface> mSurface;
};