summaryrefslogtreecommitdiff
path: root/src/mbgl/gfx/context.hpp
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2019-03-15 20:31:12 +0100
committerGitHub <noreply@github.com>2019-03-15 20:31:12 +0100
commitc8cfdb1ced822711e772dfcc8f708b1a7a68b5fc (patch)
treebf511253e25459cafc91a5f3bea2f5c773677162 /src/mbgl/gfx/context.hpp
parent62695c56956add5560933137a479f29f2d3a091b (diff)
downloadqtlocation-mapboxgl-c8cfdb1ced822711e772dfcc8f708b1a7a68b5fc.tar.gz
Merge pull request #14126 from mapbox/gfx-refactor-4
Graphics refactor #4
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