2011-09-30 21:45:50 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-05-21 04:12:37 -07:00
|
|
|
/* 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/. */
|
2011-09-30 21:45:50 -07:00
|
|
|
|
|
|
|
#ifndef WEBGLEXTENSIONS_H_
|
|
|
|
#define WEBGLEXTENSIONS_H_
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
|
2013-06-10 13:00:35 -07:00
|
|
|
class WebGLContext;
|
|
|
|
|
2012-10-03 14:13:05 -07:00
|
|
|
class WebGLExtensionBase
|
|
|
|
: public nsISupports
|
|
|
|
, public WebGLContextBoundObject
|
|
|
|
, public nsWrapperCache
|
2011-10-26 13:00:44 -07:00
|
|
|
{
|
|
|
|
public:
|
2012-10-03 14:13:05 -07:00
|
|
|
WebGLExtensionBase(WebGLContext*);
|
|
|
|
virtual ~WebGLExtensionBase();
|
|
|
|
|
|
|
|
WebGLContext *GetParentObject() const {
|
|
|
|
return Context();
|
|
|
|
}
|
2011-10-26 13:00:44 -07:00
|
|
|
|
2012-10-03 14:13:05 -07:00
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(WebGLExtensionBase)
|
2011-10-26 13:00:44 -07:00
|
|
|
};
|
|
|
|
|
2013-04-25 09:29:54 -07:00
|
|
|
#define DECL_WEBGL_EXTENSION_GOOP \
|
|
|
|
virtual JSObject* WrapObject(JSContext *cx, \
|
|
|
|
JS::Handle<JSObject*> scope) MOZ_OVERRIDE;
|
2012-10-03 14:13:05 -07:00
|
|
|
|
|
|
|
#define IMPL_WEBGL_EXTENSION_GOOP(WebGLExtensionType) \
|
|
|
|
JSObject* \
|
2013-04-25 09:29:54 -07:00
|
|
|
WebGLExtensionType::WrapObject(JSContext *cx, JS::Handle<JSObject*> scope) { \
|
2013-03-11 16:03:47 -07:00
|
|
|
return dom::WebGLExtensionType##Binding::Wrap(cx, scope, this); \
|
2012-10-03 14:13:05 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
class WebGLExtensionCompressedTextureATC
|
|
|
|
: public WebGLExtensionBase
|
2011-09-30 21:45:50 -07:00
|
|
|
{
|
|
|
|
public:
|
2012-10-03 14:13:05 -07:00
|
|
|
WebGLExtensionCompressedTextureATC(WebGLContext*);
|
|
|
|
virtual ~WebGLExtensionCompressedTextureATC();
|
2011-09-30 21:45:50 -07:00
|
|
|
|
2012-10-03 14:13:05 -07:00
|
|
|
DECL_WEBGL_EXTENSION_GOOP
|
2011-09-30 21:45:50 -07:00
|
|
|
};
|
|
|
|
|
2012-10-03 14:13:05 -07:00
|
|
|
class WebGLExtensionCompressedTexturePVRTC
|
|
|
|
: public WebGLExtensionBase
|
2012-02-23 05:43:57 -08:00
|
|
|
{
|
|
|
|
public:
|
2012-10-03 14:13:05 -07:00
|
|
|
WebGLExtensionCompressedTexturePVRTC(WebGLContext*);
|
|
|
|
virtual ~WebGLExtensionCompressedTexturePVRTC();
|
2012-02-23 05:43:57 -08:00
|
|
|
|
2012-10-03 14:13:05 -07:00
|
|
|
DECL_WEBGL_EXTENSION_GOOP
|
2012-02-23 05:43:57 -08:00
|
|
|
};
|
|
|
|
|
2012-10-03 14:13:05 -07:00
|
|
|
class WebGLExtensionCompressedTextureS3TC
|
|
|
|
: public WebGLExtensionBase
|
2012-05-08 10:29:31 -07:00
|
|
|
{
|
|
|
|
public:
|
2012-10-03 14:13:05 -07:00
|
|
|
WebGLExtensionCompressedTextureS3TC(WebGLContext*);
|
2012-05-08 10:29:31 -07:00
|
|
|
virtual ~WebGLExtensionCompressedTextureS3TC();
|
|
|
|
|
2012-10-03 14:13:05 -07:00
|
|
|
DECL_WEBGL_EXTENSION_GOOP
|
2012-05-08 10:29:31 -07:00
|
|
|
};
|
|
|
|
|
2012-10-17 12:11:51 -07:00
|
|
|
class WebGLExtensionDebugRendererInfo
|
|
|
|
: public WebGLExtensionBase
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
WebGLExtensionDebugRendererInfo(WebGLContext*);
|
|
|
|
virtual ~WebGLExtensionDebugRendererInfo();
|
|
|
|
|
|
|
|
DECL_WEBGL_EXTENSION_GOOP
|
|
|
|
};
|
|
|
|
|
2012-10-03 14:13:05 -07:00
|
|
|
class WebGLExtensionDepthTexture
|
|
|
|
: public WebGLExtensionBase
|
2012-09-25 05:49:28 -07:00
|
|
|
{
|
|
|
|
public:
|
2012-10-03 14:13:05 -07:00
|
|
|
WebGLExtensionDepthTexture(WebGLContext*);
|
|
|
|
virtual ~WebGLExtensionDepthTexture();
|
2012-09-25 05:49:28 -07:00
|
|
|
|
2012-10-03 14:13:05 -07:00
|
|
|
DECL_WEBGL_EXTENSION_GOOP
|
2012-09-25 05:49:28 -07:00
|
|
|
};
|
|
|
|
|
2013-05-13 06:22:30 -07:00
|
|
|
class WebGLExtensionElementIndexUint
|
|
|
|
: public WebGLExtensionBase
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
WebGLExtensionElementIndexUint(WebGLContext*);
|
|
|
|
virtual ~WebGLExtensionElementIndexUint();
|
|
|
|
|
|
|
|
DECL_WEBGL_EXTENSION_GOOP
|
|
|
|
};
|
|
|
|
|
2012-10-03 14:13:05 -07:00
|
|
|
class WebGLExtensionLoseContext
|
|
|
|
: public WebGLExtensionBase
|
2012-09-25 05:49:28 -07:00
|
|
|
{
|
|
|
|
public:
|
2012-10-03 14:13:05 -07:00
|
|
|
WebGLExtensionLoseContext(WebGLContext*);
|
|
|
|
virtual ~WebGLExtensionLoseContext();
|
2012-09-25 05:49:28 -07:00
|
|
|
|
2012-10-03 14:13:05 -07:00
|
|
|
void LoseContext();
|
|
|
|
void RestoreContext();
|
|
|
|
|
|
|
|
DECL_WEBGL_EXTENSION_GOOP
|
2012-09-25 05:49:28 -07:00
|
|
|
};
|
|
|
|
|
2012-10-03 14:13:05 -07:00
|
|
|
class WebGLExtensionStandardDerivatives
|
|
|
|
: public WebGLExtensionBase
|
2012-08-13 18:17:55 -07:00
|
|
|
{
|
|
|
|
public:
|
2012-10-03 14:13:05 -07:00
|
|
|
WebGLExtensionStandardDerivatives(WebGLContext*);
|
|
|
|
virtual ~WebGLExtensionStandardDerivatives();
|
|
|
|
|
|
|
|
DECL_WEBGL_EXTENSION_GOOP
|
|
|
|
};
|
|
|
|
|
|
|
|
class WebGLExtensionTextureFilterAnisotropic
|
|
|
|
: public WebGLExtensionBase
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
WebGLExtensionTextureFilterAnisotropic(WebGLContext*);
|
|
|
|
virtual ~WebGLExtensionTextureFilterAnisotropic();
|
|
|
|
|
|
|
|
DECL_WEBGL_EXTENSION_GOOP
|
|
|
|
};
|
|
|
|
|
|
|
|
class WebGLExtensionTextureFloat
|
|
|
|
: public WebGLExtensionBase
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
WebGLExtensionTextureFloat(WebGLContext*);
|
|
|
|
virtual ~WebGLExtensionTextureFloat();
|
2012-08-13 18:17:55 -07:00
|
|
|
|
2012-10-03 14:13:05 -07:00
|
|
|
DECL_WEBGL_EXTENSION_GOOP
|
2012-08-13 18:17:55 -07:00
|
|
|
};
|
|
|
|
|
2013-06-10 13:00:52 -07:00
|
|
|
class WebGLExtensionTextureFloatLinear
|
|
|
|
: public WebGLExtensionBase
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
WebGLExtensionTextureFloatLinear(WebGLContext*);
|
|
|
|
virtual ~WebGLExtensionTextureFloatLinear();
|
|
|
|
|
|
|
|
DECL_WEBGL_EXTENSION_GOOP
|
|
|
|
};
|
|
|
|
|
2013-06-21 16:44:17 -07:00
|
|
|
class WebGLExtensionDrawBuffers
|
|
|
|
: public WebGLExtensionBase
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
WebGLExtensionDrawBuffers(WebGLContext*);
|
|
|
|
virtual ~WebGLExtensionDrawBuffers();
|
|
|
|
|
|
|
|
void DrawBuffersWEBGL(const dom::Sequence<GLenum>& buffers);
|
|
|
|
|
|
|
|
static bool IsSupported(const WebGLContext*);
|
|
|
|
|
|
|
|
static const size_t sMinColorAttachments = 4;
|
|
|
|
static const size_t sMinDrawBuffers = 4;
|
|
|
|
/*
|
|
|
|
WEBGL_draw_buffers does not give a minal value for GL_MAX_DRAW_BUFFERS. But, we request
|
|
|
|
for GL_MAX_DRAW_BUFFERS = 4 at least to be able to use all requested color attachements.
|
|
|
|
See DrawBuffersWEBGL in WebGLExtensionDrawBuffers.cpp inner comments for more informations.
|
|
|
|
*/
|
|
|
|
|
|
|
|
DECL_WEBGL_EXTENSION_GOOP
|
|
|
|
};
|
|
|
|
|
2013-06-27 14:07:21 -07:00
|
|
|
class WebGLExtensionVertexArray
|
|
|
|
: public WebGLExtensionBase
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
WebGLExtensionVertexArray(WebGLContext*);
|
|
|
|
virtual ~WebGLExtensionVertexArray();
|
|
|
|
|
|
|
|
already_AddRefed<WebGLVertexArray> CreateVertexArrayOES();
|
|
|
|
void DeleteVertexArrayOES(WebGLVertexArray* array);
|
|
|
|
bool IsVertexArrayOES(WebGLVertexArray* array);
|
|
|
|
void BindVertexArrayOES(WebGLVertexArray* array);
|
|
|
|
|
|
|
|
static bool IsSupported(const WebGLContext* context);
|
|
|
|
|
|
|
|
DECL_WEBGL_EXTENSION_GOOP
|
|
|
|
};
|
|
|
|
|
2012-10-03 14:13:05 -07:00
|
|
|
} // namespace mozilla
|
2011-09-30 21:45:50 -07:00
|
|
|
|
|
|
|
#endif // WEBGLEXTENSIONS_H_
|