aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/opts/SkRasterPipeline_opts.h
Commit message (Collapse)AuthorAge
...
* Added CMYK support for ICC profiles.Gravatar raftias2016-12-01
| | | | | | | | | | | | | | Changed ICC parsing/SkGammas/SkColorLookUpTable to handle non-3-channel inputs. Parsed CMYK A2B ICC profiles. Integrated this with SkJpegCodec (the only file that supports CMYK) and SkColorSpaceXform_A2B to allow parsing and color xforming of ICC CMYK images. CQ_INCLUDE_TRYBOTS=skia.primary:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD Change-Id: I11e3d17180244281be3eb43fd608609925a7f71e Reviewed-on: https://skia-review.googlesource.com/5444 Reviewed-by: Matt Sarett <msarett@google.com> Commit-Queue: Matt Sarett <msarett@google.com>
* Revert "Add RasterPipeline implementation for SkColorSpaceXform"Gravatar Brian Osman2016-12-01
| | | | | | | | | | | This reverts commit dd19ac7d10c7c00dd6e9b1f4c4c6aae729c7e6d4. Reason for revert: ASAN Change-Id: I59aacc092398c4db40696a8343d657a5ad7c0f66 Reviewed-on: https://skia-review.googlesource.com/5448 Commit-Queue: Brian Osman <brianosman@google.com> Reviewed-by: Brian Osman <brianosman@google.com>
* Add RasterPipeline implementation for SkColorSpaceXformGravatar Matt Sarett2016-12-01
| | | | | | | | | | | | | | | | | | | This is initially turned on for Linux debug builds, which allows us to start testing. Chrome for Android is a really good candidate for this (will appreciate the code size savings), but I'd first like to run some tests to understand the performance/size tradeoffs a little better. BUG:660416 CQ_INCLUDE_TRYBOTS=skia.primary:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD Change-Id: I0fb2512216dfc0bda2e5388f9865318eec22291e Reviewed-on: https://skia-review.googlesource.com/5348 Commit-Queue: Mike Klein <mtklein@chromium.org> Reviewed-by: Mike Klein <mtklein@chromium.org>
* Revert "Added CMYK support for ICC profiles."Gravatar Mike Klein2016-12-01
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 51c3fcd376c5c9972d9476b5532f6164375a38d1. Reason for revert: ASAN, MSAN both take issue with parse_and_load_gamma() Original change's description: > Added CMYK support for ICC profiles. > > Changed ICC parsing/SkGammas/SkColorLookUpTable to handle non-3-channel > inputs. Parsed CMYK A2B ICC profiles. Integrated this with SkJpegCodec > (the only file that supports CMYK) and SkColorSpaceXform_A2B to allow > parsing and color xforming of ICC CMYK images. > > BUG=skia: > > GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=5197 > CQ_INCLUDE_TRYBOTS=skia.primary:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD > > > Change-Id: Id6619f63f04071f79cd2d84321857dfa269ad3aa > Reviewed-on: https://skia-review.googlesource.com/5197 > Commit-Queue: Mike Klein <mtklein@chromium.org> > Reviewed-by: Matt Sarett <msarett@google.com> > Reviewed-by: Mike Klein <mtklein@chromium.org> > Reviewed-by: Leon Scroggins <scroggo@google.com> > TBR=mtklein@chromium.org,mtklein@google.com,msarett@google.com,scroggo@google.com,brianosman@google.com,raftias@google.com,reviews@skia.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Change-Id: Ib43fef00bc233c0b4fa47ed29040d69601def267 Reviewed-on: https://skia-review.googlesource.com/5423 Commit-Queue: Mike Klein <mtklein@chromium.org> Reviewed-by: Mike Klein <mtklein@chromium.org>
* Added CMYK support for ICC profiles.Gravatar raftias2016-12-01
| | | | | | | | | | | | | | | | | | | | Changed ICC parsing/SkGammas/SkColorLookUpTable to handle non-3-channel inputs. Parsed CMYK A2B ICC profiles. Integrated this with SkJpegCodec (the only file that supports CMYK) and SkColorSpaceXform_A2B to allow parsing and color xforming of ICC CMYK images. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=5197 CQ_INCLUDE_TRYBOTS=skia.primary:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD Change-Id: Id6619f63f04071f79cd2d84321857dfa269ad3aa Reviewed-on: https://skia-review.googlesource.com/5197 Commit-Queue: Mike Klein <mtklein@chromium.org> Reviewed-by: Matt Sarett <msarett@google.com> Reviewed-by: Mike Klein <mtklein@chromium.org> Reviewed-by: Leon Scroggins <scroggo@google.com>
* 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>
* restore sRGB memset optimizationGravatar Mike Klein2016-11-30
| | | | | | | | | | | | | | | 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 <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>
* teach MSAN about maskloadGravatar Mike Klein2016-11-29
| | | | | | | | | | | | | | | There is a very telling FIXME in the MSAN source code: // FIXME: detect and handle SSE maskstore/maskload For now, just tell MSAN (correctly) that it's initialized. CQ_INCLUDE_TRYBOTS=skia.primary:Test-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Debug-MSAN,Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD Change-Id: I6aec67b99e4d930cb72e438458b33ed116535009 Reviewed-on: https://skia-review.googlesource.com/5311 Commit-Queue: Mike Klein <mtklein@chromium.org> Reviewed-by: Brian Osman <brianosman@google.com>
* gather_i8Gravatar Mike Klein2016-11-29
| | | | | | | | | CQ_INCLUDE_TRYBOTS=skia.primary:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD Change-Id: Ia7a133f515e29e16700aabc0633c77a703425f41 Reviewed-on: https://skia-review.googlesource.com/5239 Reviewed-by: Herb Derby <herb@google.com> Commit-Queue: Mike Klein <mtklein@chromium.org>
* Make gather() look and work more like load().Gravatar Mike Klein2016-11-29
| | | | | | | | | | | | | | | | | They're really similar, so let's make them look that way. Finally use mask load, mask store, and gather instructions for 8888. We avoid mask load and store when tail == 0. It's faster (one memory load instead of two) and a cheap test. For gather, the intrinsics make it look like we could do the same, but it really all boils down to the same masked instruction in the end. There's probably a better way to implement mask() with math instead of memory loads, but this works for now. CQ_INCLUDE_TRYBOTS=skia.primary:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD Change-Id: I578f47d4562ea19d983057bf2f4c3e21d0ab9a0e Reviewed-on: https://skia-review.googlesource.com/5234 Reviewed-by: Herb Derby <herb@google.com> Commit-Queue: Mike Klein <mtklein@chromium.org>
* document x_tail encodingGravatar Mike Klein2016-11-29
| | | | | | | | CQ_INCLUDE_TRYBOTS=skia.primary:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD Change-Id: Id9a6d00e68a7cf7464c6a561bd97e63abf6886c4 Reviewed-on: https://skia-review.googlesource.com/5307 Reviewed-by: Herb Derby <herb@google.com>
* use fma() in accumulateGravatar Mike Klein2016-11-29
| | | | | | | | | Was just reading the disassembly and noticed the opportunity. Change-Id: I25d4b70802f9a9563491f3126da69829611a9b28 Reviewed-on: https://skia-review.googlesource.com/5235 Reviewed-by: Herb Derby <herb@google.com> Commit-Queue: Mike Klein <mtklein@chromium.org>
* 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>
* simplifyGravatar Mike Klein2016-11-28
| | | | | | | | | | | | | | | | | | | | This file is getting complicated. We're still in early days and I want to keep it nimble and easy to refactor. Simplifications: - go back to one stage function type, packing x and tail together in one size_t (x_tail = x*N+tail; x = x_tail/N, tail = x_tail%N, all cheap for power of 2 N); - all stages call next(), ending in just_return; - stop coddling MSVC with kIsTail. These simplifications should all make things a little slower, some only when using subpar compilers. On a positive note, this should cut code size by about half. CQ_INCLUDE_TRYBOTS=skia.primary:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD Change-Id: I7de87c5a3cb0cbbf1e0ed0588f1ccb860a498e66 Reviewed-on: https://skia-review.googlesource.com/5285 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>
* Split srgb out of accum stages.Gravatar Mike Klein2016-11-28
| | | | | | | | | | | | | | | | | | By stashing the scales in the context (i.e. on the stack), we can free up enough registers to really simplify how the bitmap sample stages interact. Nearest neighbor is straightforward now: just call the appropriate gather_ function, and you're done. The source pixels end up in the source registers. If they're sRGB encoded, follow up with from_srgb_s To bilerp, we bracket those 1 or 2 gather+from_srgb_s stages with a stage setting up each corner (x += dx, y += dy, save off scale) and a stage that accumulates into the d-registers (load saved scale, dr += scale * r, etc.). When all the samples are accumulated, copy the d-registers into the s-registers. from_srgb_d and to_srgb are lightly sketched here and will be used in the next CL, where I apply this same factoring to non-bitmap loads and stores. This is a little tricky, because we don't actually have a float->float to_srgb yet. CQ_INCLUDE_TRYBOTS=skia.primary:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD Change-Id: I272a1f278f0ea1b29a2f07ac225f753faa8dae81 Reviewed-on: https://skia-review.googlesource.com/5271 Reviewed-by: Mike Klein <mtklein@chromium.org> Reviewed-by: Herb Derby <herb@google.com> Commit-Queue: Mike Klein <mtklein@chromium.org>
* Fix unpremul stage.Gravatar Mike Klein2016-11-28
| | | | | | | | | | | | | | | | | | The existing invert() logic explodes when a == 0. Less terribly, invert() also does not turn 1.0f into 1.0f, so we now use a float divide. This will cause a small diff in the matrix color filter GM due to increased unpremul precision. There's an alternative to try if this stage turns out to be speed critical: auto scale = (a == 0.0f).thenElse(0.0f, a.invert() * (1.0f / SkNf(1.0f).invert())); The (1.0f / SkNf(1.0f).invert()) bit there is a constant, scaling a bit to make 1.0f produce 1.0f. CQ_INCLUDE_TRYBOTS=skia.primary:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD Change-Id: I9db72eda108d3d28583a4357f90a0dcd7e4d8a6f Reviewed-on: https://skia-review.googlesource.com/5227 Reviewed-by: Mike Reed <reed@google.com>
* Some simple pipeline refactoring.Gravatar Mike Klein2016-11-28
| | | | | | | | | | | | | | | | | | This is a batch of little tweaks that all preserve the existing logical behavior: - rename dst to move_dst_src to parallel move_src_dst - remove unused swap_src_dst - move swap_rb up with the other utility stages - factor out from_8888() to parallel from_565() and from_4444() - factor out gather() from the accum_* stages This changes the order of the math in accum_8888[_srgb] ever so slightly, from (scale * C) * (1/255.0f) to scale * (1/255.0f * C). It causes a few pixel diffs, but nothing noticeable. This makes the 8888 bilerp logic consistent with the other formats, which all convert to [0,1] float first before being scaled. CQ_INCLUDE_TRYBOTS=skia.primary:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD Change-Id: Id37857b91be3086565169dcc9b1a537574e532aa Reviewed-on: https://skia-review.googlesource.com/5226 Reviewed-by: Mike Klein <mtklein@chromium.org> Commit-Queue: Mike Klein <mtklein@chromium.org>
* 4444 and gray 8Gravatar Mike Klein2016-11-22
| | | | | | | | | | GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=5147 CQ_INCLUDE_TRYBOTS=master.client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot Change-Id: Id08804803b2bbeab4fa88538491e99e53d5c2efe Reviewed-on: https://skia-review.googlesource.com/5147 Reviewed-by: Herb Derby <herb@google.com> Commit-Queue: Mike Klein <mtklein@chromium.org>
* Support sRGB 565.Gravatar Mike Klein2016-11-22
| | | | | | | | | | | | | | | It looks like I'm not going to be able to avoid supporting sRGB G8, I8, 565, 4444, 8888. (A8 and F16 will always be linear.) This fixes 565, and lays out the rest of the accum_*. I did a little reorganization to keep things in ascending bit depth, just for sanity. GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=5145 CQ_INCLUDE_TRYBOTS=master.client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot Change-Id: Ib0508e5a4ee1bab2044a76bcabc367841d634cd2 Reviewed-on: https://skia-review.googlesource.com/5145 Reviewed-by: Herb Derby <herb@google.com> Commit-Queue: Mike Klein <mtklein@chromium.org>
* accum_565 and accum_f16Gravatar Mike Klein2016-11-22
| | | | | | | | | | GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=5125 CQ_INCLUDE_TRYBOTS=master.client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot Change-Id: I2e338ae14db0068d9a09e16a0678dd2ee9f97efd Reviewed-on: https://skia-review.googlesource.com/5125 Commit-Queue: Mike Klein <mtklein@chromium.org> Reviewed-by: Herb Derby <herb@google.com>
* bilerpGravatar Mike Klein2016-11-22
| | | | | | | | | GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=5107 Change-Id: I5c30105501cbdb57896d9ec35737494eabd5998b Reviewed-on: https://skia-review.googlesource.com/5107 Reviewed-by: Herb Derby <herb@google.com> Commit-Queue: Mike Klein <mtklein@chromium.org>
* Rearrange NN sampling to more naturally support bilerp.Gravatar Mike Klein2016-11-21
| | | | | | | | | GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=5105 Change-Id: Ic692b5faf2d33fee31b119ff8d3653118b25b7c2 Reviewed-on: https://skia-review.googlesource.com/5105 Reviewed-by: Herb Derby <herb@google.com> Commit-Queue: Mike Klein <mtklein@chromium.org>
* 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>
* mirror tilingGravatar Mike Klein2016-11-18
| | | | | | | | | | GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=5064 CQ_INCLUDE_TRYBOTS=master.client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot Change-Id: I9d48ba73e145701245e5ec4f32c8c360da6baddd Reviewed-on: https://skia-review.googlesource.com/5064 Reviewed-by: Herb Derby <herb@google.com> Commit-Queue: Mike Klein <mtklein@chromium.org>
* perspective matrixGravatar Mike Klein2016-11-17
| | | | | | | | | | | | Nothing too tricky. The path of least resistance was to keep the matrix row-major when in perspective. It should make no difference in the end. GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4983 CQ_INCLUDE_TRYBOTS=master.client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot Change-Id: I48bb9de0265e7873c465874cc37076a8111f5ea1 Reviewed-on: https://skia-review.googlesource.com/4983 Reviewed-by: Herb Derby <herb@google.com> Commit-Queue: Mike Klein <mtklein@chromium.org>
* repeat tilingGravatar Mike Klein2016-11-17
| | | | | | | | | | | | Does the note in repeat() look right? GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4980 CQ_INCLUDE_TRYBOTS=master.client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot Change-Id: I347023f312ab4643fc387e486192c3ae3357db8b Reviewed-on: https://skia-review.googlesource.com/4980 Reviewed-by: Herb Derby <herb@google.com> Commit-Queue: Mike Klein <mtklein@chromium.org>
* Initialize all values we load.Gravatar Mike Klein2016-11-17
| | | | | | | | | | | | | Let's see if this can convince MSAN that we're safe. CQ_INCLUDE_TRYBOTS=master.client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot,Perf-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Debug-MSAN-Trybot GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4971 Change-Id: Ie90124068bc412bee94a4f8e87fae32e4d66e709 Reviewed-on: https://skia-review.googlesource.com/4971 Commit-Queue: Mike Klein <mtklein@chromium.org> Reviewed-by: Herb Derby <herb@google.com>
* Support SkImageShader in SkRasterPipeline blitterGravatar Mike Klein2016-11-17
| | | | | | | | | | | | | | First of many CLs, I'm sure. This handles 8888 or sRGB sources with an affine matrix, clamp/clamp tiling, and nearest-neighbor sampling only. GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4906 CQ_INCLUDE_TRYBOTS=master.client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot Change-Id: I99f7508852b3d44b6f52f7a0bee29a793af35c48 Reviewed-on: https://skia-review.googlesource.com/4906 Reviewed-by: Herb Derby <herb@google.com> Commit-Queue: Mike Klein <mtklein@chromium.org>
* Hook into parametric and table raster pipeline stagesGravatar Matt Sarett2016-11-16
| | | | | | | | | | | | BUG:664864 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4913 CQ_INCLUDE_TRYBOTS=master.client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot Change-Id: I909152f1abba60803f0ce2f970eec1f8f1816d78 Reviewed-on: https://skia-review.googlesource.com/4913 Commit-Queue: Matt Sarett <msarett@google.com> Reviewed-by: Mike Klein <mtklein@chromium.org>
* Add trace and registers stages.Gravatar Mike Klein2016-11-16
| | | | | | | | | | | | | | | Yet more debugging tools. TBR=herb@google.com GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4908 CQ_INCLUDE_TRYBOTS=master.client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot Change-Id: I92e2e6b17abfc32c8d3554e71dbf95abadbb3824 Reviewed-on: https://skia-review.googlesource.com/4908 Commit-Queue: Mike Klein <mtklein@chromium.org> Reviewed-by: Herb Derby <herb@google.com> Reviewed-by: Mike Klein <mtklein@chromium.org>
* add {parametric,table}_{r,g,b} stages.Gravatar Mike Klein2016-11-16
| | | | | | | | | | | | | | Think you can take over from here, hook these into SkColorSpaceXform_A2B, and remove the need for fn_1_{r,g,b}? BUG=skia:664864 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4888 CQ_INCLUDE_TRYBOTS=master.client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot Change-Id: If573fa2861f32f201f4db28598559290b1eef812 Reviewed-on: https://skia-review.googlesource.com/4888 Commit-Queue: Mike Klein <mtklein@chromium.org> Reviewed-by: Matt Sarett <msarett@google.com>
* 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>
* Fix up arguments passed to pipeline.Gravatar Mike Klein2016-11-15
| | | | | | | | | | | | | | | - Add half to (x,y) to get pixel centers. - The x updates were just totally wrong... BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4794 CQ_INCLUDE_TRYBOTS=master.client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot Change-Id: I314489a74b54e2b88f12dd35896452ac0b9718f3 Reviewed-on: https://skia-review.googlesource.com/4794 Reviewed-by: Mike Klein <mtklein@chromium.org> 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>
* Initial implementation of a SkColorSpace_A2B xformGravatar raftias2016-11-11
| | | | | | | | | | | | | | | | There is support for all features of SkColorSpace_A2B. Tests for these functionality were adapted from the XYZ xform, plus a CLUT-specific test was added. Shared functions used by both SkColorSpaceXform_XYZ and SkColorSpaceXform_A2B have been moved into a shared header. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2449243003 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/2449243003
* Give memset lambdas explicit names.Gravatar Mike Klein2016-11-07
| | | | | | | | | | | | | | This makes it a little easier to follow what's going on in a profile. TBR=reed@google.com GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4533 CQ_INCLUDE_TRYBOTS=master.client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot Change-Id: If48bfe6b0fe8fd49309764413fa6765dad118fc5 Reviewed-on: https://skia-review.googlesource.com/4533 Reviewed-by: Mike Klein <mtklein@chromium.org> Commit-Queue: Mike Klein <mtklein@chromium.org>
* swap_src_dst -> move_src_dstGravatar Mike Klein2016-11-04
| | | | | | | | | | | | | | | | | | | We thought it'd be handy to have swap_src_dst so that it could be used either to move dst into src or src into dst. Turns out, we already have a stage that moves dst into src (called "dst", the dst blend mode), so there's really no reason to have swap_src_dst over the strictly more efficient move_src_dst. swap_src_dst is typically 12 register moves, where move_src_dst is 4. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4461 Change-Id: Ib453775f854e313f823851978eaadc3995872312 Reviewed-on: https://skia-review.googlesource.com/4461 Reviewed-by: Matt Sarett <msarett@google.com> Commit-Queue: Mike Klein <mtklein@chromium.org>
* Detect pipelines which can compile to memsets.Gravatar mtklein2016-11-04
| | | | | | | | | | | | Any pipeline that looks like: - constant_color - store_fmt can be trivially converted into an sk_memset of the right size for fmt. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2477013002 Review-Url: https://codereview.chromium.org/2477013002
* 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
* Remove sk_linear_to_srgb_noclamp().Gravatar Mike Klein2016-11-03
| | | | | | | | | | | | | | | | | | | | | We've just re-noticed this can happen: 1) we have a properly premultiplied linear color; 2) we convert that to sRGB; 3) we convert that back to linear; 4) that color does not appear to be premultiplied. Removing sk_linear_to_srgb_noclamp(), and thus always clamping to [0,1] here in linear space, does not fix this problem. However, it does help keep it from propagating too badly. Just double-checked: the older Sk4f pipeline (SkXfermode4f, SkPM4fPriv, etc) already use sk_linear_to_srgb() exclusively, so they're already doing this same clamp. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4314 Change-Id: I6352eb0ba969eb25674e8441e43bb51e1e1c0df3 Reviewed-on: https://skia-review.googlesource.com/4314 Reviewed-by: Yuqian Li <liyuqian@google.com> Commit-Queue: Mike Klein <mtklein@chromium.org>
* 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>
* SkRasterPipeline: implement SkLumaColorFilterGravatar Mike Klein2016-11-01
| | | | | | | | | | | | | | | | | | After getting discouraged by the non-separable xfermodes, I decided to look at filling out the color filters instead. This one's nice and easy. There's only 1 GM that exercises this color filter, and it's drawing noticeably lighter now in f16 and sRGB configs. 565 is unchanged. This makes me think the diffs are due to lost precision in the previous method, which was going through the default fallback to 8888 filterSpan(). I double checked: the f16 config now draws nearly identically to the gpuf16 config. It used to be quite different. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4183 CQ_INCLUDE_TRYBOTS=master.client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot Change-Id: Ic6feaecae5cf18493b5df89733f6a5ca362e9a75 Reviewed-on: https://skia-review.googlesource.com/4183 Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: 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>
* 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>