From 94528981c8f668280fd56aea75fd720078f4ea3c Mon Sep 17 00:00:00 2001 From: Mike Klein Date: Wed, 30 Nov 2016 09:55:08 -0500 Subject: restore sRGB memset optimization https://skia-review.googlesource.com/c/5275/ removed it, and perf noticed. This is obviously not very pretty or scalable. I plan to folow up with a more thorough and principled way to do this sort of constant-color + invariant-stage == constant-color optimization. BUG=skia:6013 CQ_INCLUDE_TRYBOTS=skia.primary:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD Change-Id: I377386f67e66169cce6e0cb0831f3b7154496840 Reviewed-on: https://skia-review.googlesource.com/5338 Commit-Queue: Mike Klein Reviewed-by: Mike Klein --- src/opts/SkRasterPipeline_opts.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src') diff --git a/src/opts/SkRasterPipeline_opts.h b/src/opts/SkRasterPipeline_opts.h index a40fe6c72e..163b9ebbf0 100644 --- a/src/opts/SkRasterPipeline_opts.h +++ b/src/opts/SkRasterPipeline_opts.h @@ -897,6 +897,29 @@ namespace SK_OPTS_NS { default: break; } } + if (nstages == 3 && stages[0].stage == SkRasterPipeline::constant_color + && stages[1].stage == SkRasterPipeline::to_srgb + && stages[2].stage == SkRasterPipeline::store_8888) { + auto src = (const SkPM4f*)stages[0].ctx; + auto dst = (uint32_t**)stages[2].ctx; + return Memset32{dst, Sk4f_toS32(src->to4f())}; + } + if (nstages == 4 && stages[0].stage == SkRasterPipeline::constant_color + && stages[1].stage == SkRasterPipeline::to_srgb + && stages[2].stage == SkRasterPipeline::swap_rb + && stages[3].stage == SkRasterPipeline::store_8888) { + auto src = (const SkPM4f*)stages[0].ctx; + auto dst = (uint32_t**)stages[3].ctx; + return Memset32{dst, Sk4f_toS32(swizzle_rb(src->to4f())) }; + } + if (nstages == 4 && stages[0].stage == SkRasterPipeline::constant_color + && stages[1].stage == SkRasterPipeline::swap_rb + && stages[2].stage == SkRasterPipeline::to_srgb + && stages[3].stage == SkRasterPipeline::store_8888) { + auto src = (const SkPM4f*)stages[0].ctx; + auto dst = (uint32_t**)stages[3].ctx; + return Memset32{dst, Sk4f_toS32(swizzle_rb(src->to4f())) }; + } struct Compiled { Compiled(const SkRasterPipeline::Stage* stages, int nstages) { -- cgit v1.2.3