zmo@google.com | fd747b8 | 2011-04-23 01:30:07 +0000 | [diff] [blame^] | 1 | // |
| 2 | // Copyright (c) 2002-2011 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. |
| 5 | // |
| 6 | |
| 7 | #include "compiler/MapLongVariableNames.h" |
| 8 | |
| 9 | namespace { |
| 10 | |
| 11 | TString mapLongName(int id, const TString& name) |
| 12 | { |
| 13 | ASSERT(name.size() > MAX_IDENTIFIER_NAME_SIZE); |
| 14 | TStringStream stream; |
| 15 | stream << "webgl_" << id << "_"; |
| 16 | stream << name.substr(0, MAX_IDENTIFIER_NAME_SIZE - stream.str().size()); |
| 17 | return stream.str(); |
| 18 | } |
| 19 | |
| 20 | } // anonymous namespace |
| 21 | |
| 22 | void MapLongVariableNames::visitSymbol(TIntermSymbol* symbol) |
| 23 | { |
| 24 | ASSERT(symbol != NULL); |
| 25 | if (symbol->getSymbol().size() > MAX_IDENTIFIER_NAME_SIZE) |
| 26 | symbol->setSymbol(mapLongName(symbol->getId(), symbol->getSymbol())); |
| 27 | } |
| 28 | |
| 29 | void MapLongVariableNames::visitConstantUnion(TIntermConstantUnion*) |
| 30 | { |
| 31 | } |
| 32 | |
| 33 | bool MapLongVariableNames::visitBinary(Visit, TIntermBinary*) |
| 34 | { |
| 35 | return true; |
| 36 | } |
| 37 | |
| 38 | bool MapLongVariableNames::visitUnary(Visit, TIntermUnary*) |
| 39 | { |
| 40 | return true; |
| 41 | } |
| 42 | |
| 43 | bool MapLongVariableNames::visitSelection(Visit, TIntermSelection*) |
| 44 | { |
| 45 | return true; |
| 46 | } |
| 47 | |
| 48 | bool MapLongVariableNames::visitAggregate(Visit, TIntermAggregate* node) |
| 49 | { |
| 50 | return true; |
| 51 | } |
| 52 | |
| 53 | bool MapLongVariableNames::visitLoop(Visit, TIntermLoop*) |
| 54 | { |
| 55 | return true; |
| 56 | } |
| 57 | |
| 58 | bool MapLongVariableNames::visitBranch(Visit, TIntermBranch*) |
| 59 | { |
| 60 | return true; |
| 61 | } |