aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkRasterPipelineBlitter.cpp
Commit message (Collapse)AuthorAge
* move all memset() logic into blitterGravatar Mike Klein2016-12-01
| | | | | | | | | | | It's cute in compile_pipeline(), but as before, clearer and simpler in the blitter. CQ_INCLUDE_TRYBOTS=skia.primary:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD Change-Id: Ib83ff097e4e057e72aed785797e6ac0029ca5dbf Reviewed-on: https://skia-review.googlesource.com/5399 Reviewed-by: Herb Derby <herb@google.com> Commit-Queue: Mike Klein <mtklein@chromium.org>
* fold more in SkRasterPipelineBlitterGravatar Mike Klein2016-11-30
| | | | | | | | | | | No change in behavior. This just moves the responsibility for this optimization to the blitter (which knows what it's doing) rather than to compile_pipeline(), which sort of has to guess. CQ_INCLUDE_TRYBOTS=skia.primary:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD Change-Id: I93ad0ac896075deab995b865b188b42de637f0f7 Reviewed-on: https://skia-review.googlesource.com/5398 Commit-Queue: Mike Klein <mtklein@chromium.org> Reviewed-by: Herb Derby <herb@google.com>
* constant means constantGravatar Mike Klein2016-11-30
| | | | | | | | | | | Strip all the "constant" verbiage out of stages that really just mean 1, single, scalar. CQ_INCLUDE_TRYBOTS=skia.primary:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD Change-Id: I3d71202b348fadc3ced8ecb6c18c939cf92d7243 Reviewed-on: https://skia-review.googlesource.com/5396 Reviewed-by: Herb Derby <herb@google.com> Commit-Queue: Mike Klein <mtklein@chromium.org>
* Bring back SkRasterPipeline::run() for one-off uses.Gravatar Mike Klein2016-11-30
| | | | | | | | | CQ_INCLUDE_TRYBOTS=skia.primary:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD Change-Id: I308b6d75f2987a667eead9a55760a2ff6aec2984 Reviewed-on: https://skia-review.googlesource.com/5353 Commit-Queue: Mike Klein <mtklein@chromium.org> Reviewed-by: Mike Klein <mtklein@chromium.org>
* support a8Gravatar Mike Klein2016-11-29
| | | | | | | | | | | Most of this is plumbing through the full paint to shaders instead of just the filter quality. CQ_INCLUDE_TRYBOTS=skia.primary:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD Change-Id: I6afde07566afa3a4391c24dca7017a9a4f5ec700 Reviewed-on: https://skia-review.googlesource.com/5317 Commit-Queue: Mike Klein <mtklein@chromium.org> Reviewed-by: Mike Reed <reed@google.com>
* Consistent naming.Gravatar Mike Klein2016-11-29
| | | | | | | | | | | | | | | For stages that have {r,g,b,a} and {dr,dg,db,da} versions, name the {r,g,b,a} one "foo" and the {dr,dg,db,da} on "foo_d". The {r,g,b,a} registers are the ones most commonly used and fastest, so they get short ordinary names, and the d-registers are less commonly used and sometimes slower, so they get a suffix. Some stages naturally opearate on all 8 registers (the xfermodes, accumulate). These names for those look fine and aren't ambiguous. Also, a bit more re-arrangement in _opts.h. CQ_INCLUDE_TRYBOTS=skia.primary:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD Change-Id: Ia20029247642798a60a2566e8a26b84ed101dbd0 Reviewed-on: https://skia-review.googlesource.com/5291 Reviewed-by: Mike Klein <mtklein@chromium.org> Commit-Queue: Mike Klein <mtklein@chromium.org>
* Convert blitter over to new style from_srgb, to_srgb.Gravatar Mike Klein2016-11-28
| | | | | | | | | | | Every sRGB GM changes, none noticeably. CQ_INCLUDE_TRYBOTS=skia.primary:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD Change-Id: I632845aea0f40751639cccbcfde8fa270cae0301 Reviewed-on: https://skia-review.googlesource.com/5275 Reviewed-by: Mike Klein <mtklein@chromium.org> Commit-Queue: Mike Klein <mtklein@chromium.org>
* Revert "Revert "make it illegal to include SkXfermode.h""Gravatar Mike Reed2016-11-23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit e9d1b299ccbf8017ba57040986ded638f954684a. Reason for revert: <INSERT REASONING HERE> Original change's description: > Revert "make it illegal to include SkXfermode.h" > > This reverts commit 07764cefbb18041a77897df3453903b0a2016583. > > Reason for revert: breaking google3 > > Original change's description: > > make it illegal to include SkXfermode.h > > > > BUG=skia: > > > > GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=5133 > > > > Change-Id: I6e8596dcb17cd7e8efa67859bb682bf9bfcac4db > > Reviewed-on: https://skia-review.googlesource.com/5133 > > Reviewed-by: Mike Reed <reed@google.com> > > Commit-Queue: Mike Reed <reed@google.com> > > > > TBR=reed@google.com,reviews@skia.org > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > > Change-Id: I136f9e533eb60633c49dffa19b5747d50b6d98a8 > Reviewed-on: https://skia-review.googlesource.com/5196 > Commit-Queue: Greg Daniel <egdaniel@google.com> > Reviewed-by: Greg Daniel <egdaniel@google.com> > TBR=egdaniel@google.com,reviews@skia.org,reed@google.com NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Change-Id: I0b767ce778a4ade83c2f07d5ece486bb46d7712c Reviewed-on: https://skia-review.googlesource.com/5223 Commit-Queue: Mike Reed <reed@google.com> Reviewed-by: Mike Reed <reed@google.com>
* Revert "make it illegal to include SkXfermode.h"Gravatar Greg Daniel2016-11-23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 07764cefbb18041a77897df3453903b0a2016583. Reason for revert: breaking google3 Original change's description: > make it illegal to include SkXfermode.h > > BUG=skia: > > GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=5133 > > Change-Id: I6e8596dcb17cd7e8efa67859bb682bf9bfcac4db > Reviewed-on: https://skia-review.googlesource.com/5133 > Reviewed-by: Mike Reed <reed@google.com> > Commit-Queue: Mike Reed <reed@google.com> > TBR=reed@google.com,reviews@skia.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Change-Id: I136f9e533eb60633c49dffa19b5747d50b6d98a8 Reviewed-on: https://skia-review.googlesource.com/5196 Commit-Queue: Greg Daniel <egdaniel@google.com> Reviewed-by: Greg Daniel <egdaniel@google.com>
* make it illegal to include SkXfermode.hGravatar Mike Reed2016-11-23
| | | | | | | | | | | BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=5133 Change-Id: I6e8596dcb17cd7e8efa67859bb682bf9bfcac4db Reviewed-on: https://skia-review.googlesource.com/5133 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Mike Reed <reed@google.com>
* Simplify shader paint alpha modulation.Gravatar Mike Klein2016-11-21
| | | | | | | | | | | | | | | | | | We don't need to do any of this funky swap, load, srcin nonsense. We've got a perfectly good scale_constant_float stage just perfect to be used instead. While we're at it, we only need to modulate by paint alpha if the paint's not opaque. x*1== x... This puts the (x,y) inputs to shaders in (r,g) where they expect them. It also frees (dr,dg,db,da) for use by the shader. Might be handy for bilerp. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=5100 Change-Id: Ief60c469ecac8300798b67cc68817cc1d127cf17 Reviewed-on: https://skia-review.googlesource.com/5100 Reviewed-by: Mike Klein <mtklein@chromium.org> Reviewed-by: Herb Derby <herb@google.com> Commit-Queue: Mike Klein <mtklein@chromium.org>
* Plumb filter quality into SkShader::appendStages().Gravatar Mike Klein2016-11-17
| | | | | | | | | | | | | We of course need this to know whether or not to bilerp. TBR=herb@google.com GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4932 Change-Id: I5fe6d93c1d36d0d53f566f722960fcafb0d8bc3c Reviewed-on: https://skia-review.googlesource.com/4932 Commit-Queue: Mike Klein <mtklein@chromium.org> Reviewed-by: Mike Klein <mtklein@chromium.org>
* More shader preliminaries / refactoringGravatar Mike Klein2016-11-15
| | | | | | | | | | | | | | | | - thread through ctm - make blitter handle paint modulation instead of each shader TBR=herb@google.com GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4830 CQ_INCLUDE_TRYBOTS=master.client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot Change-Id: I8161e6b3864c4e48e4d47d5ad40a56a13c02fee8 Reviewed-on: https://skia-review.googlesource.com/4830 Reviewed-by: Mike Klein <mtklein@chromium.org> Reviewed-by: Herb Derby <herb@google.com> Commit-Queue: Mike Klein <mtklein@chromium.org>
* Start each pipeline with (x,y) in (dr,dg) registers for the shader.Gravatar Mike Klein2016-11-15
| | | | | | | | | | | | | | | | | | | | | Image shaders need to do some geometry work before sampling the image colors: 1) determine dst coordinates 2) map back to src coordinates 3) tiling Feeding (x,y) through as (dr,dg) registers makes step 1) easy, perhaps trivial, while leaving (r,g,b,a) with their usual meanings, "the color", starting with the paint color. This is easy to tweak into something like (x+0.5, y+0.5, 1) in (dr,dg,db) once this lands. Mostly I just want to get all the uninteresting boilerplate out of the way first. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4791 CQ_INCLUDE_TRYBOTS=master.client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot Change-Id: Ia07815d942ded6672dc1df785caf80a508fc8f37 Reviewed-on: https://skia-review.googlesource.com/4791 Reviewed-by: Herb Derby <herb@google.com> Commit-Queue: Mike Klein <mtklein@chromium.org>
* Make SkSmallAllocator obey the RAII invariants and move to heap structures ↵Gravatar herb2016-11-15
| | | | | | | | | | | | | | | when needed. The biggest change is to the API which allowed code to bypass the destruction invariants. This destruction bypass feature was needed in only one use, and is totally encapsulated using createWithIniterT. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2488523003 Committed: https://skia.googlesource.com/skia/+/d5dc657b8c3ac916f98005dafdedafe02f023449 Committed: https://skia.googlesource.com/skia/+/c18b5f8f57a4efc5d5d1e399ed8bd3bd02c592ab Review-Url: https://codereview.chromium.org/2488523003
* Start hooking shaders into SkRasterPipelineBlitter.Gravatar Mike Klein2016-11-14
| | | | | | | | | | | | | Here first just the simplest, constant-color shaders. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4743 Change-Id: I92c6523660e21a1e2aa353524570230282ba5dfe Reviewed-on: https://skia-review.googlesource.com/4743 Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: Mike Klein <mtklein@chromium.org>
* Revert of Make SkSmallAllocator obey the RAII invariants and be expandable ↵Gravatar mtklein2016-11-13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | (patchset #15 id:280001 of https://codereview.chromium.org/2488523003/ ) Reason for revert: bots crashing / asserting Original issue's description: > Make SkSmallAllocator obey the RAII invariants and move to heap structures when needed. > > The biggest change is to the API which allowed code to bypass the > destruction invariants. This destruction bypass feature was needed in > only one use, and is totally encapsulated using createWithIniterT. > > BUG=skia: > GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2488523003 > > Committed: https://skia.googlesource.com/skia/+/d5dc657b8c3ac916f98005dafdedafe02f023449 > Committed: https://skia.googlesource.com/skia/+/c18b5f8f57a4efc5d5d1e399ed8bd3bd02c592ab TBR=bungeman@google.com,herb@google.com # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia: Review-Url: https://codereview.chromium.org/2494353002
* Make SkSmallAllocator obey the RAII invariants and move to heap structures ↵Gravatar herb2016-11-13
| | | | | | | | | | | | | | when needed. The biggest change is to the API which allowed code to bypass the destruction invariants. This destruction bypass feature was needed in only one use, and is totally encapsulated using createWithIniterT. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2488523003 Committed: https://skia.googlesource.com/skia/+/d5dc657b8c3ac916f98005dafdedafe02f023449 Review-Url: https://codereview.chromium.org/2488523003
* Fix SkModeColorFilter in 565Gravatar Mike Klein2016-11-12
| | | | | | | | | | | | | | | | | It has been incorrectly interpreting its SkColor as sRGB all the time. Now, we plumb through the destintation color space and some scratch space, letting it decide how to interpret its SkColor later when it knows about the dst color space. The scratch space is blitter scoped, which lets this be thread safe (this is much like SkShader::Context). This only corrects the gamma transformation for now. I've kept my previous TODO about gamut transformation. Everything assumes sRGB gamut for now. Shaders will get the same treatement in this pipeline. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4725 Change-Id: I55b0c7d5db9ad8d7dcdd6295c9dac61d10aeaed4 Reviewed-on: https://skia-review.googlesource.com/4725 Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: Mike Klein <mtklein@chromium.org>
* Revert of Make SkSmallAllocator obey the RAII invariants and be expandable ↵Gravatar mtklein2016-11-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (patchset #6 id:100001 of https://codereview.chromium.org/2488523003/ ) Reason for revert: Crashing Mac Perf and Test bots. This is a flaky but extremely likely crash. I've only seen one Mac Perf or Test bot that had this patch that didn't crash. This should be easy to reproduce like this: $ gn gen out --args=is_debug=false $ ninja -C out dm $ out/dm -m xfermodes3 --config gpu This is crashing every time I run it on my laptop, and never when I revert this CL. Building in release and running --config gpu probably don't matter. Original issue's description: > Make SkSmallAllocator obey the RAII invariants and move to heap structures when needed. > > The biggest change is to the API which allowed code to bypass the > destruction invariants. This destruction bypass feature was needed in > only one use, and is totally encapsulated using createWithIniterT. > > BUG=skia: > GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2488523003 > > Committed: https://skia.googlesource.com/skia/+/d5dc657b8c3ac916f98005dafdedafe02f023449 TBR=bungeman@google.com,herb@google.com # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia: Review-Url: https://codereview.chromium.org/2485853005
* Make SkSmallAllocator obey the RAII invariants and move to heap structures ↵Gravatar herb2016-11-09
| | | | | | | | | | | | | when needed. The biggest change is to the API which allowed code to bypass the destruction invariants. This destruction bypass feature was needed in only one use, and is totally encapsulated using createWithIniterT. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2488523003 Review-Url: https://codereview.chromium.org/2488523003
* SkRasterPipelineBlitter: blitAntiH + full coverge --> blitHGravatar Mike Klein2016-11-07
| | | | | | | | | | | BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4442 Change-Id: Iaf3da7b82c1b3a41fe66c83fb5f9ca589f64851f Reviewed-on: https://skia-review.googlesource.com/4442 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Mike Klein <mtklein@chromium.org>
* Call ~SkRasterPipelineBlitter() on early out.Gravatar Mike Klein2016-11-06
| | | | | | | | | | | | | CQ_INCLUDE_TRYBOTS=master.client.skia:Test-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Debug-ASAN-Trybot BUG=skia:5937 TBR=reed@google.com GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4446 Change-Id: Id74b80901e86fc1318d80e4c76cc6076cae9caa8 Reviewed-on: https://skia-review.googlesource.com/4446 Reviewed-by: Mike Klein <mtklein@chromium.org> Commit-Queue: Mike Klein <mtklein@chromium.org>
* skrpb: evaluate color filters for constant shaders once.Gravatar mtklein2016-11-04
| | | | | | | | | | | | | | | | | | | | | | | | | The simplest thing to do here is just run shader+color filter pipeline at construction time to create a new constant color shader (replacing the paint color). This reduces a pipeline like: - constant_color (paint color) - matrix_4x5 - clamp_a - load_d_foo, xfermode, lerp, store_foo to - constant_color (paint color -> matrix_4x5 -> clamp_a) - load_d_foo, xfermode, lerp, store_foo To implement this all, we add a new store_f32 stage that writes SkPM4f, and finally get around to implementing Sk8f::Store4() (store while reinterlacing). Sk4f::Store4() already exists for both SSE and NEON. Next step: reduce simple constant_color -> store pipelines (src mode, full coverage) into non-pipeline memsets. GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2480823002 Review-Url: https://codereview.chromium.org/2480823002
* Basic pipeline blend mode strength reductions:Gravatar Mike Klein2016-11-03
| | | | | | | | | | | | | | | | | | | | - when the shader is opaque, srcover becomes src - don't load dst when blitting in src mode with full coverage - fold coverage into src alpha when in srcover mode It's not obvious that we can fold coverage into src alpha when using a 565 mask, so I've not attempted that. What would we do about alpha? Over all GMs this causes a single 1-bit difference in sRGB mode. No 565 or f16 diffs. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4349 CQ_INCLUDE_TRYBOTS=master.client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot Change-Id: Ib9161f498c4efa6b348ca74522166da64d09a7da Reviewed-on: https://skia-review.googlesource.com/4349 Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: Mike Klein <mtklein@chromium.org>
* Add Matrix colorfilter pipeline stages.Gravatar Mike Klein2016-11-03
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This breaks the color filter down into a couple logical steps: - go to unpremul - apply the 4x5 matrix - clamp to [0,1] - go to premul Because we already have handy premul clamp stages, we swap the order of clamp and premul. This is lossless. While adding our stages to the pipeline, we analyze the matrix to see if we can skip any steps: - we can skip unpremul if the shader is opaque (alphas are all 1 ~~~> we're already unpremul); - we can skip the premul back if the color filter always produces opaque (here, are the inputs opaque and do we keep them that way, but we could also check for an explicit 0 0 0 0 1 alpha row); - we can skip the clamp_0 if the matrix can never produce a value less than 0; - we can skip the clamp_1 if the matrix can never produce a value greater than 1. The only thing that should seem missing is per-pixel alpha checks. We don't do those here, but instead make up for it by operating on 4-8 pixels at a time. We don't split the 4x5 matrix into a 4x4 and 1x4 translate. We could, but when we have FMA (new x86, all ARMv8) we might as well work the translate for free into the FMAs. This makes gm/fadefilter.cpp draw differently in sRGB and F16 modes, bringing them in line with the GPU sRGB and GPU f16 configs. It's unclear to me what was wrong with the old CPU implementation. GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4346 CQ_INCLUDE_TRYBOTS=master.client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot Change-Id: I14082ded8fb8d63354167d9e6b3f8058f840253e Reviewed-on: https://skia-review.googlesource.com/4346 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Mike Klein <mtklein@chromium.org>
* Remove SkImageInfoIsGammaCorrect, etc...Gravatar Brian Osman2016-11-01
| | | | | | | | | | | | | | | | | | | | Our internal definition is (and will continue to be) that anything with a color space is gamma correct. F16 is irrelevant (whether or not we choose to support untagged F16). This makes these helpers less than helpful, and lets us remove them from (public) API. API change is just removal (of unused functions). TBR=reed@google.com BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4228 Change-Id: Ia84a423548bfee14a3ba4a43d6d5b8c4686fb5ff Reviewed-on: https://skia-review.googlesource.com/4228 Commit-Queue: Brian Osman <brianosman@google.com> Reviewed-by: Mike Klein <mtklein@chromium.org>
* Only clamp when we think our math requires it.Gravatar Mike Klein2016-10-27
| | | | | | | | | | | | | | | | | | If we require our inputs are sound, in-gamut, premul colors (a in [0,1], r,g,b in [0,a]) then we should only need to clamp when the math we perform requires it. The safety clamps before each store are paranoia. The main thing this pipeline handles right now that needs clamping is the plus transfermode. This is either used to blend, where the clamp must come after the coverage lerp, or used via a mode color filter, where we have no choice but to clamp right at the end of the color filer. This changes how the mode color filter draws with the plus transfermode. It didn't used to clamp at all. I think this is a bug fix. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4034 Change-Id: I3cbaade2127cc88c8782596f45749c4fe4b0e953 Reviewed-on: https://skia-review.googlesource.com/4034 Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: Mike Klein <mtklein@chromium.org>
* SkRasterPipelineBlitter simplificationsGravatar Mike Klein2016-10-26
| | | | | | | | | | | | | | | | | | | | | The main idea here is to simplify, mainly to reduce the number of SkRasterPipeline objects the blitter holds. - Use SkBlendMode instead of SkXfermode, just store SkBlendMode. - Fuse the shader and color filter together into one SkRasterPipeline during blitter creation. - I noticed all calls to append_load_d() and append_store() now have the same ctx argument, so I folded that through. I'll be following up with more of this sort of refactoring... I think I can fold everything into a single SkRasterPipeline during blitter creation now, but I'll want to make sure I've got my ducks in a row for how that works with pipeline strength reduction (like skipping dst loads when drawing in Src mode). BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4021 Change-Id: I88252ab8ad16f102c71bad871f8b6aec2fc1f226 Reviewed-on: https://skia-review.googlesource.com/4021 Reviewed-by: Herb Derby <herb@google.com> Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Mike Klein <mtklein@chromium.org>
* Convert SkRasterPipeline loads and stores to indirect.Gravatar Mike Klein2016-10-26
| | | | | | | | | | | | | | | This allows us to change the underlying pointer without rebuilding the pipeline, e.g. when moving the blitter from scanline to scanline. The extra overhead when not needed is measurable but small, <2%. We can always add back direct stages later for cases where we know the context pointer will not change. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=3943 Change-Id: I827d7e6e4e67d02dd2802610f898f98c5f36f8cb Reviewed-on: https://skia-review.googlesource.com/3943 Reviewed-by: Herb Derby <herb@google.com> Commit-Queue: Mike Klein <mtklein@chromium.org>
* SkRasterPipeline::compile().Gravatar Mike Klein2016-10-25
| | | | | | | | | | | I'm not yet caching these in the blitter, and speed is essentially unchanged in the bench where I am now building and compiling the pipeline only once. This may not be able to stay a simple std::function after I figure out caching, but for now it's a nice fit. GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=3911 Change-Id: I9545af589f73baf9f17cb4e6ace9a814c2478fe9 Reviewed-on: https://skia-review.googlesource.com/3911 Reviewed-by: Herb Derby <herb@google.com> Commit-Queue: Mike Klein <mtklein@chromium.org>
* Revert[8] "replace SkXfermode obj with SkBlendMode enum in paints"Gravatar reed2016-10-05
| | | | | | | | | | | This reverts commit c245574ba3d0e2ade6c94b2812de3baa383bf4c4. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2396953002 TBR= Review-Url: https://codereview.chromium.org/2396953002
* Revert[7] "replace SkXfermode obj with SkBlendMode enum in paints"Gravatar Mike Reed2016-10-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit Ib4a154cdd5f5d1dcac921ef50d53b79a2d6a1be8. Reason for revert: new assert from 100K bot Original change's description: > Revert[6] "replace SkXfermode obj with SkBlendMode enum in paints" > > - perform version check in CreateProc for XfermodeImageFilter and ArithmeticImageFilter > This reverts commit 3ed485f4249e17abb4b11f5018d03175fd1afb44. > > BUG=skia: > > GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2992 > > Change-Id: Ib4a154cdd5f5d1dcac921ef50d53b79a2d6a1be8 > Reviewed-on: https://skia-review.googlesource.com/2992 > Reviewed-by: Mike Reed <reed@google.com> > Commit-Queue: Mike Reed <reed@google.com> > TBR=reed@google.com,reviews@skia.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Change-Id: I848e5a69c5cd67f2c14889f4f0a346652578c4ff Reviewed-on: https://skia-review.googlesource.com/3023 Commit-Queue: Mike Reed <reed@google.com> Reviewed-by: Mike Reed <reed@google.com>
* Revert[6] "replace SkXfermode obj with SkBlendMode enum in paints"Gravatar Mike Reed2016-10-05
| | | | | | | | | | | | | | - perform version check in CreateProc for XfermodeImageFilter and ArithmeticImageFilter This reverts commit 3ed485f4249e17abb4b11f5018d03175fd1afb44. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2992 Change-Id: Ib4a154cdd5f5d1dcac921ef50d53b79a2d6a1be8 Reviewed-on: https://skia-review.googlesource.com/2992 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Mike Reed <reed@google.com>
* Revert[5] "replace SkXfermode obj with SkBlendMode enum in paints"Gravatar Mike Reed2016-10-04
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit I0fa5c58af428f3da8565465d1219a34ef8417d9a. Reason for revert: failing to deserialize some of the 100K Original change's description: > Revert[4] "replace SkXfermode obj with SkBlendMode enum in paints" > > This reverts commit 2cbcd12281ee807214df094964c584c78932e10b. > > BUG=skia: > > GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2924 > > Change-Id: I0fa5c58af428f3da8565465d1219a34ef8417d9a > Reviewed-on: https://skia-review.googlesource.com/2924 > Reviewed-by: Mike Reed <reed@google.com> > Commit-Queue: Mike Reed <reed@google.com> > TBR=reed@google.com,reviews@skia.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Change-Id: I1805a57eef5ebcac203da5989c8539345ecf806f Reviewed-on: https://skia-review.googlesource.com/2962 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Mike Reed <reed@google.com>
* Revert[4] "replace SkXfermode obj with SkBlendMode enum in paints"Gravatar Mike Reed2016-10-04
| | | | | | | | | | | | | This reverts commit 2cbcd12281ee807214df094964c584c78932e10b. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2924 Change-Id: I0fa5c58af428f3da8565465d1219a34ef8417d9a Reviewed-on: https://skia-review.googlesource.com/2924 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Mike Reed <reed@google.com>
* Revert "Revert "Revert "replace SkXfermode obj with SkBlendMode enum in ↵Gravatar Mike Reed2016-10-03
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | paints""" This reverts commit I86875511a13497112827cbaed1dbd7639e9e3d10. legacy (100K) skp failure Original change's description: > Revert "Revert "replace SkXfermode obj with SkBlendMode enum in paints"" > > This reverts commit ce02e7175872abde3721df9e5d3ec0ab8384cd8e. > > BUG=skia: > > GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2878 > > Change-Id: I86875511a13497112827cbaed1dbd7639e9e3d10 > Reviewed-on: https://skia-review.googlesource.com/2878 > Reviewed-by: Matt Sarett <msarett@google.com> > Commit-Queue: Mike Reed <reed@google.com> > TBR=msarett@google.com,reed@google.com,reviews@skia.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Change-Id: Ife6f0cf3a22b3e8cf885a188f7f44e1ff62e06a5 Reviewed-on: https://skia-review.googlesource.com/2881 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Mike Reed <reed@google.com>
* Revert "Revert "replace SkXfermode obj with SkBlendMode enum in paints""Gravatar Mike Reed2016-10-03
| | | | | | | | | | | | | This reverts commit ce02e7175872abde3721df9e5d3ec0ab8384cd8e. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2878 Change-Id: I86875511a13497112827cbaed1dbd7639e9e3d10 Reviewed-on: https://skia-review.googlesource.com/2878 Reviewed-by: Matt Sarett <msarett@google.com> Commit-Queue: Mike Reed <reed@google.com>
* Revert "replace SkXfermode obj with SkBlendMode enum in paints"Gravatar Mike Reed2016-10-03
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit I4fb489ba6b3f77b458f7e4a99f79c7ad10859135. Reason for revert: <INSERT REASONING HERE> Original change's description: > replace SkXfermode obj with SkBlendMode enum in paints > > BUG=skia:5814 > > GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2714 > > Change-Id: I4fb489ba6b3f77b458f7e4a99f79c7ad10859135 > Reviewed-on: https://skia-review.googlesource.com/2714 > Reviewed-by: Florin Malita <fmalita@chromium.org> > Reviewed-by: Brian Salomon <bsalomon@google.com> > Commit-Queue: Mike Reed <reed@google.com> > TBR=bsalomon@google.com,fmalita@chromium.org,fmalita@google.com,reed@google.com,reviews@skia.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Change-Id: I3e43f79ef5c1709929663fe63cc1f67cd78270b7 Reviewed-on: https://skia-review.googlesource.com/2871 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Mike Reed <reed@google.com>
* replace SkXfermode obj with SkBlendMode enum in paintsGravatar Mike Reed2016-10-03
| | | | | | | | | | | | BUG=skia:5814 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2714 Change-Id: I4fb489ba6b3f77b458f7e4a99f79c7ad10859135 Reviewed-on: https://skia-review.googlesource.com/2714 Reviewed-by: Florin Malita <fmalita@chromium.org> Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Mike Reed <reed@google.com>
* Add an enum layer of indirection for stock raster pipeline stages.Gravatar Mike Klein2016-09-29
| | | | | | | | | | | | | | | | | | 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>
* Start moving SkRasterPipeline stages to SkOpts.Gravatar Mike Klein2016-09-29
| | | | | | | | | | | | | | | | | | | | This lets them pick up runtime CPU specializations. Here I've plugged in SSE4.1. This is still one of the N prelude CLs to full 8-at-a-time AVX. I've moved the union of the stages used by SkRasterPipelineBench and SkRasterPipelineBlitter to SkOpts... they'll all be used by the blitter eventually. Picking up SSE4.1 specialization here (even still just 4 pixels at a time) is a significant speedup, especially to store_srgb(), so much that it's no longer really interesting to compare against the fused-but-default-instruction-set version in the bench. So that's gone now. That left the SkRasterPipeline unit test as the only other user of the EasyFn simplified interface to SkRasterPipeline. So I converted that back down to the bare-metal interface, and EasyFn and its friends became SkRasterPipeline_opts.h exclusive abbreviations (now called Kernel_Sk4f). This isn't really unexpected: SkXfermode also wanted to build up its own little abstractions, and once you build your own abstraction, the value of an additional EasyFn-like layer plummets to negative. For simplicity I've left the SkXfermode stages alone, except srcover() which was always part of the blitter. No particular reason except keeping the churn down while I hack. These _can_ be in SkOpts, but don't have to be until we go 8-at-a-time. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2752 CQ_INCLUDE_TRYBOTS=master.client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot Change-Id: I3b476b18232a1598d8977e425be2150059ab71dc Reviewed-on: https://skia-review.googlesource.com/2752 Reviewed-by: Mike Klein <mtklein@chromium.org> Commit-Queue: Mike Klein <mtklein@chromium.org>
* SkRasterPipeline: fuse clamp_01 into stores.Gravatar Mike Klein2016-09-28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a less generally applicable trick than I have previously hoped. The need to thread through contexts into each stage really means you can only include one context-dependent stage in each fused batch. We can still manually fuse these, of course, as you can see in SkRasterPipelineBench. It's just that we can't really write a generic compile-time template to do it except for context-free stages. And since we can't write a generic version, and I have only this one specific use case right now, I've kept it quite specific to that use case. This does work pretty well for this use case, though. Here's the fused clamp-then-store-565: +0x00 pushq %rbp +0x01 movq %rsp, %rbp +0x04 movq 8(%rdi), %rax +0x08 xorps %xmm4, %xmm4 +0x0b maxps %xmm4, %xmm3 +0x0e maxps %xmm4, %xmm0 +0x11 maxps %xmm4, %xmm1 +0x14 maxps %xmm4, %xmm2 +0x17 minps 4262818(%rip), %xmm3 +0x1e minps %xmm3, %xmm0 +0x21 minps %xmm3, %xmm1 +0x24 minps %xmm3, %xmm2 +0x27 movaps 4965378(%rip), %xmm3 +0x2e mulps %xmm3, %xmm0 +0x31 cvtps2dq %xmm0, %xmm0 +0x35 pslld $11, %xmm0 +0x3a mulps 4965375(%rip), %xmm1 +0x41 cvtps2dq %xmm1, %xmm1 +0x45 pslld $5, %xmm1 +0x4a mulps %xmm3, %xmm2 +0x4d cvtps2dq %xmm2, %xmm2 +0x51 orpd %xmm0, %xmm2 +0x55 orpd %xmm1, %xmm2 +0x59 pshufb 4474510(%rip), %xmm2 +0x62 movq %xmm2, (%rax,%rsi,2) +0x67 popq %rbp +0x68 retq BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2745 Change-Id: Ia7d66aecc6cbff154158d2600d7874feed1a76f6 Reviewed-on: https://skia-review.googlesource.com/2745 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Mike Klein <mtklein@chromium.org>
* Rearrange SkRasterPipeline scanline tail handling.Gravatar Mike Klein2016-09-28
| | | | | | | | | | | | | | | | | | | We used to step at a 4-pixel stride as long as possible, then run up to 3 times, one pixel at a time. Now replace those 1-at-a-time runs with a single tail stamp if there are 1-3 remaining pixels. This style is simply more efficient: e.g. we'll blend and lerp once for 3 pixels instead of 3 times. This should make short blits significantly more efficient. It's also more future-oriented... AVX+ on Intel and SVE on ARM support masked loads and stores, so we can do the entire tail in one direct step. This also makes it possible to re-arrange the code a bit to encapsulate each stage better. I think generally this code reads more clearly than the old code, but YMMV. I've arranged things so you write one function, but it's compiled into two specializations, one for tail=0 (Body) and one for tail>0 (Tail). It's pretty tidy. For now I've just burned a register to pass around tail. It's 2 bits now, maybe soon 3 with AVX, and capped at 4 for even the craziest new toys, so there are plenty of places we can pack it if we want to get clever. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2717 Change-Id: I45852a3e5d4c5b5e9315302c46601aee0d32265f Reviewed-on: https://skia-review.googlesource.com/2717 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Mike Klein <mtklein@chromium.org>
* SkRasterPipeline: add last() and docs.Gravatar Mike Klein2016-09-27
| | | | | | | | | | | | | | | | | | | Today if you use the simple SK_RASTER_STAGE interface to build a pipeline, each stage you add calls into a next stage. The last stage you add calls into a special backstop stage JustReturn that, well, just returns, ending the pipeline. This adds last(), which cuts that last stage off the pipeline. Instead, the stage you add using last() returns directly, ending the pipeline itself without jumping into JustReturn. This reduces the overhead of using the pipelined version of SkRasterPipelineBench from ~25% to ~20% on my desktop. Also, add docs. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2713 Change-Id: I11469378e2765c6e34db52eb3eef648d6612da3f Reviewed-on: https://skia-review.googlesource.com/2713 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Mike Klein <mtklein@chromium.org>
* Flush denorm half floats to zero.Gravatar mtklein2016-08-22
| | | | | | | | | | | | | | | | | | I think we convinced ourselves that denorms, while a good chunk of half floats, cover a rather small fraction of the representable range, which is always close enough to zero to flush. This makes both paths of the conversion to or from float considerably simpler. These functions now work for zero-or-normal half floats (excluding infinite, NaN). I'm not aware of a term for this class so I've called them "ordinary". A handful of GMs and SKPs draw differently in --config f16, but all imperceptibly. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2256023002 Review-Url: https://codereview.chromium.org/2256023002
* SkRasterPipeline: new APIs for fusionGravatar mtklein2016-07-29
| | | | | | | | | | | | | | | | | | | Most visibly this adds a macro SK_RASTER_STAGE that cuts down on the boilerplate of defining a raster pipeline stage function. Most interestingly, SK_RASTER_STAGE doesn't define a SkRasterPipeline::Fn, but rather a new type EasyFn. This function is always static and inlined, and the details of interacting with the SkRasterPipeline::Stage are taken care of for you: ctx is just passed as a void*, and st->next() is always called. All EasyFns have to do is take care of the meat of the work: update r,g,b, etc. and read and write from their context. The really neat new feature here is that you can either add EasyFns to a pipeline with the new append() functions, _or_ call them directly yourself. This lets you use the same set of pieces to build either a pipelined version of the function or a custom, fused version. The bench shows this off. On my desktop, the pipeline version of the bench takes about 25% more time to run than the fused one. The old approach to creating stages still works fine. I haven't updated SkXfermode.cpp or SkArithmeticMode.cpp because they seemed just as clear using Fn directly as they would have using EasyFn. If this looks okay to you I will rework the comments in SkRasterPipeline to explain SK_RASTER_STAGE and EasyFn a bit as I've done here in the CL description. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2195853002 Review-Url: https://codereview.chromium.org/2195853002
* SkNx: add Sk4uGravatar mtklein2016-07-29
| | | | | | | | | | This lets us get at logical >> in a nicely principled way. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2197683002 CQ_INCLUDE_TRYBOTS=master.client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot Review-Url: https://codereview.chromium.org/2197683002
* Add Sk4h_load4 for loading F16.Gravatar mtklein2016-07-26
| | | | | | | | | | | | | | Should feel very similar to Sk4h_store4: NEON uses its native instruction, SSE unpacks manually. Since we'll have our F16s in 4 Sk4h by the time we're done here, this also extracts an Sk4h->Sk4f routine from the old uint64_t->Sk4f one. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2184753002 CQ_INCLUDE_TRYBOTS=master.client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot Review-Url: https://codereview.chromium.org/2184753002
* Have SkRasterPipelineBlitter take over for F16 when it can.Gravatar mtklein2016-07-25
| | | | | | | | | 3 minor diffs to a couple GMs from fixed transfermodes (arithmetic and plus). BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2181033002 Review-Url: https://codereview.chromium.org/2181033002