shannon.woods@transgaming.com | bdf2d80 | 2013-02-28 23:16:20 +0000 | [diff] [blame] | 1 | #include "precompiled.h" |
daniel@transgaming.com | 15186aa | 2012-12-20 21:08:23 +0000 | [diff] [blame] | 2 | //
|
daniel@transgaming.com | e76b64b | 2013-01-11 04:10:08 +0000 | [diff] [blame] | 3 | // Copyright (c) 2010-2013 The ANGLE Project Authors. All rights reserved.
|
daniel@transgaming.com | 15186aa | 2012-12-20 21:08:23 +0000 | [diff] [blame] | 4 | // Use of this source code is governed by a BSD-style license that can be
|
| 5 | // found in the LICENSE file.
|
| 6 | //
|
| 7 |
|
| 8 | #include "libGLESv2/Uniform.h"
|
| 9 |
|
| 10 | #include "libGLESv2/utilities.h"
|
| 11 |
|
| 12 | namespace gl
|
| 13 | {
|
| 14 |
|
shannon.woods@transgaming.com | d5a91b9 | 2013-02-28 23:17:30 +0000 | [diff] [blame] | 15 | Uniform::Uniform(GLenum type, GLenum precision, const std::string &name, unsigned int arraySize)
|
| 16 | : type(type), precision(precision), name(name), arraySize(arraySize)
|
daniel@transgaming.com | 15186aa | 2012-12-20 21:08:23 +0000 | [diff] [blame] | 17 | {
|
daniel@transgaming.com | e6d12e9 | 2012-12-20 21:12:47 +0000 | [diff] [blame] | 18 | int bytes = gl::UniformInternalSize(type) * elementCount();
|
daniel@transgaming.com | 15186aa | 2012-12-20 21:08:23 +0000 | [diff] [blame] | 19 | data = new unsigned char[bytes];
|
| 20 | memset(data, 0, bytes);
|
| 21 | dirty = true;
|
daniel@transgaming.com | e76b64b | 2013-01-11 04:10:08 +0000 | [diff] [blame] | 22 |
|
| 23 | psRegisterIndex = -1;
|
| 24 | vsRegisterIndex = -1;
|
| 25 | registerCount = VariableRowCount(type) * elementCount();
|
daniel@transgaming.com | 15186aa | 2012-12-20 21:08:23 +0000 | [diff] [blame] | 26 | }
|
| 27 |
|
| 28 | Uniform::~Uniform()
|
| 29 | {
|
| 30 | delete[] data;
|
| 31 | }
|
| 32 |
|
daniel@transgaming.com | e6d12e9 | 2012-12-20 21:12:47 +0000 | [diff] [blame] | 33 | bool Uniform::isArray() const
|
daniel@transgaming.com | 15186aa | 2012-12-20 21:08:23 +0000 | [diff] [blame] | 34 | {
|
daniel@transgaming.com | db01995 | 2012-12-20 21:13:32 +0000 | [diff] [blame] | 35 | return arraySize > 0;
|
daniel@transgaming.com | e6d12e9 | 2012-12-20 21:12:47 +0000 | [diff] [blame] | 36 | }
|
| 37 |
|
| 38 | unsigned int Uniform::elementCount() const
|
| 39 | {
|
| 40 | return arraySize > 0 ? arraySize : 1;
|
| 41 | }
|
| 42 |
|
daniel@transgaming.com | 15186aa | 2012-12-20 21:08:23 +0000 | [diff] [blame] | 43 | }
|