Backed out 4 changesets (bug 1858627) for causing clipboard/paste failures. CLOSED...
[gecko.git] / dom / canvas / WebGLContextUtils.h
blob2f746be9cbba11f9f11601dad184156b153a7a3b
1 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
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 #ifndef WEBGL_CONTEXT_UTILS_H_
7 #define WEBGL_CONTEXT_UTILS_H_
9 #include "WebGLStrongTypes.h"
10 #include "WebGLTypes.h"
12 namespace mozilla {
14 // For use with the different texture calls, i.e.
15 // TexImage2D, CopyTex[Sub]Image2D, ...
16 // that take a "target" parameter. This parameter is not always the same as
17 // the texture binding location, like GL_TEXTURE_2D or GL_TEXTURE_CUBE_MAP.
18 // For example, cube maps would pass GL_TEXTURE_CUBE_MAP_[POS|NEG]_[X|Y|Z]
19 // instead of just GL_TEXTURE_CUBE_MAP.
21 // This function converts the texture image target to the texture target a.k.a.
22 // binding location. The returned binding location can be used to check that
23 // the currently bound texture is appropriate for this texImageTarget.
25 // Returns GL_NONE if passed an invalid texture image target
26 TexTarget TexImageTargetToTexTarget(TexImageTarget texImageTarget);
28 struct GLComponents {
29 unsigned char mComponents;
31 enum Components {
32 Red = (1 << 0),
33 Green = (1 << 1),
34 Blue = (1 << 2),
35 Alpha = (1 << 3),
36 Stencil = (1 << 4),
37 Depth = (1 << 5),
40 GLComponents() : mComponents(0) {}
42 explicit GLComponents(TexInternalFormat format);
44 // Returns true iff other has all (or more) of
45 // the components present in this GLComponents
46 bool IsSubsetOf(const GLComponents& other) const;
49 /**
50 * Return the displayable name for the texture function that is the
51 * source for validation.
53 const char* InfoFrom(WebGLTexImageFunc func, WebGLTexDimensions dims);
55 } // namespace mozilla
57 #endif // WEBGL_CONTEXT_UTILS_H_