diff options
author | Mike Klein <mtklein@chromium.org> | 2017-02-14 09:32:43 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-02-14 15:20:04 +0000 |
commit | ce44a0f4e7d1e85b09af9c1edfab3ba897ebc05d (patch) | |
tree | e02ef073425c40748c361d631370e940801b0856 | |
parent | 7598b4882cff7c418421c96c04ce658655cdd933 (diff) |
SkSplicer: implement constant_color
Change-Id: I3a5475eb3e76eef19183950f14e17b119f32458b
Reviewed-on: https://skia-review.googlesource.com/8405
Reviewed-by: Mike Klein <mtklein@chromium.org>
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>
-rw-r--r-- | src/splicer/SkSplicer.cpp | 1 | ||||
-rw-r--r-- | src/splicer/SkSplicer_generated.h | 34 | ||||
-rw-r--r-- | src/splicer/SkSplicer_stages.cpp | 12 |
3 files changed, 45 insertions, 2 deletions
diff --git a/src/splicer/SkSplicer.cpp b/src/splicer/SkSplicer.cpp index cde6f3307a..71d4132ac4 100644 --- a/src/splicer/SkSplicer.cpp +++ b/src/splicer/SkSplicer.cpp @@ -249,6 +249,7 @@ namespace { switch (st) { \ default: return false; \ CASE(prefix, seed_shader); \ + CASE(prefix, constant_color); \ CASE(prefix, clear); \ CASE(prefix, plus_); \ CASE(prefix, srcover); \ diff --git a/src/splicer/SkSplicer_generated.h b/src/splicer/SkSplicer_generated.h index 4316364e84..0f823e6acb 100644 --- a/src/splicer/SkSplicer_generated.h +++ b/src/splicer/SkSplicer_generated.h @@ -34,6 +34,14 @@ static const unsigned int aarch64_seed_shader[] = { 0x6f00e407, // movi v7.2d, #0x0 0xd65f03c0, // return }; +static const unsigned int aarch64_constant_color[] = { + 0x3dc00043, // ldr q3, [x2] + 0x4e040460, // dup v0.4s, v3.s[0] + 0x4e0c0461, // dup v1.4s, v3.s[1] + 0x4e140462, // dup v2.4s, v3.s[2] + 0x4e1c0463, // dup v3.4s, v3.s[3] + 0xd65f03c0, // return +}; static const unsigned int aarch64_clear[] = { 0x6f00e400, // movi v0.2d, #0x0 0x6f00e401, // movi v1.2d, #0x0 @@ -477,6 +485,14 @@ static const unsigned int armv7_seed_shader[] = { 0xf2807010, // vmov.i32 d7, #0 0xe12fff1e, // return }; +static const unsigned int armv7_constant_color[] = { + 0xf4620a0f, // vld1.8 {d16-d17}, [r2] + 0xf3b40c20, // vdup.32 d0, d16[0] + 0xf3bc1c20, // vdup.32 d1, d16[1] + 0xf3b42c21, // vdup.32 d2, d17[0] + 0xf3bc3c21, // vdup.32 d3, d17[1] + 0xe12fff1e, // return +}; static const unsigned int armv7_clear[] = { 0xf2800010, // vmov.i32 d0, #0 0xf2801010, // vmov.i32 d1, #0 @@ -960,6 +976,17 @@ static const unsigned char sse2_seed_shader[] = { 0x0f,0x57,0xff, // xorps %xmm7,%xmm7 0xc3, // return }; +static const unsigned char sse2_constant_color[] = { + 0x0f,0x10,0x1a, // movups (%rdx),%xmm3 + 0x0f,0x28,0xc3, // movaps %xmm3,%xmm0 + 0x0f,0xc6,0xc0,0x00, // shufps $0x0,%xmm0,%xmm0 + 0x0f,0x28,0xcb, // movaps %xmm3,%xmm1 + 0x0f,0xc6,0xc9,0x55, // shufps $0x55,%xmm1,%xmm1 + 0x0f,0x28,0xd3, // movaps %xmm3,%xmm2 + 0x0f,0xc6,0xd2,0xaa, // shufps $0xaa,%xmm2,%xmm2 + 0x0f,0xc6,0xdb,0xff, // shufps $0xff,%xmm3,%xmm3 + 0xc3, // return +}; static const unsigned char sse2_clear[] = { 0x0f,0x57,0xc0, // xorps %xmm0,%xmm0 0x0f,0x57,0xc9, // xorps %xmm1,%xmm1 @@ -1527,6 +1554,13 @@ static const unsigned char hsw_seed_shader[] = { 0xc5,0xc4,0x57,0xff, // vxorps %ymm7,%ymm7,%ymm7 0xc3, // return }; +static const unsigned char hsw_constant_color[] = { + 0xc4,0xe2,0x7d,0x18,0x02, // vbroadcastss (%rdx),%ymm0 + 0xc4,0xe2,0x7d,0x18,0x4a,0x04, // vbroadcastss 0x4(%rdx),%ymm1 + 0xc4,0xe2,0x7d,0x18,0x52,0x08, // vbroadcastss 0x8(%rdx),%ymm2 + 0xc4,0xe2,0x7d,0x18,0x5a,0x0c, // vbroadcastss 0xc(%rdx),%ymm3 + 0xc3, // return +}; static const unsigned char hsw_clear[] = { 0xc5,0xfc,0x57,0xc0, // vxorps %ymm0,%ymm0,%ymm0 0xc5,0xf4,0x57,0xc9, // vxorps %ymm1,%ymm1,%ymm1 diff --git a/src/splicer/SkSplicer_stages.cpp b/src/splicer/SkSplicer_stages.cpp index 03b7001640..7f9a5b3802 100644 --- a/src/splicer/SkSplicer_stages.cpp +++ b/src/splicer/SkSplicer_stages.cpp @@ -112,6 +112,8 @@ static T unaligned_load(const P* p) { return v; } +using F4 = float __attribute__((ext_vector_type(4))); + // We'll be compiling this file to an object file, then extracting parts of it into // SkSplicer_generated.h. It's easier to do if the function names are not C++ mangled. #define C extern "C" @@ -183,6 +185,14 @@ STAGE(seed_shader) { dr = dg = db = da = 0; } +STAGE(constant_color) { + auto rgba = unaligned_load<F4>(ctx); + r = rgba[0]; + g = rgba[1]; + b = rgba[2]; + a = rgba[3]; +} + STAGE(clear) { r = g = b = a = 0; } @@ -471,8 +481,6 @@ STAGE(matrix_3x4) { } STAGE(linear_gradient_2stops) { - using F4 = float __attribute__((ext_vector_type(4))); - struct Ctx { F4 c0, dc; }; auto c = unaligned_load<Ctx>(ctx); |