2009-09-02 17:47:49 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2010-05-17 21:04:22 -07:00
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
* the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/MPL/
|
|
|
|
*
|
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
|
|
|
*
|
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is
|
|
|
|
* Mozilla Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 2009
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
|
|
|
* Vladimir Vukicevic <vladimir@pobox.com> (original author)
|
|
|
|
* Mark Steele <mwsteele@gmail.com>
|
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
|
|
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
|
|
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
|
|
|
|
2009-09-02 17:47:49 -07:00
|
|
|
#include "WebGLContext.h"
|
|
|
|
|
|
|
|
#include "nsIConsoleService.h"
|
|
|
|
#include "nsIPrefService.h"
|
|
|
|
#include "nsServiceManagerUtils.h"
|
|
|
|
#include "nsIClassInfoImpl.h"
|
|
|
|
#include "nsContentUtils.h"
|
2009-11-01 16:33:39 -08:00
|
|
|
#include "nsIXPConnect.h"
|
2009-09-17 23:01:07 -07:00
|
|
|
#include "nsDOMError.h"
|
2009-09-02 17:47:49 -07:00
|
|
|
|
|
|
|
#include "gfxContext.h"
|
|
|
|
#include "gfxPattern.h"
|
|
|
|
|
2009-11-01 16:33:39 -08:00
|
|
|
#include "CanvasUtils.h"
|
|
|
|
#include "NativeJSContext.h"
|
|
|
|
|
2010-05-17 21:04:22 -07:00
|
|
|
#include "GLContextProvider.h"
|
|
|
|
|
2009-09-02 17:47:49 -07:00
|
|
|
using namespace mozilla;
|
2010-05-17 21:04:22 -07:00
|
|
|
using namespace mozilla::gl;
|
2009-09-02 17:47:49 -07:00
|
|
|
|
|
|
|
nsresult NS_NewCanvasRenderingContextWebGL(nsICanvasRenderingContextWebGL** aResult);
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
NS_NewCanvasRenderingContextWebGL(nsICanvasRenderingContextWebGL** aResult)
|
|
|
|
{
|
|
|
|
nsICanvasRenderingContextWebGL* ctx = new WebGLContext();
|
|
|
|
if (!ctx)
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
|
|
|
|
NS_ADDREF(*aResult = ctx);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
WebGLContext::WebGLContext()
|
2010-05-17 21:04:22 -07:00
|
|
|
: mCanvasElement(nsnull),
|
|
|
|
gl(nsnull),
|
|
|
|
mWidth(0), mHeight(0),
|
2010-06-04 12:03:37 -07:00
|
|
|
mGeneration(0),
|
2010-05-15 06:55:45 -07:00
|
|
|
mInvalidated(PR_FALSE),
|
|
|
|
mActiveTexture(0),
|
|
|
|
mSynthesizedGLError(LOCAL_GL_NO_ERROR)
|
2009-09-02 17:47:49 -07:00
|
|
|
{
|
|
|
|
mMapBuffers.Init();
|
|
|
|
mMapTextures.Init();
|
|
|
|
mMapPrograms.Init();
|
|
|
|
mMapShaders.Init();
|
|
|
|
mMapFramebuffers.Init();
|
|
|
|
mMapRenderbuffers.Init();
|
|
|
|
}
|
|
|
|
|
|
|
|
WebGLContext::~WebGLContext()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
WebGLContext::Invalidate()
|
|
|
|
{
|
|
|
|
if (!mCanvasElement)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (mInvalidated)
|
|
|
|
return;
|
|
|
|
|
|
|
|
mInvalidated = true;
|
|
|
|
mCanvasElement->InvalidateFrame();
|
|
|
|
}
|
|
|
|
|
2010-06-08 07:34:56 -07:00
|
|
|
/* readonly attribute nsIDOMHTMLCanvasElement canvas; */
|
|
|
|
NS_IMETHODIMP
|
|
|
|
WebGLContext::GetCanvas(nsIDOMHTMLCanvasElement **canvas)
|
|
|
|
{
|
|
|
|
if (mCanvasElement == nsnull) {
|
|
|
|
*canvas = nsnull;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_ADDREF(*canvas = static_cast<nsIDOMHTMLCanvasElement*>(mCanvasElement));
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2009-09-02 17:47:49 -07:00
|
|
|
//
|
|
|
|
// nsICanvasRenderingContextInternal
|
|
|
|
//
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2010-05-17 21:04:22 -07:00
|
|
|
WebGLContext::SetCanvasElement(nsHTMLCanvasElement* aParentCanvas)
|
2009-09-02 17:47:49 -07:00
|
|
|
{
|
|
|
|
if (aParentCanvas == nsnull) {
|
|
|
|
// we get this on shutdown; we should do some more cleanup here,
|
|
|
|
// but instead we just let our destructor do it.
|
2010-05-28 16:41:02 -07:00
|
|
|
mCanvasElement = nsnull;
|
2009-09-02 17:47:49 -07:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!SafeToCreateCanvas3DContext(aParentCanvas))
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
|
|
|
|
mCanvasElement = aParentCanvas;
|
2010-05-17 21:04:22 -07:00
|
|
|
|
2009-09-02 17:47:49 -07:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
WebGLContext::SetDimensions(PRInt32 width, PRInt32 height)
|
|
|
|
{
|
2010-06-04 12:03:37 -07:00
|
|
|
// If incrementing the generation would cause overflow,
|
|
|
|
// don't allow it. Allowing this would allow us to use
|
|
|
|
// resource handles created from older context generations.
|
|
|
|
if (mGeneration + 1 == 0)
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
|
2009-09-02 17:47:49 -07:00
|
|
|
if (mWidth == width && mHeight == height)
|
|
|
|
return NS_OK;
|
|
|
|
|
2010-06-09 15:07:12 -07:00
|
|
|
if (gl) {
|
|
|
|
// hey we already have something
|
|
|
|
if (gl->Resize(gfxIntSize(width, height))) {
|
|
|
|
|
|
|
|
mWidth = width;
|
|
|
|
mHeight = height;
|
|
|
|
|
|
|
|
gl->fViewport(0, 0, mWidth, mHeight);
|
|
|
|
gl->fClearColor(0, 0, 0, 0);
|
|
|
|
gl->fClear(LOCAL_GL_COLOR_BUFFER_BIT | LOCAL_GL_DEPTH_BUFFER_BIT | LOCAL_GL_STENCIL_BUFFER_BIT);
|
|
|
|
|
|
|
|
// great success!
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-05-17 21:04:22 -07:00
|
|
|
LogMessage("Canvas 3D: creating PBuffer...");
|
|
|
|
|
2010-05-17 21:04:22 -07:00
|
|
|
GLContextProvider::ContextFormat format(GLContextProvider::ContextFormat::BasicRGBA32);
|
|
|
|
format.depth = 16;
|
|
|
|
format.minDepth = 1;
|
|
|
|
|
|
|
|
gl = gl::sGLContextProvider.CreatePBuffer(gfxIntSize(width, height), format);
|
2010-05-17 21:04:22 -07:00
|
|
|
|
2010-05-19 13:46:08 -07:00
|
|
|
if (!gl) {
|
|
|
|
LogMessage("Canvas 3D: can't get a native PBuffer, trying OSMesa...");
|
|
|
|
gl = gl::GLContextProviderOSMesa::CreatePBuffer(gfxIntSize(width, height), format);
|
|
|
|
if (!gl) {
|
|
|
|
LogMessage("Canvas 3D: can't create a OSMesa pseudo-PBuffer.");
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-06-04 12:03:37 -07:00
|
|
|
// We just blew away all the resources by creating a new context; reset everything,
|
|
|
|
// and let ValidateGL set up the correct dimensions again.
|
|
|
|
|
|
|
|
mActiveTexture = 0;
|
|
|
|
mSynthesizedGLError = LOCAL_GL_NO_ERROR;
|
|
|
|
|
|
|
|
mAttribBuffers.Clear();
|
|
|
|
|
|
|
|
mUniformTextures.Clear();
|
|
|
|
mBound2DTextures.Clear();
|
|
|
|
mBoundCubeMapTextures.Clear();
|
|
|
|
|
|
|
|
mBoundArrayBuffer = nsnull;
|
|
|
|
mBoundElementArrayBuffer = nsnull;
|
|
|
|
mCurrentProgram = nsnull;
|
|
|
|
|
|
|
|
mFramebufferColorAttachments.Clear();
|
|
|
|
mFramebufferDepthAttachment = nsnull;
|
|
|
|
mFramebufferStencilAttachment = nsnull;
|
|
|
|
|
|
|
|
mBoundFramebuffer = nsnull;
|
|
|
|
mBoundRenderbuffer = nsnull;
|
|
|
|
|
|
|
|
mMapTextures.Clear();
|
|
|
|
mMapBuffers.Clear();
|
|
|
|
mMapPrograms.Clear();
|
|
|
|
mMapShaders.Clear();
|
|
|
|
mMapFramebuffers.Clear();
|
|
|
|
mMapRenderbuffers.Clear();
|
|
|
|
|
|
|
|
// Now check the GL implementation, checking limits along the way
|
2010-05-17 21:04:22 -07:00
|
|
|
if (!ValidateGL()) {
|
|
|
|
LogMessage("Canvas 3D: Couldn't validate OpenGL implementation; is everything needed present?");
|
2009-09-02 17:47:49 -07:00
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
LogMessage("Canvas 3D: ready");
|
|
|
|
|
|
|
|
mWidth = width;
|
|
|
|
mHeight = height;
|
|
|
|
|
2010-06-04 12:03:37 -07:00
|
|
|
// increment the generation number
|
|
|
|
mGeneration++;
|
2009-09-02 17:47:49 -07:00
|
|
|
|
|
|
|
MakeContextCurrent();
|
2010-06-04 12:03:37 -07:00
|
|
|
|
|
|
|
// Make sure that we clear this out, otherwise
|
|
|
|
// we'll end up displaying random memory
|
2009-09-02 17:47:49 -07:00
|
|
|
gl->fViewport(0, 0, mWidth, mHeight);
|
|
|
|
gl->fClearColor(0, 0, 0, 0);
|
|
|
|
gl->fClear(LOCAL_GL_COLOR_BUFFER_BIT | LOCAL_GL_DEPTH_BUFFER_BIT | LOCAL_GL_STENCIL_BUFFER_BIT);
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
WebGLContext::Render(gfxContext *ctx, gfxPattern::GraphicsFilter f)
|
|
|
|
{
|
2010-05-17 21:04:22 -07:00
|
|
|
if (!gl)
|
2009-09-02 17:47:49 -07:00
|
|
|
return NS_OK;
|
|
|
|
|
2010-05-17 21:04:22 -07:00
|
|
|
nsRefPtr<gfxImageSurface> surf = new gfxImageSurface(gfxIntSize(mWidth, mHeight),
|
|
|
|
gfxASurface::ImageFormatARGB32);
|
|
|
|
if (surf->CairoStatus() != 0)
|
|
|
|
return NS_ERROR_FAILURE;
|
2009-09-02 17:47:49 -07:00
|
|
|
|
2010-05-17 21:04:22 -07:00
|
|
|
MakeContextCurrent();
|
|
|
|
gl->fReadPixels(0, 0, mWidth, mHeight,
|
|
|
|
LOCAL_GL_BGRA,
|
|
|
|
LOCAL_GL_UNSIGNED_INT_8_8_8_8_REV,
|
|
|
|
surf->Data());
|
2009-09-02 17:47:49 -07:00
|
|
|
|
2010-05-17 21:04:22 -07:00
|
|
|
gfxUtils::PremultiplyImageSurface(surf);
|
2009-09-02 17:47:49 -07:00
|
|
|
|
2010-05-17 21:04:22 -07:00
|
|
|
nsRefPtr<gfxPattern> pat = new gfxPattern(surf);
|
|
|
|
pat->SetFilter(f);
|
2009-09-02 17:47:49 -07:00
|
|
|
|
2010-05-17 21:04:22 -07:00
|
|
|
ctx->NewPath();
|
|
|
|
ctx->PixelSnappedRectangleAndSetPattern(gfxRect(0, 0, mWidth, mHeight), pat);
|
|
|
|
ctx->Fill();
|
2009-09-02 17:47:49 -07:00
|
|
|
|
2010-05-17 21:04:22 -07:00
|
|
|
return NS_OK;
|
2009-09-02 17:47:49 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
WebGLContext::GetInputStream(const char* aMimeType,
|
|
|
|
const PRUnichar* aEncoderOptions,
|
|
|
|
nsIInputStream **aStream)
|
|
|
|
{
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
|
|
|
|
// XXX fix this
|
|
|
|
#if 0
|
|
|
|
if (!mGLPbuffer ||
|
|
|
|
!mGLPbuffer->ThebesSurface())
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
|
|
|
|
nsresult rv;
|
|
|
|
const char encoderPrefix[] = "@mozilla.org/image/encoder;2?type=";
|
|
|
|
nsAutoArrayPtr<char> conid(new (std::nothrow) char[strlen(encoderPrefix) + strlen(aMimeType) + 1]);
|
|
|
|
|
|
|
|
if (!conid)
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
|
|
|
|
strcpy(conid, encoderPrefix);
|
|
|
|
strcat(conid, aMimeType);
|
|
|
|
|
|
|
|
nsCOMPtr<imgIEncoder> encoder = do_CreateInstance(conid);
|
|
|
|
if (!encoder)
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
|
|
|
|
nsAutoArrayPtr<PRUint8> imageBuffer(new (std::nothrow) PRUint8[mWidth * mHeight * 4]);
|
|
|
|
if (!imageBuffer)
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
|
|
|
|
nsRefPtr<gfxImageSurface> imgsurf = new gfxImageSurface(imageBuffer.get(),
|
|
|
|
gfxIntSize(mWidth, mHeight),
|
|
|
|
mWidth * 4,
|
|
|
|
gfxASurface::ImageFormatARGB32);
|
|
|
|
|
|
|
|
if (!imgsurf || imgsurf->CairoStatus())
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
|
|
|
|
nsRefPtr<gfxContext> ctx = new gfxContext(imgsurf);
|
|
|
|
|
|
|
|
if (!ctx || ctx->HasError())
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
|
|
|
|
nsRefPtr<gfxASurface> surf = mGLPbuffer->ThebesSurface();
|
|
|
|
nsRefPtr<gfxPattern> pat = CanvasGLThebes::CreatePattern(surf);
|
|
|
|
gfxMatrix m;
|
|
|
|
m.Translate(gfxPoint(0.0, mGLPbuffer->Height()));
|
|
|
|
m.Scale(1.0, -1.0);
|
|
|
|
pat->SetMatrix(m);
|
|
|
|
|
|
|
|
// XXX I don't want to use PixelSnapped here, but layout doesn't guarantee
|
|
|
|
// pixel alignment for this stuff!
|
|
|
|
ctx->NewPath();
|
|
|
|
ctx->PixelSnappedRectangleAndSetPattern(gfxRect(0, 0, mWidth, mHeight), pat);
|
|
|
|
ctx->SetOperator(gfxContext::OPERATOR_SOURCE);
|
|
|
|
ctx->Fill();
|
|
|
|
|
|
|
|
rv = encoder->InitFromData(imageBuffer.get(),
|
|
|
|
mWidth * mHeight * 4, mWidth, mHeight, mWidth * 4,
|
|
|
|
imgIEncoder::INPUT_FORMAT_HOSTARGB,
|
|
|
|
nsDependentString(aEncoderOptions));
|
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
|
|
|
|
return CallQueryInterface(encoder, aStream);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
WebGLContext::GetThebesSurface(gfxASurface **surface)
|
|
|
|
{
|
2010-05-17 21:04:22 -07:00
|
|
|
return NS_ERROR_NOT_AVAILABLE;
|
|
|
|
}
|
|
|
|
|
|
|
|
already_AddRefed<layers::CanvasLayer>
|
|
|
|
WebGLContext::GetCanvasLayer(LayerManager *manager)
|
|
|
|
{
|
|
|
|
nsRefPtr<CanvasLayer> canvasLayer = manager->CreateCanvasLayer();
|
|
|
|
if (!canvasLayer) {
|
|
|
|
NS_WARNING("CreateCanvasLayer returned null!");
|
|
|
|
return nsnull;
|
2009-09-02 17:47:49 -07:00
|
|
|
}
|
|
|
|
|
2010-05-17 21:04:22 -07:00
|
|
|
CanvasLayer::Data data;
|
|
|
|
|
2010-05-19 13:46:08 -07:00
|
|
|
// the gl context may either provide a native PBuffer, in which case we want to initialize
|
|
|
|
// data with the gl context directly, or may provide a surface to which it renders (this is the case
|
|
|
|
// of OSMesa contexts), in which case we want to initialize data with that surface.
|
|
|
|
|
|
|
|
void* native_pbuffer = gl->GetNativeData(gl::GLContext::NativePBuffer);
|
|
|
|
void* native_surface = gl->GetNativeData(gl::GLContext::NativeImageSurface);
|
|
|
|
|
|
|
|
if (native_pbuffer) {
|
|
|
|
data.mGLContext = gl.get();
|
|
|
|
}
|
|
|
|
else if (native_surface) {
|
|
|
|
data.mSurface = static_cast<gfxASurface*>(native_surface);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
NS_WARNING("The GLContext has neither a native PBuffer nor a native surface!");
|
|
|
|
return nsnull;
|
|
|
|
}
|
|
|
|
|
2010-05-17 21:04:22 -07:00
|
|
|
data.mSize = nsIntSize(mWidth, mHeight);
|
|
|
|
data.mGLBufferIsPremultiplied = PR_FALSE;
|
|
|
|
|
|
|
|
canvasLayer->Initialize(data);
|
|
|
|
// once we support GL context attributes, we'll set the right thing here
|
|
|
|
canvasLayer->SetIsOpaqueContent(PR_FALSE);
|
|
|
|
canvasLayer->Updated(nsIntRect(0, 0, mWidth, mHeight));
|
|
|
|
|
|
|
|
mInvalidated = PR_FALSE;
|
|
|
|
|
|
|
|
return canvasLayer.forget().get();
|
2009-09-02 17:47:49 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// XPCOM goop
|
|
|
|
//
|
|
|
|
|
|
|
|
NS_IMPL_ADDREF(WebGLContext)
|
|
|
|
NS_IMPL_RELEASE(WebGLContext)
|
|
|
|
|
2010-01-12 05:08:43 -08:00
|
|
|
DOMCI_DATA(CanvasRenderingContextWebGL, WebGLContext)
|
|
|
|
|
2009-09-02 17:47:49 -07:00
|
|
|
NS_INTERFACE_MAP_BEGIN(WebGLContext)
|
|
|
|
NS_INTERFACE_MAP_ENTRY(nsICanvasRenderingContextWebGL)
|
|
|
|
NS_INTERFACE_MAP_ENTRY(nsICanvasRenderingContextInternal)
|
|
|
|
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
|
|
|
|
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsICanvasRenderingContextWebGL)
|
2010-03-17 08:09:05 -07:00
|
|
|
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(CanvasRenderingContextWebGL)
|
2009-09-02 17:47:49 -07:00
|
|
|
NS_INTERFACE_MAP_END
|
|
|
|
|
|
|
|
NS_IMPL_ADDREF(WebGLBuffer)
|
|
|
|
NS_IMPL_RELEASE(WebGLBuffer)
|
|
|
|
|
2010-01-12 05:08:43 -08:00
|
|
|
DOMCI_DATA(WebGLBuffer, WebGLBuffer)
|
|
|
|
|
2009-09-02 17:47:49 -07:00
|
|
|
NS_INTERFACE_MAP_BEGIN(WebGLBuffer)
|
2010-05-19 13:46:08 -07:00
|
|
|
NS_INTERFACE_MAP_ENTRY(WebGLBuffer)
|
2009-09-02 17:47:49 -07:00
|
|
|
NS_INTERFACE_MAP_ENTRY(nsIWebGLBuffer)
|
|
|
|
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
2010-03-17 08:09:05 -07:00
|
|
|
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(WebGLBuffer)
|
2009-09-02 17:47:49 -07:00
|
|
|
NS_INTERFACE_MAP_END
|
|
|
|
|
|
|
|
NS_IMPL_ADDREF(WebGLTexture)
|
|
|
|
NS_IMPL_RELEASE(WebGLTexture)
|
|
|
|
|
2010-01-12 05:08:43 -08:00
|
|
|
DOMCI_DATA(WebGLTexture, WebGLTexture)
|
|
|
|
|
2009-09-02 17:47:49 -07:00
|
|
|
NS_INTERFACE_MAP_BEGIN(WebGLTexture)
|
2010-05-19 13:46:08 -07:00
|
|
|
NS_INTERFACE_MAP_ENTRY(WebGLTexture)
|
2009-09-02 17:47:49 -07:00
|
|
|
NS_INTERFACE_MAP_ENTRY(nsIWebGLTexture)
|
|
|
|
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
2010-03-17 08:09:05 -07:00
|
|
|
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(WebGLTexture)
|
2009-09-02 17:47:49 -07:00
|
|
|
NS_INTERFACE_MAP_END
|
|
|
|
|
|
|
|
NS_IMPL_ADDREF(WebGLProgram)
|
|
|
|
NS_IMPL_RELEASE(WebGLProgram)
|
|
|
|
|
2010-01-12 05:08:43 -08:00
|
|
|
DOMCI_DATA(WebGLProgram, WebGLProgram)
|
|
|
|
|
2009-09-02 17:47:49 -07:00
|
|
|
NS_INTERFACE_MAP_BEGIN(WebGLProgram)
|
2010-05-19 13:46:08 -07:00
|
|
|
NS_INTERFACE_MAP_ENTRY(WebGLProgram)
|
2009-09-02 17:47:49 -07:00
|
|
|
NS_INTERFACE_MAP_ENTRY(nsIWebGLProgram)
|
|
|
|
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
2010-03-17 08:09:05 -07:00
|
|
|
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(WebGLProgram)
|
2009-09-02 17:47:49 -07:00
|
|
|
NS_INTERFACE_MAP_END
|
|
|
|
|
|
|
|
NS_IMPL_ADDREF(WebGLShader)
|
|
|
|
NS_IMPL_RELEASE(WebGLShader)
|
|
|
|
|
2010-01-12 05:08:43 -08:00
|
|
|
DOMCI_DATA(WebGLShader, WebGLShader)
|
|
|
|
|
2009-09-02 17:47:49 -07:00
|
|
|
NS_INTERFACE_MAP_BEGIN(WebGLShader)
|
2010-05-19 13:46:08 -07:00
|
|
|
NS_INTERFACE_MAP_ENTRY(WebGLShader)
|
2009-09-02 17:47:49 -07:00
|
|
|
NS_INTERFACE_MAP_ENTRY(nsIWebGLShader)
|
|
|
|
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
2010-03-17 08:09:05 -07:00
|
|
|
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(WebGLShader)
|
2009-09-02 17:47:49 -07:00
|
|
|
NS_INTERFACE_MAP_END
|
|
|
|
|
|
|
|
NS_IMPL_ADDREF(WebGLFramebuffer)
|
|
|
|
NS_IMPL_RELEASE(WebGLFramebuffer)
|
|
|
|
|
2010-01-12 05:08:43 -08:00
|
|
|
DOMCI_DATA(WebGLFramebuffer, WebGLFramebuffer)
|
|
|
|
|
2009-09-02 17:47:49 -07:00
|
|
|
NS_INTERFACE_MAP_BEGIN(WebGLFramebuffer)
|
2010-05-19 13:46:08 -07:00
|
|
|
NS_INTERFACE_MAP_ENTRY(WebGLFramebuffer)
|
2009-09-02 17:47:49 -07:00
|
|
|
NS_INTERFACE_MAP_ENTRY(nsIWebGLFramebuffer)
|
|
|
|
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
2010-03-17 08:09:05 -07:00
|
|
|
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(WebGLFramebuffer)
|
2009-09-02 17:47:49 -07:00
|
|
|
NS_INTERFACE_MAP_END
|
|
|
|
|
|
|
|
NS_IMPL_ADDREF(WebGLRenderbuffer)
|
|
|
|
NS_IMPL_RELEASE(WebGLRenderbuffer)
|
|
|
|
|
2010-01-12 05:08:43 -08:00
|
|
|
DOMCI_DATA(WebGLRenderbuffer, WebGLRenderbuffer)
|
|
|
|
|
2009-09-02 17:47:49 -07:00
|
|
|
NS_INTERFACE_MAP_BEGIN(WebGLRenderbuffer)
|
2010-05-19 13:46:08 -07:00
|
|
|
NS_INTERFACE_MAP_ENTRY(WebGLRenderbuffer)
|
2009-09-02 17:47:49 -07:00
|
|
|
NS_INTERFACE_MAP_ENTRY(nsIWebGLRenderbuffer)
|
|
|
|
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
2010-03-17 08:09:05 -07:00
|
|
|
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(WebGLRenderbuffer)
|
2009-09-02 17:47:49 -07:00
|
|
|
NS_INTERFACE_MAP_END
|
|
|
|
|
2010-06-01 23:09:19 -07:00
|
|
|
NS_IMPL_ADDREF(WebGLUniformLocation)
|
|
|
|
NS_IMPL_RELEASE(WebGLUniformLocation)
|
|
|
|
|
|
|
|
DOMCI_DATA(WebGLUniformLocation, WebGLUniformLocation)
|
|
|
|
|
|
|
|
NS_INTERFACE_MAP_BEGIN(WebGLUniformLocation)
|
|
|
|
NS_INTERFACE_MAP_ENTRY(WebGLUniformLocation)
|
|
|
|
NS_INTERFACE_MAP_ENTRY(nsIWebGLUniformLocation)
|
|
|
|
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
|
|
|
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(WebGLUniformLocation)
|
|
|
|
NS_INTERFACE_MAP_END
|
|
|
|
|
2010-05-28 15:52:39 -07:00
|
|
|
#define NAME_NOT_SUPPORTED(base) \
|
|
|
|
NS_IMETHODIMP base::GetName(WebGLuint *aName) \
|
|
|
|
{ return NS_ERROR_NOT_IMPLEMENTED; } \
|
|
|
|
NS_IMETHODIMP base::SetName(WebGLuint aName) \
|
|
|
|
{ return NS_ERROR_NOT_IMPLEMENTED; }
|
|
|
|
|
|
|
|
NAME_NOT_SUPPORTED(WebGLTexture)
|
|
|
|
NAME_NOT_SUPPORTED(WebGLBuffer)
|
|
|
|
NAME_NOT_SUPPORTED(WebGLProgram)
|
|
|
|
NAME_NOT_SUPPORTED(WebGLShader)
|
|
|
|
NAME_NOT_SUPPORTED(WebGLFramebuffer)
|
|
|
|
NAME_NOT_SUPPORTED(WebGLRenderbuffer)
|
2010-06-01 23:09:19 -07:00
|
|
|
|
|
|
|
/* [noscript] attribute WebGLint location; */
|
|
|
|
NS_IMETHODIMP WebGLUniformLocation::GetLocation(WebGLint *aLocation)
|
|
|
|
{
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
NS_IMETHODIMP WebGLUniformLocation::SetLocation(WebGLint aLocation)
|
|
|
|
{
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|