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