michael@0: From: Jeff Gilbert michael@0: michael@0: diff --git a/gfx/angle/Makefile.in b/gfx/angle/Makefile.in michael@0: --- a/gfx/angle/Makefile.in michael@0: +++ b/gfx/angle/Makefile.in michael@0: @@ -32,16 +32,17 @@ LOCAL_INCLUDES += \ michael@0: -I$(srcdir)/src michael@0: michael@0: DEFINES += -DCOMPILER_IMPLEMENTATION michael@0: michael@0: VPATH += $(srcdir)/src/compiler michael@0: VPATH += $(srcdir)/src/compiler/depgraph michael@0: VPATH += $(srcdir)/src/compiler/timing michael@0: VPATH += $(srcdir)/src/third_party/compiler michael@0: +VPATH += $(srcdir)/src/third_party/murmurhash michael@0: michael@0: # Target: 'translator_glsl' michael@0: # Requires: 'translator_common' michael@0: # src/compiler: michael@0: ifdef MOZ_ANGLE_RENDERER michael@0: michael@0: libs:: michael@0: ifdef MOZ_D3DCOMPILER_CAB michael@0: diff --git a/gfx/angle/moz.build b/gfx/angle/moz.build michael@0: --- a/gfx/angle/moz.build michael@0: +++ b/gfx/angle/moz.build michael@0: @@ -83,16 +83,21 @@ CPP_SOURCES += [ michael@0: 'RestrictVertexShaderTiming.cpp', michael@0: ] michael@0: michael@0: # src/third_party/compiler: michael@0: CPP_SOURCES += [ michael@0: 'ArrayBoundsClamper.cpp', michael@0: ] michael@0: michael@0: +# src/third_party/murmurhash: michael@0: +CPP_SOURCES += [ michael@0: + 'MurmurHash3.cpp', michael@0: +] michael@0: + michael@0: if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows': michael@0: CPP_SOURCES += [ michael@0: 'ossource_win.cpp', michael@0: ] michael@0: else: michael@0: CPP_SOURCES += [ michael@0: 'ossource_posix.cpp', michael@0: ] michael@0: diff --git a/gfx/angle/src/compiler/MapLongVariableNames.cpp b/gfx/angle/src/compiler/MapLongVariableNames.cpp michael@0: --- a/gfx/angle/src/compiler/MapLongVariableNames.cpp michael@0: +++ b/gfx/angle/src/compiler/MapLongVariableNames.cpp michael@0: @@ -1,29 +1,39 @@ michael@0: // michael@0: // Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved. michael@0: // Use of this source code is governed by a BSD-style license that can be michael@0: // found in the LICENSE file. michael@0: // michael@0: michael@0: #include "compiler/MapLongVariableNames.h" michael@0: michael@0: +#include "third_party/murmurhash/MurmurHash3.h" michael@0: + michael@0: namespace { michael@0: michael@0: TString mapLongName(size_t id, const TString& name, bool isGlobal) michael@0: { michael@0: ASSERT(name.size() > MAX_SHORTENED_IDENTIFIER_SIZE); michael@0: TStringStream stream; michael@0: - stream << "webgl_"; michael@0: - if (isGlobal) michael@0: - stream << "g"; michael@0: - stream << id; michael@0: - if (name[0] != '_') michael@0: - stream << "_"; michael@0: - stream << name.substr(0, MAX_SHORTENED_IDENTIFIER_SIZE - stream.str().size()); michael@0: + michael@0: + uint64_t hash[2] = {0, 0}; michael@0: + MurmurHash3_x64_128(name.data(), name.length(), 0, hash); michael@0: + michael@0: + // We want to avoid producing a string with a double underscore, michael@0: + // which would be an illegal GLSL identifier. We can assume that the michael@0: + // original identifier doesn't have a double underscore, otherwise michael@0: + // it's illegal anyway. michael@0: + stream << (name[0] == '_' ? "webgl" : "webgl_") michael@0: + << name.substr(0, 9) michael@0: + << (name[8] == '_' ? "" : "_") michael@0: + << std::hex michael@0: + << hash[0]; michael@0: + ASSERT(stream.str().length() <= MAX_SHORTENED_IDENTIFIER_SIZE); michael@0: + ASSERT(stream.str().length() >= MAX_SHORTENED_IDENTIFIER_SIZE - 2); michael@0: return stream.str(); michael@0: } michael@0: michael@0: LongNameMap* gLongNameMapInstance = NULL; michael@0: michael@0: } // anonymous namespace michael@0: michael@0: LongNameMap::LongNameMap() michael@0: diff --git a/gfx/angle/src/libGLESv2/moz.build b/gfx/angle/src/libGLESv2/moz.build michael@0: --- a/gfx/angle/src/libGLESv2/moz.build michael@0: +++ b/gfx/angle/src/libGLESv2/moz.build michael@0: @@ -71,16 +71,21 @@ CPP_SOURCES += [ michael@0: 'RestrictVertexShaderTiming.cpp', michael@0: ] michael@0: michael@0: # src/third_party/compiler: michael@0: CPP_SOURCES += [ michael@0: 'ArrayBoundsClamper.cpp', michael@0: ] michael@0: michael@0: +# src/third_party/murmurhash: michael@0: +CPP_SOURCES += [ michael@0: + 'MurmurHash3.cpp', michael@0: +] michael@0: + michael@0: if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows': michael@0: CPP_SOURCES += [ michael@0: 'ossource_win.cpp', michael@0: ] michael@0: else: michael@0: CPP_SOURCES += [ michael@0: 'ossource_posix.cpp', michael@0: ] michael@0: @@ -165,13 +170,8 @@ CPP_SOURCES += [ michael@0: 'TextureStorage11.cpp', michael@0: 'TextureStorage9.cpp', michael@0: 'VertexBuffer.cpp', michael@0: 'VertexBuffer9.cpp', michael@0: 'VertexBuffer11.cpp', michael@0: 'VertexDataManager.cpp', michael@0: 'VertexDeclarationCache.cpp', michael@0: ] michael@0: - michael@0: -# src/third_party/murmurhash: michael@0: -CPP_SOURCES += [ michael@0: - 'MurmurHash3.cpp', michael@0: -]