michael@0: /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef WEBGLUNIFORMLOCATION_H_ michael@0: #define WEBGLUNIFORMLOCATION_H_ michael@0: michael@0: #include "WebGLObjectModel.h" michael@0: #include "WebGLUniformInfo.h" michael@0: michael@0: namespace mozilla { michael@0: michael@0: class WebGLProgram; michael@0: michael@0: class WebGLUniformLocation MOZ_FINAL michael@0: : public WebGLContextBoundObject michael@0: { michael@0: public: michael@0: WebGLUniformLocation(WebGLContext *context, WebGLProgram *program, GLint location, const WebGLUniformInfo& info); michael@0: michael@0: ~WebGLUniformLocation() { michael@0: } michael@0: michael@0: // needed for certain helper functions like ValidateObject. michael@0: // WebGLUniformLocation's can't be 'Deleted' in the WebGL sense. michael@0: bool IsDeleted() const { return false; } michael@0: michael@0: const WebGLUniformInfo &Info() const { return mInfo; } michael@0: michael@0: WebGLProgram *Program() const { return mProgram; } michael@0: GLint Location() const { return mLocation; } michael@0: uint32_t ProgramGeneration() const { return mProgramGeneration; } michael@0: int ElementSize() const { return mElementSize; } michael@0: michael@0: JSObject* WrapObject(JSContext *cx); michael@0: michael@0: NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(WebGLUniformLocation) michael@0: NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS(WebGLUniformLocation) michael@0: michael@0: protected: michael@0: // nsRefPtr, not WebGLRefPtr, so that we don't prevent the program from being explicitly deleted. michael@0: // we just want to avoid having a dangling pointer. michael@0: nsRefPtr mProgram; michael@0: michael@0: uint32_t mProgramGeneration; michael@0: GLint mLocation; michael@0: WebGLUniformInfo mInfo; michael@0: int mElementSize; michael@0: friend class WebGLProgram; michael@0: }; michael@0: michael@0: } // namespace mozilla michael@0: michael@0: #endif