-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathpixman-wasm.patch
112 lines (102 loc) · 3 KB
/
pixman-wasm.patch
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
--- a/pixman/pixman/pixman-x86.c
+++ b/pixman/pixman/pixman-x86.c
@@ -74,10 +74,12 @@ detect_cpu_features (void)
#else
-#if defined (__GNUC__)
+#if defined (__GNUC__) && !defined(__EMSCRIPTEN__)
#include <cpuid.h>
#endif
+#if !defined(__EMSCRIPTEN__)
+
static void
pixman_cpuid (uint32_t feature,
uint32_t *a, uint32_t *b, uint32_t *c, uint32_t *d)
@@ -98,10 +100,17 @@ pixman_cpuid (uint32_t feature,
#error Unknown compiler
#endif
}
+
+#endif // !__EMSCRIPTEN__
static cpu_features_t
detect_cpu_features (void)
{
+#if defined(__EMSCRIPTEN__)
+
+ return X86_MMX | X86_MMX_EXTENSIONS | X86_SSE | X86_SSE2;
+
+#else
uint32_t a, b, c, d;
cpu_features_t features = 0;
@@ -147,6 +156,8 @@ detect_cpu_features (void)
}
return features;
+
+#endif // !__EMSCRIPTEN__
}
#endif
--- a/pixman/pixman/pixman-ssse3.c
+++ b/pixman/pixman/pixman-ssse3.c
@@ -28,7 +28,9 @@
#endif
#include <stdlib.h>
+#if !defined(__EMSCRIPTEN__)
#include <mmintrin.h>
+#endif
#include <xmmintrin.h>
#include <emmintrin.h>
#include <tmmintrin.h>
--- a/pixman/meson.build
+++ b/pixman/meson.build
@@ -160,14 +160,16 @@ elif cc.get_id() != 'msvc'
sse2_flags = ['-msse2', '-Winline']
endif
if not use_sse2.disabled()
- if host_machine.cpu_family() == 'x86'
+ # if host_machine.cpu_family() == 'x86'
if cc.compiles('''
#if defined(__GNUC__) && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 2))
- # if !defined(__amd64__) && !defined(__x86_64__)
+ # if !defined(__amd64__) && !defined(__x86_64__) && !defined(__EMSCRIPTEN__)
# error "Need GCC >= 4.2 for SSE2 intrinsics on x86"
# endif
#endif
- #include <mmintrin.h>
+ #ifndef __EMSCRIPTEN__
+ # include <mmintrin.h>
+ #endif
#include <xmmintrin.h>
#include <emmintrin.h>
int param;
@@ -180,7 +182,7 @@ if not use_sse2.disabled()
name : 'SSE2 Intrinsic Support')
have_sse2 = true
endif
- elif host_machine.cpu_family() == 'x86_64'
+ if host_machine.cpu_family() == 'x86_64'
have_sse2 = true
endif
endif
@@ -200,11 +200,14 @@ endif
# x64 pre-2010 MSVC compilers crashes when building the ssse3 code
if not use_ssse3.disabled() and not (cc.get_id() == 'msvc' and cc.version().version_compare('<16') and host_machine.cpu_family() == 'x86_64')
- if host_machine.cpu_family().startswith('x86')
+ # if host_machine.cpu_family().startswith('x86')
if cc.compiles('''
- #include <mmintrin.h>
+ #ifndef __EMSCRIPTEN__
+ # include <mmintrin.h>
+ #endif
#include <xmmintrin.h>
#include <emmintrin.h>
+ #include <tmmintrin.h>
int param;
int main () {
__m128i a = _mm_set1_epi32 (param), b = _mm_set1_epi32 (param + 1), c;
@@ -215,7 +218,7 @@ if not use_ssse3.disabled() and not (cc.get_id() == 'msvc' and cc.version().vers
name : 'SSSE3 Intrinsic Support')
have_ssse3 = true
endif
- endif
+ # endif
endif
if have_ssse3