/src/mozilla-central/dom/canvas/WebGLExtensionDrawBuffers.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 file, |
4 | | * You can obtain one at http://mozilla.org/MPL/2.0/. */ |
5 | | |
6 | | #include "WebGLExtensions.h" |
7 | | |
8 | | #include <algorithm> |
9 | | #include "GLContext.h" |
10 | | #include "mozilla/dom/WebGLRenderingContextBinding.h" |
11 | | #include "WebGLContext.h" |
12 | | #include "WebGLFramebuffer.h" |
13 | | #include "WebGLRenderbuffer.h" |
14 | | #include "WebGLTexture.h" |
15 | | |
16 | | namespace mozilla { |
17 | | |
18 | | WebGLExtensionDrawBuffers::WebGLExtensionDrawBuffers(WebGLContext* webgl) |
19 | | : WebGLExtensionBase(webgl) |
20 | 0 | { |
21 | 0 | MOZ_ASSERT(IsSupported(webgl), "Don't construct extension if unsupported."); |
22 | 0 |
|
23 | 0 | webgl->UpdateMaxDrawBuffers(); |
24 | 0 | } |
25 | | |
26 | | WebGLExtensionDrawBuffers::~WebGLExtensionDrawBuffers() |
27 | 0 | { |
28 | 0 | } |
29 | | |
30 | | void |
31 | | WebGLExtensionDrawBuffers::DrawBuffersWEBGL(const dom::Sequence<GLenum>& buffers) |
32 | 0 | { |
33 | 0 | if (mIsLost) { |
34 | 0 | mContext->ErrorInvalidOperation("drawBuffersWEBGL: Extension is lost."); |
35 | 0 | return; |
36 | 0 | } |
37 | 0 | |
38 | 0 | mContext->DrawBuffers(buffers); |
39 | 0 | } |
40 | | |
41 | | bool |
42 | | WebGLExtensionDrawBuffers::IsSupported(const WebGLContext* webgl) |
43 | 0 | { |
44 | 0 | gl::GLContext* gl = webgl->GL(); |
45 | 0 |
|
46 | 0 | return gl->IsSupported(gl::GLFeature::draw_buffers); |
47 | 0 | } |
48 | | |
49 | | IMPL_WEBGL_EXTENSION_GOOP(WebGLExtensionDrawBuffers, WEBGL_draw_buffers) |
50 | | |
51 | | } // namespace mozilla |