2012-12-04 00:13:47 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
|
|
/* 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 04:03:50 +00:00
|
|
|
#ifndef WEBGL_TEXTURE_H_
|
|
|
|
#define WEBGL_TEXTURE_H_
|
2012-12-04 00:13:47 +00:00
|
|
|
|
2014-11-14 04:03:50 +00:00
|
|
|
#include <algorithm>
|
|
|
|
#include "mozilla/Assertions.h"
|
|
|
|
#include "mozilla/CheckedInt.h"
|
|
|
|
#include "mozilla/LinkedList.h"
|
|
|
|
#include "nsAlgorithm.h"
|
|
|
|
#include "nsWrapperCache.h"
|
2014-05-07 03:11:18 +00:00
|
|
|
#include "WebGLBindableName.h"
|
2014-03-04 07:14:35 +00:00
|
|
|
#include "WebGLFramebufferAttachable.h"
|
2014-05-07 03:11:18 +00:00
|
|
|
#include "WebGLObjectModel.h"
|
2014-09-18 23:14:22 +00:00
|
|
|
#include "WebGLStrongTypes.h"
|
2012-12-04 00:13:47 +00:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
|
|
|
|
// Zero is not an integer power of two.
|
2014-11-14 04:03:50 +00:00
|
|
|
inline bool
|
|
|
|
IsPOTAssumingNonnegative(GLsizei x)
|
2012-12-04 00:13:47 +00:00
|
|
|
{
|
2014-11-14 04:03:50 +00:00
|
|
|
MOZ_ASSERT(x >= 0);
|
2012-12-04 00:13:47 +00:00
|
|
|
return x && (x & (x-1)) == 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
// NOTE: When this class is switched to new DOM bindings, update the (then-slow)
|
|
|
|
// WrapObject calls in GetParameter and GetFramebufferAttachmentParameter.
|
|
|
|
class WebGLTexture MOZ_FINAL
|
2013-08-29 15:39:17 +00:00
|
|
|
: public nsWrapperCache
|
2014-09-18 23:14:22 +00:00
|
|
|
, public WebGLBindableName<TexTarget>
|
2012-12-04 00:13:47 +00:00
|
|
|
, public WebGLRefCountedObject<WebGLTexture>
|
|
|
|
, public LinkedListElement<WebGLTexture>
|
|
|
|
, public WebGLContextBoundObject
|
2014-03-04 07:14:35 +00:00
|
|
|
, public WebGLFramebufferAttachable
|
2012-12-04 00:13:47 +00:00
|
|
|
{
|
|
|
|
public:
|
2014-11-14 04:03:50 +00:00
|
|
|
explicit WebGLTexture(WebGLContext* webgl, GLuint tex);
|
2012-12-04 00:13:47 +00:00
|
|
|
|
|
|
|
void Delete();
|
|
|
|
|
2014-11-14 04:03:50 +00:00
|
|
|
WebGLContext* GetParentObject() const {
|
2012-12-04 00:13:47 +00:00
|
|
|
return Context();
|
|
|
|
}
|
|
|
|
|
2014-11-14 04:03:50 +00:00
|
|
|
virtual JSObject* WrapObject(JSContext* cx) MOZ_OVERRIDE;
|
2012-12-04 00:13:47 +00:00
|
|
|
|
2013-08-29 15:39:17 +00:00
|
|
|
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(WebGLTexture)
|
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(WebGLTexture)
|
2012-12-04 00:13:47 +00:00
|
|
|
|
|
|
|
protected:
|
2014-06-26 13:30:49 +00:00
|
|
|
~WebGLTexture() {
|
|
|
|
DeleteOnce();
|
|
|
|
}
|
2012-12-04 00:13:47 +00:00
|
|
|
|
|
|
|
friend class WebGLContext;
|
|
|
|
friend class WebGLFramebuffer;
|
|
|
|
|
2014-11-14 04:03:50 +00:00
|
|
|
// We store information about the various images that are part of this
|
|
|
|
// texture. (cubemap faces, mipmap levels)
|
2012-12-04 00:13:47 +00:00
|
|
|
|
|
|
|
public:
|
2013-10-11 13:16:43 +00:00
|
|
|
class ImageInfo
|
|
|
|
: public WebGLRectangleObject
|
|
|
|
{
|
2012-12-04 00:13:47 +00:00
|
|
|
public:
|
|
|
|
ImageInfo()
|
2014-10-07 23:52:58 +00:00
|
|
|
: mEffectiveInternalFormat(LOCAL_GL_NONE)
|
2014-10-13 23:42:20 +00:00
|
|
|
, mDepth(0)
|
2013-10-11 13:16:43 +00:00
|
|
|
, mImageDataStatus(WebGLImageDataStatus::NoImageData)
|
2012-12-04 00:13:47 +00:00
|
|
|
{}
|
|
|
|
|
2014-11-14 04:03:50 +00:00
|
|
|
ImageInfo(GLsizei width, GLsizei height, GLsizei depth,
|
2014-10-07 23:52:58 +00:00
|
|
|
TexInternalFormat effectiveInternalFormat,
|
2014-05-02 03:15:58 +00:00
|
|
|
WebGLImageDataStatus status)
|
2012-12-04 00:13:47 +00:00
|
|
|
: WebGLRectangleObject(width, height)
|
2014-10-07 23:52:58 +00:00
|
|
|
, mEffectiveInternalFormat(effectiveInternalFormat)
|
2014-10-13 23:42:20 +00:00
|
|
|
, mDepth(depth)
|
2013-10-11 13:16:43 +00:00
|
|
|
, mImageDataStatus(status)
|
|
|
|
{
|
|
|
|
// shouldn't use this constructor to construct a null ImageInfo
|
|
|
|
MOZ_ASSERT(status != WebGLImageDataStatus::NoImageData);
|
|
|
|
}
|
2012-12-04 00:13:47 +00:00
|
|
|
|
|
|
|
bool operator==(const ImageInfo& a) const {
|
2013-10-11 13:16:43 +00:00
|
|
|
return mImageDataStatus == a.mImageDataStatus &&
|
2014-05-02 03:15:58 +00:00
|
|
|
mWidth == a.mWidth &&
|
2013-10-11 13:16:43 +00:00
|
|
|
mHeight == a.mHeight &&
|
2014-10-13 23:42:20 +00:00
|
|
|
mDepth == a.mDepth &&
|
2014-10-07 23:52:58 +00:00
|
|
|
mEffectiveInternalFormat == a.mEffectiveInternalFormat;
|
2012-12-04 00:13:47 +00:00
|
|
|
}
|
|
|
|
bool operator!=(const ImageInfo& a) const {
|
|
|
|
return !(*this == a);
|
|
|
|
}
|
|
|
|
bool IsSquare() const {
|
|
|
|
return mWidth == mHeight;
|
|
|
|
}
|
|
|
|
bool IsPositive() const {
|
2014-10-13 23:42:20 +00:00
|
|
|
return mWidth > 0 && mHeight > 0 && mDepth > 0;
|
2012-12-04 00:13:47 +00:00
|
|
|
}
|
|
|
|
bool IsPowerOfTwo() const {
|
2014-11-14 04:03:50 +00:00
|
|
|
MOZ_ASSERT(mWidth >= 0);
|
|
|
|
MOZ_ASSERT(mHeight >= 0);
|
|
|
|
return IsPOTAssumingNonnegative(mWidth) &&
|
|
|
|
IsPOTAssumingNonnegative(mHeight);
|
2012-12-04 00:13:47 +00:00
|
|
|
}
|
2013-10-11 13:16:43 +00:00
|
|
|
bool HasUninitializedImageData() const {
|
|
|
|
return mImageDataStatus == WebGLImageDataStatus::UninitializedImageData;
|
|
|
|
}
|
2014-10-13 23:42:20 +00:00
|
|
|
size_t MemoryUsage() const;
|
2014-07-14 23:55:33 +00:00
|
|
|
|
2014-11-14 04:03:50 +00:00
|
|
|
TexInternalFormat EffectiveInternalFormat() const {
|
|
|
|
return mEffectiveInternalFormat;
|
|
|
|
}
|
2014-10-14 12:54:52 +00:00
|
|
|
GLsizei Depth() const { return mDepth; }
|
2014-05-02 03:15:58 +00:00
|
|
|
|
2012-12-04 00:13:47 +00:00
|
|
|
protected:
|
2014-11-14 04:03:50 +00:00
|
|
|
// This is the "effective internal format" of the texture, an official
|
|
|
|
// OpenGL spec concept, see OpenGL ES 3.0.3 spec, section 3.8.3, page
|
|
|
|
// 126 and below.
|
2014-10-07 23:52:58 +00:00
|
|
|
TexInternalFormat mEffectiveInternalFormat;
|
|
|
|
|
2014-11-14 04:03:50 +00:00
|
|
|
/* Used only for 3D textures.
|
2014-10-13 23:42:20 +00:00
|
|
|
* Note that mWidth and mHeight are inherited from WebGLRectangleObject.
|
|
|
|
* It's a pity to store a useless mDepth on non-3D texture images, but
|
|
|
|
* the size of GLsizei is negligible compared to the typical size of a texture image.
|
|
|
|
*/
|
|
|
|
GLsizei mDepth;
|
|
|
|
|
2013-10-11 13:16:43 +00:00
|
|
|
WebGLImageDataStatus mImageDataStatus;
|
2012-12-04 00:13:47 +00:00
|
|
|
|
|
|
|
friend class WebGLTexture;
|
|
|
|
};
|
|
|
|
|
2013-10-02 00:30:38 +00:00
|
|
|
private:
|
2014-09-18 23:14:22 +00:00
|
|
|
static size_t FaceForTarget(TexImageTarget texImageTarget) {
|
2014-10-13 23:42:20 +00:00
|
|
|
if (texImageTarget == LOCAL_GL_TEXTURE_2D ||
|
|
|
|
texImageTarget == LOCAL_GL_TEXTURE_3D)
|
|
|
|
{
|
2014-09-18 23:14:22 +00:00
|
|
|
return 0;
|
2014-10-13 23:42:20 +00:00
|
|
|
}
|
2014-09-18 23:14:22 +00:00
|
|
|
return texImageTarget.get() - LOCAL_GL_TEXTURE_CUBE_MAP_POSITIVE_X;
|
2013-10-02 00:30:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ImageInfo& ImageInfoAtFace(size_t face, GLint level) {
|
2014-11-14 04:03:50 +00:00
|
|
|
MOZ_ASSERT(face < mFacesCount,
|
|
|
|
"Wrong face index, must be 0 for TEXTURE_2D or TEXTURE_3D,"
|
|
|
|
" and at most 5 for cube maps.");
|
2013-10-02 00:30:38 +00:00
|
|
|
|
2014-11-14 04:03:50 +00:00
|
|
|
// No need to check level as a wrong value would be caught by
|
|
|
|
// ElementAt().
|
2012-12-04 00:13:47 +00:00
|
|
|
return mImageInfos.ElementAt(level * mFacesCount + face);
|
|
|
|
}
|
|
|
|
|
2013-10-02 00:30:38 +00:00
|
|
|
const ImageInfo& ImageInfoAtFace(size_t face, GLint level) const {
|
|
|
|
return const_cast<const ImageInfo&>(
|
|
|
|
const_cast<WebGLTexture*>(this)->ImageInfoAtFace(face, level)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
public:
|
2014-09-18 23:14:22 +00:00
|
|
|
ImageInfo& ImageInfoAt(TexImageTarget imageTarget, GLint level) {
|
2013-10-02 00:30:38 +00:00
|
|
|
size_t face = FaceForTarget(imageTarget);
|
|
|
|
return ImageInfoAtFace(face, level);
|
|
|
|
}
|
|
|
|
|
2014-11-14 04:03:50 +00:00
|
|
|
const ImageInfo& ImageInfoAt(TexImageTarget imageTarget, GLint level) const
|
|
|
|
{
|
2013-10-02 00:30:38 +00:00
|
|
|
return const_cast<WebGLTexture*>(this)->ImageInfoAt(imageTarget, level);
|
2012-12-04 00:13:47 +00:00
|
|
|
}
|
|
|
|
|
2014-09-18 23:14:22 +00:00
|
|
|
bool HasImageInfoAt(TexImageTarget imageTarget, GLint level) const {
|
2013-10-02 00:30:38 +00:00
|
|
|
size_t face = FaceForTarget(imageTarget);
|
2012-12-04 00:13:47 +00:00
|
|
|
CheckedUint32 checked_index = CheckedUint32(level) * mFacesCount + face;
|
|
|
|
return checked_index.isValid() &&
|
|
|
|
checked_index.value() < mImageInfos.Length() &&
|
2013-10-11 13:16:43 +00:00
|
|
|
ImageInfoAt(imageTarget, level).mImageDataStatus != WebGLImageDataStatus::NoImageData;
|
2012-12-04 00:13:47 +00:00
|
|
|
}
|
|
|
|
|
2013-10-02 00:30:38 +00:00
|
|
|
ImageInfo& ImageInfoBase() {
|
|
|
|
return ImageInfoAtFace(0, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
const ImageInfo& ImageInfoBase() const {
|
|
|
|
return ImageInfoAtFace(0, 0);
|
2012-12-04 00:13:47 +00:00
|
|
|
}
|
|
|
|
|
2014-10-13 23:42:20 +00:00
|
|
|
size_t MemoryUsage() const;
|
2012-12-04 00:13:47 +00:00
|
|
|
|
2014-11-14 04:03:50 +00:00
|
|
|
void SetImageDataStatus(TexImageTarget imageTarget, GLint level,
|
|
|
|
WebGLImageDataStatus newStatus)
|
|
|
|
{
|
2013-10-11 13:16:43 +00:00
|
|
|
MOZ_ASSERT(HasImageInfoAt(imageTarget, level));
|
|
|
|
ImageInfo& imageInfo = ImageInfoAt(imageTarget, level);
|
2014-11-14 04:03:50 +00:00
|
|
|
// There is no way to go from having image data to not having any.
|
2013-10-11 13:16:43 +00:00
|
|
|
MOZ_ASSERT(newStatus != WebGLImageDataStatus::NoImageData ||
|
|
|
|
imageInfo.mImageDataStatus == WebGLImageDataStatus::NoImageData);
|
2014-11-14 04:03:50 +00:00
|
|
|
|
|
|
|
if (imageInfo.mImageDataStatus != newStatus)
|
2013-10-11 13:16:43 +00:00
|
|
|
SetFakeBlackStatus(WebGLTextureFakeBlackStatus::Unknown);
|
2014-11-14 04:03:50 +00:00
|
|
|
|
2013-10-11 13:16:43 +00:00
|
|
|
imageInfo.mImageDataStatus = newStatus;
|
|
|
|
}
|
|
|
|
|
2014-10-15 02:10:15 +00:00
|
|
|
void EnsureNoUninitializedImageData(TexImageTarget imageTarget, GLint level);
|
2013-10-11 13:16:43 +00:00
|
|
|
|
2012-12-04 00:13:47 +00:00
|
|
|
protected:
|
2014-09-26 20:11:51 +00:00
|
|
|
TexMinFilter mMinFilter;
|
|
|
|
TexMagFilter mMagFilter;
|
|
|
|
TexWrap mWrapS, mWrapT;
|
2012-12-04 00:13:47 +00:00
|
|
|
|
|
|
|
size_t mFacesCount, mMaxLevelWithCustomImages;
|
|
|
|
nsTArray<ImageInfo> mImageInfos;
|
|
|
|
|
2014-11-14 04:03:50 +00:00
|
|
|
bool mHaveGeneratedMipmap; // Set by generateMipmap
|
|
|
|
bool mImmutable; // Set by texStorage*
|
2014-07-14 23:55:56 +00:00
|
|
|
|
2014-11-14 04:03:50 +00:00
|
|
|
size_t mBaseMipmapLevel; // Set by texParameter (defaults to 0)
|
|
|
|
size_t mMaxMipmapLevel; // Set by texParameter (defaults to 1000)
|
2014-10-16 20:07:01 +00:00
|
|
|
|
2013-10-11 13:16:43 +00:00
|
|
|
WebGLTextureFakeBlackStatus mFakeBlackStatus;
|
2012-12-04 00:13:47 +00:00
|
|
|
|
2014-11-14 04:03:50 +00:00
|
|
|
void EnsureMaxLevelWithCustomImagesAtLeast(size_t maxLevelWithCustomImages) {
|
|
|
|
mMaxLevelWithCustomImages = std::max(mMaxLevelWithCustomImages,
|
|
|
|
maxLevelWithCustomImages);
|
2012-12-04 00:13:47 +00:00
|
|
|
mImageInfos.EnsureLengthAtLeast((mMaxLevelWithCustomImages + 1) * mFacesCount);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool CheckFloatTextureFilterParams() const {
|
2014-11-14 04:03:50 +00:00
|
|
|
// Without OES_texture_float_linear, only NEAREST and
|
|
|
|
// NEAREST_MIMPAMP_NEAREST are supported.
|
|
|
|
return mMagFilter == LOCAL_GL_NEAREST &&
|
|
|
|
(mMinFilter == LOCAL_GL_NEAREST ||
|
|
|
|
mMinFilter == LOCAL_GL_NEAREST_MIPMAP_NEAREST);
|
2012-12-04 00:13:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool AreBothWrapModesClampToEdge() const {
|
2014-11-14 04:03:50 +00:00
|
|
|
return mWrapS == LOCAL_GL_CLAMP_TO_EDGE &&
|
|
|
|
mWrapT == LOCAL_GL_CLAMP_TO_EDGE;
|
2012-12-04 00:13:47 +00:00
|
|
|
}
|
|
|
|
|
2014-10-13 23:42:20 +00:00
|
|
|
bool DoesMipmapHaveAllLevelsConsistentlyDefined(TexImageTarget texImageTarget) const;
|
2012-12-04 00:13:47 +00:00
|
|
|
|
|
|
|
public:
|
2014-11-14 04:03:50 +00:00
|
|
|
void Bind(TexTarget texTarget);
|
2012-12-04 00:13:47 +00:00
|
|
|
|
2014-11-14 04:03:50 +00:00
|
|
|
void SetImageInfo(TexImageTarget target, GLint level, GLsizei width,
|
|
|
|
GLsizei height, GLsizei depth, TexInternalFormat format,
|
|
|
|
WebGLImageDataStatus status);
|
2012-12-04 00:13:47 +00:00
|
|
|
|
2014-11-14 04:03:50 +00:00
|
|
|
void SetMinFilter(TexMinFilter minFilter) {
|
|
|
|
mMinFilter = minFilter;
|
2013-10-11 13:16:43 +00:00
|
|
|
SetFakeBlackStatus(WebGLTextureFakeBlackStatus::Unknown);
|
2012-12-04 00:13:47 +00:00
|
|
|
}
|
2014-11-14 04:03:50 +00:00
|
|
|
void SetMagFilter(TexMagFilter magFilter) {
|
|
|
|
mMagFilter = magFilter;
|
2013-10-11 13:16:43 +00:00
|
|
|
SetFakeBlackStatus(WebGLTextureFakeBlackStatus::Unknown);
|
2012-12-04 00:13:47 +00:00
|
|
|
}
|
2014-11-14 04:03:50 +00:00
|
|
|
void SetWrapS(TexWrap wrapS) {
|
|
|
|
mWrapS = wrapS;
|
2013-10-11 13:16:43 +00:00
|
|
|
SetFakeBlackStatus(WebGLTextureFakeBlackStatus::Unknown);
|
2012-12-04 00:13:47 +00:00
|
|
|
}
|
2014-11-14 04:03:50 +00:00
|
|
|
void SetWrapT(TexWrap wrapT) {
|
|
|
|
mWrapT = wrapT;
|
2013-10-11 13:16:43 +00:00
|
|
|
SetFakeBlackStatus(WebGLTextureFakeBlackStatus::Unknown);
|
2012-12-04 00:13:47 +00:00
|
|
|
}
|
2014-09-26 20:11:51 +00:00
|
|
|
TexMinFilter MinFilter() const { return mMinFilter; }
|
2012-12-04 00:13:47 +00:00
|
|
|
|
|
|
|
bool DoesMinFilterRequireMipmap() const {
|
2014-11-14 04:03:50 +00:00
|
|
|
return !(mMinFilter == LOCAL_GL_NEAREST ||
|
|
|
|
mMinFilter == LOCAL_GL_LINEAR);
|
2012-12-04 00:13:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void SetGeneratedMipmap();
|
|
|
|
|
|
|
|
void SetCustomMipmap();
|
|
|
|
|
|
|
|
bool IsFirstImagePowerOfTwo() const {
|
2013-10-02 00:30:38 +00:00
|
|
|
return ImageInfoBase().IsPowerOfTwo();
|
2012-12-04 00:13:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool AreAllLevel0ImageInfosEqual() const;
|
|
|
|
|
2014-10-13 23:42:20 +00:00
|
|
|
bool IsMipmapComplete() const;
|
2012-12-04 00:13:47 +00:00
|
|
|
|
|
|
|
bool IsCubeComplete() const;
|
|
|
|
|
|
|
|
bool IsMipmapCubeComplete() const;
|
|
|
|
|
2014-04-30 21:30:21 +00:00
|
|
|
void SetFakeBlackStatus(WebGLTextureFakeBlackStatus x);
|
2014-05-07 03:11:18 +00:00
|
|
|
|
2014-07-14 23:55:56 +00:00
|
|
|
bool IsImmutable() const { return mImmutable; }
|
|
|
|
void SetImmutable() { mImmutable = true; }
|
|
|
|
|
2014-10-16 20:07:01 +00:00
|
|
|
void SetBaseMipmapLevel(size_t level) { mBaseMipmapLevel = level; }
|
|
|
|
void SetMaxMipmapLevel(size_t level) { mMaxMipmapLevel = level; }
|
|
|
|
|
|
|
|
// Clamping (from ES 3.0.4, section 3.8 - Texturing). When not immutable,
|
|
|
|
// the ranges must be guarded.
|
|
|
|
size_t EffectiveBaseMipmapLevel() const {
|
|
|
|
if (IsImmutable())
|
|
|
|
return std::min(mBaseMipmapLevel, mMaxLevelWithCustomImages);
|
|
|
|
return mBaseMipmapLevel;
|
|
|
|
}
|
|
|
|
size_t EffectiveMaxMipmapLevel() const {
|
2014-11-14 04:03:50 +00:00
|
|
|
if (IsImmutable()) {
|
|
|
|
return mozilla::clamped(mMaxMipmapLevel, EffectiveBaseMipmapLevel(),
|
|
|
|
mMaxLevelWithCustomImages);
|
|
|
|
}
|
2014-10-16 20:07:01 +00:00
|
|
|
return std::min(mMaxMipmapLevel, mMaxLevelWithCustomImages);
|
|
|
|
}
|
|
|
|
bool IsMipmapRangeValid() const;
|
|
|
|
|
2014-07-14 23:55:56 +00:00
|
|
|
size_t MaxLevelWithCustomImages() const { return mMaxLevelWithCustomImages; }
|
|
|
|
|
2013-10-11 13:16:43 +00:00
|
|
|
// Returns the current fake-black-status, except if it was Unknown,
|
|
|
|
// in which case this function resolves it first, so it never returns Unknown.
|
|
|
|
WebGLTextureFakeBlackStatus ResolvedFakeBlackStatus();
|
2012-12-04 00:13:47 +00:00
|
|
|
};
|
|
|
|
|
2014-07-14 23:55:56 +00:00
|
|
|
inline TexImageTarget
|
|
|
|
TexImageTargetForTargetAndFace(TexTarget target, size_t face)
|
|
|
|
{
|
2014-10-13 23:42:20 +00:00
|
|
|
switch (target.get()) {
|
2014-11-14 04:03:50 +00:00
|
|
|
case LOCAL_GL_TEXTURE_2D:
|
|
|
|
case LOCAL_GL_TEXTURE_3D:
|
|
|
|
MOZ_ASSERT(face == 0);
|
|
|
|
return target.get();
|
|
|
|
case LOCAL_GL_TEXTURE_CUBE_MAP:
|
|
|
|
MOZ_ASSERT(face < 6);
|
|
|
|
return LOCAL_GL_TEXTURE_CUBE_MAP_POSITIVE_X + face;
|
|
|
|
default:
|
|
|
|
MOZ_CRASH();
|
2014-10-13 23:42:20 +00:00
|
|
|
}
|
2014-07-14 23:55:56 +00:00
|
|
|
}
|
|
|
|
|
2012-12-04 00:13:47 +00:00
|
|
|
} // namespace mozilla
|
|
|
|
|
2014-11-14 04:03:50 +00:00
|
|
|
#endif // WEBGL_TEXTURE_H_
|