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 "WebGLContext.h"
9 #include "WebGLBuffer.h"
10 #include "WebGLVertexArray.h"
14 void WebGLContext::BindVertexArray(WebGLVertexArray
* array
) {
15 FuncScope
funcScope(*this, "bindVertexArray");
16 if (IsContextLost()) return;
17 funcScope
.mBindFailureGuard
= true;
19 if (array
&& !ValidateObject("array", *array
)) return;
21 if (array
== nullptr) {
22 array
= mDefaultVertexArray
;
25 array
->BindVertexArray();
27 MOZ_ASSERT(mBoundVertexArray
== array
);
28 if (mBoundVertexArray
) {
29 mBoundVertexArray
->mHasBeenBound
= true;
32 funcScope
.mBindFailureGuard
= false;
35 RefPtr
<WebGLVertexArray
> WebGLContext::CreateVertexArray() {
36 const FuncScope
funcScope(*this, "createVertexArray");
37 if (IsContextLost()) return nullptr;
39 return WebGLVertexArray::Create(this);
42 } // namespace mozilla