summaryrefslogtreecommitdiffstats
path: root/src/angle/patches/0005-Fix-build-when-SSE2-is-not-available.patch
blob: 1dbf7d387fbca6d14ded32f4fb7a533c2b0e9b13 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
From 747d31f25883f6b9203245a498acf9945accdc0d Mon Sep 17 00:00:00 2001
From: Andy Shaw <andy.shaw@digia.com>
Date: Sat, 28 Jun 2014 17:06:45 +0300
Subject: [PATCH 05/12] Fix build when SSE2 is not available.

Although SSE2 support is detected at runtime it still may not be
available at build time, so we have to ensure it only uses SSE2
when it is available at build time too.

Change-Id: I86c45a6466ab4cec79aa0f62b0d5230a78ad825a
---
 src/3rdparty/angle/src/common/mathutil.h                    | 2 ++
 src/3rdparty/angle/src/libGLESv2/renderer/loadimageSSE2.cpp | 8 ++++++++
 2 files changed, 10 insertions(+)

diff --git a/src/3rdparty/angle/src/common/mathutil.h b/src/3rdparty/angle/src/common/mathutil.h
index 58f9b4c..f32663f 100644
--- a/src/3rdparty/angle/src/common/mathutil.h
+++ b/src/3rdparty/angle/src/common/mathutil.h
@@ -118,6 +118,7 @@ inline bool supportsSSE2()
         return supports;
     }
 
+#if defined(_M_IX86) || defined(_M_AMD64) // ARM doesn't provide __cpuid()
     int info[4];
     __cpuid(info, 0);
 
@@ -127,6 +128,7 @@ inline bool supportsSSE2()
 
         supports = (info[3] >> 26) & 1;
     }
+#endif
 
     checked = true;
 
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/loadimageSSE2.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/loadimageSSE2.cpp
index 9c83894..dcf347d 100644
--- a/src/3rdparty/angle/src/libGLESv2/renderer/loadimageSSE2.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/loadimageSSE2.cpp
@@ -11,6 +11,10 @@
 
 #include "libGLESv2/renderer/loadimage.h"
 
+#if !defined(__SSE2__) && (defined(_M_X64) || _M_IX86_FP == 2)
+#define __SSE2__
+#endif
+
 namespace rx
 {
 
@@ -18,6 +22,7 @@ void LoadA8ToBGRA8_SSE2(size_t width, size_t height, size_t depth,
                         const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
                         uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch)
 {
+#ifdef __SSE2__
     __m128i zeroWide = _mm_setzero_si128();
 
     for (size_t z = 0; z < depth; z++)
@@ -55,12 +60,14 @@ void LoadA8ToBGRA8_SSE2(size_t width, size_t height, size_t depth,
             }
         }
     }
+#endif
 }
 
 void LoadRGBA8ToBGRA8_SSE2(size_t width, size_t height, size_t depth,
                            const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
                            uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch)
 {
+#ifdef __SSE2__
     __m128i brMask = _mm_set1_epi32(0x00ff00ff);
 
     for (size_t z = 0; z < depth; z++)
@@ -100,6 +107,7 @@ void LoadRGBA8ToBGRA8_SSE2(size_t width, size_t height, size_t depth,
             }
         }
     }
+#endif
 }
 
 }
-- 
1.9.0.msysgit.0