Long name mapping needs to be consistent between vertex/fragment shaders.
For example: varying variables, uniforms.
This CL makes MapLongVariableNames a ref-counted singleton and therefore, the map is shared by all shaders.
Also, function/variable names changes from Varying to Global because uniforms also need to be consistent, not just varying variables.
ANGLEBUG=279
TEST=webgl conformance tests, especially invalid-passed-params.html and glsl-long-variable-names.html
Review URL: http://codereview.appspot.com/5539046
git-svn-id: https://angleproject.googlecode.com/svn/trunk@942 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/compiler/Compiler.cpp b/src/compiler/Compiler.cpp
index 22764bd..3a50319 100644
--- a/src/compiler/Compiler.cpp
+++ b/src/compiler/Compiler.cpp
@@ -1,5 +1,5 @@
//
-// Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved.
+// 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.
//
@@ -89,12 +89,15 @@
TCompiler::TCompiler(ShShaderType type, ShShaderSpec spec)
: shaderType(type),
shaderSpec(spec),
- builtInFunctionEmulator(type)
+ builtInFunctionEmulator(type),
+ longNameMapper(NULL)
{
}
TCompiler::~TCompiler()
{
+ if (longNameMapper)
+ longNameMapper->Release();
}
bool TCompiler::Init(const ShBuiltInResources& resources)
@@ -246,8 +249,9 @@
void TCompiler::mapLongVariableNames(TIntermNode* root)
{
- MapLongVariableNames map(varyingLongNameMap);
- root->traverse(&map);
+ if (longNameMapper == NULL)
+ longNameMapper = MapLongVariableNames::GetInstance();
+ root->traverse(longNameMapper);
}
int TCompiler::getMappedNameMaxLength() const