Add Load2/store2 to Sk4x (dumb impl for now)
patch from issue 1001003002 at patchset 1 (http://crrev.com/1001003002#ps1) BUG=skia: Review URL: https://codereview.chromium.org/1001453006
This commit is contained in:
parent
24e06d5244
commit
422677ceab
@ -37,6 +37,18 @@ public:
|
||||
void store (T[4]) const;
|
||||
void storeAligned(T[4]) const;
|
||||
|
||||
// Experimental!
|
||||
static Sk4x Load2(const T src[2]) {
|
||||
const T padded[4] = { src[0], src[1], 0, 0 };
|
||||
return Load(padded);
|
||||
}
|
||||
void store2(T dst[2]) const {
|
||||
T padded[4];
|
||||
this->store(padded);
|
||||
dst[0] = padded[0];
|
||||
dst[1] = padded[1];
|
||||
}
|
||||
|
||||
template <typename Dst> Dst reinterpret() const;
|
||||
template <typename Dst> Dst cast() const;
|
||||
|
||||
|
@ -42,6 +42,15 @@ DEF_TEST(Sk4x_LoadStore, r) {
|
||||
fs[2] == 6 &&
|
||||
fs[3] == 7 &&
|
||||
fs[4] == 8);
|
||||
|
||||
// Load2 and store2().
|
||||
float two[2] = { 1.0f, 2.0f };
|
||||
Sk4f twoIn4f = Sk4f::Load2(two);
|
||||
twoIn4f = twoIn4f.multiply(Sk4f(2.0f));
|
||||
twoIn4f.store2(two);
|
||||
|
||||
REPORTER_ASSERT(r, two[0] == 2.0f);
|
||||
REPORTER_ASSERT(r, two[1] == 4.0f);
|
||||
}
|
||||
|
||||
DEF_TEST(Sk4x_Conversions, r) {
|
||||
|
Loading…
Reference in New Issue
Block a user