mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 15:52:07 +00:00
Bug 748112 - WebGL Water demo broken by long identifier mapping - r=jgilbert
This commit is contained in:
parent
42d97b9780
commit
a41f9f50e8
@ -14,12 +14,18 @@ TString mapLongName(int id, const TString& name, bool isGlobal)
|
||||
ASSERT(name.size() > MAX_SHORTENED_IDENTIFIER_SIZE);
|
||||
TStringStream stream;
|
||||
uint64 hash = SpookyHash::Hash64(name.data(), name.length(), 0);
|
||||
stream << "webgl_"
|
||||
|
||||
// We want to avoid producing a string with a double underscore,
|
||||
// which would be an illegal GLSL identifier. We can assume that the
|
||||
// original identifier doesn't have a double underscore, otherwise
|
||||
// it's illegal anyway.
|
||||
stream << (name[0] == '_' ? "webgl" : "webgl_")
|
||||
<< name.substr(0, 9)
|
||||
<< "_"
|
||||
<< (name[8] == '_' ? "" : "_")
|
||||
<< std::hex
|
||||
<< hash;
|
||||
ASSERT(stream.str().length() == MAX_SHORTENED_IDENTIFIER_SIZE);
|
||||
ASSERT(stream.str().length() <= MAX_SHORTENED_IDENTIFIER_SIZE);
|
||||
ASSERT(stream.str().length() >= MAX_SHORTENED_IDENTIFIER_SIZE - 2);
|
||||
return stream.str();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user