alokp@chromium.org | 07620a5 | 2010-09-23 17:53:56 +0000 | [diff] [blame] | 1 | // |
shannonwoods@chromium.org | e429ab7 | 2013-05-30 00:12:52 +0000 | [diff] [blame] | 2 | // Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved. |
alokp@chromium.org | 07620a5 | 2010-09-23 17:53:56 +0000 | [diff] [blame] | 3 | // Use of this source code is governed by a BSD-style license that can be |
| 4 | // found in the LICENSE file. |
| 5 | // |
| 6 | |
Jamie Madill | 4667c45 | 2014-07-08 15:02:36 -0400 | [diff] [blame] | 7 | #include "angle_gl.h" |
Zhenyao Mo | 94ac7b7 | 2014-10-15 18:22:08 -0700 | [diff] [blame] | 8 | #include "compiler/translator/SymbolTable.h" |
Geoff Lang | 1773282 | 2013-08-29 13:46:49 -0400 | [diff] [blame] | 9 | #include "compiler/translator/VariableInfo.h" |
Jamie Madill | aa72d78 | 2014-07-02 15:31:19 -0400 | [diff] [blame] | 10 | #include "compiler/translator/util.h" |
Jamie Madill | d5512cd | 2014-07-10 17:50:08 -0400 | [diff] [blame] | 11 | #include "common/utilities.h" |
alokp@chromium.org | 07620a5 | 2010-09-23 17:53:56 +0000 | [diff] [blame] | 12 | |
Jamie Madill | a2fbb84 | 2014-09-03 09:40:47 -0400 | [diff] [blame] | 13 | namespace sh |
| 14 | { |
| 15 | |
Jamie Madill | 54ad4f8 | 2014-09-03 09:40:46 -0400 | [diff] [blame] | 16 | namespace |
| 17 | { |
Zhenyao Mo | d2d340b | 2013-09-23 14:57:05 -0400 | [diff] [blame] | 18 | |
Jamie Madill | 54ad4f8 | 2014-09-03 09:40:46 -0400 | [diff] [blame] | 19 | TString InterfaceBlockFieldName(const TInterfaceBlock &interfaceBlock, const TField &field) |
| 20 | { |
| 21 | if (interfaceBlock.hasInstanceName()) |
| 22 | { |
| 23 | return interfaceBlock.name() + "." + field.name(); |
| 24 | } |
| 25 | else |
| 26 | { |
| 27 | return field.name(); |
| 28 | } |
| 29 | } |
| 30 | |
Jamie Madill | a2fbb84 | 2014-09-03 09:40:47 -0400 | [diff] [blame] | 31 | BlockLayoutType GetBlockLayoutType(TLayoutBlockStorage blockStorage) |
Jamie Madill | 54ad4f8 | 2014-09-03 09:40:46 -0400 | [diff] [blame] | 32 | { |
| 33 | switch (blockStorage) |
| 34 | { |
Jamie Madill | a2fbb84 | 2014-09-03 09:40:47 -0400 | [diff] [blame] | 35 | case EbsPacked: return BLOCKLAYOUT_PACKED; |
| 36 | case EbsShared: return BLOCKLAYOUT_SHARED; |
| 37 | case EbsStd140: return BLOCKLAYOUT_STANDARD; |
| 38 | default: UNREACHABLE(); return BLOCKLAYOUT_SHARED; |
Jamie Madill | 54ad4f8 | 2014-09-03 09:40:46 -0400 | [diff] [blame] | 39 | } |
| 40 | } |
| 41 | |
Jamie Madill | a2fbb84 | 2014-09-03 09:40:47 -0400 | [diff] [blame] | 42 | void ExpandUserDefinedVariable(const ShaderVariable &variable, |
Jamie Madill | 54ad4f8 | 2014-09-03 09:40:46 -0400 | [diff] [blame] | 43 | const std::string &name, |
| 44 | const std::string &mappedName, |
| 45 | bool markStaticUse, |
Jamie Madill | a2fbb84 | 2014-09-03 09:40:47 -0400 | [diff] [blame] | 46 | std::vector<ShaderVariable> *expanded); |
Jamie Madill | 54ad4f8 | 2014-09-03 09:40:46 -0400 | [diff] [blame] | 47 | |
Jamie Madill | a2fbb84 | 2014-09-03 09:40:47 -0400 | [diff] [blame] | 48 | void ExpandVariable(const ShaderVariable &variable, |
Jamie Madill | 54ad4f8 | 2014-09-03 09:40:46 -0400 | [diff] [blame] | 49 | const std::string &name, |
| 50 | const std::string &mappedName, |
| 51 | bool markStaticUse, |
Jamie Madill | a2fbb84 | 2014-09-03 09:40:47 -0400 | [diff] [blame] | 52 | std::vector<ShaderVariable> *expanded) |
alokp@chromium.org | ee76f6a | 2010-09-27 19:28:55 +0000 | [diff] [blame] | 53 | { |
Jamie Madill | 23a8a43 | 2014-07-09 13:27:42 -0400 | [diff] [blame] | 54 | if (variable.isStruct()) |
Jamie Madill | 4667c45 | 2014-07-08 15:02:36 -0400 | [diff] [blame] | 55 | { |
Jamie Madill | 23a8a43 | 2014-07-09 13:27:42 -0400 | [diff] [blame] | 56 | if (variable.isArray()) |
| 57 | { |
| 58 | for (size_t elementIndex = 0; elementIndex < variable.elementCount(); elementIndex++) |
| 59 | { |
Jamie Madill | a2fbb84 | 2014-09-03 09:40:47 -0400 | [diff] [blame] | 60 | std::string lname = name + ::ArrayString(elementIndex); |
| 61 | std::string lmappedName = mappedName + ::ArrayString(elementIndex); |
Jamie Madill | 23a8a43 | 2014-07-09 13:27:42 -0400 | [diff] [blame] | 62 | ExpandUserDefinedVariable(variable, lname, lmappedName, markStaticUse, expanded); |
| 63 | } |
| 64 | } |
| 65 | else |
| 66 | { |
| 67 | ExpandUserDefinedVariable(variable, name, mappedName, markStaticUse, expanded); |
| 68 | } |
Jamie Madill | 4667c45 | 2014-07-08 15:02:36 -0400 | [diff] [blame] | 69 | } |
| 70 | else |
| 71 | { |
Jamie Madill | a2fbb84 | 2014-09-03 09:40:47 -0400 | [diff] [blame] | 72 | ShaderVariable expandedVar = variable; |
Jamie Madill | 23a8a43 | 2014-07-09 13:27:42 -0400 | [diff] [blame] | 73 | |
| 74 | expandedVar.name = name; |
| 75 | expandedVar.mappedName = mappedName; |
| 76 | |
| 77 | // Mark all expanded fields as used if the parent is used |
| 78 | if (markStaticUse) |
| 79 | { |
| 80 | expandedVar.staticUse = true; |
| 81 | } |
| 82 | |
| 83 | if (expandedVar.isArray()) |
| 84 | { |
| 85 | expandedVar.name += "[0]"; |
| 86 | expandedVar.mappedName += "[0]"; |
| 87 | } |
| 88 | |
| 89 | expanded->push_back(expandedVar); |
alokp@chromium.org | ee76f6a | 2010-09-27 19:28:55 +0000 | [diff] [blame] | 90 | } |
alokp@chromium.org | ee76f6a | 2010-09-27 19:28:55 +0000 | [diff] [blame] | 91 | } |
| 92 | |
Jamie Madill | a2fbb84 | 2014-09-03 09:40:47 -0400 | [diff] [blame] | 93 | void ExpandUserDefinedVariable(const ShaderVariable &variable, |
Jamie Madill | 54ad4f8 | 2014-09-03 09:40:46 -0400 | [diff] [blame] | 94 | const std::string &name, |
| 95 | const std::string &mappedName, |
| 96 | bool markStaticUse, |
Jamie Madill | a2fbb84 | 2014-09-03 09:40:47 -0400 | [diff] [blame] | 97 | std::vector<ShaderVariable> *expanded) |
alokp@chromium.org | ee76f6a | 2010-09-27 19:28:55 +0000 | [diff] [blame] | 98 | { |
Jamie Madill | 23a8a43 | 2014-07-09 13:27:42 -0400 | [diff] [blame] | 99 | ASSERT(variable.isStruct()); |
alokp@chromium.org | ee76f6a | 2010-09-27 19:28:55 +0000 | [diff] [blame] | 100 | |
Jamie Madill | a2fbb84 | 2014-09-03 09:40:47 -0400 | [diff] [blame] | 101 | const std::vector<ShaderVariable> &fields = variable.fields; |
Jamie Madill | 23a8a43 | 2014-07-09 13:27:42 -0400 | [diff] [blame] | 102 | |
| 103 | for (size_t fieldIndex = 0; fieldIndex < fields.size(); fieldIndex++) |
Jamie Madill | 4667c45 | 2014-07-08 15:02:36 -0400 | [diff] [blame] | 104 | { |
Jamie Madill | a2fbb84 | 2014-09-03 09:40:47 -0400 | [diff] [blame] | 105 | const ShaderVariable &field = fields[fieldIndex]; |
Jamie Madill | 23a8a43 | 2014-07-09 13:27:42 -0400 | [diff] [blame] | 106 | ExpandVariable(field, |
| 107 | name + "." + field.name, |
| 108 | mappedName + "." + field.mappedName, |
| 109 | markStaticUse, |
| 110 | expanded); |
alokp@chromium.org | ee76f6a | 2010-09-27 19:28:55 +0000 | [diff] [blame] | 111 | } |
| 112 | } |
| 113 | |
Jamie Madill | a718c1e | 2014-07-02 15:31:22 -0400 | [diff] [blame] | 114 | template <class VarT> |
Jamie Madill | 54ad4f8 | 2014-09-03 09:40:46 -0400 | [diff] [blame] | 115 | VarT *FindVariable(const TString &name, |
| 116 | std::vector<VarT> *infoList) |
Zhenyao Mo | d2d340b | 2013-09-23 14:57:05 -0400 | [diff] [blame] | 117 | { |
| 118 | // TODO(zmo): optimize this function. |
Jamie Madill | a718c1e | 2014-07-02 15:31:22 -0400 | [diff] [blame] | 119 | for (size_t ii = 0; ii < infoList->size(); ++ii) |
Zhenyao Mo | d2d340b | 2013-09-23 14:57:05 -0400 | [diff] [blame] | 120 | { |
Jamie Madill | 23a8a43 | 2014-07-09 13:27:42 -0400 | [diff] [blame] | 121 | if ((*infoList)[ii].name.c_str() == name) |
Jamie Madill | a718c1e | 2014-07-02 15:31:22 -0400 | [diff] [blame] | 122 | return &((*infoList)[ii]); |
Zhenyao Mo | d2d340b | 2013-09-23 14:57:05 -0400 | [diff] [blame] | 123 | } |
Jamie Madill | d5512cd | 2014-07-10 17:50:08 -0400 | [diff] [blame] | 124 | |
Zhenyao Mo | d2d340b | 2013-09-23 14:57:05 -0400 | [diff] [blame] | 125 | return NULL; |
| 126 | } |
| 127 | |
Jamie Madill | 54ad4f8 | 2014-09-03 09:40:46 -0400 | [diff] [blame] | 128 | } |
| 129 | |
Jamie Madill | a718c1e | 2014-07-02 15:31:22 -0400 | [diff] [blame] | 130 | CollectVariables::CollectVariables(std::vector<sh::Attribute> *attribs, |
Jamie Madill | d5512cd | 2014-07-10 17:50:08 -0400 | [diff] [blame] | 131 | std::vector<sh::Attribute> *outputVariables, |
Jamie Madill | a718c1e | 2014-07-02 15:31:22 -0400 | [diff] [blame] | 132 | std::vector<sh::Uniform> *uniforms, |
| 133 | std::vector<sh::Varying> *varyings, |
Jamie Madill | d5512cd | 2014-07-10 17:50:08 -0400 | [diff] [blame] | 134 | std::vector<sh::InterfaceBlock> *interfaceBlocks, |
Zhenyao Mo | 94ac7b7 | 2014-10-15 18:22:08 -0700 | [diff] [blame] | 135 | ShHashFunction64 hashFunction, |
| 136 | const TSymbolTable &symbolTable) |
Olli Etuaho | 3d0d9a4 | 2015-06-01 12:16:36 +0300 | [diff] [blame] | 137 | : TIntermTraverser(true, false, false), |
| 138 | mAttribs(attribs), |
Jamie Madill | d5512cd | 2014-07-10 17:50:08 -0400 | [diff] [blame] | 139 | mOutputVariables(outputVariables), |
daniel@transgaming.com | 0aa3b5a | 2012-11-28 19:43:24 +0000 | [diff] [blame] | 140 | mUniforms(uniforms), |
Zhenyao Mo | 74da9f2 | 2013-09-23 14:57:01 -0400 | [diff] [blame] | 141 | mVaryings(varyings), |
Jamie Madill | d5512cd | 2014-07-10 17:50:08 -0400 | [diff] [blame] | 142 | mInterfaceBlocks(interfaceBlocks), |
Jamie Madill | 55def58 | 2015-05-04 11:24:57 -0400 | [diff] [blame] | 143 | mDepthRangeAdded(false), |
Zhenyao Mo | d2d340b | 2013-09-23 14:57:05 -0400 | [diff] [blame] | 144 | mPointCoordAdded(false), |
| 145 | mFrontFacingAdded(false), |
| 146 | mFragCoordAdded(false), |
Gregoire Payen de La Garanderie | b3dced2 | 2015-01-12 14:54:55 +0000 | [diff] [blame] | 147 | mInstanceIDAdded(false), |
Zhenyao Mo | 94ac7b7 | 2014-10-15 18:22:08 -0700 | [diff] [blame] | 148 | mPositionAdded(false), |
| 149 | mPointSizeAdded(false), |
Erik Dahlström | ea7a212 | 2014-11-17 16:15:57 +0100 | [diff] [blame] | 150 | mLastFragDataAdded(false), |
Kimmo Kinnunen | 0932df6 | 2015-07-21 14:35:11 +0300 | [diff] [blame] | 151 | mFragColorAdded(false), |
| 152 | mFragDataAdded(false), |
Kimmo Kinnunen | 5448096 | 2015-07-22 10:30:35 +0300 | [diff] [blame] | 153 | mFragDepthEXTAdded(false), |
Kimmo Kinnunen | 0932df6 | 2015-07-21 14:35:11 +0300 | [diff] [blame] | 154 | mFragDepthAdded(false), |
Zhenyao Mo | 94ac7b7 | 2014-10-15 18:22:08 -0700 | [diff] [blame] | 155 | mHashFunction(hashFunction), |
| 156 | mSymbolTable(symbolTable) |
alokp@chromium.org | 07620a5 | 2010-09-23 17:53:56 +0000 | [diff] [blame] | 157 | { |
| 158 | } |
| 159 | |
Zhenyao Mo | d2d340b | 2013-09-23 14:57:05 -0400 | [diff] [blame] | 160 | // We want to check whether a uniform/varying is statically used |
| 161 | // because we only count the used ones in packing computing. |
| 162 | // Also, gl_FragCoord, gl_PointCoord, and gl_FrontFacing count |
| 163 | // toward varying counting if they are statically used in a fragment |
| 164 | // shader. |
Jamie Madill | 4667c45 | 2014-07-08 15:02:36 -0400 | [diff] [blame] | 165 | void CollectVariables::visitSymbol(TIntermSymbol *symbol) |
alokp@chromium.org | 07620a5 | 2010-09-23 17:53:56 +0000 | [diff] [blame] | 166 | { |
Zhenyao Mo | d2d340b | 2013-09-23 14:57:05 -0400 | [diff] [blame] | 167 | ASSERT(symbol != NULL); |
Jamie Madill | a2fbb84 | 2014-09-03 09:40:47 -0400 | [diff] [blame] | 168 | ShaderVariable *var = NULL; |
Jamie Madill | d5512cd | 2014-07-10 17:50:08 -0400 | [diff] [blame] | 169 | const TString &symbolName = symbol->getSymbol(); |
Jamie Madill | 4667c45 | 2014-07-08 15:02:36 -0400 | [diff] [blame] | 170 | |
Jamie Madill | a2fbb84 | 2014-09-03 09:40:47 -0400 | [diff] [blame] | 171 | if (IsVarying(symbol->getQualifier())) |
Zhenyao Mo | d2d340b | 2013-09-23 14:57:05 -0400 | [diff] [blame] | 172 | { |
Jamie Madill | d5512cd | 2014-07-10 17:50:08 -0400 | [diff] [blame] | 173 | var = FindVariable(symbolName, mVaryings); |
Jamie Madill | 4667c45 | 2014-07-08 15:02:36 -0400 | [diff] [blame] | 174 | } |
Jamie Madill | b547ddf | 2014-08-25 16:20:46 -0400 | [diff] [blame] | 175 | else if (symbol->getType().getBasicType() == EbtInterfaceBlock) |
| 176 | { |
| 177 | UNREACHABLE(); |
| 178 | } |
Jamie Madill | 55def58 | 2015-05-04 11:24:57 -0400 | [diff] [blame] | 179 | else if (symbolName == "gl_DepthRange") |
| 180 | { |
| 181 | ASSERT(symbol->getQualifier() == EvqUniform); |
| 182 | |
| 183 | if (!mDepthRangeAdded) |
| 184 | { |
| 185 | Uniform info; |
| 186 | const char kName[] = "gl_DepthRange"; |
| 187 | info.name = kName; |
| 188 | info.mappedName = kName; |
| 189 | info.type = GL_STRUCT_ANGLEX; |
| 190 | info.arraySize = 0; |
| 191 | info.precision = GL_NONE; |
| 192 | info.staticUse = true; |
| 193 | |
| 194 | ShaderVariable nearInfo; |
| 195 | const char kNearName[] = "near"; |
| 196 | nearInfo.name = kNearName; |
| 197 | nearInfo.mappedName = kNearName; |
| 198 | nearInfo.type = GL_FLOAT; |
| 199 | nearInfo.arraySize = 0; |
| 200 | nearInfo.precision = GL_HIGH_FLOAT; |
| 201 | nearInfo.staticUse = true; |
| 202 | |
| 203 | ShaderVariable farInfo; |
| 204 | const char kFarName[] = "far"; |
| 205 | farInfo.name = kFarName; |
| 206 | farInfo.mappedName = kFarName; |
| 207 | farInfo.type = GL_FLOAT; |
| 208 | farInfo.arraySize = 0; |
| 209 | farInfo.precision = GL_HIGH_FLOAT; |
| 210 | farInfo.staticUse = true; |
| 211 | |
| 212 | ShaderVariable diffInfo; |
| 213 | const char kDiffName[] = "diff"; |
| 214 | diffInfo.name = kDiffName; |
| 215 | diffInfo.mappedName = kDiffName; |
| 216 | diffInfo.type = GL_FLOAT; |
| 217 | diffInfo.arraySize = 0; |
| 218 | diffInfo.precision = GL_HIGH_FLOAT; |
| 219 | diffInfo.staticUse = true; |
| 220 | |
| 221 | info.fields.push_back(nearInfo); |
| 222 | info.fields.push_back(farInfo); |
| 223 | info.fields.push_back(diffInfo); |
| 224 | |
| 225 | mUniforms->push_back(info); |
| 226 | mDepthRangeAdded = true; |
| 227 | } |
| 228 | } |
Jamie Madill | b547ddf | 2014-08-25 16:20:46 -0400 | [diff] [blame] | 229 | else |
Jamie Madill | 4667c45 | 2014-07-08 15:02:36 -0400 | [diff] [blame] | 230 | { |
| 231 | switch (symbol->getQualifier()) |
Jamie Madill | a718c1e | 2014-07-02 15:31:22 -0400 | [diff] [blame] | 232 | { |
Jamie Madill | d5512cd | 2014-07-10 17:50:08 -0400 | [diff] [blame] | 233 | case EvqAttribute: |
| 234 | case EvqVertexIn: |
| 235 | var = FindVariable(symbolName, mAttribs); |
| 236 | break; |
| 237 | case EvqFragmentOut: |
| 238 | var = FindVariable(symbolName, mOutputVariables); |
| 239 | break; |
Jamie Madill | 4667c45 | 2014-07-08 15:02:36 -0400 | [diff] [blame] | 240 | case EvqUniform: |
Jamie Madill | d5512cd | 2014-07-10 17:50:08 -0400 | [diff] [blame] | 241 | { |
| 242 | const TInterfaceBlock *interfaceBlock = symbol->getType().getInterfaceBlock(); |
| 243 | if (interfaceBlock) |
| 244 | { |
Jamie Madill | a2fbb84 | 2014-09-03 09:40:47 -0400 | [diff] [blame] | 245 | InterfaceBlock *namedBlock = FindVariable(interfaceBlock->name(), mInterfaceBlocks); |
Jamie Madill | d5512cd | 2014-07-10 17:50:08 -0400 | [diff] [blame] | 246 | ASSERT(namedBlock); |
| 247 | var = FindVariable(symbolName, &namedBlock->fields); |
| 248 | |
| 249 | // Set static use on the parent interface block here |
| 250 | namedBlock->staticUse = true; |
| 251 | } |
| 252 | else |
| 253 | { |
| 254 | var = FindVariable(symbolName, mUniforms); |
| 255 | } |
| 256 | |
| 257 | // It's an internal error to reference an undefined user uniform |
Jamie Madill | 55def58 | 2015-05-04 11:24:57 -0400 | [diff] [blame] | 258 | ASSERT(symbolName.compare(0, 3, "gl_") != 0 || var); |
Jamie Madill | d5512cd | 2014-07-10 17:50:08 -0400 | [diff] [blame] | 259 | } |
Jamie Madill | 4667c45 | 2014-07-08 15:02:36 -0400 | [diff] [blame] | 260 | break; |
| 261 | case EvqFragCoord: |
| 262 | if (!mFragCoordAdded) |
| 263 | { |
Jamie Madill | a2fbb84 | 2014-09-03 09:40:47 -0400 | [diff] [blame] | 264 | Varying info; |
Zhenyao Mo | 94ac7b7 | 2014-10-15 18:22:08 -0700 | [diff] [blame] | 265 | const char kName[] = "gl_FragCoord"; |
| 266 | info.name = kName; |
| 267 | info.mappedName = kName; |
Jamie Madill | 4667c45 | 2014-07-08 15:02:36 -0400 | [diff] [blame] | 268 | info.type = GL_FLOAT_VEC4; |
| 269 | info.arraySize = 0; |
Zhenyao Mo | 94ac7b7 | 2014-10-15 18:22:08 -0700 | [diff] [blame] | 270 | info.precision = GL_MEDIUM_FLOAT; // Defined by spec. |
Jamie Madill | 4667c45 | 2014-07-08 15:02:36 -0400 | [diff] [blame] | 271 | info.staticUse = true; |
Zhenyao Mo | 94ac7b7 | 2014-10-15 18:22:08 -0700 | [diff] [blame] | 272 | info.isInvariant = mSymbolTable.isVaryingInvariant(kName); |
Jamie Madill | 4667c45 | 2014-07-08 15:02:36 -0400 | [diff] [blame] | 273 | mVaryings->push_back(info); |
| 274 | mFragCoordAdded = true; |
| 275 | } |
| 276 | return; |
| 277 | case EvqFrontFacing: |
| 278 | if (!mFrontFacingAdded) |
| 279 | { |
Jamie Madill | a2fbb84 | 2014-09-03 09:40:47 -0400 | [diff] [blame] | 280 | Varying info; |
Zhenyao Mo | 94ac7b7 | 2014-10-15 18:22:08 -0700 | [diff] [blame] | 281 | const char kName[] = "gl_FrontFacing"; |
| 282 | info.name = kName; |
| 283 | info.mappedName = kName; |
Jamie Madill | 4667c45 | 2014-07-08 15:02:36 -0400 | [diff] [blame] | 284 | info.type = GL_BOOL; |
| 285 | info.arraySize = 0; |
| 286 | info.precision = GL_NONE; |
| 287 | info.staticUse = true; |
Zhenyao Mo | 94ac7b7 | 2014-10-15 18:22:08 -0700 | [diff] [blame] | 288 | info.isInvariant = mSymbolTable.isVaryingInvariant(kName); |
Jamie Madill | 4667c45 | 2014-07-08 15:02:36 -0400 | [diff] [blame] | 289 | mVaryings->push_back(info); |
| 290 | mFrontFacingAdded = true; |
| 291 | } |
| 292 | return; |
| 293 | case EvqPointCoord: |
| 294 | if (!mPointCoordAdded) |
| 295 | { |
Jamie Madill | a2fbb84 | 2014-09-03 09:40:47 -0400 | [diff] [blame] | 296 | Varying info; |
Zhenyao Mo | 94ac7b7 | 2014-10-15 18:22:08 -0700 | [diff] [blame] | 297 | const char kName[] = "gl_PointCoord"; |
| 298 | info.name = kName; |
| 299 | info.mappedName = kName; |
Jamie Madill | 4667c45 | 2014-07-08 15:02:36 -0400 | [diff] [blame] | 300 | info.type = GL_FLOAT_VEC2; |
| 301 | info.arraySize = 0; |
Zhenyao Mo | 94ac7b7 | 2014-10-15 18:22:08 -0700 | [diff] [blame] | 302 | info.precision = GL_MEDIUM_FLOAT; // Defined by spec. |
Jamie Madill | 4667c45 | 2014-07-08 15:02:36 -0400 | [diff] [blame] | 303 | info.staticUse = true; |
Zhenyao Mo | 94ac7b7 | 2014-10-15 18:22:08 -0700 | [diff] [blame] | 304 | info.isInvariant = mSymbolTable.isVaryingInvariant(kName); |
Jamie Madill | 4667c45 | 2014-07-08 15:02:36 -0400 | [diff] [blame] | 305 | mVaryings->push_back(info); |
| 306 | mPointCoordAdded = true; |
| 307 | } |
| 308 | return; |
Gregoire Payen de La Garanderie | b3dced2 | 2015-01-12 14:54:55 +0000 | [diff] [blame] | 309 | case EvqInstanceID: |
| 310 | if (!mInstanceIDAdded) |
| 311 | { |
| 312 | Attribute info; |
| 313 | const char kName[] = "gl_InstanceID"; |
| 314 | info.name = kName; |
| 315 | info.mappedName = kName; |
| 316 | info.type = GL_INT; |
| 317 | info.arraySize = 0; |
| 318 | info.precision = GL_HIGH_INT; // Defined by spec. |
| 319 | info.staticUse = true; |
| 320 | info.location = -1; |
| 321 | mAttribs->push_back(info); |
| 322 | mInstanceIDAdded = true; |
| 323 | } |
| 324 | return; |
Zhenyao Mo | 94ac7b7 | 2014-10-15 18:22:08 -0700 | [diff] [blame] | 325 | case EvqPosition: |
| 326 | if (!mPositionAdded) |
| 327 | { |
| 328 | Varying info; |
| 329 | const char kName[] = "gl_Position"; |
| 330 | info.name = kName; |
| 331 | info.mappedName = kName; |
| 332 | info.type = GL_FLOAT_VEC4; |
| 333 | info.arraySize = 0; |
| 334 | info.precision = GL_HIGH_FLOAT; // Defined by spec. |
| 335 | info.staticUse = true; |
| 336 | info.isInvariant = mSymbolTable.isVaryingInvariant(kName); |
| 337 | mVaryings->push_back(info); |
| 338 | mPositionAdded = true; |
| 339 | } |
| 340 | return; |
| 341 | case EvqPointSize: |
| 342 | if (!mPointSizeAdded) |
| 343 | { |
| 344 | Varying info; |
| 345 | const char kName[] = "gl_PointSize"; |
| 346 | info.name = kName; |
| 347 | info.mappedName = kName; |
| 348 | info.type = GL_FLOAT; |
| 349 | info.arraySize = 0; |
| 350 | info.precision = GL_MEDIUM_FLOAT; // Defined by spec. |
| 351 | info.staticUse = true; |
| 352 | info.isInvariant = mSymbolTable.isVaryingInvariant(kName); |
| 353 | mVaryings->push_back(info); |
| 354 | mPointSizeAdded = true; |
| 355 | } |
| 356 | return; |
Erik Dahlström | ea7a212 | 2014-11-17 16:15:57 +0100 | [diff] [blame] | 357 | case EvqLastFragData: |
| 358 | if (!mLastFragDataAdded) |
| 359 | { |
| 360 | Varying info; |
| 361 | const char kName[] = "gl_LastFragData"; |
| 362 | info.name = kName; |
| 363 | info.mappedName = kName; |
| 364 | info.type = GL_FLOAT_VEC4; |
| 365 | info.arraySize = static_cast<const TVariable*>(mSymbolTable.findBuiltIn("gl_MaxDrawBuffers", 100))->getConstPointer()->getIConst(); |
| 366 | info.precision = GL_MEDIUM_FLOAT; // Defined by spec. |
| 367 | info.staticUse = true; |
| 368 | info.isInvariant = mSymbolTable.isVaryingInvariant(kName); |
| 369 | mVaryings->push_back(info); |
| 370 | mLastFragDataAdded = true; |
| 371 | } |
| 372 | return; |
Kimmo Kinnunen | 0932df6 | 2015-07-21 14:35:11 +0300 | [diff] [blame] | 373 | case EvqFragColor: |
| 374 | if (!mFragColorAdded) |
| 375 | { |
| 376 | Attribute info; |
| 377 | const char kName[] = "gl_FragColor"; |
| 378 | info.name = kName; |
| 379 | info.mappedName = kName; |
| 380 | info.type = GL_FLOAT_VEC4; |
| 381 | info.arraySize = 0; |
| 382 | info.precision = GL_MEDIUM_FLOAT; // Defined by spec. |
| 383 | info.staticUse = true; |
| 384 | mOutputVariables->push_back(info); |
| 385 | mFragColorAdded = true; |
| 386 | } |
| 387 | return; |
| 388 | case EvqFragData: |
| 389 | if (!mFragDataAdded) |
| 390 | { |
| 391 | Attribute info; |
| 392 | const char kName[] = "gl_FragData"; |
| 393 | info.name = kName; |
| 394 | info.mappedName = kName; |
| 395 | info.type = GL_FLOAT_VEC4; |
| 396 | info.arraySize = static_cast<const TVariable *>( |
| 397 | mSymbolTable.findBuiltIn("gl_MaxDrawBuffers", 100)) |
| 398 | ->getConstPointer() |
| 399 | ->getIConst(); |
| 400 | info.precision = GL_MEDIUM_FLOAT; // Defined by spec. |
| 401 | info.staticUse = true; |
| 402 | mOutputVariables->push_back(info); |
| 403 | mFragDataAdded = true; |
| 404 | } |
| 405 | return; |
Kimmo Kinnunen | 5448096 | 2015-07-22 10:30:35 +0300 | [diff] [blame] | 406 | case EvqFragDepthEXT: |
| 407 | if (!mFragDepthEXTAdded) |
Kimmo Kinnunen | 0932df6 | 2015-07-21 14:35:11 +0300 | [diff] [blame] | 408 | { |
| 409 | Attribute info; |
| 410 | const char kName[] = "gl_FragDepthEXT"; |
| 411 | info.name = kName; |
| 412 | info.mappedName = kName; |
| 413 | info.type = GL_FLOAT; |
| 414 | info.arraySize = 0; |
| 415 | info.precision = |
| 416 | GLVariablePrecision(static_cast<const TVariable *>( |
| 417 | mSymbolTable.findBuiltIn("gl_FragDepthEXT", 100)) |
| 418 | ->getType()); |
| 419 | info.staticUse = true; |
| 420 | mOutputVariables->push_back(info); |
Kimmo Kinnunen | 5448096 | 2015-07-22 10:30:35 +0300 | [diff] [blame] | 421 | mFragDepthEXTAdded = true; |
| 422 | } |
| 423 | return; |
| 424 | case EvqFragDepth: |
| 425 | if (!mFragDepthAdded) |
| 426 | { |
| 427 | Attribute info; |
| 428 | const char kName[] = "gl_FragDepth"; |
| 429 | info.name = kName; |
| 430 | info.mappedName = kName; |
| 431 | info.type = GL_FLOAT; |
| 432 | info.arraySize = 0; |
| 433 | info.precision = GL_HIGH_FLOAT; |
| 434 | info.staticUse = true; |
| 435 | mOutputVariables->push_back(info); |
Kimmo Kinnunen | 0932df6 | 2015-07-21 14:35:11 +0300 | [diff] [blame] | 436 | mFragDepthAdded = true; |
| 437 | } |
| 438 | return; |
Kimmo Kinnunen | 5448096 | 2015-07-22 10:30:35 +0300 | [diff] [blame] | 439 | |
Jamie Madill | 4667c45 | 2014-07-08 15:02:36 -0400 | [diff] [blame] | 440 | default: |
| 441 | break; |
Zhenyao Mo | d2d340b | 2013-09-23 14:57:05 -0400 | [diff] [blame] | 442 | } |
Zhenyao Mo | d2d340b | 2013-09-23 14:57:05 -0400 | [diff] [blame] | 443 | } |
| 444 | if (var) |
Jamie Madill | a718c1e | 2014-07-02 15:31:22 -0400 | [diff] [blame] | 445 | { |
Zhenyao Mo | d2d340b | 2013-09-23 14:57:05 -0400 | [diff] [blame] | 446 | var->staticUse = true; |
Jamie Madill | a718c1e | 2014-07-02 15:31:22 -0400 | [diff] [blame] | 447 | } |
| 448 | } |
| 449 | |
Jamie Madill | a2fbb84 | 2014-09-03 09:40:47 -0400 | [diff] [blame] | 450 | class NameHashingTraverser : public GetVariableTraverser |
Jamie Madill | 23a8a43 | 2014-07-09 13:27:42 -0400 | [diff] [blame] | 451 | { |
| 452 | public: |
Zhenyao Mo | 94ac7b7 | 2014-10-15 18:22:08 -0700 | [diff] [blame] | 453 | NameHashingTraverser(ShHashFunction64 hashFunction, |
| 454 | const TSymbolTable &symbolTable) |
| 455 | : GetVariableTraverser(symbolTable), |
| 456 | mHashFunction(hashFunction) |
Jamie Madill | 23a8a43 | 2014-07-09 13:27:42 -0400 | [diff] [blame] | 457 | {} |
| 458 | |
| 459 | private: |
Jamie Madill | a2fbb84 | 2014-09-03 09:40:47 -0400 | [diff] [blame] | 460 | virtual void visitVariable(ShaderVariable *variable) |
Jamie Madill | 23a8a43 | 2014-07-09 13:27:42 -0400 | [diff] [blame] | 461 | { |
| 462 | TString stringName = TString(variable->name.c_str()); |
| 463 | variable->mappedName = TIntermTraverser::hash(stringName, mHashFunction).c_str(); |
| 464 | } |
| 465 | |
| 466 | ShHashFunction64 mHashFunction; |
| 467 | }; |
| 468 | |
| 469 | // Attributes, which cannot have struct fields, are a special case |
| 470 | template <> |
| 471 | void CollectVariables::visitVariable(const TIntermSymbol *variable, |
Jamie Madill | a2fbb84 | 2014-09-03 09:40:47 -0400 | [diff] [blame] | 472 | std::vector<Attribute> *infoList) const |
Jamie Madill | 23a8a43 | 2014-07-09 13:27:42 -0400 | [diff] [blame] | 473 | { |
| 474 | ASSERT(variable); |
| 475 | const TType &type = variable->getType(); |
| 476 | ASSERT(!type.getStruct()); |
| 477 | |
Jamie Madill | a2fbb84 | 2014-09-03 09:40:47 -0400 | [diff] [blame] | 478 | Attribute attribute; |
Jamie Madill | 23a8a43 | 2014-07-09 13:27:42 -0400 | [diff] [blame] | 479 | |
Jamie Madill | a2fbb84 | 2014-09-03 09:40:47 -0400 | [diff] [blame] | 480 | attribute.type = GLVariableType(type); |
| 481 | attribute.precision = GLVariablePrecision(type); |
Jamie Madill | 23a8a43 | 2014-07-09 13:27:42 -0400 | [diff] [blame] | 482 | attribute.name = variable->getSymbol().c_str(); |
| 483 | attribute.arraySize = static_cast<unsigned int>(type.getArraySize()); |
| 484 | attribute.mappedName = TIntermTraverser::hash(variable->getSymbol(), mHashFunction).c_str(); |
| 485 | attribute.location = variable->getType().getLayoutQualifier().location; |
| 486 | |
| 487 | infoList->push_back(attribute); |
| 488 | } |
| 489 | |
Jamie Madill | d5512cd | 2014-07-10 17:50:08 -0400 | [diff] [blame] | 490 | template <> |
| 491 | void CollectVariables::visitVariable(const TIntermSymbol *variable, |
Jamie Madill | a2fbb84 | 2014-09-03 09:40:47 -0400 | [diff] [blame] | 492 | std::vector<InterfaceBlock> *infoList) const |
Jamie Madill | d5512cd | 2014-07-10 17:50:08 -0400 | [diff] [blame] | 493 | { |
Jamie Madill | a2fbb84 | 2014-09-03 09:40:47 -0400 | [diff] [blame] | 494 | InterfaceBlock interfaceBlock; |
Jamie Madill | d5512cd | 2014-07-10 17:50:08 -0400 | [diff] [blame] | 495 | const TInterfaceBlock *blockType = variable->getType().getInterfaceBlock(); |
Jamie Madill | 42bcf32 | 2014-08-25 16:20:46 -0400 | [diff] [blame] | 496 | ASSERT(blockType); |
Jamie Madill | d5512cd | 2014-07-10 17:50:08 -0400 | [diff] [blame] | 497 | |
| 498 | interfaceBlock.name = blockType->name().c_str(); |
| 499 | interfaceBlock.mappedName = TIntermTraverser::hash(variable->getSymbol(), mHashFunction).c_str(); |
Jamie Madill | 42bcf32 | 2014-08-25 16:20:46 -0400 | [diff] [blame] | 500 | interfaceBlock.instanceName = (blockType->hasInstanceName() ? blockType->instanceName().c_str() : ""); |
Jamie Madill | d5512cd | 2014-07-10 17:50:08 -0400 | [diff] [blame] | 501 | interfaceBlock.arraySize = variable->getArraySize(); |
Jamie Madill | 42bcf32 | 2014-08-25 16:20:46 -0400 | [diff] [blame] | 502 | interfaceBlock.isRowMajorLayout = (blockType->matrixPacking() == EmpRowMajor); |
Jamie Madill | 54ad4f8 | 2014-09-03 09:40:46 -0400 | [diff] [blame] | 503 | interfaceBlock.layout = GetBlockLayoutType(blockType->blockStorage()); |
Jamie Madill | d5512cd | 2014-07-10 17:50:08 -0400 | [diff] [blame] | 504 | |
Jamie Madill | a6f267f | 2014-08-27 11:44:15 -0400 | [diff] [blame] | 505 | // Gather field information |
Jamie Madill | 54ad4f8 | 2014-09-03 09:40:46 -0400 | [diff] [blame] | 506 | const TFieldList &fieldList = blockType->fields(); |
| 507 | |
| 508 | for (size_t fieldIndex = 0; fieldIndex < fieldList.size(); ++fieldIndex) |
| 509 | { |
| 510 | const TField &field = *fieldList[fieldIndex]; |
| 511 | const TString &fullFieldName = InterfaceBlockFieldName(*blockType, field); |
| 512 | const TType &fieldType = *field.type(); |
| 513 | |
Zhenyao Mo | 94ac7b7 | 2014-10-15 18:22:08 -0700 | [diff] [blame] | 514 | GetVariableTraverser traverser(mSymbolTable); |
Jamie Madill | 54ad4f8 | 2014-09-03 09:40:46 -0400 | [diff] [blame] | 515 | traverser.traverse(fieldType, fullFieldName, &interfaceBlock.fields); |
| 516 | |
| 517 | interfaceBlock.fields.back().isRowMajorLayout = (fieldType.getLayoutQualifier().matrixPacking == EmpRowMajor); |
| 518 | } |
Jamie Madill | d5512cd | 2014-07-10 17:50:08 -0400 | [diff] [blame] | 519 | |
| 520 | infoList->push_back(interfaceBlock); |
| 521 | } |
| 522 | |
Jamie Madill | 23a8a43 | 2014-07-09 13:27:42 -0400 | [diff] [blame] | 523 | template <typename VarT> |
Jamie Madill | 4667c45 | 2014-07-08 15:02:36 -0400 | [diff] [blame] | 524 | void CollectVariables::visitVariable(const TIntermSymbol *variable, |
| 525 | std::vector<VarT> *infoList) const |
| 526 | { |
Zhenyao Mo | 94ac7b7 | 2014-10-15 18:22:08 -0700 | [diff] [blame] | 527 | NameHashingTraverser traverser(mHashFunction, mSymbolTable); |
Jamie Madill | 42bcf32 | 2014-08-25 16:20:46 -0400 | [diff] [blame] | 528 | traverser.traverse(variable->getType(), variable->getSymbol(), infoList); |
Jamie Madill | 4667c45 | 2014-07-08 15:02:36 -0400 | [diff] [blame] | 529 | } |
| 530 | |
| 531 | template <typename VarT> |
| 532 | void CollectVariables::visitInfoList(const TIntermSequence &sequence, |
| 533 | std::vector<VarT> *infoList) const |
Jamie Madill | a718c1e | 2014-07-02 15:31:22 -0400 | [diff] [blame] | 534 | { |
| 535 | for (size_t seqIndex = 0; seqIndex < sequence.size(); seqIndex++) |
| 536 | { |
Jamie Madill | 4667c45 | 2014-07-08 15:02:36 -0400 | [diff] [blame] | 537 | const TIntermSymbol *variable = sequence[seqIndex]->getAsSymbolNode(); |
Jamie Madill | a718c1e | 2014-07-02 15:31:22 -0400 | [diff] [blame] | 538 | // The only case in which the sequence will not contain a |
| 539 | // TIntermSymbol node is initialization. It will contain a |
| 540 | // TInterBinary node in that case. Since attributes, uniforms, |
| 541 | // and varyings cannot be initialized in a shader, we must have |
| 542 | // only TIntermSymbol nodes in the sequence. |
| 543 | ASSERT(variable != NULL); |
Jamie Madill | 4667c45 | 2014-07-08 15:02:36 -0400 | [diff] [blame] | 544 | visitVariable(variable, infoList); |
Jamie Madill | a718c1e | 2014-07-02 15:31:22 -0400 | [diff] [blame] | 545 | } |
alokp@chromium.org | 07620a5 | 2010-09-23 17:53:56 +0000 | [diff] [blame] | 546 | } |
| 547 | |
Jamie Madill | 4667c45 | 2014-07-08 15:02:36 -0400 | [diff] [blame] | 548 | bool CollectVariables::visitAggregate(Visit, TIntermAggregate *node) |
alokp@chromium.org | ee76f6a | 2010-09-27 19:28:55 +0000 | [diff] [blame] | 549 | { |
Zhenyao Mo | d2d340b | 2013-09-23 14:57:05 -0400 | [diff] [blame] | 550 | bool visitChildren = true; |
alokp@chromium.org | ee76f6a | 2010-09-27 19:28:55 +0000 | [diff] [blame] | 551 | |
| 552 | switch (node->getOp()) |
| 553 | { |
Jamie Madill | 4667c45 | 2014-07-08 15:02:36 -0400 | [diff] [blame] | 554 | case EOpDeclaration: |
alokp@chromium.org | ee76f6a | 2010-09-27 19:28:55 +0000 | [diff] [blame] | 555 | { |
Zhenyao Mo | e40d1e9 | 2014-07-16 17:40:36 -0700 | [diff] [blame] | 556 | const TIntermSequence &sequence = *(node->getSequence()); |
Jamie Madill | 1c28e1f | 2014-08-04 11:37:54 -0400 | [diff] [blame] | 557 | ASSERT(!sequence.empty()); |
| 558 | |
Zhenyao Mo | e40d1e9 | 2014-07-16 17:40:36 -0700 | [diff] [blame] | 559 | const TIntermTyped &typedNode = *(sequence.front()->getAsTyped()); |
Jamie Madill | d5512cd | 2014-07-10 17:50:08 -0400 | [diff] [blame] | 560 | TQualifier qualifier = typedNode.getQualifier(); |
| 561 | |
| 562 | if (typedNode.getBasicType() == EbtInterfaceBlock) |
| 563 | { |
| 564 | visitInfoList(sequence, mInterfaceBlocks); |
Jamie Madill | b547ddf | 2014-08-25 16:20:46 -0400 | [diff] [blame] | 565 | visitChildren = false; |
Jamie Madill | d5512cd | 2014-07-10 17:50:08 -0400 | [diff] [blame] | 566 | } |
| 567 | else if (qualifier == EvqAttribute || qualifier == EvqVertexIn || |
| 568 | qualifier == EvqFragmentOut || qualifier == EvqUniform || |
Jamie Madill | a2fbb84 | 2014-09-03 09:40:47 -0400 | [diff] [blame] | 569 | IsVarying(qualifier)) |
Zhenyao Mo | 74da9f2 | 2013-09-23 14:57:01 -0400 | [diff] [blame] | 570 | { |
Jamie Madill | 4667c45 | 2014-07-08 15:02:36 -0400 | [diff] [blame] | 571 | switch (qualifier) |
| 572 | { |
| 573 | case EvqAttribute: |
| 574 | case EvqVertexIn: |
| 575 | visitInfoList(sequence, mAttribs); |
| 576 | break; |
Jamie Madill | d5512cd | 2014-07-10 17:50:08 -0400 | [diff] [blame] | 577 | case EvqFragmentOut: |
| 578 | visitInfoList(sequence, mOutputVariables); |
| 579 | break; |
Jamie Madill | 4667c45 | 2014-07-08 15:02:36 -0400 | [diff] [blame] | 580 | case EvqUniform: |
| 581 | visitInfoList(sequence, mUniforms); |
| 582 | break; |
| 583 | default: |
Jamie Madill | 3b5c2da | 2014-08-19 15:23:32 -0400 | [diff] [blame] | 584 | visitInfoList(sequence, mVaryings); |
Jamie Madill | 4667c45 | 2014-07-08 15:02:36 -0400 | [diff] [blame] | 585 | break; |
| 586 | } |
Zhenyao Mo | 74da9f2 | 2013-09-23 14:57:01 -0400 | [diff] [blame] | 587 | |
Jamie Madill | 1c28e1f | 2014-08-04 11:37:54 -0400 | [diff] [blame] | 588 | visitChildren = false; |
alokp@chromium.org | ee76f6a | 2010-09-27 19:28:55 +0000 | [diff] [blame] | 589 | } |
Jamie Madill | 4667c45 | 2014-07-08 15:02:36 -0400 | [diff] [blame] | 590 | break; |
alokp@chromium.org | ee76f6a | 2010-09-27 19:28:55 +0000 | [diff] [blame] | 591 | } |
Jamie Madill | 4667c45 | 2014-07-08 15:02:36 -0400 | [diff] [blame] | 592 | default: break; |
alokp@chromium.org | ee76f6a | 2010-09-27 19:28:55 +0000 | [diff] [blame] | 593 | } |
| 594 | |
| 595 | return visitChildren; |
| 596 | } |
Jamie Madill | 23a8a43 | 2014-07-09 13:27:42 -0400 | [diff] [blame] | 597 | |
Jamie Madill | b547ddf | 2014-08-25 16:20:46 -0400 | [diff] [blame] | 598 | bool CollectVariables::visitBinary(Visit, TIntermBinary *binaryNode) |
| 599 | { |
| 600 | if (binaryNode->getOp() == EOpIndexDirectInterfaceBlock) |
| 601 | { |
Jamie Madill | a6f267f | 2014-08-27 11:44:15 -0400 | [diff] [blame] | 602 | // NOTE: we do not determine static use for individual blocks of an array |
| 603 | TIntermTyped *blockNode = binaryNode->getLeft()->getAsTyped(); |
| 604 | ASSERT(blockNode); |
Jamie Madill | b547ddf | 2014-08-25 16:20:46 -0400 | [diff] [blame] | 605 | |
| 606 | TIntermConstantUnion *constantUnion = binaryNode->getRight()->getAsConstantUnion(); |
| 607 | ASSERT(constantUnion); |
| 608 | |
Jamie Madill | a6f267f | 2014-08-27 11:44:15 -0400 | [diff] [blame] | 609 | const TInterfaceBlock *interfaceBlock = blockNode->getType().getInterfaceBlock(); |
Jamie Madill | a2fbb84 | 2014-09-03 09:40:47 -0400 | [diff] [blame] | 610 | InterfaceBlock *namedBlock = FindVariable(interfaceBlock->name(), mInterfaceBlocks); |
Jamie Madill | b547ddf | 2014-08-25 16:20:46 -0400 | [diff] [blame] | 611 | ASSERT(namedBlock); |
| 612 | namedBlock->staticUse = true; |
| 613 | |
| 614 | unsigned int fieldIndex = constantUnion->getUConst(0); |
| 615 | ASSERT(fieldIndex < namedBlock->fields.size()); |
| 616 | namedBlock->fields[fieldIndex].staticUse = true; |
| 617 | return false; |
| 618 | } |
| 619 | |
| 620 | return true; |
| 621 | } |
| 622 | |
Zhenyao Mo | 409078f | 2014-10-28 13:23:18 -0700 | [diff] [blame] | 623 | void ExpandUniforms(const std::vector<Uniform> &compact, |
| 624 | std::vector<ShaderVariable> *expanded) |
Jamie Madill | 23a8a43 | 2014-07-09 13:27:42 -0400 | [diff] [blame] | 625 | { |
| 626 | for (size_t variableIndex = 0; variableIndex < compact.size(); variableIndex++) |
| 627 | { |
Jamie Madill | a2fbb84 | 2014-09-03 09:40:47 -0400 | [diff] [blame] | 628 | const ShaderVariable &variable = compact[variableIndex]; |
Jamie Madill | 23a8a43 | 2014-07-09 13:27:42 -0400 | [diff] [blame] | 629 | ExpandVariable(variable, variable.name, variable.mappedName, variable.staticUse, expanded); |
| 630 | } |
| 631 | } |
| 632 | |
Jamie Madill | a2fbb84 | 2014-09-03 09:40:47 -0400 | [diff] [blame] | 633 | } |