summaryrefslogtreecommitdiff
path: root/src/mbgl/gfx/context.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mbgl/gfx/context.hpp')
-rw-r--r--src/mbgl/gfx/context.hpp26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/mbgl/gfx/context.hpp b/src/mbgl/gfx/context.hpp
index 5ec73b8a41..90b62c94a4 100644
--- a/src/mbgl/gfx/context.hpp
+++ b/src/mbgl/gfx/context.hpp
@@ -5,14 +5,22 @@
#include <mbgl/gfx/index_vector.hpp>
#include <mbgl/gfx/index_buffer.hpp>
#include <mbgl/gfx/texture.hpp>
+#include <mbgl/gfx/draw_scope.hpp>
+#include <mbgl/gfx/program.hpp>
#include <mbgl/gfx/types.hpp>
namespace mbgl {
+
+class ProgramParameters;
+
namespace gfx {
class Context {
protected:
- Context() = default;
+ Context(ContextType type_) : backend(type_) {
+ }
+
+ const ContextType backend;
public:
Context(Context&&) = delete;
@@ -89,6 +97,22 @@ protected:
Size, const void* data, TexturePixelType, TextureChannelDataType) = 0;
virtual void updateTextureResource(const TextureResource&, Size, const void* data,
TexturePixelType, TextureChannelDataType) = 0;
+
+public:
+ DrawScope createDrawScope() {
+ return { createDrawScopeResource() };
+ }
+
+protected:
+ virtual std::unique_ptr<DrawScopeResource> createDrawScopeResource() = 0;
+
+public:
+ template <typename Name>
+ std::unique_ptr<Program<Name>> createProgram(const ProgramParameters&);
+
+private:
+ template <typename Backend, typename Name>
+ std::unique_ptr<Program<Name>> createProgram(const ProgramParameters&);
};
} // namespace gfx