diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2016-09-29 11:45:28 +0200 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2016-09-29 10:17:47 -0700 |
commit | d1a84d9b51a7145f9f7665805cf71050aac7bc63 (patch) | |
tree | 057b048f24e022a2c391a1ecf736c4c9a3f10943 /src/mbgl/gl | |
parent | 2b05776f978c7759824bce1c4fc89d67cc00d332 (diff) | |
download | qtlocation-mapboxgl-d1a84d9b51a7145f9f7665805cf71050aac7bc63.tar.gz |
[core] rename VAO => VertexArray, FBO => Framebuffer
Diffstat (limited to 'src/mbgl/gl')
-rw-r--r-- | src/mbgl/gl/context.cpp | 18 | ||||
-rw-r--r-- | src/mbgl/gl/context.hpp | 22 | ||||
-rw-r--r-- | src/mbgl/gl/object.cpp | 8 | ||||
-rw-r--r-- | src/mbgl/gl/object.hpp | 8 | ||||
-rw-r--r-- | src/mbgl/gl/value.cpp | 2 | ||||
-rw-r--r-- | src/mbgl/gl/value.hpp | 8 |
6 files changed, 34 insertions, 32 deletions
diff --git a/src/mbgl/gl/context.cpp b/src/mbgl/gl/context.cpp index 504e522da3..e70affd0b3 100644 --- a/src/mbgl/gl/context.cpp +++ b/src/mbgl/gl/context.cpp @@ -95,24 +95,26 @@ void Context::performCleanup() { abandonedTextures.clear(); } - if (!abandonedVAOs.empty()) { - for (const auto id : abandonedVAOs) { + if (!abandonedVertexArrays.empty()) { + for (const auto id : abandonedVertexArrays) { if (vertexArrayObject == id) { vertexArrayObject.setDirty(); } } - MBGL_CHECK_ERROR(gl::DeleteVertexArrays(int(abandonedVAOs.size()), abandonedVAOs.data())); - abandonedVAOs.clear(); + MBGL_CHECK_ERROR(gl::DeleteVertexArrays(int(abandonedVertexArrays.size()), + abandonedVertexArrays.data())); + abandonedVertexArrays.clear(); } - if (!abandonedFBOs.empty()) { - for (const auto id : abandonedFBOs) { + if (!abandonedFramebuffers.empty()) { + for (const auto id : abandonedFramebuffers) { if (bindFramebuffer == id) { bindFramebuffer.setDirty(); } } - MBGL_CHECK_ERROR(glDeleteFramebuffers(int(abandonedFBOs.size()), abandonedFBOs.data())); - abandonedFBOs.clear(); + MBGL_CHECK_ERROR( + glDeleteFramebuffers(int(abandonedFramebuffers.size()), abandonedFramebuffers.data())); + abandonedFramebuffers.clear(); } } diff --git a/src/mbgl/gl/context.hpp b/src/mbgl/gl/context.hpp index 5aa55b6a28..cd42e02fc0 100644 --- a/src/mbgl/gl/context.hpp +++ b/src/mbgl/gl/context.hpp @@ -42,16 +42,16 @@ public: return UniqueTexture { std::move(id), { this } }; } - UniqueVAO createVAO() { + UniqueVertexArray createVertexArray() { GLuint id = 0; MBGL_CHECK_ERROR(gl::GenVertexArrays(1, &id)); - return UniqueVAO { std::move(id), { this } }; + return UniqueVertexArray { std::move(id), { this } }; } - UniqueFBO createFBO() { + UniqueFramebuffer createFramebuffer() { GLuint id = 0; MBGL_CHECK_ERROR(glGenFramebuffers(1, &id)); - return UniqueFBO { std::move(id), { this } }; + return UniqueFramebuffer { std::move(id), { this } }; } // Actually remove the objects we marked as abandoned with the above methods. @@ -68,8 +68,8 @@ public: && abandonedShaders.empty() && abandonedBuffers.empty() && abandonedTextures.empty() - && abandonedVAOs.empty() - && abandonedFBOs.empty(); + && abandonedVertexArrays.empty() + && abandonedFramebuffers.empty(); } void resetState(); @@ -103,15 +103,15 @@ public: std::array<State<value::BindTexture>, 2> texture; State<value::BindBuffer<GL_ARRAY_BUFFER>> vertexBuffer; State<value::BindBuffer<GL_ELEMENT_ARRAY_BUFFER>> elementBuffer; - State<value::BindVAO> vertexArrayObject; + State<value::BindVertexArray> vertexArrayObject; private: friend detail::ProgramDeleter; friend detail::ShaderDeleter; friend detail::BufferDeleter; friend detail::TextureDeleter; - friend detail::VAODeleter; - friend detail::FBODeleter; + friend detail::VertexArrayDeleter; + friend detail::FramebufferDeleter; std::vector<GLuint> pooledTextures; @@ -119,8 +119,8 @@ private: std::vector<GLuint> abandonedShaders; std::vector<GLuint> abandonedBuffers; std::vector<GLuint> abandonedTextures; - std::vector<GLuint> abandonedVAOs; - std::vector<GLuint> abandonedFBOs; + std::vector<GLuint> abandonedVertexArrays; + std::vector<GLuint> abandonedFramebuffers; }; } // namespace gl diff --git a/src/mbgl/gl/object.cpp b/src/mbgl/gl/object.cpp index b9cabb8d9a..90451da713 100644 --- a/src/mbgl/gl/object.cpp +++ b/src/mbgl/gl/object.cpp @@ -31,14 +31,14 @@ void TextureDeleter::operator()(GLuint id) const { } } -void VAODeleter::operator()(GLuint id) const { +void VertexArrayDeleter::operator()(GLuint id) const { assert(context); - context->abandonedVAOs.push_back(id); + context->abandonedVertexArrays.push_back(id); } -void FBODeleter::operator()(GLuint id) const { +void FramebufferDeleter::operator()(GLuint id) const { assert(context); - context->abandonedFBOs.push_back(id); + context->abandonedFramebuffers.push_back(id); } } // namespace detail diff --git a/src/mbgl/gl/object.hpp b/src/mbgl/gl/object.hpp index 44da13042f..785e73e8ac 100644 --- a/src/mbgl/gl/object.hpp +++ b/src/mbgl/gl/object.hpp @@ -31,12 +31,12 @@ struct TextureDeleter { void operator()(GLuint) const; }; -struct VAODeleter { +struct VertexArrayDeleter { Context* context; void operator()(GLuint) const; }; -struct FBODeleter { +struct FramebufferDeleter { Context* context; void operator()(GLuint) const; }; @@ -47,8 +47,8 @@ using UniqueProgram = std_experimental::unique_resource<GLuint, detail::ProgramD using UniqueShader = std_experimental::unique_resource<GLuint, detail::ShaderDeleter>; using UniqueBuffer = std_experimental::unique_resource<GLuint, detail::BufferDeleter>; using UniqueTexture = std_experimental::unique_resource<GLuint, detail::TextureDeleter>; -using UniqueVAO = std_experimental::unique_resource<GLuint, detail::VAODeleter>; -using UniqueFBO = std_experimental::unique_resource<GLuint, detail::FBODeleter>; +using UniqueVertexArray = std_experimental::unique_resource<GLuint, detail::VertexArrayDeleter>; +using UniqueFramebuffer = std_experimental::unique_resource<GLuint, detail::FramebufferDeleter>; } // namespace gl } // namespace mbgl diff --git a/src/mbgl/gl/value.cpp b/src/mbgl/gl/value.cpp index 7df3f4e3bd..af316786ff 100644 --- a/src/mbgl/gl/value.cpp +++ b/src/mbgl/gl/value.cpp @@ -23,7 +23,7 @@ const constexpr Program::Type Program::Default; const constexpr LineWidth::Type LineWidth::Default; const constexpr ActiveTexture::Type ActiveTexture::Default; const constexpr BindTexture::Type BindTexture::Default; -const constexpr BindVAO::Type BindVAO::Default; +const constexpr BindVertexArray::Type BindVertexArray::Default; #ifndef GL_ES_VERSION_2_0 const constexpr PixelZoom::Type PixelZoom::Default; diff --git a/src/mbgl/gl/value.hpp b/src/mbgl/gl/value.hpp index 6436228ed1..bfa4dce775 100644 --- a/src/mbgl/gl/value.hpp +++ b/src/mbgl/gl/value.hpp @@ -278,9 +278,9 @@ struct BindFramebuffer { MBGL_CHECK_ERROR(glBindFramebuffer(GL_FRAMEBUFFER, value)); } static Type Get() { - Type activeFBO; - MBGL_CHECK_ERROR(glGetIntegerv(GL_FRAMEBUFFER_BINDING, &activeFBO)); - return activeFBO; + Type activeFramebuffer; + MBGL_CHECK_ERROR(glGetIntegerv(GL_FRAMEBUFFER_BINDING, &activeFramebuffer)); + return activeFramebuffer; } }; @@ -366,7 +366,7 @@ struct BindBuffer { template <GLenum target> const typename BindBuffer<target>::Type BindBuffer<target>::Default; -struct BindVAO { +struct BindVertexArray { using Type = GLuint; static const constexpr Type Default = 0; static void Set(const Type& value) { |