/src/mozilla-central/dom/canvas/WebGLVertexArrayGL.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
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 "WebGLVertexArrayGL.h" |
7 | | |
8 | | #include "GLContext.h" |
9 | | #include "WebGLContext.h" |
10 | | |
11 | | namespace mozilla { |
12 | | |
13 | | WebGLVertexArrayGL::WebGLVertexArrayGL(WebGLContext* webgl) |
14 | | : WebGLVertexArray(webgl) |
15 | | , mIsVAO(false) |
16 | 0 | { } |
17 | | |
18 | | WebGLVertexArrayGL::~WebGLVertexArrayGL() |
19 | 0 | { |
20 | 0 | DeleteOnce(); |
21 | 0 | } |
22 | | |
23 | | void |
24 | | WebGLVertexArrayGL::DeleteImpl() |
25 | 0 | { |
26 | 0 | mElementArrayBuffer = nullptr; |
27 | 0 |
|
28 | 0 | mContext->gl->fDeleteVertexArrays(1, &mGLName); |
29 | 0 |
|
30 | 0 | mIsVAO = false; |
31 | 0 | } |
32 | | |
33 | | void |
34 | | WebGLVertexArrayGL::BindVertexArrayImpl() |
35 | 0 | { |
36 | 0 | mContext->mBoundVertexArray = this; |
37 | 0 | mContext->gl->fBindVertexArray(mGLName); |
38 | 0 |
|
39 | 0 | mIsVAO = true; |
40 | 0 | } |
41 | | |
42 | | void |
43 | | WebGLVertexArrayGL::GenVertexArray() |
44 | 0 | { |
45 | 0 | mContext->gl->fGenVertexArrays(1, &mGLName); |
46 | 0 | } |
47 | | |
48 | | bool |
49 | | WebGLVertexArrayGL::IsVertexArrayImpl() const |
50 | 0 | { |
51 | 0 | gl::GLContext* gl = mContext->gl; |
52 | 0 | if (gl->WorkAroundDriverBugs()) |
53 | 0 | { |
54 | 0 | return mIsVAO; |
55 | 0 | } |
56 | 0 | |
57 | 0 | return mContext->gl->fIsVertexArray(mGLName) != 0; |
58 | 0 | } |
59 | | |
60 | | } // namespace mozilla |