зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1444432 - Create Compositor::BlitRenderTarget and implement it for CompositorOGL. r=jrmuizel
MozReview-Commit-ID: Jz3bawvz1pv --HG-- extra : rebase_source : 1b3e332aa2a312f6acc77b057bc466afc813990e
This commit is contained in:
Родитель
0e1a4b9b8c
Коммит
072ffa8136
|
@ -1158,7 +1158,8 @@ GLBlitHelper::DrawBlitTextureToFramebuffer(const GLuint srcTex,
|
|||
|
||||
void
|
||||
GLBlitHelper::BlitFramebuffer(const gfx::IntSize& srcSize,
|
||||
const gfx::IntSize& destSize) const
|
||||
const gfx::IntSize& destSize,
|
||||
GLuint filter) const
|
||||
{
|
||||
MOZ_ASSERT(mGL->IsSupported(GLFeature::framebuffer_blit));
|
||||
|
||||
|
@ -1166,7 +1167,7 @@ GLBlitHelper::BlitFramebuffer(const gfx::IntSize& srcSize,
|
|||
mGL->fBlitFramebuffer(0, 0, srcSize.width, srcSize.height,
|
||||
0, 0, destSize.width, destSize.height,
|
||||
LOCAL_GL_COLOR_BUFFER_BIT,
|
||||
LOCAL_GL_NEAREST);
|
||||
filter);
|
||||
}
|
||||
|
||||
// --
|
||||
|
@ -1174,7 +1175,8 @@ GLBlitHelper::BlitFramebuffer(const gfx::IntSize& srcSize,
|
|||
void
|
||||
GLBlitHelper::BlitFramebufferToFramebuffer(const GLuint srcFB, const GLuint destFB,
|
||||
const gfx::IntSize& srcSize,
|
||||
const gfx::IntSize& destSize) const
|
||||
const gfx::IntSize& destSize,
|
||||
GLuint filter) const
|
||||
{
|
||||
MOZ_ASSERT(mGL->IsSupported(GLFeature::framebuffer_blit));
|
||||
MOZ_ASSERT(!srcFB || mGL->fIsFramebuffer(srcFB));
|
||||
|
@ -1184,7 +1186,7 @@ GLBlitHelper::BlitFramebufferToFramebuffer(const GLuint srcFB, const GLuint dest
|
|||
mGL->fBindFramebuffer(LOCAL_GL_READ_FRAMEBUFFER, srcFB);
|
||||
mGL->fBindFramebuffer(LOCAL_GL_DRAW_FRAMEBUFFER, destFB);
|
||||
|
||||
BlitFramebuffer(srcSize, destSize);
|
||||
BlitFramebuffer(srcSize, destSize, filter);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -163,10 +163,12 @@ public:
|
|||
~GLBlitHelper();
|
||||
|
||||
void BlitFramebuffer(const gfx::IntSize& srcSize,
|
||||
const gfx::IntSize& destSize) const;
|
||||
const gfx::IntSize& destSize,
|
||||
GLuint filter = LOCAL_GL_NEAREST) const;
|
||||
void BlitFramebufferToFramebuffer(GLuint srcFB, GLuint destFB,
|
||||
const gfx::IntSize& srcSize,
|
||||
const gfx::IntSize& destSize) const;
|
||||
const gfx::IntSize& destSize,
|
||||
GLuint filter = LOCAL_GL_NEAREST) const;
|
||||
void BlitFramebufferToTexture(GLuint destTex, const gfx::IntSize& srcSize,
|
||||
const gfx::IntSize& destSize,
|
||||
GLenum destTarget = LOCAL_GL_TEXTURE_2D) const;
|
||||
|
|
|
@ -280,6 +280,16 @@ public:
|
|||
virtual already_AddRefed<AsyncReadbackBuffer>
|
||||
CreateAsyncReadbackBuffer(const gfx::IntSize& aSize) { return nullptr; }
|
||||
|
||||
/**
|
||||
* Draw a part of aSource into the current render target.
|
||||
* Scaling is done with linear filtering.
|
||||
* Returns whether the operation was successful.
|
||||
*/
|
||||
virtual bool
|
||||
BlitRenderTarget(CompositingRenderTarget* aSource,
|
||||
const gfx::IntSize& aSourceSize,
|
||||
const gfx::IntSize& aDestSize) { return false; }
|
||||
|
||||
/**
|
||||
* Sets the given surface as the target for subsequent calls to DrawQuad.
|
||||
* Passing null as aSurface sets the screen as the target.
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#include "GLReadTexImageHelper.h"
|
||||
#include "GLBlitTextureImageHelper.h"
|
||||
#include "HeapCopyOfStackArray.h"
|
||||
#include "GLBlitHelper.h"
|
||||
#include "mozilla/gfx/Swizzle.h"
|
||||
|
||||
#if MOZ_WIDGET_ANDROID
|
||||
|
@ -711,6 +712,24 @@ CompositorOGL::ReadbackRenderTarget(CompositingRenderTarget* aSource,
|
|||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
CompositorOGL::BlitRenderTarget(CompositingRenderTarget* aSource,
|
||||
const gfx::IntSize& aSourceSize,
|
||||
const gfx::IntSize& aDestSize)
|
||||
{
|
||||
if (!mGLContext->IsSupported(GLFeature::framebuffer_blit)) {
|
||||
return false;
|
||||
}
|
||||
CompositingRenderTargetOGL* source =
|
||||
static_cast<CompositingRenderTargetOGL*>(aSource);
|
||||
GLuint srcFBO = source->GetFBO();
|
||||
GLuint destFBO = mCurrentRenderTarget->GetFBO();
|
||||
mGLContext->BlitHelper()->
|
||||
BlitFramebufferToFramebuffer(srcFBO, destFBO, aSourceSize, aDestSize,
|
||||
LOCAL_GL_LINEAR);
|
||||
return true;
|
||||
}
|
||||
|
||||
static GLenum
|
||||
GetFrameBufferInternalFormat(GLContext* gl,
|
||||
GLuint aFrameBuffer,
|
||||
|
|
|
@ -165,6 +165,11 @@ public:
|
|||
virtual already_AddRefed<AsyncReadbackBuffer>
|
||||
CreateAsyncReadbackBuffer(const gfx::IntSize& aSize) override;
|
||||
|
||||
virtual bool
|
||||
BlitRenderTarget(CompositingRenderTarget* aSource,
|
||||
const gfx::IntSize& aSourceSize,
|
||||
const gfx::IntSize& aDestSize) override;
|
||||
|
||||
virtual void DrawQuad(const gfx::Rect& aRect,
|
||||
const gfx::IntRect& aClipRect,
|
||||
const EffectChain &aEffectChain,
|
||||
|
|
Загрузка…
Ссылка в новой задаче