summaryrefslogtreecommitdiff
path: root/src/mbgl/gl/context.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mbgl/gl/context.hpp')
-rw-r--r--src/mbgl/gl/context.hpp30
1 files changed, 29 insertions, 1 deletions
diff --git a/src/mbgl/gl/context.hpp b/src/mbgl/gl/context.hpp
index 10ff4360d3..14af299baa 100644
--- a/src/mbgl/gl/context.hpp
+++ b/src/mbgl/gl/context.hpp
@@ -30,11 +30,23 @@ class View;
namespace gl {
constexpr size_t TextureMax = 64;
+using ProcAddress = void (*)();
+
+namespace extension {
+class VertexArray;
+class Debugging;
+class ProgramBinary;
+} // namespace extension
class Context : private util::noncopyable {
public:
+ Context();
~Context();
+ void initializeExtensions(const std::function<gl::ProcAddress(const char*)>&);
+
+ void enableDebugging();
+
UniqueShader createShader(ShaderType type, const std::string& source);
UniqueProgram createProgram(ShaderID vertexShader, ShaderID fragmentShader);
UniqueProgram createProgram(BinaryProgramFormat binaryFormat, const std::string& binaryProgram);
@@ -164,11 +176,27 @@ public:
void setDirtyState();
+ extension::Debugging* getDebuggingExtension() const {
+ return debugging.get();
+ }
+
+ extension::VertexArray* getVertexArrayExtension() const {
+ return vertexArray.get();
+ }
+
+private:
+ std::unique_ptr<extension::Debugging> debugging;
+ std::unique_ptr<extension::VertexArray> vertexArray;
+#if MBGL_HAS_BINARY_PROGRAMS
+ std::unique_ptr<extension::ProgramBinary> programBinary;
+#endif
+
+public:
State<value::ActiveTexture> activeTexture;
State<value::BindFramebuffer> bindFramebuffer;
State<value::Viewport> viewport;
std::array<State<value::BindTexture>, 2> texture;
- State<value::BindVertexArray> vertexArrayObject;
+ State<value::BindVertexArray, const Context&> vertexArrayObject { *this };
State<value::Program> program;
State<value::BindVertexBuffer> vertexBuffer;
State<value::BindElementBuffer> elementBuffer;