summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilhelm Berg <wb@BergWerk-GIS.at>2018-08-30 13:26:23 +0200
committerWilhelm Berg <wb@BergWerk-GIS.at>2018-08-30 13:26:23 +0200
commit4f66a2a61a515d478ac20a8b7b7957210a7535c5 (patch)
tree00e9236f427e9adaaa949ca8eb2061fb17cc4379
parent3300fc1eeca8e778c6af01fe0f641e5978ad4c77 (diff)
downloadqtlocation-mapboxgl-4f66a2a61a515d478ac20a8b7b7957210a7535c5.tar.gz
down to 162 compile errors
-rw-r--r--src/mbgl/gl/context.hpp88
-rw-r--r--src/mbgl/gl/vertex_array.hpp13
2 files changed, 47 insertions, 54 deletions
diff --git a/src/mbgl/gl/context.hpp b/src/mbgl/gl/context.hpp
index c8181d7e80..f53690f42a 100644
--- a/src/mbgl/gl/context.hpp
+++ b/src/mbgl/gl/context.hpp
@@ -1,28 +1,27 @@
#pragma once
+#include <mbgl/gl/color_mode.hpp>
+#include <mbgl/gl/depth_mode.hpp>
+#include <mbgl/gl/draw_mode.hpp>
#include <mbgl/gl/features.hpp>
+#include <mbgl/gl/framebuffer.hpp>
+#include <mbgl/gl/index_buffer.hpp>
#include <mbgl/gl/object.hpp>
+#include <mbgl/gl/renderbuffer.hpp>
#include <mbgl/gl/state.hpp>
-#include <mbgl/gl/value.hpp>
+#include <mbgl/gl/stencil_mode.hpp>
#include <mbgl/gl/texture.hpp>
-#include <mbgl/gl/renderbuffer.hpp>
-#include <mbgl/gl/framebuffer.hpp>
-#include <mbgl/gl/vertex_buffer.hpp>
-#include <mbgl/gl/index_buffer.hpp>
-#include <mbgl/gl/vertex_array.hpp>
#include <mbgl/gl/types.hpp>
-#include <mbgl/gl/draw_mode.hpp>
-#include <mbgl/gl/depth_mode.hpp>
-#include <mbgl/gl/stencil_mode.hpp>
-#include <mbgl/gl/color_mode.hpp>
+#include <mbgl/gl/value.hpp>
+#include <mbgl/gl/vertex_array.hpp>
+#include <mbgl/gl/vertex_buffer.hpp>
#include <mbgl/util/noncopyable.hpp>
-
+#include <array>
#include <functional>
#include <memory>
-#include <vector>
-#include <array>
#include <string>
+#include <vector>
namespace mbgl {
namespace gl {
@@ -58,32 +57,34 @@ public:
#if MBGL_HAS_BINARY_PROGRAMS
bool supportsProgramBinaries() const;
#else
- constexpr bool supportsProgramBinaries() const { return false; }
+ constexpr bool supportsProgramBinaries() const {
+ return false;
+ }
#endif
optional<std::pair<BinaryProgramFormat, std::string>> getBinaryProgram(ProgramID) const;
template <class Vertex, class DrawMode>
- VertexBuffer<Vertex, DrawMode> createVertexBuffer(VertexVector<Vertex, DrawMode>&& v, const BufferUsage usage = BufferUsage::StaticDraw) {
- return VertexBuffer<Vertex, DrawMode> {
- v.vertexSize(),
- createVertexBuffer(v.data(), v.byteSize(), usage)
- };
+ VertexBuffer<Vertex, DrawMode>
+ createVertexBuffer(VertexVector<Vertex, DrawMode>&& v,
+ const BufferUsage usage = BufferUsage::StaticDraw) {
+ return VertexBuffer<Vertex, DrawMode>{ v.vertexSize(),
+ createVertexBuffer(v.data(), v.byteSize(), usage) };
}
template <class Vertex, class DrawMode>
- void updateVertexBuffer(VertexBuffer<Vertex, DrawMode>& buffer, VertexVector<Vertex, DrawMode>&& v) {
+ void updateVertexBuffer(VertexBuffer<Vertex, DrawMode>& buffer,
+ VertexVector<Vertex, DrawMode>&& v) {
assert(v.vertexSize() == buffer.vertexCount);
updateVertexBuffer(buffer.buffer, v.data(), v.byteSize());
}
template <class DrawMode>
- IndexBuffer<DrawMode> createIndexBuffer(IndexVector<DrawMode>&& v, const BufferUsage usage = BufferUsage::StaticDraw) {
- return IndexBuffer<DrawMode> {
- v.indexSize(),
- createIndexBuffer(v.data(), v.byteSize(), usage)
- };
+ IndexBuffer<DrawMode> createIndexBuffer(IndexVector<DrawMode>&& v,
+ const BufferUsage usage = BufferUsage::StaticDraw) {
+ return IndexBuffer<DrawMode>{ v.indexSize(),
+ createIndexBuffer(v.data(), v.byteSize(), usage) };
}
-
+
template <class DrawMode>
void updateIndexBuffer(IndexBuffer<DrawMode>& buffer, IndexVector<DrawMode>&& v) {
assert(v.indexSize() == buffer.indexCount);
@@ -92,9 +93,8 @@ public:
template <RenderbufferType type>
Renderbuffer<type> createRenderbuffer(const Size size) {
- static_assert(type == RenderbufferType::RGBA ||
- type == RenderbufferType::DepthStencil ||
- type == RenderbufferType::DepthComponent,
+ static_assert(type == RenderbufferType::RGBA || type == RenderbufferType::DepthStencil ||
+ type == RenderbufferType::DepthComponent,
"invalid renderbuffer type");
return { size, createRenderbuffer(type, size) };
}
@@ -159,9 +159,7 @@ public:
TextureWrap wrapX = TextureWrap::Clamp,
TextureWrap wrapY = TextureWrap::Clamp);
- void clear(optional<mbgl::Color> color,
- optional<float> depth,
- optional<int32_t> stencil);
+ void clear(optional<mbgl::Color> color, optional<float> depth, optional<int32_t> stencil);
void setDrawMode(const Points&);
void setDrawMode(const Lines&);
@@ -173,9 +171,7 @@ public:
void setStencilMode(const StencilMode&);
void setColorMode(const ColorMode&);
- void draw(PrimitiveType,
- std::size_t indexOffset,
- std::size_t indexLength);
+ void draw(PrimitiveType, std::size_t indexOffset, std::size_t indexLength);
// Actually remove the objects we marked as abandoned with the above methods.
// Only call this while the OpenGL context is exclusive to this thread.
@@ -186,13 +182,9 @@ public:
void reset();
bool empty() const {
- return pooledTextures.empty()
- && abandonedPrograms.empty()
- && abandonedShaders.empty()
- && abandonedBuffers.empty()
- && abandonedTextures.empty()
- && abandonedVertexArrays.empty()
- && abandonedFramebuffers.empty();
+ return pooledTextures.empty() && abandonedPrograms.empty() && abandonedShaders.empty() &&
+ abandonedBuffers.empty() && abandonedTextures.empty() &&
+ abandonedVertexArrays.empty() && abandonedFramebuffers.empty();
}
void setDirtyState();
@@ -227,8 +219,8 @@ public:
State<value::Program> program;
State<value::BindVertexBuffer> vertexBuffer;
- State<value::BindVertexArray, const Context&> bindVertexArray { *this };
- VertexArrayState globalVertexArrayState { UniqueVertexArray(0, { this }) };
+ State<value::BindVertexArray, const Context&> bindVertexArray{ *this };
+ VertexArrayState globalVertexArrayState{ UniqueVertexArray(0, { const_cast<Context*>(this) }) };
State<value::PixelStorePack> pixelStorePack;
State<value::PixelStoreUnpack> pixelStoreUnpack;
@@ -243,7 +235,7 @@ public:
bool supportsHalfFloatTextures = false;
const uint32_t maximumVertexBindingCount;
static constexpr const uint32_t minimumRequiredVertexBindingCount = 8;
-
+
private:
State<value::StencilFunc> stencilFunc;
State<value::StencilMask> stencilMask;
@@ -271,8 +263,10 @@ private:
void updateVertexBuffer(UniqueBuffer& buffer, const void* data, std::size_t size);
UniqueBuffer createIndexBuffer(const void* data, std::size_t size, const BufferUsage usage);
void updateIndexBuffer(UniqueBuffer& buffer, const void* data, std::size_t size);
- UniqueTexture createTexture(Size size, const void* data, TextureFormat, TextureUnit, TextureType);
- void updateTexture(TextureID, Size size, const void* data, TextureFormat, TextureUnit, TextureType);
+ UniqueTexture
+ createTexture(Size size, const void* data, TextureFormat, TextureUnit, TextureType);
+ void
+ updateTexture(TextureID, Size size, const void* data, TextureFormat, TextureUnit, TextureType);
UniqueFramebuffer createFramebuffer();
UniqueRenderbuffer createRenderbuffer(RenderbufferType, Size size);
std::unique_ptr<uint8_t[]> readFramebuffer(Size, TextureFormat, bool flip);
diff --git a/src/mbgl/gl/vertex_array.hpp b/src/mbgl/gl/vertex_array.hpp
index 604754f672..e64174e1a5 100644
--- a/src/mbgl/gl/vertex_array.hpp
+++ b/src/mbgl/gl/vertex_array.hpp
@@ -1,7 +1,7 @@
#pragma once
-#include <mbgl/gl/object.hpp>
#include <mbgl/gl/attribute.hpp>
+#include <mbgl/gl/object.hpp>
#include <mbgl/gl/state.hpp>
#include <mbgl/gl/value.hpp>
@@ -15,8 +15,7 @@ class Context;
class VertexArrayState {
public:
- VertexArrayState(UniqueVertexArray vertexArray_)
- : vertexArray(std::move(vertexArray_)) {
+ VertexArrayState(UniqueVertexArray vertexArray_) : vertexArray(std::move(vertexArray_)) {
}
void setDirty() {
@@ -35,8 +34,8 @@ public:
class VertexArrayStateDeleter {
public:
- VertexArrayStateDeleter(bool destroy_)
- : destroy(destroy_) {}
+ VertexArrayStateDeleter(bool destroy_) : destroy(destroy_) {
+ }
void operator()(VertexArrayState* ptr) const {
if (destroy) {
@@ -52,9 +51,9 @@ using UniqueVertexArrayState = std::unique_ptr<VertexArrayState, VertexArrayStat
class VertexArray {
public:
- VertexArray(UniqueVertexArrayState state_)
- : state(std::move(state_)) {
+ VertexArray(UniqueVertexArrayState state_) : state(std::move(state_)) {
}
+ VertexArray(VertexArray&& other) = default;
void bind(Context&, BufferID indexBuffer, const AttributeBindingArray&);