virtualx-engine/thirdparty/etcpak/patches/windows-mingw-bswap.patch
Rémi Verschelde d137ccbfc8
etcpak: Fix handling of pthread naming API for Linux and MinGW
For MinGW this is tricky to do as a two-step process like it was implemented,
as `std:🧵:native_handle()` is implementation-defined and depending on
the MinGW distribution, it may or may not be a pthread handle.

With mingw-gcc as packaged in Linux distros with pthread support it worked
fine, but with llvm-mingw it was problematic.

Setting the name in the thread directly as done for Apple platforms is simpler
and works fine.

Co-authored-by: Hein-Pieter van Braam-Stewart <hp@tmm.cx>
2021-04-13 21:04:09 +02:00

50 lines
1.1 KiB
Diff

diff --git a/thirdparty/etcpak/BlockData.cpp b/thirdparty/etcpak/BlockData.cpp
index a2cd032c5b..bd738085f3 100644
--- a/thirdparty/etcpak/BlockData.cpp
+++ b/thirdparty/etcpak/BlockData.cpp
@@ -15,7 +15,7 @@
# include <arm_neon.h>
#endif
-#ifdef __SSE4_1__
+#if defined __SSE4_1__ || defined __AVX2__ || defined _MSC_VER
# ifdef _MSC_VER
# include <intrin.h>
# include <Windows.h>
@@ -24,12 +24,6 @@
# else
# include <x86intrin.h>
# endif
-#else
-# ifndef _MSC_VER
-# include <byteswap.h>
-# define _bswap(x) bswap_32(x)
-# define _bswap64(x) bswap_64(x)
-# endif
#endif
#ifndef _bswap
diff --git a/thirdparty/etcpak/ProcessRGB.cpp b/thirdparty/etcpak/ProcessRGB.cpp
index 220d5c55e2..9dc5a78b67 100644
--- a/thirdparty/etcpak/ProcessRGB.cpp
+++ b/thirdparty/etcpak/ProcessRGB.cpp
@@ -1,5 +1,6 @@
#include <array>
#include <string.h>
+#include <limits>
#ifdef __ARM_NEON
# include <arm_neon.h>
@@ -21,12 +22,6 @@
# else
# include <x86intrin.h>
# endif
-#else
-# ifndef _MSC_VER
-# include <byteswap.h>
-# define _bswap(x) bswap_32(x)
-# define _bswap64(x) bswap_64(x)
-# endif
#endif
#ifndef _bswap