Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 /* -*- Mode: C++; tab-width: 20; 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/. */
6 #include "WebGLContext.h"
7 #include "WebGLExtensions.h"
8 #include "mozilla/dom/WebGLRenderingContextBinding.h"
9 #include "GLContext.h"
11 using namespace mozilla;
13 WebGLExtensionInstancedArrays::WebGLExtensionInstancedArrays(WebGLContext* context)
14 : WebGLExtensionBase(context)
15 {
16 MOZ_ASSERT(IsSupported(context), "should not construct WebGLExtensionInstancedArrays: "
17 "ANGLE_instanced_arrays unsupported.");
18 }
20 WebGLExtensionInstancedArrays::~WebGLExtensionInstancedArrays()
21 {
22 }
24 void
25 WebGLExtensionInstancedArrays::DrawArraysInstancedANGLE(GLenum mode, GLint first,
26 GLsizei count, GLsizei primcount)
27 {
28 if (mIsLost)
29 return mContext->ErrorInvalidOperation("drawArraysInstancedANGLE: Extension is lost.");
31 mContext->DrawArraysInstanced(mode, first, count, primcount);
32 }
34 void
35 WebGLExtensionInstancedArrays::DrawElementsInstancedANGLE(GLenum mode, GLsizei count,
36 GLenum type, WebGLintptr offset,
37 GLsizei primcount)
38 {
39 if (mIsLost)
40 return mContext->ErrorInvalidOperation("drawElementsInstancedANGLE: Extension is lost.");
42 mContext->DrawElementsInstanced(mode, count, type, offset, primcount);
43 }
45 void
46 WebGLExtensionInstancedArrays::VertexAttribDivisorANGLE(GLuint index, GLuint divisor)
47 {
48 if (mIsLost)
49 return mContext->ErrorInvalidOperation("vertexAttribDivisorANGLE: Extension is lost.");
51 mContext->VertexAttribDivisor(index, divisor);
52 }
54 bool
55 WebGLExtensionInstancedArrays::IsSupported(const WebGLContext* context)
56 {
57 gl::GLContext* gl = context->GL();
59 return gl->IsSupported(gl::GLFeature::draw_instanced) &&
60 gl->IsSupported(gl::GLFeature::instanced_arrays);
61 }
63 IMPL_WEBGL_EXTENSION_GOOP(WebGLExtensionInstancedArrays)