Refactor VAO entry points.
This also touches the extension EPs for ES2.
BUG=angleproject:747
Change-Id: Iaa04d97465e518f6b0496e64bc7a737914709b8f
Reviewed-on: https://chromium-review.googlesource.com/637124
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
diff --git a/src/libANGLE/Context.cpp b/src/libANGLE/Context.cpp
index 5a09777..9b112a4 100644
--- a/src/libANGLE/Context.cpp
+++ b/src/libANGLE/Context.cpp
@@ -624,13 +624,6 @@
return resultOrError.getResult();
}
-GLuint Context::createVertexArray()
-{
- GLuint vertexArray = mVertexArrayHandleAllocator.allocate();
- mVertexArrayMap.assign(vertexArray, nullptr);
- return vertexArray;
-}
-
GLuint Context::createSampler()
{
return mState.mSamplers->createSampler();
@@ -796,21 +789,6 @@
mGLState.setPathStencilFunc(func, ref, mask);
}
-void Context::deleteVertexArray(GLuint vertexArray)
-{
- VertexArray *vertexArrayObject = nullptr;
- if (mVertexArrayMap.erase(vertexArray, &vertexArrayObject))
- {
- if (vertexArrayObject != nullptr)
- {
- detachVertexArray(vertexArray);
- vertexArrayObject->onDestroy(this);
- }
-
- mVertexArrayHandleAllocator.release(vertexArray);
- }
-}
-
void Context::deleteSampler(GLuint sampler)
{
if (mState.mSamplers->getSampler(sampler))
@@ -5010,4 +4988,48 @@
program->setUniformMatrix4x3fv(location, count, transpose, value);
}
+void Context::deleteVertexArrays(GLsizei n, const GLuint *arrays)
+{
+ for (int arrayIndex = 0; arrayIndex < n; arrayIndex++)
+ {
+ GLuint vertexArray = arrays[arrayIndex];
+
+ if (arrays[arrayIndex] != 0)
+ {
+ VertexArray *vertexArrayObject = nullptr;
+ if (mVertexArrayMap.erase(vertexArray, &vertexArrayObject))
+ {
+ if (vertexArrayObject != nullptr)
+ {
+ detachVertexArray(vertexArray);
+ vertexArrayObject->onDestroy(this);
+ }
+
+ mVertexArrayHandleAllocator.release(vertexArray);
+ }
+ }
+ }
+}
+
+void Context::genVertexArrays(GLsizei n, GLuint *arrays)
+{
+ for (int arrayIndex = 0; arrayIndex < n; arrayIndex++)
+ {
+ GLuint vertexArray = mVertexArrayHandleAllocator.allocate();
+ mVertexArrayMap.assign(vertexArray, nullptr);
+ arrays[arrayIndex] = vertexArray;
+ }
+}
+
+bool Context::isVertexArray(GLuint array)
+{
+ if (array == 0)
+ {
+ return GL_FALSE;
+ }
+
+ VertexArray *vao = getVertexArray(array);
+ return (vao != nullptr ? GL_TRUE : GL_FALSE);
+}
+
} // namespace gl