diff options
23 files changed, 100 insertions, 68 deletions
diff --git a/src/core-files.json b/src/core-files.json index 7b07dcde5c..1390b7607c 100644 --- a/src/core-files.json +++ b/src/core-files.json @@ -506,6 +506,7 @@ "mbgl/gfx/stencil_mode.hpp": "src/mbgl/gfx/stencil_mode.hpp", "mbgl/gfx/types.hpp": "src/mbgl/gfx/types.hpp", "mbgl/gfx/uniform.hpp": "src/mbgl/gfx/uniform.hpp", + "mbgl/gfx/vertex_buffer.hpp": "src/mbgl/gfx/vertex_buffer.hpp", "mbgl/gfx/vertex_vector.hpp": "src/mbgl/gfx/vertex_vector.hpp", "mbgl/gl/attribute.hpp": "src/mbgl/gl/attribute.hpp", "mbgl/gl/context.hpp": "src/mbgl/gl/context.hpp", diff --git a/src/mbgl/gfx/vertex_buffer.hpp b/src/mbgl/gfx/vertex_buffer.hpp new file mode 100644 index 0000000000..2ed1e62759 --- /dev/null +++ b/src/mbgl/gfx/vertex_buffer.hpp @@ -0,0 +1,25 @@ +#pragma once + +#include <memory> + +namespace mbgl { +namespace gfx { + +class VertexBufferResource { +protected: + VertexBufferResource() = default; +public: + virtual ~VertexBufferResource() = default; +}; + +// This class has a template argument that we use to specify the vertex type. It is not used by +// the implementation, but serves type checking purposes during build time. +template <class> +class VertexBuffer { +public: + std::size_t elements; + std::unique_ptr<const VertexBufferResource> resource; +}; + +} // namespace gfx +} // namespace mbgl diff --git a/src/mbgl/gl/attribute.hpp b/src/mbgl/gl/attribute.hpp index 53ba71a89f..dc112c1ad8 100644 --- a/src/mbgl/gl/attribute.hpp +++ b/src/mbgl/gl/attribute.hpp @@ -2,7 +2,7 @@ #include <mbgl/gfx/attribute.hpp> #include <mbgl/gl/types.hpp> -#include <mbgl/gl/vertex_buffer.hpp> +#include <mbgl/gfx/vertex_buffer.hpp> #include <mbgl/util/ignore.hpp> #include <mbgl/util/indexed_tuple.hpp> #include <mbgl/util/optional.hpp> @@ -22,13 +22,14 @@ class AttributeBinding { public: gfx::AttributeDescriptor attribute; uint8_t vertexStride; - BufferID vertexBuffer; + const gfx::VertexBufferResource* vertexBufferResource; uint32_t vertexOffset; - friend bool operator==(const AttributeBinding& lhs, - const AttributeBinding& rhs) { - return std::tie(lhs.attribute, lhs.vertexStride, lhs.vertexBuffer, lhs.vertexOffset) - == std::tie(rhs.attribute, rhs.vertexStride, rhs.vertexBuffer, rhs.vertexOffset); + friend bool operator==(const AttributeBinding& lhs, const AttributeBinding& rhs) { + return lhs.attribute == rhs.attribute && + lhs.vertexStride == rhs.vertexStride && + lhs.vertexBufferResource == rhs.vertexBufferResource && + lhs.vertexOffset == rhs.vertexOffset; } }; @@ -40,12 +41,12 @@ using AttributeBindingArray = std::vector<optional<AttributeBinding>>; a buffer with only one float for each vertex can be bound to a `vec2` attribute */ template <std::size_t I, typename Vertex> -AttributeBinding attributeBinding(const VertexBuffer<Vertex>& buffer) { +AttributeBinding attributeBinding(const gfx::VertexBuffer<Vertex>& buffer) { static_assert(I < gfx::VertexDescriptorOf<Vertex>::data.count, "vertex attribute index out of range"); return { gfx::VertexDescriptorOf<Vertex>::data.attributes[I], gfx::VertexDescriptorOf<Vertex>::data.stride, - buffer.buffer, + buffer.resource.get(), 0, }; } @@ -106,7 +107,7 @@ public: return result; } - static Bindings bindings(const VertexBuffer<gfx::Vertex<Types>>& buffer) { + static Bindings bindings(const gfx::VertexBuffer<gfx::Vertex<Types>>& buffer) { return Bindings { attributeBinding<TypeIndex<As, As...>::value>(buffer)... }; } diff --git a/src/mbgl/gl/context.cpp b/src/mbgl/gl/context.cpp index 6fda803a94..9904c43145 100644 --- a/src/mbgl/gl/context.cpp +++ b/src/mbgl/gl/context.cpp @@ -1,5 +1,6 @@ #include <mbgl/gl/context.hpp> #include <mbgl/gl/enum.hpp> +#include <mbgl/gl/vertex_buffer.hpp> #include <mbgl/gl/index_buffer.hpp> #include <mbgl/gl/debugging_extension.hpp> #include <mbgl/gl/vertex_array_extension.hpp> @@ -248,17 +249,18 @@ void Context::verifyProgramLinkage(ProgramID program_) { throw std::runtime_error("program failed to link"); } -UniqueBuffer Context::createVertexBuffer(const void* data, std::size_t size, const BufferUsage usage) { +std::unique_ptr<const gfx::VertexBufferResource> +Context::createVertexBuffer(const void* data, std::size_t size, const BufferUsage usage) { BufferID id = 0; MBGL_CHECK_ERROR(glGenBuffers(1, &id)); UniqueBuffer result { std::move(id), { this } }; vertexBuffer = result; MBGL_CHECK_ERROR(glBufferData(GL_ARRAY_BUFFER, size, data, static_cast<GLenum>(usage))); - return result; + return std::make_unique<gl::VertexBufferResource>(std::move(result)); } -void Context::updateVertexBuffer(UniqueBuffer& buffer, const void* data, std::size_t size) { - vertexBuffer = buffer; +void Context::updateVertexBuffer(const gfx::VertexBufferResource& resource, const void* data, std::size_t size) { + vertexBuffer = reinterpret_cast<const gl::VertexBufferResource&>(resource).buffer; MBGL_CHECK_ERROR(glBufferSubData(GL_ARRAY_BUFFER, 0, size, data)); } diff --git a/src/mbgl/gl/context.hpp b/src/mbgl/gl/context.hpp index 2fe0d788bf..4d4a538234 100644 --- a/src/mbgl/gl/context.hpp +++ b/src/mbgl/gl/context.hpp @@ -7,7 +7,7 @@ #include <mbgl/gl/texture.hpp> #include <mbgl/gl/renderbuffer.hpp> #include <mbgl/gl/framebuffer.hpp> -#include <mbgl/gl/vertex_buffer.hpp> +#include <mbgl/gfx/vertex_buffer.hpp> #include <mbgl/gfx/index_buffer.hpp> #include <mbgl/gl/vertex_array.hpp> #include <mbgl/gl/types.hpp> @@ -66,17 +66,17 @@ public: optional<std::pair<BinaryProgramFormat, std::string>> getBinaryProgram(ProgramID) const; template <class Vertex> - VertexBuffer<Vertex> createVertexBuffer(gfx::VertexVector<Vertex>&& v, const BufferUsage usage = BufferUsage::StaticDraw) { - return VertexBuffer<Vertex> { + gfx::VertexBuffer<Vertex> createVertexBuffer(gfx::VertexVector<Vertex>&& v, const BufferUsage usage = BufferUsage::StaticDraw) { + return { v.elements(), createVertexBuffer(v.data(), v.bytes(), usage) }; } template <class Vertex> - void updateVertexBuffer(VertexBuffer<Vertex>& buffer, gfx::VertexVector<Vertex>&& v) { + void updateVertexBuffer(gfx::VertexBuffer<Vertex>& buffer, gfx::VertexVector<Vertex>&& v) { assert(v.elements() == buffer.elements); - updateVertexBuffer(buffer.buffer, v.data(), v.bytes()); + updateVertexBuffer(*buffer.resource, v.data(), v.bytes()); } template <class DrawMode> @@ -274,8 +274,8 @@ private: State<value::PointSize> pointSize; #endif // MBGL_USE_GLES2 - UniqueBuffer createVertexBuffer(const void* data, std::size_t size, const BufferUsage usage); - void updateVertexBuffer(UniqueBuffer& buffer, const void* data, std::size_t size); + std::unique_ptr<const gfx::VertexBufferResource> createVertexBuffer(const void* data, std::size_t size, const BufferUsage usage); + void updateVertexBuffer(const gfx::VertexBufferResource&, const void* data, std::size_t size); std::unique_ptr<const gfx::IndexBufferResource> createIndexBuffer(const void* data, std::size_t size, const BufferUsage usage); void updateIndexBuffer(const gfx::IndexBufferResource&, const void* data, std::size_t size); UniqueTexture createTexture(Size size, const void* data, TextureFormat, TextureUnit, TextureType); diff --git a/src/mbgl/gl/program.hpp b/src/mbgl/gl/program.hpp index 6d3a4ce266..df48dfea38 100644 --- a/src/mbgl/gl/program.hpp +++ b/src/mbgl/gl/program.hpp @@ -3,7 +3,7 @@ #include <mbgl/gl/types.hpp> #include <mbgl/gl/object.hpp> #include <mbgl/gl/context.hpp> -#include <mbgl/gl/vertex_buffer.hpp> +#include <mbgl/gfx/vertex_buffer.hpp> #include <mbgl/gfx/index_buffer.hpp> #include <mbgl/gl/vertex_array.hpp> #include <mbgl/gl/attribute.hpp> diff --git a/src/mbgl/gl/value.cpp b/src/mbgl/gl/value.cpp index b290cde50c..b205f0f358 100644 --- a/src/mbgl/gl/value.cpp +++ b/src/mbgl/gl/value.cpp @@ -1,5 +1,6 @@ #include <mbgl/gl/value.hpp> #include <mbgl/gl/context.hpp> +#include <mbgl/gl/vertex_buffer.hpp> #include <mbgl/gl/vertex_array_extension.hpp> #include <mbgl/gl/enum.hpp> @@ -485,7 +486,7 @@ GLint components(const gfx::AttributeDataType type) { void VertexAttribute::Set(const optional<AttributeBinding>& binding, Context& context, AttributeLocation location) { if (binding) { - context.vertexBuffer = binding->vertexBuffer; + context.vertexBuffer = reinterpret_cast<const gl::VertexBufferResource&>(*binding->vertexBufferResource).buffer; MBGL_CHECK_ERROR(glEnableVertexAttribArray(location)); MBGL_CHECK_ERROR(glVertexAttribPointer( location, diff --git a/src/mbgl/gl/vertex_buffer.hpp b/src/mbgl/gl/vertex_buffer.hpp index 94963ce878..95e5e75d45 100644 --- a/src/mbgl/gl/vertex_buffer.hpp +++ b/src/mbgl/gl/vertex_buffer.hpp @@ -1,14 +1,16 @@ #pragma once +#include <mbgl/gfx/vertex_buffer.hpp> #include <mbgl/gl/object.hpp> namespace mbgl { namespace gl { -template <class V> -class VertexBuffer { +class VertexBufferResource : public gfx::VertexBufferResource { public: - std::size_t elements; + VertexBufferResource(UniqueBuffer&& buffer_) : buffer(std::move(buffer_)) { + } + UniqueBuffer buffer; }; diff --git a/src/mbgl/layout/symbol_projection.hpp b/src/mbgl/layout/symbol_projection.hpp index a13769dcad..03e660b474 100644 --- a/src/mbgl/layout/symbol_projection.hpp +++ b/src/mbgl/layout/symbol_projection.hpp @@ -1,7 +1,7 @@ #pragma once #include <mbgl/util/mat4.hpp> -#include <mbgl/gl/vertex_buffer.hpp> +#include <mbgl/gfx/vertex_buffer.hpp> #include <mbgl/programs/symbol_program.hpp> namespace mbgl { diff --git a/src/mbgl/programs/collision_box_program.hpp b/src/mbgl/programs/collision_box_program.hpp index ef13392323..794921271c 100644 --- a/src/mbgl/programs/collision_box_program.hpp +++ b/src/mbgl/programs/collision_box_program.hpp @@ -63,8 +63,8 @@ public: gfx::ColorMode colorMode, gfx::CullFaceMode cullFaceMode, const UniformValues& uniformValues, - const gl::VertexBuffer<gfx::Vertex<CollisionBoxLayoutAttributes>>& layoutVertexBuffer, - const gl::VertexBuffer<gfx::Vertex<CollisionBoxDynamicAttributes>>& dynamicVertexBuffer, + const gfx::VertexBuffer<gfx::Vertex<CollisionBoxLayoutAttributes>>& layoutVertexBuffer, + const gfx::VertexBuffer<gfx::Vertex<CollisionBoxDynamicAttributes>>& dynamicVertexBuffer, const gfx::IndexBuffer& indexBuffer, const SegmentVector<Attributes>& segments, const Binders& paintPropertyBinders, @@ -144,8 +144,8 @@ public: gfx::ColorMode colorMode, gfx::CullFaceMode cullFaceMode, const UniformValues& uniformValues, - const gl::VertexBuffer<gfx::Vertex<CollisionBoxLayoutAttributes>>& layoutVertexBuffer, - const gl::VertexBuffer<gfx::Vertex<CollisionBoxDynamicAttributes>>& dynamicVertexBuffer, + const gfx::VertexBuffer<gfx::Vertex<CollisionBoxLayoutAttributes>>& layoutVertexBuffer, + const gfx::VertexBuffer<gfx::Vertex<CollisionBoxDynamicAttributes>>& dynamicVertexBuffer, const gfx::IndexBuffer& indexBuffer, const SegmentVector<Attributes>& segments, const Binders& paintPropertyBinders, diff --git a/src/mbgl/programs/program.hpp b/src/mbgl/programs/program.hpp index 6c9deab89f..a5736a44cc 100644 --- a/src/mbgl/programs/program.hpp +++ b/src/mbgl/programs/program.hpp @@ -57,7 +57,7 @@ public: } static typename Attributes::Bindings computeAllAttributeBindings( - const gl::VertexBuffer<LayoutVertex>& layoutVertexBuffer, + const gfx::VertexBuffer<LayoutVertex>& layoutVertexBuffer, const Binders& paintPropertyBinders, const typename PaintProperties::PossiblyEvaluated& currentProperties) { return LayoutAttributes::bindings(layoutVertexBuffer) diff --git a/src/mbgl/programs/symbol_program.hpp b/src/mbgl/programs/symbol_program.hpp index 53c65bbecd..76c3057852 100644 --- a/src/mbgl/programs/symbol_program.hpp +++ b/src/mbgl/programs/symbol_program.hpp @@ -286,9 +286,9 @@ public: } static typename Attributes::Bindings computeAllAttributeBindings( - const gl::VertexBuffer<LayoutVertex>& layoutVertexBuffer, - const gl::VertexBuffer<gfx::Vertex<SymbolDynamicLayoutAttributes>>& dynamicLayoutVertexBuffer, - const gl::VertexBuffer<gfx::Vertex<SymbolOpacityAttributes>>& opacityVertexBuffer, + const gfx::VertexBuffer<LayoutVertex>& layoutVertexBuffer, + const gfx::VertexBuffer<gfx::Vertex<SymbolDynamicLayoutAttributes>>& dynamicLayoutVertexBuffer, + const gfx::VertexBuffer<gfx::Vertex<SymbolOpacityAttributes>>& opacityVertexBuffer, const Binders& paintPropertyBinders, const typename PaintProperties::PossiblyEvaluated& currentProperties) { assert(layoutVertexBuffer.elements == dynamicLayoutVertexBuffer.elements && diff --git a/src/mbgl/renderer/buckets/circle_bucket.hpp b/src/mbgl/renderer/buckets/circle_bucket.hpp index 9495a9650c..27fdd5339c 100644 --- a/src/mbgl/renderer/buckets/circle_bucket.hpp +++ b/src/mbgl/renderer/buckets/circle_bucket.hpp @@ -3,7 +3,7 @@ #include <mbgl/renderer/bucket.hpp> #include <mbgl/map/mode.hpp> #include <mbgl/tile/geometry_tile_data.hpp> -#include <mbgl/gl/vertex_buffer.hpp> +#include <mbgl/gfx/vertex_buffer.hpp> #include <mbgl/gfx/index_buffer.hpp> #include <mbgl/programs/segment.hpp> #include <mbgl/programs/circle_program.hpp> @@ -34,7 +34,7 @@ public: gfx::IndexVector<gfx::Triangles> triangles; SegmentVector<CircleAttributes> segments; - optional<gl::VertexBuffer<CircleLayoutVertex>> vertexBuffer; + optional<gfx::VertexBuffer<CircleLayoutVertex>> vertexBuffer; optional<gfx::IndexBuffer> indexBuffer; std::map<std::string, CircleProgram::Binders> paintPropertyBinders; diff --git a/src/mbgl/renderer/buckets/debug_bucket.hpp b/src/mbgl/renderer/buckets/debug_bucket.hpp index e30d580df4..5623e9697d 100644 --- a/src/mbgl/renderer/buckets/debug_bucket.hpp +++ b/src/mbgl/renderer/buckets/debug_bucket.hpp @@ -5,7 +5,7 @@ #include <mbgl/util/geometry.hpp> #include <mbgl/util/optional.hpp> #include <mbgl/util/noncopyable.hpp> -#include <mbgl/gl/vertex_buffer.hpp> +#include <mbgl/gfx/vertex_buffer.hpp> #include <mbgl/gfx/index_buffer.hpp> #include <mbgl/programs/debug_program.hpp> @@ -34,7 +34,7 @@ public: const MapDebugOptions debugMode; SegmentVector<DebugAttributes> segments; - optional<gl::VertexBuffer<DebugLayoutVertex>> vertexBuffer; + optional<gfx::VertexBuffer<DebugLayoutVertex>> vertexBuffer; optional<gfx::IndexBuffer> indexBuffer; }; diff --git a/src/mbgl/renderer/buckets/fill_bucket.hpp b/src/mbgl/renderer/buckets/fill_bucket.hpp index dc7180ee3d..3ff3ecc1aa 100644 --- a/src/mbgl/renderer/buckets/fill_bucket.hpp +++ b/src/mbgl/renderer/buckets/fill_bucket.hpp @@ -2,7 +2,7 @@ #include <mbgl/renderer/bucket.hpp> #include <mbgl/tile/geometry_tile_data.hpp> -#include <mbgl/gl/vertex_buffer.hpp> +#include <mbgl/gfx/vertex_buffer.hpp> #include <mbgl/gfx/index_buffer.hpp> #include <mbgl/programs/segment.hpp> #include <mbgl/programs/fill_program.hpp> @@ -46,7 +46,7 @@ public: SegmentVector<FillAttributes> lineSegments; SegmentVector<FillAttributes> triangleSegments; - optional<gl::VertexBuffer<FillLayoutVertex>> vertexBuffer; + optional<gfx::VertexBuffer<FillLayoutVertex>> vertexBuffer; optional<gfx::IndexBuffer> lineIndexBuffer; optional<gfx::IndexBuffer> triangleIndexBuffer; diff --git a/src/mbgl/renderer/buckets/fill_extrusion_bucket.hpp b/src/mbgl/renderer/buckets/fill_extrusion_bucket.hpp index 840ed70b4c..0065231b9e 100644 --- a/src/mbgl/renderer/buckets/fill_extrusion_bucket.hpp +++ b/src/mbgl/renderer/buckets/fill_extrusion_bucket.hpp @@ -2,7 +2,7 @@ #include <mbgl/renderer/bucket.hpp> #include <mbgl/tile/geometry_tile_data.hpp> -#include <mbgl/gl/vertex_buffer.hpp> +#include <mbgl/gfx/vertex_buffer.hpp> #include <mbgl/gfx/index_buffer.hpp> #include <mbgl/programs/segment.hpp> #include <mbgl/programs/fill_extrusion_program.hpp> @@ -43,7 +43,7 @@ public: gfx::IndexVector<gfx::Triangles> triangles; SegmentVector<FillExtrusionAttributes> triangleSegments; - optional<gl::VertexBuffer<FillExtrusionLayoutVertex>> vertexBuffer; + optional<gfx::VertexBuffer<FillExtrusionLayoutVertex>> vertexBuffer; optional<gfx::IndexBuffer> indexBuffer; std::unordered_map<std::string, FillExtrusionProgram::Binders> paintPropertyBinders; diff --git a/src/mbgl/renderer/buckets/heatmap_bucket.hpp b/src/mbgl/renderer/buckets/heatmap_bucket.hpp index ad0ad7b99d..7b3fdacd77 100644 --- a/src/mbgl/renderer/buckets/heatmap_bucket.hpp +++ b/src/mbgl/renderer/buckets/heatmap_bucket.hpp @@ -3,7 +3,7 @@ #include <mbgl/renderer/bucket.hpp> #include <mbgl/map/mode.hpp> #include <mbgl/tile/geometry_tile_data.hpp> -#include <mbgl/gl/vertex_buffer.hpp> +#include <mbgl/gfx/vertex_buffer.hpp> #include <mbgl/gfx/index_buffer.hpp> #include <mbgl/programs/segment.hpp> #include <mbgl/programs/heatmap_program.hpp> @@ -33,7 +33,7 @@ public: gfx::IndexVector<gfx::Triangles> triangles; SegmentVector<HeatmapAttributes> segments; - optional<gl::VertexBuffer<HeatmapLayoutVertex>> vertexBuffer; + optional<gfx::VertexBuffer<HeatmapLayoutVertex>> vertexBuffer; optional<gfx::IndexBuffer> indexBuffer; std::map<std::string, HeatmapProgram::Binders> paintPropertyBinders; diff --git a/src/mbgl/renderer/buckets/hillshade_bucket.hpp b/src/mbgl/renderer/buckets/hillshade_bucket.hpp index 89da41d174..50b05aaeef 100644 --- a/src/mbgl/renderer/buckets/hillshade_bucket.hpp +++ b/src/mbgl/renderer/buckets/hillshade_bucket.hpp @@ -2,7 +2,7 @@ #include <mbgl/gfx/index_buffer.hpp> #include <mbgl/gl/texture.hpp> -#include <mbgl/gl/vertex_buffer.hpp> +#include <mbgl/gfx/vertex_buffer.hpp> #include <mbgl/programs/hillshade_program.hpp> #include <mbgl/programs/hillshade_prepare_program.hpp> #include <mbgl/renderer/bucket.hpp> @@ -50,7 +50,7 @@ public: gfx::IndexVector<gfx::Triangles> indices; SegmentVector<HillshadeAttributes> segments; - optional<gl::VertexBuffer<HillshadeLayoutVertex>> vertexBuffer; + optional<gfx::VertexBuffer<HillshadeLayoutVertex>> vertexBuffer; optional<gfx::IndexBuffer> indexBuffer; private: DEMData demdata; diff --git a/src/mbgl/renderer/buckets/line_bucket.hpp b/src/mbgl/renderer/buckets/line_bucket.hpp index 1faf775d55..069e27bfd9 100644 --- a/src/mbgl/renderer/buckets/line_bucket.hpp +++ b/src/mbgl/renderer/buckets/line_bucket.hpp @@ -1,7 +1,7 @@ #pragma once #include <mbgl/renderer/bucket.hpp> #include <mbgl/tile/geometry_tile_data.hpp> -#include <mbgl/gl/vertex_buffer.hpp> +#include <mbgl/gfx/vertex_buffer.hpp> #include <mbgl/gfx/index_buffer.hpp> #include <mbgl/programs/segment.hpp> #include <mbgl/programs/line_program.hpp> @@ -47,7 +47,7 @@ public: gfx::IndexVector<gfx::Triangles> triangles; SegmentVector<LineAttributes> segments; - optional<gl::VertexBuffer<LineLayoutVertex>> vertexBuffer; + optional<gfx::VertexBuffer<LineLayoutVertex>> vertexBuffer; optional<gfx::IndexBuffer> indexBuffer; std::map<std::string, LineProgram::Binders> paintPropertyBinders; diff --git a/src/mbgl/renderer/buckets/raster_bucket.hpp b/src/mbgl/renderer/buckets/raster_bucket.hpp index 510dbf1f8f..ea48a0c235 100644 --- a/src/mbgl/renderer/buckets/raster_bucket.hpp +++ b/src/mbgl/renderer/buckets/raster_bucket.hpp @@ -2,7 +2,7 @@ #include <mbgl/gfx/index_buffer.hpp> #include <mbgl/gl/texture.hpp> -#include <mbgl/gl/vertex_buffer.hpp> +#include <mbgl/gfx/vertex_buffer.hpp> #include <mbgl/programs/raster_program.hpp> #include <mbgl/renderer/bucket.hpp> #include <mbgl/renderer/tile_mask.hpp> @@ -36,7 +36,7 @@ public: gfx::IndexVector<gfx::Triangles> indices; SegmentVector<RasterAttributes> segments; - optional<gl::VertexBuffer<RasterLayoutVertex>> vertexBuffer; + optional<gfx::VertexBuffer<RasterLayoutVertex>> vertexBuffer; optional<gfx::IndexBuffer> indexBuffer; }; diff --git a/src/mbgl/renderer/buckets/symbol_bucket.hpp b/src/mbgl/renderer/buckets/symbol_bucket.hpp index c28a2cbc95..67662927ba 100644 --- a/src/mbgl/renderer/buckets/symbol_bucket.hpp +++ b/src/mbgl/renderer/buckets/symbol_bucket.hpp @@ -2,7 +2,7 @@ #include <mbgl/renderer/bucket.hpp> #include <mbgl/map/mode.hpp> -#include <mbgl/gl/vertex_buffer.hpp> +#include <mbgl/gfx/vertex_buffer.hpp> #include <mbgl/gfx/index_buffer.hpp> #include <mbgl/programs/segment.hpp> #include <mbgl/programs/symbol_program.hpp> @@ -95,9 +95,9 @@ public: SegmentVector<SymbolTextAttributes> segments; std::vector<PlacedSymbol> placedSymbols; - optional<gl::VertexBuffer<SymbolLayoutVertex>> vertexBuffer; - optional<gl::VertexBuffer<gfx::Vertex<SymbolDynamicLayoutAttributes>>> dynamicVertexBuffer; - optional<gl::VertexBuffer<gfx::Vertex<SymbolOpacityAttributes>>> opacityVertexBuffer; + optional<gfx::VertexBuffer<SymbolLayoutVertex>> vertexBuffer; + optional<gfx::VertexBuffer<gfx::Vertex<SymbolDynamicLayoutAttributes>>> dynamicVertexBuffer; + optional<gfx::VertexBuffer<gfx::Vertex<SymbolOpacityAttributes>>> opacityVertexBuffer; optional<gfx::IndexBuffer> indexBuffer; } text; @@ -112,9 +112,9 @@ public: std::vector<PlacedSymbol> placedSymbols; PremultipliedImage atlasImage; - optional<gl::VertexBuffer<SymbolLayoutVertex>> vertexBuffer; - optional<gl::VertexBuffer<gfx::Vertex<SymbolDynamicLayoutAttributes>>> dynamicVertexBuffer; - optional<gl::VertexBuffer<gfx::Vertex<SymbolOpacityAttributes>>> opacityVertexBuffer; + optional<gfx::VertexBuffer<SymbolLayoutVertex>> vertexBuffer; + optional<gfx::VertexBuffer<gfx::Vertex<SymbolDynamicLayoutAttributes>>> dynamicVertexBuffer; + optional<gfx::VertexBuffer<gfx::Vertex<SymbolOpacityAttributes>>> opacityVertexBuffer; optional<gfx::IndexBuffer> indexBuffer; } icon; @@ -123,8 +123,8 @@ public: gfx::VertexVector<gfx::Vertex<CollisionBoxDynamicAttributes>> dynamicVertices; SegmentVector<CollisionBoxProgram::Attributes> segments; - optional<gl::VertexBuffer<gfx::Vertex<CollisionBoxLayoutAttributes>>> vertexBuffer; - optional<gl::VertexBuffer<gfx::Vertex<CollisionBoxDynamicAttributes>>> dynamicVertexBuffer; + optional<gfx::VertexBuffer<gfx::Vertex<CollisionBoxLayoutAttributes>>> vertexBuffer; + optional<gfx::VertexBuffer<gfx::Vertex<CollisionBoxDynamicAttributes>>> dynamicVertexBuffer; }; struct CollisionBoxBuffer : public CollisionBuffer { diff --git a/src/mbgl/renderer/paint_property_binder.hpp b/src/mbgl/renderer/paint_property_binder.hpp index cb4c3b5519..da317f93e8 100644 --- a/src/mbgl/renderer/paint_property_binder.hpp +++ b/src/mbgl/renderer/paint_property_binder.hpp @@ -223,7 +223,7 @@ private: style::PropertyExpression<T> expression; T defaultValue; gfx::VertexVector<BaseVertex> vertexVector; - optional<gl::VertexBuffer<BaseVertex>> vertexBuffer; + optional<gfx::VertexBuffer<BaseVertex>> vertexBuffer; }; template <class T, class A> @@ -288,7 +288,7 @@ private: T defaultValue; Range<float> zoomRange; gfx::VertexVector<Vertex> vertexVector; - optional<gl::VertexBuffer<Vertex>> vertexBuffer; + optional<gfx::VertexBuffer<Vertex>> vertexBuffer; }; template <class T, class A1, class A2> @@ -377,9 +377,9 @@ private: gfx::VertexVector<Vertex> patternToVertexVector; gfx::VertexVector<Vertex2> zoomInVertexVector; gfx::VertexVector<Vertex2> zoomOutVertexVector; - optional<gl::VertexBuffer<Vertex>> patternToVertexBuffer; - optional<gl::VertexBuffer<Vertex2>> zoomInVertexBuffer; - optional<gl::VertexBuffer<Vertex2>> zoomOutVertexBuffer; + optional<gfx::VertexBuffer<Vertex>> patternToVertexBuffer; + optional<gfx::VertexBuffer<Vertex2>> zoomInVertexBuffer; + optional<gfx::VertexBuffer<Vertex2>> zoomOutVertexBuffer; CrossfadeParameters crossfade; }; diff --git a/src/mbgl/renderer/render_static_data.hpp b/src/mbgl/renderer/render_static_data.hpp index 3d4f3e7dbe..da887dff22 100644 --- a/src/mbgl/renderer/render_static_data.hpp +++ b/src/mbgl/renderer/render_static_data.hpp @@ -1,6 +1,6 @@ #pragma once -#include <mbgl/gl/vertex_buffer.hpp> +#include <mbgl/gfx/vertex_buffer.hpp> #include <mbgl/gfx/index_buffer.hpp> #include <mbgl/programs/background_program.hpp> #include <mbgl/programs/extrusion_texture_program.hpp> @@ -16,9 +16,9 @@ class RenderStaticData { public: RenderStaticData(gl::Context&, float pixelRatio, const optional<std::string>& programCacheDir); - gl::VertexBuffer<gfx::Vertex<PositionOnlyLayoutAttributes>> tileVertexBuffer; - gl::VertexBuffer<RasterLayoutVertex> rasterVertexBuffer; - gl::VertexBuffer<ExtrusionTextureLayoutVertex> extrusionTextureVertexBuffer; + gfx::VertexBuffer<gfx::Vertex<PositionOnlyLayoutAttributes>> tileVertexBuffer; + gfx::VertexBuffer<RasterLayoutVertex> rasterVertexBuffer; + gfx::VertexBuffer<ExtrusionTextureLayoutVertex> extrusionTextureVertexBuffer; gfx::IndexBuffer quadTriangleIndexBuffer; gfx::IndexBuffer tileBorderIndexBuffer; |