diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2019-03-15 20:31:12 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-15 20:31:12 +0100 |
commit | c8cfdb1ced822711e772dfcc8f708b1a7a68b5fc (patch) | |
tree | bf511253e25459cafc91a5f3bea2f5c773677162 /src/mbgl/gfx/context.hpp | |
parent | 62695c56956add5560933137a479f29f2d3a091b (diff) | |
download | qtlocation-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.hpp | 26 |
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 |