mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 11:25:00 +00:00
Bug 779611 - part 3 - port WebGL extensions to WebIDL bindings, refactor them - r=bz,jgilbert
This commit is contained in:
parent
8da7053199
commit
40e567c53c
@ -21,6 +21,7 @@ EXPORTS = \
|
||||
CustomQS_Canvas2D.h \
|
||||
WebGLContext.h \
|
||||
WebGLElementArrayCache.h \
|
||||
WebGLExtensions.h \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS_NAMESPACES = mozilla/dom
|
||||
@ -47,15 +48,17 @@ CPPSRCS += \
|
||||
WebGLContextUtils.cpp \
|
||||
WebGLContextReporter.cpp \
|
||||
WebGLContextValidate.cpp \
|
||||
WebGLExtensionStandardDerivatives.cpp \
|
||||
WebGLExtensionTextureFilterAnisotropic.cpp \
|
||||
WebGLExtensionLoseContext.cpp \
|
||||
WebGLTexelConversions.cpp \
|
||||
WebGLExtensionCompressedTextureS3TC.cpp \
|
||||
WebGLElementArrayCache.cpp \
|
||||
WebGLExtensionBase.cpp \
|
||||
WebGLExtensionCompressedTextureATC.cpp \
|
||||
WebGLExtensionCompressedTexturePVRTC.cpp \
|
||||
WebGLExtensionCompressedTextureS3TC.cpp \
|
||||
WebGLExtensionDepthTexture.cpp \
|
||||
WebGLElementArrayCache.cpp \
|
||||
WebGLExtensionLoseContext.cpp \
|
||||
WebGLExtensionStandardDerivatives.cpp \
|
||||
WebGLExtensionTextureFilterAnisotropic.cpp \
|
||||
WebGLExtensionTextureFloat.cpp \
|
||||
$(NULL)
|
||||
|
||||
DEFINES += -DUSE_ANGLE
|
||||
|
@ -41,11 +41,13 @@
|
||||
#include "nsIObserverService.h"
|
||||
#include "mozilla/Services.h"
|
||||
#include "mozilla/dom/WebGLRenderingContextBinding.h"
|
||||
#include "mozilla/dom/BindingUtils.h"
|
||||
|
||||
#include "Layers.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::gl;
|
||||
using namespace mozilla::dom;
|
||||
using namespace mozilla::layers;
|
||||
|
||||
NS_IMPL_ISUPPORTS1(WebGLMemoryPressureObserver, nsIObserver)
|
||||
@ -89,7 +91,6 @@ WebGLContext::WebGLContext()
|
||||
: gl(nullptr)
|
||||
{
|
||||
SetIsDOMBinding();
|
||||
mExtensions.SetLength(WebGLExtensionID_number_of_extensions);
|
||||
|
||||
mGeneration = 0;
|
||||
mInvalidated = false;
|
||||
@ -914,6 +915,11 @@ WebGLContext::GetContextAttributes(ErrorResult &rv)
|
||||
return obj;
|
||||
}
|
||||
|
||||
bool
|
||||
WebGLContext::IsExtensionEnabled(WebGLExtensionID ext) {
|
||||
return mExtensions.SafeElementAt(ext);
|
||||
}
|
||||
|
||||
/* [noscript] DOMString mozGetUnderlyingParamString(in WebGLenum pname); */
|
||||
NS_IMETHODIMP
|
||||
WebGLContext::MozGetUnderlyingParamString(uint32_t pname, nsAString& retval)
|
||||
@ -999,8 +1005,8 @@ bool WebGLContext::IsExtensionSupported(WebGLExtensionID ext)
|
||||
return isSupported;
|
||||
}
|
||||
|
||||
nsIWebGLExtension*
|
||||
WebGLContext::GetExtension(const nsAString& aName)
|
||||
JSObject*
|
||||
WebGLContext::GetExtension(JSContext *cx, const nsAString& aName)
|
||||
{
|
||||
if (!IsContextStable())
|
||||
return nullptr;
|
||||
@ -1011,93 +1017,100 @@ WebGLContext::GetExtension(const nsAString& aName)
|
||||
|
||||
WebGLExtensionID ext = WebGLExtensionID_unknown_extension;
|
||||
|
||||
// step 1: figure what extension is wanted
|
||||
if (aName.Equals(NS_LITERAL_STRING("OES_texture_float"),
|
||||
nsCaseInsensitiveStringComparator()))
|
||||
{
|
||||
if (IsExtensionSupported(OES_texture_float))
|
||||
ext = OES_texture_float;
|
||||
ext = OES_texture_float;
|
||||
}
|
||||
else if (aName.Equals(NS_LITERAL_STRING("OES_standard_derivatives"),
|
||||
nsCaseInsensitiveStringComparator()))
|
||||
{
|
||||
if (IsExtensionSupported(OES_standard_derivatives))
|
||||
ext = OES_standard_derivatives;
|
||||
ext = OES_standard_derivatives;
|
||||
}
|
||||
else if (aName.Equals(NS_LITERAL_STRING("EXT_texture_filter_anisotropic"),
|
||||
nsCaseInsensitiveStringComparator()))
|
||||
{
|
||||
if (IsExtensionSupported(EXT_texture_filter_anisotropic))
|
||||
ext = EXT_texture_filter_anisotropic;
|
||||
ext = EXT_texture_filter_anisotropic;
|
||||
}
|
||||
else if (aName.Equals(NS_LITERAL_STRING("MOZ_WEBGL_lose_context"),
|
||||
nsCaseInsensitiveStringComparator()))
|
||||
{
|
||||
if (IsExtensionSupported(WEBGL_lose_context))
|
||||
ext = WEBGL_lose_context;
|
||||
ext = WEBGL_lose_context;
|
||||
}
|
||||
else if (aName.Equals(NS_LITERAL_STRING("MOZ_WEBGL_compressed_texture_s3tc"),
|
||||
nsCaseInsensitiveStringComparator()))
|
||||
{
|
||||
if (IsExtensionSupported(WEBGL_compressed_texture_s3tc))
|
||||
ext = WEBGL_compressed_texture_s3tc;
|
||||
ext = WEBGL_compressed_texture_s3tc;
|
||||
}
|
||||
else if (aName.Equals(NS_LITERAL_STRING("MOZ_WEBGL_compressed_texture_atc"),
|
||||
nsCaseInsensitiveStringComparator()))
|
||||
{
|
||||
if (IsExtensionSupported(WEBGL_compressed_texture_atc))
|
||||
ext = WEBGL_compressed_texture_atc;
|
||||
ext = WEBGL_compressed_texture_atc;
|
||||
}
|
||||
else if (aName.Equals(NS_LITERAL_STRING("MOZ_WEBGL_compressed_texture_pvrtc"),
|
||||
nsCaseInsensitiveStringComparator()))
|
||||
{
|
||||
if (IsExtensionSupported(WEBGL_compressed_texture_pvrtc))
|
||||
ext = WEBGL_compressed_texture_pvrtc;
|
||||
ext = WEBGL_compressed_texture_pvrtc;
|
||||
}
|
||||
else if (aName.Equals(NS_LITERAL_STRING("MOZ_WEBGL_depth_texture"),
|
||||
nsCaseInsensitiveStringComparator()))
|
||||
{
|
||||
if (IsExtensionSupported(WEBGL_depth_texture))
|
||||
ext = WEBGL_depth_texture;
|
||||
ext = WEBGL_depth_texture;
|
||||
}
|
||||
|
||||
if (ext == WebGLExtensionID_unknown_extension) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!mExtensions[ext]) {
|
||||
switch (ext) {
|
||||
case OES_standard_derivatives:
|
||||
mExtensions[ext] = new WebGLExtensionStandardDerivatives(this);
|
||||
break;
|
||||
case EXT_texture_filter_anisotropic:
|
||||
mExtensions[ext] = new WebGLExtensionTextureFilterAnisotropic(this);
|
||||
break;
|
||||
case WEBGL_lose_context:
|
||||
mExtensions[ext] = new WebGLExtensionLoseContext(this);
|
||||
break;
|
||||
case WEBGL_compressed_texture_s3tc:
|
||||
mExtensions[ext] = new WebGLExtensionCompressedTextureS3TC(this);
|
||||
break;
|
||||
case WEBGL_compressed_texture_atc:
|
||||
mExtensions[ext] = new WebGLExtensionCompressedTextureATC(this);
|
||||
break;
|
||||
case WEBGL_compressed_texture_pvrtc:
|
||||
mExtensions[ext] = new WebGLExtensionCompressedTexturePVRTC(this);
|
||||
break;
|
||||
case WEBGL_depth_texture:
|
||||
mExtensions[ext] = new WebGLExtensionDepthTexture(this);
|
||||
break;
|
||||
default:
|
||||
// create a generic WebGLExtension object for any extensions that don't
|
||||
// have any additional tokens or methods. We still need these to be separate
|
||||
// objects in case the user might extend the corresponding JS objects with custom
|
||||
// properties.
|
||||
mExtensions[ext] = new WebGLExtension(this);
|
||||
break;
|
||||
}
|
||||
// step 2: check if the extension is supported
|
||||
if (!IsExtensionSupported(ext)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return mExtensions[ext];
|
||||
// step 3: if the extension hadn't been previously been created, create it now, thus enabling it
|
||||
if (!IsExtensionEnabled(ext)) {
|
||||
WebGLExtensionBase *obj = nullptr;
|
||||
switch (ext) {
|
||||
case OES_standard_derivatives:
|
||||
obj = new WebGLExtensionStandardDerivatives(this);
|
||||
break;
|
||||
case EXT_texture_filter_anisotropic:
|
||||
obj = new WebGLExtensionTextureFilterAnisotropic(this);
|
||||
break;
|
||||
case WEBGL_lose_context:
|
||||
obj = new WebGLExtensionLoseContext(this);
|
||||
break;
|
||||
case WEBGL_compressed_texture_s3tc:
|
||||
obj = new WebGLExtensionCompressedTextureS3TC(this);
|
||||
break;
|
||||
case WEBGL_compressed_texture_atc:
|
||||
obj = new WebGLExtensionCompressedTextureATC(this);
|
||||
break;
|
||||
case WEBGL_compressed_texture_pvrtc:
|
||||
obj = new WebGLExtensionCompressedTexturePVRTC(this);
|
||||
break;
|
||||
case WEBGL_depth_texture:
|
||||
obj = new WebGLExtensionDepthTexture(this);
|
||||
break;
|
||||
case OES_texture_float:
|
||||
obj = new WebGLExtensionTextureFloat(this);
|
||||
break;
|
||||
default:
|
||||
MOZ_ASSERT(false, "should not get there.");
|
||||
}
|
||||
mExtensions.EnsureLengthAtLeast(ext + 1);
|
||||
mExtensions[ext] = obj;
|
||||
}
|
||||
|
||||
// step 4: return the extension as a JS object
|
||||
JS::Value v;
|
||||
JSObject* wrapper = GetWrapper();
|
||||
JSAutoCompartment ac(cx, wrapper);
|
||||
if (!WrapNewBindingObject(cx, wrapper, mExtensions[ext], &v)) {
|
||||
return nullptr;
|
||||
}
|
||||
return &v.toObject();
|
||||
}
|
||||
|
||||
void
|
||||
@ -1507,22 +1520,6 @@ NAME_NOT_SUPPORTED(WebGLShader)
|
||||
NAME_NOT_SUPPORTED(WebGLFramebuffer)
|
||||
NAME_NOT_SUPPORTED(WebGLRenderbuffer)
|
||||
|
||||
// WebGLExtension
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_0(WebGLExtension)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(WebGLExtension)
|
||||
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIWebGLExtension)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(WebGLExtension)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(WebGLExtension)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(WebGLExtension)
|
||||
|
||||
DOMCI_DATA(WebGLExtension, WebGLExtension)
|
||||
|
||||
/* readonly attribute WebGLint size; */
|
||||
NS_IMETHODIMP
|
||||
WebGLActiveInfo::GetSize(WebGLint *aSize)
|
||||
|
@ -72,7 +72,6 @@ class WebGLShader;
|
||||
class WebGLFramebuffer;
|
||||
class WebGLRenderbuffer;
|
||||
class WebGLUniformLocation;
|
||||
class WebGLExtension;
|
||||
class WebGLContext;
|
||||
struct WebGLVertexAttribData;
|
||||
class WebGLMemoryPressureObserver;
|
||||
@ -80,6 +79,7 @@ class WebGLRectangleObject;
|
||||
class WebGLContextBoundObject;
|
||||
class WebGLActiveInfo;
|
||||
class WebGLShaderPrecisionFormat;
|
||||
class WebGLExtensionBase;
|
||||
|
||||
enum FakeBlackStatus { DoNotNeedFakeBlack, DoNeedFakeBlack, DontKnowIfNeedFakeBlack };
|
||||
|
||||
@ -631,7 +631,7 @@ public:
|
||||
JSObject *GetContextAttributes(ErrorResult &rv);
|
||||
bool IsContextLost() const { return !IsContextStable(); }
|
||||
void GetSupportedExtensions(dom::Nullable< nsTArray<nsString> > &retval);
|
||||
nsIWebGLExtension* GetExtension(const nsAString& aName);
|
||||
JSObject* GetExtension(JSContext* ctx, const nsAString& aName);
|
||||
void ActiveTexture(WebGLenum texture);
|
||||
void AttachShader(WebGLProgram* program, WebGLShader* shader);
|
||||
void BindAttribLocation(WebGLProgram* program, WebGLuint location,
|
||||
@ -1175,15 +1175,12 @@ protected:
|
||||
WEBGL_compressed_texture_atc,
|
||||
WEBGL_compressed_texture_pvrtc,
|
||||
WEBGL_depth_texture,
|
||||
WebGLExtensionID_number_of_extensions,
|
||||
WebGLExtensionID_unknown_extension
|
||||
};
|
||||
nsAutoTArray<nsRefPtr<WebGLExtension>, WebGLExtensionID_number_of_extensions> mExtensions;
|
||||
nsTArray<nsRefPtr<WebGLExtensionBase> > mExtensions;
|
||||
|
||||
// returns true if the extension has been enabled by calling getExtension.
|
||||
bool IsExtensionEnabled(WebGLExtensionID ext) {
|
||||
return mExtensions[ext];
|
||||
}
|
||||
bool IsExtensionEnabled(WebGLExtensionID ext);
|
||||
|
||||
// returns true if the extension is supported (as returned by getSupportedExtensions)
|
||||
bool IsExtensionSupported(WebGLExtensionID ext);
|
||||
@ -1420,6 +1417,13 @@ public:
|
||||
friend class WebGLUniformLocation;
|
||||
};
|
||||
|
||||
// used by DOM bindings in conjunction with GetParentObject
|
||||
inline nsISupports*
|
||||
ToSupports(WebGLContext* context)
|
||||
{
|
||||
return static_cast<nsICanvasRenderingContextInternal*>(context);
|
||||
}
|
||||
|
||||
// This class is a mixin for objects that are tied to a specific
|
||||
// context (which is to say, all of them). They provide initialization
|
||||
// as well as comparison with the current context.
|
||||
@ -3095,23 +3099,6 @@ protected:
|
||||
WebGLint mPrecision;
|
||||
};
|
||||
|
||||
class WebGLExtension
|
||||
: public nsIWebGLExtension
|
||||
, public WebGLContextBoundObject
|
||||
, public nsWrapperCache
|
||||
{
|
||||
public:
|
||||
WebGLExtension(WebGLContext *baseContext)
|
||||
: WebGLContextBoundObject(baseContext)
|
||||
{}
|
||||
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(WebGLExtension)
|
||||
NS_DECL_NSIWEBGLEXTENSION
|
||||
|
||||
virtual ~WebGLExtension() {}
|
||||
};
|
||||
|
||||
inline const WebGLRectangleObject *WebGLContext::FramebufferRectangleObject() const {
|
||||
return mBoundFramebuffer ? mBoundFramebuffer->RectangleObject()
|
||||
: static_cast<const WebGLRectangleObject*>(this);
|
||||
|
@ -1723,7 +1723,7 @@ WebGLContext::GenerateMipmap(WebGLenum target)
|
||||
if (IsTextureFormatCompressed(format))
|
||||
return ErrorInvalidOperation("generateMipmap: Texture data at level zero is compressed.");
|
||||
|
||||
if (IsExtensionEnabled(WEBGL_depth_texture) &&
|
||||
if (IsExtensionEnabled(WEBGL_depth_texture) &&
|
||||
(format == LOCAL_GL_DEPTH_COMPONENT || format == LOCAL_GL_DEPTH_STENCIL))
|
||||
return ErrorInvalidOperation("generateMipmap: "
|
||||
"A texture that has a base internal format of "
|
||||
@ -2669,7 +2669,6 @@ WebGLContext::GetTexParameter(WebGLenum target, WebGLenum pname)
|
||||
return JS::DoubleValue(f);
|
||||
}
|
||||
|
||||
|
||||
ErrorInvalidEnumInfo("getTexParameter: parameter", pname);
|
||||
break;
|
||||
|
||||
@ -4875,7 +4874,7 @@ WebGLContext::TexSubImage2D_base(WebGLenum target, WebGLint level,
|
||||
return ErrorInvalidValue("texSubImage2D: with level > 0, width and height must be powers of two");
|
||||
}
|
||||
|
||||
if (IsExtensionEnabled(WEBGL_depth_texture) &&
|
||||
if (IsExtensionEnabled(WEBGL_depth_texture) &&
|
||||
(format == LOCAL_GL_DEPTH_COMPONENT || format == LOCAL_GL_DEPTH_STENCIL)) {
|
||||
return ErrorInvalidOperation("texSubImage2D: format");
|
||||
}
|
||||
|
29
content/canvas/src/WebGLExtensionBase.cpp
Normal file
29
content/canvas/src/WebGLExtensionBase.cpp
Normal file
@ -0,0 +1,29 @@
|
||||
/* -*- Mode: C++; tab-width: 20; 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/. */
|
||||
|
||||
#include "WebGLContext.h"
|
||||
#include "WebGLExtensions.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
WebGLExtensionBase::WebGLExtensionBase(WebGLContext* context)
|
||||
: WebGLContextBoundObject(context)
|
||||
{
|
||||
SetIsDOMBinding();
|
||||
}
|
||||
|
||||
WebGLExtensionBase::~WebGLExtensionBase()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_0(WebGLExtensionBase)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(WebGLExtensionBase)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(WebGLExtensionBase)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(WebGLExtensionBase)
|
||||
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
NS_INTERFACE_MAP_END
|
@ -4,11 +4,12 @@
|
||||
|
||||
#include "WebGLContext.h"
|
||||
#include "WebGLExtensions.h"
|
||||
#include "mozilla/dom/WebGLRenderingContextBinding.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
WebGLExtensionCompressedTextureATC::WebGLExtensionCompressedTextureATC(WebGLContext* context)
|
||||
: WebGLExtension(context)
|
||||
: WebGLExtensionBase(context)
|
||||
{
|
||||
context->mCompressedTextureFormats.AppendElement(LOCAL_GL_ATC_RGB);
|
||||
context->mCompressedTextureFormats.AppendElement(LOCAL_GL_ATC_RGBA_EXPLICIT_ALPHA);
|
||||
@ -17,16 +18,6 @@ WebGLExtensionCompressedTextureATC::WebGLExtensionCompressedTextureATC(WebGLCont
|
||||
|
||||
WebGLExtensionCompressedTextureATC::~WebGLExtensionCompressedTextureATC()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(WebGLExtensionCompressedTextureATC, WebGLExtension)
|
||||
NS_IMPL_RELEASE_INHERITED(WebGLExtensionCompressedTextureATC, WebGLExtension)
|
||||
|
||||
DOMCI_DATA(WebGLExtensionCompressedTextureATC, WebGLExtensionCompressedTextureATC)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(WebGLExtensionCompressedTextureATC)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIWebGLExtensionCompressedTextureATC)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, WebGLExtension)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(WebGLExtensionCompressedTextureATC)
|
||||
NS_INTERFACE_MAP_END_INHERITING(WebGLExtension)
|
||||
IMPL_WEBGL_EXTENSION_GOOP(WebGLExtensionCompressedTextureATC)
|
||||
|
@ -4,11 +4,12 @@
|
||||
|
||||
#include "WebGLContext.h"
|
||||
#include "WebGLExtensions.h"
|
||||
#include "mozilla/dom/WebGLRenderingContextBinding.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
WebGLExtensionCompressedTexturePVRTC::WebGLExtensionCompressedTexturePVRTC(WebGLContext* context)
|
||||
: WebGLExtension(context)
|
||||
: WebGLExtensionBase(context)
|
||||
{
|
||||
context->mCompressedTextureFormats.AppendElement(LOCAL_GL_COMPRESSED_RGB_PVRTC_4BPPV1);
|
||||
context->mCompressedTextureFormats.AppendElement(LOCAL_GL_COMPRESSED_RGB_PVRTC_2BPPV1);
|
||||
@ -18,16 +19,6 @@ WebGLExtensionCompressedTexturePVRTC::WebGLExtensionCompressedTexturePVRTC(WebGL
|
||||
|
||||
WebGLExtensionCompressedTexturePVRTC::~WebGLExtensionCompressedTexturePVRTC()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(WebGLExtensionCompressedTexturePVRTC, WebGLExtension)
|
||||
NS_IMPL_RELEASE_INHERITED(WebGLExtensionCompressedTexturePVRTC, WebGLExtension)
|
||||
|
||||
DOMCI_DATA(WebGLExtensionCompressedTexturePVRTC, WebGLExtensionCompressedTexturePVRTC)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(WebGLExtensionCompressedTexturePVRTC)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIWebGLExtensionCompressedTexturePVRTC)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, WebGLExtension)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(WebGLExtensionCompressedTexturePVRTC)
|
||||
NS_INTERFACE_MAP_END_INHERITING(WebGLExtension)
|
||||
IMPL_WEBGL_EXTENSION_GOOP(WebGLExtensionCompressedTexturePVRTC)
|
||||
|
@ -4,11 +4,12 @@
|
||||
|
||||
#include "WebGLContext.h"
|
||||
#include "WebGLExtensions.h"
|
||||
#include "mozilla/dom/WebGLRenderingContextBinding.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
WebGLExtensionCompressedTextureS3TC::WebGLExtensionCompressedTextureS3TC(WebGLContext* context)
|
||||
: WebGLExtension(context)
|
||||
: WebGLExtensionBase(context)
|
||||
{
|
||||
context->mCompressedTextureFormats.AppendElement(LOCAL_GL_COMPRESSED_RGB_S3TC_DXT1_EXT);
|
||||
context->mCompressedTextureFormats.AppendElement(LOCAL_GL_COMPRESSED_RGBA_S3TC_DXT1_EXT);
|
||||
@ -18,16 +19,6 @@ WebGLExtensionCompressedTextureS3TC::WebGLExtensionCompressedTextureS3TC(WebGLCo
|
||||
|
||||
WebGLExtensionCompressedTextureS3TC::~WebGLExtensionCompressedTextureS3TC()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(WebGLExtensionCompressedTextureS3TC, WebGLExtension)
|
||||
NS_IMPL_RELEASE_INHERITED(WebGLExtensionCompressedTextureS3TC, WebGLExtension)
|
||||
|
||||
DOMCI_DATA(WebGLExtensionCompressedTextureS3TC, WebGLExtensionCompressedTextureS3TC)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(WebGLExtensionCompressedTextureS3TC)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIWebGLExtensionCompressedTextureS3TC)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, WebGLExtension)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(WebGLExtensionCompressedTextureS3TC)
|
||||
NS_INTERFACE_MAP_END_INHERITING(WebGLExtension)
|
||||
IMPL_WEBGL_EXTENSION_GOOP(WebGLExtensionCompressedTextureS3TC)
|
||||
|
@ -5,28 +5,17 @@
|
||||
|
||||
#include "WebGLContext.h"
|
||||
#include "WebGLExtensions.h"
|
||||
#include "mozilla/dom/WebGLRenderingContextBinding.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
WebGLExtensionDepthTexture::WebGLExtensionDepthTexture(WebGLContext* context) :
|
||||
WebGLExtension(context)
|
||||
WebGLExtensionDepthTexture::WebGLExtensionDepthTexture(WebGLContext* context)
|
||||
: WebGLExtensionBase(context)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
WebGLExtensionDepthTexture::~WebGLExtensionDepthTexture()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(WebGLExtensionDepthTexture, WebGLExtension)
|
||||
NS_IMPL_RELEASE_INHERITED(WebGLExtensionDepthTexture, WebGLExtension)
|
||||
|
||||
DOMCI_DATA(WebGLExtensionDepthTexture, WebGLExtensionDepthTexture)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(WebGLExtensionDepthTexture)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIWebGLExtensionDepthTexture)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, WebGLExtension)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(WebGLExtensionDepthTexture)
|
||||
NS_INTERFACE_MAP_END_INHERITING(WebGLExtension)
|
||||
|
||||
IMPL_WEBGL_EXTENSION_GOOP(WebGLExtensionDepthTexture)
|
||||
|
@ -5,45 +5,31 @@
|
||||
|
||||
#include "WebGLContext.h"
|
||||
#include "WebGLExtensions.h"
|
||||
#include "mozilla/dom/WebGLRenderingContextBinding.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
WebGLExtensionLoseContext::WebGLExtensionLoseContext(WebGLContext* context) :
|
||||
WebGLExtension(context)
|
||||
WebGLExtensionLoseContext::WebGLExtensionLoseContext(WebGLContext* context)
|
||||
: WebGLExtensionBase(context)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
WebGLExtensionLoseContext::~WebGLExtensionLoseContext()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
void
|
||||
WebGLExtensionLoseContext::LoseContext()
|
||||
{
|
||||
if (!mContext->LoseContext())
|
||||
mContext->mWebGLError = LOCAL_GL_INVALID_OPERATION;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
void
|
||||
WebGLExtensionLoseContext::RestoreContext()
|
||||
{
|
||||
if (!mContext->RestoreContext())
|
||||
mContext->mWebGLError = LOCAL_GL_INVALID_OPERATION;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(WebGLExtensionLoseContext, WebGLExtension)
|
||||
NS_IMPL_RELEASE_INHERITED(WebGLExtensionLoseContext, WebGLExtension)
|
||||
|
||||
DOMCI_DATA(WebGLExtensionLoseContext, WebGLExtensionLoseContext)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(WebGLExtensionLoseContext)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIWebGLExtensionLoseContext)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, WebGLExtension)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(WebGLExtensionLoseContext)
|
||||
NS_INTERFACE_MAP_END_INHERITING(WebGLExtension)
|
||||
IMPL_WEBGL_EXTENSION_GOOP(WebGLExtensionLoseContext)
|
||||
|
@ -5,27 +5,17 @@
|
||||
|
||||
#include "WebGLContext.h"
|
||||
#include "WebGLExtensions.h"
|
||||
#include "mozilla/dom/WebGLRenderingContextBinding.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
WebGLExtensionStandardDerivatives::WebGLExtensionStandardDerivatives(WebGLContext* context) :
|
||||
WebGLExtension(context)
|
||||
WebGLExtensionStandardDerivatives::WebGLExtensionStandardDerivatives(WebGLContext* context)
|
||||
: WebGLExtensionBase(context)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
WebGLExtensionStandardDerivatives::~WebGLExtensionStandardDerivatives()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(WebGLExtensionStandardDerivatives, WebGLExtension)
|
||||
NS_IMPL_RELEASE_INHERITED(WebGLExtensionStandardDerivatives, WebGLExtension)
|
||||
|
||||
DOMCI_DATA(WebGLExtensionStandardDerivatives, WebGLExtensionStandardDerivatives)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(WebGLExtensionStandardDerivatives)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIWebGLExtensionStandardDerivatives)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, WebGLExtension)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(WebGLExtensionStandardDerivatives)
|
||||
NS_INTERFACE_MAP_END_INHERITING(WebGLExtension)
|
||||
IMPL_WEBGL_EXTENSION_GOOP(WebGLExtensionStandardDerivatives)
|
||||
|
@ -5,27 +5,17 @@
|
||||
|
||||
#include "WebGLContext.h"
|
||||
#include "WebGLExtensions.h"
|
||||
#include "mozilla/dom/WebGLRenderingContextBinding.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
WebGLExtensionTextureFilterAnisotropic::WebGLExtensionTextureFilterAnisotropic(WebGLContext* context) :
|
||||
WebGLExtension(context)
|
||||
WebGLExtensionTextureFilterAnisotropic::WebGLExtensionTextureFilterAnisotropic(WebGLContext* context)
|
||||
: WebGLExtensionBase(context)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
WebGLExtensionTextureFilterAnisotropic::~WebGLExtensionTextureFilterAnisotropic()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(WebGLExtensionTextureFilterAnisotropic, WebGLExtension)
|
||||
NS_IMPL_RELEASE_INHERITED(WebGLExtensionTextureFilterAnisotropic, WebGLExtension)
|
||||
|
||||
DOMCI_DATA(WebGLExtensionTextureFilterAnisotropic, WebGLExtensionTextureFilterAnisotropic)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(WebGLExtensionTextureFilterAnisotropic)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIWebGLExtensionTextureFilterAnisotropic)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, WebGLExtension)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(WebGLExtensionTextureFilterAnisotropic)
|
||||
NS_INTERFACE_MAP_END_INHERITING(WebGLExtension)
|
||||
IMPL_WEBGL_EXTENSION_GOOP(WebGLExtensionTextureFilterAnisotropic)
|
||||
|
20
content/canvas/src/WebGLExtensionTextureFloat.cpp
Normal file
20
content/canvas/src/WebGLExtensionTextureFloat.cpp
Normal file
@ -0,0 +1,20 @@
|
||||
/* 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;
|
||||
|
||||
WebGLExtensionTextureFloat::WebGLExtensionTextureFloat(WebGLContext* context)
|
||||
: WebGLExtensionBase(context)
|
||||
{
|
||||
}
|
||||
|
||||
WebGLExtensionTextureFloat::~WebGLExtensionTextureFloat()
|
||||
{
|
||||
}
|
||||
|
||||
IMPL_WEBGL_EXTENSION_GOOP(WebGLExtensionTextureFloat)
|
@ -6,92 +6,119 @@
|
||||
#ifndef WEBGLEXTENSIONS_H_
|
||||
#define WEBGLEXTENSIONS_H_
|
||||
|
||||
#include "WebGLContext.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class WebGLExtensionLoseContext :
|
||||
public nsIWebGLExtensionLoseContext,
|
||||
public WebGLExtension
|
||||
class WebGLExtensionBase
|
||||
: public nsISupports
|
||||
, public WebGLContextBoundObject
|
||||
, public nsWrapperCache
|
||||
{
|
||||
public:
|
||||
WebGLExtensionBase(WebGLContext*);
|
||||
virtual ~WebGLExtensionBase();
|
||||
|
||||
WebGLContext *GetParentObject() const {
|
||||
return Context();
|
||||
}
|
||||
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(WebGLExtensionBase)
|
||||
};
|
||||
|
||||
#define DECL_WEBGL_EXTENSION_GOOP \
|
||||
JSObject* WrapObject(JSContext *cx, JSObject *scope, bool *triedToWrap);
|
||||
|
||||
#define IMPL_WEBGL_EXTENSION_GOOP(WebGLExtensionType) \
|
||||
JSObject* \
|
||||
WebGLExtensionType::WrapObject(JSContext *cx, JSObject *scope, bool *triedToWrap) { \
|
||||
return dom::WebGLExtensionType##Binding::Wrap(cx, scope, this, triedToWrap); \
|
||||
}
|
||||
|
||||
class WebGLExtensionCompressedTextureATC
|
||||
: public WebGLExtensionBase
|
||||
{
|
||||
public:
|
||||
WebGLExtensionCompressedTextureATC(WebGLContext*);
|
||||
virtual ~WebGLExtensionCompressedTextureATC();
|
||||
|
||||
DECL_WEBGL_EXTENSION_GOOP
|
||||
};
|
||||
|
||||
class WebGLExtensionCompressedTexturePVRTC
|
||||
: public WebGLExtensionBase
|
||||
{
|
||||
public:
|
||||
WebGLExtensionCompressedTexturePVRTC(WebGLContext*);
|
||||
virtual ~WebGLExtensionCompressedTexturePVRTC();
|
||||
|
||||
DECL_WEBGL_EXTENSION_GOOP
|
||||
};
|
||||
|
||||
class WebGLExtensionCompressedTextureS3TC
|
||||
: public WebGLExtensionBase
|
||||
{
|
||||
public:
|
||||
WebGLExtensionCompressedTextureS3TC(WebGLContext*);
|
||||
virtual ~WebGLExtensionCompressedTextureS3TC();
|
||||
|
||||
DECL_WEBGL_EXTENSION_GOOP
|
||||
};
|
||||
|
||||
class WebGLExtensionDepthTexture
|
||||
: public WebGLExtensionBase
|
||||
{
|
||||
public:
|
||||
WebGLExtensionDepthTexture(WebGLContext*);
|
||||
virtual ~WebGLExtensionDepthTexture();
|
||||
|
||||
DECL_WEBGL_EXTENSION_GOOP
|
||||
};
|
||||
|
||||
class WebGLExtensionLoseContext
|
||||
: public WebGLExtensionBase
|
||||
{
|
||||
public:
|
||||
WebGLExtensionLoseContext(WebGLContext*);
|
||||
virtual ~WebGLExtensionLoseContext();
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIWEBGLEXTENSIONLOSECONTEXT
|
||||
void LoseContext();
|
||||
void RestoreContext();
|
||||
|
||||
DECL_WEBGL_EXTENSION_GOOP
|
||||
};
|
||||
|
||||
class WebGLExtensionStandardDerivatives :
|
||||
public nsIWebGLExtensionStandardDerivatives,
|
||||
public WebGLExtension
|
||||
class WebGLExtensionStandardDerivatives
|
||||
: public WebGLExtensionBase
|
||||
{
|
||||
public:
|
||||
WebGLExtensionStandardDerivatives(WebGLContext* context);
|
||||
WebGLExtensionStandardDerivatives(WebGLContext*);
|
||||
virtual ~WebGLExtensionStandardDerivatives();
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIWEBGLEXTENSION
|
||||
DECL_WEBGL_EXTENSION_GOOP
|
||||
};
|
||||
|
||||
class WebGLExtensionTextureFilterAnisotropic :
|
||||
public nsIWebGLExtensionTextureFilterAnisotropic,
|
||||
public WebGLExtension
|
||||
class WebGLExtensionTextureFilterAnisotropic
|
||||
: public WebGLExtensionBase
|
||||
{
|
||||
public:
|
||||
WebGLExtensionTextureFilterAnisotropic(WebGLContext* context);
|
||||
WebGLExtensionTextureFilterAnisotropic(WebGLContext*);
|
||||
virtual ~WebGLExtensionTextureFilterAnisotropic();
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIWEBGLEXTENSION
|
||||
DECL_WEBGL_EXTENSION_GOOP
|
||||
};
|
||||
|
||||
class WebGLExtensionCompressedTextureS3TC :
|
||||
public nsIWebGLExtensionCompressedTextureS3TC,
|
||||
public WebGLExtension
|
||||
class WebGLExtensionTextureFloat
|
||||
: public WebGLExtensionBase
|
||||
{
|
||||
public:
|
||||
WebGLExtensionCompressedTextureS3TC(WebGLContext* context);
|
||||
virtual ~WebGLExtensionCompressedTextureS3TC();
|
||||
WebGLExtensionTextureFloat(WebGLContext*);
|
||||
virtual ~WebGLExtensionTextureFloat();
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIWEBGLEXTENSION
|
||||
DECL_WEBGL_EXTENSION_GOOP
|
||||
};
|
||||
|
||||
class WebGLExtensionCompressedTextureATC :
|
||||
public nsIWebGLExtensionCompressedTextureATC,
|
||||
public WebGLExtension
|
||||
{
|
||||
public:
|
||||
WebGLExtensionCompressedTextureATC(WebGLContext* context);
|
||||
virtual ~WebGLExtensionCompressedTextureATC();
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIWEBGLEXTENSION
|
||||
};
|
||||
|
||||
class WebGLExtensionCompressedTexturePVRTC :
|
||||
public nsIWebGLExtensionCompressedTexturePVRTC,
|
||||
public WebGLExtension
|
||||
{
|
||||
public:
|
||||
WebGLExtensionCompressedTexturePVRTC(WebGLContext* context);
|
||||
virtual ~WebGLExtensionCompressedTexturePVRTC();
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIWEBGLEXTENSION
|
||||
};
|
||||
|
||||
class WebGLExtensionDepthTexture :
|
||||
public nsIWebGLExtensionDepthTexture,
|
||||
public WebGLExtension
|
||||
{
|
||||
public:
|
||||
WebGLExtensionDepthTexture(WebGLContext* context);
|
||||
virtual ~WebGLExtensionDepthTexture();
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIWEBGLEXTENSION
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // WEBGLEXTENSIONS_H_
|
||||
|
@ -1569,30 +1569,6 @@ static nsDOMClassInfoData sClassInfoData[] = {
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(WebGLActiveInfo, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(WebGLExtension, WebGLExtensionSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS |
|
||||
nsIXPCScriptable::WANT_ADDPROPERTY)
|
||||
NS_DEFINE_CLASSINFO_DATA(WebGLExtensionStandardDerivatives, WebGLExtensionSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS |
|
||||
nsIXPCScriptable::WANT_ADDPROPERTY)
|
||||
NS_DEFINE_CLASSINFO_DATA(WebGLExtensionTextureFilterAnisotropic, WebGLExtensionSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS |
|
||||
nsIXPCScriptable::WANT_ADDPROPERTY)
|
||||
NS_DEFINE_CLASSINFO_DATA(WebGLExtensionLoseContext, WebGLExtensionSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS |
|
||||
nsIXPCScriptable::WANT_ADDPROPERTY)
|
||||
NS_DEFINE_CLASSINFO_DATA(WebGLExtensionCompressedTextureS3TC, WebGLExtensionSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS |
|
||||
nsIXPCScriptable::WANT_ADDPROPERTY)
|
||||
NS_DEFINE_CLASSINFO_DATA(WebGLExtensionCompressedTextureATC, WebGLExtensionSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS |
|
||||
nsIXPCScriptable::WANT_ADDPROPERTY)
|
||||
NS_DEFINE_CLASSINFO_DATA(WebGLExtensionCompressedTexturePVRTC, WebGLExtensionSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS |
|
||||
nsIXPCScriptable::WANT_ADDPROPERTY)
|
||||
NS_DEFINE_CLASSINFO_DATA(WebGLExtensionDepthTexture, WebGLExtensionSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS |
|
||||
nsIXPCScriptable::WANT_ADDPROPERTY)
|
||||
|
||||
NS_DEFINE_CLASSINFO_DATA(PaintRequest, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
@ -4259,38 +4235,6 @@ nsDOMClassInfo::Init()
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIWebGLActiveInfo)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(WebGLExtension, nsIWebGLExtension)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIWebGLExtension)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(WebGLExtensionStandardDerivatives, nsIWebGLExtensionStandardDerivatives)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIWebGLExtensionStandardDerivatives)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(WebGLExtensionTextureFilterAnisotropic, nsIWebGLExtensionTextureFilterAnisotropic)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIWebGLExtensionTextureFilterAnisotropic)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(WebGLExtensionLoseContext, nsIWebGLExtensionLoseContext)
|
||||
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(WebGLExtensionCompressedTextureATC, nsIWebGLExtensionCompressedTextureATC)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIWebGLExtensionCompressedTextureATC)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(WebGLExtensionCompressedTexturePVRTC, nsIWebGLExtensionCompressedTexturePVRTC)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIWebGLExtensionCompressedTexturePVRTC)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(WebGLExtensionDepthTexture, nsIWebGLExtensionDepthTexture)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIWebGLExtensionDepthTexture)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(PaintRequest, nsIDOMPaintRequest)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMPaintRequest)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
@ -10836,35 +10780,6 @@ nsSVGStringListSH::GetStringAt(nsISupports *aNative, int32_t aIndex,
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
WebGLExtensionSH::AddProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
JSObject *obj, jsid id, jsval *vp, bool *_retval)
|
||||
{
|
||||
WebGLExtensionSH::PreserveWrapper(GetNative(wrapper, obj));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
WebGLExtensionSH::PreserveWrapper(nsISupports *aNative)
|
||||
{
|
||||
WebGLExtension* ext = static_cast<WebGLExtension*>(aNative);
|
||||
nsContentUtils::PreserveWrapper(aNative, ext);
|
||||
}
|
||||
|
||||
nsresult
|
||||
WebGLExtensionSH::PreCreate(nsISupports *nativeObj, JSContext *cx,
|
||||
JSObject *globalObj, JSObject **parentObj)
|
||||
{
|
||||
*parentObj = globalObj;
|
||||
|
||||
WebGLExtension *ext = static_cast<WebGLExtension*>(nativeObj);
|
||||
WebGLContext *webgl = ext->Context();
|
||||
nsINode *node = webgl->GetParentObject();
|
||||
|
||||
return WrapNativeParent(cx, globalObj, node, parentObj);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsNewDOMBindingNoWrapperCacheSH::PreCreate(nsISupports *nativeObj,
|
||||
JSContext *cx,
|
||||
|
@ -481,32 +481,6 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
// WebGLExtension scriptable helper
|
||||
|
||||
class WebGLExtensionSH : public nsDOMGenericSH
|
||||
{
|
||||
protected:
|
||||
WebGLExtensionSH(nsDOMClassInfoData* aData) : nsDOMGenericSH(aData)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~WebGLExtensionSH()
|
||||
{
|
||||
}
|
||||
|
||||
public:
|
||||
NS_IMETHOD PreCreate(nsISupports *nativeObj, JSContext *cx,
|
||||
JSObject *globalObj, JSObject **parentObj);
|
||||
NS_IMETHOD AddProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
JSObject *obj, jsid id, jsval *vp, bool *_retval);
|
||||
virtual void PreserveWrapper(nsISupports *aNative);
|
||||
|
||||
static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
|
||||
{
|
||||
return new WebGLExtensionSH(aData);
|
||||
}
|
||||
};
|
||||
|
||||
// scriptable helper for new-binding objects without wrapper caches
|
||||
|
||||
class nsNewDOMBindingNoWrapperCacheSH : public nsDOMGenericSH
|
||||
|
@ -454,14 +454,6 @@ DOMCI_CLASS(WebGLShader)
|
||||
DOMCI_CLASS(WebGLFramebuffer)
|
||||
DOMCI_CLASS(WebGLRenderbuffer)
|
||||
DOMCI_CLASS(WebGLActiveInfo)
|
||||
DOMCI_CLASS(WebGLExtension)
|
||||
DOMCI_CLASS(WebGLExtensionStandardDerivatives)
|
||||
DOMCI_CLASS(WebGLExtensionTextureFilterAnisotropic)
|
||||
DOMCI_CLASS(WebGLExtensionLoseContext)
|
||||
DOMCI_CLASS(WebGLExtensionCompressedTextureS3TC)
|
||||
DOMCI_CLASS(WebGLExtensionCompressedTextureATC)
|
||||
DOMCI_CLASS(WebGLExtensionCompressedTexturePVRTC)
|
||||
DOMCI_CLASS(WebGLExtensionDepthTexture)
|
||||
|
||||
DOMCI_CLASS(PaintRequest)
|
||||
DOMCI_CLASS(PaintRequestList)
|
||||
|
@ -342,6 +342,46 @@ DOMInterfaces = {
|
||||
'headerFile': 'mozilla/dom/TextDecoder.h',
|
||||
},
|
||||
|
||||
'WebGLExtensionCompressedTextureATC': {
|
||||
'nativeType': 'mozilla::WebGLExtensionCompressedTextureATC',
|
||||
'headerFile': 'WebGLExtensions.h'
|
||||
},
|
||||
|
||||
'WebGLExtensionCompressedTexturePVRTC': {
|
||||
'nativeType': 'mozilla::WebGLExtensionCompressedTexturePVRTC',
|
||||
'headerFile': 'WebGLExtensions.h'
|
||||
},
|
||||
|
||||
'WebGLExtensionCompressedTextureS3TC': {
|
||||
'nativeType': 'mozilla::WebGLExtensionCompressedTextureS3TC',
|
||||
'headerFile': 'WebGLExtensions.h'
|
||||
},
|
||||
|
||||
'WebGLExtensionDepthTexture': {
|
||||
'nativeType': 'mozilla::WebGLExtensionDepthTexture',
|
||||
'headerFile': 'WebGLExtensions.h'
|
||||
},
|
||||
|
||||
'WebGLExtensionLoseContext': {
|
||||
'nativeType': 'mozilla::WebGLExtensionLoseContext',
|
||||
'headerFile': 'WebGLExtensions.h'
|
||||
},
|
||||
|
||||
'WebGLExtensionStandardDerivatives': {
|
||||
'nativeType': 'mozilla::WebGLExtensionStandardDerivatives',
|
||||
'headerFile': 'WebGLExtensions.h'
|
||||
},
|
||||
|
||||
'WebGLExtensionTextureFilterAnisotropic': {
|
||||
'nativeType': 'mozilla::WebGLExtensionTextureFilterAnisotropic',
|
||||
'headerFile': 'WebGLExtensions.h'
|
||||
},
|
||||
|
||||
'WebGLExtensionTextureFloat': {
|
||||
'nativeType': 'mozilla::WebGLExtensionTextureFloat',
|
||||
'headerFile': 'WebGLExtensions.h'
|
||||
},
|
||||
|
||||
'WebGLRenderingContext': {
|
||||
'nativeType': 'mozilla::WebGLContext',
|
||||
'headerFile': 'WebGLContext.h',
|
||||
@ -350,14 +390,14 @@ DOMInterfaces = {
|
||||
'implicitJSContext': [ 'texImage2D', 'texSubImage2D' ],
|
||||
},
|
||||
|
||||
'WebGLUniformLocation': {
|
||||
'nativeType': 'mozilla::WebGLUniformLocation',
|
||||
'WebGLShaderPrecisionFormat': {
|
||||
'nativeType': 'mozilla::WebGLShaderPrecisionFormat',
|
||||
'headerFile': 'WebGLContext.h',
|
||||
'wrapperCache': False
|
||||
},
|
||||
|
||||
'WebGLShaderPrecisionFormat': {
|
||||
'nativeType': 'mozilla::WebGLShaderPrecisionFormat',
|
||||
'WebGLUniformLocation': {
|
||||
'nativeType': 'mozilla::WebGLUniformLocation',
|
||||
'headerFile': 'WebGLContext.h',
|
||||
'wrapperCache': False
|
||||
},
|
||||
@ -546,8 +586,6 @@ addExternalIface('WebGLBuffer', nativeType='mozilla::WebGLBuffer',
|
||||
headerFile='WebGLContext.h')
|
||||
addExternalIface('WebGLContextAttributes', nativeType='JSObject',
|
||||
headerFile='jsapi.h')
|
||||
addExternalIface('WebGLExtension', nativeType='nsIWebGLExtension',
|
||||
headerFile='WebGLContext.h')
|
||||
addExternalIface('WebGLFramebuffer', nativeType='mozilla::WebGLFramebuffer',
|
||||
headerFile='WebGLContext.h')
|
||||
addExternalIface('WebGLProgram', nativeType='mozilla::WebGLProgram',
|
||||
|
@ -9,8 +9,6 @@
|
||||
* Copyright © 2012 Khronos Group
|
||||
*/
|
||||
|
||||
// AUTOGENERATED FILE -- DO NOT EDIT -- SEE Makefile
|
||||
//
|
||||
// WebGL IDL definitions scraped from the Khronos specification:
|
||||
// https://www.khronos.org/registry/webgl/specs/latest/
|
||||
//
|
||||
@ -51,8 +49,6 @@ typedef float GLclampf;
|
||||
boolean preserveDrawingBuffer = false;
|
||||
};*/
|
||||
|
||||
interface WebGLExtension;
|
||||
|
||||
interface WebGLBuffer;
|
||||
|
||||
interface WebGLFramebuffer;
|
||||
@ -500,12 +496,10 @@ interface WebGLRenderingContext {
|
||||
|
||||
[WebGLHandlesContextLoss, Throws] WebGLContextAttributes getContextAttributes();
|
||||
[WebGLHandlesContextLoss] boolean isContextLost();
|
||||
|
||||
|
||||
sequence<DOMString>? getSupportedExtensions();
|
||||
|
||||
// XXXbz In the spec, this is "object?"; I'm making it
|
||||
// WebGLExtension? just for ease of implementation.
|
||||
WebGLExtension? getExtension(DOMString name);
|
||||
object? getExtension(DOMString name);
|
||||
|
||||
void activeTexture(GLenum texture);
|
||||
void attachShader(WebGLProgram? program, WebGLShader? shader);
|
||||
@ -764,3 +758,53 @@ interface WebGLContextEvent : Event {
|
||||
/*dictionary WebGLContextEventInit : EventInit {
|
||||
DOMString statusMessage;
|
||||
};*/
|
||||
|
||||
|
||||
// specific extension interfaces
|
||||
|
||||
interface WebGLExtensionStandardDerivatives {
|
||||
const GLenum FRAGMENT_SHADER_DERIVATIVE_HINT_OES = 0x8B8B;
|
||||
};
|
||||
|
||||
interface WebGLExtensionLoseContext {
|
||||
void loseContext();
|
||||
void restoreContext();
|
||||
};
|
||||
|
||||
interface WebGLExtensionTextureFilterAnisotropic
|
||||
{
|
||||
const GLenum TEXTURE_MAX_ANISOTROPY_EXT = 0x84FE;
|
||||
const GLenum MAX_TEXTURE_MAX_ANISOTROPY_EXT = 0x84FF;
|
||||
};
|
||||
|
||||
interface WebGLExtensionCompressedTextureS3TC
|
||||
{
|
||||
const GLenum COMPRESSED_RGB_S3TC_DXT1_EXT = 0x83F0;
|
||||
const GLenum COMPRESSED_RGBA_S3TC_DXT1_EXT = 0x83F1;
|
||||
const GLenum COMPRESSED_RGBA_S3TC_DXT3_EXT = 0x83F2;
|
||||
const GLenum COMPRESSED_RGBA_S3TC_DXT5_EXT = 0x83F3;
|
||||
};
|
||||
|
||||
interface WebGLExtensionCompressedTextureATC
|
||||
{
|
||||
const GLenum COMPRESSED_RGB_ATC_WEBGL = 0x8C92;
|
||||
const GLenum COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL = 0x8C93;
|
||||
const GLenum COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL = 0x87EE;
|
||||
};
|
||||
|
||||
interface WebGLExtensionCompressedTexturePVRTC
|
||||
{
|
||||
const GLenum COMPRESSED_RGB_PVRTC_4BPPV1 = 0x8C00;
|
||||
const GLenum COMPRESSED_RGB_PVRTC_2BPPV1 = 0x8C01;
|
||||
const GLenum COMPRESSED_RGBA_PVRTC_4BPPV1 = 0x8C02;
|
||||
const GLenum COMPRESSED_RGBA_PVRTC_2BPPV1 = 0x8C03;
|
||||
};
|
||||
|
||||
interface WebGLExtensionDepthTexture
|
||||
{
|
||||
const GLenum UNSIGNED_INT_24_8_WEBGL = 0x84FA;
|
||||
};
|
||||
|
||||
interface WebGLExtensionTextureFloat
|
||||
{
|
||||
};
|
||||
|
@ -469,14 +469,6 @@ irregularFilenames = {
|
||||
'nsIWebGLFramebuffer': 'nsIDOMWebGLRenderingContext',
|
||||
'nsIWebGLRenderbuffer': 'nsIDOMWebGLRenderingContext',
|
||||
'nsIWebGLActiveInfo': 'nsIDOMWebGLRenderingContext',
|
||||
'nsIWebGLExtension': 'nsIDOMWebGLRenderingContext',
|
||||
'nsIWebGLExtensionStandardDerivatives' : 'nsIDOMWebGLRenderingContext',
|
||||
'nsIWebGLExtensionTextureFilterAnisotropic' : 'nsIDOMWebGLRenderingContext',
|
||||
'nsIWebGLExtensionLoseContext' : 'nsIDOMWebGLRenderingContext',
|
||||
'nsIWebGLExtensionCompressedTextureS3TC' : 'nsIDOMWebGLRenderingContext',
|
||||
'nsIWebGLExtensionCompressedTextureATC' : 'nsIDOMWebGLRenderingContext',
|
||||
'nsIWebGLExtensionCompressedTexturePVRTC' : 'nsIDOMWebGLRenderingContext',
|
||||
'nsIWebGLExtensionDepthTexture' : 'nsIDOMWebGLRenderingContext',
|
||||
|
||||
'nsIIndexedDatabaseUsageCallback': 'nsIIndexedDatabaseManager',
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user