Backed out changeset 9024f38e3809 (bug 843666) for bustage.

This commit is contained in:
Ryan VanderMeulen 2014-03-03 11:21:10 -05:00
Родитель 228e7a6ebc
Коммит 88addeaaa1
17 изменённых файлов: 29 добавлений и 378 удалений

Просмотреть файл

@ -895,7 +895,6 @@ protected:
// -------------------------------------------------------------------------
// WebGL extensions (implemented in WebGLContextExtensions.cpp)
enum WebGLExtensionID {
EXT_color_buffer_half_float,
EXT_frag_depth,
EXT_sRGB,
EXT_texture_filter_anisotropic,
@ -906,7 +905,6 @@ protected:
OES_texture_half_float,
OES_texture_half_float_linear,
OES_vertex_array_object,
WEBGL_color_buffer_float,
WEBGL_compressed_texture_atc,
WEBGL_compressed_texture_pvrtc,
WEBGL_compressed_texture_s3tc,
@ -935,6 +933,7 @@ protected:
nsTArray<GLenum> mCompressedTextureFormats;
// -------------------------------------------------------------------------
// WebGL 2 specifics (implemented in WebGL2Context.cpp)

Просмотреть файл

@ -17,7 +17,6 @@ using namespace mozilla::gl;
// must match WebGLContext::WebGLExtensionID
static const char *sExtensionNames[] = {
"EXT_color_buffer_half_float",
"EXT_frag_depth",
"EXT_sRGB",
"EXT_texture_filter_anisotropic",
@ -28,7 +27,6 @@ static const char *sExtensionNames[] = {
"OES_texture_half_float",
"OES_texture_half_float_linear",
"OES_vertex_array_object",
"WEBGL_color_buffer_float",
"WEBGL_compressed_texture_atc",
"WEBGL_compressed_texture_pvrtc",
"WEBGL_compressed_texture_s3tc",
@ -110,10 +108,6 @@ bool WebGLContext::IsExtensionSupported(WebGLExtensionID ext) const
gl->IsSupported(GLFeature::texture_half_float);
case OES_texture_half_float_linear:
return gl->IsSupported(GLFeature::texture_half_float_linear);
case WEBGL_color_buffer_float:
return WebGLExtensionColorBufferFloat::IsSupported(this);
case EXT_color_buffer_half_float:
return WebGLExtensionColorBufferHalfFloat::IsSupported(this);
case OES_vertex_array_object:
return WebGLExtensionVertexArray::IsSupported(this);
case EXT_texture_filter_anisotropic:
@ -292,12 +286,6 @@ WebGLContext::EnableExtension(WebGLExtensionID ext)
case OES_texture_half_float_linear:
obj = new WebGLExtensionTextureHalfFloatLinear(this);
break;
case WEBGL_color_buffer_float:
obj = new WebGLExtensionColorBufferFloat(this);
break;
case EXT_color_buffer_half_float:
obj = new WebGLExtensionColorBufferHalfFloat(this);
break;
case WEBGL_draw_buffers:
obj = new WebGLExtensionDrawBuffers(this);
break;

Просмотреть файл

@ -1394,47 +1394,8 @@ WebGLContext::GetFramebufferAttachmentParameter(JSContext* cx,
return JS::NumberValue(uint32_t(LOCAL_GL_RENDERBUFFER));
case LOCAL_GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:
{
return WebGLObjectAsJSValue(cx, fba.Renderbuffer(), rv);
case LOCAL_GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE: {
if (!IsExtensionEnabled(EXT_color_buffer_half_float) &&
!IsExtensionEnabled(WEBGL_color_buffer_float))
{
break;
}
if (attachment == LOCAL_GL_DEPTH_STENCIL_ATTACHMENT) {
ErrorInvalidOperation("getFramebufferAttachmentParameter: Cannot get component"
" type of a depth-stencil attachment.");
return JS::NullValue();
}
if (!fba.IsComplete())
return JS::NumberValue(uint32_t(LOCAL_GL_NONE));
uint32_t ret = LOCAL_GL_NONE;
switch (fba.Renderbuffer()->InternalFormat()) {
case LOCAL_GL_RGBA4:
case LOCAL_GL_RGB5_A1:
case LOCAL_GL_RGB565:
case LOCAL_GL_SRGB8_ALPHA8:
ret = LOCAL_GL_UNSIGNED_NORMALIZED;
break;
case LOCAL_GL_RGB16F:
case LOCAL_GL_RGBA16F:
case LOCAL_GL_RGB32F:
case LOCAL_GL_RGBA32F:
ret = LOCAL_GL_FLOAT;
break;
case LOCAL_GL_DEPTH_COMPONENT16:
case LOCAL_GL_STENCIL_INDEX8:
ret = LOCAL_GL_UNSIGNED_INT;
break;
default:
MOZ_ASSERT(false, "Unhandled RB component type.");
break;
}
return JS::NumberValue(uint32_t(ret));
}
}
@ -1457,58 +1418,20 @@ WebGLContext::GetFramebufferAttachmentParameter(JSContext* cx,
return JS::NumberValue(uint32_t(LOCAL_GL_TEXTURE));
case LOCAL_GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:
{
return WebGLObjectAsJSValue(cx, fba.Texture(), rv);
}
case LOCAL_GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL:
return JS::Int32Value(fba.TexImageLevel());
case LOCAL_GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: {
case LOCAL_GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE:
{
GLenum face = fba.TexImageTarget();
if (face == LOCAL_GL_TEXTURE_2D)
face = 0;
return JS::Int32Value(face);
}
case LOCAL_GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE: {
if (!IsExtensionEnabled(EXT_color_buffer_half_float) &&
!IsExtensionEnabled(WEBGL_color_buffer_float))
{
break;
}
if (attachment == LOCAL_GL_DEPTH_STENCIL_ATTACHMENT) {
ErrorInvalidOperation("getFramebufferAttachmentParameter: cannot component"
" type of depth-stencil attachments.");
return JS::NullValue();
}
if (!fba.IsComplete())
return JS::NumberValue(uint32_t(LOCAL_GL_NONE));
uint32_t ret = LOCAL_GL_NONE;
GLenum type = fba.Texture()->ImageInfoAt(fba.TexImageTarget(),
fba.TexImageLevel()).Type();
switch (type) {
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:
case LOCAL_GL_HALF_FLOAT_OES:
ret = LOCAL_GL_FLOAT;
break;
case LOCAL_GL_UNSIGNED_SHORT:
case LOCAL_GL_UNSIGNED_INT:
ret = LOCAL_GL_UNSIGNED_INT;
break;
default:
MOZ_ASSERT(false, "Unhandled RB component type.");
break;
}
return JS::NumberValue(uint32_t(ret));
}
}
ErrorInvalidEnumInfo("getFramebufferAttachmentParameter: pname", pname);
@ -2295,8 +2218,9 @@ WebGLContext::ReadPixels(GLint x, GLint y, GLsizei width,
GLenum type, const Nullable<ArrayBufferView> &pixels,
ErrorResult& rv)
{
if (IsContextLost())
if (IsContextLost()) {
return;
}
if (mCanvasElement->IsWriteOnly() && !nsContentUtils::IsCallerChrome()) {
GenerateWarning("readPixels: Not allowed");
@ -2334,34 +2258,20 @@ WebGLContext::ReadPixels(GLint x, GLint y, GLsizei width,
int requiredDataType = 0;
// Check the type param
bool isReadTypeValid = false;
bool isReadTypeFloat = false;
switch (type) {
case LOCAL_GL_UNSIGNED_BYTE:
isReadTypeValid = true;
bytesPerPixel = 1*channels;
bytesPerPixel = 1 * channels;
requiredDataType = js::ArrayBufferView::TYPE_UINT8;
break;
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:
isReadTypeValid = true;
bytesPerPixel = 2;
requiredDataType = js::ArrayBufferView::TYPE_UINT16;
break;
case LOCAL_GL_FLOAT:
if (IsExtensionEnabled(WEBGL_color_buffer_float) ||
IsExtensionEnabled(EXT_color_buffer_half_float))
{
isReadTypeValid = true;
isReadTypeFloat = true;
bytesPerPixel = 4*channels;
requiredDataType = js::ArrayBufferView::TYPE_FLOAT32;
}
break;
default:
return ErrorInvalidEnum("readPixels: Bad type");
}
if (!isReadTypeValid)
return ErrorInvalidEnum("readPixels: Bad type", type);
int dataType = JS_GetArrayBufferViewType(pixels.Value().Obj());
@ -2391,25 +2301,12 @@ WebGLContext::ReadPixels(GLint x, GLint y, GLsizei width,
return rv.Throw(NS_ERROR_OUT_OF_MEMORY);
}
bool isSourceTypeFloat = false;
if (mBoundFramebuffer &&
mBoundFramebuffer->ColorAttachmentCount() &&
mBoundFramebuffer->ColorAttachment(0).IsDefined())
{
isSourceTypeFloat = mBoundFramebuffer->ColorAttachment(0).IsReadableFloat();
}
if (isReadTypeFloat != isSourceTypeFloat)
return ErrorInvalidOperation("readPixels: Invalid type floatness");
// Check the format and type params to assure they are an acceptable pair (as per spec)
switch (format) {
case LOCAL_GL_RGBA: {
switch (type) {
case LOCAL_GL_UNSIGNED_BYTE:
break;
case LOCAL_GL_FLOAT:
break;
default:
return ErrorInvalidOperation("readPixels: Invalid format/type pair");
}
@ -2537,20 +2434,6 @@ WebGLContext::ReadPixels(GLint x, GLint y, GLsizei width,
rowp += 4;
}
row += checked_alignedRowSize.value();
}
} else if (format == LOCAL_GL_RGBA && type == LOCAL_GL_FLOAT) {
float* row = static_cast<float*>(data);
for (GLint j = 0; j < height; ++j) {
float* pAlpha = row + 3;
float* pAlphaEnd = pAlpha + 4*width;
while (pAlpha != pAlphaEnd) {
*pAlpha = 1.0f;
pAlpha += 4;
}
row += checked_alignedRowSize.value();
}
} else {
@ -2606,22 +2489,6 @@ WebGLContext::RenderbufferStorage(GLenum target, GLenum internalformat, GLsizei
break;
case LOCAL_GL_SRGB8_ALPHA8_EXT:
break;
case LOCAL_GL_RGB16F:
case LOCAL_GL_RGBA16F: {
bool hasExtensions = IsExtensionEnabled(OES_texture_half_float) &&
IsExtensionEnabled(EXT_color_buffer_half_float);
if (!hasExtensions)
return ErrorInvalidEnumInfo("renderbufferStorage: internalformat", target);
break;
}
case LOCAL_GL_RGB32F:
case LOCAL_GL_RGBA32F: {
bool hasExtensions = IsExtensionEnabled(OES_texture_float) &&
IsExtensionEnabled(WEBGL_color_buffer_float);
if (!hasExtensions)
return ErrorInvalidEnumInfo("renderbufferStorage: internalformat", target);
break;
}
default:
return ErrorInvalidEnumInfo("renderbufferStorage: internalformat", internalformat);
}
@ -3765,12 +3632,8 @@ GLenum WebGLContext::CheckedTexImage2D(GLenum target,
// convert type for half float if not on GLES2
GLenum realType = type;
if (realType == LOCAL_GL_HALF_FLOAT_OES) {
if (gl->IsSupported(gl::GLFeature::texture_half_float)) {
realType = LOCAL_GL_HALF_FLOAT;
} else {
MOZ_ASSERT(gl->IsExtensionSupported(gl::GLContext::OES_texture_half_float));
}
if (realType == LOCAL_GL_HALF_FLOAT_OES && !gl->IsGLES2()) {
realType = LOCAL_GL_HALF_FLOAT;
}
if (sizeMayChange) {
@ -4025,13 +3888,8 @@ WebGLContext::TexSubImage2D_base(GLenum target, GLint level,
// convert type for half float if not on GLES2
GLenum realType = type;
if (realType == LOCAL_GL_HALF_FLOAT_OES) {
if (gl->IsSupported(gl::GLFeature::texture_half_float)) {
realType = LOCAL_GL_HALF_FLOAT;
} else {
MOZ_ASSERT(gl->IsExtensionSupported(gl::GLContext::OES_texture_half_float));
}
}
if (realType == LOCAL_GL_HALF_FLOAT_OES && !gl->IsGLES2())
realType = LOCAL_GL_HALF_FLOAT;
if (actualSrcFormat == dstFormat &&
srcPremultiplied == mPixelStorePremultiplyAlpha &&

Просмотреть файл

@ -1,28 +0,0 @@
/* 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/. */
#include "WebGLContext.h"
#include "WebGLExtensions.h"
#include "mozilla/dom/WebGLRenderingContextBinding.h"
using namespace mozilla;
WebGLExtensionColorBufferFloat::WebGLExtensionColorBufferFloat(WebGLContext* context)
: WebGLExtensionBase(context)
{
MOZ_ASSERT(IsSupported(context));
}
WebGLExtensionColorBufferFloat::~WebGLExtensionColorBufferFloat()
{
}
bool
WebGLExtensionColorBufferFloat::IsSupported(const WebGLContext* context)
{
return context->GL()->IsSupported(gl::GLFeature::renderbuffer_color_float) &&
context->GL()->IsSupported(gl::GLFeature::frag_color_float);
}
IMPL_WEBGL_EXTENSION_GOOP(WebGLExtensionColorBufferFloat)

Просмотреть файл

@ -1,28 +0,0 @@
/* 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/. */
#include "WebGLContext.h"
#include "WebGLExtensions.h"
#include "mozilla/dom/WebGLRenderingContextBinding.h"
using namespace mozilla;
WebGLExtensionColorBufferHalfFloat::WebGLExtensionColorBufferHalfFloat(WebGLContext* context)
: WebGLExtensionBase(context)
{
MOZ_ASSERT(IsSupported(context));
}
WebGLExtensionColorBufferHalfFloat::~WebGLExtensionColorBufferHalfFloat()
{
}
bool
WebGLExtensionColorBufferHalfFloat::IsSupported(const WebGLContext* context)
{
return context->GL()->IsSupported(gl::GLFeature::renderbuffer_color_half_float) &&
context->GL()->IsSupported(gl::GLFeature::frag_color_float);
}
IMPL_WEBGL_EXTENSION_GOOP(WebGLExtensionColorBufferHalfFloat)

Просмотреть файл

@ -205,30 +205,6 @@ public:
DECL_WEBGL_EXTENSION_GOOP
};
class WebGLExtensionColorBufferFloat
: public WebGLExtensionBase
{
public:
WebGLExtensionColorBufferFloat(WebGLContext*);
virtual ~WebGLExtensionColorBufferFloat();
static bool IsSupported(const WebGLContext*);
DECL_WEBGL_EXTENSION_GOOP
};
class WebGLExtensionColorBufferHalfFloat
: public WebGLExtensionBase
{
public:
WebGLExtensionColorBufferHalfFloat(WebGLContext*);
virtual ~WebGLExtensionColorBufferHalfFloat();
static bool IsSupported(const WebGLContext*);
DECL_WEBGL_EXTENSION_GOOP
};
class WebGLExtensionDrawBuffers
: public WebGLExtensionBase
{

Просмотреть файл

@ -60,35 +60,6 @@ WebGLFramebuffer::Attachment::HasAlpha() const
return FormatHasAlpha(format);
}
bool
WebGLFramebuffer::Attachment::IsReadableFloat() const
{
if (Texture() && Texture()->HasImageInfoAt(mTexImageTarget, mTexImageLevel)) {
GLenum type = Texture()->ImageInfoAt(mTexImageTarget, mTexImageLevel).Type();
switch (type) {
case LOCAL_GL_FLOAT:
case LOCAL_GL_HALF_FLOAT_OES:
return true;
}
return false;
}
if (Renderbuffer()) {
GLenum format = Renderbuffer()->InternalFormat();
switch (format) {
case LOCAL_GL_RGB16F:
case LOCAL_GL_RGBA16F:
case LOCAL_GL_RGB32F:
case LOCAL_GL_RGBA32F:
return true;
}
return false;
}
MOZ_ASSERT(false, "Should not get here.");
return false;
}
void
WebGLFramebuffer::Attachment::SetTexImage(WebGLTexture* tex, GLenum target, GLint level)
{

Просмотреть файл

@ -53,7 +53,6 @@ public:
bool IsDeleteRequested() const;
bool HasAlpha() const;
bool IsReadableFloat() const;
void SetTexImage(WebGLTexture* tex, GLenum target, GLint level);
void SetRenderbuffer(WebGLRenderbuffer* rb) {

Просмотреть файл

@ -95,13 +95,13 @@ WebGLRenderbuffer::MemoryUsage() const {
int64_t primarySize = 0;
switch (primaryFormat) {
case LOCAL_GL_STENCIL_INDEX8:
primarySize = 1*pixels;
primarySize = 1 * pixels;
break;
case LOCAL_GL_RGBA4:
case LOCAL_GL_RGB5_A1:
case LOCAL_GL_RGB565:
case LOCAL_GL_DEPTH_COMPONENT16:
primarySize = 2*pixels;
primarySize = 2 * pixels;
break;
case LOCAL_GL_RGB8:
case LOCAL_GL_DEPTH_COMPONENT24:
@ -113,18 +113,6 @@ WebGLRenderbuffer::MemoryUsage() const {
case LOCAL_GL_DEPTH_COMPONENT32:
primarySize = 4*pixels;
break;
case LOCAL_GL_RGB16F:
primarySize = 2*3*pixels;
break;
case LOCAL_GL_RGBA16F:
primarySize = 2*4*pixels;
break;
case LOCAL_GL_RGB32F:
primarySize = 4*3*pixels;
break;
case LOCAL_GL_RGBA32F:
primarySize = 4*4*pixels;
break;
default:
MOZ_ASSERT(false, "Unknown `primaryFormat`.");
break;

Просмотреть файл

@ -49,8 +49,8 @@ int64_t
WebGLTexture::ImageInfo::MemoryUsage() const {
if (mImageDataStatus == WebGLImageDataStatus::NoImageData)
return 0;
int64_t bitsPerTexel = WebGLContext::GetBitsPerTexel(mInternalFormat, mType);
return int64_t(mWidth) * int64_t(mHeight) * bitsPerTexel/8;
int64_t texelSizeInBits = WebGLContext::GetBitsPerTexel(mInternalFormat, mType);
return int64_t(mWidth) * int64_t(mHeight) * texelSizeInBits / 8;
}
int64_t

Просмотреть файл

@ -44,8 +44,6 @@ if CONFIG['MOZ_WEBGL']:
'WebGLContextVertices.cpp',
'WebGLElementArrayCache.cpp',
'WebGLExtensionBase.cpp',
'WebGLExtensionColorBufferFloat.cpp',
'WebGLExtensionColorBufferHalfFloat.cpp',
'WebGLExtensionCompressedTextureATC.cpp',
'WebGLExtensionCompressedTexturePVRTC.cpp',
'WebGLExtensionCompressedTextureS3TC.cpp',

Просмотреть файл

@ -1343,16 +1343,6 @@ DOMInterfaces = {
'headerFile': 'WebGLExtensions.h'
},
'WebGLExtensionColorBufferFloat': {
'nativeType': 'mozilla::WebGLExtensionColorBufferFloat',
'headerFile': 'WebGLExtensions.h'
},
'WebGLExtensionColorBufferHalfFloat': {
'nativeType': 'mozilla::WebGLExtensionColorBufferHalfFloat',
'headerFile': 'WebGLExtensions.h'
},
'WebGLExtensionDrawBuffers': {
'nativeType': 'mozilla::WebGLExtensionDrawBuffers',
'headerFile': 'WebGLExtensions.h'

Просмотреть файл

@ -917,24 +917,6 @@ interface WebGLExtensionTextureHalfFloatLinear
{
};
[NoInterfaceObject]
interface WebGLExtensionColorBufferFloat
{
const GLenum RGBA32F_EXT = 0x8814;
const GLenum RGB32F_EXT = 0x8815;
const GLenum FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT = 0x8211;
const GLenum UNSIGNED_NORMALIZED_EXT = 0x8C17;
};
[NoInterfaceObject]
interface WebGLExtensionColorBufferHalfFloat
{
const GLenum RGBA16F_EXT = 0x881A;
const GLenum RGB16F_EXT = 0x881B;
const GLenum FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT = 0x8211;
const GLenum UNSIGNED_NORMALIZED_EXT = 0x8C17;
};
[NoInterfaceObject]
interface WebGLExtensionVertexArray {
const GLenum VERTEX_ARRAY_BINDING_OES = 0x85B5;

Просмотреть файл

@ -86,9 +86,6 @@ static const char *sExtensionNames[] = {
"GL_OES_texture_half_float",
"GL_OES_texture_half_float_linear",
"GL_NV_half_float",
"GL_EXT_color_buffer_float",
"GL_EXT_color_buffer_half_float",
"GL_ARB_color_buffer_float",
"GL_EXT_unpack_subimage",
"GL_OES_standard_derivatives",
"GL_EXT_texture_filter_anisotropic",

Просмотреть файл

@ -90,7 +90,6 @@ MOZ_BEGIN_ENUM_CLASS(GLFeature)
element_index_uint,
ES2_compatibility,
ES3_compatibility,
frag_color_float,
frag_depth,
framebuffer_blit,
framebuffer_multisample,
@ -103,8 +102,6 @@ MOZ_BEGIN_ENUM_CLASS(GLFeature)
occlusion_query2,
packed_depth_stencil,
query_objects,
renderbuffer_color_float,
renderbuffer_color_half_float,
robustness,
sRGB,
standard_derivatives,
@ -368,9 +365,6 @@ public:
OES_texture_half_float,
OES_texture_half_float_linear,
NV_half_float,
EXT_color_buffer_float,
EXT_color_buffer_half_float,
ARB_color_buffer_float,
EXT_unpack_subimage,
OES_standard_derivatives,
EXT_texture_filter_anisotropic,

Просмотреть файл

@ -111,18 +111,6 @@ static const FeatureInfo sFeatureInfoArr[] = {
GLContext::Extensions_End
}
},
{
// Removes clamping for float color outputs from frag shaders.
"frag_color_float",
300, // OpenGL version
300, // OpenGL ES version
{
GLContext::ARB_color_buffer_float,
GLContext::EXT_color_buffer_float,
GLContext::EXT_color_buffer_half_float,
GLContext::Extensions_End
}
},
{
"frag_depth",
200, // OpenGL version
@ -264,26 +252,6 @@ static const FeatureInfo sFeatureInfoArr[] = {
* (added in OpenGL ES 3.0)
*/
},
{
"renderbuffer_float",
300, // OpenGL version
300, // OpenGL ES version
{
GLContext::ARB_texture_float,
GLContext::EXT_color_buffer_float,
GLContext::Extensions_End
}
},
{
"renderbuffer_half_float",
300, // OpenGL version
300, // OpenGL ES version
{
GLContext::ARB_texture_float,
GLContext::EXT_color_buffer_half_float,
GLContext::Extensions_End
}
},
{
"robustness",
0, // OpenGL version
@ -314,7 +282,7 @@ static const FeatureInfo sFeatureInfoArr[] = {
},
{
"texture_float",
300, // OpenGL version
310, // OpenGL version
300, // OpenGL ES version
{
GLContext::ARB_texture_float,
@ -334,7 +302,7 @@ static const FeatureInfo sFeatureInfoArr[] = {
},
{
"texture_half_float",
300, // OpenGL version
310, // OpenGL version
300, // OpenGL ES version
{
GLContext::ARB_half_float_pixel,

Просмотреть файл

@ -14,8 +14,7 @@ NS_IMPL_ISUPPORTS1(GfxTexturesReporter, nsIMemoryReporter)
int64_t GfxTexturesReporter::sAmount = 0;
static uint32_t
GetBitsPerTexel(GLenum format, GLenum type)
static uint32_t GetBitsPerTexel(GLenum format, GLenum type)
{
// If there is no defined format or type, we're not taking up any memory
if (!format || !type) {
@ -24,16 +23,16 @@ GetBitsPerTexel(GLenum format, GLenum type)
if (format == LOCAL_GL_DEPTH_COMPONENT) {
if (type == LOCAL_GL_UNSIGNED_SHORT)
return 2*8;
return 2;
else if (type == LOCAL_GL_UNSIGNED_INT)
return 4*8;
return 4;
} else if (format == LOCAL_GL_DEPTH_STENCIL) {
if (type == LOCAL_GL_UNSIGNED_INT_24_8_EXT)
return 4*8;
return 4;
}
if (type == LOCAL_GL_UNSIGNED_BYTE || type == LOCAL_GL_FLOAT) {
uint32_t multiplier = type == LOCAL_GL_FLOAT ? 32 : 8;
int multiplier = type == LOCAL_GL_FLOAT ? 32 : 8;
switch (format) {
case LOCAL_GL_ALPHA:
case LOCAL_GL_LUMINANCE:
@ -65,7 +64,7 @@ GetBitsPerTexel(GLenum format, GLenum type)
type == LOCAL_GL_UNSIGNED_SHORT_5_5_5_1 ||
type == LOCAL_GL_UNSIGNED_SHORT_5_6_5)
{
return 2*8;
return 16;
}
MOZ_ASSERT(false);
@ -76,8 +75,8 @@ GetBitsPerTexel(GLenum format, GLenum type)
GfxTexturesReporter::UpdateAmount(MemoryUse action, GLenum format,
GLenum type, uint16_t tileSize)
{
int64_t bitsPerTexel = GetBitsPerTexel(format, type);
int64_t bytes = int64_t(tileSize) * int64_t(tileSize) * bitsPerTexel/8;
uint32_t bytesPerTexel = GetBitsPerTexel(format, type) / 8;
int64_t bytes = (int64_t)(tileSize * tileSize * bytesPerTexel);
if (action == MemoryFreed) {
sAmount -= bytes;
} else {