2012-12-09 03:02:29 +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/. */
|
|
|
|
|
2014-11-14 07:03:50 +03:00
|
|
|
#ifndef WEBGL_UNIFORM_LOCATION_H_
|
|
|
|
#define WEBGL_UNIFORM_LOCATION_H_
|
2012-12-09 03:02:29 +04:00
|
|
|
|
2015-01-16 02:40:39 +03:00
|
|
|
#include "GLDefs.h"
|
|
|
|
#include "mozilla/WeakPtr.h"
|
|
|
|
#include "nsCycleCollectionParticipant.h" // NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS
|
|
|
|
#include "nsISupportsImpl.h" // NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING
|
|
|
|
#include "nsWrapperCache.h"
|
2015-07-15 03:37:28 +03:00
|
|
|
|
2012-12-09 03:02:29 +04:00
|
|
|
#include "WebGLObjectModel.h"
|
2013-06-11 00:00:35 +04:00
|
|
|
|
2015-01-16 02:40:39 +03:00
|
|
|
struct JSContext;
|
2015-01-10 05:40:56 +03:00
|
|
|
|
2015-01-16 02:40:39 +03:00
|
|
|
namespace mozilla {
|
|
|
|
class WebGLActiveInfo;
|
|
|
|
class WebGLContext;
|
2015-01-13 11:07:26 +03:00
|
|
|
class WebGLProgram;
|
2015-01-13 06:51:20 +03:00
|
|
|
|
2015-01-16 02:40:39 +03:00
|
|
|
namespace webgl {
|
|
|
|
struct LinkedProgramInfo;
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace webgl
|
2015-01-16 02:40:39 +03:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
class WebGLUniformLocation final
|
2015-01-16 02:40:39 +03:00
|
|
|
: public nsWrapperCache
|
|
|
|
, public WebGLContextBoundObject
|
2012-12-09 03:02:29 +04:00
|
|
|
{
|
|
|
|
public:
|
2015-01-16 02:40:39 +03:00
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(WebGLUniformLocation)
|
|
|
|
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(WebGLUniformLocation)
|
2012-12-09 03:02:29 +04:00
|
|
|
|
2015-07-15 03:37:28 +03:00
|
|
|
virtual JSObject* WrapObject(JSContext* js, JS::Handle<JSObject*> givenProto) override;
|
2012-12-09 03:02:29 +04:00
|
|
|
|
2015-01-16 02:40:39 +03:00
|
|
|
WebGLContext* GetParentObject() const {
|
|
|
|
return mContext;
|
|
|
|
}
|
2014-06-26 17:30:49 +04:00
|
|
|
|
2015-01-16 02:40:39 +03:00
|
|
|
const WeakPtr<const webgl::LinkedProgramInfo> mLinkInfo;
|
|
|
|
const GLuint mLoc;
|
|
|
|
const WebGLActiveInfo* const mActiveInfo;
|
2015-01-10 08:03:54 +03:00
|
|
|
|
2015-01-16 02:40:39 +03:00
|
|
|
WebGLUniformLocation(WebGLContext* webgl, const webgl::LinkedProgramInfo* linkInfo,
|
|
|
|
GLuint loc, const WebGLActiveInfo* activeInfo);
|
2015-01-10 08:03:54 +03:00
|
|
|
|
2015-01-16 02:40:39 +03:00
|
|
|
bool ValidateForProgram(WebGLProgram* prog, WebGLContext* webgl,
|
|
|
|
const char* funcName) const;
|
|
|
|
bool ValidateSamplerSetter(GLint value, WebGLContext* webgl,
|
|
|
|
const char* funcName) const;
|
|
|
|
bool ValidateSizeAndType(uint8_t setterElemSize, GLenum setterType,
|
|
|
|
WebGLContext* webgl, const char* funcName) const;
|
|
|
|
bool ValidateArrayLength(uint8_t setterElemSize, size_t setterArraySize,
|
|
|
|
WebGLContext* webgl, const char* funcName) const;
|
2015-01-13 11:07:26 +03:00
|
|
|
|
2015-01-16 02:40:39 +03:00
|
|
|
JS::Value GetUniform(JSContext* js, WebGLContext* webgl) const;
|
2015-01-13 11:07:26 +03:00
|
|
|
|
2015-01-16 02:40:39 +03:00
|
|
|
// Needed for certain helper functions like ValidateObject.
|
|
|
|
// `WebGLUniformLocation`s can't be 'Deleted' in the WebGL sense.
|
|
|
|
bool IsDeleted() const { return false; }
|
|
|
|
|
|
|
|
protected:
|
|
|
|
~WebGLUniformLocation();
|
2012-12-09 03:02:29 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2014-11-14 07:03:50 +03:00
|
|
|
#endif // WEBGL_UNIFORM_LOCATION_H_
|