gecko/gfx/gl/GLBlitHelper.h

76 lines
2.6 KiB
C++

/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim: set ts=8 sts=4 et sw=4 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef GLBLITHELPER_H_
#define GLBLITHELPER_H_
#include "GLContextTypes.h"
#include "GLConsts.h"
#include "mozilla/Attributes.h"
struct nsIntSize;
namespace mozilla {
namespace gl {
class GLContext;
class GLBlitHelper MOZ_FINAL
{
// The GLContext is the sole owner of the GLBlitHelper.
GLContext* mGL;
GLuint mTexBlit_Buffer;
GLuint mTexBlit_VertShader;
GLuint mTex2DBlit_FragShader;
GLuint mTex2DRectBlit_FragShader;
GLuint mTex2DBlit_Program;
GLuint mTex2DRectBlit_Program;
bool mTexBlit_UseDrawNotCopy;
void UseBlitProgram();
void SetBlitFramebufferForDestTexture(GLuint aTexture);
bool UseTexQuadProgram(GLenum target, const nsIntSize& srcSize);
bool InitTexQuadProgram(GLenum target = LOCAL_GL_TEXTURE_2D);
void DeleteTexBlitProgram();
public:
GLBlitHelper(GLContext* gl);
~GLBlitHelper();
// If you don't have |srcFormats| for the 2nd definition,
// then you'll need the framebuffer_blit extensions to use
// the first BlitFramebufferToFramebuffer.
void BlitFramebufferToFramebuffer(GLuint srcFB, GLuint destFB,
const nsIntSize& srcSize,
const nsIntSize& destSize);
void BlitFramebufferToFramebuffer(GLuint srcFB, GLuint destFB,
const nsIntSize& srcSize,
const nsIntSize& destSize,
const GLFormats& srcFormats);
void BlitTextureToFramebuffer(GLuint srcTex, GLuint destFB,
const nsIntSize& srcSize,
const nsIntSize& destSize,
GLenum srcTarget = LOCAL_GL_TEXTURE_2D);
void BlitFramebufferToTexture(GLuint srcFB, GLuint destTex,
const nsIntSize& srcSize,
const nsIntSize& destSize,
GLenum destTarget = LOCAL_GL_TEXTURE_2D);
void BlitTextureToTexture(GLuint srcTex, GLuint destTex,
const nsIntSize& srcSize,
const nsIntSize& destSize,
GLenum srcTarget = LOCAL_GL_TEXTURE_2D,
GLenum destTarget = LOCAL_GL_TEXTURE_2D);
};
}
}
#endif // GLBLITHELPER_H_