michael@0: #include "precompiled.h" michael@0: // michael@0: // Copyright (c) 2010-2013 The ANGLE Project Authors. All rights reserved. michael@0: // Use of this source code is governed by a BSD-style license that can be michael@0: // found in the LICENSE file. michael@0: // michael@0: michael@0: #include "libGLESv2/Uniform.h" michael@0: michael@0: #include "libGLESv2/utilities.h" michael@0: michael@0: namespace gl michael@0: { michael@0: michael@0: Uniform::Uniform(GLenum type, GLenum precision, const std::string &name, unsigned int arraySize) michael@0: : type(type), precision(precision), name(name), arraySize(arraySize) michael@0: { michael@0: int bytes = gl::UniformInternalSize(type) * elementCount(); michael@0: data = new unsigned char[bytes]; michael@0: memset(data, 0, bytes); michael@0: dirty = true; michael@0: michael@0: psRegisterIndex = -1; michael@0: vsRegisterIndex = -1; michael@0: registerCount = VariableRowCount(type) * elementCount(); michael@0: } michael@0: michael@0: Uniform::~Uniform() michael@0: { michael@0: delete[] data; michael@0: } michael@0: michael@0: bool Uniform::isArray() const michael@0: { michael@0: return arraySize > 0; michael@0: } michael@0: michael@0: unsigned int Uniform::elementCount() const michael@0: { michael@0: return arraySize > 0 ? arraySize : 1; michael@0: } michael@0: michael@0: }