2 // Copyright (c) 2010-2013 The ANGLE Project Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
7 #ifndef LIBGLESV2_UNIFORM_H_
8 #define LIBGLESV2_UNIFORM_H_
10 #include "common/debug.h"
11 #include "common/blocklayout.h"
13 #include "libGLESv2/angletypes.h"
23 // Helper struct representing a single shader uniform
26 LinkedUniform(GLenum type, GLenum precision, const std::string &name, unsigned int arraySize, const int blockIndex, const sh::BlockMemberInfo &blockInfo);
31 unsigned int elementCount() const;
32 bool isReferencedByVertexShader() const;
33 bool isReferencedByFragmentShader() const;
34 bool isInDefaultBlock() const;
35 size_t dataSize() const;
36 bool isSampler() const;
39 const GLenum precision;
40 const std::string name;
41 const unsigned int arraySize;
43 const sh::BlockMemberInfo blockInfo;
48 unsigned int psRegisterIndex;
49 unsigned int vsRegisterIndex;
50 unsigned int registerCount;
52 // Register "elements" are used for uniform structs in ES3, to appropriately identify single uniforms
53 // inside aggregate types, which are packed according C-like structure rules.
54 unsigned int registerElement;
57 // Helper struct representing a single shader uniform block
60 // use GL_INVALID_INDEX for non-array elements
61 UniformBlock(const std::string &name, unsigned int elementIndex, unsigned int dataSize);
63 bool isArrayElement() const;
64 bool isReferencedByVertexShader() const;
65 bool isReferencedByFragmentShader() const;
67 const std::string name;
68 const unsigned int elementIndex;
69 const unsigned int dataSize;
71 std::vector<unsigned int> memberUniformIndexes;
73 unsigned int psRegisterIndex;
74 unsigned int vsRegisterIndex;
79 #endif // LIBGLESV2_UNIFORM_H_