2014-09-17 22:08:41 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 4; 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 "WebGLTransformFeedback.h"
|
|
|
|
|
|
|
|
#include "GLContext.h"
|
|
|
|
#include "mozilla/dom/WebGL2RenderingContextBinding.h"
|
2014-11-14 04:03:50 +00:00
|
|
|
#include "WebGL2Context.h"
|
2014-09-17 22:08:41 +00:00
|
|
|
|
2014-11-14 04:03:50 +00:00
|
|
|
namespace mozilla {
|
2014-09-17 22:08:41 +00:00
|
|
|
|
2014-12-05 07:04:55 +00:00
|
|
|
WebGLTransformFeedback::WebGLTransformFeedback(WebGLContext* webgl,
|
2014-11-26 02:00:06 +00:00
|
|
|
GLuint tf)
|
2015-05-20 23:57:48 +00:00
|
|
|
: WebGLContextBoundObject(webgl)
|
|
|
|
, mGLName(tf)
|
2014-11-26 02:00:06 +00:00
|
|
|
, mMode(LOCAL_GL_NONE)
|
|
|
|
, mIsActive(false)
|
|
|
|
, mIsPaused(false)
|
2014-09-17 22:08:41 +00:00
|
|
|
{
|
2014-12-05 07:04:55 +00:00
|
|
|
mContext->mTransformFeedbacks.insertBack(this);
|
2014-09-17 22:08:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
WebGLTransformFeedback::~WebGLTransformFeedback()
|
2014-11-26 02:00:06 +00:00
|
|
|
{
|
|
|
|
mMode = LOCAL_GL_NONE;
|
|
|
|
mIsActive = false;
|
|
|
|
mIsPaused = false;
|
|
|
|
DeleteOnce();
|
|
|
|
}
|
2014-09-17 22:08:41 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
WebGLTransformFeedback::Delete()
|
|
|
|
{
|
2014-11-26 02:00:06 +00:00
|
|
|
mContext->MakeContextCurrent();
|
|
|
|
mContext->gl->fDeleteTransformFeedbacks(1, &mGLName);
|
|
|
|
removeFrom(mContext->mTransformFeedbacks);
|
2014-09-17 22:08:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
WebGLContext*
|
|
|
|
WebGLTransformFeedback::GetParentObject() const
|
|
|
|
{
|
2014-11-26 02:00:06 +00:00
|
|
|
return Context();
|
2014-09-17 22:08:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
JSObject*
|
2015-07-15 00:37:28 +00:00
|
|
|
WebGLTransformFeedback::WrapObject(JSContext* cx, JS::Handle<JSObject*> givenProto)
|
2014-09-17 22:08:41 +00:00
|
|
|
{
|
2015-07-15 00:37:28 +00:00
|
|
|
return dom::WebGLTransformFeedbackBinding::Wrap(cx, this, givenProto);
|
2014-09-17 22:08:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_0(WebGLTransformFeedback)
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(WebGLTransformFeedback, AddRef)
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(WebGLTransformFeedback, Release)
|
2014-11-14 04:03:50 +00:00
|
|
|
|
|
|
|
} // namespace mozilla
|