2013-04-17 01:35:57 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
* 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 MOZILLA_GFX_GLMANAGER_H
|
|
|
|
#define MOZILLA_GFX_GLMANAGER_H
|
|
|
|
|
2013-08-12 03:17:23 +04:00
|
|
|
#include "mozilla/gfx/Types.h" // for SurfaceFormat
|
2013-11-27 02:15:17 +04:00
|
|
|
#include "OGLShaderProgram.h"
|
2013-04-17 01:35:57 +04:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace gl {
|
|
|
|
class GLContext;
|
|
|
|
}
|
2013-08-12 03:17:23 +04:00
|
|
|
|
2013-04-17 01:35:57 +04:00
|
|
|
namespace layers {
|
|
|
|
|
2013-12-09 05:40:59 +04:00
|
|
|
class LayerManagerComposite;
|
2013-08-12 03:17:23 +04:00
|
|
|
|
2013-04-17 01:35:57 +04:00
|
|
|
/**
|
|
|
|
* Minimal interface to allow widgets to draw using OpenGL. Abstracts
|
2013-11-27 02:15:17 +04:00
|
|
|
* CompositorOGL. Call CreateGLManager with a LayerManagerComposite
|
|
|
|
* backed by a CompositorOGL.
|
2013-04-17 01:35:57 +04:00
|
|
|
*/
|
|
|
|
class GLManager
|
|
|
|
{
|
|
|
|
public:
|
2013-12-09 05:40:59 +04:00
|
|
|
static GLManager* CreateGLManager(LayerManagerComposite* aManager);
|
2013-04-17 01:35:57 +04:00
|
|
|
|
|
|
|
virtual ~GLManager() {}
|
|
|
|
|
|
|
|
virtual gl::GLContext* gl() const = 0;
|
2013-11-01 19:51:32 +04:00
|
|
|
virtual ShaderProgramOGL* GetProgram(ShaderProgramType aType) = 0;
|
2013-04-17 01:35:57 +04:00
|
|
|
virtual void BindAndDrawQuad(ShaderProgramOGL *aProg) = 0;
|
2013-11-01 19:51:32 +04:00
|
|
|
|
|
|
|
ShaderProgramOGL* GetProgram(gfx::SurfaceFormat aFormat) {
|
|
|
|
return GetProgram(ShaderProgramFromSurfaceFormat(aFormat));
|
|
|
|
}
|
2013-04-17 01:35:57 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|