1 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #include "WebGLSampler.h"
9 #include "mozilla/dom/WebGL2RenderingContextBinding.h"
10 #include "WebGLContext.h"
14 WebGLSampler::WebGLSampler(WebGLContext
* webgl
, GLuint sampler
)
15 : WebGLBindableName
<GLenum
>(sampler
),
16 WebGLContextBoundObject(webgl
)
18 mContext
->mSamplers
.insertBack(this);
21 WebGLSampler::~WebGLSampler()
27 WebGLSampler::Delete()
29 mContext
->MakeContextCurrent();
30 mContext
->gl
->fDeleteSamplers(1, &mGLName
);
32 removeFrom(mContext
->mSamplers
);
36 WebGLSampler::GetParentObject() const
42 WebGLSampler::WrapObject(JSContext
* cx
)
44 return dom::WebGLSamplerBinding::Wrap(cx
, this);
48 NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_0(WebGLSampler
)
49 NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(WebGLSampler
, AddRef
)
50 NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(WebGLSampler
, Release
)
52 } // namespace mozilla