Bug 1075305 - WebGL2 - remove WebGL prefix from WebGLTexture::ImageInfo.; r=bjacob
--- a/dom/canvas/WebGLContextDraw.cpp
+++ b/dom/canvas/WebGLContextDraw.cpp
@@ -671,17 +671,17 @@ WebGLContext::BindFakeBlackTexturesHelpe
WebGLTextureFakeBlackStatus s = boundTexturesArray[i]->ResolvedFakeBlackStatus();
MOZ_ASSERT(s != WebGLTextureFakeBlackStatus::Unknown);
if (MOZ_LIKELY(s == WebGLTextureFakeBlackStatus::NotNeeded)) {
continue;
}
bool alpha = s == WebGLTextureFakeBlackStatus::UninitializedImageData &&
- FormatHasAlpha(boundTexturesArray[i]->ImageInfoBase().WebGLInternalFormat());
+ FormatHasAlpha(boundTexturesArray[i]->ImageInfoBase().InternalFormat());
UniquePtr<FakeBlackTexture>&
blackTexturePtr = alpha
? transparentTextureScopedPtr
: opaqueTextureScopedPtr;
if (!blackTexturePtr) {
GLenum format = alpha ? LOCAL_GL_RGBA : LOCAL_GL_RGB;
blackTexturePtr = MakeUnique<FakeBlackTexture>(gl, target, format);
--- a/dom/canvas/WebGLContextGL.cpp
+++ b/dom/canvas/WebGLContextGL.cpp
@@ -504,18 +504,18 @@ WebGLContext::CopyTexImage2D(GLenum rawT
// check if the memory size of this texture may change with this call
bool sizeMayChange = true;
WebGLTexture* tex = activeBoundTextureForTexImageTarget(texImageTarget);
if (tex->HasImageInfoAt(texImageTarget, level)) {
const WebGLTexture::ImageInfo& imageInfo = tex->ImageInfoAt(texImageTarget, level);
sizeMayChange = width != imageInfo.Width() ||
height != imageInfo.Height() ||
- internalformat != imageInfo.WebGLInternalFormat() ||
- type != imageInfo.WebGLType();
+ internalformat != imageInfo.InternalFormat() ||
+ type != imageInfo.Type();
}
if (sizeMayChange)
GetAndFlushUnderlyingGLErrors();
CopyTexSubImage2D_base(texImageTarget, level, format, 0, 0, x, y, width, height, false);
if (sizeMayChange) {
@@ -590,17 +590,17 @@ WebGLContext::CopyTexSubImage2D(GLenum r
if (!mBoundFramebuffer)
ClearBackbufferIfNeeded();
if (imageInfo.HasUninitializedImageData()) {
tex->DoDeferredImageInitialization(texImageTarget, level);
}
- return CopyTexSubImage2D_base(texImageTarget, level, imageInfo.WebGLInternalFormat().get(), xoffset, yoffset, x, y, width, height, true);
+ return CopyTexSubImage2D_base(texImageTarget, level, imageInfo.InternalFormat().get(), xoffset, yoffset, x, y, width, height, true);
}
already_AddRefed<WebGLProgram>
WebGLContext::CreateProgram()
{
if (IsContextLost())
return nullptr;
@@ -910,22 +910,22 @@ WebGLContext::GenerateMipmap(GLenum rawT
if (!tex->HasImageInfoAt(imageTarget, 0))
{
return ErrorInvalidOperation("generateMipmap: Level zero of texture is not defined.");
}
if (!tex->IsFirstImagePowerOfTwo())
return ErrorInvalidOperation("generateMipmap: Level zero of texture does not have power-of-two width and height.");
- TexInternalFormat webGLInternalFormat = tex->ImageInfoAt(imageTarget, 0).WebGLInternalFormat();
- if (IsTextureFormatCompressed(webGLInternalFormat))
+ TexInternalFormat internalformat = tex->ImageInfoAt(imageTarget, 0).InternalFormat();
+ if (IsTextureFormatCompressed(internalformat))
return ErrorInvalidOperation("generateMipmap: Texture data at level zero is compressed.");
if (IsExtensionEnabled(WebGLExtensionID::WEBGL_depth_texture) &&
- (IsGLDepthFormat(webGLInternalFormat) || IsGLDepthStencilFormat(webGLInternalFormat)))
+ (IsGLDepthFormat(internalformat) || IsGLDepthStencilFormat(internalformat)))
{
return ErrorInvalidOperation("generateMipmap: "
"A texture that has a base internal format of "
"DEPTH_COMPONENT or DEPTH_STENCIL isn't supported");
}
if (!tex->AreAllLevel0ImageInfosEqual())
return ErrorInvalidOperation("generateMipmap: The six faces of this cube map have different dimensions, format, or type.");
@@ -1171,20 +1171,20 @@ WebGLContext::GetFramebufferAttachmentPa
}
ErrorInvalidEnumInfo("getFramebufferAttachmentParameter: pname", pname);
return JS::NullValue();
} else if (fba.Texture()) {
switch (pname) {
case LOCAL_GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT:
if (IsExtensionEnabled(WebGLExtensionID::EXT_sRGB)) {
- const TexInternalFormat webGLInternalFormat =
- fba.Texture()->ImageInfoBase().WebGLInternalFormat();
- return (webGLInternalFormat == LOCAL_GL_SRGB ||
- webGLInternalFormat == LOCAL_GL_SRGB_ALPHA) ?
+ const TexInternalFormat internalformat =
+ fba.Texture()->ImageInfoBase().InternalFormat();
+ return (internalformat == LOCAL_GL_SRGB ||
+ internalformat == LOCAL_GL_SRGB_ALPHA) ?
JS::NumberValue(uint32_t(LOCAL_GL_SRGB)) :
JS::NumberValue(uint32_t(LOCAL_GL_LINEAR));
}
break;
case LOCAL_GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:
return JS::NumberValue(uint32_t(LOCAL_GL_TEXTURE));
@@ -1214,17 +1214,17 @@ WebGLContext::GetFramebufferAttachmentPa
return JS::NullValue();
}
if (!fba.IsComplete())
return JS::NumberValue(uint32_t(LOCAL_GL_NONE));
uint32_t ret = LOCAL_GL_NONE;
TexType type = fba.Texture()->ImageInfoAt(fba.ImageTarget(),
- fba.MipLevel()).WebGLType();
+ fba.MipLevel()).Type();
switch (type.get()) {
case LOCAL_GL_UNSIGNED_BYTE:
case LOCAL_GL_UNSIGNED_SHORT_4_4_4_4:
case LOCAL_GL_UNSIGNED_SHORT_5_5_5_1:
case LOCAL_GL_UNSIGNED_SHORT_5_6_5:
ret = LOCAL_GL_UNSIGNED_NORMALIZED;
break;
case LOCAL_GL_FLOAT:
@@ -3590,18 +3590,18 @@ GLenum WebGLContext::CheckedTexImage2D(T
MOZ_ASSERT(tex != nullptr, "no texture bound");
bool sizeMayChange = true;
if (tex->HasImageInfoAt(texImageTarget, level)) {
const WebGLTexture::ImageInfo& imageInfo = tex->ImageInfoAt(texImageTarget, level);
sizeMayChange = width != imageInfo.Width() ||
height != imageInfo.Height() ||
- format != imageInfo.WebGLInternalFormat() ||
- type != imageInfo.WebGLType();
+ format != imageInfo.InternalFormat() ||
+ type != imageInfo.Type();
}
// Convert to format and type required by OpenGL 'driver'.
GLenum driverType = DriverTypeFromType(gl, type);
GLenum driverInternalFormat = LOCAL_GL_NONE;
GLenum driverFormat = LOCAL_GL_NONE;
DriverFormatsFromFormatAndType(gl, format, type, &driverInternalFormat, &driverFormat);
--- a/dom/canvas/WebGLContextValidate.cpp
+++ b/dom/canvas/WebGLContextValidate.cpp
@@ -1405,18 +1405,18 @@ WebGLContext::ValidateTexImage(GLuint di
func))
{
return false;
}
/* Require the format and type to match that of the existing
* texture as created
*/
- if (imageInfo.WebGLInternalFormat() != internalFormat ||
- imageInfo.WebGLType() != type)
+ if (imageInfo.InternalFormat() != internalFormat ||
+ imageInfo.Type() != type)
{
ErrorInvalidOperation("%s: format or type doesn't match the existing texture",
info);
return false;
}
}
/* Additional checks for depth textures */
--- a/dom/canvas/WebGLFramebuffer.cpp
+++ b/dom/canvas/WebGLFramebuffer.cpp
@@ -75,48 +75,48 @@ WebGLFramebuffer::Attachment::IsDefined(
}
bool
WebGLFramebuffer::Attachment::HasAlpha() const
{
MOZ_ASSERT(HasImage());
if (Texture() && Texture()->HasImageInfoAt(mTexImageTarget, mTexImageLevel))
- return FormatHasAlpha(Texture()->ImageInfoAt(mTexImageTarget, mTexImageLevel).WebGLInternalFormat());
+ return FormatHasAlpha(Texture()->ImageInfoAt(mTexImageTarget, mTexImageLevel).InternalFormat());
else if (Renderbuffer())
return FormatHasAlpha(Renderbuffer()->InternalFormat());
else return false;
}
GLenum
WebGLFramebuffer::GetFormatForAttachment(const WebGLFramebuffer::Attachment& attachment) const
{
MOZ_ASSERT(attachment.IsDefined());
MOZ_ASSERT(attachment.Texture() || attachment.Renderbuffer());
if (attachment.Texture()) {
const WebGLTexture& tex = *attachment.Texture();
MOZ_ASSERT(tex.HasImageInfoAt(attachment.ImageTarget(), 0));
const WebGLTexture::ImageInfo& imgInfo = tex.ImageInfoAt(attachment.ImageTarget(), 0);
- return imgInfo.WebGLInternalFormat().get();
+ return imgInfo.InternalFormat().get();
}
if (attachment.Renderbuffer())
return attachment.Renderbuffer()->InternalFormat();
return LOCAL_GL_NONE;
}
bool
WebGLFramebuffer::Attachment::IsReadableFloat() const
{
const WebGLTexture* tex = Texture();
if (tex && tex->HasImageInfoAt(mTexImageTarget, mTexImageLevel)) {
- GLenum type = tex->ImageInfoAt(mTexImageTarget, mTexImageLevel).WebGLType().get();
+ GLenum type = tex->ImageInfoAt(mTexImageTarget, mTexImageLevel).Type().get();
switch (type) {
case LOCAL_GL_FLOAT:
case LOCAL_GL_HALF_FLOAT_OES:
return true;
}
return false;
}
@@ -326,33 +326,33 @@ WebGLFramebuffer::Attachment::IsComplete
{
return false;
}
if (Texture()) {
MOZ_ASSERT(Texture()->HasImageInfoAt(mTexImageTarget, mTexImageLevel));
const WebGLTexture::ImageInfo& imageInfo =
Texture()->ImageInfoAt(mTexImageTarget, mTexImageLevel);
- GLenum webGLFormat = imageInfo.WebGLInternalFormat().get();
+ GLenum internalformat = imageInfo.InternalFormat().get();
if (mAttachmentPoint == LOCAL_GL_DEPTH_ATTACHMENT)
- return IsValidFBOTextureDepthFormat(webGLFormat);
+ return IsValidFBOTextureDepthFormat(internalformat);
if (mAttachmentPoint == LOCAL_GL_STENCIL_ATTACHMENT)
return false; // Textures can't have the correct format for stencil buffers
if (mAttachmentPoint == LOCAL_GL_DEPTH_STENCIL_ATTACHMENT) {
- return IsValidFBOTextureDepthStencilFormat(webGLFormat);
+ return IsValidFBOTextureDepthStencilFormat(internalformat);
}
if (mAttachmentPoint >= LOCAL_GL_COLOR_ATTACHMENT0 &&
mAttachmentPoint <= FBAttachment(LOCAL_GL_COLOR_ATTACHMENT0 - 1 +
WebGLContext::kMaxColorAttachments))
{
- return IsValidFBOTextureColorFormat(webGLFormat);
+ return IsValidFBOTextureColorFormat(internalformat);
}
MOZ_ASSERT(false, "Invalid WebGL attachment point?");
return false;
}
if (Renderbuffer()) {
GLenum internalFormat = Renderbuffer()->InternalFormat();
--- a/dom/canvas/WebGLTexture.cpp
+++ b/dom/canvas/WebGLTexture.cpp
@@ -47,17 +47,17 @@ WebGLTexture::Delete() {
mContext->gl->fDeleteTextures(1, &mGLName);
LinkedListElement<WebGLTexture>::removeFrom(mContext->mTextures);
}
int64_t
WebGLTexture::ImageInfo::MemoryUsage() const {
if (mImageDataStatus == WebGLImageDataStatus::NoImageData)
return 0;
- int64_t bitsPerTexel = WebGLContext::GetBitsPerTexel(mWebGLInternalFormat, mWebGLType);
+ int64_t bitsPerTexel = WebGLContext::GetBitsPerTexel(mInternalFormat, mType);
return int64_t(mWidth) * int64_t(mHeight) * bitsPerTexel/8;
}
int64_t
WebGLTexture::MemoryUsage() const {
if (IsDeleted())
return 0;
int64_t result = 0;
@@ -331,17 +331,17 @@ WebGLTexture::ResolvedFakeBlackStatus()
mContext->GenerateWarning("%s is a cube map texture, with a minification filter not requiring a mipmap, "
"with some level 0 image having width or height not a power of two, and with a wrap mode "
"different from CLAMP_TO_EDGE.", msg_rendering_as_black);
mFakeBlackStatus = WebGLTextureFakeBlackStatus::IncompleteTexture;
}
}
}
- if (ImageInfoBase().mWebGLType == LOCAL_GL_FLOAT &&
+ if (ImageInfoBase().mType == LOCAL_GL_FLOAT &&
!Context()->IsExtensionEnabled(WebGLExtensionID::OES_texture_float_linear))
{
if (mMinFilter == LOCAL_GL_LINEAR ||
mMinFilter == LOCAL_GL_LINEAR_MIPMAP_LINEAR ||
mMinFilter == LOCAL_GL_LINEAR_MIPMAP_NEAREST ||
mMinFilter == LOCAL_GL_NEAREST_MIPMAP_LINEAR)
{
mContext->GenerateWarning("%s is a texture with a linear minification filter, "
@@ -351,17 +351,17 @@ WebGLTexture::ResolvedFakeBlackStatus()
}
else if (mMagFilter == LOCAL_GL_LINEAR)
{
mContext->GenerateWarning("%s is a texture with a linear magnification filter, "
"which is not compatible with gl.FLOAT by default. "
"Try enabling the OES_texture_float_linear extension if supported.", msg_rendering_as_black);
mFakeBlackStatus = WebGLTextureFakeBlackStatus::IncompleteTexture;
}
- } else if (ImageInfoBase().mWebGLType == LOCAL_GL_HALF_FLOAT_OES &&
+ } else if (ImageInfoBase().mType == LOCAL_GL_HALF_FLOAT_OES &&
!Context()->IsExtensionEnabled(WebGLExtensionID::OES_texture_half_float_linear))
{
if (mMinFilter == LOCAL_GL_LINEAR ||
mMinFilter == LOCAL_GL_LINEAR_MIPMAP_LINEAR ||
mMinFilter == LOCAL_GL_LINEAR_MIPMAP_NEAREST ||
mMinFilter == LOCAL_GL_NEAREST_MIPMAP_LINEAR)
{
mContext->GenerateWarning("%s is a texture with a linear minification filter, "
@@ -538,18 +538,18 @@ void
WebGLTexture::DoDeferredImageInitialization(TexImageTarget imageTarget, GLint level)
{
const ImageInfo& imageInfo = ImageInfoAt(imageTarget, level);
MOZ_ASSERT(imageInfo.mImageDataStatus == WebGLImageDataStatus::UninitializedImageData);
mContext->MakeContextCurrent();
// Try to clear with glCLear.
- TexInternalFormat internalformat = imageInfo.mWebGLInternalFormat;
- TexType type = imageInfo.mWebGLType;
+ TexInternalFormat internalformat = imageInfo.mInternalFormat;
+ TexType type = imageInfo.mType;
WebGLTexelFormat texelformat = GetWebGLTexelFormat(internalformat, type);
bool cleared = ClearWithTempFB(mContext, GLName(),
imageTarget, level,
internalformat, imageInfo.mHeight, imageInfo.mWidth);
if (cleared) {
SetImageDataStatus(imageTarget, level, WebGLImageDataStatus::InitializedImageData);
return;
--- a/dom/canvas/WebGLTexture.h
+++ b/dom/canvas/WebGLTexture.h
@@ -62,41 +62,41 @@ protected:
public:
class ImageInfo
: public WebGLRectangleObject
{
public:
ImageInfo()
- : mWebGLInternalFormat(LOCAL_GL_NONE)
- , mWebGLType(LOCAL_GL_NONE)
+ : mInternalFormat(LOCAL_GL_NONE)
+ , mType(LOCAL_GL_NONE)
, mImageDataStatus(WebGLImageDataStatus::NoImageData)
{}
ImageInfo(GLsizei width,
GLsizei height,
- TexInternalFormat webGLInternalFormat,
- TexType webGLType,
+ TexInternalFormat internalFormat,
+ TexType type,
WebGLImageDataStatus status)
: WebGLRectangleObject(width, height)
- , mWebGLInternalFormat(webGLInternalFormat)
- , mWebGLType(webGLType)
+ , mInternalFormat(internalFormat)
+ , mType(type)
, mImageDataStatus(status)
{
// shouldn't use this constructor to construct a null ImageInfo
MOZ_ASSERT(status != WebGLImageDataStatus::NoImageData);
}
bool operator==(const ImageInfo& a) const {
return mImageDataStatus == a.mImageDataStatus &&
mWidth == a.mWidth &&
mHeight == a.mHeight &&
- mWebGLInternalFormat == a.mWebGLInternalFormat &&
- mWebGLType == a.mWebGLType;
+ mInternalFormat == a.mInternalFormat &&
+ mType == a.mType;
}
bool operator!=(const ImageInfo& a) const {
return !(*this == a);
}
bool IsSquare() const {
return mWidth == mHeight;
}
bool IsPositive() const {
@@ -109,27 +109,27 @@ public:
bool HasUninitializedImageData() const {
return mImageDataStatus == WebGLImageDataStatus::UninitializedImageData;
}
int64_t MemoryUsage() const;
/*! This is the format passed from JS to WebGL.
* It can be converted to a value to be passed to driver with
* DriverFormatsFromFormatAndType().
*/
- TexInternalFormat WebGLInternalFormat() const { return mWebGLInternalFormat; }
+ TexInternalFormat InternalFormat() const { return mInternalFormat; }
/*! This is the type passed from JS to WebGL.
* It can be converted to a value to be passed to driver with
* DriverTypeFromType().
*/
- TexType WebGLType() const { return mWebGLType; }
+ TexType Type() const { return mType; }
protected:
- TexInternalFormat mWebGLInternalFormat; //!< This is the WebGL/GLES internal format.
- TexType mWebGLType; //!< This is the WebGL/GLES type
+ TexInternalFormat mInternalFormat; //!< This is the WebGL/GLES internal format.
+ TexType mType; //!< This is the WebGL/GLES type
WebGLImageDataStatus mImageDataStatus;
friend class WebGLTexture;
};
private:
static size_t FaceForTarget(TexImageTarget texImageTarget) {
if (texImageTarget == LOCAL_GL_TEXTURE_2D)