Commit 51b4a07a by Zhenyao Mo

Remove SH_MAP_LONG_VARIABLE_NAMES

We use hashing to map all variables/strcuture field names, etc, so we no longer need this option. Checked with Firefox and WebKit, they no longer use this option either. Time to remove it. Change-Id: Ie3e79b91a05258b04af419a9c42b2fd1b00e67c4 Reviewed-on: https://chromium-review.googlesource.com/189236Reviewed-by: 's avatarKenneth Russell <kbr@chromium.org> Reviewed-by: 's avatarShannon Woods <shannonwoods@chromium.org> Tested-by: 's avatarZhenyao Mo <zmo@chromium.org>
parent 9d30ce3f
...@@ -140,16 +140,15 @@ typedef enum { ...@@ -140,16 +140,15 @@ typedef enum {
SH_VARIABLES = 0x0008, SH_VARIABLES = 0x0008,
SH_LINE_DIRECTIVES = 0x0010, SH_LINE_DIRECTIVES = 0x0010,
SH_SOURCE_PATH = 0x0020, SH_SOURCE_PATH = 0x0020,
SH_MAP_LONG_VARIABLE_NAMES = 0x0040, SH_UNROLL_FOR_LOOP_WITH_INTEGER_INDEX = 0x0040,
SH_UNROLL_FOR_LOOP_WITH_INTEGER_INDEX = 0x0080,
// If a sampler array index happens to be a loop index, // If a sampler array index happens to be a loop index,
// 1) if its type is integer, unroll the loop. // 1) if its type is integer, unroll the loop.
// 2) if its type is float, fail the shader compile. // 2) if its type is float, fail the shader compile.
// This is to work around a mac driver bug. // This is to work around a mac driver bug.
SH_UNROLL_FOR_LOOP_WITH_SAMPLER_ARRAY_INDEX = 0x0100, SH_UNROLL_FOR_LOOP_WITH_SAMPLER_ARRAY_INDEX = 0x0080,
// This is needed only as a workaround for certain OpenGL driver bugs. // This is needed only as a workaround for certain OpenGL driver bugs.
SH_EMULATE_BUILT_IN_FUNCTIONS = 0x0200, SH_EMULATE_BUILT_IN_FUNCTIONS = 0x0100,
// This is an experimental flag to enforce restrictions that aim to prevent // This is an experimental flag to enforce restrictions that aim to prevent
// timing attacks. // timing attacks.
...@@ -157,7 +156,7 @@ typedef enum { ...@@ -157,7 +156,7 @@ typedef enum {
// texture information via the timing channel. // texture information via the timing channel.
// To use this flag, you must compile the shader under the WebGL spec // To use this flag, you must compile the shader under the WebGL spec
// (using the SH_WEBGL_SPEC flag). // (using the SH_WEBGL_SPEC flag).
SH_TIMING_RESTRICTIONS = 0x0400, SH_TIMING_RESTRICTIONS = 0x0200,
// This flag prints the dependency graph that is used to enforce timing // This flag prints the dependency graph that is used to enforce timing
// restrictions on fragment shaders. // restrictions on fragment shaders.
...@@ -165,7 +164,7 @@ typedef enum { ...@@ -165,7 +164,7 @@ typedef enum {
// - The shader spec is SH_WEBGL_SPEC. // - The shader spec is SH_WEBGL_SPEC.
// - The compile options contain the SH_TIMING_RESTRICTIONS flag. // - The compile options contain the SH_TIMING_RESTRICTIONS flag.
// - The shader type is SH_FRAGMENT_SHADER. // - The shader type is SH_FRAGMENT_SHADER.
SH_DEPENDENCY_GRAPH = 0x0800, SH_DEPENDENCY_GRAPH = 0x0400,
// Enforce the GLSL 1.017 Appendix A section 7 packing restrictions. // Enforce the GLSL 1.017 Appendix A section 7 packing restrictions.
// This flag only enforces (and can only enforce) the packing // This flag only enforces (and can only enforce) the packing
...@@ -173,7 +172,7 @@ typedef enum { ...@@ -173,7 +172,7 @@ typedef enum {
// shaders. ShCheckVariablesWithinPackingLimits() lets embedders // shaders. ShCheckVariablesWithinPackingLimits() lets embedders
// enforce the packing restrictions for varying variables during // enforce the packing restrictions for varying variables during
// program link time. // program link time.
SH_ENFORCE_PACKING_RESTRICTIONS = 0x1000, SH_ENFORCE_PACKING_RESTRICTIONS = 0x0800,
// This flag ensures all indirect (expression-based) array indexing // This flag ensures all indirect (expression-based) array indexing
// is clamped to the bounds of the array. This ensures, for example, // is clamped to the bounds of the array. This ensures, for example,
...@@ -181,32 +180,32 @@ typedef enum { ...@@ -181,32 +180,32 @@ typedef enum {
// vec234, or mat234 type. The ShArrayIndexClampingStrategy enum, // vec234, or mat234 type. The ShArrayIndexClampingStrategy enum,
// specified in the ShBuiltInResources when constructing the // specified in the ShBuiltInResources when constructing the
// compiler, selects the strategy for the clamping implementation. // compiler, selects the strategy for the clamping implementation.
SH_CLAMP_INDIRECT_ARRAY_BOUNDS = 0x2000, SH_CLAMP_INDIRECT_ARRAY_BOUNDS = 0x1000,
// This flag limits the complexity of an expression. // This flag limits the complexity of an expression.
SH_LIMIT_EXPRESSION_COMPLEXITY = 0x4000, SH_LIMIT_EXPRESSION_COMPLEXITY = 0x2000,
// This flag limits the depth of the call stack. // This flag limits the depth of the call stack.
SH_LIMIT_CALL_STACK_DEPTH = 0x8000, SH_LIMIT_CALL_STACK_DEPTH = 0x4000,
// This flag initializes gl_Position to vec4(0,0,0,0) at the // This flag initializes gl_Position to vec4(0,0,0,0) at the
// beginning of the vertex shader's main(), and has no effect in the // beginning of the vertex shader's main(), and has no effect in the
// fragment shader. It is intended as a workaround for drivers which // fragment shader. It is intended as a workaround for drivers which
// incorrectly fail to link programs if gl_Position is not written. // incorrectly fail to link programs if gl_Position is not written.
SH_INIT_GL_POSITION = 0x10000, SH_INIT_GL_POSITION = 0x8000,
// This flag replaces // This flag replaces
// "a && b" with "a ? b : false", // "a && b" with "a ? b : false",
// "a || b" with "a ? true : b". // "a || b" with "a ? true : b".
// This is to work around a MacOSX driver bug that |b| is executed // This is to work around a MacOSX driver bug that |b| is executed
// independent of |a|'s value. // independent of |a|'s value.
SH_UNFOLD_SHORT_CIRCUIT = 0x20000, SH_UNFOLD_SHORT_CIRCUIT = 0x10000,
// This flag initializes varyings without static use in vertex shader // This flag initializes varyings without static use in vertex shader
// at the beginning of main(), and has no effects in the fragment shader. // at the beginning of main(), and has no effects in the fragment shader.
// It is intended as a workaround for drivers which incorrectly optimize // It is intended as a workaround for drivers which incorrectly optimize
// out such varyings and cause a link failure. // out such varyings and cause a link failure.
SH_INIT_VARYINGS_WITHOUT_STATIC_USE = 0x40000, SH_INIT_VARYINGS_WITHOUT_STATIC_USE = 0x20000,
} ShCompileOptions; } ShCompileOptions;
// Defines alternate strategies for implementing array index clamping. // Defines alternate strategies for implementing array index clamping.
......
...@@ -81,7 +81,6 @@ int main(int argc, char* argv[]) ...@@ -81,7 +81,6 @@ int main(int argc, char* argv[])
if (argv[0][0] == '-') { if (argv[0][0] == '-') {
switch (argv[0][1]) { switch (argv[0][1]) {
case 'i': compileOptions |= SH_INTERMEDIATE_TREE; break; case 'i': compileOptions |= SH_INTERMEDIATE_TREE; break;
case 'm': compileOptions |= SH_MAP_LONG_VARIABLE_NAMES; break;
case 'o': compileOptions |= SH_OBJECT_CODE; break; case 'o': compileOptions |= SH_OBJECT_CODE; break;
case 'u': compileOptions |= SH_VARIABLES; break; case 'u': compileOptions |= SH_VARIABLES; break;
case 'l': compileOptions |= SH_UNROLL_FOR_LOOP_WITH_INTEGER_INDEX; break; case 'l': compileOptions |= SH_UNROLL_FOR_LOOP_WITH_INTEGER_INDEX; break;
...@@ -174,12 +173,12 @@ int main(int argc, char* argv[]) ...@@ -174,12 +173,12 @@ int main(int argc, char* argv[])
} }
if (compiled && (compileOptions & SH_VARIABLES)) { if (compiled && (compileOptions & SH_VARIABLES)) {
LogMsg("BEGIN", "COMPILER", numCompiles, "ACTIVE ATTRIBS"); LogMsg("BEGIN", "COMPILER", numCompiles, "ACTIVE ATTRIBS");
PrintActiveVariables(compiler, SH_ACTIVE_ATTRIBUTES, (compileOptions & SH_MAP_LONG_VARIABLE_NAMES) != 0); PrintActiveVariables(compiler, SH_ACTIVE_ATTRIBUTES);
LogMsg("END", "COMPILER", numCompiles, "ACTIVE ATTRIBS"); LogMsg("END", "COMPILER", numCompiles, "ACTIVE ATTRIBS");
printf("\n\n"); printf("\n\n");
LogMsg("BEGIN", "COMPILER", numCompiles, "ACTIVE UNIFORMS"); LogMsg("BEGIN", "COMPILER", numCompiles, "ACTIVE UNIFORMS");
PrintActiveVariables(compiler, SH_ACTIVE_UNIFORMS, (compileOptions & SH_MAP_LONG_VARIABLE_NAMES) != 0); PrintActiveVariables(compiler, SH_ACTIVE_UNIFORMS);
LogMsg("END", "COMPILER", numCompiles, "ACTIVE UNIFORMS"); LogMsg("END", "COMPILER", numCompiles, "ACTIVE UNIFORMS");
printf("\n\n"); printf("\n\n");
} }
...@@ -280,7 +279,7 @@ void LogMsg(const char* msg, const char* name, const int num, const char* logNam ...@@ -280,7 +279,7 @@ void LogMsg(const char* msg, const char* name, const int num, const char* logNam
printf("#### %s %s %d %s ####\n", msg, name, num, logName); printf("#### %s %s %d %s ####\n", msg, name, num, logName);
} }
void PrintActiveVariables(ShHandle compiler, ShShaderInfo varType, bool mapLongVariableNames) void PrintActiveVariables(ShHandle compiler, ShShaderInfo varType)
{ {
size_t nameSize = 0; size_t nameSize = 0;
switch (varType) { switch (varType) {
...@@ -295,13 +294,6 @@ void PrintActiveVariables(ShHandle compiler, ShShaderInfo varType, bool mapLongV ...@@ -295,13 +294,6 @@ void PrintActiveVariables(ShHandle compiler, ShShaderInfo varType, bool mapLongV
if (nameSize <= 1) return; if (nameSize <= 1) return;
char* name = new char[nameSize]; char* name = new char[nameSize];
char* mappedName = NULL;
if (mapLongVariableNames) {
size_t mappedNameSize = 0;
ShGetInfo(compiler, SH_MAPPED_NAME_MAX_LENGTH, &mappedNameSize);
mappedName = new char[mappedNameSize];
}
size_t activeVars = 0; size_t activeVars = 0;
int size = 0; int size = 0;
ShDataType type = SH_NONE; ShDataType type = SH_NONE;
...@@ -312,10 +304,10 @@ void PrintActiveVariables(ShHandle compiler, ShShaderInfo varType, bool mapLongV ...@@ -312,10 +304,10 @@ void PrintActiveVariables(ShHandle compiler, ShShaderInfo varType, bool mapLongV
for (size_t i = 0; i < activeVars; ++i) { for (size_t i = 0; i < activeVars; ++i) {
switch (varType) { switch (varType) {
case SH_ACTIVE_ATTRIBUTES: case SH_ACTIVE_ATTRIBUTES:
ShGetVariableInfo(compiler, SH_ACTIVE_ATTRIBUTES, static_cast<int>(i), NULL, &size, &type, &precision, &staticUse, name, mappedName); ShGetVariableInfo(compiler, SH_ACTIVE_ATTRIBUTES, static_cast<int>(i), NULL, &size, &type, &precision, &staticUse, name, NULL);
break; break;
case SH_ACTIVE_UNIFORMS: case SH_ACTIVE_UNIFORMS:
ShGetVariableInfo(compiler, SH_ACTIVE_UNIFORMS, static_cast<int>(i), NULL, &size, &type, &precision, &staticUse, name, mappedName); ShGetVariableInfo(compiler, SH_ACTIVE_UNIFORMS, static_cast<int>(i), NULL, &size, &type, &precision, &staticUse, name, NULL);
break; break;
default: assert(0); default: assert(0);
} }
...@@ -340,14 +332,9 @@ void PrintActiveVariables(ShHandle compiler, ShShaderInfo varType, bool mapLongV ...@@ -340,14 +332,9 @@ void PrintActiveVariables(ShHandle compiler, ShShaderInfo varType, bool mapLongV
case SH_SAMPLER_EXTERNAL_OES: typeName = "GL_SAMPLER_EXTERNAL_OES"; break; case SH_SAMPLER_EXTERNAL_OES: typeName = "GL_SAMPLER_EXTERNAL_OES"; break;
default: assert(0); default: assert(0);
} }
printf("%lu: name:%s type:%s size:%d", i, name, typeName, size); printf("%lu: name:%s type:%s size:%d\n", i, name, typeName, size);
if (mapLongVariableNames)
printf(" mapped name:%s", mappedName);
printf("\n");
} }
delete [] name; delete [] name;
if (mappedName)
delete [] mappedName;
} }
static bool ReadShaderSource(const char* fileName, ShaderSource& source) { static bool ReadShaderSource(const char* fileName, ShaderSource& source) {
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
#include "compiler/translator/Initialize.h" #include "compiler/translator/Initialize.h"
#include "compiler/translator/InitializeParseContext.h" #include "compiler/translator/InitializeParseContext.h"
#include "compiler/translator/InitializeVariables.h" #include "compiler/translator/InitializeVariables.h"
#include "compiler/translator/MapLongVariableNames.h"
#include "compiler/translator/ParseContext.h" #include "compiler/translator/ParseContext.h"
#include "compiler/translator/RenameFunction.h" #include "compiler/translator/RenameFunction.h"
#include "compiler/translator/ShHandle.h" #include "compiler/translator/ShHandle.h"
...@@ -88,13 +87,10 @@ TCompiler::TCompiler(ShShaderType type, ShShaderSpec spec) ...@@ -88,13 +87,10 @@ TCompiler::TCompiler(ShShaderType type, ShShaderSpec spec)
clampingStrategy(SH_CLAMP_WITH_CLAMP_INTRINSIC), clampingStrategy(SH_CLAMP_WITH_CLAMP_INTRINSIC),
builtInFunctionEmulator(type) builtInFunctionEmulator(type)
{ {
longNameMap = LongNameMap::GetInstance();
} }
TCompiler::~TCompiler() TCompiler::~TCompiler()
{ {
ASSERT(longNameMap);
longNameMap->Release();
} }
bool TCompiler::Init(const ShBuiltInResources& resources) bool TCompiler::Init(const ShBuiltInResources& resources)
...@@ -178,13 +174,13 @@ bool TCompiler::compile(const char* const shaderStrings[], ...@@ -178,13 +174,13 @@ bool TCompiler::compile(const char* const shaderStrings[],
// Unroll for-loop markup needs to happen after validateLimitations pass. // Unroll for-loop markup needs to happen after validateLimitations pass.
if (success && (compileOptions & SH_UNROLL_FOR_LOOP_WITH_INTEGER_INDEX)) if (success && (compileOptions & SH_UNROLL_FOR_LOOP_WITH_INTEGER_INDEX))
{ {
ForLoopUnrollMarker marker(ForLoopUnrollMarker::kIntegerIndex); ForLoopUnrollMarker marker(ForLoopUnrollMarker::kIntegerIndex);
root->traverse(&marker); root->traverse(&marker);
} }
if (success && (compileOptions & SH_UNROLL_FOR_LOOP_WITH_SAMPLER_ARRAY_INDEX)) if (success && (compileOptions & SH_UNROLL_FOR_LOOP_WITH_SAMPLER_ARRAY_INDEX))
{ {
ForLoopUnrollMarker marker(ForLoopUnrollMarker::kSamplerArrayIndex); ForLoopUnrollMarker marker(ForLoopUnrollMarker::kSamplerArrayIndex);
root->traverse(&marker); root->traverse(&marker);
if (marker.samplerArrayIndexIsFloatLoopIndex()) if (marker.samplerArrayIndexIsFloatLoopIndex())
{ {
...@@ -206,13 +202,6 @@ bool TCompiler::compile(const char* const shaderStrings[], ...@@ -206,13 +202,6 @@ bool TCompiler::compile(const char* const shaderStrings[],
if (success && (compileOptions & SH_LIMIT_EXPRESSION_COMPLEXITY)) if (success && (compileOptions & SH_LIMIT_EXPRESSION_COMPLEXITY))
success = limitExpressionComplexity(root); success = limitExpressionComplexity(root);
// Call mapLongVariableNames() before collectAttribsUniforms() so in
// collectAttribsUniforms() we already have the mapped symbol names and
// we could composite mapped and original variable names.
// Also, if we hash all the names, then no need to do this for long names.
if (success && (compileOptions & SH_MAP_LONG_VARIABLE_NAMES) && hashFunction == NULL)
mapLongVariableNames(root);
if (success && shaderType == SH_VERTEX_SHADER && (compileOptions & SH_INIT_GL_POSITION)) if (success && shaderType == SH_VERTEX_SHADER && (compileOptions & SH_INIT_GL_POSITION))
initializeGLPosition(root); initializeGLPosition(root);
...@@ -503,18 +492,6 @@ void TCompiler::initializeVaryingsWithoutStaticUse(TIntermNode* root) ...@@ -503,18 +492,6 @@ void TCompiler::initializeVaryingsWithoutStaticUse(TIntermNode* root)
root->traverse(&initializer); root->traverse(&initializer);
} }
void TCompiler::mapLongVariableNames(TIntermNode* root)
{
ASSERT(longNameMap);
MapLongVariableNames map(longNameMap);
root->traverse(&map);
}
int TCompiler::getMappedNameMaxLength() const
{
return MAX_SHORTENED_IDENTIFIER_SIZE + 1;
}
const TExtensionBehavior& TCompiler::getExtensionBehavior() const const TExtensionBehavior& TCompiler::getExtensionBehavior() const
{ {
return extensionBehavior; return extensionBehavior;
......
//
// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
#include "compiler/translator/MapLongVariableNames.h"
namespace {
TString mapLongName(size_t id, const TString& name, bool isGlobal)
{
ASSERT(name.size() > MAX_SHORTENED_IDENTIFIER_SIZE);
TStringStream stream;
stream << "webgl_";
if (isGlobal)
stream << "g";
stream << id;
if (name[0] != '_')
stream << "_";
stream << name.substr(0, MAX_SHORTENED_IDENTIFIER_SIZE - stream.str().size());
return stream.str();
}
LongNameMap* gLongNameMapInstance = NULL;
} // anonymous namespace
LongNameMap::LongNameMap()
: refCount(0)
{
}
LongNameMap::~LongNameMap()
{
}
// static
LongNameMap* LongNameMap::GetInstance()
{
if (gLongNameMapInstance == NULL)
gLongNameMapInstance = new LongNameMap;
gLongNameMapInstance->refCount++;
return gLongNameMapInstance;
}
void LongNameMap::Release()
{
ASSERT(gLongNameMapInstance == this);
ASSERT(refCount > 0);
refCount--;
if (refCount == 0) {
delete gLongNameMapInstance;
gLongNameMapInstance = NULL;
}
}
const char* LongNameMap::Find(const char* originalName) const
{
std::map<std::string, std::string>::const_iterator it = mLongNameMap.find(
originalName);
if (it != mLongNameMap.end())
return (*it).second.c_str();
return NULL;
}
void LongNameMap::Insert(const char* originalName, const char* mappedName)
{
mLongNameMap.insert(std::map<std::string, std::string>::value_type(
originalName, mappedName));
}
size_t LongNameMap::Size() const
{
return mLongNameMap.size();
}
MapLongVariableNames::MapLongVariableNames(LongNameMap* globalMap)
{
ASSERT(globalMap);
mGlobalMap = globalMap;
}
void MapLongVariableNames::visitSymbol(TIntermSymbol* symbol)
{
ASSERT(symbol != NULL);
if (symbol->getSymbol().size() > MAX_SHORTENED_IDENTIFIER_SIZE) {
switch (symbol->getQualifier()) {
case EvqVaryingIn:
case EvqVaryingOut:
case EvqInvariantVaryingIn:
case EvqInvariantVaryingOut:
case EvqUniform:
symbol->setSymbol(
mapGlobalLongName(symbol->getSymbol()));
break;
default:
symbol->setSymbol(
mapLongName(symbol->getId(), symbol->getSymbol(), false));
break;
};
}
}
TString MapLongVariableNames::mapGlobalLongName(const TString& name)
{
ASSERT(mGlobalMap);
const char* mappedName = mGlobalMap->Find(name.c_str());
if (mappedName != NULL)
return mappedName;
size_t id = mGlobalMap->Size();
TString rt = mapLongName(id, name, true);
mGlobalMap->Insert(name.c_str(), rt.c_str());
return rt;
}
//
// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
#ifndef COMPILER_MAP_LONG_VARIABLE_NAMES_H_
#define COMPILER_MAP_LONG_VARIABLE_NAMES_H_
#include "GLSLANG/ShaderLang.h"
#include "compiler/translator/intermediate.h"
#include "compiler/translator/VariableInfo.h"
// This size does not include '\0' in the end.
#define MAX_SHORTENED_IDENTIFIER_SIZE 32
// This is a ref-counted singleton. GetInstance() returns a pointer to the
// singleton, and after use, call Release(). GetInstance() and Release() should
// be paired.
class LongNameMap {
public:
static LongNameMap* GetInstance();
void Release();
// Return the mapped name if <originalName, mappedName> is in the map;
// otherwise, return NULL.
const char* Find(const char* originalName) const;
// Insert a pair into the map.
void Insert(const char* originalName, const char* mappedName);
// Return the number of entries in the map.
size_t Size() const;
private:
LongNameMap();
~LongNameMap();
size_t refCount;
std::map<std::string, std::string> mLongNameMap;
};
// Traverses intermediate tree to map attributes and uniforms names that are
// longer than MAX_SHORTENED_IDENTIFIER_SIZE to MAX_SHORTENED_IDENTIFIER_SIZE.
class MapLongVariableNames : public TIntermTraverser {
public:
MapLongVariableNames(LongNameMap* globalMap);
virtual void visitSymbol(TIntermSymbol*);
private:
TString mapGlobalLongName(const TString& name);
LongNameMap* mGlobalMap;
};
#endif // COMPILER_MAP_LONG_VARIABLE_NAMES_H_
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
#include "compiler/translator/VariableInfo.h" #include "compiler/translator/VariableInfo.h"
#include "third_party/compiler/ArrayBoundsClamper.h" #include "third_party/compiler/ArrayBoundsClamper.h"
class LongNameMap;
class TCompiler; class TCompiler;
class TDependencyGraph; class TDependencyGraph;
class TranslatorHLSL; class TranslatorHLSL;
...@@ -71,7 +70,6 @@ public: ...@@ -71,7 +70,6 @@ public:
const TVariableInfoList& getAttribs() const { return attribs; } const TVariableInfoList& getAttribs() const { return attribs; }
const TVariableInfoList& getUniforms() const { return uniforms; } const TVariableInfoList& getUniforms() const { return uniforms; }
const TVariableInfoList& getVaryings() const { return varyings; } const TVariableInfoList& getVaryings() const { return varyings; }
int getMappedNameMaxLength() const;
ShHashFunction64 getHashFunction() const { return hashFunction; } ShHashFunction64 getHashFunction() const { return hashFunction; }
NameMap& getNameMap() { return nameMap; } NameMap& getNameMap() { return nameMap; }
...@@ -93,8 +91,6 @@ protected: ...@@ -93,8 +91,6 @@ protected:
bool validateLimitations(TIntermNode* root); bool validateLimitations(TIntermNode* root);
// Collect info for all attribs, uniforms, varyings. // Collect info for all attribs, uniforms, varyings.
void collectVariables(TIntermNode* root); void collectVariables(TIntermNode* root);
// Map long variable names into shorter ones.
void mapLongVariableNames(TIntermNode* root);
// Translate to object code. // Translate to object code.
virtual void translate(TIntermNode* root) = 0; virtual void translate(TIntermNode* root) = 0;
// Returns true if, after applying the packing rules in the GLSL 1.017 spec // Returns true if, after applying the packing rules in the GLSL 1.017 spec
...@@ -155,9 +151,6 @@ private: ...@@ -155,9 +151,6 @@ private:
TVariableInfoList uniforms; // Active uniforms in the compiled shader. TVariableInfoList uniforms; // Active uniforms in the compiled shader.
TVariableInfoList varyings; // Varyings in the compiled shader. TVariableInfoList varyings; // Varyings in the compiled shader.
// Cached copy of the ref-counted singleton.
LongNameMap* longNameMap;
// name hashing. // name hashing.
ShHashFunction64 hashFunction; ShHashFunction64 hashFunction;
NameMap nameMap; NameMap nameMap;
......
...@@ -293,9 +293,9 @@ bool CollectVariables::visitAggregate(Visit, TIntermAggregate* node) ...@@ -293,9 +293,9 @@ bool CollectVariables::visitAggregate(Visit, TIntermAggregate* node)
if (mHashFunction == NULL) if (mHashFunction == NULL)
processedSymbol = variable->getSymbol(); processedSymbol = variable->getSymbol();
else else
processedSymbol = TIntermTraverser::hash(variable->getOriginalSymbol(), mHashFunction); processedSymbol = TIntermTraverser::hash(variable->getSymbol(), mHashFunction);
getVariableInfo(variable->getType(), getVariableInfo(variable->getType(),
variable->getOriginalSymbol(), variable->getSymbol(),
processedSymbol, processedSymbol,
infoList, infoList,
mHashFunction); mHashFunction);
......
...@@ -356,7 +356,7 @@ public: ...@@ -356,7 +356,7 @@ public:
// per process globalpoolallocator, then it causes increased memory usage per compile // per process globalpoolallocator, then it causes increased memory usage per compile
// it is essential to use "symbol = sym" to assign to symbol // it is essential to use "symbol = sym" to assign to symbol
TIntermSymbol(int i, const TString& sym, const TType& t) : TIntermSymbol(int i, const TString& sym, const TType& t) :
TIntermTyped(t), id(i) { symbol = sym; originalSymbol = sym; } TIntermTyped(t), id(i) { symbol = sym; }
virtual bool hasSideEffects() const { return false; } virtual bool hasSideEffects() const { return false; }
...@@ -364,9 +364,6 @@ public: ...@@ -364,9 +364,6 @@ public:
const TString& getSymbol() const { return symbol; } const TString& getSymbol() const { return symbol; }
void setId(int newId) { id = newId; } void setId(int newId) { id = newId; }
void setSymbol(const TString& sym) { symbol = sym; }
const TString& getOriginalSymbol() const { return originalSymbol; }
virtual void traverse(TIntermTraverser*); virtual void traverse(TIntermTraverser*);
virtual TIntermSymbol* getAsSymbolNode() { return this; } virtual TIntermSymbol* getAsSymbolNode() { return this; }
...@@ -375,7 +372,6 @@ public: ...@@ -375,7 +372,6 @@ public:
protected: protected:
int id; int id;
TString symbol; TString symbol;
TString originalSymbol;
}; };
// A Raw node stores raw code, that the translator will insert verbatim // A Raw node stores raw code, that the translator will insert verbatim
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment