From 32fc011f80c9c95a11512864f0980aeb0987ceda Mon Sep 17 00:00:00 2001 From: Arvid Gerstmann Date: Fri, 13 Jul 2018 23:39:25 +0200 Subject: [PATCH 1/4] Silence unused parameter warning --- client/concurrentqueue.h | 1 + 1 file changed, 1 insertion(+) diff --git a/client/concurrentqueue.h b/client/concurrentqueue.h index dfde96db..7a57e547 100644 --- a/client/concurrentqueue.h +++ b/client/concurrentqueue.h @@ -3553,6 +3553,7 @@ private: template static inline void destroy_array(U* p, size_t count) { + ((void)count); if (p != nullptr) { assert(count > 0); (Traits::free)(p); From ebd1d00178456da48864f9d3b2201788f3957d57 Mon Sep 17 00:00:00 2001 From: Arvid Gerstmann Date: Fri, 13 Jul 2018 23:39:58 +0200 Subject: [PATCH 2/4] Correctly forward declare Win32 functions _WINDOWS_ is the macro defined by the windows.h header guard, checking it whether the symbols have already been included before forward declaring our own. --- common/TracySystem.hpp | 2 ++ common/tracy_sema.h | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/common/TracySystem.hpp b/common/TracySystem.hpp index d5e98ecd..489f5a35 100644 --- a/common/TracySystem.hpp +++ b/common/TracySystem.hpp @@ -8,7 +8,9 @@ #endif #ifdef _WIN32 +#ifndef _WINDOWS_ extern "C" __declspec(dllimport) unsigned long __stdcall GetCurrentThreadId(void); +#endif #else # include #endif diff --git a/common/tracy_sema.h b/common/tracy_sema.h index 2419bb79..d0584987 100644 --- a/common/tracy_sema.h +++ b/common/tracy_sema.h @@ -35,10 +35,15 @@ namespace tracy //--------------------------------------------------------- // Semaphore (Windows) //--------------------------------------------------------- - #ifndef MAXLONG enum { MAXLONG = 0x7fffffff }; +#endif + +#ifndef INFINITE enum { INFINITE = 0xFFFFFFFF }; +#endif + +#ifndef _WINDOWS_ typedef void* HANDLE; extern "C" __declspec(dllimport) HANDLE __stdcall CreateSemaphoreA( void*, long, long, const char* ); From 0b1c2ebc8fe0a299dcfdd371b0f97d24ba0b3c22 Mon Sep 17 00:00:00 2001 From: Arvid Gerstmann Date: Fri, 13 Jul 2018 23:41:12 +0200 Subject: [PATCH 3/4] Define M_PI_2 if not already done --- server/TracyView.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server/TracyView.cpp b/server/TracyView.cpp index 780af07f..af23871d 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -22,6 +22,10 @@ # include "../nfd/nfd.h" #endif +#ifndef M_PI_2 +#define M_PI_2 1.57079632679489661923 +#endif + namespace tracy { From 34533ad4f13a5cec77f449c4b2ca200c54800a10 Mon Sep 17 00:00:00 2001 From: Arvid Gerstmann Date: Fri, 13 Jul 2018 23:41:38 +0200 Subject: [PATCH 4/4] Dynamically import GetDpiForSystem, to support older Windows versions --- standalone/src/main.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/standalone/src/main.cpp b/standalone/src/main.cpp index 355f7eb7..6ae6f8aa 100644 --- a/standalone/src/main.cpp +++ b/standalone/src/main.cpp @@ -51,7 +51,13 @@ int main( int argc, char** argv ) float dpiScale = 1.f; #ifdef _WIN32 - dpiScale = GetDpiForSystem() / 96.f; + typedef UINT(*GDFS)(void); + GDFS getDpiForSystem = nullptr; + HMODULE dll = GetModuleHandleW(L"user32.dll"); + if (dll != INVALID_HANDLE_VALUE) + getDpiForSystem = (GDFS)GetProcAddress(dll, "GetDpiForSystem"); + if (getDpiForSystem) + dpiScale = getDpiForSystem() / 96.f; #endif // Setup ImGui binding