1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/content/canvas/src/WebGLUniformLocation.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,55 @@ 1.4 +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#ifndef WEBGLUNIFORMLOCATION_H_ 1.10 +#define WEBGLUNIFORMLOCATION_H_ 1.11 + 1.12 +#include "WebGLObjectModel.h" 1.13 +#include "WebGLUniformInfo.h" 1.14 + 1.15 +namespace mozilla { 1.16 + 1.17 +class WebGLProgram; 1.18 + 1.19 +class WebGLUniformLocation MOZ_FINAL 1.20 + : public WebGLContextBoundObject 1.21 +{ 1.22 +public: 1.23 + WebGLUniformLocation(WebGLContext *context, WebGLProgram *program, GLint location, const WebGLUniformInfo& info); 1.24 + 1.25 + ~WebGLUniformLocation() { 1.26 + } 1.27 + 1.28 + // needed for certain helper functions like ValidateObject. 1.29 + // WebGLUniformLocation's can't be 'Deleted' in the WebGL sense. 1.30 + bool IsDeleted() const { return false; } 1.31 + 1.32 + const WebGLUniformInfo &Info() const { return mInfo; } 1.33 + 1.34 + WebGLProgram *Program() const { return mProgram; } 1.35 + GLint Location() const { return mLocation; } 1.36 + uint32_t ProgramGeneration() const { return mProgramGeneration; } 1.37 + int ElementSize() const { return mElementSize; } 1.38 + 1.39 + JSObject* WrapObject(JSContext *cx); 1.40 + 1.41 + NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(WebGLUniformLocation) 1.42 + NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS(WebGLUniformLocation) 1.43 + 1.44 +protected: 1.45 + // nsRefPtr, not WebGLRefPtr, so that we don't prevent the program from being explicitly deleted. 1.46 + // we just want to avoid having a dangling pointer. 1.47 + nsRefPtr<WebGLProgram> mProgram; 1.48 + 1.49 + uint32_t mProgramGeneration; 1.50 + GLint mLocation; 1.51 + WebGLUniformInfo mInfo; 1.52 + int mElementSize; 1.53 + friend class WebGLProgram; 1.54 +}; 1.55 + 1.56 +} // namespace mozilla 1.57 + 1.58 +#endif