Bug 1892041 - Part 1: Update test262 features. r=spidermonkey-reviewers,dminor
[gecko.git] / dom / canvas / WebGLVertexArrayGL.cpp
blob823fc41778a8477fea96d7dc6eee8edcca4d35c0
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #include "WebGLVertexArrayGL.h"
8 #include "GLContext.h"
9 #include "WebGLBuffer.h"
10 #include "WebGLContext.h"
12 namespace mozilla {
14 WebGLVertexArrayGL::WebGLVertexArrayGL(WebGLContext* webgl)
15 : WebGLVertexArray(webgl), mGLName([&]() {
16 GLuint ret = 0;
17 webgl->gl->fGenVertexArrays(1, &ret);
18 return ret;
19 }()) {}
21 WebGLVertexArrayGL::~WebGLVertexArrayGL() {
22 if (!mContext) return;
23 mContext->gl->fDeleteVertexArrays(1, &mGLName);
26 void WebGLVertexArrayGL::BindVertexArray() {
27 mContext->mBoundVertexArray = this;
28 mContext->gl->fBindVertexArray(mGLName);
31 } // namespace mozilla