Commit Graph

7715 Commits

Author SHA1 Message Date
Brian Salomon
90673ec665 Rename GrSimpleTextureEffect->GrTextureEffect
It will become less simple.

Change-Id: I409d0faba386597ae05738273d5ff773501eb358
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/262383
Auto-Submit: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-01-06 21:49:44 +00:00
Brian Osman
8783b78b38 Add a few more SkRuntimeEffect unit tests
Validating that only certain types are allowed as in or uniform.

Change-Id: I941da448bffec06158e67fbf653833846d9fe3db
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/262222
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-01-06 20:32:54 +00:00
Mike Klein
6dbd7ff34a first foray into SkVM image shaders
Basic support for clamp/clamp/nearest/RGBA-8888/premul images.

A couple little changes to make this work:
   - add pixel-center offset to shader (x,y)

   - change the signature of gather??() calls to work
     more naturally with how we let effects build uniforms.
     Instead of gathering directly from one of the program
     arguments, load the gather base pointer off another
     uniforms pointer, just like any other uniform.

   - remove the default argument to uniform??() so that
     they parallel the new gather??() calls more closely.
     There was only one place that was using the default
     and I think it's clearer as an explicit 0 offset.

   - centralize some more helpers onto skvm::Builder so
     we can use the in both SkVMBlitter and SkImageShader.

Some diffs:
   - very, very small color diffs probably due to slightly
     different math converting between byte and float or blending;
   - small sampling coordinate diffs where skvm + SkRP agree,
     and the legacy shaders disagree.  That's fine by me.

Change-Id: I72634e7fed4f13e6cb41b8067104760f392ea3bf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/262368
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2020-01-06 19:45:53 +00:00
Brian Salomon
e994380d00 Some GrTypes cleanup.
Remove some unused functions/macros.

Move two functions only used by GrBufferAllocPool there.

We only ever used GrSizeAlignUp with pow 2 alignments. Require that,
rename, move to GrTypesPriv.h (along with GrSizeDivRoundUp).

Change-Id: I1a7248952d1905f16f02de2028d65768b186acee
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/262061
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-01-03 19:49:07 +00:00
Ethan Nicholas
2a099dae1e SkSL description methods are now only present in debug mode
As they are a significant chunk of code, this reduces the size of the
release executable.

Change-Id: Ib764b3ec6244629e50941b0101a540e49d56c320
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/261955
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2020-01-03 16:56:27 +00:00
Brian Osman
ee426f223f Move SkRuntimeEffect.h to include/effects
Change-Id: I0b11d4210c6e663cfb4854fc33e1396fd79fe9a4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/261780
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-01-02 17:37:46 +00:00
Brian Salomon
94724c6594 Fix GrColorMatrixFragmentProcessor handling of premul transparent black.
Use the original alpha in the unpremul color.

Bug: chromium:1024935
Change-Id: I6a721431781f0ef42a3f162d39f8bbac924a2c30
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/261680
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-01-02 14:55:06 +00:00
Brian Osman
82d49704ce More SkRuntimeEffect tests
- 'in' variables can't be arrays (applies to all SkSL)
- 'in' and 'uniform' variables are restricted to a fixed
  list of types.

Change-Id: I957ce1ad33aaf6b5970ca7204c568bb533bc86d6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/261436
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-12-30 19:26:06 +00:00
Brian Salomon
0a7ca7a2a3 Avoid div by zero in ProcessorTest to please UBSAN
Change-Id: I1e49ab46975bb8e5eff08bc5afe7ffed1c078309
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/261550
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2019-12-27 18:06:24 +00:00
Brian Salomon
bc73eb4fcc Make ProcessorOptimizationTest for canTweakAlphaForCoverage more robust
Change-Id: Ic43bebee6a0036eff5b718cc505d85bf839cb8a3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/260898
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2019-12-27 15:34:44 +00:00
Brian Salomon
9c4ee9c79a Disable advanced blend equations on Imagination driver 1.10 and earlier
Causes shader compilation to fail in Programs test on Tecno Spark 3 Pro.

Hopefully this doesn't affect performance as this GPU has framebuffer
fetch support.

Also reduce the effect depth limit in ProgramsTest.

Change-Id: I1fa5b8a670b3a074808cdba09c2ac97492067d33
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/261192
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2019-12-20 22:17:09 +00:00
Robert Phillips
8f259a0329 Add BC1_RGB8_UNORM support
This is working in the GL and Vulkan back ends. MacOS only supports the RGBA8 variants.
For mobile devices, probably only nVidia GPUs will support this.

Bug: skia:9680
Change-Id: I9d886b72232a031603e93e46059a97a8aa288b3c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/261093
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-12-20 21:41:09 +00:00
Michael Ludwig
28b0c5d4b3 Pass Arenas* to GrOpsTask and GrOps instead of multiple pointers to each pool type
Change-Id: I47ac0b069334cb9702473b1bb923f585712f38ce
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/261087
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2019-12-20 21:02:49 +00:00
Chris Dalton
34280e29cf Shorten argument lists in GrMesh::SendToGpuImpl
Replaces several of the arguments with a single GrMesh object. The
call signatures were a bit unruly, and would have become more so with
extra required arguments for tessellation.

Change-Id: I4834b03d9c107dd233a91019c0a3189030e52bef
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/260977
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2019-12-20 21:01:39 +00:00
Mike Reed
aebe4390af move clip-stencil function into GpuDevice
Will follow-up with a change that doesn't use SkRegions!

Note:

The previous code flow gathered a region for all devices (in the canvas method).
However, it only tried to draw into the top device. The new code just focuses on
the top device, which ought to give the same results.

Change-Id: Ic5ed47e7908d646700c09b10faa538415522c645
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/261283
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2019-12-20 20:31:08 +00:00
Robert Phillips
9f744f7ece Change GrGpu::onCreateCompressedTexture signature
In the previous form there was some duplication between the backend format and the SkImage::CompressionType being passed around.

Bug: skia:9680
Change-Id: I04455b7a4289bec83d87be17b75b4e9d4d6ef2e0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/261184
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-12-20 15:37:26 +00:00
Robert Phillips
ca0f837c1e Prepare CompressedBackendAllocationTest for new compression formats
Bug: skia:9680
Change-Id: Ia11219dff9880b78903d8e4b73565cfed5ccf9de
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/261185
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2019-12-20 15:25:56 +00:00
Greg Daniel
bfa19c4e76 Add factories to GrSurfaceContext and clean up creation flow.
This CL updates all callers that ending up in GrDrawingManager::makeSurfaceContext
to use the new factory or directly call ctors.

A follow on change will get the rest of the calls which go to
GrDrawingManager::makeRenderTargetContext

Change-Id: I662da654a1ec8b8972c50fe9ce45a9185d4c3dc1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/260901
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2019-12-20 15:05:56 +00:00
Noah Lavine
334d0ba9d7 Optimize SkSL xor where one argument is constant
Change-Id: I9ea41625fd80433f7f6480fe539321d8df7b7930
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/258877
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2019-12-20 14:50:46 +00:00
Brian Salomon
3a09a3770b Ungenerate GrSimpleTextureEffect
There is no change to the code (yet).

Change-Id: I1997d7ac070691a3384441028503f6dc8565bbf8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/261182
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2019-12-20 14:18:56 +00:00
Brian Osman
088913a63b Start adding unit tests of SkRuntimeEffect
- Change SkRuntimeEffect::Make so *it* can fail, and returns
  [Effect, ErrorText].
- Initial tests just test for expected failure conditions.
  Next steps are to add tests for effects that should work,
  and to validate results on CPU and GPU.

Change-Id: Ibac8c3046104577434034263e9e4a4b177e89129
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/261095
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-12-20 14:15:06 +00:00
Robert Phillips
3e5e2f2c95 Add test for the GrContext::createCompressedBackendTexture API
Bug: skia:9680
Change-Id: Ib51613e6bacb36ff59b2e1e3c3cf13221d0382fa
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/261083
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2019-12-19 16:48:09 +00:00
Mike Reed
2c38315710 hide/remove obsolete/tricky SkMatrix methods
Change-Id: Iee399b929e8ca1a7326a326a643539d05e333d81
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/260818
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2019-12-18 22:29:52 +00:00
Brian Salomon
766098de94 Make sure random unit test processors use an alpha type compatible with
texture data.

It'd probably be good to provide an opaque texture that has an alpha
channel and widen the range of color types that are present in the
future.

Change-Id: I5587a479f7e2f3991f8ae27a4cd44afc533324e8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/260696
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2019-12-18 19:40:11 +00:00
Robert Phillips
0d7e2f158e Change signature of several gpu backend methods
This makes:

onCreateBackendTexture better match onCreateCompressedBackendTexture to better reflect our mipMapping assumptions.

GrCompressedDataSize better match GrComputeTightCombinedBufferSize to allow the used of generated mipmap data.

createVkImageForBackendSurface and createMtlTextureForBackendSurface take a GrRenderable instead of a raw bool

Change-Id: Ifb7d60bc0e626dfbf1cea0d362bcb04093a71ba7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/260780
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2019-12-18 18:27:15 +00:00
Brian Salomon
4dea72a987 Reland x3 "Remove most of GrConfig.h"
This change makes this safe for Chrome:
https://skia-review.googlesource.com/c/skia/+/260779

This reverts commit 3f1a98b779.

Change-Id: Ic6886ceabbf626040fc527ea10fe06cbe74a3854
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/260783
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2019-12-18 17:14:45 +00:00
Robert Phillips
ee94693c7a Fix a sprinkling of GPU issues
Change-Id: I0123fdc3b492f56f8bc9ff592ffe74f854be380b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/260816
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-12-18 16:53:55 +00:00
Mike Reed
190b82d67c Add clipping for perspective triangles
more UI for halfplanes in SampleClip

bug: skia:9698
Change-Id: I9463fe9860fa482ef05fc2113114e61524c38fc0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/260500
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2019-12-17 23:24:18 +00:00
Greg Daniel
3f1a98b779 Reland "Revert "Remove most of GrConfig.h""
This reverts commit 5b9c7ba313.

Reason for revert: Looks to still be breaking chrome

Original change's description:
> Revert "Revert "Remove most of GrConfig.h""
> 
> This reverts commit b0047b57b7.
> 
> Change-Id: I0c6df9e9d5c3984987398d2b7f675005828ab3de
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/260697
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>

TBR=bsalomon@google.com

Change-Id: Ia9860b39c562368f8a2f84283c52f55593333075
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/260642
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2019-12-17 23:16:58 +00:00
Greg Daniel
14b57216e3 Rename GrCaps textureSwizzle to readSwizzle.
Change-Id: Ia5e2c4d3ca7346a1ad7559cd158ed632a70145bc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/260699
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2019-12-17 21:59:08 +00:00
Brian Salomon
5b9c7ba313 Revert "Revert "Remove most of GrConfig.h""
This reverts commit b0047b57b7.

Change-Id: I0c6df9e9d5c3984987398d2b7f675005828ab3de
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/260697
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2019-12-17 21:23:48 +00:00
Brian Salomon
682ba43ba3 Revert "Blend functions as SkSL built ins."
This reverts commit 3794db84e1.

Reason for revert: Still breaking Pixel3 processor optimization test

Original change's description:
> Blend functions as SkSL built ins.
> 
> GPU-only for right now.
> 
> Use in GrGLSLBlend::AppendMode.
> 
> Remove unused GrGLSLBlend::AppendRegionOp.
> 
> Change-Id: I23affe255a1adafa55f3a07ca6291dc84e18e213
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/254678
> Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>

TBR=bsalomon@google.com,brianosman@google.com,ethannicholas@google.com

Change-Id: I0675c0fe00d6540202ca0676fd9b07f3007d0404
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/260639
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2019-12-17 20:20:46 +00:00
Brian Salomon
3794db84e1 Blend functions as SkSL built ins.
GPU-only for right now.

Use in GrGLSLBlend::AppendMode.

Remove unused GrGLSLBlend::AppendRegionOp.

Change-Id: I23affe255a1adafa55f3a07ca6291dc84e18e213
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/254678
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2019-12-17 19:56:47 +00:00
Greg Daniel
46e366ae21 Remove GrTextureContext.
This change mostly just removes GrTextureContext and switches users to
directly creating GrSurfaceContexts. Outside of updating types, the factory
functions for creating Gr*Contexts have not been updated in this but will
be done in a followup.

Change-Id: I55257568d4c096c5fb48c5e38bfa2c01b824e7b5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/260289
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2019-12-16 20:45:10 +00:00
Robert Phillips
48257d74cd Spruce up GrDataUtils in preparation for compressed backend texture support
This fixes a bug in the computation of a solid colored ETC1 block and adds support for mipmapped ETC1 data.

Bug: skia:9680
Change-Id: I50be60d652bd974e0f11966d72228bea5441696c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/259977
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2019-12-16 20:14:03 +00:00
Herb Derby
26300d64ca Make allocation of SkDescriptor do initialization
The SkDescriptor fuzzer did not call init. This caused
mysterious failures.

Make SkDescriptor's constructor initialize its fields.
Remove init().

Change-Id: Icab79c53b2d2878fceecfec06c886b71613cea6f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/260287
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2019-12-16 19:55:42 +00:00
Robert Phillips
df6c734253 Add GrCaps::getConfigFromCompressedBackendFormat
When wrapping a backend texture we currently need to derive a GrPixelConfig from the backend format. The normal caps method (i.e., getConfigFromBackendFormat) is inappropriate for the compressed backend texture use case.

Bug: skia:9680
Change-Id: Ic4de7550c9a11f6e6207374c27d0ea23b8ab1575
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/260044
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2019-12-16 19:19:11 +00:00
Robert Phillips
d6df7b55a5 Switch GrCaps::isFormatCompressed virtual to be 'compressionType'
Most call sites really only want the Boolean so I also added an isFormatCompressed helper.

Change-Id: I77f16033b69bc99329344201d2c85599d60cb757
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/259168
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-12-16 18:00:00 +00:00
Mike Reed
cf0e3c63fd remove dead code around old SkPath enums
Change-Id: I8dc06da48e881d3a9c40b47c799afe27bdcce819
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/257689
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2019-12-14 01:58:10 +00:00
Ben Wagner
ab51c2ce08 Add more variation support on Mac.
With the recent transition to creating fonts from data as CTFonts and
dropping variation support from macOS 10.11 and earlier, it is now
possible to reliably make variation clones and get the axis information.

Change-Id: Ia9a0922ac94a29e1508d2e74d4ce973751044866
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/259421
Reviewed-by: Herb Derby <herb@google.com>
Reviewed-by: Dominik Röttsches <drott@chromium.org>
Commit-Queue: Ben Wagner <bungeman@google.com>
2019-12-13 18:16:13 +00:00
Michael Ludwig
d0840ecf58 Provide record time allocator to onCombineIfPossible()
Change-Id: I3acf5d5fdb29bfbd3407a8065b7567dff43503a0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/259427
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2019-12-13 14:13:43 +00:00
Herb Derby
2fc9fa6d08 Add filter to SkTHashTable and SkTHashMap
Filter takes a bool function where fales means remove the entry.

Change-Id: I768baed6a4e26308f571b0b595ae19aea9d8dca7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/259821
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2019-12-12 22:55:35 +00:00
Mike Klein
f46d5ca492 use std::make_unique
Change-Id: I7c672ff6b8eb95ec8c1123a5bfdb202e1644f494
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/259281
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2019-12-12 22:32:45 +00:00
Brian Salomon
6986c6539e Make Gr[Op]MemoryPool allocate itself into its initial block.
Saves one heap allocation per DDL recorded.

Change-Id: I9393aedc3b48031cd2ea5f0160b107915077099a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/259419
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2019-12-12 20:33:40 +00:00
Mike Reed
bb59dfa9e3 perform perspective clip by default
- this adds new (default) parameter to control clipping when transforming
  rects and paths

Bug: skia:9698
Change-Id: I4cfb36b60bd6bbfcdac0226e374dbc27d5284952
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/259431
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2019-12-12 20:19:59 +00:00
Michael Ludwig
cb10e4d323 Reland "Detach op memory pool from recording context"
This reverts commit ed58654e39.

Reason for revert: Fix field order in SkDeferredDisplayList to deconstruct
dependent types in the proper order.

Original change's description:
> Revert "Detach op memory pool from recording context"
>
> This reverts commit 6b95516728.
>
> Reason for revert: breaking some Win10 bots
>
> Original change's description:
> > Detach op memory pool from recording context
> >
> > This changes GrOpMemoryPool to no longer extend SkRefCnt, and all usages
> > either are std::unique_ptr for owners, or GrOpMemoryPool* when ownership
> > is held somewhere else. The culmination of this is that DDLs explicitly
> > detach the memory pool from the recording context instead of the GrOpsTask
> > maintaining a strong ref that preserved the memory somewhat sneakily.
> >
> > Change-Id: I33e2caebea70cebe8fd7681207c631feeaf2c703
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/259424
> > Commit-Queue: Michael Ludwig <michaelludwig@google.com>
> > Reviewed-by: Robert Phillips <robertphillips@google.com>
> > Reviewed-by: Brian Salomon <bsalomon@google.com>
>
> TBR=bsalomon@google.com,robertphillips@google.com,michaelludwig@google.com
>
> Change-Id: I942ae1e07fdc63d9311f6ee482bd71beca090502
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/259696
> Reviewed-by: Derek Sollenberger <djsollen@google.com>
> Commit-Queue: Derek Sollenberger <djsollen@google.com>

Change-Id: Ia82fa6e42fc8d75b8aa57e5172894e8dfc7e83d1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/259816
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2019-12-12 20:11:40 +00:00
Nathaniel Nifong
20b177a9bf Parse android layer annotations in debugger, play back layers
Bug: skia:9626
Change-Id: I3ae8fa83520690f9af534e9ab0b70834d7890fb0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/256100
Commit-Queue: Nathaniel Nifong <nifong@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2019-12-12 16:32:44 +00:00
Derek Sollenberger
ed58654e39 Revert "Detach op memory pool from recording context"
This reverts commit 6b95516728.

Reason for revert: breaking some Win10 bots

Original change's description:
> Detach op memory pool from recording context
> 
> This changes GrOpMemoryPool to no longer extend SkRefCnt, and all usages
> either are std::unique_ptr for owners, or GrOpMemoryPool* when ownership
> is held somewhere else. The culmination of this is that DDLs explicitly
> detach the memory pool from the recording context instead of the GrOpsTask
> maintaining a strong ref that preserved the memory somewhat sneakily.
> 
> Change-Id: I33e2caebea70cebe8fd7681207c631feeaf2c703
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/259424
> Commit-Queue: Michael Ludwig <michaelludwig@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>

TBR=bsalomon@google.com,robertphillips@google.com,michaelludwig@google.com

Change-Id: I942ae1e07fdc63d9311f6ee482bd71beca090502
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/259696
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Derek Sollenberger <djsollen@google.com>
2019-12-12 16:07:33 +00:00
Robert Phillips
a27d625ca6 Add compression to Mock backend
Bring the Mock backend up to speed since we're expanding compression support.

Bug: skia:9680
Change-Id: I7fd7bed9351d3534d238feca0add54eced31cb4b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/259099
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-12-12 15:42:53 +00:00
Michael Ludwig
6b95516728 Detach op memory pool from recording context
This changes GrOpMemoryPool to no longer extend SkRefCnt, and all usages
either are std::unique_ptr for owners, or GrOpMemoryPool* when ownership
is held somewhere else. The culmination of this is that DDLs explicitly
detach the memory pool from the recording context instead of the GrOpsTask
maintaining a strong ref that preserved the memory somewhat sneakily.

Change-Id: I33e2caebea70cebe8fd7681207c631feeaf2c703
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/259424
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2019-12-12 15:37:04 +00:00
Robert Phillips
bd99c0cf43 Reland "Update FragmentProcessor TextureSampler to hold an GrSurfaceProxyView."
This reverts commit c5c024791b.

Reason for revert: Doh

Original change's description:
> Revert "Update FragmentProcessor TextureSampler to hold an GrSurfaceProxyView."
> 
> This reverts commit acf5929ae0.
> 
> Reason for revert: May be blocking Chrome roll
> Original change's description:
> > Update FragmentProcessor TextureSampler to hold an GrSurfaceProxyView.
> > 
> > In future CLs I will update the Ops that create the TextureSamplers to pass
> > the GrSurfaceProxyView in.
> > 
> > Bug: skia:9556
> > Change-Id: I550dab64974d32e4c3047188063efa2d0832328e
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/259164
> > Commit-Queue: Greg Daniel <egdaniel@google.com>
> > Reviewed-by: Michael Ludwig <michaelludwig@google.com>
> 
> TBR=egdaniel@google.com,michaelludwig@google.com
> 
> Change-Id: Ic804a52c5c6d16a13a9cc2d85bb959f305134177
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:9556
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/259433
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Commit-Queue: Robert Phillips <robertphillips@google.com>

TBR=egdaniel@google.com,robertphillips@google.com,michaelludwig@google.com

Change-Id: If2af5b5b323858e59c0c8db3b75477d74d78abfd
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:9556
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/259434
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-12-12 13:27:21 +00:00
Robert Phillips
c5c024791b Revert "Update FragmentProcessor TextureSampler to hold an GrSurfaceProxyView."
This reverts commit acf5929ae0.

Reason for revert: May be blocking Chrome roll
Original change's description:
> Update FragmentProcessor TextureSampler to hold an GrSurfaceProxyView.
> 
> In future CLs I will update the Ops that create the TextureSamplers to pass
> the GrSurfaceProxyView in.
> 
> Bug: skia:9556
> Change-Id: I550dab64974d32e4c3047188063efa2d0832328e
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/259164
> Commit-Queue: Greg Daniel <egdaniel@google.com>
> Reviewed-by: Michael Ludwig <michaelludwig@google.com>

TBR=egdaniel@google.com,michaelludwig@google.com

Change-Id: Ic804a52c5c6d16a13a9cc2d85bb959f305134177
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:9556
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/259433
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-12-12 13:24:51 +00:00
Greg Daniel
acf5929ae0 Update FragmentProcessor TextureSampler to hold an GrSurfaceProxyView.
In future CLs I will update the Ops that create the TextureSamplers to pass
the GrSurfaceProxyView in.

Bug: skia:9556
Change-Id: I550dab64974d32e4c3047188063efa2d0832328e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/259164
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2019-12-11 23:17:15 +00:00
Leon Scroggins III
ae834f5781 SkWebpCodec: enable a loop count of 1
Commit 557fbb added animation support to SkWebpCodec, with the intent to
match Chromium. This was during the ~1.5 year period between
crbug.com/592735 and crbug.com/649264 when Chromium attempted to align
WebP with GIF, and play the animation once more than the stored number
(see crbug.com/592735). This was later reverted, because it means that a
WebP is unable to play an animation a single time (see
crbug.com/649264). This commit catches SkWebpCodec up with Chromium.

Add a legacy build flag (SK_LEGACY_WEBP_LOOP_COUNT) so we can stage the
change on Android.

Change-Id: If07e00d5e070847ceeb9ce27cd78a846974cdb4d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/259161
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
2019-12-10 21:41:10 +00:00
Greg Daniel
9715b6c450 Add GrSurfaceProxyView to the various draw atlas ops.
Bug: skia:9556
Change-Id: I9eb825ab241fd0d0d4e63408af270a89e872d1c9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/258802
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2019-12-10 20:29:27 +00:00
Julia Lavrova
c5313e6b2a Font features
Change-Id: I8ae44d715fd2fa195c209c8ecb514db3e9644c31
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/259100
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2019-12-10 19:19:24 +00:00
Robert Phillips
ab2b722fdd Switch SkImage::CompressionType to be an enum class
Following CLs use CompressionType much more widely so let's switch it first.

Bug: skia:9680
Change-Id: Ie8847f24936e90dd85e0ad79cbe5542d68c87b12
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/258882
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2019-12-10 15:58:23 +00:00
Julia Lavrova
90bfd1c1c3 Small changes
Change-Id: Ic9c41a2dd11b4df8ab24037df0109e36536ec6c3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/257892
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2019-12-09 21:58:13 +00:00
Michael Ludwig
379e4961fd Merge consecutive entries that share proxy in bulk texture op
Previously, a batch draw that reused the same proxy consecutively
would create a ViewCountPair for each set entry, with its count == 1.
This turned into 1 draw per entry, so although there'd still be a single
pipeline, it didn't take advantage of merging those consecutive entries
into a larger draw to reduce draw count as well.

Initially, the thinking for the batch API was that it was for tilers
that used unique images for each tile or render pass. However, Chrome's
compositor is also responsible for rendering 9 patches as part of the UI.
These appear as 9 consecutive entries in the image set that all refer to
the same texture. With this CL the texture op will automatically merge
such occurrences into one ViewCountPair with a count of 9.

The bulkrect_1000_[grid|random]_sharedimage_batch leverages this case.
Before this CL its op would hold 1000 view count pairs that each drew
one quad. Now its op will hold 1 view count pair with a count of 1000.
On my linux workstation, the bulkrect_1000_grid_sharedimage_batch time
went from 377us to 206us. For reference, the _ref variant (which already
was a 1 view count pair with ct == 1000 due to merging of each op) has
a time of 497us. The difference between 497us and 206us represents the
overhead of calling through SkCanvas, op creation, quad optimization
analysis 1000x.

Interestingly the bulkrect_1000_random_sharedimage_batch benchmark did not
change on my workstation. My conjecture is that it is bottlenecked by
overdraw of the many overlapping rectangles.

Change-Id: Icc4195de0bcb2219f424fdaa79728281c0418558
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/258418
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2019-12-06 18:49:35 +00:00
Robert Phillips
3968fcbc3a Pull creation of GrPipeline explicitly into the Ops' onExecute methods
This is a first step towards pulling the creation of the GrProgramInfos explicitly into the Ops' onExecute methods. We need this behavior so programInfo creation can be moved forward to onPrePrepare.

For now, pipeline creation is a static member on GrSimpleMeshDrawOpHelper so GrPipeline creation can be bottle-neckedOps for Ops that don't use the helper. In some future world CreatePipeline could become non-static to reduce some of the duplicate code.

Bug: skia:9455
Change-Id: I2d35dd223db824e84616f5df0f1dca34c1b6e412
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/258003
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-12-06 16:33:15 +00:00
Brian Salomon
b0047b57b7 Revert "Remove most of GrConfig.h"
This reverts commit 80e334dad8.

Reason for revert: Chrome is including our private headers which means this breaks the Chrome roll:
https://chromium-review.googlesource.com/c/chromium/src/+/1953757

Original change's description:
> Remove most of GrConfig.h
> 
> Change-Id: I0f693bed0778151f93d07cd42c6b597566695ab1
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/257999
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>

TBR=egdaniel@google.com,bsalomon@google.com

Change-Id: Ie206db9865a7f9a7e334eb248de8cff38dd31d15
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/258356
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2019-12-05 19:52:48 +00:00
Brian Salomon
80e334dad8 Remove most of GrConfig.h
Change-Id: I0f693bed0778151f93d07cd42c6b597566695ab1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/257999
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2019-12-05 18:37:33 +00:00
Greg Daniel
f0e04f0c31 Always destroy resources instead of simply "abandoning" them in Vulkan backend.
This also now requires that when using a vulkan GrContext, the backing VkDevice,
Queue, and Instance must be alive when the GrContext is first destroyed or
abandoned. Additionally any GrBackendTextures created from the GrContext must
be deleted before destroying or abandoning the GrContext.

Bug: skia:9603
Change-Id: Ibf194d2ffdcddd61e34214d7d59a2d9a33c880e5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/257921
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2019-12-05 14:45:45 +00:00
Mike Klein
7a671982cd work around GCC 8 mips release bug?
This feels kind of bad, but at least it's just a unit test?

Change-Id: I18740f846680218a00add40eb2398876c4fd19be
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/258023
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2019-12-04 21:14:13 +00:00
Greg Daniel
1a5d2d590a Remove unneeded abandon/release check in GrGpuResource message processing.
Change-Id: Ib11405be82e8ff7fd1edcaca2f19c44cce2abbd9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/257889
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2019-12-04 18:11:16 +00:00
Mike Klein
f78aa16af1 work around GCC false positive warning?
On 32-bit Release builds, GCC warns about this line in this test,

    ../../tests/SkRasterPipelineTest.cpp:225:40:
    error: ‘int __builtin_memcmp_eq(const void*, const void*, unsigned int)’
    reading 8 bytes from a region of size 0 [-Werror=stringop-overflow=]
                                 !memcmp(&data[j][0], &buffer[j][0], sizeof(buffer[j])));
                                  ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I don't really see anything wrong, and I'm not really sure why it takes
offense here testing load_f16 and not in the very similar next chunk of
code testing load_af16.  Anyway, it's simple enough to write a loop.

Change-Id: Ie4f598328dd7109660b9ae97a5a27b386e833fd5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/257869
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Auto-Submit: Mike Klein <mtklein@google.com>
2019-12-04 17:07:46 +00:00
Mike Klein
0f9df470ca remove pointless tests
Why are we testing how memset() and snprintf() work in
tests/StringTest.cpp.  Nevermind, I don't want to know...

Change-Id: Ic8608fea95635ee2fbb7da34a195de73d7a1444a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/257415
Commit-Queue: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2019-12-02 21:27:39 +00:00
Julia Lavrova
3281b961c5 A new API call on Paragraph: a number of unresolved glyphs
Change-Id: Iba33c0df4aa9f2dc9b816c0954980ac8a971909b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/257326
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2019-12-02 19:23:45 +00:00
Herb Derby
126d7a2636 Cleanup unit test output
Change-Id: Ic6467a505f50c9bd10c29099aa45e265a0434169
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/257046
Auto-Submit: Herb Derby <herb@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2019-11-27 17:12:23 +00:00
Brian Salomon
c241b58965 Make fragment processor iterators work with range for loops.
When iterating over the coord transforms or texture samplers of a
FP also have access to the owning FP.

Pass a coord transform range to GPs rather than a pointer to an
iterator.

Change-Id: If7c829a67dce6600d7f49e12d6f49f685dcace3a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/256216
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2019-11-27 14:32:43 +00:00
Herb Derby
81777ac947 Make SkEnumerate make flatten tuples
The new c++17 only has a single level of destructuring;
append the index instead of nesting it.

Change-Id: I26bb1ca387d1de57233dbf7096dcf4bb7aaedecf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/254637
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2019-11-27 05:16:23 +00:00
Robert Phillips
933484f6bb Stop using GrPixelConfig in Metal & Dawn's GrProgramDesc creation
In order to be able to create GrProgramDescs pre-flush we would like as little reliance on the GrRenderTarget as possible (also GrPixelConfig is going away).

Bug: skia:9455
Change-Id: Ie35c87758bb1ed97c99c6e9e130eaeb3355f4139
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/256457
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-11-26 17:51:34 +00:00
Mike Reed
7d34dc7747 Revert "Revert "switch to new filltype for SkPath""
This reverts commit 3e7af41224.

Change-Id: Id4f66b3956f4bdbe690db20fc478b7365ee89717
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/256676
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Mike Reed <reed@google.com>
2019-11-26 17:43:14 +00:00
Emircan Uysaler
17096c763c Revert "Disable VkProtectedContext_DDLMakeRenderTargetTest"
This reverts commit 6b4afb27fd.

Reason for revert: Fuchsia fix landed on https://bugs.fuchsia.dev/p/fuchsia/issues/detail?id=40061#c11.

Original change's description:
> Disable VkProtectedContext_DDLMakeRenderTargetTest
> 
> Bug: fuchsia:40061
> Change-Id: I9d6293298bc27b81f5b4202d56c930f976c86cfc
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/254336
> Commit-Queue: Emircan Uysaler <emircan@google.com>
> Commit-Queue: Greg Daniel <egdaniel@google.com>
> Reviewed-by: Greg Daniel <egdaniel@google.com>

TBR=egdaniel@google.com,emircan@google.com

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: fuchsia:40061
Change-Id: I3db60ae3376cd8fe1719b482d2788eb9d48338f5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/256659
Reviewed-by: Emircan Uysaler <emircan@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2019-11-26 15:59:04 +00:00
Michael Ludwig
704d5408db Allow Tessellator to operate on provided GrQuads
To facilitate this, the GrQuadBuffer::Iter's local GrQuads that are
modified on each next() are now allowed to be operated on for the AA
inset/outsetting. Previously this required additional GrQuads on the
stack to hold the results, and additional guards for accessing localQuad()
when the entry didn't have actual coords.

With this change, a 2D op should have its device and src GrQuads' Ws
set to 1 once, and then they are completely ignored for all iteration
and tessellation, without any more redundant initialization. In all
likelihood we won't see the needle move on powerful platforms, but may
help lower end devices.

Change-Id: I457205786766403a760918e779d36ba056d69cde
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/256097
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2019-11-26 14:57:44 +00:00
Mike Reed
3e7af41224 Revert "switch to new filltype for SkPath"
This reverts commit 3a50981a83.

Reason for revert: chrome win build found compile-problem in xpsdevice

Original change's description:
> switch to new filltype for SkPath
> 
> Change-Id: I7793324a9acf4afb0eb38c1e20fbb38eac25d636
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/256102
> Reviewed-by: Florin Malita <fmalita@chromium.org>
> Commit-Queue: Mike Reed <reed@google.com>

TBR=fmalita@chromium.org,reed@google.com

Change-Id: Iacb3566da61c2512b9bd6b7e42b592febc85e031
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/256530
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2019-11-26 03:34:30 +00:00
Mike Reed
3a50981a83 switch to new filltype for SkPath
Change-Id: I7793324a9acf4afb0eb38c1e20fbb38eac25d636
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/256102
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
2019-11-25 22:31:46 +00:00
Julia Lavrova
c028b42717 Ellipsis again
Change-Id: I895fd394dedc50acd648eeed4f398c375a9812ee
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/256224
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2019-11-25 19:57:15 +00:00
Herb Derby
06a620868e Structured binding for SkZip and SkEnumerate
Change-Id: I619d45fc270b6405f687096df2d333fe5e5ecb53
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/254276
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2019-11-25 17:07:46 +00:00
Brian Salomon
fc118442f6 Reland "Revert "Revert "Make FP optimizations helpers use SkAlphaType not GrColorType"""
This is a reland of 997b37fdb9

Layout tests have been suppressed.

Original change's description:
> Revert "Revert "Make FP optimizations helpers use SkAlphaType not GrColorType""
>
> This reverts commit 078e8faa26.
>
> Change-Id: I67b2970584db5a1afbf9928b77c5444947ef71a3
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/255897
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>

Change-Id: I6db4cff8b71ef1f29ac47f7729b9514d009f730a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/256225
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2019-11-25 15:46:35 +00:00
Robert Phillips
50299de399 Reland "Revert "Make FP optimizations helpers use SkAlphaType not GrColorType""
This reverts commit 997b37fdb9.

Reason for revert: May be blocking Chrome roll

Original change's description:
> Revert "Revert "Make FP optimizations helpers use SkAlphaType not GrColorType""
> 
> This reverts commit 078e8faa26.
> 
> Change-Id: I67b2970584db5a1afbf9928b77c5444947ef71a3
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/255897
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>

TBR=egdaniel@google.com,bsalomon@google.com

Change-Id: I0d2754ac7f4672f0758e4d00cd9e06998637846a
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/256196
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-11-23 15:21:08 +00:00
Brian Salomon
997b37fdb9 Revert "Revert "Make FP optimizations helpers use SkAlphaType not GrColorType""
This reverts commit 078e8faa26.

Change-Id: I67b2970584db5a1afbf9928b77c5444947ef71a3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/255897
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2019-11-23 00:51:03 +00:00
Ethan Nicholas
db80f6936c SkSL now supports functions defined in sksl_gpu.inc
Change-Id: Ib29f41f6e71b176fec1ead26259ad1945a41e634
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/254677
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2019-11-22 19:39:44 +00:00
Mike Reed
30bc527fd6 Revert "Reland "Revert "Use flat version of path-direction enum"""
This reverts commit 7cda6f3743.

Reason for revert: legacy convexity code removed -- google3 should be ok

Original change's description:
> Reland "Revert "Use flat version of path-direction enum""
>
> This reverts commit 1792b19485.
>
> Reason for revert: need to update legacy_convexity, still used by google3
>
> Original change's description:
> > Revert "Revert "Use flat version of path-direction enum""
> >
> > This reverts commit 0dacc6b7d3.
> >
> > Change-Id: Ie103e9f36b07e4ee256a3688a4decf3a6dd74314
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/255832
> > Auto-Submit: Mike Reed <reed@google.com>
> > Reviewed-by: Mike Reed <reed@google.com>
> > Commit-Queue: Mike Reed <reed@google.com>
>
> TBR=reed@google.com
>
> Change-Id: I0ecea0eb8a237298c6b908cc4bfd1cacdfc5b900
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/255976
> Reviewed-by: Mike Reed <reed@google.com>
> Commit-Queue: Mike Reed <reed@google.com>

TBR=reed@google.com

Change-Id: I3529139bb391c4f62ce5cd0744cdf38a13b71d78
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/255984
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2019-11-22 19:09:54 +00:00
Mike Reed
8ee77d8f42 remove LEGACY_CONVEXITY code -- no more clients
Change-Id: Ifd33831b6a83a56685435ce8e4fbb218a147b34e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/255981
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2019-11-22 18:31:44 +00:00
Michael Ludwig
fe13ca3e67 Move textureop fallback code out of GrRTC and into AddTextureSetOps
(also renames CreateTextureSetOps to AddTextureSetOps, to match naming of
GrFillRectOp::AddFillRectOps).

Now that GrTextureOp can add more than one op to the GrRTC, it can take
over ownership of its fallback code for the texture set. It already had
taken over the code for non src-over blends when drawing a single texture.

Besides consolidating where the logic of converting TextureSetEntries into
op data lives, this makes the fallback case more consistent in terms of
performance. Previously, it would go through GrRTC::drawTexturedQuad,
which attempts to merge the clip with the draw for correctness reasons.
A batch never attempted these optimizations, so now even when one op per
quad is required, there won't be the overhead of comparing clips.

Change-Id: I30883e3bd45ed4386f81584e3d68229c46b17e47
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/255781
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2019-11-22 16:13:03 +00:00
Mike Reed
7cda6f3743 Reland "Revert "Use flat version of path-direction enum""
This reverts commit 1792b19485.

Reason for revert: need to update legacy_convexity, still used by google3

Original change's description:
> Revert "Revert "Use flat version of path-direction enum""
> 
> This reverts commit 0dacc6b7d3.
> 
> Change-Id: Ie103e9f36b07e4ee256a3688a4decf3a6dd74314
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/255832
> Auto-Submit: Mike Reed <reed@google.com>
> Reviewed-by: Mike Reed <reed@google.com>
> Commit-Queue: Mike Reed <reed@google.com>

TBR=reed@google.com

Change-Id: I0ecea0eb8a237298c6b908cc4bfd1cacdfc5b900
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/255976
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2019-11-22 11:03:34 +00:00
Brian Salomon
078e8faa26 Revert "Make FP optimizations helpers use SkAlphaType not GrColorType"
This reverts commit 7a538b1eec.

Reason for revert: ios failures

Original change's description:
> Make FP optimizations helpers use SkAlphaType not GrColorType
> 
> Change-Id: I3b7cde6e7f68192af5419fb09c7d59e7a803a4d5
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/255818
> Commit-Queue: Brian Salomon <bsalomon@google.com>
> Reviewed-by: Greg Daniel <egdaniel@google.com>

TBR=egdaniel@google.com,bsalomon@google.com

Change-Id: Id41daa47fb3ccac434bb9d71a697f32e36c87367
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/255835
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2019-11-22 04:10:34 +00:00
Brian Salomon
7a538b1eec Make FP optimizations helpers use SkAlphaType not GrColorType
Change-Id: I3b7cde6e7f68192af5419fb09c7d59e7a803a4d5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/255818
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2019-11-22 03:30:32 +00:00
Mike Reed
1792b19485 Revert "Revert "Use flat version of path-direction enum""
This reverts commit 0dacc6b7d3.

Change-Id: Ie103e9f36b07e4ee256a3688a4decf3a6dd74314
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/255832
Auto-Submit: Mike Reed <reed@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2019-11-22 00:51:22 +00:00
Mike Reed
0dacc6b7d3 Revert "Use flat version of path-direction enum"
This reverts commit e0fbe94351.

Reason for revert: need to add guard flag to flutter

Original change's description:
> Use flat version of path-direction enum
> 
> Bug: skia:9663
> Change-Id: I00077d9f2b14b3e983e6a46ef6f560cabdb1678d
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/242557
> Commit-Queue: Mike Reed <reed@google.com>
> Reviewed-by: Florin Malita <fmalita@chromium.org>

TBR=fmalita@chromium.org,reed@google.com

Change-Id: If47173d9b203b2d3a175af290a15d986accb4703
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:9663
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/255831
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2019-11-21 22:10:32 +00:00
Mike Reed
e0fbe94351 Use flat version of path-direction enum
Bug: skia:9663
Change-Id: I00077d9f2b14b3e983e6a46ef6f560cabdb1678d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/242557
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2019-11-21 21:45:20 +00:00
Robert Phillips
7cd0bfe769 No longer ref count GrGeometryProcessors
This CL is 100% plumbing. We ultimately want all GrPrimitiveProcessor-derived objects to not be refCounted. This will make several helper objects POD and, by putting them into an arena, will make managing their lifetime easier (e.g., for DDL prePreparing).

Note: the CCPR GrGeometryProcessor-derived classes only ever appear on the stack so aren't forced into arenas.

Bug: skia:9455
Change-Id: Ib9be503d2fbf8c2578642df93fc301156629829d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/255304
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2019-11-20 21:36:52 +00:00
Mike Klein
4a627011ea SkReader32::setMemory() requires 4-byte alignment
We've just been getting lucky that the char[] was 4-byte aligned.

Change-Id: I550be24b0e6f074a38ef002b6b10fbdc5cdfcf2b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/255557
Commit-Queue: Mike Klein <mtklein@google.com>
Commit-Queue: Ben Wagner aka dogben <benjaminwagner@google.com>
Auto-Submit: Mike Klein <mtklein@google.com>
Reviewed-by: Ben Wagner aka dogben <benjaminwagner@google.com>
2019-11-20 20:20:10 +00:00
Mike Klein
17e2714c9f skip _imm ops on ARM
These are really designed around x86, so forcing them
on ARM where our existing non-immediate ops work better
is kind of silly.

Change-Id: I6b66ed0b0a71b335becdcb1d67dec471620542b0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/254440
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2019-11-20 00:08:05 +00:00
John Rosasco
24cbdab97e SKQP Build for Fuchsia SDK
Change-Id: I2619784eca0f7a4dd66f2db0104cb746d9266b4e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/244369
Commit-Queue: John Rosasco <rosasco@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2019-11-18 12:34:28 +00:00
Herb Derby
0d59368721 Add subspan() to SkZip
Change-Id: I54916c7e14646b8a66dd8341a1cb4b46ba8dba2c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/254737
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
Auto-Submit: Herb Derby <herb@google.com>
2019-11-15 23:11:24 +00:00
Herb Derby
c9dcd09f24 Add last() to SkZip
Change-Id: Ia1a1e58df38bd4865d4d3d389a6a75835b5e87df
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/254809
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2019-11-15 22:15:34 +00:00
Robert Phillips
67a625e51e Make GrProgramInfo take pointers to the GrPipeline and the GrPrimitiveProcessor
Hopefully this makes it clearer that the GrProgramInfo isn't copying these
objects.

Bug: skia:9455
Change-Id: Id43b7978d63b6d53d531601f3446745f33afcf2d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/254970
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-11-15 21:48:21 +00:00
Robert Phillips
8bc157e216 Reduce max # of AA Quads that can be merged or chained into a single GrTextureOp (take 2)
It is, arguably, not a good metric but the max number of AA Quads that are merged or chained together across all Skia's GMs and SKPs is 276.

This should also reduce the memory consumed from 245,760 bytes to 30,720 bytes.

Bug: b/143572065 skia:9601
Change-Id: I86f3ae2830d8a64ebcc6f5b7da8c0a4dac8761d5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/254916
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-11-15 18:51:16 +00:00
Robert Phillips
e837e61b5a Respect the max indexBuffer limits in the bulk texture draw API (take 2)
This is required before we can lower the max AA quad count (again).

Bug: b/143572065 skia:9601
Change-Id: Ibd029a59f6589e1ae6c66d072e5039f0e9de06dc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/254581
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2019-11-15 16:57:33 +00:00
Robert Phillips
438d986b47 Respect max index buffer sizes in GrFillRectOp::MakeSet
This is required before we can lower the max AA quad count (again).

Bug: b/143572065 skia:9601
Change-Id: Iea5884ffff9bd62f62527fcb597dac97d33ecd76
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/254438
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2019-11-14 18:26:18 +00:00
Brian Salomon
bf5c0c0c99 Fixed sampling non-SkSL FPs with coordinates
This fixes an issue where fragment processors which were not written
in pure SkSL did not interact properly with coordinate overrides.

Change-Id: I960173986fd8d6be7322f55ab0d81a533b6b89e5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252916
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2019-11-14 17:46:18 +00:00
Mike Klein
37be7715fd implement assert_true on ARM
This all comes together as

    uminv tmp, condition
    fmov  gp, tmp
    cbnz  gp, all_true
    brk   0
  all_true:
    ...

The key idea is uminv(vec) will return 0 if any of the inputs are 0,
and non-zero if all of the inputs are non-zero, namely 0xffffffff.

fmov moves that minimum from a vector register to a general purpose
register where we can test it with cbnz, compare and branch if non-zero.
This jumps over the `brk 0` debug trap when all inputs are true.

Change-Id: If5deb77a77f52221d0649e537179743c45eb9cc5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/254479
Auto-Submit: Mike Klein <mtklein@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2019-11-13 22:09:59 +00:00
Emircan Uysaler
6b4afb27fd Disable VkProtectedContext_DDLMakeRenderTargetTest
Bug: fuchsia:40061
Change-Id: I9d6293298bc27b81f5b4202d56c930f976c86cfc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/254336
Commit-Queue: Emircan Uysaler <emircan@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2019-11-13 19:11:33 +00:00
Robert Phillips
ae01f62009 Revert "Respect the max indexBuffer limits in the bulk texture draw API"
This reverts commit dd947ceb55.

Reason for revert: CL isn't getting any respect from Android

Original change's description:
> Respect the max indexBuffer limits in the bulk texture draw API
> 
> This is required before we can lower the max AA quad count (again).
> 
> Bug: b/143572065 skia:9601
> Change-Id: Id34123476ad49a57dc9ce7fe13f941c06f721b74
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252603
> Commit-Queue: Robert Phillips <robertphillips@google.com>
> Reviewed-by: Michael Ludwig <michaelludwig@google.com>

TBR=robertphillips@google.com,michaelludwig@google.com

Change-Id: Ibe396fe5a0351190c214ed54611ce72b7928cadd
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: b/143572065 skia:9601
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/254437
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-11-13 15:56:43 +00:00
Robert Phillips
dd947ceb55 Respect the max indexBuffer limits in the bulk texture draw API
This is required before we can lower the max AA quad count (again).

Bug: b/143572065 skia:9601
Change-Id: Id34123476ad49a57dc9ce7fe13f941c06f721b74
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252603
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2019-11-13 15:32:02 +00:00
Herb Derby
cb443a5928 Force single glyph calls through bulk interface
Enance SkBulkGlyphMetrics, SkBulkGlyphMetricsAndPaths, and SkBulkGlyphMetricsAndImages
with single glyph calls. In addtion, add calls needed to have the rest of the system
work with these interfaces.

As a resulte move the glyph, prepareImage, and preparePath calls to private.

Change-Id: I8d383b649390e45f621dcb9d62fb8367a55cee02
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/254056
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2019-11-12 22:38:14 +00:00
John Rosasco
a9b348f66c Reland fully delineate GL usage w/ skia_use_gl.
Change-Id: I90f40467be145537cc08461fd3805606432f0cfd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/254240
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: John Rosasco <rosasco@google.com>
Auto-Submit: John Rosasco <rosasco@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2019-11-12 21:43:44 +00:00
Mike Klein
8c1e0effbb sketch out structure for ops with immediates
Lots of x86 instructions can take their right hand side argument from
memory directly rather than a register.  We can use this to avoid the
need to allocate a register for many constants.

The strategy in this CL is one of several I've been stewing over, the
simplest of those strategies I think.  There are some trade offs
particularly on ARM; this naive ARM implementation means we'll load&op
every time, even though the load part of the operation can logically be
hoisted.  From here on I'm going to just briefly enumerate a few other
approaches that allow the optimization on x86 and still allow the
immediate splats to hoist on ARM.

1) don't do it on ARM
A very simple approach is to simply not perform this optimization on
ARM.  ARM has more vector registers than x86, and so register pressure
is lower there.  We're going to end up with splatted constants in
registers anyway, so maybe just let that happen the normal way instead
of some roundabout complicated hack like I'll talk about in 2).  The
only downside in my mind is that this approach would make high-level
program descriptions platform dependent, which isn't so bad, but it's
been nice to be able to compare and diff debug dumps.

2) split Op::splat up
The next less-simple approach to this problem could fix this by
splitting splats into two Ops internally, one inner Op::immediate that
guantees at least the constant is in memory and is compatible with
immediate-aware Ops like mul_f32_imm, and an outer Op::constant that
depends on that Op::immediate and further guarantees that constant has
been broadcast into a register to be compatible with non-immediate-aware
ops like div_f32.  When building a program, immediate-aware ops would
peek for Op::constants as they do today for Op::splats, but instead of
embedding the immediate themselves, they'd replace their dependency with
the inner Op::immediate.

On x86 these new Ops would work just as advertised, with Op::immediate a
runtime no-op, Op::constant the usual vbroadcastss.  On ARM
Op::immediate needs to go all the way and splat out a register to make
the constant compatible with immediate-aware ops, and the Op::constant
becomes a noop now instead.  All this comes together to let the
Op::immediate splat hoist up out of the loop while still feeding
Op::mul_f32_imm and co.  It's a rather complicated approach to solving
this issue, but I might want to explore it just to see how bad it is.

3) do it inside the x86 JIT
The conceptually best approach is to find a way to do this peepholing
only inside the JIT only on x86, avoiding the need for new
Op::mul_f32_imm and co.  ARM and the interpreter don't benefit from this
peephole, so the x86 JIT is the logical owner of this optimization.
Finding a clean way to do this without too much disruption is the least
baked idea I've got here, though I think the most desirable long-term.

Cq-Include-Trybots: skia.primary:Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Debug-All-SK_USE_SKVM_BLITTER,Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Release-All-SK_USE_SKVM_BLITTER
Change-Id: Ie9c6336ed08b6fbeb89acf920a48a319f74f3643
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/254217
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2019-11-12 20:17:55 +00:00
Mike Klein
749eef6b1a implement assert_true on x86
The logic implemented here is roughly

  assert_true(v):
     if any ~v {
         int3()
     }

  in assembly as

  ```
    vptest v, constant 0xffffffff mask
    jc ok
    int3
  ok:
  ```

jc branches if (~v & mask) are all zero, with mask set fully, that's
branch if ~v are all zero, which is to say, v are all ~0, true.  So we
jump over the int3 breakpoint if v are all true.

Cq-Include-Trybots: skia.primary:Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Debug-All-SK_USE_SKVM_BLITTER
Change-Id: Ie0fc1da15b1a0dba00c66af610ccde18f5985f8a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/253897
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Auto-Submit: Mike Klein <mtklein@google.com>
2019-11-12 20:07:35 +00:00
Chris Dalton
5e8cdfdd8b Add 'numRasterSamples' and 'isMixedSampled' to GrProgramInfo
Replaces numSamples with numRasterSamples, and adds isMixedSampled.
The sample count that vulkan and metal actually want to know is how
many samples the rasterizer will compute, which may not match the
number of samples in the render target when we have mixed samples.
They will also need to know whether a program is mixed sampled in
order to set up coverage modulation.

Change-Id: I133c11f74b7dc6a7580818ef73d6deec1d201b64
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/253550
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2019-11-12 17:14:19 +00:00
Jim Van Verth
9187e49ed1 Detect whether trying to blit a Metal swapchain texture, and fail if so.
Metal swapchain textures (equivalent to GL's FBO 0) can't be used with
MTLBlitCommandEncoder. For copySurface we need to detect this and fail.
Future changes will handle GrSurfaceProxy.

Change-Id: I9235d91cf31e96260c8d1da5938f5441d2e49d27
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252045
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2019-11-12 14:56:28 +00:00
Mike Klein
ee5864a170 add int3, vptest, jc
Will use these to implement assert_true on x86.

Change-Id: I9d2595a35518b6971dd8e418b583febd3960c7f6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/253896
Commit-Queue: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2019-11-11 16:33:01 +00:00
Mike Klein
1360117174 add assert_true()
This is an assert that is active in debug mode.  For the moment it only
works in the interpreter, but I plan to follow up with JIT code too.

assert_true() is a data sink like a store() as far as lifetime goes,
though we take care to allow it to be hoisted if its inputs are.  An
assert_true's existence will keep all its inputs alive, and in release
builds where we skip the instruction, those inputs will all drop away
automatically.

Tested locally by forcing the interpreter.  It shouldn't be long before
I have at least x86 JIT asserts working too.

Change-Id: I7aba40d040436a57a6b930790f7b8962bafb1a8c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/253756
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2019-11-11 15:12:18 +00:00
Julia Lavrova
b30d4812c7 Yet another build fix
Change-Id: I606689930c9d07dbba3e743d1137e7c3c54790d4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/253736
Commit-Queue: Julia Lavrova <jlavrova@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2019-11-08 21:22:37 +00:00
Mike Klein
6e4aad91c3 rename to_i32 -> trunc, and add round
This plumbs through round but doesn't use it.  I want that change to be
its own CL.  It's nice to have assembler support and the name changes
even if I revert using round.

Change-Id: I6d67ec5c63546069eb7cc1c91599b599bafcda66
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/253724
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2019-11-08 21:00:51 +00:00
Mike Klein
a53e47fe94 native f32 min/max
No diffs.

Change-Id: Ia0b35c2787e27d74763f21b81072affa6caf1e5a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/253720
Commit-Queue: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2019-11-08 20:21:38 +00:00
Mike Reed
052a05ac3a add flatten test to SkFont
Change-Id: I7e96e826fad9aa204c963ae671cce668a676378f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/253684
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
2019-11-08 18:49:15 +00:00
Julia Lavrova
2e30fde046 Font resolution: all unit tests working
Change-Id: Ie6ee30901d599ceefa42651add79bb0288c54c48
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/249004
Commit-Queue: Julia Lavrova <jlavrova@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Julia Lavrova <jlavrova@google.com>
2019-11-08 17:24:14 +00:00
Mike Klein
81a8d282d3 Reland "hook up float comparisons to x86 JIT"
This is a reland of 12cea8d6c4

Now implementing float comparisons on ARM also.
Only vaguely tricky thing is that x!=y is ~(x==y).

Original change's description:
> hook up float comparisons to x86 JIT
>
> This gets the draws in gm/skvm.cpp all JITing again,
> and in one of the unit tests.
>
> (Everything draws the same of course.)
>
> Change-Id: Iada28690d9df78f9d444ee3765e21beb29239672
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/253166
> Auto-Submit: Mike Klein <mtklein@google.com>
> Reviewed-by: Mike Klein <mtklein@google.com>
> Commit-Queue: Mike Klein <mtklein@google.com>

Cq-Include-Trybots: skia.primary:Test-Android-Clang-NVIDIA_Shield-CPU-TegraX1-arm64-Debug-All-Android
Change-Id: I771b8a327a958db8a0d509d55863ade935a00035
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/253401
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2019-11-07 18:55:14 +00:00
Mike Klein
3f7c865936 avoid the JIT on MSAN builds
JIT code isn't MSAN-instrumented, so we won't see when it uses
uninitialized memory, and we'll not see the writes it makes as properly
initializing memory.  Instead force the interpreter, which should let
MSAN see everything our programs do properly.

This refactors so that SkVM.cpp is the only code to look at whether
SKVM_JIT is defined, and undefines it when built with MSAN.  Added
a simple regression test too.

Cq-Include-Trybots: skia.primary:Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Debug-All-MSAN
Change-Id: Ic7cca2621f84dfba7174127738744d6c68f85f2e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/253410
Auto-Submit: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2019-11-07 18:24:34 +00:00
herb
252cdb7824 One glyph() to rule them all!!!
Change-Id: Icb8d9653b5037921648a6c20ff21d26375301b65
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/253381
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2019-11-07 18:03:34 +00:00
Mike Klein
297d5a03e6 Revert "hook up float comparisons to x86 JIT"
This reverts commit 12cea8d6c4.

Reason for revert: unit tests failing on ARM... will try again once I have float comparisons implemented for ARM too.

Original change's description:
> hook up float comparisons to x86 JIT
> 
> This gets the draws in gm/skvm.cpp all JITing again,
> and in one of the unit tests.
> 
> (Everything draws the same of course.)
> 
> Change-Id: Iada28690d9df78f9d444ee3765e21beb29239672
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/253166
> Auto-Submit: Mike Klein <mtklein@google.com>
> Reviewed-by: Mike Klein <mtklein@google.com>
> Commit-Queue: Mike Klein <mtklein@google.com>

TBR=mtklein@google.com,reed@google.com

Change-Id: Ie07e580b4998199338217a27d4fad34c679ffc23
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/253399
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2019-11-07 15:35:12 +00:00
Mike Klein
12cea8d6c4 hook up float comparisons to x86 JIT
This gets the draws in gm/skvm.cpp all JITing again,
and in one of the unit tests.

(Everything draws the same of course.)

Change-Id: Iada28690d9df78f9d444ee3765e21beb29239672
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/253166
Auto-Submit: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2019-11-07 14:36:32 +00:00
Robert Phillips
cea290f9d5 Add GrPrimitiveType to GrProgramInfo
This further consolidates the information required to compute the program key (esp. for Vulkan). This CL mainly comprises the plumbing portion - a follow up CL will actually use it.

Bug: skia:9455
Change-Id: Iaac716c289916981a1757a333bfa57b3051fd35b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252161
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-11-07 13:30:42 +00:00
Herb Derby
2959749f85 Allow more sub-pixel position bits
I tracked down all the places where things were assuming 2-bits
of sub-pixel positions. I generalized them all to take a variable
number of bits.

Change-Id: I304061635c838fedc3881aaa256bab943ff6a817
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/253236
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2019-11-06 21:37:07 +00:00
Mike Klein
714f8cc3ff add vcmpps
Change-Id: I7a13b759d2cd2c27c107ff4cec0daa15c2cd9edb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/253131
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2019-11-06 21:22:22 +00:00
Herb Derby
f7ce19e773 Improve the dynamic range of SkPackedGlyphID ctor
The previous version only translated the sub-position reliably
if the position < 2^10. This code extends the range to 2^21.

Change-Id: I7fcdfe2c3f7336ac0788e282c2bd0fc73067d8fb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/253101
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2019-11-06 20:27:42 +00:00
Brian Salomon
6790423f84 fix tolerance in read pixels tests
This was accidentally loosened up

Change-Id: I7a95ed5b56aff06114ceaa9c2a3719bd85d4add4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252934
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2019-11-06 17:28:03 +00:00
Robert Phillips
0efc01d540 Revert "Fully delineate GL usage w/ skia_use_gl"
This reverts commit 078cf3e3b2.

Reason for revert: Appears to be blocking the Chrome roll due to Fuchsia build failures

Original change's description:
> Fully delineate GL usage w/ skia_use_gl
> 
> Change-Id: I17424d2235c7a54c4cda036f01a0b99dadc4b632
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252085
> Commit-Queue: Mike Klein <mtklein@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>

TBR=mtklein@google.com,bsalomon@google.com,halcanary@google.com,rosasco@google.com

Change-Id: I17ba79bfe6e7f81c126eddbd50ca5384cfa4179c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/253098
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-11-06 17:19:48 +00:00
John Rosasco
078cf3e3b2 Fully delineate GL usage w/ skia_use_gl
Change-Id: I17424d2235c7a54c4cda036f01a0b99dadc4b632
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252085
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2019-11-06 15:15:03 +00:00
Ben Wagner
da53dd5e17 Reland "Fix empty run handling in trivial shaper iterators"
This reverts commit 1803f4ef6f.
And also fixes the primitive shaper.

Change-Id: Ieaeda5522c98d8a9e6f628b8a6cc30cf41278350
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252929
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2019-11-06 14:32:13 +00:00
Ben Wagner
1803f4ef6f Revert "Fix empty run handling in trivial shaper iterators"
This reverts commit 0f3a26dd18.

Reason for revert: Windows bots are broken

Original change's description:
> Fix empty run handling in trivial shaper iterators
> 
> When the text run is of zero length the iterator starts at the end. The
> trivial itereators did not handle this case.
> 
> Change-Id: Id41304500e33d821874f56ab20085cbc4b2d9b0b
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252857
> Reviewed-by: Herb Derby <herb@google.com>
> Commit-Queue: Ben Wagner <bungeman@google.com>

TBR=bungeman@google.com,herb@google.com

Change-Id: Ia38e46ac4c04def5d374fbbce450538096d90d64
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252923
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2019-11-05 20:13:43 +00:00
Ben Wagner
0f3a26dd18 Fix empty run handling in trivial shaper iterators
When the text run is of zero length the iterator starts at the end. The
trivial itereators did not handle this case.

Change-Id: Id41304500e33d821874f56ab20085cbc4b2d9b0b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252857
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2019-11-05 19:51:11 +00:00
Greg Daniel
e643da6ab8 Add new macro for checking device lost when making Vulkan calls.
This CL itself doesn't really change how anything is running today. However,
it is the first step into gracefully supporting a vulkan device lost return
error and being able to correctly clean everything up.

Bug: skia:9603
Change-Id: I9693c514a32ca437df61a7aee63651e2e40ee1c0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252819
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2019-11-05 18:56:35 +00:00
Brian Salomon
b3bd86405b Cleanup kGray_8 readback.
Rm unused function SkColorTypeIsGray.

Expect kGray_8 readback to work in tests.

Bug: skia:8962

Change-Id: Iad9d2be3e0a2e594e62dc681b79c59e0a833116a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/245162
Auto-Submit: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2019-11-05 18:36:25 +00:00
Mike Klein
7a13b461e6 x86-64 JIT support for Op::index
This lets shaders that use 'x' JIT on x86.

I started with paddd and {0,-1,-2,-3,...}, which worked fine but on
second thought seemed a bit odd.  I've switched to psubd and
{0,1,2,3,...} but I've left in support for paddd with a memory arg.

gm/skvm.cpp now JITs fully again and continues to draw the same as
the interpreter did.

Simplify embedded data alignment a little... memory operands don't
need full register alignment in AVX like they used to in SSE.  So
just align everything to the vector element size like we do on ARM,
and reorder [splats,bytes_masks,iota] to match the order we declare
and handle them in the code above.

Add unit tests for vpaddd + vpsubd.

Cq-Include-Trybots: skia.primary:Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Debug-All-SK_USE_SKVM_BLITTER
Change-Id: I6b8d060450cca7f437a1d2a597a8a0e0e8d51b33
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252797
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2019-11-05 17:11:37 +00:00
Brian Salomon
85c3d68f25 Some improvements to backend texture creation.
This initializes more formats correctly with solid colors and relies
less on GrPixelConfig.

It also includes the changes to get gray8 read pixels working
and almost everything to initialize GL_RGB8 textures with data. Minor
stuff to follow to get RGB8 fully working and update test expectations.

Bug: skia:8962
Bug: skia:6718
Bug: skia:9358

Change-Id: Ic044b4c4badc37f14fb46c898cd3b3c21a6fc7fd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/251199
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2019-11-04 20:37:41 +00:00
Robert Phillips
e94cdd2dbc Use QuadHelper and PatternHelper in more places
Propagating usage of these helpers will, hopefully, improve code reuse and centralize future changes.

This is pulled out of https://skia-review.googlesource.com/c/skia/+/252161/ (Add GrPrimitiveType to GrProgramInfo)

Bug: skia:9455
Change-Id: I9b46e42db8561d98fb724a41a1f7a3bec4bf97b0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252484
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-11-04 20:32:36 +00:00
Herb Derby
790eff85a0 Fix fuzz bug in isValid for SkDescriptor
isValid read memory beyond the buffer that was uninitialized.

BUG=oss-fuzz:18555

Change-Id: I5576add2cd7bfbe146d495239b96210fe15fe562
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252538
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2019-11-04 20:30:16 +00:00
Greg Daniel
524e28b88f Use GrSurfaceProxyView for dst proxies.
Bug: skia:9556
Change-Id: I41ae112a3d22f6c6481cba1afc3937b5e5115cf5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252043
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2019-11-01 17:18:19 +00:00
Brian Osman
2b73e66ca5 Add BT2020 (non-constant-luminance) YUV color space
Change-Id: I8ef13b78a5f2f49ff9c59db285b3e0e7ee708c9b
Bug: chromium:960620
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252160
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-11-01 14:34:13 +00:00
Herb Derby
f5ad3f421e Fast SkPackedGlyphID CTOR
Performance measurments showed that SkPackedGlyphID was too much
time.

SkDiffBench-lorem_ipsum 955µs -> 873µs

BUG=chromium:881505

Change-Id: I8d42f02d87817777cc7c95404c73c723f0bc100c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/251818
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2019-10-31 20:11:20 +00:00
Herb Derby
c7a8df8b1c Swap SkPackedGlyphID bitfields around
Change-Id: Ic286357dc637edf0c8df003422a43252590250f5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/251768
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2019-10-30 19:20:28 +00:00
Nigel Tao
2777cd37bf Have SkWuffsCodec use two Wuffs decoders
This allows onGetFrameCount to advance the stream (and return a higher
frame count), even when in the middle of a onIncrementalDecode sequence.

Such behavior is expected by Chromium's
TestResumePartialDecodeAfterClearFrameBufferCache:

https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/image-decoders/image_decoder_test_helpers.cc?l=365&rcl=23787ba147959ebf4ad168c595d5ec87919fdbd2

Bug: skia:8235
Change-Id: Iba7267468b02ce73455b362e50d8878f53b0ff88
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/250937
Commit-Queue: Nigel Tao <nigeltao@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Leon Scroggins <scroggo@google.com>
2019-10-29 22:17:43 +00:00
Chris Dalton
b0fd4b12a1 Reland "Revert "Revert "Rename gl_SampleMask to sk_SampleMask"""
This is a reland of 4ac37632a8

Original change's description:
> Revert "Revert "Rename gl_SampleMask to sk_SampleMask""
> 
> This reverts commit 40b815db97.
> 
> Bug: skia:
> Change-Id: I454d3e86219276996d0b4f9e7fcf177bb6dc45e7
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/251004
> Reviewed-by: Chris Dalton <csmartdalton@google.com>
> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>

Bug: skia:
Change-Id: Ia343e9e1008ca2354e1d300030e763f3c578d71c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/251441
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2019-10-29 21:01:52 +00:00
Nigel Tao
a1cc9f6b84 Test Codec::getFrameCount updates with more data
This mimics Chromium's
TestResumePartialDecodeAfterClearFrameBufferCache, which expects the
frame count to increase as more data comes in, even if the decoder is in
the middle of an incremental decode:

https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/image-decoders/image_decoder_test_helpers.cc?l=365&rcl=23787ba147959ebf4ad168c595d5ec87919fdbd2

Bug: skia:8235
Change-Id: Icc19ebea6d77f6b6fb62e3b2ff0c2ffb1ef0950d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/250476
Reviewed-by: Leon Scroggins <scroggo@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
2019-10-29 20:15:36 +00:00
Brian Osman
5f95519d54 Use GPU special images in two GPU image filter tests
We were always testing the CPU backend.

Bug: skia:9582
Change-Id: I25ff1dc151c1be8a31ab09008393430a1fa85221
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/251457
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-10-29 19:59:49 +00:00
Greg Daniel
16f5c65a0a Use GrSurfaceProxyView in RenderTasks.
Bug: skia:9556
Change-Id: Ibe0ae6981e87909848e5af73fc716aac7c8a591f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/249232
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2019-10-29 15:53:59 +00:00
Robert Phillips
d4b95d213d Revert "Implement refPinnedTextureProxy for SkImage_Lazy."
This reverts commit 1e0f2f389f.

Reason for revert: I suspect this is blocking the Chrome roll

Original change's description:
> Implement refPinnedTextureProxy for SkImage_Lazy.
> 
> Creating a cross-context texture exposed a hole in our lazyproxy
> texture generation. Despite having a wrapped texture we were falling
> back to drawing in tiled mode, which is incorrect. Filling in these
> methods allows us to draw with the wrapped texture.
> 
> Bug: skia:9562
> Change-Id: Ia26c5d75b202aefdf720e6d1f7a201af23e40676
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/251214
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Commit-Queue: Jim Van Verth <jvanverth@google.com>

TBR=jvanverth@google.com,robertphillips@google.com

Change-Id: I2dd6f2cbe13dd3ac1f65890da366171572fb84e2
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:9562
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/251356
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-10-29 12:40:06 +00:00
Jim Van Verth
1e0f2f389f Implement refPinnedTextureProxy for SkImage_Lazy.
Creating a cross-context texture exposed a hole in our lazyproxy
texture generation. Despite having a wrapped texture we were falling
back to drawing in tiled mode, which is incorrect. Filling in these
methods allows us to draw with the wrapped texture.

Bug: skia:9562
Change-Id: Ia26c5d75b202aefdf720e6d1f7a201af23e40676
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/251214
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2019-10-28 20:28:33 +00:00
Brian Osman
9ead6c7400 Guard against integer overflow when classifying transfer functions
Bug: chromium:1016183
Change-Id: I2fa470db3690f79d83fd17b01e421e7457f7c725
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/251246
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2019-10-28 20:18:23 +00:00
Greg Daniel
1e058a5380 Reland "Revert "Rename gl_SampleMask to sk_SampleMask""
This reverts commit 4ac37632a8.

Reason for revert: Failing assert, "assert(fProgram.fSettings.fCaps->sampleVariablesSupport())" on some bots

Original change's description:
> Revert "Revert "Rename gl_SampleMask to sk_SampleMask""
> 
> This reverts commit 40b815db97.
> 
> Bug: skia:
> Change-Id: I454d3e86219276996d0b4f9e7fcf177bb6dc45e7
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/251004
> Reviewed-by: Chris Dalton <csmartdalton@google.com>
> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>

TBR=csmartdalton@google.com,ethannicholas@google.com

Change-Id: I1fe9e2bb0d9f921f7d66e4a4707c21dd5c923586
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/251248
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2019-10-28 19:28:25 +00:00
Ethan Nicholas
4ac37632a8 Revert "Revert "Rename gl_SampleMask to sk_SampleMask""
This reverts commit 40b815db97.

Bug: skia:
Change-Id: I454d3e86219276996d0b4f9e7fcf177bb6dc45e7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/251004
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2019-10-28 18:47:52 +00:00
Brian Salomon
3683a4f5ae Remove legacy async read pixels APIs.
Chrome is now using the newer version.

Bug: skia:8962
Change-Id: I8c38bde63e1e032281d19b0cc7cb8cf301061a9e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/251198
Commit-Queue: Greg Daniel <egdaniel@google.com>
Auto-Submit: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2019-10-28 17:28:53 +00:00
Emircan Uysaler
7697476ad2 Disable async readback from protected memory
Reading back pixel values from protected memory into cpu memory is
not allowed. This CL adds early returns so they are not attempted.

Bug: skia:9016, fuchsia:38648
Change-Id: Icc0b51a62e87b7aebd0e7cb2a061fea084e7f754
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/251000
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2019-10-25 20:02:01 +00:00
Herb Derby
f5e9b42ef0 Change from single prepareForDrawing to prepare[Mask|SDFT|Path]ForDrawing
This produces much simpler logic, and sets up for a massive simplification
of the diff canvas. You can see the ultimate changes in:

https://skia-review.googlesource.com/c/skia/+/238196

Change-Id: I92100bdccb80d0b6f7864435213c29a159e0caaf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/250039
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2019-10-25 19:35:09 +00:00
Brian Salomon
28a8f28b3e Rename functions in TestUtils.h
Change-Id: Iaa8a4ac57e967c6429473fb3a738d377a47fc2c7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/250799
Commit-Queue: Brian Salomon <bsalomon@google.com>
Auto-Submit: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2019-10-25 00:36:28 +00:00
Herb Derby
95ea4c4c9e Change code() to glyphID() on SkGlyph.
Change-Id: Id13cd5039df7ff3042858c8c89a2dc629b589d3c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/244998
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2019-10-24 20:00:29 +00:00
Brian Salomon
557e812779 Make GrSurfaceProxy ref counts thread safe.
Bug: chromium:1008312

Change-Id: I90525db25ee61aeb8f03abc7569d8e4224df1497
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/250576
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2019-10-24 19:55:23 +00:00
Jim Van Verth
5a8f3e4aac Reland "Enable Programs (formerly GLPrograms) test for other APIs"
This is a reland of 598741667a

Original change's description:
> Enable Programs (formerly GLPrograms) test for other APIs
> 
> Bug: skia:9365
> Change-Id: I2eeac4e628425411b0a8f9ffa94ad61d58254b77
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/249806
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Reviewed-by: Eric Boren <borenet@google.com>
> Commit-Queue: Jim Van Verth <jvanverth@google.com>

Bug: skia:9365
Change-Id: I94db6cb2b1465edbb2e6d32708b835a76e12cbc6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/250016
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2019-10-24 19:53:25 +00:00
Hal Canary
e107faa062 SkRemoteGlyphCache Add tracing to diff canvas
Use `extra_cflags=["-DSK_CAPTURE_DRAW_TEXT_BLOB"]` to enable.

Change-Id: I1d6db478ee91696cdce090647b889c17a83a2718
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/250259
Commit-Queue: Hal Canary <halcanary@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2019-10-24 17:09:31 +00:00
Herb Derby
4a1af26f1a Fix fuzzer bug in SkDescriptor::isValid
This is following up chrome bug:
https://bugs.chromium.org/p/chromium/issues/detail?id=996211

BUG=skia:18491

Change-Id: I4c85bc916903aaa2fdf7eb226bdf3e57f8b1c66c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/250578
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2019-10-24 16:33:52 +00:00
Brian Salomon
5918e8313b Rewrite ReadPixels_Gpu test to be more exhaustive and share code.
Implementation is shared with with AsyncReadPixels.

Change-Id: If40705e96cc7fb073ab6024ab59819784c8be0ca
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/244717
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2019-10-23 18:06:03 +00:00
Robert Phillips
e9462dd2da Rename *worstCase* to backingStore* in GrSurfaceProxy
These names are more appropriate after:

https://skia-review.googlesource.com/c/skia/+/241356 (Always create an approx-size texture for approx-fit proxies))

Note that this CL does have one substantive change in GrCoordTransform::hasSameEffectAs where we use our knowledge of the size at which the backing stores will be allocated to remove a sly usage of GrSurfaceProxy::underlyingUniqueID.

Change-Id: Ibbb8cb23c4503f267abbdf4794610f3262a6f515
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/250257
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2019-10-23 17:15:01 +00:00
Robert Phillips
40b815db97 Revert "Rename gl_SampleMask to sk_SampleMask"
This reverts commit 23716d42f7.

Reason for revert: red bots and GMs

Original change's description:
> Rename gl_SampleMask to sk_SampleMask
> 
> Change-Id: I3924c6f76edf310a984e4fd89478b00eeec69722
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/249931
> Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
> Commit-Queue: Chris Dalton <csmartdalton@google.com>

TBR=egdaniel@google.com,csmartdalton@google.com,ethannicholas@google.com

Change-Id: I74848e95972cf2c41cc28887e26214136ce79e08
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/250180
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-10-23 12:28:48 +00:00
Mike Klein
d48488b5ea reorder to minimize register pressure
Rewrite program instructions so that each value becomes available as
late as possible, just before it's used by another instruction.  This
reorders blocks of instructions to reduce them number of temporary
registers in flight.

Take this example of the sort of program that we naturally write,
noting the registers needed as we progress down the right:

    src = load32 ...          (1)
    sr = extract src ...      (2)
    sg = extract src ...      (3)
    sb = extract src ...      (4)
    sa = extract src ...      (4, src dies)

    dst = load32 ...          (5)
    dr = extract dst ...      (6)
    dg = extract dst ...      (7)
    db = extract dst ...      (8)
    da = extract dst ...      (8, dst dies)

    r = add sr dr             (7, sr and dr die)
    g = add sg dg             (6, sg and dg die)
    b = add sb db             (5, sb and db die)
    a = add sa da             (4, sa and da die)

    rg   = pack r g ...       (3, r and g die)
    ba   = pack b a ...       (2, b and a die)
    rgba = pack rg ba ...     (1, rg and ba die)
    store32 rgba ...          (0, rgba dies)

That original ordering of the code needs 8 registers (perhaps with a
temporary 9th, but we'll ignore that here).  This CL will rewrite the
program to something more like this by recursively issuing inputs only
once needed:

    src = load32 ...       (1)
    sr  = extract src ...  (2)
    dst = load32 ...       (3)
    dr  = extract dst ...  (4)
     r  = add sr dr        (3, sr and dr die)

    sg  = extract src ...  (4)
    dg  = extract dst ...  (5)
     g  = add sg dg        (4, sg and dg die)

    rg  = pack r g         (3, r and g die)

    sb  = extract src ...  (4)
    db  = extract dst ...  (5)
     b  = add sb db        (4, sb and db die)

    sa  = extract src ...  (4, src dies)
    da  = extract dst ...  (4, dst dies)
     a  = add sa da        (3, sa and da die)

    ba  = pack b a         (2, b and a die)

    rgba = pack rg ba ...  (1, rg and ba die)
    store32 rgba  ...      (0)

That trims 3 registers off the example, just by reordering!
I've added the real version of this example to SkVMTest.cpp.
(Its 6th register comes from holding the 0xff byte mask used
by extract, in case you're curious).

I'll admit it's not exactly easy to work out how this reordering works
without a pen and paper or trial and error.  I've tried to make the
implementation preserve the original program's order as much as makes
sense (i.e. when order is an otherwise arbitrary choice) to keep it
somewhat sane to follow.

This reordering naturally skips dead code, so pour one out for ☠️ .
We lose our cute dead code emoji marker, but on the other hand all code
downstream of Builder::done() can assume every instruction is live.

Change-Id: Iceffcd10fd7465eae51a39ef8eec7a7189766ba2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/249999
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2019-10-22 21:49:05 +00:00
Chris Dalton
23716d42f7 Rename gl_SampleMask to sk_SampleMask
Change-Id: I3924c6f76edf310a984e4fd89478b00eeec69722
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/249931
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2019-10-22 20:36:00 +00:00
Brian Salomon
2638f3d44b rename atlassize->atlasdimensions
Change-Id: I0262ed26f0b3523302bbb4e94dfca94d120fc70c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/249980
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2019-10-22 16:57:01 +00:00
Robert Phillips
61fc799759 Add creation-time POD memory pool for GrOps
This CL begins pulling some of the work forward into onPrePrepare.

Change-Id: If049e0662db51b465b8b82aafebeef2323bddfd4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/249802
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-10-22 16:35:41 +00:00
Michael Ludwig
6387dc19f6 Revert "Enable Programs (formerly GLPrograms) test for other APIs"
This reverts commit 598741667a.

Reason for revert: segfaults on Pixel bots

Original change's description:
> Enable Programs (formerly GLPrograms) test for other APIs
> 
> Bug: skia:9365
> Change-Id: I2eeac4e628425411b0a8f9ffa94ad61d58254b77
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/249806
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Reviewed-by: Eric Boren <borenet@google.com>
> Commit-Queue: Jim Van Verth <jvanverth@google.com>

TBR=borenet@google.com,jvanverth@google.com,robertphillips@google.com

Change-Id: I286c637490bb8a21c0020a8935ce4c850b98f6b0
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:9365
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/249978
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2019-10-22 15:39:49 +00:00
Brian Salomon
9f2b86c54d More SkISizification in GPU code.
Uses SkISize instead of separate width/height variables in many places.

No functional change.

Change-Id: If87b2c57e43d810f0820c4e3c9ef8e6b8ebd10ba
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/249886
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2019-10-22 15:04:07 +00:00
Jim Van Verth
598741667a Enable Programs (formerly GLPrograms) test for other APIs
Bug: skia:9365
Change-Id: I2eeac4e628425411b0a8f9ffa94ad61d58254b77
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/249806
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Eric Boren <borenet@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2019-10-22 14:36:09 +00:00
Brian Salomon
4eda7108a2 Simplify sk_gpu_test::MakeTextureProxyFromData.
Make it take GrImageInfo.

Change-Id: I9ec16e9b935fbe3e829b4669f715c17873a1793a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/249813
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2019-10-21 20:04:37 +00:00
Hal Canary
c056e169ea SkPDF: simplify Producer metadata logic
Bug: skia:9552
Change-Id: Ifa199048e6d38ccb28f055b77128971411203188
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/249800
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
2019-10-21 20:01:47 +00:00
Michael Ludwig
c89d1b56e5 Rename SkDevice::ctm() to localToDevice()
This helps differentiate the SkCanvas' total CTM
(canvas transform matrix), from the device-specific transform matrix
that maps draws from local to device space.

Bug: 9545
Change-Id: I67f40d9b1bc92377bf0520fbc9245f1058e179e6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/249424
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2019-10-18 18:04:31 +00:00
Robert Phillips
6c2aa7af0b Revert "Reduce inputs to GrProgramDesc::Build method(s)"
This reverts commit 63a3873957.

Reason for revert: fail

Original change's description:
> Reduce inputs to GrProgramDesc::Build method(s)
> 
> This moves the computation of the GrStencilSettings into GrProgramDesc::Build for the Vulkan backend
> 
> This makes it clear that the stencilSettings are determined by the GrProgramInfo.
> 
> Note that this does change some behavior in that the number of stencil bits is now determined (and set up for) the number requested not the number actually available on the attached stencil buffer at flush time.
> 
> Bug: skia:9455
> Change-Id: Ia5fa4e30e34952c1a492b8d571094abf2291b2a4
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/248696
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Commit-Queue: Robert Phillips <robertphillips@google.com>

TBR=egdaniel@google.com,robertphillips@google.com

Change-Id: Ib0b337c19acea8000b5592f3dfeda181fd6ef157
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:9455
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/249222
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-10-17 19:06:52 +00:00
Robert Phillips
63a3873957 Reduce inputs to GrProgramDesc::Build method(s)
This moves the computation of the GrStencilSettings into GrProgramDesc::Build for the Vulkan backend

This makes it clear that the stencilSettings are determined by the GrProgramInfo.

Note that this does change some behavior in that the number of stencil bits is now determined (and set up for) the number requested not the number actually available on the attached stencil buffer at flush time.

Bug: skia:9455
Change-Id: Ia5fa4e30e34952c1a492b8d571094abf2291b2a4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/248696
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-10-17 18:32:40 +00:00
Herbert Derby
d7689d434c Reland "Introduce SkGlyphSourceBuffer"
This is a reland of 77c53087c1

Original change's description:
> Introduce SkGlyphSourceBuffer
>
> SkGlyphSourceBuffer provides a system for taking rejected glyphs from
> one glyph drawing stage, and turns them into the source for the next stage.
> It is rarely used, so it tries to conserve memory.
>
> Change-Id: I5275ffa3e804fc494eb2f5803e0cf2d148a755f7
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/248260
> Reviewed-by: Ben Wagner <bungeman@google.com>
> Commit-Queue: Herb Derby <herb@google.com>

Change-Id: Ib90508a21993b12c71ee86cbdeb51c4d4c2ec913
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/249128
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2019-10-17 17:26:37 +00:00
Mike Klein
97afd2e21c add bsl.16b, cmeq.4s, cmgt.4s
These implement select, eq_i32, lt_i32, and gt_i32 on ARMv8.

Change-Id: Ic36dda1cc425ca91700f9b120594e420ea0f560a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/248970
Auto-Submit: Mike Klein <mtklein@google.com>
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2019-10-17 01:54:33 +00:00
Herb Derby
f29cb70281 Revert "Introduce SkGlyphSourceBuffer"
This reverts commit 77c53087c1.

Reason for revert: Breaks some windows builds

Original change's description:
> Introduce SkGlyphSourceBuffer
> 
> SkGlyphSourceBuffer provides a system for taking rejected glyphs from
> one glyph drawing stage, and turns them into the source for the next stage.
> It is rarely used, so it tries to conserve memory.
> 
> Change-Id: I5275ffa3e804fc494eb2f5803e0cf2d148a755f7
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/248260
> Reviewed-by: Ben Wagner <bungeman@google.com>
> Commit-Queue: Herb Derby <herb@google.com>

TBR=bungeman@google.com,herb@google.com

Change-Id: I4270d092f8daba3dddcadd6abbed10f14bf57490
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/249077
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2019-10-16 21:28:35 +00:00
Robert Phillips
1dfc77cc08 Add unit test to exercise GrTextureFreed message handling after a context abandon
Bug: 1011368, 1014993
Change-Id: Ie9f7be15b321daa05fcac8109a24e42810f10737
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/249008
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-10-16 21:11:12 +00:00
Herbert Derby
77c53087c1 Introduce SkGlyphSourceBuffer
SkGlyphSourceBuffer provides a system for taking rejected glyphs from
one glyph drawing stage, and turns them into the source for the next stage.
It is rarely used, so it tries to conserve memory.

Change-Id: I5275ffa3e804fc494eb2f5803e0cf2d148a755f7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/248260
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2019-10-16 20:55:32 +00:00
Robert Phillips
ddc21485cb Work around un-safe downcast in PromiseLazyInstantiateCallback destructor after a context abandon
90% of this CL is just renaming. The only two substantive changes are:
   holding a GrTexture* (rather than a GrGpuResource*) in the GrTextureFreedMessage (this avoids the downcast)
   adding the abandoned() checks to the two GrContext::purgeUnlockedResources methods (this prevents accesses of the message queue)

Bug: 1011368, 1014993
Change-Id: Ifff3842f7802add6b7cd34595578369543698ba1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/249001
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-10-16 19:24:03 +00:00
Brian Osman
11e6aa823d Starting to hack up HDR transfer function support
Brings over skcms' encoding scheme, etc.

Change-Id: Ib8abec911acd1c50df3b201b4a9bde01b1cb123b
Bug: chromium:960620
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/249000
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2019-10-16 18:40:16 +00:00
Mike Klein
0f61c12737 add used_in_loop bit to skvm::Builder::Instruction
Most hoisted values are used in the loop body (and that's really the
whole point of hoisting) but some are just temporaries to help produce
other hoisted values.  This used_in_loop bit helps us distinguish the
two, and lets us recycle registers holding temporary hoisted values not
used in the loop.

The can-we-recycle logic now becomes:
   - is this a real value?
   - is it time for it to die?
   - is it either not hoisted or a hoisted temporary?

The set-death-to-infinity approach for hoisted values is now gone.  That
worked great for hoisted values used inside the loop, but was too
conservative for hoisted temporaries.  This lifetime extension was
preventing us from recycling those registers, pinning enough registers
that we run out and fail to JIT.

Small amounts of refactoring to make this clearer:
   - move the Instruction hash function definition near its operator==
   - rename the two "hoist" variables to "can_hoist" for Instructions
     and "try_hoisting" for the JIT approach
   - add ↟ to mark hoisted temporaries, _really_ hoisted values.

There's some redundancy here between tracking the can_hoist bit, the
used_in_loop bit, and lifetime tracking.  I think it should be true, for
instance, that !can_hoist && !used_in_loop implies an instruction is
dead code.  I plan to continue refactoring lifetime analysis (in
particular reordering instructions to decrease register pressure) so
hopefully by the time I'm done that metadata will shake out a little
crisper.

Change-Id: I6460ca96d1cbec0315bed3c9a0774cd88ab5be26
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/248986
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2019-10-16 18:29:06 +00:00
Mike Klein
b5a30767e0 Reland "mark which SkVM tests should JIT or not"
This is a reland of 52435503e9

with better checks for when we should expect JIT and not.

Original change's description:
> mark which SkVM tests should JIT or not
>
> Most of these tests converted over to test_interpreter_only()
> are failing to JIT because of unimplemented instructions.  No
> bug there, just TODOs.
>
> But SkVM_hoist _should_ be JITting.  A while back I landed a CL
> that messed with value lifetimes that prevents it from JITting.
> Will be using this as a regression test to fix that bug.
>
> Change-Id: Id2034f6548a45ed9aeb9ae3cbb24d389cad7dc60
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/248980
> Commit-Queue: Mike Klein <mtklein@google.com>
> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
> Auto-Submit: Mike Klein <mtklein@google.com>
> Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
> Reviewed-by: Herb Derby <herb@google.com>

Cq-Include-Trybots: skia.primary:Test-Android-Clang-NVIDIA_Shield-CPU-TegraX1-arm64-Release-All-Android,Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Release-All-SK_CPU_LIMIT_SSE2,Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Release-All-SK_CPU_LIMIT_SSE41,Test-Mac10.13-Clang-VMware7.1-CPU-AVX-x86_64-Debug-All-NativeFonts,Test-Mac10.14-Clang-VMware7.1-CPU-AVX-x86_64-Debug-All-NativeFonts
Change-Id: Id7bde7e879649e435fa424a9c9d6c51a31afd5e9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/248990
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2019-10-16 17:35:06 +00:00
Mike Klein
4e11526e3d Revert "mark which SkVM tests should JIT or not"
This reverts commit 52435503e9.

Reason for revert: lots of bots can't JIT, duh...

Original change's description:
> mark which SkVM tests should JIT or not
> 
> Most of these tests converted over to test_interpreter_only()
> are failing to JIT because of unimplemented instructions.  No
> bug there, just TODOs.
> 
> But SkVM_hoist _should_ be JITting.  A while back I landed a CL
> that messed with value lifetimes that prevents it from JITting.
> Will be using this as a regression test to fix that bug.
> 
> Change-Id: Id2034f6548a45ed9aeb9ae3cbb24d389cad7dc60
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/248980
> Commit-Queue: Mike Klein <mtklein@google.com>
> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
> Auto-Submit: Mike Klein <mtklein@google.com>
> Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
> Reviewed-by: Herb Derby <herb@google.com>

TBR=mtklein@google.com,herb@google.com,ethannicholas@google.com

Change-Id: Ieea4b06f0d32249e3da56c6810d3c45c2abf2689
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/248989
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2019-10-16 16:48:58 +00:00
Mike Klein
52435503e9 mark which SkVM tests should JIT or not
Most of these tests converted over to test_interpreter_only()
are failing to JIT because of unimplemented instructions.  No
bug there, just TODOs.

But SkVM_hoist _should_ be JITting.  A while back I landed a CL
that messed with value lifetimes that prevents it from JITting.
Will be using this as a regression test to fix that bug.

Change-Id: Id2034f6548a45ed9aeb9ae3cbb24d389cad7dc60
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/248980
Commit-Queue: Mike Klein <mtklein@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Auto-Submit: Mike Klein <mtklein@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2019-10-16 15:45:16 +00:00
Lee Salzman
634d15032d fix SkTextBlob::getIntercepts regression no longer considering glyph vertical offset
As of revision 7924d9a4ae (https://skia-review.googlesource.com/c/skia/+/222277), SkTextBlob::getIntercepts no longer considers each glyph's vertical offset. So getIntercepts will only work properly if each glyph has a vertical offset of 0. This patch restores the original behavior of offsetting the bounds from each glyph's position.

Without this fix, Firefox has no way to implement proper intercepts for underlining decorations when glyphs are offset...

Change-Id: I06fc4b63bd57c9d70e3b07a95ead69f3caa8b33a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/248724
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Herb Derby <herb@google.com>
Auto-Submit: Lee Salzman <lsalzman@mozilla.com>
2019-10-16 00:02:08 +00:00
Greg Daniel
c594e62698 Plumb GrColorType through all ops/processors that sample textures.
This change also allows for the remove of GrPixelConfigIsOpaque function.

Bug: skia:6718
Change-Id: I7e7b70f02d911eda67640d648fb6348091e0f55d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/248698
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2019-10-15 18:34:37 +00:00
Robert Phillips
7d7aaf46ae Slim down GrFragmentProcessor::TextureSampler and GrPrimitiveProcessor::TextureSampler
I'm gearing up to add a GrBackendFormat to GrPrimitiveProcessor::TextureSampler so this CL just reduces the API surface area I'll need to alter.

The GrFragmentProcess::TextureSampler changes just keep it aligned with its "twin".

Change-Id: Ia9ece03ca76b4f6c8ebdaf0e0ba0061ecde6c5f4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/248558
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-10-14 19:48:19 +00:00
Greg Daniel
a4828a13c2 Remove GrPixelConfigIsAlphaOnly call and transition calls to it.
Bug: skia:6718
Change-Id: I4d9c31bc0ca42a80e652de29462531587efef031
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/248257
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2019-10-14 13:49:14 +00:00
Hal Canary
3d49d08660 SkPDF/tests: add regression test for crbug/494913
Bug: chromium:494913
Bug: skia:9508
Change-Id: I8793fa32b8c4d38b58ec1814b35187ddfc246916
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/248256
Auto-Submit: Hal Canary <halcanary@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2019-10-11 18:17:54 +00:00
Herbert Derby
0be4c2cb86 Introduce SkGlyphDrawableBuffer
Used for efficient glyph id to glyph lookup.

This is part of a larger change:
https://skia-review.googlesource.com/c/skia/+/238196

Change-Id: Ifce43879685bf0d760a7e12dceb32f7a650be687
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/247340
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2019-10-11 15:40:24 +00:00
Greg Daniel
7fd7a8aef0 Remove uses of GrPixelConfig version of GrBytesPerPixel.
Bug: skia:6718
Change-Id: I8421f38644567973f0b8de29b745ca9a471583bf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/247598
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2019-10-10 20:39:05 +00:00
Robert Phillips
2d8a95ee71 Add "meshCount" to GrProgramInfo
This improves the encapsulation of the GrProgramInfo class.

Bug: skia:9455
Change-Id: Ic241ba4a2c2edea3e774522065371e5ed8cc2da3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/247438
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2019-10-10 17:18:15 +00:00
Jim Van Verth
ce3cf804f1 Draw perspective text as paths.
Perspective glyphs can vary in screen size so it's unclear which SDF
level is best, and even if we choose one for an entire subrun it's
possible that a given glyph will have artifacts if it's too big.
Instead we fall back to paths unless specifically requested to
support perspective SDF.

Bug: skia:9515
Change-Id: I75ac1d60f2eaa0e63de201b5db36fe0485fff463
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/247398
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2019-10-10 15:35:51 +00:00
Herb Derby
d543fbbd6f Revert "Draw perspective text as paths."
This reverts commit 76826fc91c.

Reason for revert: Missing some characters

Original change's description:
> Draw perspective text as paths.
> 
> Perspective glyphs can vary in screen size so it's unclear which SDF
> level is best, and even if we choose one for an entire subrun it's
> possible that a given glyph will have artifacts if it's too big.
> Instead we fall back to paths.
> 
> Bug: skia:9515
> Change-Id: I88f03b25651df0222459f5dbd03eee9465b97487
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/247437
> Commit-Queue: Herb Derby <herb@google.com>
> Reviewed-by: Jim Van Verth <jvanverth@google.com>

TBR=jvanverth@google.com,herb@google.com

Change-Id: I5e39566c35b49323913eb72ff89ecbc91faac8ce
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:9515
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/247462
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2019-10-09 23:46:28 +00:00
Jim Van Verth
76826fc91c Draw perspective text as paths.
Perspective glyphs can vary in screen size so it's unclear which SDF
level is best, and even if we choose one for an entire subrun it's
possible that a given glyph will have artifacts if it's too big.
Instead we fall back to paths.

Bug: skia:9515
Change-Id: I88f03b25651df0222459f5dbd03eee9465b97487
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/247437
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
2019-10-09 20:53:20 +00:00
Robert Phillips
901aff018b Add GrProgramInfo to centralize management of program information
This is the first step in moving the marshaling of program information earlier in renderTask processing (i.e., to onPrePrepare).

Change-Id: I91e3baed9a128e845bd32f9dbbacd9b21d852a3d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/244118
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-10-08 20:35:51 +00:00
Herbert Derby
5899485b9a Add tests for SkZip first, data, and consting copy ctor
Change-Id: Ibc8a6a856c448f03c9e3860a3fb7391c407289dd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/247038
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2019-10-08 15:45:30 +00:00
Fredrik Söderquist
d1ed56e4be Fix mapping the morphology filter's radius when the CTM is a mirror op
When the CTM contained a "mirroring" operation - for example
scale(-1, 1) or scale(1, -1) - the radius of the morphology filter would
end up negative, essentially disabling the filter.
When mapping the radii, use the magnitude of a vector built from each
component of the radii instead of considering the radii as a plain
vector.

Bug: chromium:595244
Change-Id: Ia249f8962648f0a4e69b6d0becf87ee1ba6be9a6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/246996
Reviewed-by: Florin Malita <fmalita@chromium.org>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-10-08 14:34:57 +00:00
Julia Lavrova
f3ed273b32 Adding line/style metrics
Fixed some bugs for flutter tests

Change-Id: I43f4b4b185152a8d642127370da5f80fb96f1e9e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/239444
Commit-Queue: Julia Lavrova <jlavrova@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2019-10-07 15:07:48 +00:00
Robert Phillips
405413fcec Clarify that the OpArgs' outputSwizzle comes from its GrRenderTargetProxy
Since we want to collect shader information early, this attempts to make clear that numSamples, origin and outputSwizzle can all be obtained from the target renderTargetProxy.


Change-Id: I42e0fd79e2163f17673ccdd344a31fbaadac5f53
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/246298
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-10-04 18:03:32 +00:00
Michael Ludwig
05a777d442 Define coord space tagged geometry for image filters v2.
This is an alternative approach to https://skia-review.googlesource.com/c/skia/+/234896

It inverts the templates and coordinate spaces, so that each coordinate space is
defined by a struct that accepts the SkIRect/etc. type as an argument. For parameter
space and device space, the only exposed functionality is holding on to the coordinates
and moving into and out of the layer space (using the Mapping type, which now encapsulates
the definition of parameter, layer, and device space for a given CTM).

The LayerSpace struct has specialized definitions for each of the 6 key geometric types,
exposes accessors/mutators and operations like join/intersect that work on appropriate
layer-space geometry.

FilterResult and Context have been updated to use these new types, although they no
longer take a Usage enum. If this strategy works, FilterResult will be updated to have
more utilities to operate and read from its image in layer-space so there won't be a need
to have the image space (and the usage enum to differentiate between different image
spaces).

To further reinforce the differences between getInputBounds() and getOutputBounds() (which
previously used Usage to do this), they now accept/return values in device and parameter
space. This is no different than what SkCanvas would have done before calling the old
functions, but now that work is owned by SkImageFilter (seems like a good thing), and
achieves the same reinforcement.

Change-Id: I8bebb9fadf6c8f2bd51fa863b2d6f2e4a33dd08b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/244515
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2019-10-04 16:40:00 +00:00
Mike Reed
a32654c13a Simple iterator for textblobs
bug: skia:9503

Change-Id: I5b4e2434c6085d048d6d0fc42b2b928439b1066b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/246296
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2019-10-04 14:44:19 +00:00
Brian Salomon
9241a6d394 Reland "Reland "SkSurface asynchronous read APIs allow client to extend pixel lifetime""
This is a reland of 6fc04f88a8

Original change's description:
> Reland "SkSurface asynchronous read APIs allow client to extend pixel lifetime"
> 
> This is a reland of ce240cc6fd
> 
> Original change's description:
> > SkSurface asynchronous read APIs allow client to extend pixel lifetime
> > 
> > Previously the pixel data passed to the client was only valid during
> > the client's callback. This meant if the client wanted to defer
> > processing of the data a copy was necessary.
> > 
> > Now we pass an object to the callback and the pixel lifetime is tied
> > to the lifetime of that object.
> > 
> > The object may be holding a GPU transfer buffer mapped. We don't assume
> > that the object will be released on the direct GrContext thread. So
> > when the object is destroyed it posts a message to a new type,
> > GrClientMappedBufferManager, hanging off the direct context. The direct
> > context will periodically check for messages and unmap and then unref
> > buffers so that they can be reused. Currently this is done in
> > GrContext::performDeferredCleanup() and GrDrawingManager::flush().
> > 
> > The old API is kept around for backwards compatibility but it is
> > reimplemented as a bridge on top of the new mechanism.
> > 
> > Also a utility function to SkImageInfo is added to directly make a new
> > info with a specified dimensions rather than passing the width and
> > height separately to makeWH().
> > 
> > Bug: chromium:973403
> > Bug: skia:8962
> > 
> > Change-Id: Id5cf04235376170142a48e90d3ecd13fd021a2a6
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/245457
> > Reviewed-by: Brian Osman <brianosman@google.com>
> > Commit-Queue: Brian Salomon <bsalomon@google.com>
> 
> Bug: chromium:973403, skia:8962
> Change-Id: I5cecd36276c8b6dc942cf549c7095db2df88530c
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/245678
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>

Bug: chromium:973403, skia:8962
Change-Id: Ie584c1c3ef8021c976f71b708e53871c693cc450
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/246057
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2019-10-03 19:14:22 +00:00
Brian Osman
c95c4a69e1 Remove old SkSL JIT and cleanup include files a bit
- The raster pipeline JIT was an experiment that never really panned
  out (except for also introducing the interpreter, which survives).
  The removal should be pretty thorough, including undoing some changes
  to SkRasterPipeline itself. For reference, I basically undid most of
  https://skia-review.googlesource.com/c/skia/+/112204/

- With runtime shaders, always convert to Program using kPipelineStage
  This makes the first-pass compile consistent with runtime color filter,
  and with GrSkSLFP.

- Remove sksl_mixer.inc, which hasn't been used in a while.

- In sksl_pipeline.inc, all of the math symbols are already declared
  in sksl_gpu.inc, which forms the base symbol table when this include
  is parsed.

  sk_x and sk_y appear to never be used? Those builtin IDs are the IDs
  of the x and y params to main, but that logic still works without
  these declarations.

  sk_OutColor only makes sense in FP files (it's still declared in
  sksl_fp.inc).

Change-Id: Ie8dd68d2c4687745d46f96804a76695bce8c1ba2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/246017
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-10-03 18:00:40 +00:00
Robert Phillips
a975ef3b2f Add SkSurfaceCharacterization::createColorSpace
Change-Id: Ie4653fce34e4d6f38613f63bc68ecc1b7bae361b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/246019
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-10-03 17:06:13 +00:00
Ravi Mistry
cb55010652 Revert "Reland "SkSurface asynchronous read APIs allow client to extend pixel lifetime""
This reverts commit 6fc04f88a8.

Reason for revert: Chrome roll failure suspect because of:
* https://chromium-review.googlesource.com/c/chromium/src/+/1837131 (22 commits)
* https://chromium-review.googlesource.com/c/chromium/src/+/1837214 (24 commits)

Original change's description:
> Reland "SkSurface asynchronous read APIs allow client to extend pixel lifetime"
>
> This is a reland of ce240cc6fd
>
> Original change's description:
> > SkSurface asynchronous read APIs allow client to extend pixel lifetime
> >
> > Previously the pixel data passed to the client was only valid during
> > the client's callback. This meant if the client wanted to defer
> > processing of the data a copy was necessary.
> >
> > Now we pass an object to the callback and the pixel lifetime is tied
> > to the lifetime of that object.
> >
> > The object may be holding a GPU transfer buffer mapped. We don't assume
> > that the object will be released on the direct GrContext thread. So
> > when the object is destroyed it posts a message to a new type,
> > GrClientMappedBufferManager, hanging off the direct context. The direct
> > context will periodically check for messages and unmap and then unref
> > buffers so that they can be reused. Currently this is done in
> > GrContext::performDeferredCleanup() and GrDrawingManager::flush().
> >
> > The old API is kept around for backwards compatibility but it is
> > reimplemented as a bridge on top of the new mechanism.
> >
> > Also a utility function to SkImageInfo is added to directly make a new
> > info with a specified dimensions rather than passing the width and
> > height separately to makeWH().
> >
> > Bug: chromium:973403
> > Bug: skia:8962
> >
> > Change-Id: Id5cf04235376170142a48e90d3ecd13fd021a2a6
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/245457
> > Reviewed-by: Brian Osman <brianosman@google.com>
> > Commit-Queue: Brian Salomon <bsalomon@google.com>
>
> Bug: chromium:973403, skia:8962
> Change-Id: I5cecd36276c8b6dc942cf549c7095db2df88530c
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/245678
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>

TBR=bsalomon@google.com,brianosman@google.com

Change-Id: I9e01d1b82fb399b94292441d91da51176bb161d9
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: chromium:973403, skia:8962
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/245956
Reviewed-by: Ravi Mistry <rmistry@google.com>
Commit-Queue: Ravi Mistry <rmistry@google.com>
2019-10-03 09:19:24 +00:00
Brian Salomon
6fc04f88a8 Reland "SkSurface asynchronous read APIs allow client to extend pixel lifetime"
This is a reland of ce240cc6fd

Original change's description:
> SkSurface asynchronous read APIs allow client to extend pixel lifetime
> 
> Previously the pixel data passed to the client was only valid during
> the client's callback. This meant if the client wanted to defer
> processing of the data a copy was necessary.
> 
> Now we pass an object to the callback and the pixel lifetime is tied
> to the lifetime of that object.
> 
> The object may be holding a GPU transfer buffer mapped. We don't assume
> that the object will be released on the direct GrContext thread. So
> when the object is destroyed it posts a message to a new type,
> GrClientMappedBufferManager, hanging off the direct context. The direct
> context will periodically check for messages and unmap and then unref
> buffers so that they can be reused. Currently this is done in
> GrContext::performDeferredCleanup() and GrDrawingManager::flush().
> 
> The old API is kept around for backwards compatibility but it is
> reimplemented as a bridge on top of the new mechanism.
> 
> Also a utility function to SkImageInfo is added to directly make a new
> info with a specified dimensions rather than passing the width and
> height separately to makeWH().
> 
> Bug: chromium:973403
> Bug: skia:8962
> 
> Change-Id: Id5cf04235376170142a48e90d3ecd13fd021a2a6
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/245457
> Reviewed-by: Brian Osman <brianosman@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>

Bug: chromium:973403, skia:8962
Change-Id: I5cecd36276c8b6dc942cf549c7095db2df88530c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/245678
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2019-10-03 01:41:35 +00:00
Brian Salomon
9c219785a8 Revert "SkSurface asynchronous read APIs allow client to extend pixel lifetime"
This reverts commit ce240cc6fd.

Reason for revert: crashing in chrome unit test, abandoned context related?

Original change's description:
> SkSurface asynchronous read APIs allow client to extend pixel lifetime
> 
> Previously the pixel data passed to the client was only valid during
> the client's callback. This meant if the client wanted to defer
> processing of the data a copy was necessary.
> 
> Now we pass an object to the callback and the pixel lifetime is tied
> to the lifetime of that object.
> 
> The object may be holding a GPU transfer buffer mapped. We don't assume
> that the object will be released on the direct GrContext thread. So
> when the object is destroyed it posts a message to a new type,
> GrClientMappedBufferManager, hanging off the direct context. The direct
> context will periodically check for messages and unmap and then unref
> buffers so that they can be reused. Currently this is done in
> GrContext::performDeferredCleanup() and GrDrawingManager::flush().
> 
> The old API is kept around for backwards compatibility but it is
> reimplemented as a bridge on top of the new mechanism.
> 
> Also a utility function to SkImageInfo is added to directly make a new
> info with a specified dimensions rather than passing the width and
> height separately to makeWH().
> 
> Bug: chromium:973403
> Bug: skia:8962
> 
> Change-Id: Id5cf04235376170142a48e90d3ecd13fd021a2a6
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/245457
> Reviewed-by: Brian Osman <brianosman@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>

TBR=bsalomon@google.com,brianosman@google.com

Change-Id: Ic14cf07a7629b167c9f34a651aa87a0326e74207
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: chromium:973403, skia:8962
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/245721
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2019-10-02 22:51:15 +00:00
Brian Salomon
ce240cc6fd SkSurface asynchronous read APIs allow client to extend pixel lifetime
Previously the pixel data passed to the client was only valid during
the client's callback. This meant if the client wanted to defer
processing of the data a copy was necessary.

Now we pass an object to the callback and the pixel lifetime is tied
to the lifetime of that object.

The object may be holding a GPU transfer buffer mapped. We don't assume
that the object will be released on the direct GrContext thread. So
when the object is destroyed it posts a message to a new type,
GrClientMappedBufferManager, hanging off the direct context. The direct
context will periodically check for messages and unmap and then unref
buffers so that they can be reused. Currently this is done in
GrContext::performDeferredCleanup() and GrDrawingManager::flush().

The old API is kept around for backwards compatibility but it is
reimplemented as a bridge on top of the new mechanism.

Also a utility function to SkImageInfo is added to directly make a new
info with a specified dimensions rather than passing the width and
height separately to makeWH().

Bug: chromium:973403
Bug: skia:8962

Change-Id: Id5cf04235376170142a48e90d3ecd13fd021a2a6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/245457
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2019-10-02 19:20:08 +00:00
Mike Klein
edf2d727f9 picture nesting bounds bug
- add a unit test reproducing the bug
  - fix SkRecorder::reset() to call resetCanvas(bounds) instead of
    calling resetCanvas(w,h).  (It was actually calling
    resetCanvas(right,top), even worse...)

In short, because we were calling this old resetCanvas(), SkRecorder,
the SkCanvas* we record into, was presenting bad device bounds,
affecting code like where we query the clip to search an R-tree for ops
to draw.  It was trimmed to only the positive/positive portion of the
actual bounds, so content like in the unit test that's all in negative
space was erroneously clipped out.

I'd like to get rid of these w/h methods altogether but they're still
used by some of our test tools and by Android.

Change-Id: Ie46f611250de4d655c4357823895ff885b4f3d59
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/245599
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2019-10-02 18:59:17 +00:00
Greg Daniel
5faf474fab More bounds fixes for StrokeRect and DefaultPath when using MSAA for non-aa.
Change-Id: Ia9c2a47675eac8f3ac1220c0e1089766aa141fc1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/245364
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2019-10-01 19:49:15 +00:00
Jim Van Verth
f2f0e1b8cc Add TransferBuffer and AsyncRead support to Metal.
* Implements onTransferPixelsFrom, onTransferPixelsTo, onFinishFlush and
checkFinishProcs.
* Adds a bind() method for allocating dynamic buffer memory that can
be used by the GPU prior to mapping on the CPU

Bug: skia:8243
Change-Id: I366ec47bf1155797d9a9b0c9f33870e50c95e914
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/244301
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2019-10-01 14:37:51 +00:00
Brian Salomon
4bc0c1fc4b Rename GrColorSpaceInfo -> GrColorInfo
Add version SkImageInfo::Make() that takes SkISize instead of separate
width and height.

Change-Id: I42aa79d23b19e22f5405631728c245b04bce0559
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/245172
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2019-09-30 21:53:24 +00:00
Robert Phillips
66944404ce Make SkPixmap-variant of createBackendTexture public
Change-Id: I51d916d2410428113e29d2fc374e5f1f7f4010b9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/244676
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2019-09-30 18:06:14 +00:00
Brian Osman
9b8b4558d2 Change ByteCode and ByteCodeFunction to classes
The lack of encapsulation was finally starting to bother me. Had to
change the Interpreter namespace to a struct so that it could be
friended, but otherwise this was a nice and simple cleanup.

Also updated the comments on the two run functions, and renamed
fInputSlots to fUniformSlots, to reflect recent clarification
around in vs. uniform.

Change-Id: I24bbc59778b3ab6448bffcf98133d5c149a060a9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/244883
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-09-30 18:02:24 +00:00
Brian Salomon
f2ebdd91bf Rename GrPixelInfo to GrImageInfo.
Give it its own header file.

Make it store SkISize rather than separate int w/h.

Change-Id: I732f2774c561decac743a950959a70cbc162b67b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/245163
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2019-09-30 17:10:18 +00:00
Kevin Lubick
7aeabcfa6a [SkParagraph] Require len if using addText(const char*)
Bug: skia:9469
Change-Id: Ie3ae11db9be4b1cf1645e8db0bf29dc8e59bc4cd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/244877
Reviewed-by: Ben Wagner <bungeman@google.com>
2019-09-29 11:39:34 +00:00
Brian Salomon
dcbc359a00 Remove vestiges of 32 float texture format support
Change-Id: I186b2ea83a0c41f0ff1ecfe4163704c71ed121fb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/244881
Commit-Queue: Greg Daniel <egdaniel@google.com>
Auto-Submit: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2019-09-27 19:40:54 +00:00
Herb Derby
cbd235c746 Introduce SkIota a wrapper that adds an index
SkIota adds an index to some collection you already use:

std::vector<int> v;
for (auto t : SkMakeIota(v)) {
   size_t i; int v;
   std::tie(i, v) = t;
   ...
}

Change-Id: I18390fc084eb8509cfaeb50d9720541759a2986d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/225546
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2019-09-27 15:17:06 +00:00
Brian Salomon
5dd7746e35 Use SW backend as ref for AsyncReadPixels unit test.
As regular GPU and async read pixels share more it doesn't make sense
to test the async path using the regular path as the reference.

Bug: skia:9269

Change-Id: I8c32289947a7ae8b0f6e4e25ce8a588dfa5413f3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/244512
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2019-09-27 15:10:06 +00:00
Brian Osman
b23d66e10a Interpreter: Lots of minor cleanup/refactoring
- Update the parameter lists to both run and runStriped so
  that they're in the same (sane) order, named consistently,
  and always take counts with pointer arguments.
- Add the same count-based safety checks to run that were
  already in runStriped.
- Remove the N parameter to run, it was only used to run
  things one-at-a-time (other than one spot in unit tests),
  and it simplifies the code quite a bit. If you want to run
  multiple times, use the striped version. I also moved that
  functions 'N' earlier in the parameter list, to make the
  pattern of the remaining parameters clearer.
- Remove an interpreter benchmark class that was never used.

Change-Id: Ibff0a47bdb2d29d095a0addd27e65ab13cb80fce
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/244716
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-09-27 15:02:16 +00:00
Robert Phillips
7f367983b5 Add mipmap support to SkPixmap flavor of createBackendTexture
Change-Id: I7a2dea9b0b8e6b985f2d56e587939266022c19e1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/234664
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-09-26 19:42:27 +00:00
Ethan Nicholas
31cff27607 Revert "Revert "remove 'in uniform' support from GrSkSLFP, make rules more clear""
This reverts commit 85705c1b3b.

Change-Id: If189dafce53491728296a4292c76af55b05835ac
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/244509
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2019-09-26 18:11:45 +00:00
Brian Salomon
614cdab25d Check support for each GL format independently.
Previous code tried to aggregate some checks, but therefore had several
subtle bugs. Make each format check independent. It's easier to check
whether it's correct by looking up the specs/extensions referenced and
tweak it if not.

Also removes some "workarounds" that were just working around our own
bugs in extension/version detection.

Also adds some more WebGL format functionality.

Also uses glTexStorage2D for formats that previously did not check for
support.

Use glTexStorage2D on Android/NVIDIA to work around N9 and Shield TV
issues with glTexImage2D.

Bug: chromium:1003481

Change-Id: Ie3295b1ca76a6068f1426e77783d9dc07698c56a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/243816
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2019-09-26 16:30:46 +00:00
Ethan Nicholas
85705c1b3b Revert "remove 'in uniform' support from GrSkSLFP, make rules more clear"
This reverts commit ac18a5ca60.

Reason for revert: breaking Chrome roll

Original change's description:
> remove 'in uniform' support from GrSkSLFP, make rules more clear
> 
> Bug: skia:
> Change-Id: Iaa4d33c1bfb295d87343411ba6aacc8fae68ef9c
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/244300
> Reviewed-by: Brian Osman <brianosman@google.com>
> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>

TBR=brianosman@google.com,ethannicholas@google.com

Change-Id: I6e53f5197c751d961abfa21861b940d4168de213
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/244508
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2019-09-26 16:04:26 +00:00
Ethan Nicholas
ac18a5ca60 remove 'in uniform' support from GrSkSLFP, make rules more clear
Bug: skia:
Change-Id: Iaa4d33c1bfb295d87343411ba6aacc8fae68ef9c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/244300
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2019-09-26 14:05:10 +00:00
Nathaniel Nifong
7ee3f93196 Add a test that draws subpictures within an MSKP and make it pass.
It would have been passing, note that he changes to SkRecorder are needed only to obtain the
SkRecord used in asseting the correct commands were recorded.

Bug: skia: 9462
Change-Id: Ic43ab400b5954cc4f6eb465168179c0204a66040
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/243818
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Nathaniel Nifong <nifong@google.com>
2019-09-25 20:12:35 +00:00
Brian Osman
2caecd2a43 In AAConvexPathRenderer, don't assume that path direction can be computed
With a perspective view matrix, we transform the path, which can
collapse it down and cause CheapComputeFirstDirection to fail. In that
case, just skip drawing the path, rather than asserting.

Change-Id: I59ee3c74d02d41913136626a653c64f825a9d56a
Bug: https://bugs.fuchsia.dev/p/fuchsia/issues/detail?id=37330
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/244298
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-09-25 18:36:45 +00:00
Herb Derby
986ab2cf3d Add helper SkMakeZip
SkMakeZip uses function parameter deduction to build SkZips
the same way std::make_tuple does. It figures out the size
from one of the inputs that has a size. In debug, it makes
sure that all the size()s match if the input has a size.

Change-Id: I8f80d1137866ff595fff10cafa861e867441bedd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/242817
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2019-09-25 17:52:09 +00:00
Robert Phillips
0ee10347f9 Split out check_base_readbacks sub-test in BackendAllocation tests
We want to reuse this sub-portion of the tests for SkPixmap initialized backend textures

Note: this also changes the format read-back into to be RGBA8

Change-Id: I3708541cb4e60cf2ba7b587da6e21169ef890b04
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/244056
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-09-25 16:22:49 +00:00
Robert Phillips
c1dbb4b510 Add check_mipmaps subtest to BackendAllocation test
This is setting up the test for SkPixmap-initialized backend texture testing

Change-Id: I667a0e6d622c9408d7fb42fc4b5792b0efa2ffb4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/243736
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2019-09-24 21:12:12 +00:00
Brian Osman
73fb39c9b0 SkSL: Support bitwise negation on unsigned integers
Change-Id: I5558891882923b4e554a8b97a87da6bc4386b645
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/243817
Commit-Queue: Brian Osman <brianosman@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Auto-Submit: Brian Osman <brianosman@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2019-09-24 20:50:43 +00:00
Robert Phillips
d34691b513 Remove compressed format support from the GrGpu::createBackendTexture code path
The intent is to add a createCompressedBackendTexture code path. This will decouple the GPU's ability to create compressed textures from raster's support for compressed SkColorTypes.

Change-Id: I5fa5dded6d5013b524fe7f99f2ebe0bdee76b3c4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/243657
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2019-09-24 18:10:57 +00:00
Ethan Nicholas
6f62412c92 Fixed integer divide / remainder in sksl interpreter
Our integer tests were broken: constant folding was optimizing away
the actual operations, so nothing was actually being tested. This
allowed us to not realize that integer divide / remainder didn't
work: vector division signals if any of divisor's lanes are zero,
and zeroes are common in masked-off lanes.

This replaces naive vector operations with loops and mask checks
for integer divide and remainder, and corrects the various broken
integer tests so they are actually doing stuff.

Change-Id: I6ffcad9e7b38a0bfd1604097f86d0faa24e1dbc7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/243698
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2019-09-24 17:35:42 +00:00
Nigel Tao
d48f13b26a Enable Codec_GifInterlacedTruncated test for Wuffs
A recent update to the Wuffs version that Skia uses means that the test
now passes.

While the old third_party/gif implementation and the Wuffs
implementation now both replicate interlaced rows (what the old
implementation calls a "Haeberli hack"), and the
Codec_GifInterlacedTruncated test passes either way, the exact
replication algorithm is different. In general, pixel-by-pixel output
may be different for the same (truncated) input.

For example, the old implementation only processed input on block
boundaries. If the truncation happened within a block, the old
implementation produces no output for that partial block but the Wuffs
implementation does.

Also, the old implementation used the interlaced row as the *center* of
the extrapolation (the 'broad brush'); Wuffs uses it as the *top* of the
extrapolation. There are subjective arguments (e.g. 'Venetian blinds',
'fat bottom rows') for either behavior. In any case, it isn't covered by
the GIF spec.

Bug: skia:8235
Bug: skia:8766
Change-Id: Ia8d8b1007006697498e47ec6bba7be7d81be10c4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/243596
Commit-Queue: Leon Scroggins <scroggo@google.com>
Reviewed-by: Leon Scroggins <scroggo@google.com>
2019-09-24 16:48:33 +00:00
Brian Osman
4c2146f2ca Interpreter: Add bitwise shift operators
These only support fixed shift amounts (for now) ... because that's what
skvx supports ... because that's what various SIMD instructions support.

(We could loop over lanes, but the only need for this at the moment
is fine with constant shift).

Change-Id: I0e2c17084d019ff9b9a21476633adb59b3ce4bd6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/243656
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-09-24 14:56:36 +00:00
Brian Osman
e5bbce209c Interpreter: Add bitwise operators
Also, negation is unary, not binary.

Change-Id: Ic7c5a6f2ee0b2bbda89eef62999e4ebbc97dca12
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/243161
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-09-23 17:10:01 +00:00
Ethan Nicholas
d166d2e62f SkSL interpreter now properly short-circuits boolean operators
Bug: skia:
Change-Id: If7acf4107498cabc049ad130814a3814383bd14b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/243418
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2019-09-23 16:21:04 +00:00
Robert Phillips
40b05c390c Remove a usage of GrPixelConfig in SkGpuBlurUtils::GaussianBlur (take 2)
Bug: skia:6718
Change-Id: I6a0be1cab5543c3d76a041fcdc9ae9be4a3b179b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/242822
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2019-09-20 17:11:27 +00:00
Robert Phillips
ea1b30b57b New proposed syntax for SkColorTypes
Everything except for SkImageInfo.h is mechanical

Change-Id: I2d775c79467fb15f6022e80d21b4a9151272fe2a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/242896
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-09-19 20:42:55 +00:00
Robert Phillips
a5d96bcc51 Remove "experimental" comments regarding RG_F16 and RGBA_16161616
These two formats are now exercised in the wacky_yuv_formats GM

Change-Id: I07a5649401b7928e8c4666e39793915ac1d45646
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/242560
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-09-19 18:05:38 +00:00
Robert Phillips
c766d7fe3d Revert "Remove a usage of GrPixelConfig in SkGpuBlurUtils::GaussianBlur"
This reverts commit f580721e11.

Reason for revert: maybe angle bots

Original change's description:
> Remove a usage of GrPixelConfig in SkGpuBlurUtils::GaussianBlur
> 
> Bug: skia:6718
> Change-Id: Ia8a96cf6907ffaafd989f1e5bb1443d1ef51b9e6
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/242142
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Robert Phillips <robertphillips@google.com>

TBR=bsalomon@google.com,robertphillips@google.com

Change-Id: Ifcd22699ed64c7020c5d33781062c267595e246e
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:6718
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/242820
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-09-19 16:16:23 +00:00
Robert Phillips
f580721e11 Remove a usage of GrPixelConfig in SkGpuBlurUtils::GaussianBlur
Bug: skia:6718
Change-Id: Ia8a96cf6907ffaafd989f1e5bb1443d1ef51b9e6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/242142
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-09-19 15:26:56 +00:00
Chris Dalton
e2a903e18b Reland "Reorder msaa and mipmap resolves to happen all at once"
This is a reland of fd1414608b

Original change's description:
> Reorder msaa and mipmap resolves to happen all at once
> 
> Makes it so every renderTask has only one textureResolveTask, and
> modifies GrTextureResolveTask to perform multiple resolves
> back-to-back.
> 
> Bug: skia:9406
> Change-Id: I93566cf4b23764bd846a1e0a0848642c9b3a507a
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/241936
> Commit-Queue: Chris Dalton <csmartdalton@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>

Bug: skia:9406
Change-Id: I0e98ec6749e88628f8c1bae34351f5ff95cd2066
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/242519
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2019-09-18 21:00:01 +00:00