Line data Source code
1 : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 : /* This Source Code Form is subject to the terms of the Mozilla Public
4 : * License, v. 2.0. If a copy of the MPL was not distributed with this
5 : * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 :
7 : #include "WebGLVertexArrayObject.h"
8 :
9 : #include "GLContext.h"
10 : #include "mozilla/dom/WebGL2RenderingContextBinding.h"
11 : #include "WebGLContext.h"
12 :
13 : namespace mozilla {
14 : namespace dom {
15 :
16 : WebGLVertexArray*
17 0 : WebGLVertexArrayObject::Create(WebGLContext* webgl)
18 : {
19 : // WebGL 2: This is core in GL ES 3. If support is missing something
20 : // is very wrong.
21 0 : bool vaoSupport = webgl->GL()->IsSupported(gl::GLFeature::vertex_array_object);
22 0 : MOZ_RELEASE_ASSERT(vaoSupport, "GFX: Vertex Array Objects aren't supported.");
23 0 : if (vaoSupport)
24 0 : return new WebGLVertexArrayObject(webgl);
25 :
26 0 : return nullptr;
27 : }
28 :
29 : JSObject*
30 0 : WebGLVertexArrayObject::WrapObject(JSContext* cx,
31 : JS::Handle<JSObject*> givenProto)
32 : {
33 0 : return dom::WebGLVertexArrayObjectBinding::Wrap(cx, this, givenProto);
34 : }
35 :
36 : } // namespace dom
37 : } // namespace mozilla
|