Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(112)

Side by Side Diff: src/core/Sk4x.h

Issue 719143002: Revert of Sk4x_sse.h (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/core/Sk4x_sse.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #ifndef Sk4x_DEFINED 1 #ifndef Sk4x_DEFINED
2 #define Sk4x_DEFINED 2 #define Sk4x_DEFINED
3 3
4 #include "SkTypes.h" 4 #include "SkTypes.h"
5 5
6 #define SK4X_PREAMBLE 1 6 #define SK4X_PREAMBLE 1
7 #if SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2 7 #include "Sk4x_portable.h"
8 #include "Sk4x_sse.h"
9 #else
10 #include "Sk4x_portable.h"
11 #endif
12 #undef SK4X_PREAMBLE 8 #undef SK4X_PREAMBLE
13 9
14 template <typename T> class Sk4x; 10 template <typename T> class Sk4x;
15 typedef Sk4x<float> Sk4f; 11 typedef Sk4x<float> Sk4f;
16 typedef Sk4x<int32_t> Sk4i; 12 typedef Sk4x<int32_t> Sk4i;
17 13
18 // Some Sk4x methods are implemented only for Sk4f or Sk4i.
19 // They might be unavailable, really slow, or just a bad idea.
20 // Talk to mtklein if you find yourself unable to link and
21 // really need one of those methods.
22
23 template <typename T> class Sk4x { 14 template <typename T> class Sk4x {
24 public: 15 public:
25 Sk4x(); // Uninitialized; use Sk4x(0,0,0,0) for zero. 16 Sk4x(); // Uninitialized; use Sk4x(0,0,0,0) for zero.
26 Sk4x(T, T, T, T); 17 Sk4x(T, T, T, T);
27 18
28 Sk4x(const Sk4x&); 19 Sk4x(const Sk4x&);
29 Sk4x& operator=(const Sk4x&); 20 Sk4x& operator=(const Sk4x&);
30 21
31 static Sk4x Load (const T[4]); 22 static Sk4x Load (const T[4]);
32 static Sk4x LoadAligned(const T[4]); 23 static Sk4x LoadAligned(const T[4]);
33 24
34 void store (T[4]) const; 25 void store (T[4]) const;
35 void storeAligned(T[4]) const; 26 void storeAligned(T[4]) const;
36 27
37 template <typename Dst> Dst reinterpret() const; 28 template <typename Dst> Dst reinterpret() const;
38 template <typename Dst> Dst cast() const; 29 template <typename Dst> Dst cast() const;
39 30
40 bool allTrue() const; 31 bool allTrue() const;
41 bool anyTrue() const; 32 bool anyTrue() const;
42 33
43 Sk4x bitNot() const; 34 Sk4x bitNot() const;
44 Sk4x bitAnd(const Sk4x&) const; 35 Sk4x bitAnd(const Sk4x&) const;
45 Sk4x bitOr(const Sk4x&) const; 36 Sk4x bitOr(const Sk4x&) const;
46 // TODO: Sk4x bitAndNot(const Sk4x&) const; is efficient in SSE.
47 Sk4x add(const Sk4x&) const; 37 Sk4x add(const Sk4x&) const;
48 Sk4x subtract(const Sk4x&) const; 38 Sk4x subtract(const Sk4x&) const;
49 Sk4x multiply(const Sk4x&) const; 39 Sk4x multiply(const Sk4x&) const;
50 Sk4x divide(const Sk4x&) const; 40 Sk4x divide(const Sk4x&) const;
51 41
52 Sk4i equal(const Sk4x&) const; 42 Sk4i equal(const Sk4x&) const;
53 Sk4i notEqual(const Sk4x&) const; 43 Sk4i notEqual(const Sk4x&) const;
54 Sk4i lessThan(const Sk4x&) const; 44 Sk4i lessThan(const Sk4x&) const;
55 Sk4i greaterThan(const Sk4x&) const; 45 Sk4i greaterThan(const Sk4x&) const;
56 Sk4i lessThanEqual(const Sk4x&) const; 46 Sk4i lessThanEqual(const Sk4x&) const;
57 Sk4i greaterThanEqual(const Sk4x&) const; 47 Sk4i greaterThanEqual(const Sk4x&) const;
58 48
59 static Sk4x Min(const Sk4x& a, const Sk4x& b); 49 static Sk4x Min(const Sk4x& a, const Sk4x& b);
60 static Sk4x Max(const Sk4x& a, const Sk4x& b); 50 static Sk4x Max(const Sk4x& a, const Sk4x& b);
61 51
62 // Swizzles follow OpenCL xyzw convention. 52 // Swizzles follow OpenCL xyzw convention.
63 Sk4x zwxy() const; 53 Sk4x zwxy() const;
64 54
65 // When there's a second argument, it's abcd. 55 // When there's a second argument, it's abcd.
66 static Sk4x XYAB(const Sk4x& xyzw, const Sk4x& abcd); 56 static Sk4x XYAB(const Sk4x& xyzw, const Sk4x& abcd);
67 static Sk4x ZWCD(const Sk4x& xyzw, const Sk4x& abcd); 57 static Sk4x ZWCD(const Sk4x& xyzw, const Sk4x& abcd);
68 58
69 // TODO: these are particularly efficient in SSE. Useful? Also efficient i n NEON?
70 // static Sk4x XAYB(const Sk4x& xyzw, const Sk4x& abcd);
71 // static Sk4x ZCWD(const Sk4x& xyzw, const Sk4x& abcd);
72
73 private: 59 private:
74 // It's handy to have Sk4f and Sk4i be mutual friends. 60 // It's handy to have Sk4f and Sk4i be mutual friends.
75 template <typename S> friend class Sk4x; 61 template <typename S> friend class Sk4x;
76 62
77 #define SK4X_PRIVATE 1 63 #define SK4X_PRIVATE 1
78 #if SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2 64 #include "Sk4x_portable.h"
79 #include "Sk4x_sse.h"
80 #else
81 #include "Sk4x_portable.h"
82 #endif
83 #undef SK4X_PRIVATE 65 #undef SK4X_PRIVATE
84 }; 66 };
85 67
86 #if SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2 68 #include "Sk4x_portable.h"
87 #include "Sk4x_sse.h"
88 #else
89 #include "Sk4x_portable.h"
90 #endif
91 69
92 #endif//Sk4x_DEFINED 70 #endif//Sk4x_DEFINED
OLDNEW
« no previous file with comments | « no previous file | src/core/Sk4x_sse.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698