From ec0b6df7db66405600c4609324205eb78c80fee5 Mon Sep 17 00:00:00 2001 From: Wilhelm Berg Date: Thu, 30 Aug 2018 13:26:23 +0200 Subject: down to 162 compile errors --- src/mbgl/gl/context.hpp | 88 +++++++++++++++++++++----------------------- src/mbgl/gl/vertex_array.hpp | 13 +++---- 2 files changed, 47 insertions(+), 54 deletions(-) (limited to 'src/mbgl') 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 +#include +#include #include +#include +#include #include +#include #include -#include +#include #include -#include -#include -#include -#include -#include #include -#include -#include -#include -#include +#include +#include +#include #include - +#include #include #include -#include -#include #include +#include 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> getBinaryProgram(ProgramID) const; template - VertexBuffer createVertexBuffer(VertexVector&& v, const BufferUsage usage = BufferUsage::StaticDraw) { - return VertexBuffer { - v.vertexSize(), - createVertexBuffer(v.data(), v.byteSize(), usage) - }; + VertexBuffer + createVertexBuffer(VertexVector&& v, + const BufferUsage usage = BufferUsage::StaticDraw) { + return VertexBuffer{ v.vertexSize(), + createVertexBuffer(v.data(), v.byteSize(), usage) }; } template - void updateVertexBuffer(VertexBuffer& buffer, VertexVector&& v) { + void updateVertexBuffer(VertexBuffer& buffer, + VertexVector&& v) { assert(v.vertexSize() == buffer.vertexCount); updateVertexBuffer(buffer.buffer, v.data(), v.byteSize()); } template - IndexBuffer createIndexBuffer(IndexVector&& v, const BufferUsage usage = BufferUsage::StaticDraw) { - return IndexBuffer { - v.indexSize(), - createIndexBuffer(v.data(), v.byteSize(), usage) - }; + IndexBuffer createIndexBuffer(IndexVector&& v, + const BufferUsage usage = BufferUsage::StaticDraw) { + return IndexBuffer{ v.indexSize(), + createIndexBuffer(v.data(), v.byteSize(), usage) }; } - + template void updateIndexBuffer(IndexBuffer& buffer, IndexVector&& v) { assert(v.indexSize() == buffer.indexCount); @@ -92,9 +93,8 @@ public: template Renderbuffer 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 color, - optional depth, - optional stencil); + void clear(optional color, optional depth, optional 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 program; State vertexBuffer; - State bindVertexArray { *this }; - VertexArrayState globalVertexArrayState { UniqueVertexArray(0, { this }) }; + State bindVertexArray{ *this }; + VertexArrayState globalVertexArrayState{ UniqueVertexArray(0, { const_cast(this) }) }; State pixelStorePack; State pixelStoreUnpack; @@ -243,7 +235,7 @@ public: bool supportsHalfFloatTextures = false; const uint32_t maximumVertexBindingCount; static constexpr const uint32_t minimumRequiredVertexBindingCount = 8; - + private: State stencilFunc; State 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 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 #include +#include #include #include @@ -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