diff options
author | Mike Klein <mtklein@chromium.org> | 2016-09-29 13:40:01 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2016-09-29 18:11:29 +0000 |
commit | fa9f241a85c55c32a3fe2ae0324811de998f7a2e (patch) | |
tree | 01308fe5602180eaaf0636fa635183ce9a93a7e7 /src/opts | |
parent | 69e7eba6aef583eb0561019539b164d8e0eed025 (diff) |
Add an enum layer of indirection for stock raster pipeline stages.
This is handy now, and becomes necessary with fancier backends:
- most code can't speak the type of AVX pipeline stages,
so indirection's definitely needed there;
- if the pipleine is entirely composed of stock stages,
these enum values become an abstract recipe that can be JITted.
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2782
CQ_INCLUDE_TRYBOTS=master.client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot
Change-Id: Iedd62e99ce39e94cf3e6ffc78c428f0ccc182342
Reviewed-on: https://skia-review.googlesource.com/2782
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Mike Klein <mtklein@chromium.org>
Diffstat (limited to 'src/opts')
-rw-r--r-- | src/opts/SkOpts_sse41.cpp | 36 | ||||
-rw-r--r-- | src/opts/SkRasterPipeline_opts.h | 20 |
2 files changed, 27 insertions, 29 deletions
diff --git a/src/opts/SkOpts_sse41.cpp b/src/opts/SkOpts_sse41.cpp index e4e3246780..0509b91fdf 100644 --- a/src/opts/SkOpts_sse41.cpp +++ b/src/opts/SkOpts_sse41.cpp @@ -22,33 +22,31 @@ namespace SkOpts { blit_row_s32a_opaque = sse41::blit_row_s32a_opaque; #define STAGE(stage, kCallNext) \ - stage = body<SK_OPTS_NS::stage, kCallNext> + stages_4 [SkRasterPipeline::stage] = stage_4 <SK_OPTS_NS::stage, kCallNext>; \ + stages_1_3[SkRasterPipeline::stage] = stage_1_3<SK_OPTS_NS::stage, kCallNext> - STAGE(srcover, true); - STAGE(constant_color, true); - STAGE(lerp_constant_float, true); - #undef STAGE + STAGE(store_565 , false); + STAGE(store_srgb, false); + STAGE(store_f16 , false); - #define STAGE(stage, kCallNext) \ - stage##_body = body<SK_OPTS_NS::stage, kCallNext>; \ - stage##_tail = tail<SK_OPTS_NS::stage, kCallNext> + STAGE(load_s_565 , true); + STAGE(load_s_srgb, true); + STAGE(load_s_f16 , true); + STAGE(load_d_565 , true); STAGE(load_d_srgb, true); - STAGE(load_s_srgb, true); - STAGE( store_srgb, false); + STAGE(load_d_f16 , true); - STAGE(load_d_f16, true); - STAGE(load_s_f16, true); - STAGE( store_f16, false); + STAGE(scale_u8, true); - STAGE(load_d_565, true); - STAGE(load_s_565, true); - STAGE( store_565, false); + STAGE(lerp_u8 , true); + STAGE(lerp_565 , true); + STAGE(lerp_constant_float, true); - STAGE(scale_u8, true); + STAGE(constant_color, true); - STAGE(lerp_u8, true); - STAGE(lerp_565, true); + STAGE(srcover, true); #undef STAGE + } } diff --git a/src/opts/SkRasterPipeline_opts.h b/src/opts/SkRasterPipeline_opts.h index 70c4d0c225..fe0fde8139 100644 --- a/src/opts/SkRasterPipeline_opts.h +++ b/src/opts/SkRasterPipeline_opts.h @@ -25,26 +25,26 @@ using Kernel_Sk4f = void(void*, size_t, size_t, Sk4f&, Sk4f&, Sk4f&, Sk4f&, template <Kernel_Sk4f kernel, bool kCallNext> -static inline void SK_VECTORCALL body(SkRasterPipeline::Stage* st, size_t x, size_t t, - Sk4f r, Sk4f g, Sk4f b, Sk4f a, - Sk4f dr, Sk4f dg, Sk4f db, Sk4f da) { +static inline void SK_VECTORCALL stage_4(SkRasterPipeline::Stage* st, size_t x, size_t tail, + Sk4f r, Sk4f g, Sk4f b, Sk4f a, + Sk4f dr, Sk4f dg, Sk4f db, Sk4f da) { // Passing 0 lets the optimizer completely drop any "if (tail) {...}" code in kernel. kernel(st->ctx<void*>(), x,0, r,g,b,a, dr,dg,db,da); if (kCallNext) { - st->next(x,t, r,g,b,a, dr,dg,db,da); // It's faster to pass t here than 0. + st->next(x,tail, r,g,b,a, dr,dg,db,da); // It's faster to pass t here than 0. } } template <Kernel_Sk4f kernel, bool kCallNext> -static inline void SK_VECTORCALL tail(SkRasterPipeline::Stage* st, size_t x, size_t t, - Sk4f r, Sk4f g, Sk4f b, Sk4f a, - Sk4f dr, Sk4f dg, Sk4f db, Sk4f da) { +static inline void SK_VECTORCALL stage_1_3(SkRasterPipeline::Stage* st, size_t x, size_t tail, + Sk4f r, Sk4f g, Sk4f b, Sk4f a, + Sk4f dr, Sk4f dg, Sk4f db, Sk4f da) { #if defined(__clang__) - __builtin_assume(t > 0); // This flourish lets Clang compile away any tail==0 code. + __builtin_assume(tail > 0); // This flourish lets Clang compile away any tail==0 code. #endif - kernel(st->ctx<void*>(), x,t, r,g,b,a, dr,dg,db,da); + kernel(st->ctx<void*>(), x,tail, r,g,b,a, dr,dg,db,da); if (kCallNext) { - st->next(x,t, r,g,b,a, dr,dg,db,da); + st->next(x,tail, r,g,b,a, dr,dg,db,da); } } |