| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef SkNx_DEFINED | 8 #ifndef SkNx_DEFINED |
| 9 #define SkNx_DEFINED | 9 #define SkNx_DEFINED |
| 10 | 10 |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 | 325 |
| 326 // Transpose 4 Sk4h and store (256 bits total). | 326 // Transpose 4 Sk4h and store (256 bits total). |
| 327 SI void Sk4h_store4(void* dst, const Sk4h& r, const Sk4h& g, const Sk4h& b, cons
t Sk4h& a) { | 327 SI void Sk4h_store4(void* dst, const Sk4h& r, const Sk4h& g, const Sk4h& b, cons
t Sk4h& a) { |
| 328 uint64_t* dst64 = (uint64_t*) dst; | 328 uint64_t* dst64 = (uint64_t*) dst; |
| 329 Sk4h(r[0], g[0], b[0], a[0]).store(dst64 + 0); | 329 Sk4h(r[0], g[0], b[0], a[0]).store(dst64 + 0); |
| 330 Sk4h(r[1], g[1], b[1], a[1]).store(dst64 + 1); | 330 Sk4h(r[1], g[1], b[1], a[1]).store(dst64 + 1); |
| 331 Sk4h(r[2], g[2], b[2], a[2]).store(dst64 + 2); | 331 Sk4h(r[2], g[2], b[2], a[2]).store(dst64 + 2); |
| 332 Sk4h(r[3], g[3], b[3], a[3]).store(dst64 + 3); | 332 Sk4h(r[3], g[3], b[3], a[3]).store(dst64 + 3); |
| 333 } | 333 } |
| 334 | 334 |
| 335 // Load 4 Sk4f and transpose them (512 bits total). | |
| 336 SI void Sk4f_load4(const void* vptr, Sk4f* r, Sk4f* g, Sk4f* b, Sk4f* a) { | |
| 337 const float* ptr = (const float*) vptr; | |
| 338 auto p0 = Sk4f::Load(ptr + 0), | |
| 339 p1 = Sk4f::Load(ptr + 4), | |
| 340 p2 = Sk4f::Load(ptr + 8), | |
| 341 p3 = Sk4f::Load(ptr + 12); | |
| 342 *r = { p0[0], p1[0], p2[0], p3[0] }; | |
| 343 *g = { p0[1], p1[1], p2[1], p3[1] }; | |
| 344 *b = { p0[2], p1[2], p2[2], p3[2] }; | |
| 345 *a = { p0[3], p1[3], p2[3], p3[3] }; | |
| 346 } | |
| 347 | |
| 348 // Transpose 4 Sk4f and store (512 bits total). | |
| 349 SI void Sk4f_store4(void* vdst, const Sk4f& r, const Sk4f& g, const Sk4f& b, con
st Sk4f& a) { | |
| 350 float* dst = (float*) vdst; | |
| 351 Sk4f(r[0], g[0], b[0], a[0]).store(dst + 0); | |
| 352 Sk4f(r[1], g[1], b[1], a[1]).store(dst + 4); | |
| 353 Sk4f(r[2], g[2], b[2], a[2]).store(dst + 8); | |
| 354 Sk4f(r[3], g[3], b[3], a[3]).store(dst + 12); | |
| 355 } | |
| 356 | |
| 357 #endif | 335 #endif |
| 358 | 336 |
| 359 SI void Sk4f_ToBytes(uint8_t p[16], const Sk4f& a, const Sk4f& b, const Sk4f& c,
const Sk4f& d) { | 337 SI void Sk4f_ToBytes(uint8_t p[16], const Sk4f& a, const Sk4f& b, const Sk4f& c,
const Sk4f& d) { |
| 360 SkNx_cast<uint8_t>(SkNx_join(SkNx_join(a,b), SkNx_join(c,d))).store(p); | 338 SkNx_cast<uint8_t>(SkNx_join(SkNx_join(a,b), SkNx_join(c,d))).store(p); |
| 361 } | 339 } |
| 362 | 340 |
| 363 #undef SI | 341 #undef SI |
| 364 | 342 |
| 365 #endif//SkNx_DEFINED | 343 #endif//SkNx_DEFINED |
| OLD | NEW |