Diff
Modified: trunk/Source/ThirdParty/ANGLE/ChangeLog (203937 => 203938)
--- trunk/Source/ThirdParty/ANGLE/ChangeLog 2016-07-30 02:02:48 UTC (rev 203937)
+++ trunk/Source/ThirdParty/ANGLE/ChangeLog 2016-07-30 03:22:19 UTC (rev 203938)
@@ -1,3 +1,46 @@
+2016-07-29 David Kilzer <ddkil...@apple.com>
+
+ ANGLE: Fix global constructors and exit-time destructors
+ <https://webkit.org/b/160332>
+
+ Reviewed by Darin Adler.
+
+ * Configurations/Base.xcconfig:
+ - Add warning flags.
+
+ * src/common/angleutils.cpp:
+ (FormatString):
+ * src/common/angleutils.h:
+ (MakeStaticString):
+ * src/common/debug.cpp:
+ * src/common/mathutil.cpp:
+ (gl::g_sharedexp_max):
+ (gl::convertRGBFloatsTo999E5):
+ * src/compiler/translator/ShaderLang.cpp:
+ (ShGetUniformRegisterMap):
+ * src/libANGLE/Caps.cpp:
+ (gl::TextureCapsMap::get):
+ * src/libANGLE/Device.cpp:
+ (egl::GetDeviceSet):
+ * src/libANGLE/Display.cpp:
+ (egl::Display::getClientExtensionString):
+ * src/libANGLE/formatutils.cpp:
+ (gl::BuildFormatMap):
+ (gl::BuildInternalFormatInfoMap):
+ (gl::GetInternalFormatMap):
+ (gl::BuildAllSizedInternalFormatSet):
+ (gl::GetSizedInternalFormat):
+ (gl::GetAllSizedInternalFormats):
+ * src/libANGLE/validationES3.cpp:
+ (gl::BuildES3FormatSet):
+ (gl::ValidateTexImageFormatCombination):
+ (gl::BuildSizedEffectiveInternalFormatList):
+ (gl::BuildUnsizedEffectiveInternalFormatList):
+ (gl::GetEffectiveInternalFormat):
+ (gl::BuildValidES3CopyTexImageCombinations):
+ (gl::IsValidES3CopyTexImageCombination):
+ - Fix global constructors and exit-time destructors.
+
2016-07-13 Enrica Casucci <enr...@apple.com>
Update supported platforms in xcconfig files to match the sdk names.
Modified: trunk/Source/ThirdParty/ANGLE/Configurations/Base.xcconfig (203937 => 203938)
--- trunk/Source/ThirdParty/ANGLE/Configurations/Base.xcconfig 2016-07-30 02:02:48 UTC (rev 203937)
+++ trunk/Source/ThirdParty/ANGLE/Configurations/Base.xcconfig 2016-07-30 03:22:19 UTC (rev 203938)
@@ -42,6 +42,7 @@
GCC_WARN_UNUSED_VARIABLE = YES;
PREBINDING = NO;
STRIP_INSTALLED_PRODUCT = NO;
+WARNING_CFLAGS = -Wexit-time-destructors -Wglobal-constructors;
SUPPORTED_PLATFORMS = iphoneos iphonesimulator macosx appletvos appletvsimulator watchos watchsimulator;
Modified: trunk/Source/ThirdParty/ANGLE/src/common/angleutils.cpp (203937 => 203938)
--- trunk/Source/ThirdParty/ANGLE/src/common/angleutils.cpp 2016-07-30 02:02:48 UTC (rev 203937)
+++ trunk/Source/ThirdParty/ANGLE/src/common/angleutils.cpp 2016-07-30 03:22:19 UTC (rev 203938)
@@ -36,7 +36,7 @@
std::string FormatString(const char *fmt, va_list vararg)
{
- static std::vector<char> buffer(512);
+ static auto& buffer = *new std::vector<char>(512);
size_t len = FormatStringIntoVector(fmt, vararg, buffer);
return std::string(&buffer[0], len);
Modified: trunk/Source/ThirdParty/ANGLE/src/common/angleutils.h (203937 => 203938)
--- trunk/Source/ThirdParty/ANGLE/src/common/angleutils.h 2016-07-30 02:02:48 UTC (rev 203937)
+++ trunk/Source/ThirdParty/ANGLE/src/common/angleutils.h 2016-07-30 03:22:19 UTC (rev 203938)
@@ -116,7 +116,7 @@
inline const char* MakeStaticString(const std::string &str)
{
- static std::set<std::string> strings;
+ static auto& strings = *new std::set<std::string>;
std::set<std::string>::iterator it = strings.find(str);
if (it != strings.end())
{
Modified: trunk/Source/ThirdParty/ANGLE/src/common/debug.cpp (203937 => 203938)
--- trunk/Source/ThirdParty/ANGLE/src/common/debug.cpp 2016-07-30 02:02:48 UTC (rev 203937)
+++ trunk/Source/ThirdParty/ANGLE/src/common/debug.cpp 2016-07-30 03:22:19 UTC (rev 203938)
@@ -34,7 +34,7 @@
{
if (DebugAnnotationsActive())
{
- static std::vector<char> buffer(512);
+ static auto& buffer = *new std::vector<char>(512);
size_t len = FormatStringIntoVector(format, vararg, buffer);
std::wstring formattedWideMessage(buffer.begin(), buffer.begin() + len);
Modified: trunk/Source/ThirdParty/ANGLE/src/common/mathutil.cpp (203937 => 203938)
--- trunk/Source/ThirdParty/ANGLE/src/common/mathutil.cpp 2016-07-30 02:02:48 UTC (rev 203937)
+++ trunk/Source/ThirdParty/ANGLE/src/common/mathutil.cpp 2016-07-30 03:22:19 UTC (rev 203938)
@@ -31,15 +31,19 @@
// Emax is the maximum allowed biased exponent value (31)
static const int g_sharedexp_maxexponent = 31;
-static const float g_sharedexp_max = ((pow(2.0f, g_sharedexp_mantissabits) - 1) /
- pow(2.0f, g_sharedexp_mantissabits)) *
- pow(2.0f, g_sharedexp_maxexponent - g_sharedexp_bias);
+static float g_sharedexp_max()
+{
+ static float sharedexp_max = ((powf(2.0f, g_sharedexp_mantissabits) - 1) /
+ powf(2.0f, g_sharedexp_mantissabits)) *
+ powf(2.0f, g_sharedexp_maxexponent - g_sharedexp_bias);
+ return sharedexp_max;
+}
unsigned int convertRGBFloatsTo999E5(float red, float green, float blue)
{
- const float red_c = std::max<float>(0, std::min(g_sharedexp_max, red));
- const float green_c = std::max<float>(0, std::min(g_sharedexp_max, green));
- const float blue_c = std::max<float>(0, std::min(g_sharedexp_max, blue));
+ const float red_c = std::max<float>(0, std::min(g_sharedexp_max(), red));
+ const float green_c = std::max<float>(0, std::min(g_sharedexp_max(), green));
+ const float blue_c = std::max<float>(0, std::min(g_sharedexp_max(), blue));
const float max_c = std::max<float>(std::max<float>(red_c, green_c), blue_c);
const float exp_p = std::max<float>(-g_sharedexp_bias - 1, floor(log(max_c))) + 1 + g_sharedexp_bias;
Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ShaderLang.cpp (203937 => 203938)
--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ShaderLang.cpp 2016-07-30 02:02:48 UTC (rev 203937)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ShaderLang.cpp 2016-07-30 03:22:19 UTC (rev 203938)
@@ -371,7 +371,7 @@
return translator->getUniformRegisterMap();
#else
- static std::map<std::string, unsigned int> map;
+ static auto& map = *new std::map<std::string, unsigned int>;
return ↦
#endif // ANGLE_ENABLE_HLSL
}
Modified: trunk/Source/ThirdParty/ANGLE/src/libANGLE/Caps.cpp (203937 => 203938)
--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/Caps.cpp 2016-07-30 02:02:48 UTC (rev 203937)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/Caps.cpp 2016-07-30 03:22:19 UTC (rev 203938)
@@ -72,7 +72,7 @@
const TextureCaps &TextureCapsMap::get(GLenum internalFormat) const
{
- static TextureCaps defaultUnsupportedTexture;
+ static auto& defaultUnsupportedTexture = *new TextureCaps;
InternalFormatToCapsMap::const_iterator iter = mCapsMap.find(internalFormat);
return (iter != mCapsMap.end()) ? iter->second : defaultUnsupportedTexture;
}
Modified: trunk/Source/ThirdParty/ANGLE/src/libANGLE/Device.cpp (203937 => 203938)
--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/Device.cpp 2016-07-30 02:02:48 UTC (rev 203937)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/Device.cpp 2016-07-30 03:22:19 UTC (rev 203938)
@@ -38,7 +38,7 @@
typedef std::set<egl::Device *> DeviceSet;
static DeviceSet *GetDeviceSet()
{
- static DeviceSet devices;
+ static auto& devices = *new DeviceSet;
return &devices;
}
Modified: trunk/Source/ThirdParty/ANGLE/src/libANGLE/Display.cpp (203937 => 203938)
--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/Display.cpp 2016-07-30 02:02:48 UTC (rev 203937)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/Display.cpp 2016-07-30 03:22:19 UTC (rev 203938)
@@ -82,7 +82,7 @@
// associated with it.
static WindowSurfaceMap *GetWindowSurfaces()
{
- static WindowSurfaceMap windowSurfaces;
+ static auto& windowSurfaces = *new WindowSurfaceMap;
return &windowSurfaces;
}
@@ -89,7 +89,7 @@
typedef std::map<EGLNativeDisplayType, Display *> ANGLEPlatformDisplayMap;
static ANGLEPlatformDisplayMap *GetANGLEPlatformDisplayMap()
{
- static ANGLEPlatformDisplayMap displays;
+ static auto& displays = *new ANGLEPlatformDisplayMap;
return &displays;
}
@@ -96,7 +96,7 @@
typedef std::map<Device *, Display *> DevicePlatformDisplayMap;
static DevicePlatformDisplayMap *GetDevicePlatformDisplayMap()
{
- static DevicePlatformDisplayMap displays;
+ static auto& displays = *new DevicePlatformDisplayMap;
return &displays;
}
@@ -949,7 +949,7 @@
const std::string &Display::getClientExtensionString()
{
- static const std::string clientExtensionsString = GenerateExtensionsString(getClientExtensions());
+ static const auto& clientExtensionsString = *new std::string(GenerateExtensionsString(getClientExtensions()));
return clientExtensionsString;
}
Modified: trunk/Source/ThirdParty/ANGLE/src/libANGLE/formatutils.cpp (203937 => 203938)
--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/formatutils.cpp 2016-07-30 02:02:48 UTC (rev 203937)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/formatutils.cpp 2016-07-30 03:22:19 UTC (rev 203938)
@@ -29,9 +29,9 @@
map->insert(FormatPair(FormatTypePair(format, type), internalFormat));
}
-FormatMap BuildFormatMap()
+FormatMap& BuildFormatMap()
{
- FormatMap map;
+ auto& map = *new FormatMap;
// | Format | Type | Internal format |
InsertFormatMapping(&map, GL_RGBA, GL_UNSIGNED_BYTE, GL_RGBA8);
@@ -392,9 +392,9 @@
typedef std::pair<GLenum, InternalFormat> InternalFormatInfoPair;
typedef std::map<GLenum, InternalFormat> InternalFormatInfoMap;
-static InternalFormatInfoMap BuildInternalFormatInfoMap()
+static InternalFormatInfoMap& BuildInternalFormatInfoMap()
{
- InternalFormatInfoMap map;
+ auto& map = *new InternalFormatInfoMap;
// clang-format off
// From ES 3.0.1 spec, table 3.12
@@ -576,13 +576,13 @@
static const InternalFormatInfoMap &GetInternalFormatMap()
{
- static const InternalFormatInfoMap formatMap = BuildInternalFormatInfoMap();
+ static const InternalFormatInfoMap& formatMap = BuildInternalFormatInfoMap();
return formatMap;
}
-static FormatSet BuildAllSizedInternalFormatSet()
+static FormatSet& BuildAllSizedInternalFormatSet()
{
- FormatSet result;
+ auto& result = *new FormatSet;
const InternalFormatInfoMap &formats = GetInternalFormatMap();
for (InternalFormatInfoMap::const_iterator i = formats.begin(); i != formats.end(); i++)
@@ -742,7 +742,7 @@
}
else
{
- static const FormatMap formatMap = BuildFormatMap();
+ static const FormatMap& formatMap = BuildFormatMap();
FormatMap::const_iterator iter = formatMap.find(FormatTypePair(internalFormat, type));
if (iter != formatMap.end())
{
@@ -757,7 +757,7 @@
const FormatSet &GetAllSizedInternalFormats()
{
- static FormatSet formatSet = BuildAllSizedInternalFormatSet();
+ static FormatSet& formatSet = BuildAllSizedInternalFormatSet();
return formatSet;
}
Modified: trunk/Source/ThirdParty/ANGLE/src/libANGLE/validationES3.cpp (203937 => 203938)
--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/validationES3.cpp 2016-07-30 02:02:48 UTC (rev 203937)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/validationES3.cpp 2016-07-30 03:22:19 UTC (rev 203938)
@@ -44,9 +44,9 @@
set->insert(info);
}
-ES3FormatCombinationSet BuildES3FormatSet()
+ES3FormatCombinationSet& BuildES3FormatSet()
{
- ES3FormatCombinationSet set;
+ auto& set = *new ES3FormatCombinationSet;
// Format combinations from ES 3.0.1 spec, table 3.2
@@ -217,7 +217,7 @@
bool formatSupported = false;
bool typeSupported = false;
- static const ES3FormatCombinationSet es3FormatSet = BuildES3FormatSet();
+ static const ES3FormatCombinationSet& es3FormatSet = BuildES3FormatSet();
for (ES3FormatCombinationSet::const_iterator i = es3FormatSet.begin(); i != es3FormatSet.end(); i++)
{
if (i->format == format || i->type == type)
@@ -591,9 +591,9 @@
typedef std::vector<EffectiveInternalFormatInfo> EffectiveInternalFormatList;
-static EffectiveInternalFormatList BuildSizedEffectiveInternalFormatList()
+static EffectiveInternalFormatList& BuildSizedEffectiveInternalFormatList()
{
- EffectiveInternalFormatList list;
+ auto& list = *new EffectiveInternalFormatList;
// OpenGL ES 3.0.3 Specification, Table 3.17, pg 141: Effective internal format coresponding to destination internal format and
// linear source buffer component sizes.
@@ -612,9 +612,9 @@
return list;
}
-static EffectiveInternalFormatList BuildUnsizedEffectiveInternalFormatList()
+static EffectiveInternalFormatList& BuildUnsizedEffectiveInternalFormatList()
{
- EffectiveInternalFormatList list;
+ auto& list = *new EffectiveInternalFormatList;
// OpenGL ES 3.0.3 Specification, Table 3.17, pg 141: Effective internal format coresponding to destination internal format and
// linear source buffer component sizes.
@@ -640,12 +640,12 @@
if (destFormat.pixelBytes > 0)
{
- static const EffectiveInternalFormatList sizedList = BuildSizedEffectiveInternalFormatList();
+ static const EffectiveInternalFormatList& sizedList = BuildSizedEffectiveInternalFormatList();
list = &sizedList;
}
else
{
- static const EffectiveInternalFormatList unsizedList = BuildUnsizedEffectiveInternalFormatList();
+ static const EffectiveInternalFormatList& unsizedList = BuildUnsizedEffectiveInternalFormatList();
list = &unsizedList;
targetFormat = destFormat.format;
}
@@ -683,9 +683,9 @@
typedef std::set<CopyConversion> CopyConversionSet;
-static CopyConversionSet BuildValidES3CopyTexImageCombinations()
+static CopyConversionSet& BuildValidES3CopyTexImageCombinations()
{
- CopyConversionSet set;
+ auto& set = *new CopyConversionSet;
// From ES 3.0.1 spec, table 3.15
set.insert(CopyConversion(GL_ALPHA, GL_RGBA));
@@ -733,7 +733,7 @@
const InternalFormat &textureInternalFormatInfo = GetInternalFormatInfo(textureInternalFormat);
const InternalFormat &framebufferInternalFormatInfo = GetInternalFormatInfo(frameBufferInternalFormat);
- static const CopyConversionSet conversionSet = BuildValidES3CopyTexImageCombinations();
+ static const CopyConversionSet& conversionSet = BuildValidES3CopyTexImageCombinations();
if (conversionSet.find(CopyConversion(textureInternalFormatInfo.format, framebufferInternalFormatInfo.format)) != conversionSet.end())
{
// Section 3.8.5 of the GLES 3.0.3 spec states that source and destination formats