зеркало из https://github.com/mozilla/pjs.git
Backout ba7cf6fd10ae (bug 728017) for failing to compile
This commit is contained in:
Родитель
fa4f7f1833
Коммит
39725f8eb1
|
@ -69,7 +69,6 @@ CPPSRCS = \
|
|||
DocumentRendererParent.cpp \
|
||||
DocumentRendererChild.cpp \
|
||||
ImageData.cpp \
|
||||
WebGLExtensionCompressedTextureS3TC.cpp \
|
||||
$(NULL)
|
||||
|
||||
ifdef MOZ_WEBGL
|
||||
|
|
|
@ -883,13 +883,10 @@ bool WebGLContext::IsExtensionSupported(WebGLExtensionID ei)
|
|||
case WebGL_EXT_texture_filter_anisotropic:
|
||||
isSupported = gl->IsExtensionSupported(GLContext::EXT_texture_filter_anisotropic);
|
||||
break;
|
||||
case WebGL_WEBGL_lose_context:
|
||||
case WebGL_MOZ_WEBGL_lose_context:
|
||||
// We always support this extension.
|
||||
isSupported = true;
|
||||
break;
|
||||
case WebGL_WEBGL_compressed_texture_s3tc:
|
||||
isSupported = gl->IsExtensionSupported(GLContext::EXT_texture_compression_s3tc);
|
||||
break;
|
||||
default:
|
||||
isSupported = false;
|
||||
}
|
||||
|
@ -930,12 +927,8 @@ WebGLContext::GetExtension(const nsAString& aName)
|
|||
ei = WebGL_EXT_texture_filter_anisotropic;
|
||||
}
|
||||
else if (aName.EqualsLiteral("MOZ_WEBGL_lose_context")) {
|
||||
if (IsExtensionSupported(WebGL_WEBGL_lose_context))
|
||||
ei = WebGL_WEBGL_lose_context;
|
||||
}
|
||||
else if (aName.EqualsLiteral("MOZ_WEBGL_compressed_texture_s3tc")) {
|
||||
if (IsExtensionSupported(WebGL_WEBGL_compressed_texture_s3tc))
|
||||
ei = WebGL_WEBGL_compressed_texture_s3tc;
|
||||
if (IsExtensionSupported(WebGL_MOZ_WEBGL_lose_context))
|
||||
ei = WebGL_MOZ_WEBGL_lose_context;
|
||||
}
|
||||
|
||||
if (ei != WebGLExtensionID_Max) {
|
||||
|
@ -947,12 +940,9 @@ WebGLContext::GetExtension(const nsAString& aName)
|
|||
case WebGL_EXT_texture_filter_anisotropic:
|
||||
mEnabledExtensions[ei] = new WebGLExtensionTextureFilterAnisotropic(this);
|
||||
break;
|
||||
case WebGL_WEBGL_lose_context:
|
||||
case WebGL_MOZ_WEBGL_lose_context:
|
||||
mEnabledExtensions[ei] = new WebGLExtensionLoseContext(this);
|
||||
break;
|
||||
case WebGL_WEBGL_compressed_texture_s3tc:
|
||||
mEnabledExtensions[ei] = new WebGLExtensionCompressedTextureS3TC(this);
|
||||
break;
|
||||
// create an extension for any types that don't
|
||||
// have any additional tokens or methods
|
||||
default:
|
||||
|
@ -1528,10 +1518,8 @@ WebGLContext::GetSupportedExtensions(Nullable< nsTArray<nsString> > &retval)
|
|||
arr.AppendElement(NS_LITERAL_STRING("OES_standard_derivatives"));
|
||||
if (IsExtensionSupported(WebGL_EXT_texture_filter_anisotropic))
|
||||
arr.AppendElement(NS_LITERAL_STRING("MOZ_EXT_texture_filter_anisotropic"));
|
||||
if (IsExtensionSupported(WebGL_WEBGL_lose_context))
|
||||
if (IsExtensionSupported(WebGL_MOZ_WEBGL_lose_context))
|
||||
arr.AppendElement(NS_LITERAL_STRING("MOZ_WEBGL_lose_context"));
|
||||
if (IsExtensionSupported(WebGL_WEBGL_compressed_texture_s3tc))
|
||||
arr.AppendElement(NS_LITERAL_STRING("MOZ_WEBGL_compressed_texture_s3tc"));
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -571,7 +571,6 @@ class WebGLContext :
|
|||
{
|
||||
friend class WebGLMemoryMultiReporterWrapper;
|
||||
friend class WebGLExtensionLoseContext;
|
||||
friend class WebGLExtensionCompressedTextureS3TC;
|
||||
friend class WebGLContextUserData;
|
||||
friend class WebGLMemoryPressureObserver;
|
||||
|
||||
|
@ -1196,8 +1195,7 @@ protected:
|
|||
WebGL_OES_texture_float,
|
||||
WebGL_OES_standard_derivatives,
|
||||
WebGL_EXT_texture_filter_anisotropic,
|
||||
WebGL_WEBGL_lose_context,
|
||||
WebGL_WEBGL_compressed_texture_s3tc,
|
||||
WebGL_MOZ_WEBGL_lose_context,
|
||||
WebGLExtensionID_Max
|
||||
};
|
||||
nsAutoTArray<nsRefPtr<WebGLExtension>, WebGLExtensionID_Max> mEnabledExtensions;
|
||||
|
@ -1207,8 +1205,6 @@ protected:
|
|||
}
|
||||
bool IsExtensionSupported(WebGLExtensionID ei);
|
||||
|
||||
nsTArray<WebGLenum> mCompressedTextureFormats;
|
||||
|
||||
bool InitAndValidateGL();
|
||||
bool ValidateBuffers(PRInt32* maxAllowedCount, const char *info);
|
||||
bool ValidateCapabilityEnum(WebGLenum cap, const char *info);
|
||||
|
@ -1231,11 +1227,7 @@ protected:
|
|||
bool ValidateGLSLCharacter(PRUnichar c);
|
||||
bool ValidateGLSLString(const nsAString& string, const char *info);
|
||||
|
||||
bool ValidateTexImage2DTarget(WebGLenum target, WebGLsizei width, WebGLsizei height, const char* info);
|
||||
bool ValidateCompressedTextureSize(WebGLint level, WebGLenum format, WebGLsizei width, WebGLsizei height, uint32_t byteLength, const char* info);
|
||||
bool ValidateLevelWidthHeightForTarget(WebGLenum target, WebGLint level, WebGLsizei width, WebGLsizei height, const char* info);
|
||||
|
||||
static PRUint32 GetBitsPerTexel(WebGLenum format, WebGLenum type);
|
||||
static PRUint32 GetTexelSize(WebGLenum format, WebGLenum type);
|
||||
|
||||
void Invalidate();
|
||||
void DestroyResourcesAndContext();
|
||||
|
@ -1721,8 +1713,8 @@ public:
|
|||
PRInt64 MemoryUsage() const {
|
||||
if (!mIsDefined)
|
||||
return 0;
|
||||
PRInt64 texelSizeInBits = WebGLContext::GetBitsPerTexel(mFormat, mType);
|
||||
return PRInt64(mWidth) * PRInt64(mHeight) * texelSizeInBits / 8;
|
||||
PRInt64 texelSize = WebGLContext::GetTexelSize(mFormat, mType);
|
||||
return PRInt64(mWidth) * PRInt64(mHeight) * texelSize;
|
||||
}
|
||||
WebGLenum Format() const { return mFormat; }
|
||||
WebGLenum Type() const { return mType; }
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
#include "gfxImageSurface.h"
|
||||
#include "gfxContext.h"
|
||||
#include "gfxPlatform.h"
|
||||
//#include "nsIDOMHTMLCanvasElement.h"
|
||||
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsDOMError.h"
|
||||
|
@ -2482,8 +2483,7 @@ WebGLContext::GetParameter(JSContext* cx, WebGLenum pname, ErrorResult& rv)
|
|||
return JS::Int32Value(0);
|
||||
case LOCAL_GL_COMPRESSED_TEXTURE_FORMATS:
|
||||
{
|
||||
PRUint32 length = mCompressedTextureFormats.Length();
|
||||
JSObject* obj = Uint32Array::Create(cx, length, mCompressedTextureFormats.Elements());
|
||||
JSObject* obj = Uint32Array::Create(cx, 0);
|
||||
if (!obj) {
|
||||
rv = NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
@ -5082,37 +5082,11 @@ WebGLContext::CompressedTexImage2D(WebGLenum target, WebGLint level, WebGLenum i
|
|||
return;
|
||||
}
|
||||
|
||||
if (!ValidateTexImage2DTarget(target, width, height, "compressedTexImage2D")) {
|
||||
return;
|
||||
}
|
||||
|
||||
WebGLTexture *tex = activeBoundTextureForTarget(target);
|
||||
if (!tex) {
|
||||
ErrorInvalidOperation("compressedTexImage2D: no texture is bound to this target");
|
||||
return;
|
||||
}
|
||||
if (!tex)
|
||||
return ErrorInvalidOperation("compressedTexImage2D: no texture is bound to this target");
|
||||
|
||||
if (!mCompressedTextureFormats.Contains(internalformat)) {
|
||||
ErrorInvalidEnum("compressedTexImage2D: compressed texture format 0x%x is not supported", internalformat);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ValidateLevelWidthHeightForTarget(target, level, width, height, "compressedTexImage2D")) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (border) {
|
||||
ErrorInvalidValue("compressedTexImage2D: border is not 0");
|
||||
return;
|
||||
}
|
||||
|
||||
uint32_t byteLength = view.mLength;
|
||||
if (!ValidateCompressedTextureSize(level, internalformat, width, height, byteLength, "compressedTexImage2D")) {
|
||||
return;
|
||||
}
|
||||
|
||||
gl->fCompressedTexImage2D(target, level, internalformat, width, height, border, byteLength, view.mData);
|
||||
tex->SetImageInfo(target, level, width, height, internalformat, LOCAL_GL_UNSIGNED_BYTE);
|
||||
return ErrorInvalidEnum("compressedTexImage2D: compressed textures are not supported");
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -5139,82 +5113,12 @@ WebGLContext::CompressedTexSubImage2D(WebGLenum target, WebGLint level, WebGLint
|
|||
return;
|
||||
}
|
||||
|
||||
switch (target) {
|
||||
case LOCAL_GL_TEXTURE_2D:
|
||||
case LOCAL_GL_TEXTURE_CUBE_MAP_POSITIVE_X:
|
||||
case LOCAL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
|
||||
case LOCAL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
|
||||
case LOCAL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
|
||||
case LOCAL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
|
||||
case LOCAL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
|
||||
break;
|
||||
default:
|
||||
return ErrorInvalidEnumInfo("texSubImage2D: target", target);
|
||||
}
|
||||
|
||||
WebGLTexture *tex = activeBoundTextureForTarget(target);
|
||||
if (!tex) {
|
||||
ErrorInvalidOperation("compressedTexSubImage2D: no texture is bound to this target");
|
||||
return;
|
||||
return ErrorInvalidOperation("compressedTexSubImage2D: no texture is bound to this target");
|
||||
}
|
||||
|
||||
if (!mCompressedTextureFormats.Contains(format)) {
|
||||
ErrorInvalidEnum("compressedTexSubImage2D: compressed texture format 0x%x is not supported", format);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ValidateLevelWidthHeightForTarget(target, level, width, height, "compressedTexSubImage2D")) {
|
||||
return;
|
||||
}
|
||||
|
||||
uint32_t byteLength = view.mLength;
|
||||
if (!ValidateCompressedTextureSize(level, format, width, height, byteLength, "compressedTexSubImage2D")) {
|
||||
return;
|
||||
}
|
||||
|
||||
size_t face = WebGLTexture::FaceForTarget(target);
|
||||
|
||||
if (!tex->HasImageInfoAt(level, face)) {
|
||||
ErrorInvalidOperation("compressedTexSubImage2D: no texture image previously defined for this level and face");
|
||||
return;
|
||||
}
|
||||
|
||||
const WebGLTexture::ImageInfo &imageInfo = tex->ImageInfoAt(level, face);
|
||||
|
||||
if (!CanvasUtils::CheckSaneSubrectSize(xoffset, yoffset, width, height, imageInfo.Width(), imageInfo.Height())) {
|
||||
ErrorInvalidValue("compressedTexSubImage2D: subtexture rectangle out of bounds");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (format) {
|
||||
case LOCAL_GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
|
||||
case LOCAL_GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
|
||||
case LOCAL_GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
|
||||
case LOCAL_GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
|
||||
{
|
||||
if (xoffset < 0 || xoffset % 4 != 0) {
|
||||
ErrorInvalidOperation("compressedTexSubImage2D: xoffset is not a multiple of 4");
|
||||
return;
|
||||
}
|
||||
if (yoffset < 0 || yoffset % 4 != 0) {
|
||||
ErrorInvalidOperation("compressedTexSubImage2D: yoffset is not a multiple of 4");
|
||||
return;
|
||||
}
|
||||
if (width % 4 != 0 && width != imageInfo.Width()) {
|
||||
ErrorInvalidOperation("compressedTexSubImage2D: width is not a multiple of 4 or equal to texture width");
|
||||
return;
|
||||
}
|
||||
if (height % 4 != 0 && height != imageInfo.Height()) {
|
||||
ErrorInvalidOperation("compressedTexSubImage2D: height is not a multiple of 4 or equal to texture height");
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
gl->fCompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, byteLength, view.mData);
|
||||
|
||||
return;
|
||||
return ErrorInvalidEnum("compressedTexSubImage2D: compressed textures are not supported");
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -5553,8 +5457,20 @@ WebGLContext::TexImage2D_base(WebGLenum target, WebGLint level, WebGLenum intern
|
|||
int jsArrayType, // a TypedArray format enum, or -1 if not relevant
|
||||
WebGLTexelFormat srcFormat, bool srcPremultiplied)
|
||||
{
|
||||
if (!ValidateTexImage2DTarget(target, width, height, "texImage2D")) {
|
||||
return;
|
||||
switch (target) {
|
||||
case LOCAL_GL_TEXTURE_2D:
|
||||
break;
|
||||
case LOCAL_GL_TEXTURE_CUBE_MAP_POSITIVE_X:
|
||||
case LOCAL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
|
||||
case LOCAL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
|
||||
case LOCAL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
|
||||
case LOCAL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
|
||||
case LOCAL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
|
||||
if (width != height)
|
||||
return ErrorInvalidValue("texImage2D: with cube map targets, width and height must be equal");
|
||||
break;
|
||||
default:
|
||||
return ErrorInvalidEnumInfo("texImage2D: target", target);
|
||||
}
|
||||
|
||||
switch (format) {
|
||||
|
@ -5571,9 +5487,19 @@ WebGLContext::TexImage2D_base(WebGLenum target, WebGLint level, WebGLenum intern
|
|||
if (format != internalformat)
|
||||
return ErrorInvalidOperation("texImage2D: format does not match internalformat");
|
||||
|
||||
if (!ValidateLevelWidthHeightForTarget(target, level, width, height, "texImage2D")) {
|
||||
return;
|
||||
}
|
||||
WebGLsizei maxTextureSize = MaxTextureSizeForTarget(target);
|
||||
|
||||
if (level < 0)
|
||||
return ErrorInvalidValue("texImage2D: level must be >= 0");
|
||||
|
||||
if (!(maxTextureSize >> level))
|
||||
return ErrorInvalidValue("texImage2D: 2^level exceeds maximum texture size");
|
||||
|
||||
if (width < 0 || height < 0)
|
||||
return ErrorInvalidValue("texImage2D: width and height must be >= 0");
|
||||
|
||||
if (width > maxTextureSize || height > maxTextureSize)
|
||||
return ErrorInvalidValue("texImage2D: width or height exceeds maximum texture size");
|
||||
|
||||
if (level >= 1) {
|
||||
if (!(is_pot_assuming_nonnegative(width) &&
|
||||
|
@ -5812,9 +5738,19 @@ WebGLContext::TexSubImage2D_base(WebGLenum target, WebGLint level,
|
|||
return ErrorInvalidEnumInfo("texSubImage2D: target", target);
|
||||
}
|
||||
|
||||
if (!ValidateLevelWidthHeightForTarget(target, level, width, height, "texSubImage2D")) {
|
||||
return;
|
||||
}
|
||||
WebGLsizei maxTextureSize = MaxTextureSizeForTarget(target);
|
||||
|
||||
if (level < 0)
|
||||
return ErrorInvalidValue("texSubImage2D: level must be >= 0");
|
||||
|
||||
if (!(maxTextureSize >> level))
|
||||
return ErrorInvalidValue("texSubImage2D: 2^level exceeds maximum texture size");
|
||||
|
||||
if (width < 0 || height < 0)
|
||||
return ErrorInvalidValue("texSubImage2D: width and height must be >= 0");
|
||||
|
||||
if (width > maxTextureSize || height > maxTextureSize)
|
||||
return ErrorInvalidValue("texSubImage2D: width or height exceeds maximum texture size");
|
||||
|
||||
if (level >= 1) {
|
||||
if (!(is_pot_assuming_nonnegative(width) &&
|
||||
|
|
|
@ -57,4 +57,3 @@ DOMCI_DATA(WebGLExtension, void)
|
|||
DOMCI_DATA(WebGLExtensionStandardDerivatives, void)
|
||||
DOMCI_DATA(WebGLExtensionTextureFilterAnisotropic, void)
|
||||
DOMCI_DATA(WebGLExtensionLoseContext, void)
|
||||
DOMCI_DATA(WebGLExtensionCompressedTextureS3TC, void)
|
||||
|
|
|
@ -371,118 +371,10 @@ bool WebGLContext::ValidateGLSLString(const nsAString& string, const char *info)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool WebGLContext::ValidateTexImage2DTarget(WebGLenum target, WebGLsizei width, WebGLsizei height,
|
||||
const char* info)
|
||||
{
|
||||
switch (target) {
|
||||
case LOCAL_GL_TEXTURE_2D:
|
||||
break;
|
||||
case LOCAL_GL_TEXTURE_CUBE_MAP_POSITIVE_X:
|
||||
case LOCAL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
|
||||
case LOCAL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
|
||||
case LOCAL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
|
||||
case LOCAL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
|
||||
case LOCAL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
|
||||
if (width != height) {
|
||||
ErrorInvalidValue("%s: with cube map targets, width and height must be equal", info);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
ErrorInvalidEnum("%s: invalid target enum 0x%x", info, target);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool WebGLContext::ValidateCompressedTextureSize(WebGLint level, WebGLenum format, WebGLsizei width,
|
||||
WebGLsizei height, uint32_t byteLength, const char* info)
|
||||
{
|
||||
CheckedUint32 calculated_byteLength = 0;
|
||||
CheckedUint32 checked_byteLength = byteLength;
|
||||
if (!checked_byteLength.valid()) {
|
||||
ErrorInvalidValue("%s: data length out of bounds", info);
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (format) {
|
||||
case LOCAL_GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
|
||||
case LOCAL_GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
|
||||
{
|
||||
calculated_byteLength = ((CheckedUint32(width) + 3) / 4) * ((CheckedUint32(height) + 3) / 4) * 8;
|
||||
if (!calculated_byteLength.valid() || !(checked_byteLength == calculated_byteLength)) {
|
||||
ErrorInvalidValue("%s: data size does not match dimensions", info);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case LOCAL_GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
|
||||
case LOCAL_GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
|
||||
{
|
||||
calculated_byteLength = ((CheckedUint32(width) + 3) / 4) * ((CheckedUint32(height) + 3) / 4) * 16;
|
||||
if (!calculated_byteLength.valid() || !(checked_byteLength == calculated_byteLength)) {
|
||||
ErrorInvalidValue("%s: data size does not match dimensions", info);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
switch (format) {
|
||||
case LOCAL_GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
|
||||
case LOCAL_GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
|
||||
case LOCAL_GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
|
||||
case LOCAL_GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
|
||||
{
|
||||
if (level == 0 && width % 4 == 0 && height % 4 == 0) {
|
||||
return true;
|
||||
}
|
||||
if (level > 0
|
||||
&& (width == 0 || width == 1 || width == 2 || width % 4 == 0)
|
||||
&& (height == 0 || height == 1 || height == 2 || height % 4 == 0))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ErrorInvalidOperation("%s: level parameter does not match width and height", info);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool WebGLContext::ValidateLevelWidthHeightForTarget(WebGLenum target, WebGLint level, WebGLsizei width,
|
||||
WebGLsizei height, const char* info)
|
||||
{
|
||||
WebGLsizei maxTextureSize = MaxTextureSizeForTarget(target);
|
||||
|
||||
if (level < 0) {
|
||||
ErrorInvalidValue("%s: level must be >= 0", info);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(maxTextureSize >> level)) {
|
||||
ErrorInvalidValue("%s: 2^level exceeds maximum texture size");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (width < 0 || height < 0) {
|
||||
ErrorInvalidValue("%s: width and height must be >= 0");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (width > maxTextureSize || height > maxTextureSize) {
|
||||
ErrorInvalidValue("%s: width or height exceeds maximum texture size");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
PRUint32 WebGLContext::GetBitsPerTexel(WebGLenum format, WebGLenum type)
|
||||
PRUint32 WebGLContext::GetTexelSize(WebGLenum format, WebGLenum type)
|
||||
{
|
||||
if (type == LOCAL_GL_UNSIGNED_BYTE || type == LOCAL_GL_FLOAT) {
|
||||
int multiplier = type == LOCAL_GL_FLOAT ? 32 : 8;
|
||||
int multiplier = type == LOCAL_GL_FLOAT ? 4 : 1;
|
||||
switch (format) {
|
||||
case LOCAL_GL_ALPHA:
|
||||
case LOCAL_GL_LUMINANCE:
|
||||
|
@ -493,12 +385,6 @@ PRUint32 WebGLContext::GetBitsPerTexel(WebGLenum format, WebGLenum type)
|
|||
return 3 * multiplier;
|
||||
case LOCAL_GL_RGBA:
|
||||
return 4 * multiplier;
|
||||
case LOCAL_GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
|
||||
case LOCAL_GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
|
||||
return 4;
|
||||
case LOCAL_GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
|
||||
case LOCAL_GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
|
||||
return 8;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -506,7 +392,7 @@ PRUint32 WebGLContext::GetBitsPerTexel(WebGLenum format, WebGLenum type)
|
|||
type == LOCAL_GL_UNSIGNED_SHORT_5_5_5_1 ||
|
||||
type == LOCAL_GL_UNSIGNED_SHORT_5_6_5)
|
||||
{
|
||||
return 16;
|
||||
return 2;
|
||||
}
|
||||
|
||||
NS_ABORT();
|
||||
|
|
|
@ -36,9 +36,14 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "WebGLContext.h"
|
||||
#include "WebGLExtensions.h"
|
||||
|
||||
#include "nsContentUtils.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
WebGLExtensionLoseContext::WebGLExtensionLoseContext(WebGLContext* context) :
|
||||
|
|
|
@ -36,9 +36,14 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "WebGLContext.h"
|
||||
#include "WebGLExtensions.h"
|
||||
|
||||
#include "nsContentUtils.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
WebGLExtensionStandardDerivatives::WebGLExtensionStandardDerivatives(WebGLContext* context) :
|
||||
|
|
|
@ -36,9 +36,14 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "WebGLContext.h"
|
||||
#include "WebGLExtensions.h"
|
||||
|
||||
#include "nsContentUtils.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
WebGLExtensionTextureFilterAnisotropic::WebGLExtensionTextureFilterAnisotropic(WebGLContext* context) :
|
||||
|
|
|
@ -77,18 +77,6 @@ public:
|
|||
NS_DECL_NSIWEBGLEXTENSION
|
||||
};
|
||||
|
||||
class WebGLExtensionCompressedTextureS3TC :
|
||||
public nsIWebGLExtensionCompressedTextureS3TC,
|
||||
public WebGLExtension
|
||||
{
|
||||
public:
|
||||
WebGLExtensionCompressedTextureS3TC(WebGLContext* context);
|
||||
virtual ~WebGLExtensionCompressedTextureS3TC();
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIWEBGLEXTENSION
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // WEBGLEXTENSIONS_H_
|
||||
|
|
|
@ -1546,9 +1546,6 @@ static nsDOMClassInfoData sClassInfoData[] = {
|
|||
NS_DEFINE_CLASSINFO_DATA(WebGLExtensionLoseContext, WebGLExtensionSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS |
|
||||
nsIXPCScriptable::WANT_ADDPROPERTY)
|
||||
NS_DEFINE_CLASSINFO_DATA(WebGLExtensionCompressedTextureS3TC, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS |
|
||||
nsIXPCScriptable::WANT_ADDPROPERTY)
|
||||
|
||||
NS_DEFINE_CLASSINFO_DATA(PaintRequest, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
|
@ -4253,10 +4250,6 @@ nsDOMClassInfo::Init()
|
|||
DOM_CLASSINFO_MAP_ENTRY(nsIWebGLExtensionLoseContext)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(WebGLExtensionCompressedTextureS3TC, nsIWebGLExtensionCompressedTextureS3TC)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIWebGLExtensionCompressedTextureS3TC)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(PaintRequest, nsIDOMPaintRequest)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMPaintRequest)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
|
|
@ -489,7 +489,6 @@ DOMCI_CLASS(WebGLExtension)
|
|||
DOMCI_CLASS(WebGLExtensionStandardDerivatives)
|
||||
DOMCI_CLASS(WebGLExtensionTextureFilterAnisotropic)
|
||||
DOMCI_CLASS(WebGLExtensionLoseContext)
|
||||
DOMCI_CLASS(WebGLExtensionCompressedTextureS3TC)
|
||||
|
||||
DOMCI_CLASS(PaintRequest)
|
||||
DOMCI_CLASS(PaintRequestList)
|
||||
|
|
|
@ -178,16 +178,6 @@ interface nsIWebGLExtensionTextureFilterAnisotropic : nsIWebGLExtension
|
|||
const WebGLenum MAX_TEXTURE_MAX_ANISOTROPY_EXT = 0x84FF;
|
||||
};
|
||||
|
||||
[scriptable, builtinclass, uuid(a1508b6f-f2ab-44cf-bbb4-3cfb339e1e8a)]
|
||||
interface nsIWebGLExtensionCompressedTextureS3TC : nsIWebGLExtension
|
||||
{
|
||||
/* Compressed Texture Formats */
|
||||
const WebGLenum COMPRESSED_RGB_S3TC_DXT1_EXT = 0x83F0;
|
||||
const WebGLenum COMPRESSED_RGBA_S3TC_DXT1_EXT = 0x83F1;
|
||||
const WebGLenum COMPRESSED_RGBA_S3TC_DXT3_EXT = 0x83F2;
|
||||
const WebGLenum COMPRESSED_RGBA_S3TC_DXT5_EXT = 0x83F3;
|
||||
};
|
||||
|
||||
[scriptable, builtinclass, uuid(a1fdfb76-6a08-4a1a-b0c9-d92ef3357cb9)]
|
||||
interface nsIDOMWebGLRenderingContext : nsISupports
|
||||
{
|
||||
|
|
|
@ -100,7 +100,6 @@ static const char *sExtensionNames[] = {
|
|||
"GL_EXT_unpack_subimage",
|
||||
"GL_OES_standard_derivatives",
|
||||
"GL_EXT_texture_filter_anisotropic",
|
||||
"GL_EXT_texture_compression_s3tc",
|
||||
"GL_EXT_framebuffer_blit",
|
||||
"GL_ANGLE_framebuffer_blit",
|
||||
"GL_EXT_framebuffer_multisample",
|
||||
|
@ -146,8 +145,6 @@ GLContext::InitWithPrefix(const char *prefix, bool trygl)
|
|||
{ (PRFuncPtr*) &mSymbols.fClearColor, { "ClearColor", NULL } },
|
||||
{ (PRFuncPtr*) &mSymbols.fClearStencil, { "ClearStencil", NULL } },
|
||||
{ (PRFuncPtr*) &mSymbols.fColorMask, { "ColorMask", NULL } },
|
||||
{ (PRFuncPtr*) &mSymbols.fCompressedTexImage2D, {"CompressedTexImage2D", NULL} },
|
||||
{ (PRFuncPtr*) &mSymbols.fCompressedTexSubImage2D, {"CompressedTexSubImage2D", NULL} },
|
||||
{ (PRFuncPtr*) &mSymbols.fCullFace, { "CullFace", NULL } },
|
||||
{ (PRFuncPtr*) &mSymbols.fDetachShader, { "DetachShader", "DetachShaderARB", NULL } },
|
||||
{ (PRFuncPtr*) &mSymbols.fDepthFunc, { "DepthFunc", NULL } },
|
||||
|
|
|
@ -1620,7 +1620,6 @@ public:
|
|||
EXT_unpack_subimage,
|
||||
OES_standard_derivatives,
|
||||
EXT_texture_filter_anisotropic,
|
||||
EXT_texture_compression_s3tc,
|
||||
EXT_framebuffer_blit,
|
||||
ANGLE_framebuffer_blit,
|
||||
EXT_framebuffer_multisample,
|
||||
|
@ -2210,18 +2209,6 @@ public:
|
|||
AFTER_GL_CALL;
|
||||
}
|
||||
|
||||
void fCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *pixels) {
|
||||
BEFORE_GL_CALL;
|
||||
mSymbols.fCompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, pixels);
|
||||
AFTER_GL_CALL;
|
||||
}
|
||||
|
||||
void fCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *pixels) {
|
||||
BEFORE_GL_CALL;
|
||||
mSymbols.fCompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, pixels);
|
||||
AFTER_GL_CALL;
|
||||
}
|
||||
|
||||
void fCullFace(GLenum mode) {
|
||||
BEFORE_GL_CALL;
|
||||
mSymbols.fCullFace(mode);
|
||||
|
|
|
@ -101,10 +101,6 @@ struct GLContextSymbols
|
|||
PFNGLCLEARSTENCILPROC fClearStencil;
|
||||
typedef void (GLAPIENTRY * PFNGLCOLORMASKPROC) (realGLboolean red, realGLboolean green, realGLboolean blue, realGLboolean alpha);
|
||||
PFNGLCOLORMASKPROC fColorMask;
|
||||
typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXIMAGE2D) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *pixels);
|
||||
PFNGLCOMPRESSEDTEXIMAGE2D fCompressedTexImage2D;
|
||||
typedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXSUBIMAGE2D) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *pixels);
|
||||
PFNGLCOMPRESSEDTEXSUBIMAGE2D fCompressedTexSubImage2D;
|
||||
typedef void (GLAPIENTRY * PFNGLCULLFACEPROC) (GLenum mode);
|
||||
PFNGLCULLFACEPROC fCullFace;
|
||||
typedef void (GLAPIENTRY * PFNGLDETACHSHADERPROC) (GLuint program, GLuint shader);
|
||||
|
|
|
@ -508,7 +508,6 @@ irregularFilenames = {
|
|||
'nsIWebGLExtensionStandardDerivatives' : 'nsIDOMWebGLRenderingContext',
|
||||
'nsIWebGLExtensionTextureFilterAnisotropic' : 'nsIDOMWebGLRenderingContext',
|
||||
'nsIWebGLExtensionLoseContext' : 'nsIDOMWebGLRenderingContext',
|
||||
'nsIWebGLExtensionCompressedTextureS3TC' : 'nsIDOMWebGLRenderingContext',
|
||||
|
||||
'nsIIndexedDatabaseUsageCallback': 'nsIIndexedDatabaseManager',
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче