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"
10 using namespace mozilla
;
11 using namespace mozilla::dom
;
13 // -------------------------------------------------------------------------
16 /** Target validation for BindBuffer, etc */
18 WebGL1Context::ValidateBufferTarget(GLenum target
, const char* info
)
21 case LOCAL_GL_ARRAY_BUFFER
:
22 case LOCAL_GL_ELEMENT_ARRAY_BUFFER
:
26 ErrorInvalidEnumInfo(info
, target
);
32 WebGL1Context::ValidateBufferIndexedTarget(GLenum target
, const char* info
)
34 ErrorInvalidEnumInfo(info
, target
);
38 /** Buffer and Target validation for BindBuffer */
40 WebGL1Context::ValidateBufferForTarget(GLenum target
, WebGLBuffer
* buffer
,
46 if (buffer
->HasEverBeenBound() && target
!= buffer
->Target()) {
47 ErrorInvalidOperation("%s: buffer already bound to a different target", info
);