From 4737a45383911fcddf93f0a33e7e25246a5da07e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20K=C3=A4fer?= Date: Tue, 5 Mar 2019 16:07:58 +0100 Subject: [core] move IndexBuffer to gfx namespace --- src/mbgl/gl/context.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/mbgl/gl/context.cpp') diff --git a/src/mbgl/gl/context.cpp b/src/mbgl/gl/context.cpp index 72d59737f3..6fda803a94 100644 --- a/src/mbgl/gl/context.cpp +++ b/src/mbgl/gl/context.cpp @@ -1,5 +1,6 @@ #include #include +#include #include #include #include @@ -261,21 +262,22 @@ void Context::updateVertexBuffer(UniqueBuffer& buffer, const void* data, std::si MBGL_CHECK_ERROR(glBufferSubData(GL_ARRAY_BUFFER, 0, size, data)); } -UniqueBuffer Context::createIndexBuffer(const void* data, std::size_t size, const BufferUsage usage) { +std::unique_ptr +Context::createIndexBuffer(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 } }; bindVertexArray = 0; globalVertexArrayState.indexBuffer = result; MBGL_CHECK_ERROR(glBufferData(GL_ELEMENT_ARRAY_BUFFER, size, data, static_cast(usage))); - return result; + return std::make_unique(std::move(result)); } -void Context::updateIndexBuffer(UniqueBuffer& buffer, const void* data, std::size_t size) { +void Context::updateIndexBuffer(const gfx::IndexBufferResource& resource, const void* data, std::size_t size) { // Be sure to unbind any existing vertex array object before binding the index buffer // so that we don't mess up another VAO bindVertexArray = 0; - globalVertexArrayState.indexBuffer = buffer; + globalVertexArrayState.indexBuffer = reinterpret_cast(resource).buffer; MBGL_CHECK_ERROR(glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, 0, size, data)); } -- cgit v1.2.1