From 0bd27f80e0fff56e5450bb10aa7da8ba1ac00406 Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Tue, 16 Apr 2019 10:19:27 +0200 Subject: ANGLE: clean up displays on dll unload If the displays are not cleaned up on dll unloading, profilers might report memory leaks. Change-Id: I04cbc3c2448bfb450f7d840e216827f86856e963 Reviewed-by: Friedemann Kleint Reviewed-by: Andre de la Rocha Reviewed-by: Andy Shaw --- src/3rdparty/angle/src/libANGLE/Display.cpp | 17 +++++++++++++++++ src/3rdparty/angle/src/libANGLE/Display.h | 1 + src/3rdparty/angle/src/libGLESv2/global_state.cpp | 2 ++ 3 files changed, 20 insertions(+) (limited to 'src/3rdparty/angle') diff --git a/src/3rdparty/angle/src/libANGLE/Display.cpp b/src/3rdparty/angle/src/libANGLE/Display.cpp index 735b472787..0bb0bb05b1 100644 --- a/src/3rdparty/angle/src/libANGLE/Display.cpp +++ b/src/3rdparty/angle/src/libANGLE/Display.cpp @@ -364,6 +364,23 @@ Display *Display::GetDisplayFromDevice(Device *device, const AttributeMap &attri return display; } +//static +void Display::CleanupDisplays() +{ + // ~Display takes care of removing the entry from the according map + { + ANGLEPlatformDisplayMap *displays = GetANGLEPlatformDisplayMap(); + while (!displays->empty()) + delete displays->begin()->second; + } + + { + DevicePlatformDisplayMap *displays = GetDevicePlatformDisplayMap(); + while (!displays->empty()) + delete displays->begin()->second; + } +} + Display::Display(EGLenum platform, EGLNativeDisplayType displayId, Device *eglDevice) : mImplementation(nullptr), mDisplayId(displayId), diff --git a/src/3rdparty/angle/src/libANGLE/Display.h b/src/3rdparty/angle/src/libANGLE/Display.h index aa1d1c3b37..2a1c386d75 100644 --- a/src/3rdparty/angle/src/libANGLE/Display.h +++ b/src/3rdparty/angle/src/libANGLE/Display.h @@ -65,6 +65,7 @@ class Display final : angle::NonCopyable static Display *GetDisplayFromDevice(Device *device, const AttributeMap &attribMap); static Display *GetDisplayFromNativeDisplay(EGLNativeDisplayType nativeDisplay, const AttributeMap &attribMap); + static void CleanupDisplays(); static const ClientExtensions &GetClientExtensions(); static const std::string &GetClientExtensionString(); diff --git a/src/3rdparty/angle/src/libGLESv2/global_state.cpp b/src/3rdparty/angle/src/libGLESv2/global_state.cpp index c5f3dfe4e1..26045bf5b2 100644 --- a/src/3rdparty/angle/src/libGLESv2/global_state.cpp +++ b/src/3rdparty/angle/src/libGLESv2/global_state.cpp @@ -13,6 +13,7 @@ #include "common/tls.h" #include "libANGLE/Thread.h" +#include "libANGLE/Display.h" namespace gl { @@ -140,6 +141,7 @@ extern "C" BOOL WINAPI DllMain(HINSTANCE, DWORD reason, LPVOID) return static_cast(egl::DeallocateCurrentThread()); case DLL_PROCESS_DETACH: + egl::Display::CleanupDisplays(); return static_cast(egl::TerminateProcess()); } -- cgit v1.2.3 From 827b7afba7b16cb25e276dc5e7bd74cd69c3acf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Fri, 26 Apr 2019 14:57:01 +0300 Subject: ANGLE: Backport fix for compilation on mingw/64bit with clang This backports the following upstream fix from angle: https://github.com/google/angle/commit/63cc351fbad06c6241d1c7372fe76f74e1d09a10 Change-Id: Id80dba62c69f3505eb836f758367b4bf054b1fd5 Reviewed-by: Oliver Wolff --- src/3rdparty/angle/src/common/third_party/smhasher/src/PMurHash.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/3rdparty/angle') diff --git a/src/3rdparty/angle/src/common/third_party/smhasher/src/PMurHash.cpp b/src/3rdparty/angle/src/common/third_party/smhasher/src/PMurHash.cpp index 071bc31539..93b48713cd 100644 --- a/src/3rdparty/angle/src/common/third_party/smhasher/src/PMurHash.cpp +++ b/src/3rdparty/angle/src/common/third_party/smhasher/src/PMurHash.cpp @@ -49,6 +49,7 @@ on big endian machines, or a byte-by-byte read if the endianess is unknown. #include "PMurHash.h" +#include /* I used ugly type names in the header to avoid potential conflicts with * application or system typedefs & defines. Since I'm not including any more @@ -208,7 +209,7 @@ void PMurHash32_Process(uint32_t *ph1, uint32_t *pcarry, const void *key, int le /* This CPU does not handle unaligned word access */ /* Consume enough so that the next data byte is word aligned */ - int i = -(long)ptr & 3; + int i = -(intptr_t)ptr & 3; if(i && i <= len) { DOBYTES(i, h1, c, n, ptr, len); } -- cgit v1.2.3