Commit Graph

16815 Commits

Author SHA1 Message Date
Leon Scroggins III
33deb7ed4d Make SkCodec more flexible about its required frame
SkCodec sets fRequiredFrame to be the earliest possible frame that a
given frame can depend on. e.g.

- Frame A fills the screen, Keep
- Frame B does not cover A, Keep
- Frame C covers B but not A, and is opaque

Frame C can depend on either A or B. SkCodec already reports that C
depends on A. This CL allows a client of SkCodec to use either A or
B to create C.

Also expose the DisposalMethod. Since any frame between A and C can
be used to create C except for DisposePrevious frames, the client
needs to be able to know the disposal method so they do not try to
use such a frame to create C.

Further, the disposal method can be used to give the client a better
idea whether they will continue to need a frame. (e.g. if frame i is
DisposePrevious and depends on i-1, the client may not want to steal
i-1 to create i, since i+1 may also depend on i-1.)

TODO: Share code for decoding prior frames between GIF and WEBP

Change-Id: I91a5ae22ba3d8dfbe0bde833fa67ae3da0d81ed6
Reviewed-on: https://skia-review.googlesource.com/13722
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Chris Blume <cblume@chromium.org>
Reviewed-by: Matt Sarett <msarett@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
2017-06-07 20:15:17 +00:00
Hal Canary
fa2a26a026 SkPDF: Do draw{Image,Bitmap}Rect with maskfilter.
https://fiddle.skia.org/c/@skbug_237_drawImageRect

BUG=skia:237
Change-Id: I4d6d683fcbfd6dc86a27998e3d03534458952db0
Reviewed-on: https://skia-review.googlesource.com/19023
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
2017-06-07 19:30:05 +00:00
Florin Malita
a924dd3b7e Use burst mode for linear gradients w/ > 2 stops
Change-Id: I4c2778ca9a004ae8b45362e11cb15ac7703c18ac
Reviewed-on: https://skia-review.googlesource.com/19022
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2017-06-07 19:11:01 +00:00
Chris Dalton
46983b7dd8 Introduce dynamic pipeline state
Adds a DynamicState struct to GrPipeline that has a field for the
scissor rect. Eventually this should become the only way to specify a
scissor rectangle and may grow to contain more fields. Adds an array of
DynamicStates to GrGpuCommandBuffer::draw and implements support in GL
and Vulkan.

Bug: skia:
Change-Id: If5aebbf9da5d192acf7e68e7def4674ffc7ec310
Reviewed-on: https://skia-review.googlesource.com/18510
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2017-06-07 18:26:11 +00:00
Matt Sarett
912e6b8837 Reland "Handle different types of streams in different jpeg source managers"
For streams that are memory backed (stream->getMemoryBase() returns
a non-null ptr and hasLength() returns true), handle the stream
with skjpeg_mem_source_mgr, which directly assigns memory base to
the source manager.  For other non memory backed streams, handle the
stream with skjpeg_buffered_source_mgr, which is renamed from
the old skjpeg_source_mgr with no implementation change.

Original Author: cjbao <cathy.bao@intel.com>
https://skia-review.googlesource.com/c/17296/

Bug: skia:
Change-Id: I0885c5114083f976a9c08afe5954434196762e39
Reviewed-on: https://skia-review.googlesource.com/18933
Reviewed-by: Mike Klein <mtklein@chromium.org>
Reviewed-by: Leon Scroggins <scroggo@google.com>
Commit-Queue: Matt Sarett <msarett@google.com>
2017-06-07 18:19:29 +00:00
Mike Reed
65cfb5ecbc disable coverage optimization for hairlines
The coverage blitter is an optimization of regular blitting to A8.
It can go faster because it never tries to blend with itself... because
it was intended to be called only by fill-path, which is written to
never draw twice in the same place. Hairlines don't make this promise,
so we can use the coverage optimization for hairlines.

Change-Id: I0a4816f886462017ad81378d5928357ef038ae8f
Reviewed-on: https://skia-review.googlesource.com/18666
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2017-06-07 17:34:14 +00:00
Robert Phillips
5ab7276a35 Suppress rendererability of kAlpha8 GL_CHROMIUM_framebuffer_multisample for ANGLE D3D9
For ANGLE D3D9 ES2 we're seeing GL_CHROMIUM_framebuffer_multisample but not GL_ANGLE_framebuffer_multisample.
The same occurs for ANGLE D3D11 ES2 but kAlpha8 is renderable in that case.

Bug: 730082
Change-Id: I7eda844b0ad48150d19406517d1dfbe453e9e478
Reviewed-on: https://skia-review.googlesource.com/18980
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2017-06-07 17:27:54 +00:00
Leon Scroggins III
91f0f7332f Fix alpha issues in SkGifCodec
- Call conversion_possible with the proper alpha type for the frame.
- Always use kUnpremul for the transform. Previously we used the alpha
  type for the first frame. If it was opaque and a later frame was not,
  this would be incorrect.

Also fix Codec_frames test. Most of the tests were not running due to
a return statement in a loop. Change that to continue, and correct
errors in the test. Provide better debugging information.

Change-Id: Icd40c09526b1d599168bfe90d93d8ddcdd9ca20f
Reviewed-on: https://skia-review.googlesource.com/18935
Reviewed-by: Matt Sarett <msarett@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
2017-06-07 15:43:07 +00:00
Brian Osman
fd7819c5d8 Revert "Handle too many (or too large) paths in GrDefaultPathRenderer"
This reverts commit 6383b29848.

Reason for revert: Test failures

Original change's description:
> Handle too many (or too large) paths in GrDefaultPathRenderer
> 
> PathGeoBuilder constructs the geometry with the same basic
> technique as before, but allows interrupting the process
> to emit multiple draws.
> 
> Original test case was 2000 non-AA stroked circles, which
> created ~66000 vertices. That now renders, as do various
> tests with a single large path (as well as filled paths).
> 
> TODO: I think that this could be extracted and re-used for
> MSAA path renderer without too much work? I need to read
> that code more carefully to make sure it lines up.
> 
> Bug: skia:6695
> Change-Id: I18983ba3d4f475ae0651946958b4911008aa623f
> Reviewed-on: https://skia-review.googlesource.com/18360
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Brian Osman <brianosman@google.com>

TBR=bsalomon@google.com,robertphillips@google.com,brianosman@google.com
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:6695

Change-Id: I78ce9879a2e45e19f53027ca506cc2e8fae664b3
Reviewed-on: https://skia-review.googlesource.com/18981
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2017-06-07 14:43:29 +00:00
Brian Osman
b53f48cfec Touch input support for Windows
Had to add some logic to avoid touch and mouse cross-talk, because
(at least on my laptop), the touch screen generates both kinds of
events.

This seems really useful [1] for the many [2] Skia developers with
touch-enabled Windows devices.

----------
1: No, not really.
2: N = 1?

Bug: skia:
Change-Id: Ib888bf4198f2cc0a29a31581ec4b64d3d9008c33
Reviewed-on: https://skia-review.googlesource.com/18920
Reviewed-by: Yuqian Li <liyuqian@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2017-06-07 14:27:09 +00:00
Brian Osman
2e425ebd95 Fix use of uninitialized value in SkColor4Shader::CreateProc
Bug: chromium:727678
Change-Id: I4c59d9222d47b866b3c30408322ec456f304aa53
Reviewed-on: https://skia-review.googlesource.com/18938
Commit-Queue: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>
Reviewed-by: Mike Klein <mtklein@chromium.org>
2017-06-07 14:21:19 +00:00
Brian Osman
6383b29848 Handle too many (or too large) paths in GrDefaultPathRenderer
PathGeoBuilder constructs the geometry with the same basic
technique as before, but allows interrupting the process
to emit multiple draws.

Original test case was 2000 non-AA stroked circles, which
created ~66000 vertices. That now renders, as do various
tests with a single large path (as well as filled paths).

TODO: I think that this could be extracted and re-used for
MSAA path renderer without too much work? I need to read
that code more carefully to make sure it lines up.

Bug: skia:6695
Change-Id: I18983ba3d4f475ae0651946958b4911008aa623f
Reviewed-on: https://skia-review.googlesource.com/18360
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2017-06-07 14:20:39 +00:00
Brian Salomon
b52fa02227 Limit Adreno 4xx stencil clear workaround to older drivers
Bug: skia:5587
Change-Id: I00f377c06228deb9053b1cf7d9f413e0bf2fb490
Reviewed-on: https://skia-review.googlesource.com/18936
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2017-06-07 14:04:10 +00:00
Mike Klein
b15ef6f149 we can std::move work to avoid copying it
clang-tidy pointed out this opportunity in the Google3 build.

Change-Id: Id3c7b291fec12cbf860e7fc2583c1a34ad23f697
Reviewed-on: https://skia-review.googlesource.com/18927
Reviewed-by: Yuqian Li <liyuqian@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>
2017-06-07 13:45:10 +00:00
Kevin Lubick
4ed5dac522 Mark SkThreadedBMPDevice destructors with override
Very new versions of Clang (5.0 TOT) call out this problem.

Bug: skia:
Change-Id: Ie86d3936c26769c0d3387a81fd2c247ea1272d1c
Reviewed-on: https://skia-review.googlesource.com/18930
Commit-Queue: Mike Klein <mtklein@chromium.org>
Reviewed-by: Mike Klein <mtklein@chromium.org>
2017-06-07 13:02:18 +00:00
Mike Klein
72f1a4565c we can move dst here
clang-tidy pointed out this opportunity in the Google3 build.

Change-Id: I2ab01602fae2d3132a229006c06625371342e18a
Reviewed-on: https://skia-review.googlesource.com/18926
Commit-Queue: Matt Sarett <msarett@google.com>
Reviewed-by: Matt Sarett <msarett@google.com>
2017-06-07 12:41:43 +00:00
Stephen White
3b5a3fa8b1 GrTessellator: implement out-of-range splitting and AEL rewinding.
Due to floating point inaccuracy, when intersecting edges, the
intersection point may fall above one of the edges' top vertices
or below one of the bottom vertices.  In these cases, we were simply
splitting one edge on the relevant endpoint of the other edge. This
is incorrect if the intersection is far from the endpoint (e.g.,
the test case in the linked bug, where one of the intersected edges
is near-horizontal but the intersection falls below both of its
endpoints, in the middle of the edge.)

The correct solution is to split both edges as normal, and take care
to produce edges with the correct ordering where the intersection is
above or below an edge. However, since the new vertex may be above
the current vertex, simply restarting intersection checks at the
current vertex won't work. We need to process the intersection
vertex before the current one.

This introduces another problem: unlike all other splitting modes
(which always shorten edges), splitting an edge above the top or 
below the bottom can lengthen it, causing it to violate the AEL 
with an adjacent edge which then shortens it back to the original 
point (in cleanup_active_edges()). Since the splitting and merging 
code can't agree, we loop forever.

Instead of simply fusing neighboring edges in cleanup_active_edges(), 
the proper fix to this problem is to detect the AEL violation and 
rewind all processing to the vertex above it. For performance, we 
only rewind when we detect that a split edge is no longer ordered 
within the mesh (merge_enclosing_edges()) or within the the AEL 
(rewind_if_necessary()).  We also store the enclosing edges of each 
vertex, which allows us to rewind quickly, since we know exactly which 
edges need to be added/removed from the AEL.

cleanup_active_edges(), fix_active_state() and Vertex::fProcessed have
been removed. In their place are rewind_active_edges() and 
rewind_if_necessary(), which uses the same logic as 
cleanup_active_edges() but uses it to know when to rewind.

Bug: skia:5026
Change-Id: I3638a429f5428498d6df6bb7b98c67374dc291aa
Reviewed-on: https://skia-review.googlesource.com/18900
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2017-06-07 00:09:15 +00:00
Mike Klein
31550dbc98 Revert "Revert "Workaround Adreno driver issue with stencil clears.""
This reverts commit 8b06ed7c9f.

Reason for revert: try again.

Original change's description:
> Revert "Workaround Adreno driver issue with stencil clears."
> 
> This reverts commit 4e8c581f2a.
> 
> Reason for revert: breaks Google3 roll
> 
> Original change's description:
> > Workaround Adreno driver issue with stencil clears.
> > 
> > This also removes the "debug wire rect" which was not used and not implemented for Vulkan.
> > 
> > Also some declared but not implemented methods are removed from GrGLGpu.
> > 
> > Bug: skia:5587
> > 
> > Change-Id: I750051e90e6cfbfad6a6fe20792226182f698bcf
> > Reviewed-on: https://skia-review.googlesource.com/18639
> > Reviewed-by: Chris Dalton <csmartdalton@google.com>
> > Commit-Queue: Brian Salomon <bsalomon@google.com>
> 
> TBR=bsalomon@google.com,csmartdalton@google.com
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:5587
> 
> Change-Id: I65aa16b3f8c70cdef56ff16e16304ba09604c475
> Reviewed-on: https://skia-review.googlesource.com/18924
> Reviewed-by: Mike Klein <mtklein@google.com>
> Commit-Queue: Mike Klein <mtklein@google.com>

TBR=mtklein@google.com,bsalomon@google.com,reviews@skia.org,csmartdalton@google.com
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:5587

Change-Id: Ice49027bda1c1ff7e0362d0680341ac862159850
Reviewed-on: https://skia-review.googlesource.com/18928
Reviewed-by: Mike Klein <mtklein@google.com>
2017-06-06 23:32:28 +00:00
Mike Klein
8b06ed7c9f Revert "Workaround Adreno driver issue with stencil clears."
This reverts commit 4e8c581f2a.

Reason for revert: breaks Google3 roll

Original change's description:
> Workaround Adreno driver issue with stencil clears.
> 
> This also removes the "debug wire rect" which was not used and not implemented for Vulkan.
> 
> Also some declared but not implemented methods are removed from GrGLGpu.
> 
> Bug: skia:5587
> 
> Change-Id: I750051e90e6cfbfad6a6fe20792226182f698bcf
> Reviewed-on: https://skia-review.googlesource.com/18639
> Reviewed-by: Chris Dalton <csmartdalton@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>

TBR=bsalomon@google.com,csmartdalton@google.com
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:5587

Change-Id: I65aa16b3f8c70cdef56ff16e16304ba09604c475
Reviewed-on: https://skia-review.googlesource.com/18924
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2017-06-06 22:12:48 +00:00
Chris Dalton
a88da48436 Fix invalid assert in GrMesh::setIndexed
When drawing a single point it's valid for the first and last indices
to be equal.

Bug: skia:6728
Change-Id: Ice8cd89b306ed9564cdd9a77c557628662e18abb
Reviewed-on: https://skia-review.googlesource.com/18904
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2017-06-06 21:24:43 +00:00
Christopher Dalton
7f5af0c283 Use more stable root finding methods for cubics
Applies the quadratic formula from "Numerical Recipes in C",
Section 5.6, to the homogeneous quadratic equations that find cubic
inflection points and loop intersections. Also addresses KLM
orientation ahead of time, rather than negating K and L after the
fact.

Bug: skia:
Change-Id: Ic7e0818e2fe49b7724f9b583bae52281cfb1aea1
Reviewed-on: https://skia-review.googlesource.com/13481
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Cary Clark <caryclark@google.com>
2017-06-06 20:53:16 +00:00
Brian Salomon
4e8c581f2a Workaround Adreno driver issue with stencil clears.
This also removes the "debug wire rect" which was not used and not implemented for Vulkan.

Also some declared but not implemented methods are removed from GrGLGpu.

Bug: skia:5587

Change-Id: I750051e90e6cfbfad6a6fe20792226182f698bcf
Reviewed-on: https://skia-review.googlesource.com/18639
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2017-06-06 19:36:31 +00:00
Florin Malita
47e55a5115 Opt-in burst mechanism for pipeline shaders
Add a dedicated virtual for shaders to select burst mode.

Enabled for linear gradients with more than 8 stops, as a start.

BUG=skia:6710

Change-Id: I1b19124f42d1d805de27a5db6a26601c386bb9ff
Reviewed-on: https://skia-review.googlesource.com/18628
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Mike Klein <mtklein@chromium.org>
2017-06-06 18:51:59 +00:00
Matt Sarett
15f4d02738 Revert "Handle different types of streams in different jpeg source managers"
This reverts commit 96cc36124d.

Reason for revert: I think this is break one of our test bots.  I will reland once that is figured out.

Original change's description:
> Handle different types of streams in different jpeg source managers
> 
> For streams that are memory backed (stream->getMemoryBase() returns
> a non-null ptr and hasLength() returns true), handle the stream
> with skjpeg_mem_source_mgr, which directly assigns memory base to
> the source manager.  For other non memory backed streams, handle the
> stream with skjpeg_buffered_source_mgr, which is renamed from
> the old skjpeg_source_mgr with no implementation change.
> 
> Signed-off-by: cjbao <cathy.bao@intel.com>
> Bug: skia:
> Change-Id: I748de0bdba726bbb318922c08497135e73e37329
> Reviewed-on: https://skia-review.googlesource.com/17296
> Reviewed-by: Leon Scroggins <scroggo@google.com>
> Reviewed-by: Matt Sarett <msarett@google.com>
> Commit-Queue: Matt Sarett <msarett@google.com>
> 

TBR=msarett@google.com,scroggo@google.com,cathy.bao@intel.com
# Not skipping CQ checks because original CL landed > 1 day ago.
Bug: skia:

Change-Id: Idf6c426468cc959b3f4661c0b3e86cb4d5e93688
Reviewed-on: https://skia-review.googlesource.com/18850
Reviewed-by: Matt Sarett <msarett@google.com>
Commit-Queue: Matt Sarett <msarett@google.com>
2017-06-06 18:20:40 +00:00
Mike Klein
1dda8bbf46 use smarter float -> skfixed15 logic everywhere
This is the same logic from constant_color, covering all  the other
places where we convert from float to fixed, e.g. scale_1_float.

This isn't quite ideal yet.  We replace mulss+cvttss2si for addss+movd,
which is great, but this leads to a silly sequence of code:

    addss   %xmm2, %xmm0
    movd    %xmm0, %r9d
    movd    %r9d,  %xmm0
    pshuflw $0x0,  %xmm0, %xmm0

Those two movd are pointless...

Again, all diffs due to switching from truncation to rounding.

Change-Id: Icf6f3b6eb370fe41cea0cebcfda0b8907e055f41
Reviewed-on: https://skia-review.googlesource.com/18846
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>
2017-06-06 17:06:16 +00:00
Mike Klein
ce4b6c100f less naive lowp constant_color
This is as good as we can get without switching away from float inputs.

All diffs due to rounding (from the +256.0f).

Change-Id: I0d314f111d313577ce9078660178be17e865f11e
Reviewed-on: https://skia-review.googlesource.com/18845
Commit-Queue: Mike Klein <mtklein@chromium.org>
Reviewed-by: Mike Reed <reed@google.com>
2017-06-06 16:24:43 +00:00
Mike Klein
c665fddeab define HWCAP_* ourselves in SkCpu.cpp
For compatibility with older system headers, instead of looking for HWCAP_
values in asm/hwcap.h, just define the bits we want to test ourselves.

This lets us compile this code on systems before those bits were defined.
At runtime the bits will harmlessly test as zero.

Change-Id: I44b6aba7d6f0fc2c5df08ad262c2b0537d900209
Reviewed-on: https://skia-review.googlesource.com/18844
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>
2017-06-06 15:57:15 +00:00
Florin Malita
0e36b3f930 Add color space support to 4f gradients
Similar to the raster pipeline stage, transform the stops into the dest
color space before interpolation.

Change-Id: I626b6ef18606fd2308d7da166ce70d05f3951e21
Reviewed-on: https://skia-review.googlesource.com/18767
Reviewed-by: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2017-06-06 15:54:45 +00:00
Mike Reed
6b3542aeb0 move Coeff into blendmode
Bug: skia:
Change-Id: Ib4f3398b0cdc6b0f575f6db80d2ce0bf9666f077
Reviewed-on: https://skia-review.googlesource.com/18843
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2017-06-06 15:07:00 +00:00
Matt Sarett
3928ff8e0b Create an SkColorSpaceXform image generator
This should be immediately useful in the Skia-Android
rendering pipeline.

Possible future uses include creating a "renderable"
SkImage from a bitmap with a funny color space.

Inspired by:
https://skia-review.googlesource.com/c/13981/

Bug: b/62347704
Change-Id: I388c7af1fc43834b8ad22022d0caf3ac90b734c8
Reviewed-on: https://skia-review.googlesource.com/18598
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Matt Sarett <msarett@google.com>
2017-06-06 14:34:03 +00:00
Mike Reed
1608a1dd17 remove unused xfermode methods
CQ_INCLUDE_TRYBOTS=skia.primary:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD
Bug: skia:
Change-Id: Ibc7d581bcc40134ee7cf57bb65fee2d70e119bc7
Reviewed-on: https://skia-review.googlesource.com/18842
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2017-06-06 13:41:19 +00:00
Mike Klein
8e200787b7 more easy lowp stages
Change-Id: I8a292bc98135b41ceedb4242451436c3657616fc
Reviewed-on: https://skia-review.googlesource.com/18722
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>
2017-06-06 00:18:45 +00:00
Mike Klein
adff9dc982 SkJumper: only omit leaf frame pointers
This seems to make Instruments work a lot better.

Change-Id: I078f005d32e427b4eb31bc92c731e3444f2faffb
Reviewed-on: https://skia-review.googlesource.com/18635
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>
2017-06-05 20:14:59 +00:00
Leon Scroggins III
c6e6a5f45e Simplify SkCodecs' call to SkColorSpaceXform::apply
Most SkCodec subclasses did the following to apply their
SkColorSpaceXform:
  dstFormat = select_xform_format(dstInfo.colorType());
  srcFormat = select_xform_format(<something that doesn't change>);
  xformAlphaType = select_xform_alpha(dstInfo.alphaType(),
                                      this->getInfo().alphaType());
  this->colorXform()->apply(dstFormat, dst, srcFormat, src, width,
                            xformAlphaType);

Consolidate the computation of these parameters into SkCodec and add a
new method to SkCodec that calls apply() with those parameters.

Add a SkColorSpaceXform::ColorFormat to SkCodec. This allows the new
method SkCodec::applyColorXform to supply the ColorFormat.

TBR=reed@google.com
(No change to public API.)

Change-Id: I8ea7ba4c0024be827a9f9359796c778744330f6e
Reviewed-on: https://skia-review.googlesource.com/18523
Reviewed-by: Leon Scroggins <scroggo@google.com>
Reviewed-by: Matt Sarett <msarett@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
2017-06-05 20:14:57 +00:00
Chris Dalton
348060fa82 Fix GrReducedClip.cpp: assertion failure surrounding tiny query bounds
Some assertions cannot be relied upon due to FP error.

Bug: skia:5990
Change-Id: I32445b320b9100ae2f80d2f762707d823da77805
Reviewed-on: https://skia-review.googlesource.com/18602
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2017-06-05 19:53:06 +00:00
Yuqian Li
70898afe07 Add TiledDrawScheduler so we can concurrently draw and enque
(instead of finishing enque before draw). The highlight is that we can now
achieve 9x speedup compared to 5x in all our previous approaches
(including multi-picture draw).

The schedulers here are experimental. I'd like to move on to try initializing
once for each draw before further polishing and optimizing the schedule
mechanism.

Bug: skia:
Change-Id: Idc3d030d475af9645c24c5372ff62b9a402206cc
Reviewed-on: https://skia-review.googlesource.com/17826
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Yuqian Li <liyuqian@google.com>
2017-06-05 19:29:57 +00:00
Mike Klein
9653d3aa84 more lowp blend modes
Change-Id: Id62e989d4278f273c040b159ed4d2fd6a2f209e0
Reviewed-on: https://skia-review.googlesource.com/18627
Reviewed-by: Herb Derby <herb@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>
2017-06-05 19:25:51 +00:00
Hal Canary
d12a67626d SkPDF: Draw paths with mask filters; color filter.
Also:
  - drawPaint, drawPath w/ perspective shaders
  - text with mask filters, stroking, path effect.
  - SkPDFUtils::GetShaderLocalMatrix

BUG=skia:237
BUG=skia:238
BUG=skia:5607
Change-Id: Iffeaf2d7abbde13fd2577ce9feaa178657f48364
Reviewed-on: https://skia-review.googlesource.com/18200
Commit-Queue: Hal Canary <halcanary@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2017-06-05 19:22:46 +00:00
Mike Klein
f36031b68a lowp: add some big easy stages
srcover_rgba_8888, lerp_u8, lerp_1_float, scale_u8, scale_1_float...
this is enough for _lots_ of drawing.

Change-Id: Ibe42adb8b1da6c66db3085851561dc9070556ee3
Reviewed-on: https://skia-review.googlesource.com/18622
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>
2017-06-05 19:20:48 +00:00
Leon Scroggins III
12a4dc985b Defend against ICOs with large BMPs embedded
If the ICO reports that it has a large BMP file embedded, do not
crash if we attempt to allocate too much memory.

Bug: b/38116746
Change-Id: I70eb66f5e4ffc15587007b398bbe843665eae500
Reviewed-on: https://skia-review.googlesource.com/18447
Reviewed-by: Matt Sarett <msarett@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
2017-06-05 18:28:19 +00:00
Robert Phillips
67d52cf0d8 sk_sp-ify GrResourceProvider some more
I believe this addresses the concerns of this particular bug (although more remains to be done)

Bug: skia:5327
Change-Id: Ie82f08f87b3cf3d7986fe4eeb16a5d2553173913
Reviewed-on: https://skia-review.googlesource.com/18599
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2017-06-05 18:07:05 +00:00
Mike Klein
727b09c898 lowp: add constant_color, swap, move_dst_src
This is enough for us to do some really simple draws.
Also add some debug tools to help prioritize porting.

Change-Id: I334f8fd2133be1aeec3f3406371a81aa6c184776
Reviewed-on: https://skia-review.googlesource.com/18597
Commit-Queue: Mike Klein <mtklein@chromium.org>
Reviewed-by: Herb Derby <herb@google.com>
2017-06-05 17:23:05 +00:00
Mike Klein
0e022297fe add color
Change-Id: Ie85ed7a807603ba627cb7f17de5a423ca9678251
Reviewed-on: https://skia-review.googlesource.com/18594
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>
2017-06-05 16:49:45 +00:00
Brian Salomon
28207df02b Make GrSimpleMeshDrawOpHelper record whether coverage can be implemented as alpha
This also makes the blend table entry for opaque src over indicate a blend of (1, ISA) rather than (1, 0) to match the actual implementation of the global src-over XP.
Change-Id: I1b1f64d2546e4f0cf03c0239ce674d1baad655f6
Reviewed-on: https://skia-review.googlesource.com/18521
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2017-06-05 16:47:45 +00:00
Mike Klein
5adb01bf0d lowp: add move_src_dst and srcover
This is enough to run the bench SkRasterPipeline_compile.

    $ ninja -C out monobench; and out/monobench SkRasterPipeline_compile 300

    Before: 300  SkRasterPipeline_compile 48.4858ns
    After:  300  SkRasterPipeline_compile 37.5801ns

Change-Id: Icb80348908dfb016826700a44566222c9f7a853c
Reviewed-on: https://skia-review.googlesource.com/18595
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>
2017-06-05 16:32:54 +00:00
Mike Klein
1f29bf093f slight streamlining for lowp load_8888 with pshufb
We can use 2 pshufb to replace 4 unpacks when deinterlacing the colors.

Change-Id: I713fbbc94f5cb9eaf14f85323b0ec76dc2246e98
Reviewed-on: https://skia-review.googlesource.com/18531
Commit-Queue: Mike Klein <mtklein@chromium.org>
Reviewed-by: Herb Derby <herb@google.com>
2017-06-05 16:01:16 +00:00
Mike Klein
eeccbf735d Real fix for stage perf regression.
When we made start_pipeline() return void, the call into the tail!=0 run
of the pipeline became eligble to be a tail-call, and Clang made that
choice.  This had the side effect of not going through vzeroupper on
those tails.

We now mark start_pipeline() as inelligible for tail calls when
targeting AVX+.  All paths go through the vzeroupper at the end.

BUG=chromium:729237

Change-Id: I2099931284214f24c67b38979b3ad4b4d10e8bba
Reviewed-on: https://skia-review.googlesource.com/18591
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>
2017-06-05 15:29:11 +00:00
Brian Osman
42bb6acf56 Simplify some Viewer code, and fix a few bugs
The content rect was always identical to the window rect,
so most of the related code did nothing. The translation
limit code is always useful (to avoid dragging the slide
way off-screen with the mouse), so always include it.
The auto-scaling to fit the screen is also still useful,
but just base it on the window rect.

The zoom code has four state variables, only used two of
them, and one was a trivially derived computation. Fold
most of that work into computeMatrix. (The translation
was always zero -- we never changed the zoom center.)

Include fDefaultMatrix in the matrix from computeMatrix,
rather than needing to apply it specially to the canvas.

Don't apply the inverse default matrix to touch or mouse
points. The absolute positions of those touch points is
not important, but because that matrix includes scale
(and sometimes very large or very small scale), it just
had the effect of greatly amplifying or damping the drag
speed. Without it, the slide always pans at the speed of
the touch/mouse drag -- which seems more desirable.

The use of the inverse default matrix was a clever trick,
but it caused the translation (applied to the global mtx)
to be scaled, so the slide was always pinned incorrectly.
Instead, supply the unmodified window rect and the default
matrix, so the trans limit code can do the obvious correct
thing: xform the slide bounds completely, then limit the
translation that will be applied after that. Slides are
now correctly pinned to screen edge regardless of how
much zoom is present in the default matrix.

Note: There are still several bugs related to all of this
code, but given the web of xform state, it's hard to
unravel. The touch gesture still doesn't know about
viewer's zoom, so that's ignored when doing the pinning.
Beyond that, it doesn't even know about window resize -
it only configures the translation limit when setting up
a slide. I had a fix for all of this (doing the
translation limiting in computeMatrix), but then the touch
gesture doesn't know about it, and can accumulate drag
motion that needs to be un-dragged to get back on-screen,
even though the slide is never really translated that far.

SkTouchGesture is in include. No one uses it except viewer:
TBR=bsalomon@google.com

Bug: skia:
Change-Id: I460cc07c3de6d36e63826f57d359faf1facf5ab3
Reviewed-on: https://skia-review.googlesource.com/18524
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Yuqian Li <liyuqian@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2017-06-05 15:21:43 +00:00
Matt Sarett
d3df9ec874 SkImage::makeColorSpace(): Fix nullptr->sRGB bug with picture images
Bug: 729352
Change-Id: I5ad5e2121ce87dc154528bfd9ec0f3e9253ed792
Reviewed-on: https://skia-review.googlesource.com/18590
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Matt Sarett <msarett@google.com>
2017-06-05 15:13:40 +00:00
Leon Scroggins III
d81fed9ce2 Replace BMP calls to new with calls to malloc
A BMP can have an arbitrarily large width. We typically read a row
into a block of memory before swizzling it to the output. Rather
than calling new to create that block of memory, which may crash
when we run out of memory, call malloc, and return null if malloc
fails.

Add a common base class for Mask and Standard BMP codecs. This class
handles allocating and freeing the buffer.

Bug: b/37623797
Change-Id: I0510b76d688d030865faa481bb2fb1351dac2c97
Reviewed-on: https://skia-review.googlesource.com/18400
Reviewed-by: Matt Sarett <msarett@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
2017-06-05 15:09:40 +00:00
cjbao
96cc36124d Handle different types of streams in different jpeg source managers
For streams that are memory backed (stream->getMemoryBase() returns
a non-null ptr and hasLength() returns true), handle the stream
with skjpeg_mem_source_mgr, which directly assigns memory base to
the source manager.  For other non memory backed streams, handle the
stream with skjpeg_buffered_source_mgr, which is renamed from
the old skjpeg_source_mgr with no implementation change.

Signed-off-by: cjbao <cathy.bao@intel.com>
Bug: skia:
Change-Id: I748de0bdba726bbb318922c08497135e73e37329
Reviewed-on: https://skia-review.googlesource.com/17296
Reviewed-by: Leon Scroggins <scroggo@google.com>
Reviewed-by: Matt Sarett <msarett@google.com>
Commit-Queue: Matt Sarett <msarett@google.com>
2017-06-05 14:57:46 +00:00
Mike Reed
c928fe2056 add testing flag to force rasterpipeline
Bug: skia:
Change-Id: I8e195e90dc00b9be9072858086f7541e993428da
Reviewed-on: https://skia-review.googlesource.com/18585
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
2017-06-05 14:45:11 +00:00
Robert Phillips
eee4d6e4e8 Make instantiate return a Boolean
From an off-line conversation:
The longer term idea will be to create a helper class isolates the
ability to instantiate proxies until flush time. The peek* methods
could then be moved to GrSurfaceProxy.

Change-Id: I8e8c02c098475b77d515791c0d6b81f7e4a327dd
Reviewed-on: https://skia-review.googlesource.com/18076
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2017-06-05 14:03:10 +00:00
Mike Klein
9beafc41af have start_pipeline() return limit again
This is spooky.
I don't quite yet understand why, but this makes things much faster.

Performance regressed across the board when we no longer needed the
value and changed it to return void:

    https://perf.skia.org/e/?begin=1496176469&keys=6994&xbaroffset=28513

You can see similar regressions following this Chromium bug link.
BUG=chromium:729237

Change-Id: I68371b0456014f909acf819aca52aa4f4f187460
Reviewed-on: https://skia-review.googlesource.com/18580
Reviewed-by: Herb Derby <herb@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>
2017-06-05 13:46:40 +00:00
Mike Klein
34d10d734c implement SkRasterPipelineBlitter::blitAntiH2()
The default blitAntiH2() calls blitAntiH() with two length-1 runs, but
for this blitter creating a small mask is better.  We can stamp both
pixels out with a single pipeline invocation.

Change-Id: If356975e85310a4545e54f2231a142d6e537944d
Reviewed-on: https://skia-review.googlesource.com/18581
Reviewed-by: Mike Reed <reed@google.com>
2017-06-05 13:31:31 +00:00
Robert Phillips
e18474e864 Re-enable single channel renderability for ANGLE ES2
Since the ANGLE-side fix has landed & been rolled into Skia we no longer need this workaround.

Change-Id: I9e6296976d53fc1c87232f918a5c0257201744bf
Reviewed-on: https://skia-review.googlesource.com/18583
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2017-06-05 13:16:13 +00:00
Mike Klein
cb218b30aa don't try lowp in msan builds
CQ_INCLUDE_TRYBOTS=skia.primary:Build-Ubuntu-Clang-x86_64-Debug-MSAN

Change-Id: I50bcb3a3d8138ce94e3741cac8ceacc9e7e28a20
Reviewed-on: https://skia-review.googlesource.com/18532
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Mike Klein <mtklein@chromium.org>
2017-06-04 23:23:15 +00:00
Mike Klein
bba02c2031 start on SkJumper lowp mode
Just 3 stages implemented so far:

  load_8888
  swap_rb
  store_8888

That's enough to make the shortest non-trivial pipeline
that you see in the new unit test.

Change-Id: Iabf90866ab452f7183d8c8dec1405ece2db695dc
Reviewed-on: https://skia-review.googlesource.com/18458
Commit-Queue: Mike Klein <mtklein@chromium.org>
Reviewed-by: Herb Derby <herb@google.com>
2017-06-04 22:50:14 +00:00
Mike Reed
3f511889e8 experiment: force composeshade to always be rasterpipeline
Bug: skia:
Change-Id: I7dd3f652f3ce05c48cc41b0bbbb54b96d17d721a
Reviewed-on: https://skia-review.googlesource.com/18529
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
2017-06-04 00:22:35 +00:00
Mike Reed
b5d9e85c02 remove unused blitters
Bug: skia:
Change-Id: Iaa2ead32a4025071c3592f83d47f174ffeb63a49
Reviewed-on: https://skia-review.googlesource.com/18530
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2017-06-03 11:56:55 +00:00
Brian Salomon
e23bffd65b Remove support in GPU backend for distance vector field.
Also, remvoes SkNormalBevelSource as this was the last use case for the distance vector field.

Change-Id: Ib0176c78e500e6b5130310934253a75860245812
Reviewed-on: https://skia-review.googlesource.com/18482
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2017-06-02 19:44:18 +00:00
Mike Reed
65efe9c0eb remove unused auto class
Bug: skia:
Change-Id: I7178876c0d95dc83d64d39a2cb6d90a47bc4b00e
Reviewed-on: https://skia-review.googlesource.com/18520
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2017-06-02 19:25:47 +00:00
Mike Reed
0271c5b7db simplify verts in certain modes
Bug: skia:
Change-Id: I7cc54c940b61332f06b8d21eeba1def8bd9cb3dc
Reviewed-on: https://skia-review.googlesource.com/18495
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2017-06-02 19:17:07 +00:00
Mike Reed
6867eee44d default impl of appendStages now calls shaderContext
this is approximately a revert of https://skia-review.googlesource.com/c/17768/

I propose if/when we want to experiment with a fast-path for coherent shaders
(e.g. 2-color linear gradients, up-scaling images) that we just create a new
mechanism for shaders to opt into that, knowing that it will be driven by
the rasterpipeline (and never by the old context convention).

This CL now makes it legal/clear that a new shader subclass can *just* implement
stages for raster, and never needs to make a context.

Bug: skia:
Change-Id: I525a8b1cece100f0993f75e28128e0927a4ea35c
Reviewed-on: https://skia-review.googlesource.com/18481
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
2017-06-02 17:51:24 +00:00
Robert Phillips
3ea1798829 Remove ImmediateFlush mode
Change-Id: I7db113e66d81516b2beb5eefeddf488d9bfed2e5
Reviewed-on: https://skia-review.googlesource.com/18488
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2017-06-02 17:35:18 +00:00
Robert Phillips
bc712740bd Disable single channel renderability for ANGLE ES2
Bug: 720325

Change-Id: Ib55c7a0c59a23b8dc012e04b626010de7da2921b
Reviewed-on: https://skia-review.googlesource.com/18485
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2017-06-02 16:51:49 +00:00
Florin Malita
67af673d7a Remove deprecated SkRWBuffer snapshot methods
Change-Id: I98fc6059fe74458fb359eaf00ccfcae50996a9e1
Reviewed-on: https://skia-review.googlesource.com/18480
Reviewed-by: Leon Scroggins <scroggo@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2017-06-02 15:44:57 +00:00
Mike Klein
0d93010c98 move load_and_inc() and LazyCtx into SkJumper_misc.h
This is a no-op refator that'll help keep the interesting diff more
focused in the lowp CL.  The lowp stages will use these unaltered, so
SkJumper_misc.h is a good place for them.

Change-Id: I7fb6327ade29ac884194517d94ac4303ed1079e0
Reviewed-on: https://skia-review.googlesource.com/18484
Reviewed-by: Mike Klein <mtklein@chromium.org>
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>
2017-06-02 15:40:16 +00:00
Ethan Nicholas
b4dc419f0b Re-land "Fixed an issue with sksl variable declarations"
This reverts commit affa6a3da8.

Bug: skia:
Change-Id: I5864830e31acbf786f3ea7ae91f42f10aae6d855
Reviewed-on: https://skia-review.googlesource.com/18459
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2017-06-02 15:11:19 +00:00
Stan Iliev
7e910df7f1 Implement an SkImage backed by a Android hardware buffer
Create a new SkImage public API to make an image from an Android
hardware buffer. Implementation is using a SkImageGenerator
derived class GrAndroidBufferImageGenerator.
A new EGLImage texture is created, which is then wrapped with
GrTextureProxy.

Bug: skia:
Change-Id: I610a4c5a58198686ce7c03e9a0adad3f9d2342e0
Reviewed-on: https://skia-review.googlesource.com/17789
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Stan Iliev <stani@google.com>
2017-06-02 14:51:24 +00:00
Ethan Nicholas
affa6a3da8 Revert "Fixed an issue with sksl variable declarations"
This reverts commit 88bd8edcff.

Reason for revert: unhappy bots

Original change's description:
> Fixed an issue with sksl variable declarations
> 
> There was an issue where multiple variables defined in the same
> declaration were not being sequenced appropriately during analysis, so
> 'int x = 0, y = x + 1' would report that x was undefined.
> 
> Bug: skia:
> Change-Id: I882f7e216467306f6a6013a0a34aac30a4c60744
> Reviewed-on: https://skia-review.googlesource.com/18313
> Reviewed-by: Chris Dalton <csmartdalton@google.com>
> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
> 

TBR=csmartdalton@google.com,ethannicholas@google.com
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Change-Id: Ibc68674289dce70b6173a347a0e78bb0f1e6db1b
Reviewed-on: https://skia-review.googlesource.com/18457
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2017-06-02 13:57:39 +00:00
Mike Klein
370c2b304a minor refactor to SkRasterPipeline::BuildPipeline
I don't see any reason to have it be static...

Change-Id: I0fdc9c0629e2194c469f7c9c696d1bb55ffbc98a
Reviewed-on: https://skia-review.googlesource.com/18455
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Mike Klein <mtklein@chromium.org>
2017-06-02 13:47:44 +00:00
Ethan Nicholas
88bd8edcff Fixed an issue with sksl variable declarations
There was an issue where multiple variables defined in the same
declaration were not being sequenced appropriately during analysis, so
'int x = 0, y = x + 1' would report that x was undefined.

Bug: skia:
Change-Id: I882f7e216467306f6a6013a0a34aac30a4c60744
Reviewed-on: https://skia-review.googlesource.com/18313
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2017-06-02 13:23:36 +00:00
Leon Scroggins III
ec4400bfe3 Avoid new for small arrays in SkBmpCodec
Use a buffer on the stack to avoid the cost of new/delete.

Change-Id: I5c9208ec283e8345c34553343925097926274978
Reviewed-on: https://skia-review.googlesource.com/18402
Reviewed-by: Matt Sarett <msarett@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
2017-06-02 13:14:57 +00:00
Brian Osman
48c9919335 Expand texturability testing to cover mip-mapped textures, and fix iOS
Don't allow creation of mip-mapped textures when caps says we don't
support mip-mapping.

Skip testing of mip-mapped resources in the resource size test,
when creation will fail.

For iOS devices with ES2, the APPLE BGRA8888 extension is more
trouble than it's worth. Even though it lets the internal and
external formats not match, it appears that the driver remembers
the first external format, so subsequent attempts to upload with
the other swizzle will fail. Up until now, creation of these
textures was failing anyway, so now just make it more explicit
that we don't support BGRA in this situation.

Now that we're testing our TexStorage path, fix a few other problems
that showed  up:
- Command Buffer doesn't like extension formats.
- X86 PowerVR and Adreno devices don't like BGRA.

Re-land of   : https://skia-review.googlesource.com/18382
Re-re-land of: https://skia-review.googlesource.com/18261

BUG=skia:

Change-Id: Ie12793549a6807300d6ece68cd6b92495e85c3fe
Reviewed-on: https://skia-review.googlesource.com/18403
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2017-06-02 13:12:17 +00:00
Robert Phillips
18166eeaf2 Omnibus: Push instantiation of GrTextures later (post TextureSampler)
Split into:
   https://skia-review.googlesource.com/c/10485/ (More GrSurfaceProxy-clean up)
   https://skia-review.googlesource.com/c/15819/ (Expand GrTextureProxy to handle highestFilterMode)
   https://skia-review.googlesource.com/c/16714/ (Switch ImageStorageAccess over to GrTextureProxies)
   https://skia-review.googlesource.com/c/16908/ (Convert DstTexture to DstProxy)

Change-Id: I6cf3ba0f3bf0e1908d36749bc83571c066ddd568
Reviewed-on: https://skia-review.googlesource.com/10484
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2017-06-02 11:46:40 +00:00
Mike Reed
d5bee5d50c add API to change max pointsize for font cache
Bug: skia:6585
Change-Id: I6df8c439dca0a154e8fbfce6d66c536665dff1d7
Reviewed-on: https://skia-review.googlesource.com/18314
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2017-06-01 20:55:16 +00:00
Robert Phillips
1bfece8556 Rm int flavor of GrNextPow2 in favor of uint32_t flavor
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=18384

Change-Id: I8f62c5ea6146626916389429ac4f2f80c57a7d72
Reviewed-on: https://skia-review.googlesource.com/18384
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2017-06-01 20:30:54 +00:00
Lee Salzman
a836267029 fix premultiplied color generation in linear gradients when using fApplyAlphaAfterInterp
BUG=skia:

Change-Id: I771797498f60313022cd3a9e53037e98b3b3590b
Reviewed-on: https://skia-review.googlesource.com/17818
Commit-Queue: Mike Klein <mtklein@chromium.org>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2017-06-01 19:39:45 +00:00
Mike Klein
5df94d508e have shaders that need seed_shader call it themselves
This ought to make compose shader and our sprite blitter a bit more
efficient.  Compose shader can simply re-seed instead of saving the
xy values off to a buffer.  The sprite blitter doesn't need xy at all.

Change-Id: Ib4b3509288810f74a4c8e2978ce2ca14d8644980
Reviewed-on: https://skia-review.googlesource.com/18405
Reviewed-by: Herb Derby <herb@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>
2017-06-01 19:23:10 +00:00
Mike Klein
9b10f8ff0d plumb y through to SkJumper
There'll still be a little more refactoring after this, but this is the
main thing we want to do.

This makes y available in a general-purpose register in pipeline stages,
just like x.  Stages that need y (seed_shader and dither) can just use
it rather than pulling it off a context pointer.  seed_shader loses its
context pointer, and dither's gets simpler.

Change-Id: Ic2d1e13b03fb45b73e308b38aafbb3a14c29cf7f
Reviewed-on: https://skia-review.googlesource.com/18383
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>
2017-06-01 18:08:25 +00:00
Brian Osman
842a560470 Revert "Expand texturability testing to cover mip-mapped textures, and fix iOS"
This reverts commit c2b5175e99.

Reason for revert: Nexus 5

Original change's description:
> Expand texturability testing to cover mip-mapped textures, and fix iOS
> 
> Don't allow creation of mip-mapped textures when caps says we don't
> support mip-mapping.
> 
> Skip testing of mip-mapped resources in the resource size test,
> when creation will fail.
> 
> For iOS devices with ES2, the APPLE BGRA8888 extension is more
> trouble than it's worth. Even though it lets the internal and
> external formats not match, it appears that the driver remembers
> the first external format, so subsequent attempts to upload with
> the other swizzle will fail. Up until now, creation of these
> textures was failing anyway, so now just make it more explicit
> that we don't support BGRA in this situation.
> 
> Re-land of: https://skia-review.googlesource.com/18261
> 
> BUG=skia:
> 
> Change-Id: I910ffab0aa735647dce910d9054696c385f94933
> Reviewed-on: https://skia-review.googlesource.com/18382
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Commit-Queue: Brian Osman <brianosman@google.com>
> 

TBR=bsalomon@google.com,robertphillips@google.com,brianosman@google.com
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
BUG=skia:

Change-Id: I8f0fd87678cc584ad37b2a93a859bd4ef38c8092
Reviewed-on: https://skia-review.googlesource.com/18401
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2017-06-01 18:00:41 +00:00
Brian Osman
c2b5175e99 Expand texturability testing to cover mip-mapped textures, and fix iOS
Don't allow creation of mip-mapped textures when caps says we don't
support mip-mapping.

Skip testing of mip-mapped resources in the resource size test,
when creation will fail.

For iOS devices with ES2, the APPLE BGRA8888 extension is more
trouble than it's worth. Even though it lets the internal and
external formats not match, it appears that the driver remembers
the first external format, so subsequent attempts to upload with
the other swizzle will fail. Up until now, creation of these
textures was failing anyway, so now just make it more explicit
that we don't support BGRA in this situation.

Re-land of: https://skia-review.googlesource.com/18261

BUG=skia:

Change-Id: I910ffab0aa735647dce910d9054696c385f94933
Reviewed-on: https://skia-review.googlesource.com/18382
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2017-06-01 17:11:42 +00:00
Mike Klein
761d27c4d7 update SkRasterPipeline::run() to also take y
y isn't used yet.  This is just a warmup that updates the callers.

Change-Id: I78f4f44e2b82f72b3a39fa8a8bdadef1d1b8a99e
Reviewed-on: https://skia-review.googlesource.com/18381
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Mike Klein <mtklein@chromium.org>
2017-06-01 17:05:13 +00:00
Brian Osman
c674e26950 Revert "Expand texturability testing to cover mip-mapped textures, and fix iOS"
This reverts commit 9f6f41b01b.

Reason for revert: Command Buffer and ANGLE failures.

Original change's description:
> Expand texturability testing to cover mip-mapped textures, and fix iOS
> 
> Don't allow creation of mip-mapped textures when caps says we don't
> support mip-mapping.
> 
> Skip testing of mip-mapped resources in the resource size test,
> when creation will fail.
> 
> For iOS devices with ES2, the APPLE BGRA8888 extension is more
> trouble than it's worth. Even though it lets the internal and
> external formats not match, it appears that the driver remembers
> the first external format, so subsequent attempts to upload with
> the other swizzle will fail. Up until now, creation of these
> textures was failing anyway, so now just make it more explicit
> that we don't support BGRA in this situation.
> 
> BUG=skia:
> 
> Change-Id: Ic2e3ba1673398d542edd46a555ef47b5d0979c01
> Reviewed-on: https://skia-review.googlesource.com/18261
> Commit-Queue: Brian Osman <brianosman@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> 

TBR=bsalomon@google.com,robertphillips@google.com,brianosman@google.com
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
BUG=skia:

Change-Id: I68f6bb3be9fbafa7366ef5611a12e372274aa648
Reviewed-on: https://skia-review.googlesource.com/18380
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2017-06-01 16:22:44 +00:00
Florin Malita
69270fbb2b Add smartptr SkRWBuffer snapshot methods
Change-Id: Id816a38213a86bf090230ebaaef00d98a9487965
Reviewed-on: https://skia-review.googlesource.com/18266
Reviewed-by: Leon Scroggins <scroggo@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2017-06-01 16:00:45 +00:00
Robert Phillips
a16f6cb40a Update copyOp to split-opList world
Change-Id: Ib18fc0a589185b11b21241e50acb7b506c44bfac
Reviewed-on: https://skia-review.googlesource.com/17325
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2017-06-01 15:33:12 +00:00
Brian Osman
9f6f41b01b Expand texturability testing to cover mip-mapped textures, and fix iOS
Don't allow creation of mip-mapped textures when caps says we don't
support mip-mapping.

Skip testing of mip-mapped resources in the resource size test,
when creation will fail.

For iOS devices with ES2, the APPLE BGRA8888 extension is more
trouble than it's worth. Even though it lets the internal and
external formats not match, it appears that the driver remembers
the first external format, so subsequent attempts to upload with
the other swizzle will fail. Up until now, creation of these
textures was failing anyway, so now just make it more explicit
that we don't support BGRA in this situation.

BUG=skia:

Change-Id: Ic2e3ba1673398d542edd46a555ef47b5d0979c01
Reviewed-on: https://skia-review.googlesource.com/18261
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2017-06-01 15:28:07 +00:00
Robert Phillips
48567ac8ae update GrOp printouts
Change-Id: I19ac4ec7849e5eaae1726a746ac2051d5861e12f
Reviewed-on: https://skia-review.googlesource.com/18304
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2017-06-01 15:24:27 +00:00
Mike Klein
5cc9da6bbc raster pipeline sprite blitter
The color in the unit test turned out to be right on the edge
of not round tripping well, and I guess rounding pushed it over
the edge, so I've tweaked it to a new one that seems better.

Change-Id: I46095fafc9d6b68fd417ff9dc32003f42929c5a5
Reviewed-on: https://skia-review.googlesource.com/18238
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>
2017-06-01 15:02:08 +00:00
Mike Klein
c6912f712f make SkColorFilter::onAppendStages() pure
Change-Id: I2851e19648fb0478db9b940e86c6ddb2020000b3
Reviewed-on: https://skia-review.googlesource.com/18264
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2017-06-01 14:55:10 +00:00
Robert Phillips
fe50d9696a Remove GrSurface-based surfaceContext factories from GrContextPriv
This relies on both:
   https://skia-review.googlesource.com/c/13001/ (Rm makeRenderTargetContext in favor of deferred version)
   https://skia-review.googlesource.com/c/11125/ (Remove discard from GrRenderTarget & force it to always go through a RenderTargetContext)

Change-Id: Ia06469a6fa0048e162fb769ed4a11e4773cfacca
Reviewed-on: https://skia-review.googlesource.com/13130
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2017-06-01 14:47:31 +00:00
Christopher Cameron
eb0e60f1ec Ensure SkPictureImageFilter::onFilterImage doesn't double-convert color
Consider the following sequence of events:
1. SkPictureImageFilter::onFilterImage creates a local canvas, wraps it
   in a SkColorSpaceXformCanvas, and passed to...
2. SkPictureImageFilter::drawPictureAtLocalResolution creates a local
   canvas (localCanvas) wraps that in a SkColorSpaceXformCanvas, draws
   the picture to it, doing sRGB->fColorSpace conversion
3. We then call makeImageSnapshot to produce a SkSpecialImage, localImg,
   which is not tagged with any color space.
4. When the draw that localImg to the passed-in SkColorSpaceXformCanvas,
   which then performs sRGB->fColorSpace conversion a second time.

We now have performed color conversion twice.

One fix for this would be to have the image produced by the call to
localSurface->makeImageSnapshot() be tagged with fColorSpace. This is
somewhat involved.

The less invasive fix is to remove the SkColorSpaceXformCanvas in
SkPictureImageFilter::onFilterImage, and push it down into the two
branches, SkPictureImageFilter::drawPictureAtLocalResolution and
SkPictureImageFilter::drawPictureAtDeviceResolution.

BUG=728332

Change-Id: If2aa32e18ad660b3e361f1d90845eeb8555fe404
Reviewed-on: https://skia-review.googlesource.com/18282
Reviewed-by: Matt Sarett <msarett@google.com>
Reviewed-by: Christopher Cameron <ccameron@google.com>
Commit-Queue: Christopher Cameron <ccameron@google.com>
2017-06-01 14:42:24 +00:00
Mike Reed
a03d407aea fix and test colorfiltershader
Bug: skia:
Change-Id: I02fd77796880b42ce55549a8340b116e1c5f19d6
Reviewed-on: https://skia-review.googlesource.com/18305
Commit-Queue: Mike Reed <reed@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>
Reviewed-by: Mike Klein <mtklein@chromium.org>
2017-06-01 13:58:05 +00:00
Robert Phillips
2f4ddf6964 Update more GrOps to split-opList world
Change-Id: I568e52f58372597abc2920aaee346a9731452d18
Reviewed-on: https://skia-review.googlesource.com/17324
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2017-06-01 13:20:37 +00:00
Mike Klein
823103384c reland: We can mask load and store with just AVX
Originally reviewed here: https://skia-review.googlesource.com/c/17452/

CQ_INCLUDE_TRYBOTS=skia.primary:Test-Ubuntu-GCC-ShuttleA-GPU-GTX550Ti-x86_64-Release-Valgrind

Change-Id: I2e593e897ce93147ec593c2a5de143217274ba2a
Reviewed-on: https://skia-review.googlesource.com/18267
Reviewed-by: Mike Klein <mtklein@chromium.org>
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>
2017-06-01 02:26:50 +00:00
Robert Phillips
8bf1f9ffcf Disable deferred proxies for M60 branch
Bug: 720325
Change-Id: I0529bbcd592bdc5d5a741731af8a66971e485649
Reviewed-on: https://skia-review.googlesource.com/18239
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2017-05-31 23:12:39 +00:00
Florin Malita
83223bc5c4 Store SkPerlinNoiseShaderImpl's PaintingData inline
No reason to allocate dynamically, now that the impl is private.

Change-Id: I1b6f34fa903149d88fe82f5947c1df899446967e
Reviewed-on: https://skia-review.googlesource.com/18237
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2017-05-31 20:57:09 +00:00
Brian Osman
6799939b0a Blacklist sRGB MSAA on AMD (ATI) Macs
Fixes GrSurfaceTest failure on the trash can

BUG=skia:

Change-Id: I0def62ea7a2693043f6a359a47a3e9e1177ca84d
Reviewed-on: https://skia-review.googlesource.com/18152
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2017-05-31 20:52:55 +00:00
Chris Dalton
1d6163577c Add support for instanced draws
Adds an instance buffer to GrMesh and instance attribs to
GrPrimitiveProcessor. Implements support in GL and Vulkan. Adds unit
tests for instanced rendering with GrMesh.

Bug: skia:
Change-Id: If1a9920feb9366f346b8c37cf914713c49129b3a
Reviewed-on: https://skia-review.googlesource.com/16200
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2017-05-31 20:40:20 +00:00