зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1045955 - Allow blitting 'internal' fb0. - r=kamidphish
This commit is contained in:
Родитель
4f8b794b06
Коммит
b2c6fe98ab
|
@ -546,7 +546,8 @@ GLBlitHelper::DeleteTexBlitProgram()
|
|||
void
|
||||
GLBlitHelper::BlitFramebufferToFramebuffer(GLuint srcFB, GLuint destFB,
|
||||
const gfx::IntSize& srcSize,
|
||||
const gfx::IntSize& destSize)
|
||||
const gfx::IntSize& destSize,
|
||||
bool internalFBs)
|
||||
{
|
||||
MOZ_ASSERT(!srcFB || mGL->fIsFramebuffer(srcFB));
|
||||
MOZ_ASSERT(!destFB || mGL->fIsFramebuffer(destFB));
|
||||
|
@ -556,8 +557,13 @@ GLBlitHelper::BlitFramebufferToFramebuffer(GLuint srcFB, GLuint destFB,
|
|||
ScopedBindFramebuffer boundFB(mGL);
|
||||
ScopedGLState scissor(mGL, LOCAL_GL_SCISSOR_TEST, false);
|
||||
|
||||
mGL->BindReadFB(srcFB);
|
||||
mGL->BindDrawFB(destFB);
|
||||
if (internalFBs) {
|
||||
mGL->Screen()->BindReadFB_Internal(srcFB);
|
||||
mGL->Screen()->BindDrawFB_Internal(destFB);
|
||||
} else {
|
||||
mGL->BindReadFB(srcFB);
|
||||
mGL->BindDrawFB(destFB);
|
||||
}
|
||||
|
||||
mGL->fBlitFramebuffer(0, 0, srcSize.width, srcSize.height,
|
||||
0, 0, destSize.width, destSize.height,
|
||||
|
@ -569,22 +575,24 @@ void
|
|||
GLBlitHelper::BlitFramebufferToFramebuffer(GLuint srcFB, GLuint destFB,
|
||||
const gfx::IntSize& srcSize,
|
||||
const gfx::IntSize& destSize,
|
||||
const GLFormats& srcFormats)
|
||||
const GLFormats& srcFormats,
|
||||
bool internalFBs)
|
||||
{
|
||||
MOZ_ASSERT(!srcFB || mGL->fIsFramebuffer(srcFB));
|
||||
MOZ_ASSERT(!destFB || mGL->fIsFramebuffer(destFB));
|
||||
|
||||
if (mGL->IsSupported(GLFeature::framebuffer_blit)) {
|
||||
BlitFramebufferToFramebuffer(srcFB, destFB,
|
||||
srcSize, destSize);
|
||||
srcSize, destSize,
|
||||
internalFBs);
|
||||
return;
|
||||
}
|
||||
|
||||
GLuint tex = CreateTextureForOffscreen(mGL, srcFormats, srcSize);
|
||||
MOZ_ASSERT(tex);
|
||||
|
||||
BlitFramebufferToTexture(srcFB, tex, srcSize, srcSize);
|
||||
BlitTextureToFramebuffer(tex, destFB, srcSize, destSize);
|
||||
BlitFramebufferToTexture(srcFB, tex, srcSize, srcSize, internalFBs);
|
||||
BlitTextureToFramebuffer(tex, destFB, srcSize, destSize, internalFBs);
|
||||
|
||||
mGL->fDeleteTextures(1, &tex);
|
||||
}
|
||||
|
@ -782,7 +790,8 @@ void
|
|||
GLBlitHelper::BlitTextureToFramebuffer(GLuint srcTex, GLuint destFB,
|
||||
const gfx::IntSize& srcSize,
|
||||
const gfx::IntSize& destSize,
|
||||
GLenum srcTarget)
|
||||
GLenum srcTarget,
|
||||
bool internalFBs)
|
||||
{
|
||||
MOZ_ASSERT(mGL->fIsTexture(srcTex));
|
||||
MOZ_ASSERT(!destFB || mGL->fIsFramebuffer(destFB));
|
||||
|
@ -792,7 +801,8 @@ GLBlitHelper::BlitTextureToFramebuffer(GLuint srcTex, GLuint destFB,
|
|||
MOZ_ASSERT(srcWrapper.IsComplete());
|
||||
|
||||
BlitFramebufferToFramebuffer(srcWrapper.FB(), destFB,
|
||||
srcSize, destSize);
|
||||
srcSize, destSize,
|
||||
internalFBs);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -812,7 +822,11 @@ GLBlitHelper::BlitTextureToFramebuffer(GLuint srcTex, GLuint destFB,
|
|||
}
|
||||
|
||||
ScopedGLDrawState autoStates(mGL);
|
||||
mGL->BindDrawFB(destFB);
|
||||
if (internalFBs) {
|
||||
mGL->Screen()->BindDrawFB_Internal(destFB);
|
||||
} else {
|
||||
mGL->BindDrawFB(destFB);
|
||||
}
|
||||
|
||||
// Does destructive things to (only!) what we just saved above.
|
||||
bool good = UseTexQuadProgram(type, srcSize);
|
||||
|
@ -829,7 +843,8 @@ void
|
|||
GLBlitHelper::BlitFramebufferToTexture(GLuint srcFB, GLuint destTex,
|
||||
const gfx::IntSize& srcSize,
|
||||
const gfx::IntSize& destSize,
|
||||
GLenum destTarget)
|
||||
GLenum destTarget,
|
||||
bool internalFBs)
|
||||
{
|
||||
MOZ_ASSERT(!srcFB || mGL->fIsFramebuffer(srcFB));
|
||||
MOZ_ASSERT(mGL->fIsTexture(destTex));
|
||||
|
@ -838,14 +853,21 @@ GLBlitHelper::BlitFramebufferToTexture(GLuint srcFB, GLuint destTex,
|
|||
ScopedFramebufferForTexture destWrapper(mGL, destTex, destTarget);
|
||||
|
||||
BlitFramebufferToFramebuffer(srcFB, destWrapper.FB(),
|
||||
srcSize, destSize);
|
||||
srcSize, destSize,
|
||||
internalFBs);
|
||||
return;
|
||||
}
|
||||
|
||||
ScopedBindTexture autoTex(mGL, destTex, destTarget);
|
||||
ScopedBindFramebuffer boundFB(mGL, srcFB);
|
||||
ScopedGLState scissor(mGL, LOCAL_GL_SCISSOR_TEST, false);
|
||||
|
||||
ScopedBindFramebuffer boundFB(mGL);
|
||||
if (internalFBs) {
|
||||
mGL->Screen()->BindReadFB_Internal(srcFB);
|
||||
} else {
|
||||
mGL->BindReadFB(srcFB);
|
||||
}
|
||||
|
||||
ScopedGLState scissor(mGL, LOCAL_GL_SCISSOR_TEST, false);
|
||||
mGL->fCopyTexSubImage2D(destTarget, 0,
|
||||
0, 0,
|
||||
0, 0,
|
||||
|
|
|
@ -153,19 +153,23 @@ public:
|
|||
// the first BlitFramebufferToFramebuffer.
|
||||
void BlitFramebufferToFramebuffer(GLuint srcFB, GLuint destFB,
|
||||
const gfx::IntSize& srcSize,
|
||||
const gfx::IntSize& destSize);
|
||||
const gfx::IntSize& destSize,
|
||||
bool internalFBs = false);
|
||||
void BlitFramebufferToFramebuffer(GLuint srcFB, GLuint destFB,
|
||||
const gfx::IntSize& srcSize,
|
||||
const gfx::IntSize& destSize,
|
||||
const GLFormats& srcFormats);
|
||||
const GLFormats& srcFormats,
|
||||
bool internalFBs = false);
|
||||
void BlitTextureToFramebuffer(GLuint srcTex, GLuint destFB,
|
||||
const gfx::IntSize& srcSize,
|
||||
const gfx::IntSize& destSize,
|
||||
GLenum srcTarget = LOCAL_GL_TEXTURE_2D);
|
||||
GLenum srcTarget = LOCAL_GL_TEXTURE_2D,
|
||||
bool internalFBs = false);
|
||||
void BlitFramebufferToTexture(GLuint srcFB, GLuint destTex,
|
||||
const gfx::IntSize& srcSize,
|
||||
const gfx::IntSize& destSize,
|
||||
GLenum destTarget = LOCAL_GL_TEXTURE_2D);
|
||||
GLenum destTarget = LOCAL_GL_TEXTURE_2D,
|
||||
bool internalFBs = false);
|
||||
void BlitTextureToTexture(GLuint srcTex, GLuint destTex,
|
||||
const gfx::IntSize& srcSize,
|
||||
const gfx::IntSize& destSize,
|
||||
|
|
Загрузка…
Ссылка в новой задаче