summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2016-09-29 11:45:28 +0200
committerJohn Firebaugh <john.firebaugh@gmail.com>2016-09-29 10:17:47 -0700
commitd1a84d9b51a7145f9f7665805cf71050aac7bc63 (patch)
tree057b048f24e022a2c391a1ecf736c4c9a3f10943
parent2b05776f978c7759824bce1c4fc89d67cc00d332 (diff)
downloadqtlocation-mapboxgl-d1a84d9b51a7145f9f7665805cf71050aac7bc63.tar.gz
[core] rename VAO => VertexArray, FBO => Framebuffer
-rw-r--r--src/mbgl/geometry/vao.cpp6
-rw-r--r--src/mbgl/geometry/vao.hpp8
-rw-r--r--src/mbgl/gl/context.cpp18
-rw-r--r--src/mbgl/gl/context.hpp22
-rw-r--r--src/mbgl/gl/object.cpp8
-rw-r--r--src/mbgl/gl/object.hpp8
-rw-r--r--src/mbgl/gl/value.cpp2
-rw-r--r--src/mbgl/gl/value.hpp8
-rw-r--r--src/mbgl/util/offscreen_texture.cpp8
-rw-r--r--src/mbgl/util/offscreen_texture.hpp2
-rw-r--r--test/gl/object.test.cpp2
11 files changed, 47 insertions, 45 deletions
diff --git a/src/mbgl/geometry/vao.cpp b/src/mbgl/geometry/vao.cpp
index 6a95127970..0f29d65cf9 100644
--- a/src/mbgl/geometry/vao.cpp
+++ b/src/mbgl/geometry/vao.cpp
@@ -19,13 +19,13 @@ void VertexArrayObject::bindVertexArrayObject(gl::Context& context) {
return;
}
- if (!vao) {
- vao = context.createVAO();
+ if (!vertexArray) {
+ vertexArray = context.createVertexArray();
context.vertexBuffer.setDirty();
context.elementBuffer.setDirty();
}
- context.vertexArrayObject = *vao;
+ context.vertexArrayObject = *vertexArray;
}
void VertexArrayObject::verifyBinding(Shader& shader, GLuint vertexBuffer, GLuint elementsBuffer,
diff --git a/src/mbgl/geometry/vao.hpp b/src/mbgl/geometry/vao.hpp
index 2cb81481f2..a9e69c938f 100644
--- a/src/mbgl/geometry/vao.hpp
+++ b/src/mbgl/geometry/vao.hpp
@@ -24,7 +24,7 @@ public:
if (bound_shader == 0) {
vertexBuffer.bind(context);
shader.bind(offset);
- if (vao) {
+ if (vertexArray) {
storeBinding(shader, vertexBuffer.getID(), 0, offset);
}
} else {
@@ -43,7 +43,7 @@ public:
vertexBuffer.bind(context);
elementsBuffer.bind(context);
shader.bind(offset);
- if (vao) {
+ if (vertexArray) {
storeBinding(shader, vertexBuffer.getID(), elementsBuffer.getID(), offset);
}
} else {
@@ -52,7 +52,7 @@ public:
}
GLuint getID() const {
- return *vao;
+ return *vertexArray;
}
private:
@@ -60,7 +60,7 @@ private:
void storeBinding(Shader &shader, GLuint vertexBuffer, GLuint elementsBuffer, GLbyte *offset);
void verifyBinding(Shader &shader, GLuint vertexBuffer, GLuint elementsBuffer, GLbyte *offset);
- mbgl::optional<gl::UniqueVAO> vao;
+ mbgl::optional<gl::UniqueVertexArray> vertexArray;
// For debug reasons, we're storing the bind information so that we can
// detect errors and report
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) {
diff --git a/src/mbgl/util/offscreen_texture.cpp b/src/mbgl/util/offscreen_texture.cpp
index 602dd8092a..e396aabef6 100644
--- a/src/mbgl/util/offscreen_texture.cpp
+++ b/src/mbgl/util/offscreen_texture.cpp
@@ -14,9 +14,9 @@ void OffscreenTexture::bind(gl::Context& context,
raster.upload(context, 0);
}
- if (!fbo) {
- fbo = context.createFBO();
- context.bindFramebuffer = *fbo;
+ if (!framebuffer) {
+ framebuffer = context.createFramebuffer();
+ context.bindFramebuffer = *framebuffer;
MBGL_CHECK_ERROR(glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D,
raster.getID(), 0));
@@ -48,7 +48,7 @@ void OffscreenTexture::bind(gl::Context& context,
}
}
} else {
- context.bindFramebuffer = *fbo;
+ context.bindFramebuffer = *framebuffer;
}
context.viewport = { { 0, 0, static_cast<GLint>(size[0]), static_cast<GLint>(size[1]) } };
diff --git a/src/mbgl/util/offscreen_texture.hpp b/src/mbgl/util/offscreen_texture.hpp
index e0a61eb4aa..2f5fa75d6c 100644
--- a/src/mbgl/util/offscreen_texture.hpp
+++ b/src/mbgl/util/offscreen_texture.hpp
@@ -16,7 +16,7 @@ public:
std::array<uint16_t, 2> getSize() const;
private:
- mbgl::optional<gl::UniqueFBO> fbo;
+ mbgl::optional<gl::UniqueFramebuffer> framebuffer;
Raster raster;
};
diff --git a/test/gl/object.test.cpp b/test/gl/object.test.cpp
index 2722669e84..ba3580080b 100644
--- a/test/gl/object.test.cpp
+++ b/test/gl/object.test.cpp
@@ -103,7 +103,7 @@ TEST(GLObject, Store) {
context.reset();
EXPECT_TRUE(context.empty());
- mbgl::gl::UniqueVAO vao = context.createVAO();
+ mbgl::gl::UniqueVertexArray vao = context.createVertexArray();
EXPECT_NE(vao.get(), 0u);
vao.reset();
EXPECT_FALSE(context.empty());