tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

WebGLContextVertexArray.cpp (1131B)


      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/. */
      5 
      6 #include "GLContext.h"
      7 #include "WebGLBuffer.h"
      8 #include "WebGLContext.h"
      9 #include "WebGLVertexArray.h"
     10 
     11 namespace mozilla {
     12 
     13 void WebGLContext::BindVertexArray(WebGLVertexArray* array) {
     14  FuncScope funcScope(*this, "bindVertexArray");
     15  if (IsContextLost()) return;
     16  funcScope.mBindFailureGuard = true;
     17 
     18  if (array && !ValidateObject("array", *array)) return;
     19 
     20  if (array == nullptr) {
     21    array = mDefaultVertexArray;
     22  }
     23 
     24  array->BindVertexArray();
     25 
     26  MOZ_ASSERT(mBoundVertexArray == array);
     27  if (mBoundVertexArray) {
     28    mBoundVertexArray->mHasBeenBound = true;
     29  }
     30 
     31  funcScope.mBindFailureGuard = false;
     32 }
     33 
     34 RefPtr<WebGLVertexArray> WebGLContext::CreateVertexArray() {
     35  const FuncScope funcScope(*this, "createVertexArray");
     36  if (IsContextLost()) return nullptr;
     37 
     38  return WebGLVertexArray::Create(this);
     39 }
     40 
     41 }  // namespace mozilla