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 | |
| 7 | #include "compiler/VariableInfo.h" |
| 8 | |
Zhenyao Mo | d2d340b | 2013-09-23 14:57:05 -0400 | [diff] [blame^] | 9 | namespace { |
| 10 | |
| 11 | TString arrayBrackets(int index) |
alokp@chromium.org | ee76f6a | 2010-09-27 19:28:55 +0000 | [diff] [blame] | 12 | { |
| 13 | TStringStream stream; |
| 14 | stream << "[" << index << "]"; |
| 15 | return stream.str(); |
| 16 | } |
| 17 | |
Zhenyao Mo | d2d340b | 2013-09-23 14:57:05 -0400 | [diff] [blame^] | 18 | // Returns the data type for an attribute, uniform, or varying. |
| 19 | ShDataType getVariableDataType(const TType& type) |
alokp@chromium.org | ee76f6a | 2010-09-27 19:28:55 +0000 | [diff] [blame] | 20 | { |
| 21 | switch (type.getBasicType()) { |
| 22 | case EbtFloat: |
| 23 | if (type.isMatrix()) { |
shannonwoods@chromium.org | 8da034c | 2013-05-30 00:19:15 +0000 | [diff] [blame] | 24 | switch (type.getCols()) |
| 25 | { |
| 26 | case 2: |
| 27 | switch (type.getRows()) |
| 28 | { |
| 29 | case 2: return SH_FLOAT_MAT2; |
| 30 | case 3: return SH_FLOAT_MAT2x3; |
| 31 | case 4: return SH_FLOAT_MAT2x4; |
| 32 | default: UNREACHABLE(); |
| 33 | } |
| 34 | case 3: |
| 35 | switch (type.getRows()) |
| 36 | { |
| 37 | case 2: return SH_FLOAT_MAT3x2; |
| 38 | case 3: return SH_FLOAT_MAT3; |
| 39 | case 4: return SH_FLOAT_MAT3x4; |
| 40 | default: UNREACHABLE(); |
| 41 | } |
| 42 | case 4: |
| 43 | switch (type.getRows()) |
| 44 | { |
| 45 | case 2: return SH_FLOAT_MAT4x2; |
| 46 | case 3: return SH_FLOAT_MAT4x3; |
| 47 | case 4: return SH_FLOAT_MAT4; |
| 48 | default: UNREACHABLE(); |
| 49 | } |
alokp@chromium.org | ee76f6a | 2010-09-27 19:28:55 +0000 | [diff] [blame] | 50 | } |
| 51 | } else if (type.isVector()) { |
| 52 | switch (type.getNominalSize()) { |
| 53 | case 2: return SH_FLOAT_VEC2; |
| 54 | case 3: return SH_FLOAT_VEC3; |
| 55 | case 4: return SH_FLOAT_VEC4; |
| 56 | default: UNREACHABLE(); |
| 57 | } |
| 58 | } else { |
| 59 | return SH_FLOAT; |
| 60 | } |
| 61 | case EbtInt: |
| 62 | if (type.isMatrix()) { |
| 63 | UNREACHABLE(); |
| 64 | } else if (type.isVector()) { |
| 65 | switch (type.getNominalSize()) { |
| 66 | case 2: return SH_INT_VEC2; |
| 67 | case 3: return SH_INT_VEC3; |
| 68 | case 4: return SH_INT_VEC4; |
| 69 | default: UNREACHABLE(); |
| 70 | } |
| 71 | } else { |
| 72 | return SH_INT; |
| 73 | } |
shannonwoods@chromium.org | 6b70991 | 2013-05-30 00:20:04 +0000 | [diff] [blame] | 74 | case EbtUInt: |
| 75 | if (type.isMatrix()) { |
| 76 | UNREACHABLE(); |
| 77 | } else if (type.isVector()) { |
Jamie Madill | 22d63da | 2013-06-07 12:45:12 -0400 | [diff] [blame] | 78 | switch (type.getNominalSize()) { |
shannonwoods@chromium.org | 6b70991 | 2013-05-30 00:20:04 +0000 | [diff] [blame] | 79 | case 2: return SH_UNSIGNED_INT_VEC2; |
| 80 | case 3: return SH_UNSIGNED_INT_VEC3; |
| 81 | case 4: return SH_UNSIGNED_INT_VEC4; |
| 82 | default: UNREACHABLE(); |
| 83 | } |
| 84 | } else { |
| 85 | return SH_UNSIGNED_INT; |
| 86 | } |
alokp@chromium.org | ee76f6a | 2010-09-27 19:28:55 +0000 | [diff] [blame] | 87 | case EbtBool: |
| 88 | if (type.isMatrix()) { |
| 89 | UNREACHABLE(); |
| 90 | } else if (type.isVector()) { |
| 91 | switch (type.getNominalSize()) { |
| 92 | case 2: return SH_BOOL_VEC2; |
| 93 | case 3: return SH_BOOL_VEC3; |
| 94 | case 4: return SH_BOOL_VEC4; |
| 95 | default: UNREACHABLE(); |
| 96 | } |
| 97 | } else { |
| 98 | return SH_BOOL; |
| 99 | } |
| 100 | case EbtSampler2D: return SH_SAMPLER_2D; |
Nicolas Capens | 8772b58 | 2013-06-24 16:14:19 -0400 | [diff] [blame] | 101 | case EbtSampler3D: return SH_SAMPLER_3D; |
alokp@chromium.org | ee76f6a | 2010-09-27 19:28:55 +0000 | [diff] [blame] | 102 | case EbtSamplerCube: return SH_SAMPLER_CUBE; |
apatrick@chromium.org | 6575602 | 2012-01-17 21:45:38 +0000 | [diff] [blame] | 103 | case EbtSamplerExternalOES: return SH_SAMPLER_EXTERNAL_OES; |
kbr@chromium.org | 205fef3 | 2011-11-22 20:50:02 +0000 | [diff] [blame] | 104 | case EbtSampler2DRect: return SH_SAMPLER_2D_RECT_ARB; |
Nicolas Capens | 8772b58 | 2013-06-24 16:14:19 -0400 | [diff] [blame] | 105 | case EbtSampler2DArray: return SH_SAMPLER_2D_ARRAY; |
Nicolas Capens | 344e714 | 2013-06-24 15:39:21 -0400 | [diff] [blame] | 106 | case EbtISampler2D: return SH_INT_SAMPLER_2D; |
Nicolas Capens | 8772b58 | 2013-06-24 16:14:19 -0400 | [diff] [blame] | 107 | case EbtISampler3D: return SH_INT_SAMPLER_3D; |
Nicolas Capens | 344e714 | 2013-06-24 15:39:21 -0400 | [diff] [blame] | 108 | case EbtISamplerCube: return SH_INT_SAMPLER_CUBE; |
Nicolas Capens | 8772b58 | 2013-06-24 16:14:19 -0400 | [diff] [blame] | 109 | case EbtISampler2DArray: return SH_INT_SAMPLER_2D_ARRAY; |
Nicolas Capens | 2ffe0bb | 2013-06-24 15:56:19 -0400 | [diff] [blame] | 110 | case EbtUSampler2D: return SH_UNSIGNED_INT_SAMPLER_2D; |
Nicolas Capens | 8772b58 | 2013-06-24 16:14:19 -0400 | [diff] [blame] | 111 | case EbtUSampler3D: return SH_UNSIGNED_INT_SAMPLER_3D; |
Nicolas Capens | 2ffe0bb | 2013-06-24 15:56:19 -0400 | [diff] [blame] | 112 | case EbtUSamplerCube: return SH_UNSIGNED_INT_SAMPLER_CUBE; |
Nicolas Capens | 8772b58 | 2013-06-24 16:14:19 -0400 | [diff] [blame] | 113 | case EbtUSampler2DArray: return SH_UNSIGNED_INT_SAMPLER_2D_ARRAY; |
Nicolas Capens | 2a1d8a3 | 2013-07-18 11:49:40 -0400 | [diff] [blame] | 114 | case EbtSampler2DShadow: return SH_SAMPLER_2D_SHADOW; |
| 115 | case EbtSamplerCubeShadow: return SH_SAMPLER_CUBE_SHADOW; |
| 116 | case EbtSampler2DArrayShadow: return SH_SAMPLER_2D_ARRAY_SHADOW; |
alokp@chromium.org | ee76f6a | 2010-09-27 19:28:55 +0000 | [diff] [blame] | 117 | default: UNREACHABLE(); |
| 118 | } |
| 119 | return SH_NONE; |
| 120 | } |
| 121 | |
Zhenyao Mo | d2d340b | 2013-09-23 14:57:05 -0400 | [diff] [blame^] | 122 | void getBuiltInVariableInfo(const TType& type, |
alokp@chromium.org | ee76f6a | 2010-09-27 19:28:55 +0000 | [diff] [blame] | 123 | const TString& name, |
zmo@google.com | fd747b8 | 2011-04-23 01:30:07 +0000 | [diff] [blame] | 124 | const TString& mappedName, |
Zhenyao Mo | d2d340b | 2013-09-23 14:57:05 -0400 | [diff] [blame^] | 125 | TVariableInfoList& infoList); |
| 126 | void getUserDefinedVariableInfo(const TType& type, |
| 127 | const TString& name, |
| 128 | const TString& mappedName, |
| 129 | TVariableInfoList& infoList, |
| 130 | ShHashFunction64 hashFunction); |
| 131 | |
| 132 | // Returns info for an attribute, uniform, or varying. |
| 133 | void getVariableInfo(const TType& type, |
| 134 | const TString& name, |
| 135 | const TString& mappedName, |
| 136 | TVariableInfoList& infoList, |
| 137 | ShHashFunction64 hashFunction) |
alokp@chromium.org | ee76f6a | 2010-09-27 19:28:55 +0000 | [diff] [blame] | 138 | { |
| 139 | if (type.getBasicType() == EbtStruct) { |
| 140 | if (type.isArray()) { |
| 141 | for (int i = 0; i < type.getArraySize(); ++i) { |
| 142 | TString lname = name + arrayBrackets(i); |
zmo@google.com | fd747b8 | 2011-04-23 01:30:07 +0000 | [diff] [blame] | 143 | TString lmappedName = mappedName + arrayBrackets(i); |
daniel@transgaming.com | 0aa3b5a | 2012-11-28 19:43:24 +0000 | [diff] [blame] | 144 | getUserDefinedVariableInfo(type, lname, lmappedName, infoList, hashFunction); |
alokp@chromium.org | ee76f6a | 2010-09-27 19:28:55 +0000 | [diff] [blame] | 145 | } |
| 146 | } else { |
daniel@transgaming.com | 0aa3b5a | 2012-11-28 19:43:24 +0000 | [diff] [blame] | 147 | getUserDefinedVariableInfo(type, name, mappedName, infoList, hashFunction); |
alokp@chromium.org | ee76f6a | 2010-09-27 19:28:55 +0000 | [diff] [blame] | 148 | } |
| 149 | } else { |
zmo@google.com | fd747b8 | 2011-04-23 01:30:07 +0000 | [diff] [blame] | 150 | getBuiltInVariableInfo(type, name, mappedName, infoList); |
alokp@chromium.org | ee76f6a | 2010-09-27 19:28:55 +0000 | [diff] [blame] | 151 | } |
| 152 | } |
| 153 | |
| 154 | void getBuiltInVariableInfo(const TType& type, |
| 155 | const TString& name, |
zmo@google.com | fd747b8 | 2011-04-23 01:30:07 +0000 | [diff] [blame] | 156 | const TString& mappedName, |
alokp@chromium.org | ee76f6a | 2010-09-27 19:28:55 +0000 | [diff] [blame] | 157 | TVariableInfoList& infoList) |
| 158 | { |
| 159 | ASSERT(type.getBasicType() != EbtStruct); |
| 160 | |
| 161 | TVariableInfo varInfo; |
| 162 | if (type.isArray()) { |
| 163 | varInfo.name = (name + "[0]").c_str(); |
zmo@google.com | fd747b8 | 2011-04-23 01:30:07 +0000 | [diff] [blame] | 164 | varInfo.mappedName = (mappedName + "[0]").c_str(); |
alokp@chromium.org | ee76f6a | 2010-09-27 19:28:55 +0000 | [diff] [blame] | 165 | varInfo.size = type.getArraySize(); |
| 166 | } else { |
| 167 | varInfo.name = name.c_str(); |
zmo@google.com | fd747b8 | 2011-04-23 01:30:07 +0000 | [diff] [blame] | 168 | varInfo.mappedName = mappedName.c_str(); |
alokp@chromium.org | ee76f6a | 2010-09-27 19:28:55 +0000 | [diff] [blame] | 169 | varInfo.size = 1; |
| 170 | } |
Zhenyao Mo | 74da9f2 | 2013-09-23 14:57:01 -0400 | [diff] [blame] | 171 | varInfo.precision = type.getPrecision(); |
alokp@chromium.org | ee76f6a | 2010-09-27 19:28:55 +0000 | [diff] [blame] | 172 | varInfo.type = getVariableDataType(type); |
| 173 | infoList.push_back(varInfo); |
| 174 | } |
| 175 | |
| 176 | void getUserDefinedVariableInfo(const TType& type, |
| 177 | const TString& name, |
zmo@google.com | fd747b8 | 2011-04-23 01:30:07 +0000 | [diff] [blame] | 178 | const TString& mappedName, |
daniel@transgaming.com | 0aa3b5a | 2012-11-28 19:43:24 +0000 | [diff] [blame] | 179 | TVariableInfoList& infoList, |
| 180 | ShHashFunction64 hashFunction) |
alokp@chromium.org | ee76f6a | 2010-09-27 19:28:55 +0000 | [diff] [blame] | 181 | { |
Jamie Madill | 98493dd | 2013-07-08 14:39:03 -0400 | [diff] [blame] | 182 | ASSERT(type.getBasicType() == EbtStruct || type.isInterfaceBlock()); |
alokp@chromium.org | ee76f6a | 2010-09-27 19:28:55 +0000 | [diff] [blame] | 183 | |
Jamie Madill | 98493dd | 2013-07-08 14:39:03 -0400 | [diff] [blame] | 184 | const TFieldList& fields = type.getStruct()->fields(); |
| 185 | for (size_t i = 0; i < fields.size(); ++i) { |
| 186 | const TType& fieldType = *(fields[i]->type()); |
| 187 | const TString& fieldName = fields[i]->name(); |
| 188 | getVariableInfo(fieldType, |
| 189 | name + "." + fieldName, |
| 190 | mappedName + "." + TIntermTraverser::hash(fieldName, hashFunction), |
daniel@transgaming.com | 0aa3b5a | 2012-11-28 19:43:24 +0000 | [diff] [blame] | 191 | infoList, |
| 192 | hashFunction); |
alokp@chromium.org | ee76f6a | 2010-09-27 19:28:55 +0000 | [diff] [blame] | 193 | } |
| 194 | } |
| 195 | |
Zhenyao Mo | d2d340b | 2013-09-23 14:57:05 -0400 | [diff] [blame^] | 196 | TVariableInfo* findVariable(const TType& type, |
| 197 | const TString& name, |
| 198 | TVariableInfoList& infoList) |
| 199 | { |
| 200 | // TODO(zmo): optimize this function. |
| 201 | TString myName = name; |
| 202 | if (type.isArray()) |
| 203 | myName += "[0]"; |
| 204 | for (size_t ii = 0; ii < infoList.size(); ++ii) |
| 205 | { |
| 206 | if (infoList[ii].name.c_str() == myName) |
| 207 | return &(infoList[ii]); |
| 208 | } |
| 209 | return NULL; |
| 210 | } |
| 211 | |
| 212 | } // namespace anonymous |
| 213 | |
gman@chromium.org | 8d80479 | 2012-10-17 21:33:48 +0000 | [diff] [blame] | 214 | TVariableInfo::TVariableInfo() |
Zhenyao Mo | d2d340b | 2013-09-23 14:57:05 -0400 | [diff] [blame^] | 215 | : type(SH_NONE), |
| 216 | size(0), |
| 217 | precision(EbpUndefined), |
| 218 | staticUse(false) |
gman@chromium.org | 8d80479 | 2012-10-17 21:33:48 +0000 | [diff] [blame] | 219 | { |
| 220 | } |
| 221 | |
| 222 | TVariableInfo::TVariableInfo(ShDataType type, int size) |
| 223 | : type(type), |
Zhenyao Mo | d2d340b | 2013-09-23 14:57:05 -0400 | [diff] [blame^] | 224 | size(size), |
| 225 | precision(EbpUndefined), |
| 226 | staticUse(false) |
gman@chromium.org | 8d80479 | 2012-10-17 21:33:48 +0000 | [diff] [blame] | 227 | { |
| 228 | } |
| 229 | |
Zhenyao Mo | 74da9f2 | 2013-09-23 14:57:01 -0400 | [diff] [blame] | 230 | CollectVariables::CollectVariables(TVariableInfoList& attribs, |
| 231 | TVariableInfoList& uniforms, |
| 232 | TVariableInfoList& varyings, |
| 233 | ShHashFunction64 hashFunction) |
alokp@chromium.org | 07620a5 | 2010-09-23 17:53:56 +0000 | [diff] [blame] | 234 | : mAttribs(attribs), |
daniel@transgaming.com | 0aa3b5a | 2012-11-28 19:43:24 +0000 | [diff] [blame] | 235 | mUniforms(uniforms), |
Zhenyao Mo | 74da9f2 | 2013-09-23 14:57:01 -0400 | [diff] [blame] | 236 | mVaryings(varyings), |
Zhenyao Mo | d2d340b | 2013-09-23 14:57:05 -0400 | [diff] [blame^] | 237 | mPointCoordAdded(false), |
| 238 | mFrontFacingAdded(false), |
| 239 | mFragCoordAdded(false), |
daniel@transgaming.com | 0aa3b5a | 2012-11-28 19:43:24 +0000 | [diff] [blame] | 240 | mHashFunction(hashFunction) |
alokp@chromium.org | 07620a5 | 2010-09-23 17:53:56 +0000 | [diff] [blame] | 241 | { |
| 242 | } |
| 243 | |
Zhenyao Mo | d2d340b | 2013-09-23 14:57:05 -0400 | [diff] [blame^] | 244 | // We want to check whether a uniform/varying is statically used |
| 245 | // because we only count the used ones in packing computing. |
| 246 | // Also, gl_FragCoord, gl_PointCoord, and gl_FrontFacing count |
| 247 | // toward varying counting if they are statically used in a fragment |
| 248 | // shader. |
| 249 | void CollectVariables::visitSymbol(TIntermSymbol* symbol) |
alokp@chromium.org | 07620a5 | 2010-09-23 17:53:56 +0000 | [diff] [blame] | 250 | { |
Zhenyao Mo | d2d340b | 2013-09-23 14:57:05 -0400 | [diff] [blame^] | 251 | ASSERT(symbol != NULL); |
| 252 | TVariableInfo* var = NULL; |
| 253 | switch (symbol->getQualifier()) |
| 254 | { |
| 255 | case EvqVaryingOut: |
| 256 | case EvqInvariantVaryingOut: |
| 257 | case EvqVaryingIn: |
| 258 | case EvqInvariantVaryingIn: |
| 259 | var = findVariable(symbol->getType(), symbol->getSymbol(), mVaryings); |
| 260 | break; |
| 261 | case EvqUniform: |
| 262 | var = findVariable(symbol->getType(), symbol->getSymbol(), mUniforms); |
| 263 | break; |
| 264 | case EvqFragCoord: |
| 265 | if (!mFragCoordAdded) { |
| 266 | TVariableInfo info; |
| 267 | info.name = "gl_FragCoord"; |
| 268 | info.mappedName = "gl_FragCoord"; |
| 269 | info.type = SH_FLOAT_VEC4; |
| 270 | info.size = 1; |
| 271 | info.precision = EbpMedium; // Use mediump as it doesn't really matter. |
| 272 | info.staticUse = true; |
| 273 | mVaryings.push_back(info); |
| 274 | mFragCoordAdded = true; |
| 275 | } |
| 276 | return; |
| 277 | case EvqFrontFacing: |
| 278 | if (!mFrontFacingAdded) { |
| 279 | TVariableInfo info; |
| 280 | info.name = "gl_FrontFacing"; |
| 281 | info.mappedName = "gl_FrontFacing"; |
| 282 | info.type = SH_BOOL; |
| 283 | info.size = 1; |
| 284 | info.precision = EbpUndefined; |
| 285 | info.staticUse = true; |
| 286 | mVaryings.push_back(info); |
| 287 | mFrontFacingAdded = true; |
| 288 | } |
| 289 | return; |
| 290 | case EvqPointCoord: |
| 291 | if (!mPointCoordAdded) { |
| 292 | TVariableInfo info; |
| 293 | info.name = "gl_PointCoord"; |
| 294 | info.mappedName = "gl_PointCoord"; |
| 295 | info.type = SH_FLOAT_VEC2; |
| 296 | info.size = 1; |
| 297 | info.precision = EbpMedium; // Use mediump as it doesn't really matter. |
| 298 | info.staticUse = true; |
| 299 | mVaryings.push_back(info); |
| 300 | mPointCoordAdded = true; |
| 301 | } |
| 302 | return; |
| 303 | default: |
| 304 | break; |
| 305 | } |
| 306 | if (var) |
| 307 | var->staticUse = true; |
alokp@chromium.org | 07620a5 | 2010-09-23 17:53:56 +0000 | [diff] [blame] | 308 | } |
| 309 | |
Zhenyao Mo | 74da9f2 | 2013-09-23 14:57:01 -0400 | [diff] [blame] | 310 | bool CollectVariables::visitAggregate(Visit, TIntermAggregate* node) |
alokp@chromium.org | ee76f6a | 2010-09-27 19:28:55 +0000 | [diff] [blame] | 311 | { |
Zhenyao Mo | d2d340b | 2013-09-23 14:57:05 -0400 | [diff] [blame^] | 312 | bool visitChildren = true; |
alokp@chromium.org | ee76f6a | 2010-09-27 19:28:55 +0000 | [diff] [blame] | 313 | |
| 314 | switch (node->getOp()) |
| 315 | { |
alokp@chromium.org | ee76f6a | 2010-09-27 19:28:55 +0000 | [diff] [blame] | 316 | case EOpDeclaration: { |
| 317 | const TIntermSequence& sequence = node->getSequence(); |
alokp@chromium.org | 10e6e9e | 2010-09-27 21:03:45 +0000 | [diff] [blame] | 318 | TQualifier qualifier = sequence.front()->getAsTyped()->getQualifier(); |
Zhenyao Mo | 74da9f2 | 2013-09-23 14:57:01 -0400 | [diff] [blame] | 319 | if (qualifier == EvqAttribute || qualifier == EvqVertexIn || qualifier == EvqUniform || |
| 320 | qualifier == EvqVaryingIn || qualifier == EvqVaryingOut || |
| 321 | qualifier == EvqInvariantVaryingIn || qualifier == EvqInvariantVaryingOut) |
alokp@chromium.org | ee76f6a | 2010-09-27 19:28:55 +0000 | [diff] [blame] | 322 | { |
Zhenyao Mo | 74da9f2 | 2013-09-23 14:57:01 -0400 | [diff] [blame] | 323 | TVariableInfoList *infoList = NULL; |
| 324 | |
| 325 | switch (qualifier) |
| 326 | { |
| 327 | case EvqAttribute: |
| 328 | case EvqVertexIn: |
| 329 | infoList = &mAttribs; |
| 330 | break; |
| 331 | case EvqUniform: |
| 332 | infoList = &mUniforms; |
| 333 | break; |
| 334 | default: |
| 335 | infoList = &mVaryings; |
| 336 | break; |
| 337 | } |
| 338 | |
alokp@chromium.org | ee76f6a | 2010-09-27 19:28:55 +0000 | [diff] [blame] | 339 | for (TIntermSequence::const_iterator i = sequence.begin(); |
| 340 | i != sequence.end(); ++i) |
| 341 | { |
alokp@chromium.org | 10e6e9e | 2010-09-27 21:03:45 +0000 | [diff] [blame] | 342 | const TIntermSymbol* variable = (*i)->getAsSymbolNode(); |
| 343 | // The only case in which the sequence will not contain a |
| 344 | // TIntermSymbol node is initialization. It will contain a |
Zhenyao Mo | d2d340b | 2013-09-23 14:57:05 -0400 | [diff] [blame^] | 345 | // TInterBinary node in that case. Since attributes, uniforms, |
| 346 | // and varyings cannot be initialized in a shader, we must have |
| 347 | // only TIntermSymbol nodes in the sequence. |
alokp@chromium.org | 10e6e9e | 2010-09-27 21:03:45 +0000 | [diff] [blame] | 348 | ASSERT(variable != NULL); |
daniel@transgaming.com | 0aa3b5a | 2012-11-28 19:43:24 +0000 | [diff] [blame] | 349 | TString processedSymbol; |
| 350 | if (mHashFunction == NULL) |
| 351 | processedSymbol = variable->getSymbol(); |
| 352 | else |
| 353 | processedSymbol = TIntermTraverser::hash(variable->getOriginalSymbol(), mHashFunction); |
zmo@google.com | fd747b8 | 2011-04-23 01:30:07 +0000 | [diff] [blame] | 354 | getVariableInfo(variable->getType(), |
| 355 | variable->getOriginalSymbol(), |
daniel@transgaming.com | 0aa3b5a | 2012-11-28 19:43:24 +0000 | [diff] [blame] | 356 | processedSymbol, |
Zhenyao Mo | 74da9f2 | 2013-09-23 14:57:01 -0400 | [diff] [blame] | 357 | *infoList, |
daniel@transgaming.com | 0aa3b5a | 2012-11-28 19:43:24 +0000 | [diff] [blame] | 358 | mHashFunction); |
Zhenyao Mo | d2d340b | 2013-09-23 14:57:05 -0400 | [diff] [blame^] | 359 | visitChildren = false; |
alokp@chromium.org | ee76f6a | 2010-09-27 19:28:55 +0000 | [diff] [blame] | 360 | } |
| 361 | } |
| 362 | break; |
| 363 | } |
| 364 | default: break; |
| 365 | } |
| 366 | |
| 367 | return visitChildren; |
| 368 | } |
| 369 | |