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
|
|
|
|
2014-11-13 20:03:50 -08:00
|
|
|
#ifndef WEBGL_EXTENSIONS_H_
|
|
|
|
#define WEBGL_EXTENSIONS_H_
|
2011-09-30 21:45:50 -07:00
|
|
|
|
2014-03-07 13:25:27 -08:00
|
|
|
#include "jsapi.h"
|
|
|
|
#include "mozilla/Attributes.h"
|
|
|
|
#include "nsWrapperCache.h"
|
|
|
|
#include "WebGLObjectModel.h"
|
|
|
|
#include "WebGLTypes.h"
|
|
|
|
|
2011-09-30 21:45:50 -07:00
|
|
|
namespace mozilla {
|
|
|
|
|
2013-06-10 13:00:35 -07:00
|
|
|
class WebGLContext;
|
2014-03-07 13:25:27 -08:00
|
|
|
class WebGLShader;
|
|
|
|
class WebGLVertexArray;
|
2013-06-10 13:00:35 -07:00
|
|
|
|
2012-10-03 14:13:05 -07:00
|
|
|
class WebGLExtensionBase
|
2013-09-04 05:14:48 -07:00
|
|
|
: public nsWrapperCache
|
2012-10-03 14:13:05 -07:00
|
|
|
, public WebGLContextBoundObject
|
2011-10-26 13:00:44 -07:00
|
|
|
{
|
|
|
|
public:
|
2014-11-13 20:03:50 -08:00
|
|
|
explicit WebGLExtensionBase(WebGLContext* webgl);
|
2012-10-03 14:13:05 -07:00
|
|
|
|
2014-11-13 20:03:50 -08:00
|
|
|
WebGLContext* GetParentObject() const {
|
2012-10-03 14:13:05 -07:00
|
|
|
return Context();
|
|
|
|
}
|
2011-10-26 13:00:44 -07:00
|
|
|
|
2014-03-11 19:51:39 -07:00
|
|
|
void MarkLost();
|
|
|
|
|
2013-09-04 05:14:48 -07:00
|
|
|
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(WebGLExtensionBase)
|
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(WebGLExtensionBase)
|
2014-03-11 19:51:39 -07:00
|
|
|
|
|
|
|
protected:
|
2014-06-26 06:30:49 -07:00
|
|
|
virtual ~WebGLExtensionBase();
|
|
|
|
|
2014-03-11 19:51:39 -07:00
|
|
|
bool mIsLost;
|
2011-10-26 13:00:44 -07:00
|
|
|
};
|
|
|
|
|
2014-11-13 20:03:50 -08:00
|
|
|
#define DECL_WEBGL_EXTENSION_GOOP \
|
|
|
|
virtual JSObject* WrapObject(JSContext* cx) MOZ_OVERRIDE;
|
2012-10-03 14:13:05 -07:00
|
|
|
|
2014-11-13 20:03:50 -08:00
|
|
|
#define IMPL_WEBGL_EXTENSION_GOOP(WebGLExtensionType) \
|
|
|
|
JSObject* \
|
|
|
|
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-08 15:27:17 -07:00
|
|
|
return dom::WebGLExtensionType##Binding::Wrap(cx, this); \
|
2012-10-03 14:13:05 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
class WebGLExtensionCompressedTextureATC
|
|
|
|
: public WebGLExtensionBase
|
2011-09-30 21:45:50 -07:00
|
|
|
{
|
|
|
|
public:
|
2014-09-02 20:21:31 -07:00
|
|
|
explicit WebGLExtensionCompressedTextureATC(WebGLContext*);
|
2012-10-03 14:13:05 -07:00
|
|
|
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
|
|
|
};
|
|
|
|
|
2014-03-10 15:42:58 -07:00
|
|
|
class WebGLExtensionCompressedTextureETC1
|
|
|
|
: public WebGLExtensionBase
|
|
|
|
{
|
|
|
|
public:
|
2014-09-02 20:21:31 -07:00
|
|
|
explicit WebGLExtensionCompressedTextureETC1(WebGLContext*);
|
2014-03-10 15:42:58 -07:00
|
|
|
virtual ~WebGLExtensionCompressedTextureETC1();
|
|
|
|
|
|
|
|
DECL_WEBGL_EXTENSION_GOOP
|
|
|
|
};
|
|
|
|
|
2012-10-03 14:13:05 -07:00
|
|
|
class WebGLExtensionCompressedTexturePVRTC
|
|
|
|
: public WebGLExtensionBase
|
2012-02-23 05:43:57 -08:00
|
|
|
{
|
|
|
|
public:
|
2014-09-02 20:21:31 -07:00
|
|
|
explicit WebGLExtensionCompressedTexturePVRTC(WebGLContext*);
|
2012-10-03 14:13:05 -07:00
|
|
|
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:
|
2014-09-02 20:21:31 -07:00
|
|
|
explicit 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:
|
2014-09-02 20:21:31 -07:00
|
|
|
explicit WebGLExtensionDebugRendererInfo(WebGLContext*);
|
2012-10-17 12:11:51 -07:00
|
|
|
virtual ~WebGLExtensionDebugRendererInfo();
|
|
|
|
|
|
|
|
DECL_WEBGL_EXTENSION_GOOP
|
|
|
|
};
|
|
|
|
|
2014-02-11 14:37:06 -08:00
|
|
|
class WebGLExtensionDebugShaders
|
|
|
|
: public WebGLExtensionBase
|
|
|
|
{
|
|
|
|
public:
|
2014-09-02 20:21:31 -07:00
|
|
|
explicit WebGLExtensionDebugShaders(WebGLContext*);
|
2014-02-11 14:37:06 -08:00
|
|
|
virtual ~WebGLExtensionDebugShaders();
|
|
|
|
|
|
|
|
void GetTranslatedShaderSource(WebGLShader* shader, nsAString& retval);
|
|
|
|
|
|
|
|
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:
|
2014-09-02 20:21:31 -07:00
|
|
|
explicit WebGLExtensionDepthTexture(WebGLContext*);
|
2012-10-03 14:13:05 -07:00
|
|
|
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:
|
2014-09-02 20:21:31 -07:00
|
|
|
explicit WebGLExtensionElementIndexUint(WebGLContext*);
|
2013-05-13 06:22:30 -07:00
|
|
|
virtual ~WebGLExtensionElementIndexUint();
|
|
|
|
|
|
|
|
DECL_WEBGL_EXTENSION_GOOP
|
|
|
|
};
|
|
|
|
|
2014-02-13 15:00:12 -08:00
|
|
|
class WebGLExtensionFragDepth
|
|
|
|
: public WebGLExtensionBase
|
|
|
|
{
|
|
|
|
public:
|
2014-09-02 20:21:31 -07:00
|
|
|
explicit WebGLExtensionFragDepth(WebGLContext*);
|
2014-02-13 15:00:12 -08:00
|
|
|
virtual ~WebGLExtensionFragDepth();
|
|
|
|
|
|
|
|
static bool IsSupported(const WebGLContext* context);
|
|
|
|
|
|
|
|
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:
|
2014-09-02 20:21:31 -07:00
|
|
|
explicit WebGLExtensionLoseContext(WebGLContext*);
|
2012-10-03 14:13:05 -07:00
|
|
|
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
|
|
|
};
|
|
|
|
|
2013-11-04 13:05:04 -08:00
|
|
|
class WebGLExtensionSRGB
|
|
|
|
: public WebGLExtensionBase
|
|
|
|
{
|
|
|
|
public:
|
2014-09-02 20:21:31 -07:00
|
|
|
explicit WebGLExtensionSRGB(WebGLContext*);
|
2013-11-04 13:05:04 -08:00
|
|
|
virtual ~WebGLExtensionSRGB();
|
|
|
|
|
|
|
|
static bool IsSupported(const WebGLContext* context);
|
|
|
|
|
|
|
|
DECL_WEBGL_EXTENSION_GOOP
|
|
|
|
};
|
|
|
|
|
2012-10-03 14:13:05 -07:00
|
|
|
class WebGLExtensionStandardDerivatives
|
|
|
|
: public WebGLExtensionBase
|
2012-08-13 18:17:55 -07:00
|
|
|
{
|
|
|
|
public:
|
2014-09-02 20:21:31 -07:00
|
|
|
explicit WebGLExtensionStandardDerivatives(WebGLContext*);
|
2012-10-03 14:13:05 -07:00
|
|
|
virtual ~WebGLExtensionStandardDerivatives();
|
|
|
|
|
|
|
|
DECL_WEBGL_EXTENSION_GOOP
|
|
|
|
};
|
|
|
|
|
2014-07-24 08:58:43 -07:00
|
|
|
class WebGLExtensionShaderTextureLod
|
|
|
|
: public WebGLExtensionBase
|
|
|
|
{
|
|
|
|
public:
|
2014-09-02 20:21:31 -07:00
|
|
|
explicit WebGLExtensionShaderTextureLod(WebGLContext*);
|
2014-07-24 08:58:43 -07:00
|
|
|
virtual ~WebGLExtensionShaderTextureLod();
|
|
|
|
|
|
|
|
DECL_WEBGL_EXTENSION_GOOP
|
|
|
|
};
|
|
|
|
|
2012-10-03 14:13:05 -07:00
|
|
|
class WebGLExtensionTextureFilterAnisotropic
|
|
|
|
: public WebGLExtensionBase
|
|
|
|
{
|
|
|
|
public:
|
2014-09-02 20:21:31 -07:00
|
|
|
explicit WebGLExtensionTextureFilterAnisotropic(WebGLContext*);
|
2012-10-03 14:13:05 -07:00
|
|
|
virtual ~WebGLExtensionTextureFilterAnisotropic();
|
|
|
|
|
|
|
|
DECL_WEBGL_EXTENSION_GOOP
|
|
|
|
};
|
|
|
|
|
|
|
|
class WebGLExtensionTextureFloat
|
|
|
|
: public WebGLExtensionBase
|
|
|
|
{
|
|
|
|
public:
|
2014-09-02 20:21:31 -07:00
|
|
|
explicit WebGLExtensionTextureFloat(WebGLContext*);
|
2012-10-03 14:13:05 -07:00
|
|
|
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:
|
2014-09-02 20:21:31 -07:00
|
|
|
explicit WebGLExtensionTextureFloatLinear(WebGLContext*);
|
2013-06-10 13:00:52 -07:00
|
|
|
virtual ~WebGLExtensionTextureFloatLinear();
|
|
|
|
|
|
|
|
DECL_WEBGL_EXTENSION_GOOP
|
|
|
|
};
|
|
|
|
|
2014-01-23 13:47:37 -08:00
|
|
|
class WebGLExtensionTextureHalfFloat
|
|
|
|
: public WebGLExtensionBase
|
|
|
|
{
|
|
|
|
public:
|
2014-09-02 20:21:31 -07:00
|
|
|
explicit WebGLExtensionTextureHalfFloat(WebGLContext*);
|
2014-01-23 13:47:37 -08:00
|
|
|
virtual ~WebGLExtensionTextureHalfFloat();
|
|
|
|
|
|
|
|
DECL_WEBGL_EXTENSION_GOOP
|
|
|
|
};
|
|
|
|
|
2014-02-13 06:53:53 -08:00
|
|
|
class WebGLExtensionTextureHalfFloatLinear
|
|
|
|
: public WebGLExtensionBase
|
|
|
|
{
|
|
|
|
public:
|
2014-09-02 20:21:31 -07:00
|
|
|
explicit WebGLExtensionTextureHalfFloatLinear(WebGLContext*);
|
2014-02-13 06:53:53 -08:00
|
|
|
virtual ~WebGLExtensionTextureHalfFloatLinear();
|
|
|
|
|
|
|
|
DECL_WEBGL_EXTENSION_GOOP
|
|
|
|
};
|
|
|
|
|
2014-03-07 13:26:17 -08:00
|
|
|
class WebGLExtensionColorBufferFloat
|
|
|
|
: public WebGLExtensionBase
|
|
|
|
{
|
|
|
|
public:
|
2014-09-02 20:21:31 -07:00
|
|
|
explicit WebGLExtensionColorBufferFloat(WebGLContext*);
|
2014-03-07 13:26:17 -08:00
|
|
|
virtual ~WebGLExtensionColorBufferFloat();
|
|
|
|
|
|
|
|
static bool IsSupported(const WebGLContext*);
|
|
|
|
|
|
|
|
DECL_WEBGL_EXTENSION_GOOP
|
|
|
|
};
|
|
|
|
|
|
|
|
class WebGLExtensionColorBufferHalfFloat
|
|
|
|
: public WebGLExtensionBase
|
|
|
|
{
|
|
|
|
public:
|
2014-09-02 20:21:31 -07:00
|
|
|
explicit WebGLExtensionColorBufferHalfFloat(WebGLContext*);
|
2014-03-07 13:26:17 -08:00
|
|
|
virtual ~WebGLExtensionColorBufferHalfFloat();
|
|
|
|
|
|
|
|
static bool IsSupported(const WebGLContext*);
|
|
|
|
|
|
|
|
DECL_WEBGL_EXTENSION_GOOP
|
|
|
|
};
|
|
|
|
|
2013-06-21 16:44:17 -07:00
|
|
|
class WebGLExtensionDrawBuffers
|
|
|
|
: public WebGLExtensionBase
|
|
|
|
{
|
|
|
|
public:
|
2014-09-02 20:21:31 -07:00
|
|
|
explicit WebGLExtensionDrawBuffers(WebGLContext*);
|
2013-06-21 16:44:17 -07:00
|
|
|
virtual ~WebGLExtensionDrawBuffers();
|
|
|
|
|
|
|
|
void DrawBuffersWEBGL(const dom::Sequence<GLenum>& buffers);
|
|
|
|
|
|
|
|
static bool IsSupported(const WebGLContext*);
|
|
|
|
|
2014-11-13 20:03:50 -08:00
|
|
|
static const size_t kMinColorAttachments = 4;
|
|
|
|
static const size_t kMinDrawBuffers = 4;
|
2013-06-21 16:44:17 -07:00
|
|
|
/*
|
|
|
|
WEBGL_draw_buffers does not give a minal value for GL_MAX_DRAW_BUFFERS. But, we request
|
2014-01-27 10:30:33 -08:00
|
|
|
for GL_MAX_DRAW_BUFFERS = 4 at least to be able to use all requested color attachments.
|
2013-06-21 16:44:17 -07:00
|
|
|
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:
|
2014-11-13 20:03:50 -08:00
|
|
|
explicit WebGLExtensionVertexArray(WebGLContext* webgl);
|
2013-06-27 14:07:21 -07:00
|
|
|
virtual ~WebGLExtensionVertexArray();
|
|
|
|
|
|
|
|
already_AddRefed<WebGLVertexArray> CreateVertexArrayOES();
|
|
|
|
void DeleteVertexArrayOES(WebGLVertexArray* array);
|
|
|
|
bool IsVertexArrayOES(WebGLVertexArray* array);
|
|
|
|
void BindVertexArrayOES(WebGLVertexArray* array);
|
|
|
|
|
|
|
|
DECL_WEBGL_EXTENSION_GOOP
|
|
|
|
};
|
|
|
|
|
2013-08-13 15:11:01 -07:00
|
|
|
class WebGLExtensionInstancedArrays
|
|
|
|
: public WebGLExtensionBase
|
|
|
|
{
|
|
|
|
public:
|
2014-11-13 20:03:50 -08:00
|
|
|
explicit WebGLExtensionInstancedArrays(WebGLContext* webgl);
|
2013-08-13 15:11:01 -07:00
|
|
|
virtual ~WebGLExtensionInstancedArrays();
|
|
|
|
|
2014-11-13 20:03:50 -08:00
|
|
|
void DrawArraysInstancedANGLE(GLenum mode, GLint first, GLsizei count,
|
|
|
|
GLsizei primcount);
|
|
|
|
void DrawElementsInstancedANGLE(GLenum mode, GLsizei count, GLenum type,
|
|
|
|
WebGLintptr offset, GLsizei primcount);
|
2013-09-04 05:14:43 -07:00
|
|
|
void VertexAttribDivisorANGLE(GLuint index, GLuint divisor);
|
2013-08-13 15:11:01 -07:00
|
|
|
|
2014-11-13 20:03:50 -08:00
|
|
|
static bool IsSupported(const WebGLContext* webgl);
|
2013-08-13 15:11:01 -07:00
|
|
|
|
|
|
|
DECL_WEBGL_EXTENSION_GOOP
|
|
|
|
};
|
|
|
|
|
2014-06-14 09:07:53 -07:00
|
|
|
class WebGLExtensionBlendMinMax
|
|
|
|
: public WebGLExtensionBase
|
|
|
|
{
|
|
|
|
public:
|
2014-11-13 20:03:50 -08:00
|
|
|
explicit WebGLExtensionBlendMinMax(WebGLContext* webgl);
|
2014-06-14 09:07:53 -07:00
|
|
|
virtual ~WebGLExtensionBlendMinMax();
|
|
|
|
|
|
|
|
static bool IsSupported(const WebGLContext*);
|
|
|
|
|
|
|
|
DECL_WEBGL_EXTENSION_GOOP
|
|
|
|
};
|
|
|
|
|
2012-10-03 14:13:05 -07:00
|
|
|
} // namespace mozilla
|
2011-09-30 21:45:50 -07:00
|
|
|
|
2014-11-13 20:03:50 -08:00
|
|
|
#endif // WEBGL_EXTENSIONS_H_
|