2018-11-30 22:52:05 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-10-05 00:35:54 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
2014-11-14 07:03:50 +03:00
|
|
|
#ifndef WEBGL_CONTEXT_UTILS_H_
|
|
|
|
#define WEBGL_CONTEXT_UTILS_H_
|
2012-10-05 00:35:54 +04:00
|
|
|
|
2015-07-15 03:37:28 +03:00
|
|
|
#include "WebGLStrongTypes.h"
|
2020-07-22 18:12:10 +03:00
|
|
|
#include "WebGLTypes.h"
|
2015-07-15 03:37:28 +03:00
|
|
|
|
2012-10-05 00:35:54 +04:00
|
|
|
namespace mozilla {
|
|
|
|
|
2014-09-03 23:17:18 +04:00
|
|
|
// For use with the different texture calls, i.e.
|
|
|
|
// TexImage2D, CopyTex[Sub]Image2D, ...
|
|
|
|
// that take a "target" parameter. This parameter is not always the same as
|
|
|
|
// the texture binding location, like GL_TEXTURE_2D or GL_TEXTURE_CUBE_MAP.
|
|
|
|
// For example, cube maps would pass GL_TEXTURE_CUBE_MAP_[POS|NEG]_[X|Y|Z]
|
|
|
|
// instead of just GL_TEXTURE_CUBE_MAP.
|
|
|
|
//
|
|
|
|
// This function converts the texture image target to the texture target a.k.a.
|
|
|
|
// binding location. The returned binding location can be used to check that
|
|
|
|
// the currently bound texture is appropriate for this texImageTarget.
|
|
|
|
//
|
|
|
|
// Returns GL_NONE if passed an invalid texture image target
|
2014-09-19 03:14:22 +04:00
|
|
|
TexTarget TexImageTargetToTexTarget(TexImageTarget texImageTarget);
|
2014-09-03 23:17:18 +04:00
|
|
|
|
2014-08-21 00:38:42 +04:00
|
|
|
struct GLComponents {
|
|
|
|
unsigned char mComponents;
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2014-08-21 00:38:42 +04:00
|
|
|
enum Components {
|
|
|
|
Red = (1 << 0),
|
|
|
|
Green = (1 << 1),
|
|
|
|
Blue = (1 << 2),
|
|
|
|
Alpha = (1 << 3),
|
|
|
|
Stencil = (1 << 4),
|
|
|
|
Depth = (1 << 5),
|
|
|
|
};
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2014-08-21 00:38:42 +04:00
|
|
|
GLComponents() : mComponents(0) {}
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2014-11-14 07:03:50 +03:00
|
|
|
explicit GLComponents(TexInternalFormat format);
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2014-08-21 00:38:42 +04:00
|
|
|
// Returns true iff other has all (or more) of
|
|
|
|
// the components present in this GLComponents
|
|
|
|
bool IsSubsetOf(const GLComponents& other) const;
|
|
|
|
};
|
|
|
|
|
2014-10-14 03:42:15 +04:00
|
|
|
/**
|
|
|
|
* Return the displayable name for the texture function that is the
|
|
|
|
* source for validation.
|
|
|
|
*/
|
2014-11-14 07:03:50 +03:00
|
|
|
const char* InfoFrom(WebGLTexImageFunc func, WebGLTexDimensions dims);
|
2014-10-14 03:42:15 +04:00
|
|
|
|
2012-10-05 00:35:54 +04:00
|
|
|
} // namespace mozilla
|
|
|
|
|
2014-11-14 07:03:50 +03:00
|
|
|
#endif // WEBGL_CONTEXT_UTILS_H_
|