Bumping manifests a=b2g-bump
[gecko.git] / dom / canvas / WebGL1ContextBuffers.cpp
blob5f54ec6fd9f84f9f2bf452881ac74a02da3a1078
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/. */
6 #include "WebGL1Context.h"
7 #include "WebGLBuffer.h"
8 #include "GLContext.h"
10 using namespace mozilla;
11 using namespace mozilla::dom;
13 // -------------------------------------------------------------------------
14 // Buffer objects
16 /** Target validation for BindBuffer, etc */
17 bool
18 WebGL1Context::ValidateBufferTarget(GLenum target, const char* info)
20 switch (target) {
21 case LOCAL_GL_ARRAY_BUFFER:
22 case LOCAL_GL_ELEMENT_ARRAY_BUFFER:
23 return true;
25 default:
26 ErrorInvalidEnumInfo(info, target);
27 return false;
31 bool
32 WebGL1Context::ValidateBufferIndexedTarget(GLenum target, const char* info)
34 ErrorInvalidEnumInfo(info, target);
35 return false;
38 /** Buffer and Target validation for BindBuffer */
39 bool
40 WebGL1Context::ValidateBufferForTarget(GLenum target, WebGLBuffer* buffer,
41 const char* info)
43 if (!buffer)
44 return true;
46 if (buffer->HasEverBeenBound() && target != buffer->Target()) {
47 ErrorInvalidOperation("%s: buffer already bound to a different target", info);
48 return false;
51 return true;