1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/angle/angle-long-ident-hash.patch Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,137 @@ 1.4 +From: Jeff Gilbert <jgilbert@mozilla.com> 1.5 + 1.6 +diff --git a/gfx/angle/Makefile.in b/gfx/angle/Makefile.in 1.7 +--- a/gfx/angle/Makefile.in 1.8 ++++ b/gfx/angle/Makefile.in 1.9 +@@ -32,16 +32,17 @@ LOCAL_INCLUDES += \ 1.10 + -I$(srcdir)/src 1.11 + 1.12 + DEFINES += -DCOMPILER_IMPLEMENTATION 1.13 + 1.14 + VPATH += $(srcdir)/src/compiler 1.15 + VPATH += $(srcdir)/src/compiler/depgraph 1.16 + VPATH += $(srcdir)/src/compiler/timing 1.17 + VPATH += $(srcdir)/src/third_party/compiler 1.18 ++VPATH += $(srcdir)/src/third_party/murmurhash 1.19 + 1.20 + # Target: 'translator_glsl' 1.21 + # Requires: 'translator_common' 1.22 + # src/compiler: 1.23 + ifdef MOZ_ANGLE_RENDERER 1.24 + 1.25 + libs:: 1.26 + ifdef MOZ_D3DCOMPILER_CAB 1.27 +diff --git a/gfx/angle/moz.build b/gfx/angle/moz.build 1.28 +--- a/gfx/angle/moz.build 1.29 ++++ b/gfx/angle/moz.build 1.30 +@@ -83,16 +83,21 @@ CPP_SOURCES += [ 1.31 + 'RestrictVertexShaderTiming.cpp', 1.32 + ] 1.33 + 1.34 + # src/third_party/compiler: 1.35 + CPP_SOURCES += [ 1.36 + 'ArrayBoundsClamper.cpp', 1.37 + ] 1.38 + 1.39 ++# src/third_party/murmurhash: 1.40 ++CPP_SOURCES += [ 1.41 ++ 'MurmurHash3.cpp', 1.42 ++] 1.43 ++ 1.44 + if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows': 1.45 + CPP_SOURCES += [ 1.46 + 'ossource_win.cpp', 1.47 + ] 1.48 + else: 1.49 + CPP_SOURCES += [ 1.50 + 'ossource_posix.cpp', 1.51 + ] 1.52 +diff --git a/gfx/angle/src/compiler/MapLongVariableNames.cpp b/gfx/angle/src/compiler/MapLongVariableNames.cpp 1.53 +--- a/gfx/angle/src/compiler/MapLongVariableNames.cpp 1.54 ++++ b/gfx/angle/src/compiler/MapLongVariableNames.cpp 1.55 +@@ -1,29 +1,39 @@ 1.56 + // 1.57 + // Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved. 1.58 + // Use of this source code is governed by a BSD-style license that can be 1.59 + // found in the LICENSE file. 1.60 + // 1.61 + 1.62 + #include "compiler/MapLongVariableNames.h" 1.63 + 1.64 ++#include "third_party/murmurhash/MurmurHash3.h" 1.65 ++ 1.66 + namespace { 1.67 + 1.68 + TString mapLongName(size_t id, const TString& name, bool isGlobal) 1.69 + { 1.70 + ASSERT(name.size() > MAX_SHORTENED_IDENTIFIER_SIZE); 1.71 + TStringStream stream; 1.72 +- stream << "webgl_"; 1.73 +- if (isGlobal) 1.74 +- stream << "g"; 1.75 +- stream << id; 1.76 +- if (name[0] != '_') 1.77 +- stream << "_"; 1.78 +- stream << name.substr(0, MAX_SHORTENED_IDENTIFIER_SIZE - stream.str().size()); 1.79 ++ 1.80 ++ uint64_t hash[2] = {0, 0}; 1.81 ++ MurmurHash3_x64_128(name.data(), name.length(), 0, hash); 1.82 ++ 1.83 ++ // We want to avoid producing a string with a double underscore, 1.84 ++ // which would be an illegal GLSL identifier. We can assume that the 1.85 ++ // original identifier doesn't have a double underscore, otherwise 1.86 ++ // it's illegal anyway. 1.87 ++ stream << (name[0] == '_' ? "webgl" : "webgl_") 1.88 ++ << name.substr(0, 9) 1.89 ++ << (name[8] == '_' ? "" : "_") 1.90 ++ << std::hex 1.91 ++ << hash[0]; 1.92 ++ ASSERT(stream.str().length() <= MAX_SHORTENED_IDENTIFIER_SIZE); 1.93 ++ ASSERT(stream.str().length() >= MAX_SHORTENED_IDENTIFIER_SIZE - 2); 1.94 + return stream.str(); 1.95 + } 1.96 + 1.97 + LongNameMap* gLongNameMapInstance = NULL; 1.98 + 1.99 + } // anonymous namespace 1.100 + 1.101 + LongNameMap::LongNameMap() 1.102 +diff --git a/gfx/angle/src/libGLESv2/moz.build b/gfx/angle/src/libGLESv2/moz.build 1.103 +--- a/gfx/angle/src/libGLESv2/moz.build 1.104 ++++ b/gfx/angle/src/libGLESv2/moz.build 1.105 +@@ -71,16 +71,21 @@ CPP_SOURCES += [ 1.106 + 'RestrictVertexShaderTiming.cpp', 1.107 + ] 1.108 + 1.109 + # src/third_party/compiler: 1.110 + CPP_SOURCES += [ 1.111 + 'ArrayBoundsClamper.cpp', 1.112 + ] 1.113 + 1.114 ++# src/third_party/murmurhash: 1.115 ++CPP_SOURCES += [ 1.116 ++ 'MurmurHash3.cpp', 1.117 ++] 1.118 ++ 1.119 + if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows': 1.120 + CPP_SOURCES += [ 1.121 + 'ossource_win.cpp', 1.122 + ] 1.123 + else: 1.124 + CPP_SOURCES += [ 1.125 + 'ossource_posix.cpp', 1.126 + ] 1.127 +@@ -165,13 +170,8 @@ CPP_SOURCES += [ 1.128 + 'TextureStorage11.cpp', 1.129 + 'TextureStorage9.cpp', 1.130 + 'VertexBuffer.cpp', 1.131 + 'VertexBuffer9.cpp', 1.132 + 'VertexBuffer11.cpp', 1.133 + 'VertexDataManager.cpp', 1.134 + 'VertexDeclarationCache.cpp', 1.135 + ] 1.136 +- 1.137 +-# src/third_party/murmurhash: 1.138 +-CPP_SOURCES += [ 1.139 +- 'MurmurHash3.cpp', 1.140 +-]