1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/angle/src/libGLESv2/Uniform.cpp Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,43 @@ 1.4 +#include "precompiled.h" 1.5 +// 1.6 +// Copyright (c) 2010-2013 The ANGLE Project Authors. All rights reserved. 1.7 +// Use of this source code is governed by a BSD-style license that can be 1.8 +// found in the LICENSE file. 1.9 +// 1.10 + 1.11 +#include "libGLESv2/Uniform.h" 1.12 + 1.13 +#include "libGLESv2/utilities.h" 1.14 + 1.15 +namespace gl 1.16 +{ 1.17 + 1.18 +Uniform::Uniform(GLenum type, GLenum precision, const std::string &name, unsigned int arraySize) 1.19 + : type(type), precision(precision), name(name), arraySize(arraySize) 1.20 +{ 1.21 + int bytes = gl::UniformInternalSize(type) * elementCount(); 1.22 + data = new unsigned char[bytes]; 1.23 + memset(data, 0, bytes); 1.24 + dirty = true; 1.25 + 1.26 + psRegisterIndex = -1; 1.27 + vsRegisterIndex = -1; 1.28 + registerCount = VariableRowCount(type) * elementCount(); 1.29 +} 1.30 + 1.31 +Uniform::~Uniform() 1.32 +{ 1.33 + delete[] data; 1.34 +} 1.35 + 1.36 +bool Uniform::isArray() const 1.37 +{ 1.38 + return arraySize > 0; 1.39 +} 1.40 + 1.41 +unsigned int Uniform::elementCount() const 1.42 +{ 1.43 + return arraySize > 0 ? arraySize : 1; 1.44 +} 1.45 + 1.46 +}