Thu, 15 Jan 2015 21:03:48 +0100
Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)
1 #include "precompiled.h"
2 //
3 // Copyright (c) 2010-2013 The ANGLE Project Authors. All rights reserved.
4 // Use of this source code is governed by a BSD-style license that can be
5 // found in the LICENSE file.
6 //
8 #include "libGLESv2/Uniform.h"
10 #include "libGLESv2/utilities.h"
12 namespace gl
13 {
15 Uniform::Uniform(GLenum type, GLenum precision, const std::string &name, unsigned int arraySize)
16 : type(type), precision(precision), name(name), arraySize(arraySize)
17 {
18 int bytes = gl::UniformInternalSize(type) * elementCount();
19 data = new unsigned char[bytes];
20 memset(data, 0, bytes);
21 dirty = true;
23 psRegisterIndex = -1;
24 vsRegisterIndex = -1;
25 registerCount = VariableRowCount(type) * elementCount();
26 }
28 Uniform::~Uniform()
29 {
30 delete[] data;
31 }
33 bool Uniform::isArray() const
34 {
35 return arraySize > 0;
36 }
38 unsigned int Uniform::elementCount() const
39 {
40 return arraySize > 0 ? arraySize : 1;
41 }
43 }