Merge pull request #451 from mapbox/noncopyable-vao
VertexArrayObject and ElementGroup should be noncopyable
This commit is contained in:
@@ -3,13 +3,14 @@
|
||||
|
||||
#include <mbgl/geometry/buffer.hpp>
|
||||
#include <mbgl/geometry/vao.hpp>
|
||||
#include <mbgl/util/noncopyable.hpp>
|
||||
|
||||
#include <array>
|
||||
|
||||
namespace mbgl {
|
||||
|
||||
template <int count>
|
||||
struct ElementGroup {
|
||||
struct ElementGroup : public util::noncopyable {
|
||||
std::array<VertexArrayObject, count> array;
|
||||
uint32_t vertex_length;
|
||||
uint32_t elements_length;
|
||||
@@ -19,6 +20,11 @@ struct ElementGroup {
|
||||
: vertex_length(vertex_length),
|
||||
elements_length(elements_length) {
|
||||
}
|
||||
|
||||
ElementGroup(ElementGroup &&rhs) noexcept
|
||||
: array(std::move(rhs.array)),
|
||||
vertex_length(rhs.vertex_length),
|
||||
elements_length(rhs.elements_length) {};
|
||||
};
|
||||
|
||||
class TriangleElementsBuffer : public Buffer<
|
||||
|
||||
@@ -3,14 +3,25 @@
|
||||
|
||||
#include <mbgl/shader/shader.hpp>
|
||||
#include <mbgl/platform/gl.hpp>
|
||||
#include <mbgl/util/noncopyable.hpp>
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
namespace mbgl {
|
||||
|
||||
#if GL_ARB_vertex_array_object
|
||||
class VertexArrayObject {
|
||||
class VertexArrayObject : public util::noncopyable {
|
||||
public:
|
||||
inline VertexArrayObject() {};
|
||||
|
||||
inline VertexArrayObject(VertexArrayObject &&rhs) noexcept
|
||||
: vao(rhs.vao),
|
||||
bound_shader(rhs.bound_shader),
|
||||
bound_shader_name(rhs.bound_shader_name),
|
||||
bound_vertex_buffer(rhs.bound_vertex_buffer),
|
||||
bound_elements_buffer(rhs.bound_elements_buffer),
|
||||
bound_offset(rhs.bound_offset) {};
|
||||
|
||||
template <typename Shader, typename VertexBuffer>
|
||||
inline void bind(Shader& shader, VertexBuffer &vertexBuffer, char *offset) {
|
||||
bindVertexArrayObject();
|
||||
@@ -56,7 +67,7 @@ private:
|
||||
|
||||
#else
|
||||
|
||||
class VertexArrayObject {
|
||||
class VertexArrayObject : public util::noncopyable {
|
||||
public:
|
||||
template <typename Shader, typename Buffers>
|
||||
void bind(Shader& shader, Buffers& buffers, char *offset) {
|
||||
|
||||
@@ -36,6 +36,7 @@ class FillBucket : public Bucket {
|
||||
|
||||
typedef ElementGroup<2> triangle_group_type;
|
||||
typedef ElementGroup<1> line_group_type;
|
||||
|
||||
public:
|
||||
FillBucket(FillVertexBuffer& vertexBuffer,
|
||||
TriangleElementsBuffer& triangleElementsBuffer,
|
||||
|
||||
@@ -22,6 +22,7 @@ struct pbf;
|
||||
class LineBucket : public Bucket {
|
||||
typedef ElementGroup<1> triangle_group_type;
|
||||
typedef ElementGroup<1> point_group_type;
|
||||
|
||||
public:
|
||||
LineBucket(LineVertexBuffer& vertexBuffer,
|
||||
TriangleElementsBuffer& triangleElementsBuffer,
|
||||
@@ -43,7 +44,6 @@ public:
|
||||
const StyleBucketLine &properties;
|
||||
|
||||
private:
|
||||
|
||||
LineVertexBuffer& vertexBuffer;
|
||||
TriangleElementsBuffer& triangleElementsBuffer;
|
||||
PointElementsBuffer& pointElementsBuffer;
|
||||
|
||||
@@ -10,7 +10,11 @@ if [[ ${TRAVIS_OS_NAME} == "linux" ]]; then
|
||||
make linux -j4 BUILDTYPE=${BUILDTYPE}
|
||||
make test -j4 BUILDTYPE=${BUILDTYPE}
|
||||
./scripts/run_tests.sh
|
||||
(cd ./node_modules/mapbox-gl-test-suite/ && (./bin/compare_images.js || true; [[ $TRAVIS_PULL_REQUEST = "false" ]] && ./bin/deploy_results.sh))
|
||||
(cd ./node_modules/mapbox-gl-test-suite/ && (./bin/compare_images.js || true))
|
||||
|
||||
if [ "${TRAVIS_PULL_REQUEST}" == "false" ] ; then
|
||||
(cd ./node_modules/mapbox-gl-test-suite/ && ./bin/deploy_results.sh)
|
||||
fi
|
||||
|
||||
elif [[ ${TRAVIS_OS_NAME} == "osx" ]]; then
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user