Bug 709490 - Part 8: Copy to a temp texture when readback from IOSurface, r=jgilbert

This commit is contained in:
Morris Tseng 2015-09-29 11:51:25 +01:00
Родитель c5927f2dae
Коммит 173c50c555
1 изменённых файлов: 23 добавлений и 0 удалений

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

@ -2650,6 +2650,7 @@ GLContext::Readback(SharedSurface* src, gfx::DataSourceSurface* dest)
}
GLuint tempFB = 0;
GLuint tempTex = 0;
{
ScopedBindFramebuffer autoFB(this);
@ -2681,6 +2682,24 @@ GLContext::Readback(SharedSurface* src, gfx::DataSourceSurface* dest)
MOZ_ASSERT(status == LOCAL_GL_FRAMEBUFFER_COMPLETE);
}
if (src->NeedsIndirectReads()) {
fGenTextures(1, &tempTex);
{
ScopedBindTexture autoTex(this, tempTex);
GLenum format = src->mHasAlpha ? LOCAL_GL_RGBA
: LOCAL_GL_RGB;
auto width = src->mSize.width;
auto height = src->mSize.height;
fCopyTexImage2D(LOCAL_GL_TEXTURE_2D, 0, format, 0, 0, width,
height, 0);
}
fFramebufferTexture2D(LOCAL_GL_FRAMEBUFFER,
LOCAL_GL_COLOR_ATTACHMENT0,
LOCAL_GL_TEXTURE_2D, tempTex, 0);
}
ReadPixelsIntoDataSurface(this, dest);
src->ProducerReadRelease();
@ -2689,6 +2708,10 @@ GLContext::Readback(SharedSurface* src, gfx::DataSourceSurface* dest)
if (tempFB)
fDeleteFramebuffers(1, &tempFB);
if (tempTex) {
fDeleteTextures(1, &tempTex);
}
if (needsSwap) {
src->UnlockProd();
if (prev)