2011-10-01 08:45:50 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-05-21 15:12:37 +04: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-10-01 08:45:50 +04:00
|
|
|
|
|
|
|
#ifndef WEBGLEXTENSIONS_H_
|
|
|
|
#define WEBGLEXTENSIONS_H_
|
|
|
|
|
2014-03-08 01:25:27 +04:00
|
|
|
#include "jsapi.h"
|
|
|
|
#include "mozilla/Attributes.h"
|
|
|
|
#include "nsWrapperCache.h"
|
|
|
|
#include "WebGLObjectModel.h"
|
|
|
|
#include "WebGLTypes.h"
|
|
|
|
|
2011-10-01 08:45:50 +04:00
|
|
|
namespace mozilla {
|
|
|
|
|
2013-06-11 00:00:35 +04:00
|
|
|
class WebGLContext;
|
2014-03-08 01:25:27 +04:00
|
|
|
class WebGLShader;
|
|
|
|
class WebGLVertexArray;
|
2013-06-11 00:00:35 +04:00
|
|
|
|
2012-10-04 01:13:05 +04:00
|
|
|
class WebGLExtensionBase
|
2013-09-04 16:14:48 +04:00
|
|
|
: public nsWrapperCache
|
2012-10-04 01:13:05 +04:00
|
|
|
, public WebGLContextBoundObject
|
2011-10-27 00:00:44 +04:00
|
|
|
{
|
|
|
|
public:
|
2014-09-02 02:26:43 +04:00
|
|
|
explicit WebGLExtensionBase(WebGLContext* aValue);
|
2012-10-04 01:13:05 +04:00
|
|
|
|
|
|
|
WebGLContext *GetParentObject() const {
|
|
|
|
return Context();
|
|
|
|
}
|
2011-10-27 00:00:44 +04:00
|
|
|
|
2014-03-12 06:51:39 +04:00
|
|
|
void MarkLost();
|
|
|
|
|
2013-09-04 16:14:48 +04:00
|
|
|
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(WebGLExtensionBase)
|
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(WebGLExtensionBase)
|
2014-03-12 06:51:39 +04:00
|
|
|
|
|
|
|
protected:
|
2014-06-26 17:30:49 +04:00
|
|
|
virtual ~WebGLExtensionBase();
|
|
|
|
|
2014-03-12 06:51:39 +04:00
|
|
|
bool mIsLost;
|
2011-10-27 00:00:44 +04:00
|
|
|
};
|
|
|
|
|
2013-04-25 20:29:54 +04:00
|
|
|
#define DECL_WEBGL_EXTENSION_GOOP \
|
2014-04-09 02:27:18 +04:00
|
|
|
virtual JSObject* WrapObject(JSContext *cx) MOZ_OVERRIDE;
|
2012-10-04 01:13:05 +04:00
|
|
|
|
|
|
|
#define IMPL_WEBGL_EXTENSION_GOOP(WebGLExtensionType) \
|
|
|
|
JSObject* \
|
2014-04-09 02:27:18 +04:00
|
|
|
WebGLExtensionType::WrapObject(JSContext *cx) { \
|
Bug 991742 part 6. Remove the "aScope" argument of binding Wrap() methods. r=bholley
This patch was mostly generated with this command:
find . -name "*.h" -o -name "*.cpp" | xargs sed -e 's/Binding::Wrap(aCx, aScope, this/Binding::Wrap(aCx, this/' -e 's/Binding_workers::Wrap(aCx, aScope, this/Binding_workers::Wrap(aCx, this/' -e 's/Binding::Wrap(cx, scope, this/Binding::Wrap(cx, this/' -i ""
plus a few manual fixes to dom/bindings/Codegen.py, js/xpconnect/src/event_impl_gen.py, and a few C++ files that were not caught in the search-and-replace above.
2014-04-09 02:27:17 +04:00
|
|
|
return dom::WebGLExtensionType##Binding::Wrap(cx, this); \
|
2012-10-04 01:13:05 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
class WebGLExtensionCompressedTextureATC
|
|
|
|
: public WebGLExtensionBase
|
2011-10-01 08:45:50 +04:00
|
|
|
{
|
|
|
|
public:
|
2014-09-03 07:21:31 +04:00
|
|
|
explicit WebGLExtensionCompressedTextureATC(WebGLContext*);
|
2012-10-04 01:13:05 +04:00
|
|
|
virtual ~WebGLExtensionCompressedTextureATC();
|
2011-10-01 08:45:50 +04:00
|
|
|
|
2012-10-04 01:13:05 +04:00
|
|
|
DECL_WEBGL_EXTENSION_GOOP
|
2011-10-01 08:45:50 +04:00
|
|
|
};
|
|
|
|
|
2014-03-11 02:42:58 +04:00
|
|
|
class WebGLExtensionCompressedTextureETC1
|
|
|
|
: public WebGLExtensionBase
|
|
|
|
{
|
|
|
|
public:
|
2014-09-03 07:21:31 +04:00
|
|
|
explicit WebGLExtensionCompressedTextureETC1(WebGLContext*);
|
2014-03-11 02:42:58 +04:00
|
|
|
virtual ~WebGLExtensionCompressedTextureETC1();
|
|
|
|
|
|
|
|
DECL_WEBGL_EXTENSION_GOOP
|
|
|
|
};
|
|
|
|
|
2012-10-04 01:13:05 +04:00
|
|
|
class WebGLExtensionCompressedTexturePVRTC
|
|
|
|
: public WebGLExtensionBase
|
2012-02-23 17:43:57 +04:00
|
|
|
{
|
|
|
|
public:
|
2014-09-03 07:21:31 +04:00
|
|
|
explicit WebGLExtensionCompressedTexturePVRTC(WebGLContext*);
|
2012-10-04 01:13:05 +04:00
|
|
|
virtual ~WebGLExtensionCompressedTexturePVRTC();
|
2012-02-23 17:43:57 +04:00
|
|
|
|
2012-10-04 01:13:05 +04:00
|
|
|
DECL_WEBGL_EXTENSION_GOOP
|
2012-02-23 17:43:57 +04:00
|
|
|
};
|
|
|
|
|
2012-10-04 01:13:05 +04:00
|
|
|
class WebGLExtensionCompressedTextureS3TC
|
|
|
|
: public WebGLExtensionBase
|
2012-05-08 21:29:31 +04:00
|
|
|
{
|
|
|
|
public:
|
2014-09-03 07:21:31 +04:00
|
|
|
explicit WebGLExtensionCompressedTextureS3TC(WebGLContext*);
|
2012-05-08 21:29:31 +04:00
|
|
|
virtual ~WebGLExtensionCompressedTextureS3TC();
|
|
|
|
|
2012-10-04 01:13:05 +04:00
|
|
|
DECL_WEBGL_EXTENSION_GOOP
|
2012-05-08 21:29:31 +04:00
|
|
|
};
|
|
|
|
|
2012-10-17 23:11:51 +04:00
|
|
|
class WebGLExtensionDebugRendererInfo
|
|
|
|
: public WebGLExtensionBase
|
|
|
|
{
|
|
|
|
public:
|
2014-09-03 07:21:31 +04:00
|
|
|
explicit WebGLExtensionDebugRendererInfo(WebGLContext*);
|
2012-10-17 23:11:51 +04:00
|
|
|
virtual ~WebGLExtensionDebugRendererInfo();
|
|
|
|
|
|
|
|
DECL_WEBGL_EXTENSION_GOOP
|
|
|
|
};
|
|
|
|
|
2014-02-12 02:37:06 +04:00
|
|
|
class WebGLExtensionDebugShaders
|
|
|
|
: public WebGLExtensionBase
|
|
|
|
{
|
|
|
|
public:
|
2014-09-03 07:21:31 +04:00
|
|
|
explicit WebGLExtensionDebugShaders(WebGLContext*);
|
2014-02-12 02:37:06 +04:00
|
|
|
virtual ~WebGLExtensionDebugShaders();
|
|
|
|
|
|
|
|
void GetTranslatedShaderSource(WebGLShader* shader, nsAString& retval);
|
|
|
|
|
|
|
|
DECL_WEBGL_EXTENSION_GOOP
|
|
|
|
};
|
|
|
|
|
2012-10-04 01:13:05 +04:00
|
|
|
class WebGLExtensionDepthTexture
|
|
|
|
: public WebGLExtensionBase
|
2012-09-25 16:49:28 +04:00
|
|
|
{
|
|
|
|
public:
|
2014-09-03 07:21:31 +04:00
|
|
|
explicit WebGLExtensionDepthTexture(WebGLContext*);
|
2012-10-04 01:13:05 +04:00
|
|
|
virtual ~WebGLExtensionDepthTexture();
|
2012-09-25 16:49:28 +04:00
|
|
|
|
2012-10-04 01:13:05 +04:00
|
|
|
DECL_WEBGL_EXTENSION_GOOP
|
2012-09-25 16:49:28 +04:00
|
|
|
};
|
|
|
|
|
2013-05-13 17:22:30 +04:00
|
|
|
class WebGLExtensionElementIndexUint
|
|
|
|
: public WebGLExtensionBase
|
|
|
|
{
|
|
|
|
public:
|
2014-09-03 07:21:31 +04:00
|
|
|
explicit WebGLExtensionElementIndexUint(WebGLContext*);
|
2013-05-13 17:22:30 +04:00
|
|
|
virtual ~WebGLExtensionElementIndexUint();
|
|
|
|
|
|
|
|
DECL_WEBGL_EXTENSION_GOOP
|
|
|
|
};
|
|
|
|
|
2014-02-14 03:00:12 +04:00
|
|
|
class WebGLExtensionFragDepth
|
|
|
|
: public WebGLExtensionBase
|
|
|
|
{
|
|
|
|
public:
|
2014-09-03 07:21:31 +04:00
|
|
|
explicit WebGLExtensionFragDepth(WebGLContext*);
|
2014-02-14 03:00:12 +04:00
|
|
|
virtual ~WebGLExtensionFragDepth();
|
|
|
|
|
|
|
|
static bool IsSupported(const WebGLContext* context);
|
|
|
|
|
|
|
|
DECL_WEBGL_EXTENSION_GOOP
|
|
|
|
};
|
|
|
|
|
2012-10-04 01:13:05 +04:00
|
|
|
class WebGLExtensionLoseContext
|
|
|
|
: public WebGLExtensionBase
|
2012-09-25 16:49:28 +04:00
|
|
|
{
|
|
|
|
public:
|
2014-09-03 07:21:31 +04:00
|
|
|
explicit WebGLExtensionLoseContext(WebGLContext*);
|
2012-10-04 01:13:05 +04:00
|
|
|
virtual ~WebGLExtensionLoseContext();
|
2012-09-25 16:49:28 +04:00
|
|
|
|
2012-10-04 01:13:05 +04:00
|
|
|
void LoseContext();
|
|
|
|
void RestoreContext();
|
|
|
|
|
|
|
|
DECL_WEBGL_EXTENSION_GOOP
|
2012-09-25 16:49:28 +04:00
|
|
|
};
|
|
|
|
|
2013-11-05 01:05:04 +04:00
|
|
|
class WebGLExtensionSRGB
|
|
|
|
: public WebGLExtensionBase
|
|
|
|
{
|
|
|
|
public:
|
2014-09-03 07:21:31 +04:00
|
|
|
explicit WebGLExtensionSRGB(WebGLContext*);
|
2013-11-05 01:05:04 +04:00
|
|
|
virtual ~WebGLExtensionSRGB();
|
|
|
|
|
|
|
|
static bool IsSupported(const WebGLContext* context);
|
|
|
|
|
|
|
|
DECL_WEBGL_EXTENSION_GOOP
|
|
|
|
};
|
|
|
|
|
2012-10-04 01:13:05 +04:00
|
|
|
class WebGLExtensionStandardDerivatives
|
|
|
|
: public WebGLExtensionBase
|
2012-08-14 05:17:55 +04:00
|
|
|
{
|
|
|
|
public:
|
2014-09-03 07:21:31 +04:00
|
|
|
explicit WebGLExtensionStandardDerivatives(WebGLContext*);
|
2012-10-04 01:13:05 +04:00
|
|
|
virtual ~WebGLExtensionStandardDerivatives();
|
|
|
|
|
|
|
|
DECL_WEBGL_EXTENSION_GOOP
|
|
|
|
};
|
|
|
|
|
2014-07-24 19:58:43 +04:00
|
|
|
class WebGLExtensionShaderTextureLod
|
|
|
|
: public WebGLExtensionBase
|
|
|
|
{
|
|
|
|
public:
|
2014-09-03 07:21:31 +04:00
|
|
|
explicit WebGLExtensionShaderTextureLod(WebGLContext*);
|
2014-07-24 19:58:43 +04:00
|
|
|
virtual ~WebGLExtensionShaderTextureLod();
|
|
|
|
|
|
|
|
DECL_WEBGL_EXTENSION_GOOP
|
|
|
|
};
|
|
|
|
|
2012-10-04 01:13:05 +04:00
|
|
|
class WebGLExtensionTextureFilterAnisotropic
|
|
|
|
: public WebGLExtensionBase
|
|
|
|
{
|
|
|
|
public:
|
2014-09-03 07:21:31 +04:00
|
|
|
explicit WebGLExtensionTextureFilterAnisotropic(WebGLContext*);
|
2012-10-04 01:13:05 +04:00
|
|
|
virtual ~WebGLExtensionTextureFilterAnisotropic();
|
|
|
|
|
|
|
|
DECL_WEBGL_EXTENSION_GOOP
|
|
|
|
};
|
|
|
|
|
|
|
|
class WebGLExtensionTextureFloat
|
|
|
|
: public WebGLExtensionBase
|
|
|
|
{
|
|
|
|
public:
|
2014-09-03 07:21:31 +04:00
|
|
|
explicit WebGLExtensionTextureFloat(WebGLContext*);
|
2012-10-04 01:13:05 +04:00
|
|
|
virtual ~WebGLExtensionTextureFloat();
|
2012-08-14 05:17:55 +04:00
|
|
|
|
2012-10-04 01:13:05 +04:00
|
|
|
DECL_WEBGL_EXTENSION_GOOP
|
2012-08-14 05:17:55 +04:00
|
|
|
};
|
|
|
|
|
2013-06-11 00:00:52 +04:00
|
|
|
class WebGLExtensionTextureFloatLinear
|
|
|
|
: public WebGLExtensionBase
|
|
|
|
{
|
|
|
|
public:
|
2014-09-03 07:21:31 +04:00
|
|
|
explicit WebGLExtensionTextureFloatLinear(WebGLContext*);
|
2013-06-11 00:00:52 +04:00
|
|
|
virtual ~WebGLExtensionTextureFloatLinear();
|
|
|
|
|
|
|
|
DECL_WEBGL_EXTENSION_GOOP
|
|
|
|
};
|
|
|
|
|
2014-01-24 01:47:37 +04:00
|
|
|
class WebGLExtensionTextureHalfFloat
|
|
|
|
: public WebGLExtensionBase
|
|
|
|
{
|
|
|
|
public:
|
2014-09-03 07:21:31 +04:00
|
|
|
explicit WebGLExtensionTextureHalfFloat(WebGLContext*);
|
2014-01-24 01:47:37 +04:00
|
|
|
virtual ~WebGLExtensionTextureHalfFloat();
|
|
|
|
|
|
|
|
DECL_WEBGL_EXTENSION_GOOP
|
|
|
|
};
|
|
|
|
|
2014-02-13 18:53:53 +04:00
|
|
|
class WebGLExtensionTextureHalfFloatLinear
|
|
|
|
: public WebGLExtensionBase
|
|
|
|
{
|
|
|
|
public:
|
2014-09-03 07:21:31 +04:00
|
|
|
explicit WebGLExtensionTextureHalfFloatLinear(WebGLContext*);
|
2014-02-13 18:53:53 +04:00
|
|
|
virtual ~WebGLExtensionTextureHalfFloatLinear();
|
|
|
|
|
|
|
|
DECL_WEBGL_EXTENSION_GOOP
|
|
|
|
};
|
|
|
|
|
2014-03-08 01:26:17 +04:00
|
|
|
class WebGLExtensionColorBufferFloat
|
|
|
|
: public WebGLExtensionBase
|
|
|
|
{
|
|
|
|
public:
|
2014-09-03 07:21:31 +04:00
|
|
|
explicit WebGLExtensionColorBufferFloat(WebGLContext*);
|
2014-03-08 01:26:17 +04:00
|
|
|
virtual ~WebGLExtensionColorBufferFloat();
|
|
|
|
|
|
|
|
static bool IsSupported(const WebGLContext*);
|
|
|
|
|
|
|
|
DECL_WEBGL_EXTENSION_GOOP
|
|
|
|
};
|
|
|
|
|
|
|
|
class WebGLExtensionColorBufferHalfFloat
|
|
|
|
: public WebGLExtensionBase
|
|
|
|
{
|
|
|
|
public:
|
2014-09-03 07:21:31 +04:00
|
|
|
explicit WebGLExtensionColorBufferHalfFloat(WebGLContext*);
|
2014-03-08 01:26:17 +04:00
|
|
|
virtual ~WebGLExtensionColorBufferHalfFloat();
|
|
|
|
|
|
|
|
static bool IsSupported(const WebGLContext*);
|
|
|
|
|
|
|
|
DECL_WEBGL_EXTENSION_GOOP
|
|
|
|
};
|
|
|
|
|
2013-06-22 03:44:17 +04:00
|
|
|
class WebGLExtensionDrawBuffers
|
|
|
|
: public WebGLExtensionBase
|
|
|
|
{
|
|
|
|
public:
|
2014-09-03 07:21:31 +04:00
|
|
|
explicit WebGLExtensionDrawBuffers(WebGLContext*);
|
2013-06-22 03:44:17 +04:00
|
|
|
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
|
2014-01-27 22:30:33 +04:00
|
|
|
for GL_MAX_DRAW_BUFFERS = 4 at least to be able to use all requested color attachments.
|
2013-06-22 03:44:17 +04:00
|
|
|
See DrawBuffersWEBGL in WebGLExtensionDrawBuffers.cpp inner comments for more informations.
|
|
|
|
*/
|
|
|
|
|
|
|
|
DECL_WEBGL_EXTENSION_GOOP
|
|
|
|
};
|
|
|
|
|
2013-06-28 01:07:21 +04:00
|
|
|
class WebGLExtensionVertexArray
|
|
|
|
: public WebGLExtensionBase
|
|
|
|
{
|
|
|
|
public:
|
2014-09-02 02:26:43 +04:00
|
|
|
explicit WebGLExtensionVertexArray(WebGLContext* aValue);
|
2013-06-28 01:07:21 +04:00
|
|
|
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
|
|
|
|
};
|
|
|
|
|
2013-08-14 02:11:01 +04:00
|
|
|
class WebGLExtensionInstancedArrays
|
|
|
|
: public WebGLExtensionBase
|
|
|
|
{
|
|
|
|
public:
|
2014-09-02 02:26:43 +04:00
|
|
|
explicit WebGLExtensionInstancedArrays(WebGLContext* aContext);
|
2013-08-14 02:11:01 +04:00
|
|
|
virtual ~WebGLExtensionInstancedArrays();
|
|
|
|
|
2013-09-04 16:14:43 +04:00
|
|
|
void DrawArraysInstancedANGLE(GLenum mode, GLint first,
|
|
|
|
GLsizei count, GLsizei primcount);
|
|
|
|
void DrawElementsInstancedANGLE(GLenum mode, GLsizei count,
|
|
|
|
GLenum type, WebGLintptr offset,
|
|
|
|
GLsizei primcount);
|
|
|
|
void VertexAttribDivisorANGLE(GLuint index, GLuint divisor);
|
2013-08-14 02:11:01 +04:00
|
|
|
|
|
|
|
static bool IsSupported(const WebGLContext* context);
|
|
|
|
|
|
|
|
DECL_WEBGL_EXTENSION_GOOP
|
|
|
|
};
|
|
|
|
|
2014-06-14 20:07:53 +04:00
|
|
|
class WebGLExtensionBlendMinMax
|
|
|
|
: public WebGLExtensionBase
|
|
|
|
{
|
|
|
|
public:
|
2014-09-02 02:26:43 +04:00
|
|
|
explicit WebGLExtensionBlendMinMax(WebGLContext* aValue);
|
2014-06-14 20:07:53 +04:00
|
|
|
virtual ~WebGLExtensionBlendMinMax();
|
|
|
|
|
|
|
|
static bool IsSupported(const WebGLContext*);
|
|
|
|
|
|
|
|
DECL_WEBGL_EXTENSION_GOOP
|
|
|
|
};
|
|
|
|
|
2012-10-04 01:13:05 +04:00
|
|
|
} // namespace mozilla
|
2011-10-01 08:45:50 +04:00
|
|
|
|
|
|
|
#endif // WEBGLEXTENSIONS_H_
|