Commit Graph

3226 Commits

Author SHA1 Message Date
Brian Osman
3dd52c758b Revert "Convert GrDitherEffect to a runtime FP"
This reverts commit 2fa843abc2.

Reason for revert: Oops, SkSL error in the ES2 path.

Original change's description:
> Convert GrDitherEffect to a runtime FP
>
> Includes a change so that we can create non-ES2 runtime effects, even
> outside of tests/tools. It's still locked to a private API, so clients
> can't access the functionality.
>
> Change-Id: Ie0643da2071bd223fccf05b35f3a7b6f7bbc4876
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/423578
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Brian Osman <brianosman@google.com>

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

Change-Id: Icff68da3cadd00868c94b84fbb39e470a7bf45d0
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/424100
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-07-01 22:36:09 +00:00
Brian Osman
2fa843abc2 Convert GrDitherEffect to a runtime FP
Includes a change so that we can create non-ES2 runtime effects, even
outside of tests/tools. It's still locked to a private API, so clients
can't access the functionality.

Change-Id: Ie0643da2071bd223fccf05b35f3a7b6f7bbc4876
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/423578
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-07-01 20:58:54 +00:00
Florin Malita
d584ddd151 Add skottie-vs-png decode bench
Three flavors:

  - png data  -> bitmap
  - json data -> skottie::Animation -> SkPicture
  - json data -> skottie::Animation

    micros   	bench
     70.20  	decode_png_small	nonrendering
      4.32 ?	decode_skottiepic_small	nonrendering
      3.71 ?	decode_skottie_small	nonrendering

   4589.10  	decode_png_medium	nonrendering
    117.48 ?	decode_skottiepic_medium	nonrendering
     76.69 ?	decode_skottie_medium	nonrendering

  30895.97  	decode_png_large	nonrendering
   4911.16  	decode_skottiepic_large	nonrendering
   4640.39  	decode_skottie_large	nonrendering

Change-Id: Id93be15f453b70e8cb51ea38f33adc1ebc9ce562
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/423819
Reviewed-by: Florin Malita <fmalita@google.com>
Commit-Queue: Florin Malita <fmalita@google.com>
2021-07-01 20:18:03 +00:00
Robert Phillips
024668cf7f Rename gn options to skgpu_v1 and skgpu_v2
Bug: skia:11837
Change-Id: Ie9221d2cd8e42bebb6a8a9a8ef51ba4a488ce6ca
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/424036
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-07-01 17:09:33 +00:00
Robert Phillips
1a82a4ea49 Remove GrResourceProvider.h from all other header files
According to
https://commondatastorage.googleapis.com/chromium-browser-clang/include-analysis.html
these account for 583,146,886 bytes of input to the compiler, or roughly
0.25% of the input used to build Chrome.

Bug: chromium:242216
Change-Id: I2d5b73db770dba296df18c02a251da21e82b9ec0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/423836
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2021-07-01 15:25:14 +00:00
Brian Osman
4a77813008 Convert GrConfigConversionEffect to a runtime FP
Change-Id: I7f22447cf3356b1558d73665ff3e9b61639ebe83
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/423576
Auto-Submit: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2021-07-01 14:35:33 +00:00
Greg Daniel
34b52bf634 Revert "Metal: Add labels and debug groups to help with GPU Debugging."
This reverts commit 9e583bfa3f.

Reason for revert: breaking flutter, needs available checks

Original change's description:
> Metal: Add labels and debug groups to help with GPU Debugging.
>
> * Adds SK_ENABLE_MTL_DEBUG_INFO to enable labels and debug groups,
>   dependent on skia_enable_gpu_debug_layers.
>
> Bug: skia:12150
> Change-Id: I5b4538c0f6df6ceed72d7e8e6f1952fd193b7b90
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/422756
> Commit-Queue: Jim Van Verth <jvanverth@google.com>
> Reviewed-by: Greg Daniel <egdaniel@google.com>

TBR=egdaniel@google.com,jvanverth@google.com,chinmaygarde@google.com

Change-Id: I62deacb3527dc709fa8bb8c9f4631e523eae27f0
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:12150
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/423816
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2021-07-01 11:59:55 +00:00
Brian Osman
eaa76b9de0 Replace mask blur FPs with GrSkSLFP
Change-Id: Ie257eca4357b7ab66845af046329ad89857cdaa5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/423025
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2021-06-30 22:56:41 +00:00
Jim Van Verth
9e583bfa3f Metal: Add labels and debug groups to help with GPU Debugging.
* Adds SK_ENABLE_MTL_DEBUG_INFO to enable labels and debug groups,
  dependent on skia_enable_gpu_debug_layers.

Bug: skia:12150
Change-Id: I5b4538c0f6df6ceed72d7e8e6f1952fd193b7b90
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/422756
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2021-06-30 22:48:41 +00:00
Brian Osman
c6804edbae Convert Clamped and Tiled gradient effects to GrSkSLFP
Change-Id: If9a3a2e71fada81447ad697b2dc9efd4dec77a28
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/423019
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2021-06-29 21:04:38 +00:00
Ethan Nicholas
549c6b8739 Added Poison values to SkSL to improve DSL error handling
This also tightens up the rules around releasing DSL objects.

Bug: skia:12133
Change-Id: I11a6d8fbcec58374f7b5ed5ced1c5c112e2b7cc7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/421323
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2021-06-28 19:15:16 +00:00
Mike Reed
9f745d90d0 Remove SkMatrix44
Change-Id: I4b33603f7318bc5881929b50258bf166c8a5cb04
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/420818
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2021-06-26 01:51:45 +00:00
Brian Osman
9204ca678b Replace GrAlphaThresholdFP with GrSkSLFP
This also introduces "IgnoreOptFlags", for child FPs that should not
influence the OptFlags of the parent.

Change-Id: I8f7ba2ca59f612bd7d6e226b96e9fd94d656150b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/421929
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-06-25 21:02:49 +00:00
Brian Osman
b384eb204c Convert shape-clipping FPs to GrSkSLFP
Change-Id: Ic574939fd37dd9ded9868d3ffa9ac962140fb66c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/421537
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Chris Dalton <csmartdalton@google.com>
2021-06-25 17:08:39 +00:00
Brian Osman
65b4597d07 Reland "Replace some gradient .fps with runtime FPs"
This reverts commit 16c0791a5a.

Reason for revert: Only errors are AMD+ANGLE+D3D9+ES2

Original change's description:
> Revert "Replace some gradient .fps with runtime FPs"
>
> This reverts commit 68d6983acd.
>
> Reason for revert: Going to investigate some bad ANGLE_D3D_ES2 images.
>
> Original change's description:
> > Replace some gradient .fps with runtime FPs
> >
> > Change-Id: Ia00f88d00c6010d87c775acd32493673020d5ae8
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/420577
> > Commit-Queue: Brian Osman <brianosman@google.com>
> > Reviewed-by: Michael Ludwig <michaelludwig@google.com>
>
> TBR=bsalomon@google.com,brianosman@google.com,michaelludwig@google.com
>
> Change-Id: If57772f0e2d5236c5122f3c7fe261c0a59f3b141
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/421920
> Reviewed-by: Brian Osman <brianosman@google.com>
> Commit-Queue: Brian Osman <brianosman@google.com>

# Not skipping CQ checks because this is a reland.

Change-Id: I3903a23ab08c256303ee14814f16b4d2e1cbc642
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/421928
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-06-25 17:05:49 +00:00
Brian Osman
16c0791a5a Revert "Replace some gradient .fps with runtime FPs"
This reverts commit 68d6983acd.

Reason for revert: Going to investigate some bad ANGLE_D3D_ES2 images.

Original change's description:
> Replace some gradient .fps with runtime FPs
>
> Change-Id: Ia00f88d00c6010d87c775acd32493673020d5ae8
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/420577
> Commit-Queue: Brian Osman <brianosman@google.com>
> Reviewed-by: Michael Ludwig <michaelludwig@google.com>

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

Change-Id: If57772f0e2d5236c5122f3c7fe261c0a59f3b141
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/421920
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-06-25 14:33:51 +00:00
John Stiles
bef379ba62 Add SkBlendModeBlender class.
This is an SkBlender type which represents a traditional Skia blend mode
(from the SkBlendMode enum).

Change-Id: I7c74395be70584e11a5f1445b7f6cacfff35c532
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/420817
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2021-06-25 13:55:59 +00:00
Brian Osman
68d6983acd Replace some gradient .fps with runtime FPs
Change-Id: Ia00f88d00c6010d87c775acd32493673020d5ae8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/420577
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2021-06-25 13:08:49 +00:00
Chris Dalton
83420eb817 Rewrite tessellation atlases as normal render tasks
Rewrites tessellation atlases as normal render tasks instead of
"onFlush" tasks. These tasks get inserted into the DAG upfront, lay
out their atlases as dependent tasks get built and reference them, and
finally add their ops to render themselves during onMakeClosed. Doing it
this way allows us to pause the flush and re-render the atlas whenever
it runs out of room.

Bug: b/188794626
Bug: chromium:928984
Change-Id: Id59a5527924c63d5ff7c5bce46a88368e79fc3ef
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/420556
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Adlai Holler <adlai@google.com>
2021-06-24 01:44:19 +00:00
Brian Osman
48f83fd5d1 Reland "Replace GrColorMatrixFragmentProcessor with a runtime FP"
This reverts commit 3366efd581.

Reason for revert: Perf regression root cause fixed.

Original change's description:
> Revert "Replace GrColorMatrixFragmentProcessor with a runtime FP"
>
> Triggered a perf regression, somehow.
>
> This reverts commit 311010405e.
>
> Change-Id: Ic468d34c8ccd28aaaed2d3028ce9559115860844
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/420816
> Reviewed-by: Brian Osman <brianosman@google.com>
> Commit-Queue: Brian Osman <brianosman@google.com>

# Not skipping CQ checks because this is a reland.

Change-Id: Iea53fba22ef08b0ed97220b9cd2a9a0d054ecf57
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/420900
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-06-23 17:05:15 +00:00
Brian Osman
3366efd581 Revert "Replace GrColorMatrixFragmentProcessor with a runtime FP"
Triggered a perf regression, somehow.

This reverts commit 311010405e.

Change-Id: Ic468d34c8ccd28aaaed2d3028ce9559115860844
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/420816
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-06-23 13:47:35 +00:00
Jim Van Verth
f87f5b02ec Add state checks in GrMtlRenderCommandEncoder.
Change-Id: I9dcfc0dd559fe1596019f0d8051f665f69a6960d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/419163
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2021-06-23 13:13:55 +00:00
John Stiles
fbd9faef88 Migrate matrix-inversion code to a dedicated SkMatrixInvert file.
This allows SkM44 and optimize_intrinsic_call to share the same matrix
inversion logic.

Support for 2x2 and 3x3 matrix inversion was also added to
SkMatrixInvert, but is not currently used anywhere in Skia besides
optimize_intrinsic_call. (The perspective case of SkMatrix::ComputeInv
could probably be adapted to use the shared 3x3 code.)

Change-Id: Ie55aab536b4bd0c0a04f2c24527747670ca68fbb
Bug: skia:12054
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/420219
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2021-06-22 17:11:15 +00:00
Robert Phillips
11bc305898 Make current GPU blurring implementation be OGA-only
Bug: skia:11837
Change-Id: I8b209b362238e18a110fc518cb1c0b2f2244c22f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/419840
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-06-22 14:52:21 +00:00
Brian Osman
5946589e58 Replace GrOverrideInputFragmentProcessor with a runtime FP
Change-Id: Ife4dcd5627851b2dac1ed05b38c551d5d258e39c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/419797
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-06-22 14:21:48 +00:00
Brian Osman
6290555808 Replace GrDeviceSpaceEffect with a runtime FP
Change-Id: Ic0876160c936132c53b55ac9d27e0e422e1ccd26
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/420217
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-06-21 19:31:06 +00:00
Chris Dalton
685e09b31a Reland "Purge ccpr"
This is a reland of 7bf6bc0d06

Original change's description:
> Purge ccpr
>
> Now that the clip atlas has been successfully migrated to
> tessellation, we don't need this code anymore!
>
> Change-Id: Ic97f50cff7c4ee59f4476f8410f0b30a32df4e90
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/419857
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>
> Commit-Queue: Chris Dalton <csmartdalton@google.com>

Change-Id: If0be86902e7cc4755eba91a89be1ec1a6a4b54b2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/419720
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2021-06-19 18:42:38 +00:00
Brian Osman
fe83ab6706 Revert "Purge ccpr"
This reverts commit 7bf6bc0d06.

Reason for revert: Android build references kCoverageCounting

Original change's description:
> Purge ccpr
>
> Now that the clip atlas has been successfully migrated to
> tessellation, we don't need this code anymore!
>
> Change-Id: Ic97f50cff7c4ee59f4476f8410f0b30a32df4e90
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/419857
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>
> Commit-Queue: Chris Dalton <csmartdalton@google.com>

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

Change-Id: I01d99287978f848eb8bf900c07cba90ceb3b6edc
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/419898
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-06-19 15:13:19 +00:00
Chris Dalton
7bf6bc0d06 Purge ccpr
Now that the clip atlas has been successfully migrated to
tessellation, we don't need this code anymore!

Change-Id: Ic97f50cff7c4ee59f4476f8410f0b30a32df4e90
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/419857
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2021-06-18 21:46:36 +00:00
Greg Daniel
6f66302fe4 Fix iOS build for skpinfo.
Change-Id: Id6f6e20831ad84c35a67dbb47ac9eda3d72650b6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/419839
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-06-18 20:53:06 +00:00
Brian Osman
71bf78604b Replace RGB <-> HSL FPs with runtime FPs
Awkwardly, there is still two copies of (some of) this SkSL. We have
helper functions in SkRuntimeEffectPriv.h that implement these
transformations, and those are used by the high contrast color filter.

However: The RGB to HSL code is fairly different, and produces results
that are visibly different. For this CL, I didn't want to impact either
use case, so this is just a migration of the existing .fp code (only
used by HSLA color matrices). We can/should look at merging the
implementation in the future.

Change-Id: I8a9aa6a2d8563ab4333af79a528e406c08b0e1ba
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/419497
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2021-06-18 20:13:46 +00:00
Brian Osman
311010405e Replace GrColorMatrixFragmentProcessor with a runtime FP
Change-Id: I243c02fcf84c28141a263fa7cd056c5b43eab892
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/419496
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2021-06-18 19:30:41 +00:00
Chris Dalton
abed267359 Reland "Use a custom FP for tessellation atlas clips"
This is a reland of 90a0d9f618

Original change's description:
> Use a custom FP for tessellation atlas clips
>
> Something about GrTextureEffect::MakeSubset was upsetting NVIDIA
> Vulkan. This is cleaner anyway though since we only have to create 2
> fps instead of 3, and since we don't need to make new shaders for
> inverting coverage anymore.
>
> Bug: skia:12102
> Change-Id: I5d03ed12abba5c4053e08062c75ac8d40933b422
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/419150
> Reviewed-by: Michael Ludwig <michaelludwig@google.com>
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Commit-Queue: Chris Dalton <csmartdalton@google.com>

Bug: skia:12102
Change-Id: I32c3f698ee22179caee196ef884ae64456595c96
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/419563
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2021-06-18 00:14:13 +00:00
Chris Dalton
fd3ec901e0 Revert "Use a custom FP for tessellation atlas clips"
This reverts commit 90a0d9f618.

Reason for revert: Adreno compiler bug

Original change's description:
> Use a custom FP for tessellation atlas clips
>
> Something about GrTextureEffect::MakeSubset was upsetting NVIDIA
> Vulkan. This is cleaner anyway though since we only have to create 2
> fps instead of 3, and since we don't need to make new shaders for
> inverting coverage anymore.
>
> Bug: skia:12102
> Change-Id: I5d03ed12abba5c4053e08062c75ac8d40933b422
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/419150
> Reviewed-by: Michael Ludwig <michaelludwig@google.com>
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Commit-Queue: Chris Dalton <csmartdalton@google.com>

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

Change-Id: I0029410641f3914ab70686e07d1f4faa4952f31c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:12102
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/419596
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2021-06-17 20:44:35 +00:00
Robert Phillips
71143950f4 Switch GrMeshDrawOp::Target to be the stand alone GrMeshDrawTarget class
The Tessellator classes will survive in the NGA and they use
GrMeshDrawOp::Target - but GrMeshDrawOp will not survive.

This is a prelude to making all the remaining GrOp-derived classes OGA-only.

Bug: skia:11837
Change-Id: I62dc92e5f42d672342113f12dcedf3435fab993f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/419198
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2021-06-17 19:57:43 +00:00
Brian Osman
8e814b3be0 Replace GrClampFragmentProcessor with runtime FPs
Change-Id: Ie271fba0fa26165baac9246eaf1c729df2c7b05a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/419476
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-06-17 19:16:53 +00:00
Chris Dalton
90a0d9f618 Use a custom FP for tessellation atlas clips
Something about GrTextureEffect::MakeSubset was upsetting NVIDIA
Vulkan. This is cleaner anyway though since we only have to create 2
fps instead of 3, and since we don't need to make new shaders for
inverting coverage anymore.

Bug: skia:12102
Change-Id: I5d03ed12abba5c4053e08062c75ac8d40933b422
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/419150
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2021-06-17 17:51:53 +00:00
Brian Osman
3e4ef49890 Remove SkBlendMode from SkSL
We've lived without this for a long time. It bloats sksl_gpu (inhibits
some inlining!), and if things go according to plan, we'll be removing
enum support from SkSL entirely soon.

Change-Id: If844bbe5fdae41df7930d5c8ea9b832f9dd1b922
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/419099
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-06-16 21:01:30 +00:00
Brian Osman
759802fdd1 Reland "Fix more new Clang warnings"
This is a reland of 3d5483a547

Original change's description:
> Fix more new Clang warnings
>
> Change-Id: I82a13744669a6b5c23e23e6a719ec79878114dab
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/418697
> Commit-Queue: Brian Osman <brianosman@google.com>
> Reviewed-by: Kevin Lubick <kjlubick@google.com>

Change-Id: I6a81630c09d7aed906196b28adced0bf0a88e18d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/418938
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-06-16 17:40:07 +00:00
John Stiles
2d8b835cad Add SkBlender class; thread into SkVMBlitter.
Like SkColorFilter, SkShader, etc., this has a public-facing component
(SkBlender) and a private subclass (SkBlenderBase) which can be
obtained via a helper function (as_BB). At present there are no public-
facing methods, but the type needs to be exposed to be usable by the
outside world.

These classes exist for SkRuntimeEffect to subclass. The blender base
provides a `program` method with the parameters that blending will use.

Change-Id: I75c772fd4108a9c21fbda84201a8b23d3750a0df
Bug: skia:12080
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/416916
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-06-16 17:35:38 +00:00
Robert Phillips
3674f589ee Make GrPathRenderer and all derived class be OGA-only
Bug: skia:11837
Change-Id: I92aacf8b412d0158036a5f27aa767590e426bd5c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/417657
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-06-16 17:09:37 +00:00
Kevin Lubick
c3aa2f05cf Address some compile warnings from Clang 13
The latest emscripten uses Clang 13, which points out some new warnings
about implicit copy constructors, copy assignment operators etc.

This addresses some that I found until llvm crashed and would not
compile further (https://bugs.llvm.org/show_bug.cgi?id=50408)

Change-Id: Ia4d3f0b308facb18bf2da50261326244a7848644
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/413056
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
2021-06-15 18:58:18 +00:00
Robert Phillips
62214f779f Clean up prior to making GrPathRenderers OGA-only
GrCpuVertexAllocator, GrIsStrokeHairlineOrEquivalent and kLinearizationPrecision are still
useful in the NGA so divorce them from OGA-only classes.

Bug: skia:11837
Change-Id: Ib10e6b5448e0eb2b62c0178cfd019009a3a2e952
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/418148
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-06-15 15:22:17 +00:00
Robert Phillips
1ca0da4b91 Make GrClipStack, GrClipStackClip, and GrReducedClip OGA-only
GrStencilClip and GrStencilMaskHelper just come along for the ride

Bug: skia:11837
Change-Id: I7cfa2dd620b7457e6b6be4abf91b1ecd415d9b73
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/417680
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2021-06-15 12:48:34 +00:00
Jim Van Verth
5856683b9c Wrap MTLRenderCommandEncoder in GrMtlCommandEncoderClass.
This will allow tracking to prevent setting duplicate state.

Change-Id: I7cc72125a5dce9efbd957f1dfffc85ce45681048
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/418146
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Adlai Holler <adlai@google.com>
2021-06-15 12:31:47 +00:00
Chris Dalton
7ae272f043 Add a single-pass tessellation Op for convex fills
Bug: skia:10419
Change-Id: I0592adc43c1e426795fce133c37844ea7530058b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/416979
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2021-06-10 18:47:05 +00:00
Ethan Nicholas
2919bbdab8 Added DSLSymbols
These are new APIs to manage symbols and symbol tables from DSL code,
needed for the upcoming DSLParser.

Change-Id: Ic8d86aebfbcdeb84bd872d8727cdfafbb8db2fd6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/414907
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2021-06-10 17:07:36 +00:00
Robert Phillips
7b931f8f78 Add possibility of not compiling OGA files
The plan is to be able to compile and test NGA-only, OGA-only and both

Bug: skia:11837
Change-Id: Ib79cc2c2c437c72def8649392b345648f49300fc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/416799
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-06-10 13:10:19 +00:00
John Stiles
50d0d097c3 Add dest-color support to the Pipeline stage.
Previously, when converting a program, the pipeline stage could assume
that an input to main() of type half4/float4 was always the input color.
This was a good assumption since the only possible inputs were
coordinates, or the input color.

This CL now recognizes that when a second float4 is passed to the main()
function, it should be a SK_DEST_COLOR_BUILTIN. This will let blend
functions pass in two colors.

ProgramToSkVM now takes a dest-color argument as well, but existing call
sites won't reference it (since they aren't for blend functions). I've
just passed the input-color a second time, since the value will never
actually be accessed.

Change-Id: I4214586bda605c6d287aa25b1b099e6ef5ba15a4
Bug: skia:12080
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/417261
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-06-09 22:09:21 +00:00
Brian Osman
a784914e74 Rudimentary SkRuntimeImageFilter
This is really just a runtime shader with a late-bound input.

Bug: skia:12074 chromium:1213217
Change-Id: Ie92650a3e1e03d0c43ce4745eb33d49d582094f5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/416476
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2021-06-09 21:46:24 +00:00
Brian Osman
d1b530a785 Convert GrMagnifierEffect to a runtime FP
Change-Id: Ic44d272fff7a5bf8610b2f9b8e6c3270c54a20c6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/412957
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-06-09 14:46:19 +00:00
Chris Dalton
031d76b674 Rename GrPathStencilFillOp -> GrPathStencilCoverOp
"Fill" is an overloaded term. Switch to saying "cover", which I
believe is more true to the Redbook terminology anyway.

Bug: skia:10419
Change-Id: I906122c58462ac374b29dcb96e35bb3f86e55b0d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/416079
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-06-08 23:33:50 +00:00
Chris Dalton
26666bda75 Replace the indirect patch tessellator with fixed count
Bug: skia:10419
Change-Id: Icb3395565060d736624d03ba1465926bd9188e44
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/416078
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
2021-06-08 23:16:50 +00:00
John Stiles
f7f36ae077 Add ProgramKind::kRuntimeBlend for Runtime Blend functions.
Runtime Blend effects always take two input colors--source and
destination--instead of one. This CL adds a new ProgramKind for blend
effects, a new program module (empty for now), and adds a test to
confirm that the signature for blend functions is checked. Currently
these are only accessible via skslc; there's no Runtime Effect API to
create one and the dest color isn't hooked up to anything.

Change-Id: I5272a811d2d76b878cfdf3429efa78c9c8b3fd97
Bug: skia:12080
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/416798
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-06-08 19:34:39 +00:00
Chris Dalton
7ad3aa20c9 Fix DMSAA loads on ES/ANGLE
ES and ANGLE don't support framebuffer blits from single to
multisample. On these platforms we now perform a draw instead.

Bug: skia:12069
Bug: angleproject:6030
Change-Id: Ida0a5e9b556c4715fa63cb98aba185e64c72b28e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/415767
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2021-06-08 17:45:46 +00:00
Chris Dalton
155c33c859 Add a workaround for "ldexp(..., -x)" on Mac/Radeon/GLSL
Bug: skia:12076
Change-Id: Ia7aabe2e048a05475d25811af657228ea39d75ba
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/416561
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2021-06-08 01:39:38 +00:00
Ethan Nicholas
2c9a6ec3a0 Added skstd::string_view
Change-Id: Id02ed33b4fe60663327cc50d79db2bf876ad6df7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/415458
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2021-06-07 21:48:37 +00:00
John Stiles
0fbc6a3bcb Fix up names from RenderTargetContext to SurfaceDrawContext.
RenderTargetContext was renamed several months ago; this CL just fixes
up a few related names which hadn't yet updated yet.

Change-Id: I59a6ea92fc5d309a9b45a83e3aca6e49cb8d662e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/415745
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-06-04 19:37:14 +00:00
John Stiles
bb04e3d47e Add new FP, GrFragmentProcessor::DestColor.
This fragment processor reads back the color from the destination
surface; you can then use it as an input to other fragment processors.

Change-Id: Ibfe01fa92cf043f31e8284b7c7ed6c3d284d6429
Bug: skia:12066
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/415158
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-06-04 17:36:54 +00:00
John Stiles
87960de2ae Migrate GrDstProxyView to its own header.
Change-Id: Ic1b362a38d60c50ee6b4ead307fb57eb26c375e0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/415459
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-06-04 14:13:33 +00:00
Chris Dalton
d9bdc32347 Split GrPathTessellator subclasses into their own files
It was becoming a bit chaotic to have so many different algorithms in
one file.

Bug: skia:10419
Change-Id: I477b7b65439d16b0f983e10952cb41ec881e8183
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/413856
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2021-06-02 18:46:56 +00:00
Chris Dalton
feb099c403 Delete GrStrokeIndirectTessellator
Bug: skia:10419
Change-Id: I3393dbdbe33967d03e31ced4d1612fa228fc7acc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/414584
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2021-06-02 15:50:53 +00:00
Robert Phillips
1e3121af47 Replace replaceSurfaceDrawContext with replaceBackingProxy
Change-Id: Iba2641f71bdc541d1a55a22c022031949c326c27
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/414444
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2021-06-02 13:35:53 +00:00
Chris Dalton
b63711a6c4 Hide path tessellation shaders in private files
Replaces the public class definitions with factory methods. Separates
the class definitions into their own separate files.

Bug: skia:10419
Change-Id: I574d920d5a3d0dc98fa5eb231c9b510e04aebf78
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/413796
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-06-01 21:37:57 +00:00
Chris Dalton
3b412788fd Move tessellation shader files into a subdirectory
Also renames GrStrokeShader -> GrStrokeTessellationShader.

Bug: skia:10419
Change-Id: I75b09f794ef86a4cd8c467a1fd61cc87fe68091b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/413756
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-06-01 20:26:13 +00:00
Chris Dalton
2f733ec2dd Restructure path tessellation shaders
Merges the GrStrokePathShader and GrFillPathShader classes together.
Creates a new base class called GrPathTessellationShader. Now they all
have a uniform color and can all be draw to stencil and color both.
This is necessary cleanup in general, but will also allow us to create
a convex tessellation op that bypasses the stencil buffer.

Bug: skia:10419
Change-Id: Ifc492c94d3de044a36bd9ea95b1d5aa22e007905
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/413696
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-06-01 19:11:43 +00:00
John Stiles
9df48c6ba6 Add test for literals that overflow int64.
This was handled properly, but lacked a test.

Change-Id: I84adc7cb3d37ab85eef945c1e38fc43c6cd8aa01
Bug: skia:10932
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/414437
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2021-06-01 17:34:23 +00:00
John Stiles
b069582d16 Add regression test for oss-fuzz:32156.
The fuzzer found that it could overflow an int via a properly-crafted
constant-fold expression, leading to a UBSAN error. Constant-fold
expressions now guard against overflow (http://review.skia.org/413138)
and UBSAN is no longer triggered.

Change-Id: I07dba41e87bb9ceed37b84ec6b8922defbdc6550
Bug: oss-fuzz:32156, skia:12050
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/413836
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2021-06-01 15:19:13 +00:00
John Stiles
7d341a37f7 Add unit test for Type::minimumValue and Type::maximumValue.
This test confirms that our logic to derive the min and max value of a
given integer type actually matches reality.

Change-Id: I1cb5fba6bfb9ffdcf4972d8feed79cf71e11d0ca
Bug: skia:10932
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/413376
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-05-27 20:45:57 +00:00
Brian Osman
ce9d8e143d Remove all traces of OpenCL
Change-Id: I4e00edd2d1572c3e2c1fcb56824239c166253cbc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/412958
Reviewed-by: Eric Boren <borenet@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-05-27 19:17:17 +00:00
John Stiles
b35fbdbb06 Add test demonstrating overflow error in SkSL.
Change-Id: Ic6a3ce722c607d4d3c47d37e5749a01ae5fb193f
Bug: skia:12050
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/412668
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-05-26 21:52:31 +00:00
Brian Osman
9a4c965b2b Remove GrBlurredEdgeFragmentProcessor, use GrRuntimeFPBuilder
Change-Id: Ia5d849a2ab3fc233c4feacb5198a0684978ca3a9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/410794
Reviewed-by: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-05-25 18:26:12 +00:00
Ethan Nicholas
4ed2baa981 Added skstd::optional
This is needed by the upcoming DSLParser.

Change-Id: I54a0714e55feeb78894df766b14c795970f2c2d4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/411308
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2021-05-25 14:10:11 +00:00
Herb Derby
994a37be7e clean up SkPathEffectPriv removal
Change-Id: I83ad61869074e398ec0b452ae6efe09da5969f7e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/411837
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2021-05-24 15:13:58 +00:00
John Stiles
5ee369f623 Rename caps bit for matrix comparison rewrites.
This was originally designated for 2x2 matrices only, but this was not
right--all matrix comparisons actually need to be rewritten to fully
work around the bug.

Change-Id: I743d16a65bc55e93361a3dd8753653384583f063
Bug: skia:11308
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/411416
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-05-21 22:31:53 +00:00
John Stiles
147cfda6d8 Allow function declarations to take (void).
This is allowed by GLSL, so we allow it too.

GLSL ES 1.0, Section 6.1: "The idiom “(void)” as a parameter list is
provided for convenience."

Change-Id: I551c505d3de518a75acd5e306f09f0f0767e43f2
Bug: skia:12025
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/411300
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-05-21 19:21:23 +00:00
Brian Osman
b1e9cb08c1 Remove fExpression (matrix expression) from SampleUsage
Other than GMs, there is exactly one use of matrix-sampling
(GrMatrixEffect). It is always uniform (not literal or an
expression containing a uniform). The uniform always has the
same name. Bake these simplifications in, which also shrinks
SampleUsage quite a bit.

Change-Id: I0d5e32069d710af475ccc1030e2988c5fc965a98
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/411296
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-05-21 18:04:03 +00:00
John Stiles
36c5796f0b Add caps bit for 2x2 matrix comparison rewrites.
This will allow us to rewrite `mat == mat` on Adreno 5xx/6xx GPUs when
running in GLSL.

Change-Id: I621e918a545a49b7ecb9c944ae59b1e7a7594bae
Bug: skia:11308
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/410996
Reviewed-by: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-05-20 23:19:05 +00:00
Brian Osman
77a5bc3212 Remove GrArithmeticProcessor, use GrRuntimeFPBuilder instead
This also converts "enforcePMColor" to a uniform (rather than baking it
in). It's easier to write this way, and I can't imagine it made that
much difference to performance.

Change-Id: Idd202678740077412a2fb4e5122ebb9118f1d7bf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/410096
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2021-05-20 23:16:55 +00:00
Mike Reed
ec87dc1b76 Just expose factories for patheffects
bug: skia:11957
Change-Id: If2983fcd1b520a7ae77650d7e5ab226af9db52e0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/410782
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Tyler Denniston <tdenniston@google.com>
2021-05-20 23:01:45 +00:00
John Stiles
25be58e24b Reland "Eliminate unreachable code during optimization."
This is a reland of c6260f9742

Problematic DeadReturn.sksl test cases have been moved to DeadReturnES3.

Original change's description:
> Eliminate unreachable code during optimization.
>
> The Adreno 5xx and 6xx previously failed the SkSLStaticSwitchInline
> test; the driver struggled to interpret code with multiple return
> statements in a row. We now detect unreachable statements and eliminate
> them.
>
> Change-Id: I344d632f2488ca65b0635b37bebffe6e4fb607c5
> Bug: skia:12012
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/410256
> Auto-Submit: John Stiles <johnstiles@google.com>
> Commit-Queue: Brian Osman <brianosman@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>

Bug: skia:12012
Change-Id: I748e8761cbc71c811b5ad8fe49186f980261d8b9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/410793
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-05-20 20:02:15 +00:00
Brian Salomon
e72fd09ce1 Revert "Eliminate unreachable code during optimization."
This reverts commit c6260f9742.

Reason for revert: Nexus 7 is grumpy, fails SkSLDeadReturn_GPU
https://ci.chromium.org/raw/build/logs.chromium.org/skia/539fff50ff093c11/+/annotations


Original change's description:
> Eliminate unreachable code during optimization.
>
> The Adreno 5xx and 6xx previously failed the SkSLStaticSwitchInline
> test; the driver struggled to interpret code with multiple return
> statements in a row. We now detect unreachable statements and eliminate
> them.
>
> Change-Id: I344d632f2488ca65b0635b37bebffe6e4fb607c5
> Bug: skia:12012
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/410256
> Auto-Submit: John Stiles <johnstiles@google.com>
> Commit-Queue: Brian Osman <brianosman@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>

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

Change-Id: Ia3db1f1b28417e479e2d71a4a6ed94a007e47cf9
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:12012
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/410780
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2021-05-20 13:00:36 +00:00
John Stiles
c6260f9742 Eliminate unreachable code during optimization.
The Adreno 5xx and 6xx previously failed the SkSLStaticSwitchInline
test; the driver struggled to interpret code with multiple return
statements in a row. We now detect unreachable statements and eliminate
them.

Change-Id: I344d632f2488ca65b0635b37bebffe6e4fb607c5
Bug: skia:12012
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/410256
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-05-19 23:03:23 +00:00
Chris Dalton
a9f759d022 Rewrite the path tessellation sample
Use the GrPathTessellators directly instead of going through
GrPathStencilFillOp. Add keyboard shortcuts to toggle between the
different path tessellators.

Bug: skia:10419
Change-Id: I5d80731d26c9a77fb0eca07a7023c50848e29f7c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/409556
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Tyler Denniston <tdenniston@google.com>
2021-05-18 19:34:24 +00:00
Brian Osman
3adc091af8 Remove layout(tracked) from SkSL
Change-Id: I6019418526def09c6c9f4b22567a2c76542d043c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/409876
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-05-18 17:44:54 +00:00
Chris Dalton
e73c070911 Refactor stroke tessellation shaders
Splits the instanced and tessellation implementations into their own
separate files and merges their common code into a shared base class.
Renames GrStrokeTessellateShader to GrStrokeShader.

Bug: skia:10419
Change-Id: Ia731509858e682a605ee65c9ced1fd163e4c03f3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/409036
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Tyler Denniston <tdenniston@google.com>
2021-05-17 23:18:10 +00:00
John Stiles
f2b08cc9c8 Fix SPIR-V code generation of dead return statements.
If we encounter code like `return 1; return 2;` we need to synthesize a
label, even though the second return statement isn't actually reachable.
This is harmless and satisfies the SPIR-V validator.

Ideally we'd eliminate the dead code entirely, but this case is rare and
isn't likely to cause any problems as-is.

Change-Id: I2d6219dff6868011353e19a662301bec44a015d6
Bug: skia:12009
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/409402
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-05-17 20:23:40 +00:00
John Stiles
191b4e2a00 Enable proper testing of matrix-scalar ops.
Now that the various Metal and SPIR-V bugs have been shaken out, we can
enable these tests. Knock on wood.

Change-Id: If4b4e302cfdd91464aaf00bc9639989de5e49aac
Bug: skia:11985
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/408640
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2021-05-17 17:36:22 +00:00
John Stiles
29b44fc226 Add SPIR-V test for matrix-op-scalar math.
This is a clone of the Metal test. (This can be moved into shared/ and
enabled as a real test once the codegen is fixed.)

At present, this test generates broken code; everything is writing an
SpvOpMatrixTimesScalar opcode regardless of the actual operation being
performed.

Change-Id: If06b4196e7d9be36e41c5c60c006b2a713cc25d8
Bug: skia:11985
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/408297
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-05-14 12:52:02 +00:00
Chris Dalton
0cfe5e1628 Add a GrCullTest class
GrCullTest quickly determines whether a set of points will be visible
or not. It will be used to guard against exponential recursion when
chopping paths at an extreme zoom level.

Bug: skia:10419
Change-Id: I85183826d820bbca0349a1e794b0696f776b134b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/407297
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2021-05-13 17:30:58 +00:00
John Stiles
6b13129c30 Add support for matrix + scalar to Metal codegen.
The Metal code generator will now detect matrix-op-scalar expressions
and splat the scalar across a matrix. This allows a scalar to be added
to, or subtracted from, a matrix. (It does not fix division because
Metal also does not natively support componentwise division on
matrices.)

Change-Id: I7d5b0c5bd35393475c524e34cad789bf4f72a103
Bug: skia:11125
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/407616
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-05-13 17:22:43 +00:00
Robert Phillips
09b2bcbb81 Add SkBaseGpuDevice ...
between SkBaseDevice/SkClipStackDevice and SkGpuDevice/SkGpuDevice_nga

The idea is that SkCanvas will deal with SkBaseGpuDevices rather than SkGpuDevice*s

Change-Id: I1bffeccab44d2a2b73413f50d7c905fa2df8eedc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/407459
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-05-12 19:26:52 +00:00
Michael Ludwig
4e9d5e2bdf Use Wang's formula for quadratic and cubic point counts
- most of the small diffs are because I moved GrWangsFormula.h out
   of the tessellate/ directory and into the geometry/ directory since
   it's more general than HW tessellation.

The previous implementation was based on the heuristic that the distance
from the true curve to the line segment would be divided by 4 every time
the curve was recursively subdivided. This was a reasonable
approximation if the curve had balanced curvature on both sides of the
split. However, in the case of the new GM's curve, the left half was
already very linear and the right half had much higher curves.

This lead to the approximation reporting fewer points than required.
Theoretically, those few points that weren't utilized by the left half
of the curve could have been made available to the right half, but the
implementation of that would be tricky.

Instead, it now uses Wang's formula to compute the number of points.
Since recursive subdivision leads to linearly spaced samples assuming it
can't stop early, this point count represents a valid upper bound on
what's needed. It also then ensures both left and right halves of a
curve have the point counts they might need w/o updating the
generation implementations. However, since the recursive point
generation exits once each section has reached the error tolerance, in
scenarios where the prior approximation was reasonable, we'll end up
using fewer points than reported by Wang's. Hopefully that means there
is negligible performance regression since we won't be increasing
vertex counts by that much (except where needed for correctness).

Bug: skia:11886
Change-Id: Iba39dbe4de82011775524583efd461b10c9259fe
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/405197
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2021-05-12 18:33:33 +00:00
Brian Osman
bb3966ad4e Update GN reference to recently moved SkSpan.h
Fixes CMake build

Cq-Include-Trybots: luci.skia.skia.primary:Build-Debian10-Clang-x86_64-Release-CMake
Change-Id: If4da32306e6735dced70412216e43f0b8bbca48c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/407357
Commit-Queue: Brian Osman <brianosman@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Auto-Submit: Brian Osman <brianosman@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-05-12 14:53:33 +00:00
Ethan Nicholas
b22fcaf627 Added DSL layout() support
Change-Id: I698dd607ff4676b6fb29be0a718c6073b66dc7c7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/406336
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2021-05-11 19:52:59 +00:00
Michael Ludwig
4e1c1a77ad Implement computeFastBounds for PathEffects
Makes computeFastBounds not part of the public API, it's only accessible
to subclasses of SkPathEffect, GrStyle, and SkPaint. Subclasses can
invoke it other path effects using SkPathEffectPriv::ComputeFastBounds.

Changes the internal function to
  bool computeFastBounds(SkRect* bounds) const;

Subclasses of SkPathEffect must implement this, and can choose to return
false when fast bounds aren't computable.

Provides implementations of computeFastBounds() for path effects
bundled with Skia.

Bug: skia:11974
Change-Id: I545ccf99b4e669d3af9df13acfac28573306fab8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/406140
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2021-05-11 17:01:59 +00:00
John Stiles
27193d4bce Add test demonstrating missed opportunities with casts.
A cast like `float(five)` or `int4(colorGreen)` should detect const
variables and replace the expression with its compile-time constant
equivalent value. At present, this replacement is missed, which inhibits
further optimization opportunities on the expression.

(This CL is very similar in spirit to http://review.skia.org/404676)

Change-Id: I04b5c435a30d2afcdbdb3d020adc15e9c651cc31
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/405682
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-05-07 22:04:16 +00:00
Chris Dalton
2ed22faaa1 Rename GrTessellatingStencilFillOp -> GrPathStencilFillOp
This makes the class name conform to the same pattern as the other
tessellation ops: stroke tessellation ops begin with GrStroke* and
fill tessellation ops now begin with GrPath*.

Change-Id: I454341ec95438637ee2a4e501a374f8f59622550
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/405018
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-05-06 22:59:47 +00:00
John Stiles
f96cb712d7 Keep the intrinsic kind of a FunctionDefinition in its IRNode.
This simplifies intrinsic identification from our backends. Rather than
needing to manually track a list of strings in each backend, we can just
call `funcCall.function().intrinsicKind()` and use the shared enum.

In this CL, the GLSL backend has been converted to use the intrinsicKind
call. Other backends will be updated in followup CLs.

Change-Id: I47491655108a08b7414bfa293807d46ad948084a
Bug: skia:11961
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/404898
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-05-06 12:16:17 +00:00
Brian Osman
c9125aa8f3 Reland "Better first-class shader & color filter support in runtime effects"
This is a reland of adadb95a9f
... adds a temporary workaround for some Android framework code.

Original change's description:
> Better first-class shader & color filter support in runtime effects
>
> This does a few things, because they're all intertwined:
>
> 1) SkRuntimeEffect's API now includes details about children (which Skia
>    stage was declared, not just the name). The factories verify that the
>    declared types in the SkSL match up with the C++ types being passed.
>    Today, we still only support adding children of the same type, so the
>    checks are simple. Once we allow mixing types, we'll be testing the
>    declared type against the actual C++ type supplied for each slot.
> 2) Adds sample variants that supply the input color to the child. This
>    is now the only way to invoke a colorFilter child. Internally, we
>    support passing a color when invoking a child shader, but I'm not
>    exposing that. It's not clearly part of the semantics of the Skia
>    pipeline, and is almost never useful. It also exposes users to
>    several inconsistencies (skbug.com/11942).
> 3) Because of #2, it's possible that we can't compute a reusable program
>    to filter individual colors. In that case, we don't set the constant
>    output for constant input optimization, and filterColor4f falls back
>    to the slower base-class implementation.
>
> Bug: skia:11813 skia:11942
> Change-Id: I06c41e1b35056e486f3163a72acf6b9535d7fed4
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/401917
> Commit-Queue: Brian Osman <brianosman@google.com>
> Reviewed-by: Mike Klein <mtklein@google.com>

Bug: skia:11813 skia:11942
Change-Id: I2c31b147ed86fa8c4dddefb7066bc1d07fe0d285
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/404637
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-05-05 22:06:46 +00:00
Robert Phillips
3b97aa2cc9 Add NGA compilation stubs
Change-Id: I5309005146b8121528ad23589fa64cc6bf286aee
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/402578
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-05-05 16:48:01 +00:00
Ethan Nicholas
371f6e18e5 Refactored SkSL function creation and error handling
This breaks up the giant IRGenerator::convertFunction method into more-
manageable chunks, moves the functionality into FunctionDeclaration,
and funnels the DSL through it so it receives the same error checking.

Change-Id: Icf2ac650ab3d5276d8c0134062a4e7e220f9bf32
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/402778
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2021-05-04 19:25:25 +00:00
Greg Daniel
c2cca5a8a0 Revert "Better first-class shader & color filter support in runtime effects"
This reverts commit adadb95a9f.

Reason for revert: breaking android

Original change's description:
> Better first-class shader & color filter support in runtime effects
>
> This does a few things, because they're all intertwined:
>
> 1) SkRuntimeEffect's API now includes details about children (which Skia
>    stage was declared, not just the name). The factories verify that the
>    declared types in the SkSL match up with the C++ types being passed.
>    Today, we still only support adding children of the same type, so the
>    checks are simple. Once we allow mixing types, we'll be testing the
>    declared type against the actual C++ type supplied for each slot.
> 2) Adds sample variants that supply the input color to the child. This
>    is now the only way to invoke a colorFilter child. Internally, we
>    support passing a color when invoking a child shader, but I'm not
>    exposing that. It's not clearly part of the semantics of the Skia
>    pipeline, and is almost never useful. It also exposes users to
>    several inconsistencies (skbug.com/11942).
> 3) Because of #2, it's possible that we can't compute a reusable program
>    to filter individual colors. In that case, we don't set the constant
>    output for constant input optimization, and filterColor4f falls back
>    to the slower base-class implementation.
>
> Bug: skia:11813 skia:11942
> Change-Id: I06c41e1b35056e486f3163a72acf6b9535d7fed4
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/401917
> Commit-Queue: Brian Osman <brianosman@google.com>
> Reviewed-by: Mike Klein <mtklein@google.com>

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

Change-Id: I94ba57e73305b2302f86fd0c1d76f667d4e45b92
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:11813 skia:11942
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/404117
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2021-05-04 13:36:26 +00:00
Brian Osman
adadb95a9f Better first-class shader & color filter support in runtime effects
This does a few things, because they're all intertwined:

1) SkRuntimeEffect's API now includes details about children (which Skia
   stage was declared, not just the name). The factories verify that the
   declared types in the SkSL match up with the C++ types being passed.
   Today, we still only support adding children of the same type, so the
   checks are simple. Once we allow mixing types, we'll be testing the
   declared type against the actual C++ type supplied for each slot.
2) Adds sample variants that supply the input color to the child. This
   is now the only way to invoke a colorFilter child. Internally, we
   support passing a color when invoking a child shader, but I'm not
   exposing that. It's not clearly part of the semantics of the Skia
   pipeline, and is almost never useful. It also exposes users to
   several inconsistencies (skbug.com/11942).
3) Because of #2, it's possible that we can't compute a reusable program
   to filter individual colors. In that case, we don't set the constant
   output for constant input optimization, and filterColor4f falls back
   to the slower base-class implementation.

Bug: skia:11813 skia:11942
Change-Id: I06c41e1b35056e486f3163a72acf6b9535d7fed4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/401917
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2021-05-04 01:29:57 +00:00
Brian Salomon
31fddc3769 MSKP support in nanobench
Bug: skia:11900
Change-Id: I97d1f2a9523252318ffb4f479b197cb0ef9cf0b1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/402920
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2021-04-30 20:04:08 +00:00
Leon Scroggins
d87a98f196 Add LOCAL_LICENSE_KINDS to external/skia
Bug: b/68860345
Bug: b/151177513
Bug: b/151953481

ag/Iead63ec340208211058d0a04ed4e476af6cd51b0 added these to Android.bp,
resulting in merge conflicts. After that is reverted, we can land these
here unchanged to get the same effect, without conflicts.

Change-Id: Ia9e3970564dca014e4f144fba9e3da4f0c174e7d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/357277
Commit-Queue: Leon Scroggins <scroggo@google.com>
Reviewed-by: Derek Sollenberger <djsollen@google.com>
2021-04-30 20:03:22 +00:00
Brian Salomon
768d97133d Remove last usage of GrTextureAdjuster and delete it and parent class.
Last use case was creating cached mipmapped copies of uncached
views backing SkImage_Raster (pinned) or SkImage_Gpu. Add a helper
to SkImage_Base as replacement.

Bug: skia:11877
Change-Id: I1f39842e7aeee3d34f6086618e164058e8e43128
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/402776
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-04-30 18:09:38 +00:00
Leon Scroggins III
6c41bf55b7 Create mini-skia for RenderEngine
Bug: b/167743764

Android's RenderEngine is now using Skia, but it doesn't need all the
pieces of Skia used by HWUI. Make a smaller version of Skia that
excludes many of those pieces, in particular where they bring in other
dependencies:
- codecs
- text
- pdf
- xml

Add a new cc_defaults to be shared by the new libskia_mini and libskia.

Manually insert fexceptions into libskia, since it is only needed by
SkRawCodec (not needed by mini).

Add a new SkUserConfig for mini, so it can exclude defines like
SK_CODEC_DECODES_PNG.

Continue to link in libpng (and libz, which it depends on) and build
SkPngEncoder, so that SKP captures can include compressed image files.

Switching to the mini-skia reduces the size of surfaceflinger from 7.4M
to 6.0M.

Change-Id: I6843ee43457b5a0feb36ae88a59d1d61770a6247
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/402257
Commit-Queue: Leon Scroggins <scroggo@google.com>
Reviewed-by: Derek Sollenberger <djsollen@google.com>
2021-04-29 21:04:48 +00:00
Brian Salomon
1450643c1d Remove unused class GrTextureMaker
Bug: skia:11877
Change-Id: If715cff4632b2ed0c4cddccedd5eaf614a0c0275
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/402616
Auto-Submit: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2021-04-29 17:01:47 +00:00
Brian Osman
552fcb9a1b Remove flexible runtime effects entirely
All internal usage has migrated to MakeFor..., this removes the old
program kind, and updates some tests.

Bug: skia:11813
Change-Id: I56733b071270e1ae3fab5d851e23acf6c02e3361
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/402536
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2021-04-29 16:02:27 +00:00
John Stiles
fb7d378a1a Add test demonstrating swizzled constant folding.
At present, this is a missed optimization opportunity. These will be
optimized in a followup CL.

Change-Id: I8882058900cdc12c8ab0df03e36ebfb9d8022f01
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/402580
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2021-04-29 15:59:37 +00:00
Brian Salomon
2ee0f48d3f Remove GrImageTextureMaker.
Make proxy view directly in SkImage_Lazy::onAsView.

Temporarily lean on GrTextureAdjuster for
SkImage_Lazy::asFragmentProcessor.

Bug: skia:11877
Change-Id: I2f8b35d0571ebcf9ffba945ecdf1ac51db6e3eba
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/402400
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2021-04-29 15:45:47 +00:00
Brian Osman
83dae92318 Remove SkSL sample-with-matrix implementation
Simplifies SampleUsage quite a bit (no need to track multiple kinds of
sampling, variable matrices don't exist any more, etc...).

Change-Id: I58b8de7218d00c4d882d2650672e5fe01892a062
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/402177
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-04-29 12:46:57 +00:00
Brian Salomon
27c4202f4b Remove GrBitmapTextureMaker.
Replace with two methods in SkGr.h that make cached/uncached texture
proxies from SkBitmap. Move code that makes a GrFP from the proxy
to SkImage_Raster::asFragmentProcessor.

Bug: skia:11877
Change-Id: I51a0ae687561be9b0e44b98ee50f171e42476d94
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/401920
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2021-04-28 17:24:56 +00:00
Brian Osman
bf3e9e9591 Remove sample-with-matrix from SkSL
This is completely unused - GrMatrixEffect is the only thing that deals
with matrix transforms on child sampling. Removing this makes everything
simpler to reason about.

Change-Id: I555a3fd937c064f2480b149a6d4d8e36f7ee69bc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/402176
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2021-04-28 15:44:35 +00:00
Mike Reed
e4b8c3aa73 OrderedFontMgr utility
Only supports finding / matching, never Making

Change-Id: I81b09e7f3563cab4ed4f0fbfc598781ff3a355aa
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/401576
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Julia Lavrova <jlavrova@google.com>
2021-04-27 18:10:41 +00:00
John Stiles
83b0c830c6 Add support for built-in functions to DSLCPPCodeGenerator.
Change-Id: Idf65ff46cd75d23f550c8e763cf3618ec7501b38
Bug: skia:11854
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/398877
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2021-04-22 21:56:22 +00:00
John Stiles
d85d720800 Add support for sample() to DSLCPPCodeGenerator.
This CL also removes some vestiges of the kSampler type, which hasn't
been used in .fp files for a long time.

Change-Id: Iaca1d0c6e77ad2df2b6c5dacd1c68079d6dd5cf2
Bug: skia:11854
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/398738
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2021-04-22 21:13:13 +00:00
John Stiles
abde8fc182 Enable DSL FP tests.
These new tests rely on compiled shaders that live in the
`tests/sksl/dslfp/` directory; this CL updates the Bazel and
emscripten build scripts to include these shaders.

Change-Id: Ib670682af8bf451a4473504dd4cc76a0e9222129
Bug: skia:11854
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/400097
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-04-22 21:03:43 +00:00
Chris Dalton
82007f568d Implement a fixed count stroke tessellator
This new tessellator renders strokes as fixed-count triangle strip
instances. Any extra triangles not needed by the instance are emitted
as degenerate triangles. Since it draws in order, this tessellator
allows us to batch dynamic colors even when hw tessellation is not
supported.

Bug: skia:10419
Change-Id: If03a8b76319471ae4d4580dda019b69204d9197b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/398416
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2021-04-22 20:34:04 +00:00
John Stiles
956802335d Reland "Reland "Implement statements and expressions in DSL C++ code generator.""
This is a reland of c412688798

This CL lands the code changes but not the dm test, which is causing
link errors. Tests will be relanded as a separate CL, at
http://review.skia.org/400097

Original change's description:
> Reland "Implement statements and expressions in DSL C++ code generator."
>
> This is a reland of 16cbfb41df
>
> Tests now rely on `shaderDerivativeSupport` and `integerSupport` as
> proxies to indicate ES3 support. The SwitchStatement test has been
> adjusted to hopefully confuse fewer compilers.
>
> Original change's description:
> > Implement statements and expressions in DSL C++ code generator.
> >
> > This CL removes the bulk of the existing C++ code generator, especially
> > all the complex format-string assembly code. It has been replaced with
> > actual DSL code generation. Simple IR can now be successfully translated
> > to a working DSL fragment processor.
> >
> > This CL also adds a simple test harness which is patterned after the
> > existing SkSLTest; it renders a pixel, reads it back, and fails the test
> > if the result isn't solid green (RGBA=0101).
> >
> > This CL doesn't implement every feature. Some obvious gaps include:
> > - Sampling from children
> > - Uniforms/inputs of any kind
> > - Function calls of any kind
> >
> > Change-Id: Ib80c23fe1ba4453f7c3cb43b65f93c5ea0deb709
> > Bug: skia:11854
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/396757
> > Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
> > Reviewed-by: Brian Osman <brianosman@google.com>
> > Commit-Queue: John Stiles <johnstiles@google.com>
>
> Bug: skia:11854, skia:11891
> Change-Id: I91363e31f34611d15ae350b52d6fc459feeace9c
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/399076
> Auto-Submit: John Stiles <johnstiles@google.com>
> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
> Reviewed-by: Ethan Nicholas <ethannicholas@google.com>

Bug: skia:11854
Bug: skia:11891
Change-Id: Ib1f08256c84d1da2130e0b61356f72435dc0a5a8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/399740
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2021-04-22 20:01:33 +00:00
Mike Klein
dd8f8ed384 clean up defines that do nothing
These are leftovers.  Should be a noop.

Change-Id: I9897841e63b417a63d6f2d681a8ac4ae50ebb485
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/399797
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2021-04-22 18:02:59 +00:00
Herb Derby
d5a676441a use GrArenas for direct glyph drawing
The existing code incorrectly uses the recordTimeAllocator.
Add a SubRunAllocator to the GrArenas, and use GrArenas to
store direct glyph drawing information.

Change-Id: I38ba25658364a48af5c775315331795d3d22121f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/397476
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-04-22 16:43:31 +00:00
John Stiles
126128b37c Revert "Reland "Implement statements and expressions in DSL C++ code generator.""
This reverts commit c412688798.

Reason for revert: fix Google3 roll and wasm build

Original change's description:
> Reland "Implement statements and expressions in DSL C++ code generator."
>
> This is a reland of 16cbfb41df
>
> Tests now rely on `shaderDerivativeSupport` and `integerSupport` as
> proxies to indicate ES3 support. The SwitchStatement test has been
> adjusted to hopefully confuse fewer compilers.
>
> Original change's description:
> > Implement statements and expressions in DSL C++ code generator.
> >
> > This CL removes the bulk of the existing C++ code generator, especially
> > all the complex format-string assembly code. It has been replaced with
> > actual DSL code generation. Simple IR can now be successfully translated
> > to a working DSL fragment processor.
> >
> > This CL also adds a simple test harness which is patterned after the
> > existing SkSLTest; it renders a pixel, reads it back, and fails the test
> > if the result isn't solid green (RGBA=0101).
> >
> > This CL doesn't implement every feature. Some obvious gaps include:
> > - Sampling from children
> > - Uniforms/inputs of any kind
> > - Function calls of any kind
> >
> > Change-Id: Ib80c23fe1ba4453f7c3cb43b65f93c5ea0deb709
> > Bug: skia:11854
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/396757
> > Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
> > Reviewed-by: Brian Osman <brianosman@google.com>
> > Commit-Queue: John Stiles <johnstiles@google.com>
>
> Bug: skia:11854, skia:11891
> Change-Id: I91363e31f34611d15ae350b52d6fc459feeace9c
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/399076
> Auto-Submit: John Stiles <johnstiles@google.com>
> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
> Reviewed-by: Ethan Nicholas <ethannicholas@google.com>

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

Change-Id: I71a8cf31e8a013b7a2a0d10f0ad3bc3893ea07ea
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:11854
Bug: skia:11891
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/399499
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-04-22 13:45:00 +00:00
John Stiles
c412688798 Reland "Implement statements and expressions in DSL C++ code generator."
This is a reland of 16cbfb41df

Tests now rely on `shaderDerivativeSupport` and `integerSupport` as
proxies to indicate ES3 support. The SwitchStatement test has been
adjusted to hopefully confuse fewer compilers.

Original change's description:
> Implement statements and expressions in DSL C++ code generator.
>
> This CL removes the bulk of the existing C++ code generator, especially
> all the complex format-string assembly code. It has been replaced with
> actual DSL code generation. Simple IR can now be successfully translated
> to a working DSL fragment processor.
>
> This CL also adds a simple test harness which is patterned after the
> existing SkSLTest; it renders a pixel, reads it back, and fails the test
> if the result isn't solid green (RGBA=0101).
>
> This CL doesn't implement every feature. Some obvious gaps include:
> - Sampling from children
> - Uniforms/inputs of any kind
> - Function calls of any kind
>
> Change-Id: Ib80c23fe1ba4453f7c3cb43b65f93c5ea0deb709
> Bug: skia:11854
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/396757
> Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>
> Commit-Queue: John Stiles <johnstiles@google.com>

Bug: skia:11854, skia:11891
Change-Id: I91363e31f34611d15ae350b52d6fc459feeace9c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/399076
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2021-04-21 20:17:07 +00:00
John Stiles
60191e0502 Revert "Implement statements and expressions in DSL C++ code generator."
This reverts commit 16cbfb41df.

Reason for revert: using ES3 features, breaks on ANGLE ES2 bots

Original change's description:
> Implement statements and expressions in DSL C++ code generator.
>
> This CL removes the bulk of the existing C++ code generator, especially
> all the complex format-string assembly code. It has been replaced with
> actual DSL code generation. Simple IR can now be successfully translated
> to a working DSL fragment processor.
>
> This CL also adds a simple test harness which is patterned after the
> existing SkSLTest; it renders a pixel, reads it back, and fails the test
> if the result isn't solid green (RGBA=0101).
>
> This CL doesn't implement every feature. Some obvious gaps include:
> - Sampling from children
> - Uniforms/inputs of any kind
> - Function calls of any kind
>
> Change-Id: Ib80c23fe1ba4453f7c3cb43b65f93c5ea0deb709
> Bug: skia:11854
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/396757
> Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>
> Commit-Queue: John Stiles <johnstiles@google.com>

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

Change-Id: I4f3e7667bf1e3a5539d0248b6c47d9ae2296aa88
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:11854
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/398739
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-04-20 19:59:37 +00:00
John Stiles
16cbfb41df Implement statements and expressions in DSL C++ code generator.
This CL removes the bulk of the existing C++ code generator, especially
all the complex format-string assembly code. It has been replaced with
actual DSL code generation. Simple IR can now be successfully translated
to a working DSL fragment processor.

This CL also adds a simple test harness which is patterned after the
existing SkSLTest; it renders a pixel, reads it back, and fails the test
if the result isn't solid green (RGBA=0101).

This CL doesn't implement every feature. Some obvious gaps include:
- Sampling from children
- Uniforms/inputs of any kind
- Function calls of any kind

Change-Id: Ib80c23fe1ba4453f7c3cb43b65f93c5ea0deb709
Bug: skia:11854
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/396757
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-04-20 19:28:36 +00:00
John Stiles
49b409e680 Simplify for init-stmts at the IR level.
Most backends don't like init-stmts with multiple VarDeclarations inside
them, so we no longer emit IR that does this. This lets us avoid doing
backend-level fixups.

Change-Id: Ide839de18953a73e0f9c7a690df59a7bc3523f89
Bug: skia:11860
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/398221
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2021-04-20 14:38:36 +00:00
Julia Lavrova
b40c925b82 Removing the staging flag for Google3 (SK_PARAGRAPH_ROUND_POSITION)
Change-Id: I45ff82fb1e6083c90248b174b8d088d91be75825
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/398216
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2021-04-19 19:01:54 +00:00
John Stiles
8e2a84be3d Fix for fuzzer-discovered error in SPIR-V compilation.
Unused InterfaceBlocks were not added to the ProgramUsage map. The
ProgramUsageVisitor now makes sure to account for them during its
initial scan.

Change-Id: If3afac8e954c5b685ddc6b63b0f771d8c0b8f207
Bug: oss-fuzz:33405
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/398016
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-04-19 15:55:04 +00:00
Ethan Nicholas
624a529fbd Added an API for creating RuntimeEffects using the SkSL DSL.
Change-Id: I305016d305455e2b90fe904d8da93cf7735cc38e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/389316
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2021-04-16 19:36:54 +00:00
Kevin Lubick
e2b457ad5f Fix CMakeLists to find Emscripten headers
Change-Id: I02fa871eecd4dc3e24c47d4ad0d9bd16c1d59fda
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/397462
Auto-Submit: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2021-04-16 16:45:22 +00:00
Herb Derby
e90a295f6c fix SkCanvas::drawGlyphs's bounds calculation
Change-Id: I9aea1f516ccb362cf28684de571bdd6971dd6f6c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/397478
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2021-04-16 16:34:33 +00:00
Brian Osman
102d6e5a63 Add test case for sample() with color and various forms of coords
Demonstrates a bug that was introduced here:
  https://skia-review.googlesource.com/c/skia/+/396021

Bug: skia:11867
Change-Id: Iaa6521bdeb4c05b0b91f4df43505e9983106f964
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/397148
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-04-15 20:34:42 +00:00
Brian Osman
cbb60bd0b0 Add runtime color filter and shader modes to the SkSL compiler
These enforce stricter rules about the signature of main, and each one
uses a separate pre-include module. That prevents color filters from
being able to reference sk_FragCoord (or coords passed to main) at all.
It also limits the versions of sample() that are exposed.

In the new world, an effect created for a specific stage of the Skia
pipeline can only be used to create instances of that stage (SkShader or
SkColorFilter). For now, SkRuntimeEffect::Make uses kRuntimeEffect,
which continues to be more lenient and allow creation of either shaders
or color filters from a single effect. After we migrate all clients, we
can deprecate and then delete that mode.

Bug: skia:11813
Change-Id: I0afd79a72beeec84da42c86146e8fcd8d0e4c09f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/395716
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-04-15 13:30:59 +00:00
John Stiles
c5d860877e Add unit test for for-loop with multiple variables.
We lacked test coverage for this case, and this was broken when compound
VarDeclarations were split from one Statement into several.

Change-Id: I561b4d8acc0bfa01161d873a0c022ec58e316903
Bug: skia:11860
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/396817
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-04-14 20:23:35 +00:00
Brian Salomon
354147a23c Replace GrConstColorProcessor with a runtime FP
Change-Id: Ie36ea4d5186f6cca341efc6300b813ec8255bdbb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/388457
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2021-04-14 18:40:18 +00:00
John Stiles
0a0a50ae97 Use .dsl.cpp suffix for DSL C++ instead of _dsl.cpp.
This requires the GN processing to be slightly more complex, as GN has
no native support for more than one extension on a file.
Context: https://groups.google.com/a/chromium.org/g/gn-dev/c/RdEpjeYtb-4

Change-Id: I630511fca9eb291f0e414481ef439f18a8e1b72f
Bug: skia:11854
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/396197
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2021-04-14 13:49:53 +00:00
John Stiles
82ab3409f7 Fork CPPCodeGenerator into a DSL-based version.
The long term goal is for the DSLCPPCodeGenerator to replace the
CPPCodeGenerator entirely, but we will need both to coexist while DSL is
still under development.

Currently, the DSLCPPCodeGenerator is cloned from CPPCodeGenerator and
emits almost exactly the same code (it adds a comment at the top to
distinguish its output). Its output will change in followup CLs.

This CL also allows skslc to recognize the `_dsl.cpp` output suffix and
generate code using DSLCPPCodeGenerator instead of CPPCodeGenerator.
This allows test DSL FPs to be created for inspection.

Change-Id: If5136279c307ea53a9df3a292caa18344c1eb259
Bug: skia:11854
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/396096
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-04-13 22:01:09 +00:00
John Stiles
3738ef531b Move code generators to codegen/ directory.
We are up to having seven distinct types of codegen, and will soon have
an 8th (DSL C++).

Change-Id: I6758328390c234ba1d5c30c118199dbc820af52a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/395817
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2021-04-13 15:34:24 +00:00
John Stiles
7134646ebd Migrate SkSLExternalFunction to the ir/ directory.
Change-Id: I8ca4fbba551624c61a4ebe7a4716750fe0b48196
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/395818
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-04-13 14:17:16 +00:00
Mike Reed
e58231ae8f Removed unused SkInterpolator
Bug: skia:11852
Change-Id: I7a9eb2e0594bc1bdf6e7ba5355b6f00cc177253f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/395476
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2021-04-13 00:50:11 +00:00
Brian Osman
962e6140ac Add ivec GLSL type aliases to runtime effects
Also add unit test of all GLSL type aliases.

Bug: skia:10679
Change-Id: I93e21621c11adfe3f114d0c55fb8043518e62696
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/395718
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-04-12 16:55:41 +00:00
John Stiles
d02615698e Fix assertion when performing type-coercion with enums.
In http://review.skia.org/393397, I replaced a Constructor::Convert call
with a call directly to ConstructorCompoundCast::Make.

This worked fine if the input expression was actually a compound, but
if it was not, the code would assert/crash. The fuzzer detected this
error right away. (Enums are not considered to be a scalar, a vector or
a matrix in SkSL.)

Change-Id: Ie0df4c5771ff4f4d8f5251d4703e9c3516b6baad
Bug: oss-fuzz:33113
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/395720
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-04-12 16:40:31 +00:00
Ethan Nicholas
ee49efcc91 Added DSL fragmentProcessor and Sample function
Change-Id: I76348d151fbf27454a6f60e4f5f7e1774731e61b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/395216
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2021-04-12 14:29:51 +00:00
John Stiles
f2c2d3020e Migrate PersistentCacheUtils logic into a cpp file.
This code is not performance-sensitive, and there doesn't seem to be any
benefit to making it header-only.

Change-Id: Ic83be5cbb96f08c18a144954be7453aaabaa5a72
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/394900
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-04-12 14:09:59 +00:00
John Stiles
97186dc957 Fix various fuzzer-generated tests.
Two of the tests are now (correctly) detected as invalid code, but were
previously checked into /shared/ because they compiled when the fuzzer
first reported them (that is, after the crash was fixed). These have
been moved into the /errors/ test folder.

One of the tests was only generating an error because its main function
was named `a` instead of `main`, so I renamed it to `main`.

Change-Id: I1a2346fb16e304b0c66ff377a3f9bf7e7ee89ba9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/394899
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-04-12 13:44:59 +00:00
John Stiles
d3a1df8da7 Remove sk_Height and sk_Width.
These builtins have been obsolete for a long time; they were only
implemented on the GLSL backend. These values are provided in
u_skRTHeight and u_skRTWidth instead. (See GrGLSLProgramBuilder's
addRTHeightUniform and addRTWidthUniform.)

Change-Id: I8cceca348cbf9071939618f913693c316d35dbc6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/395001
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-04-09 21:01:27 +00:00
Herb Derby
e4454aaf23 update gn_to_cmake's minimim required cmake version
Change-Id: I86f157b8d5885f1bf4cc013fc8e58d64dc1ba66e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/395096
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2021-04-09 17:38:27 +00:00
John Stiles
3509210622 Implement array == and != on SPIR-V.
GLSL (post-ES2) allows array comparison: http://screen/8gryPvb9T7gndyb

Unfortunately, because ES2 does not support array comparisons, we can't
add this test to the dm test suite.

Change-Id: I06b71683e49b2631669cff801dc647951a81a299
Bug: skia:11849
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/394162
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-04-09 15:33:57 +00:00
John Stiles
781496ffe5 Add unit test for array of zero or negative size.
Change-Id: Icc710e414388e4026a5e9819a53b8dac8ee0a2d1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/394896
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-04-09 14:38:47 +00:00
John Stiles
d47330feed Add support for struct constructors to SkSL.
This is allowed in OpenGL ES2, and its absence in SkSL has been a pain
point for new users adopting Runtime Effects.

Change-Id: Id2ed78261a2cd2b14b49ad22cb74cdc9e0905f8a
Bug: skia:11368
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/393418
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-04-09 13:54:16 +00:00
John Stiles
8cad6374f0 Rename composite constructors to compound constructors.
Change-Id: Ic1f5d28651e8de9d9ecea2a0bcfa73063dd90a9d
Bug: skia:11032
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/393337
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2021-04-07 19:13:20 +00:00
John Stiles
268a73f9e8 Represent matrix casts with CompositeCast type.
Vector and matrix typecasting is mechanically very similar, so it makes
sense to represent these with a single constructor type and paper over
the tiny differences in each backend. (SPIR-V in particular needs a
separate path for matrix casting versus vector casting.)

Change-Id: Id9ea7ca6297e69b3e813c69bfdc56073b50d8d89
Bug: skia:11032
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/393216
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2021-04-07 19:08:10 +00:00
John Stiles
2bec8ab55b Represent vector/matrix composition with the ConstructorComposite type.
ConstructorComposite is a slight rework of ConstructorVector;
mechanically, both vector and matrix composition behave the same and
can share the same logic.

The generated code in SPIR-V and Metal still has some tweaks due to
different handling for matrices in these languages, but the SkSL
internal model mimics GLSL's view that vectors and matrices can be
created by lumping together any mix of scalars and vectors.
The backends will continue to adapt this model to their reality.

Change-Id: Ia2781c8a9dd3b4ba55ef93e33ac252eaeec844ac
Bug: skia:11032
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/393178
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-04-07 13:24:08 +00:00
John Stiles
d986f476ae Represent vector construction with ConstructorVector.
This constructor aggregates scalars and smaller vectors together into
one vector. It is not responsible for splats or typecasts; those are
handled in separate classes which were added previously.

Change-Id: I9194bec50d58d94c331e0bb883686e26b86af347
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/392816
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-04-06 20:44:46 +00:00
Brian Osman
601abfacc7 Move 'shader' usage tests to an SkSL golden file
Also adds tests of non-uniform shader declarations. These are currently
allowed, but will be detected as an error in the next CL.

Bug: skia:11374
Change-Id: I3fee0a0c97ae590f7bc6952cb367f7e94436b891
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/393080
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-04-06 19:20:16 +00:00
John Stiles
5abb9e1426 Represent matrix resizes as a dedicated expression type.
This shook out a long-standing bug; constant folding would treat a
matrix resize as if the cells not covered by the original matrix were
all zero. This is wrong; GLSL populates the unknown cells with an
identity matrix. We actually tested for the wrong behavior, so the tests
were updated to match the correct behavior, and an equivalent test was
added that does not constant-fold (to verify that our constant folder
matches reality).

Change-Id: I03df10ce646fbef0a36e9c1a841a7637182de122
Bug: skia:11032
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/392916
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-04-06 18:35:06 +00:00
John Stiles
0a12b85f16 Add regression test for oss-fuzz finding.
The actual fix happened at prior CL http://review.skia.org/392197, which
reworked how vector-cast constructors function.

Change-Id: Ifb71ec913b349e65d38458dc615441e7a73efddc
Bug: oss-fuzz:32851
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/392841
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-04-05 19:39:16 +00:00
Julia Lavrova
db10b0e802 Float error and positioning
(Hiding the fix from Flutter for now because we need to test it in
Google3 first)

Bug: skia:11100
Change-Id: I51fa37ee16a48de6a636dc857d5ae8650327922f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/391197
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2021-04-05 19:00:46 +00:00
John Stiles
b14a819122 Represent vector-cast constructors with ConstructorVectorCast.
Making a VectorCast from a compile-time constant will perform the cast
at compile-time instead; previously, we did not apply this optimization.
This simplified a few test outputs in subtle ways. (In particular, the
SPIR-V codegen used to occasionally decorate OpConstantComposite of
constant numbers with RelaxedPrecision, and no longer appears to do
this. This should have no effect on results either way AFAICS.)

Because we don't return VectorCast constructors containing compile-time
constant values, we do not need to implement compareConstant for this
constructor; they only wrap non-compile-time-constant expressions.

Change-Id: I28c1f337f64d6f20fb86bc0f58e225af4bd7b26c
Bug: skia:11032
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/392197
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-04-05 16:28:06 +00:00
John Stiles
fd7252fa23 Represent scalar-cast constructors with ConstructorScalarCast.
Change-Id: Iff8477f3797c83059c823ca9287493b7f30db71b
Bug: skia:11032
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/392438
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-04-05 14:16:26 +00:00
Brian Osman
1f56479d6e Add test using 'fragmentProcessor' in runtime effects
Allowed today, will soon be an error.

Bug: skia:11813
Change-Id: I5c13de7657fa85f13fa6d80e1d890225d8a3e868
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/392439
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-04-05 14:02:16 +00:00
John Stiles
2938eea68c Represent splat constructors with a dedicated ConstructorSplat class.
Change-Id: Ic9c3d688b571591d057ab6a4e998f1f9712a1b58
Bug: skia:11032
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/392117
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-04-02 13:14:05 +00:00
John Stiles
7384b37576 Represent array constructors with a dedicated ConstructorArray class.
Change-Id: Ia8c8a3476202257ecc100f9cb31e6d0095135aa1
Bug: skia:11032
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/391919
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-04-01 18:52:43 +00:00
John Stiles
e1182785be Create a diagonal-matrix Constructor class.
This constructor takes a single argument and splats it diagonally across
an otherwise-zero matrix. These are also sometimes referred to as a
uniform-scale matrix.

Change-Id: I1ed8140f55f5cad4029015807b220d6475401daa
Bug: skia:11032
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/390716
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-03-31 18:00:42 +00:00
Chris Dalton
8ed7a8d1c6 Extract a GrVertexChunkArray class with a builder
This will be used by the new stroke tessellator. All the other
tessellators should start chopping and chunking too. That will allow us
to quit cropping paths if we are afraid they might need more segments
than are supported.

Bug: chromium:1172543
Change-Id: I30f0ebb581f56cac099d8c05e0e181c4657c3db8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/390096
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-03-31 17:27:52 +00:00
John Stiles
8037c9e2ed Add test for folding of == and != for arrays.
We don't directly support this today at all. In practice, though, simple
constant arrays are detected as equal in the constant-folding pass
because they hit the `x == x` self-equality check (using
`IsSameExpressionTree`).

This does not work for our inequality tests, though, so those do not
fold.

Change-Id: I6730a9a2d1da9ac613ee58889d651f3ff65b1d2d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/391057
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-03-31 15:32:03 +00:00
Chris Dalton
9b5b7db793 Move GrStrokeTessellator into its own header file
Simple refactor to make things reusable for the next non-hardware stroke
tessellator.

Change-Id: I0898b54a616e60f0475ac74cbd6f518e8696e0e5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/390078
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-03-30 18:00:16 +00:00
Ben Wagner
7d8cdd5b7f Remove use of std::result_of.
std::result_of is deprecated and removed in C++20, std::invoke_result is
in C++17 the library so not ready yet.

In the case of SkMakeArray there is no need for the full power of
std::invoke_result as SFINAE is not needed, nor is calling a method
supported. As a result a simple decltype is sufficient.

Bug: skia:11811
Change-Id: I6c07c380970cc2a991ab8bd457997320ba634e6c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/390476
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2021-03-30 16:57:45 +00:00
Adlai Holler
194b239e09 Reland "Use objc_externally_retained to cut down retain/release in Metal"
This reverts commit 8b6788079f.

Reason for revert: Fixed variable type for chrome & flutter

Basically, you can't use objc_externally_retained with `auto` type
variables because the compiler isn't smart enough to deduce the type
before checking that it's compatible with the attribute.

Original change's description:
> Revert "Use objc_externally_retained to cut down retain/release in Metal"
>
> This reverts commit 78381ee5e0.
>
> Reason for revert: breaking chromium and flutter mac builds
>
> Original change's description:
> > Use objc_externally_retained to cut down retain/release in Metal
> >
> > Until we get off of ARC, these extra retains and releases can really
> > add up in previous profiling of Metal, especially on iOS.
> >
> > Change-Id: Ib3aaa0b863c4469bdb6ad930395a170719c0293d
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/381110
> > Commit-Queue: Adlai Holler <adlai@google.com>
> > Reviewed-by: Jim Van Verth <jvanverth@google.com>
> > Reviewed-by: Brian Salomon <bsalomon@google.com>
>
> TBR=jvanverth@google.com,bsalomon@google.com,adlai@google.com
>
> Change-Id: I36aff7698a70052a42b91a910b92fd512b3eecd4
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/388717
> Reviewed-by: Michael Ludwig <michaelludwig@google.com>
> Commit-Queue: Michael Ludwig <michaelludwig@google.com>


Change-Id: I5cad02fc9d8c7f21e22021858b2e6e9b038a3de6
Cq-Include-Trybots: luci.skia.skia.primary:Canary-Flutter
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/389157
Commit-Queue: Adlai Holler <adlai@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
2021-03-30 14:43:15 +00:00
Jim Van Verth
7b41798fd6 Add GrD3DPipeline.
This allows me to separate the wrapper around the ID3D12PipelineState
from the other data we track with GrD3DPipelineState. In this way I can
create a GrD3DPipeline directly for compute experiments without worrying
about managing graphics-specific objects. In the long run, we'll
probably need GrD3DGraphicsPipelineState and GrD3DComputePipelineState.

Change-Id: I36ff90a93b6e53fae217aaca3f6e0e76d698aa57
Bug: skia:10446
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/389896
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2021-03-29 21:50:14 +00:00
John Stiles
fabed8bb79 Fix fuzzer-discovered error with variable declarations.
As soon as a single VarDeclaration is successfully created, its Variable
is added to the current symbol table. However, if a variable-declaration
line declared several variables in a row, we would stop if ANY of the
declarations contained an error and discard the entire statement, but
would continue processing the rest of the program. This left us in a
position where some Variables existed in the SymbolTable with valid,
reachable names, but their corresponding VarDeclaration statement had
been thrown away as erroneous. Since Variables point back to
VarDeclarations for their initialValues, this gave us a stale pointer.
Any future reference to that variable name which could trigger an
access to its initialValue would read from this dead pointer.

This CL fixes the conversion of VarDeclarations so that we no longer
throw away any VarDeclarations associated with a successfully-parsed
Variable.

Change-Id: If8ec3c160933e48a0e1f36414234b3a849d8978c
Bug: oss-fuzz:32587
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/389636
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-03-29 14:35:09 +00:00
John Stiles
2febb5b423 Add SkSL test for vector-scalar math.
We had constant-folding tests for vector-scalar arithmetic, but didn't
have an equivalent SkSL unit test for vector-scalar arithmetic that
actually needs to be computed at runtime.

This exposes two SPIR-V bugs: one was previously known, but the other
is a new discovery.

Change-Id: I28737128f20b445797c6c29872335d05f94cc95c
Bug: skia:11267, skia:11788
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/388739
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2021-03-25 23:30:34 +00:00
Michael Ludwig
8b6788079f Revert "Use objc_externally_retained to cut down retain/release in Metal"
This reverts commit 78381ee5e0.

Reason for revert: breaking chromium and flutter mac builds

Original change's description:
> Use objc_externally_retained to cut down retain/release in Metal
>
> Until we get off of ARC, these extra retains and releases can really
> add up in previous profiling of Metal, especially on iOS.
>
> Change-Id: Ib3aaa0b863c4469bdb6ad930395a170719c0293d
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/381110
> Commit-Queue: Adlai Holler <adlai@google.com>
> Reviewed-by: Jim Van Verth <jvanverth@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>

TBR=jvanverth@google.com,bsalomon@google.com,adlai@google.com

Change-Id: I36aff7698a70052a42b91a910b92fd512b3eecd4
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/388717
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2021-03-24 19:06:05 +00:00
Adlai Holler
78381ee5e0 Use objc_externally_retained to cut down retain/release in Metal
Until we get off of ARC, these extra retains and releases can really
add up in previous profiling of Metal, especially on iOS.

Change-Id: Ib3aaa0b863c4469bdb6ad930395a170719c0293d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/381110
Commit-Queue: Adlai Holler <adlai@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2021-03-24 16:32:42 +00:00
Brian Salomon
5ca24f94ab Reland "Reland "Add GrRuntimeFPBuilder""
This is a reland of 7508b54af3

Original change's description:
> Reland "Add GrRuntimeFPBuilder"
>
> This is a reland of 4b39aaf2cb
>
> Original change's description:
> > Add GrRuntimeFPBuilder
> >
> > Like SkRuntimeShaderBuilder but for internal use for creating FPs.
> >
> > Currently it requires that the code be a static string so it can
> > easily make a static SkRuntimeEffect instance for each effect.
> >
> > Bug: skia:11771
> >
> > Change-Id: I18148eb33e7d28c804e4a13bcef88c89c06b2c9b
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/386889
> > Commit-Queue: Brian Salomon <bsalomon@google.com>
> > Reviewed-by: Brian Osman <brianosman@google.com>
>
> Bug: skia:11771
> Cq-Include-Trybots: luci.skia.skia.primary:Build-Debian10-GCC-x86_64-Release-Shared_Docker,Build-Win-Clang-x86_64-Release-Shared,Build-Win-MSVC-x86_64-Release-Shared
> Change-Id: I10a7974aa209f9cd63a5dc1ef21a36822b49bda3
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/388097
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>

Bug: skia:11771
Change-Id: Id20797ecf5b34847fdc22e28d3e68db88f2519c3
Cq-Include-Trybots: luci.skia.skia.primary:Canary-Android
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/388458
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2021-03-24 16:11:42 +00:00
John Stiles
85749c0b22 Add caps bit for RewriteMatrixVectorMultiply.
On ARM GPUs, the Vulkan driver does not honor relaxed precision when
evaluating SpvOpMatrixTimesVector. This leads to reduced performance
(compared to GLSL, where mediump matrices and floats do evaluate all
intermediate values at mediump).

This caps bit will be enabled on ARM GPUs and, in a followup CL, will
be used to toggle a workaround where `m*v` is rewritten as the sum of
(m[0]*v[0] + m[1]*v[1] + ... + m[N]*v[N]).

Change-Id: I310fa73639b6498552c9672e76860f2eded15d0a
Bug: skia:11769
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/388459
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-03-23 22:40:02 +00:00
Brian Salomon
bb0ed8e487 Revert "Reland "Add GrRuntimeFPBuilder""
This reverts commit 7508b54af3.

Reason for revert: android roll

Original change's description:
> Reland "Add GrRuntimeFPBuilder"
>
> This is a reland of 4b39aaf2cb
>
> Original change's description:
> > Add GrRuntimeFPBuilder
> >
> > Like SkRuntimeShaderBuilder but for internal use for creating FPs.
> >
> > Currently it requires that the code be a static string so it can
> > easily make a static SkRuntimeEffect instance for each effect.
> >
> > Bug: skia:11771
> >
> > Change-Id: I18148eb33e7d28c804e4a13bcef88c89c06b2c9b
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/386889
> > Commit-Queue: Brian Salomon <bsalomon@google.com>
> > Reviewed-by: Brian Osman <brianosman@google.com>
>
> Bug: skia:11771
> Change-Id: I10a7974aa209f9cd63a5dc1ef21a36822b49bda3
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/388097
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>

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

Change-Id: I01a1567edd4162f1054137886052f5065a9e6175
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:11771
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/388397
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2021-03-23 18:11:47 +00:00
Brian Osman
d1f3b97a64 Remove sk_SampleMask support from SkSL
Change-Id: I22837a4921238749664217e595d24d196503534d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/388096
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-03-23 14:37:28 +00:00
Robert Phillips
f10535f6fa Fuse GrGLSLPrimitiveProcessor and GrGLSLGeometryProcessor ...
into a new GrGLSLGeometryProcessor. Since NVPR is no more this
distinction (between GLSL- Primitive and Geometry -Processor)
probably isn't needed/useful.

Bug: skia:11760
Change-Id: I75621725bd2b0ef3dbac2ea6449bd571551babab
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/388036
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-03-23 14:30:18 +00:00
Brian Salomon
7508b54af3 Reland "Add GrRuntimeFPBuilder"
This is a reland of 4b39aaf2cb

Original change's description:
> Add GrRuntimeFPBuilder
>
> Like SkRuntimeShaderBuilder but for internal use for creating FPs.
>
> Currently it requires that the code be a static string so it can
> easily make a static SkRuntimeEffect instance for each effect.
>
> Bug: skia:11771
>
> Change-Id: I18148eb33e7d28c804e4a13bcef88c89c06b2c9b
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/386889
> Commit-Queue: Brian Salomon <bsalomon@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>

Bug: skia:11771
Cq-Include-Trybots: luci.skia.skia.primary:Build-Debian10-GCC-x86_64-Release-Shared_Docker,Build-Win-Clang-x86_64-Release-Shared,Build-Win-MSVC-x86_64-Release-Shared
Change-Id: I10a7974aa209f9cd63a5dc1ef21a36822b49bda3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/388097
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2021-03-23 14:08:48 +00:00
John Stiles
1b843bdcb7 Fix up outdated tests.
Removed error tests which no longer test anything:
- UseWithoutInitialize...: we no longer track variable use-before-init.
- InlineDivideByZero: we no longer constant-fold the result of an
  inlined function call into its parent statement.
- Unreachable: we no longer report unreachable statements.

And fixed some minor test-case issues:
- StaticSwitchConditionalBreak: we still check this, but the function
  was being dead-stripped before this check could run. Renamed to main.
- OssFuzzXxxxx: these cases no longer report errors, but they are still
  valuable as regression tests; moved to `shared/`.

Change-Id: Iade3cff821dc998cacfd02f62d3ac4625e48904c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/387820
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-03-22 21:11:47 +00:00
Robert Phillips
787fd9d80a Fuse GrPrimitiveProcessor & GrGeometryProcessor into a new GrGeometryProcessor
With the removal of NVPR we no longer need this distinction.

Bug: skia:11760
Change-Id: I225a4feb764395fb72aca3ffc8b6d05396bf0b1e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/386890
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2021-03-22 19:44:40 +00:00
Brian Salomon
50af8c2656 Revert "Add GrRuntimeFPBuilder"
This reverts commit 4b39aaf2cb.

Reason for revert: DLL fail

Original change's description:
> Add GrRuntimeFPBuilder
>
> Like SkRuntimeShaderBuilder but for internal use for creating FPs.
>
> Currently it requires that the code be a static string so it can
> easily make a static SkRuntimeEffect instance for each effect.
>
> Bug: skia:11771
>
> Change-Id: I18148eb33e7d28c804e4a13bcef88c89c06b2c9b
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/386889
> Commit-Queue: Brian Salomon <bsalomon@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>

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

Change-Id: I13e22674a1bcb07b86342189bab84fc6cbb357e9
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:11771
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/387817
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2021-03-22 18:24:18 +00:00
Ben Wagner
72513e7ff6 Correct Android.bp warnings.
The gn_to_bp.py script generates projects with is_official_build=true.
This means that gn/skia:warnings is not applied. This means that a
number of warnings are not turned on, but it also means a number of
warnings are not turned off. Directly suppress several warnings which
were previously always suppressed.

Change-Id: Iefe48f663d47e39f36e21f2200417a33b2389508
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/387836
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Leon Scroggins <scroggo@google.com>
2021-03-22 18:09:06 +00:00
Robert Phillips
22970175f7 Remove sample locations usage from GL backend
Bug: skia:8921

Change-Id: If9e65a78f9e1fddb5c5ad5afa5612294935122e5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/386837
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-03-22 18:00:06 +00:00
John Stiles
ece1d794b9 Mangle function names in GLSL.
This will be implemented in Metal and SPIR-V in followup CLs.

Change-Id: I397b4db40b15dd54cf1d8a17f414c3fe184b48d2
Bug: skia:10851
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/387638
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-03-22 17:18:26 +00:00
Brian Salomon
4b39aaf2cb Add GrRuntimeFPBuilder
Like SkRuntimeShaderBuilder but for internal use for creating FPs.

Currently it requires that the code be a static string so it can
easily make a static SkRuntimeEffect instance for each effect.

Bug: skia:11771

Change-Id: I18148eb33e7d28c804e4a13bcef88c89c06b2c9b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/386889
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-03-22 15:57:36 +00:00
Ben Wagner
3d9ab7e7ec Separate general defaults from Skia defaults
In the build there are some defaults which actually apply to every
use of a built-in target type, but there are some (particularaly
warnings) which apply only to targets controlled by Skia. Currently
these unwanted defaults are magically known to exist and removed
wherever they are not wanted. Instead, create 'skia_' prefixed target
templates and apply these defaults to those instead.

Change-Id: I3a2afb53c7205a2e2748d1cfad46319f2e93d3b3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/385516
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2021-03-22 15:30:56 +00:00
John Stiles
e67bd1371e Migrate VarDeclaration conversion out of IRGenerator.
Change-Id: If5fb4f99d327bb429f60e8d6c526720dd02b0928
Bug: skia:11342
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/386800
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-03-22 14:25:26 +00:00
John Stiles
cd7ba500b6 Migrate FunctionCall conversion out of IRGenerator.
We don't currently do FunctionCall optimization, but implementing
something along the lines of skia:10835 would probably involve doing
rewrites for optimization in FunctionCall::Make. This CL is the first
step down that road.

Change-Id: I249b02412e7ebac21bb98d6c5d61af3dcd6f1e69
Bug: skia:11342
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/387156
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-03-19 15:47:21 +00:00
Robert Phillips
31798c2796 Remove NVPR
Bug: skia:11760
Change-Id: Ie0fc1aaa3120b37b1d452fdc9a8b5cb91b6ffe1e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/386559
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-03-19 12:26:38 +00:00
Tyler Denniston
333b938c95 Reland "Add SVG to default modules list"
This is a reland of 579728eb19

Original change's description:
> Add SVG to default modules list
>
> This enables SVG to build in official builds.
>
> Change-Id: I4f64109983216baf9663061e23cc3757292ff448
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/386096
> Reviewed-by: Florin Malita <fmalita@google.com>
> Commit-Queue: Tyler Denniston <tdenniston@google.com>

Change-Id: I8bb93f3881e69f7b4461981a4f0f95a87fed0976
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/386557
Reviewed-by: Florin Malita <fmalita@google.com>
Commit-Queue: Tyler Denniston <tdenniston@google.com>
2021-03-18 18:37:56 +00:00
Mike Reed
fc32405ff2 Revert "Revert "Add bench for skparagraph""
Fix: check for successful fParagraph creation

This reverts commit ead52dc068.

Change-Id: Id122877935affaaa33ac791e6c5b69c571267adf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/385879
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2021-03-17 18:05:10 +00:00
Ethan Nicholas
e0707b7075 No longer passing the results of OpAccessChain to function calls
It turns out it is not legal to pass the results of OpAccessChain as a
function argument, for... reasons. This CL switches us over to passing
the argument via a temp variable instead.

Bug: skia:11748
Change-Id: Ib5e86c1d000655ebd7bb62ceea6a27b823808645
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/385936
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2021-03-17 16:37:00 +00:00
John Stiles
dc20847579 Disallow inlining functions containing early returns.
This allows us to remove 100 LOC from the inliner and is very unlikely
to affect any existing benchmark. We don't have any evidence to support
the idea that a one-iteration `for` loop with `continue`-based exits
will be any faster than a standard function call on any existing GPU.
Our fragment processors are generally written to avoid early returns,
in large part to avoid hitting this path.

This drastically impacts BlendEnum.sksl (which can no longer flatten out
a switch over every blend function in SkSL) but is otherwise a wash.

See: http://go/optimization-in-sksl-inliner suggestion 4(a)

Change-Id: I1f9c27bcd7a8de46cc4e8d0b9768d75957cf1c50
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/385377
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2021-03-17 16:29:00 +00:00
Mike Reed
ead52dc068 Revert "Add bench for skparagraph"
This reverts commit 1aa25c3217.

Reason for revert: crashing on windows bots

Original change's description:
> Add bench for skparagraph
>
> Change-Id: Ib33e06527660b33984b9171f51026a935ef99f79
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/385156
> Reviewed-by: Julia Lavrova <jlavrova@google.com>
> Commit-Queue: Mike Reed <reed@google.com>

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

Change-Id: I7b8524c449f3c484b777af31f83e1372a689de55
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/385163
Reviewed-by: Mike Reed <reed@google.com>
2021-03-15 22:55:40 +00:00
Mike Reed
1aa25c3217 Add bench for skparagraph
Change-Id: Ib33e06527660b33984b9171f51026a935ef99f79
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/385156
Reviewed-by: Julia Lavrova <jlavrova@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2021-03-15 22:32:16 +00:00
John Stiles
bf16b6c5df Add Make factory function to Block.
Block::Make always makes a real Block object. This is important because
many callers rely on Blocks specifically; e.g. a function body must be a
scoped Block, nothing else will do.

However, unscoped Blocks are just a collection of Statements and usually
have more flexibility. So, Block::MakeUnscoped is a factory function
that will return the Statement as-is for a single-statement unscoped
Block. For an entirely empty Block, MakeUnscoped returns Nop.

Change-Id: Ied65d505bde4ea7f6157a039944018546e4b7333
Bug: skia:11342
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/384180
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2021-03-13 13:28:17 +00:00
Ethan Nicholas
2f4652f309 Revert "Fixed a number of spots where we should have been using RelaxedPrecision"
This reverts commit a04692f69e.

Reason for revert: Angry Vulkan bots.

Original change's description:
> Fixed a number of spots where we should have been using RelaxedPrecision
>
> Our SPIR-V output was missing many RelaxedPrecision decorations, which
> was presumably impacting performance.
>
> Change-Id: Iee32d4a42f37af167fe0e45f3db94c2142129695
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/384178
> Reviewed-by: Brian Osman <brianosman@google.com>
> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>

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

Change-Id: If4fe945cb363c9b61b5a4abfde649a437689d2eb
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/384217
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2021-03-12 18:48:57 +00:00
Ethan Nicholas
a04692f69e Fixed a number of spots where we should have been using RelaxedPrecision
Our SPIR-V output was missing many RelaxedPrecision decorations, which
was presumably impacting performance.

Change-Id: Iee32d4a42f37af167fe0e45f3db94c2142129695
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/384178
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2021-03-12 18:00:56 +00:00
Chris Dalton
7d592cda58 Delete all low-level rendering from ccpr
This converts ccpr to just a poorly named atlas manager. The atlas
gets rendered by normal calls on its MSAA draw context:

  for (;;) {
      surfaceDrawContext->stencilPath();  // Stencil.
  }
  surfaceDrawContext->stencilRect(atlasBounds);  // Cover.

Bug: chromium:1158093
Change-Id: I758ffd372b2ed5bb8b370156b6f80f6204146700
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/381618
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2021-03-12 17:02:56 +00:00
Chris Dalton
03730e6ca6 Delete path caching and path rendering from ccpr
All that's left is a clip atlas renderer.

Bug: chromium:1158093
Change-Id: I8b509904a752a202ff1321e5302c41a3f57a5edb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/383741
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2021-03-12 16:02:16 +00:00
John Stiles
f3a28db703 Eliminate control-flow analysis.
We no longer derive a performance benefit from this pass in practice,
and it is a very expensive compilation step. It is also prone to fuzz-
related errors.

Doc: http://go/optimization-in-sksl

Change-Id: Ief08ffac659a8fe7fe92c92b9a5da14c9f713bc2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/381261
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-03-11 13:24:54 +00:00
Chris Dalton
2603c1fb14 Delete coverage counting backend from ccpr
This declutters the atlas generation code so there are fewer variables.
Next we will delete all the lower level rendering code and render the
atlas with stencilPath/stencilRect instead.

Bug: chromium:1158093
Change-Id: I36cff285d0f7de6f8ece4b027e62ae84aa01adc8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/380656
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-03-11 04:26:00 +00:00
John Stiles
0dd1a77e12 Add noinline keyword to SkSL.
As you might expect, a function tagged with `noinline` will never be
considered as a candidate for inlining.

Change-Id: Ia098f8974e6de251d78bb2a76cd71db8a86bc19c
Bug: skia:11362
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/382337
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2021-03-10 15:39:48 +00:00
Herb Derby
cc1cbcf9e0 Revert "Reland "cache the creation of one GrAtlasTextOp""
This reverts commit dc3d678712.

Reason for revert: Crashing on exit thread handler

Original change's description:
> Reland "cache the creation of one GrAtlasTextOp"
>
> This is a reland of 4b1fb7ca90
>
> Original change's description:
> > cache the creation of one GrAtlasTextOp
> >
> > GrAtlasTextOp has a high probability of being merged with the
> > previous op. This cache keeps using the same op to merge with
> > keeping memory warm.
> >
> > This show about 5.75% improvement in skpbench on desk_nytimes.
> >
> > When compiling for ios 9 or earlier, this optimization is
> > disabled.
> >
> > Change-Id: I13ccbef6dcd4b9d82103bf20bba7d94f3e4fb6f4
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/376718
> > Reviewed-by: Michael Ludwig <michaelludwig@google.com>
> > Reviewed-by: Brian Salomon <bsalomon@google.com>
> > Commit-Queue: Herb Derby <herb@google.com>
>
> Change-Id: I935a2965062b1fddb28806e85eb0fe055ba46ec2
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/380320
> Commit-Queue: Herb Derby <herb@google.com>
> Reviewed-by: Michael Ludwig <michaelludwig@google.com>

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

Change-Id: I3bc3329580460fcf8c0b49f655a88cb902da3d58
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/382556
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2021-03-10 04:24:09 +00:00
Herb Derby
dc3d678712 Reland "cache the creation of one GrAtlasTextOp"
This is a reland of 4b1fb7ca90

Original change's description:
> cache the creation of one GrAtlasTextOp
>
> GrAtlasTextOp has a high probability of being merged with the
> previous op. This cache keeps using the same op to merge with
> keeping memory warm.
>
> This show about 5.75% improvement in skpbench on desk_nytimes.
>
> When compiling for ios 9 or earlier, this optimization is
> disabled.
>
> Change-Id: I13ccbef6dcd4b9d82103bf20bba7d94f3e4fb6f4
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/376718
> Reviewed-by: Michael Ludwig <michaelludwig@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Herb Derby <herb@google.com>

Change-Id: I935a2965062b1fddb28806e85eb0fe055ba46ec2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/380320
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2021-03-09 23:32:00 +00:00
Brian Osman
86e85537fe Test that we propagate 'const' to the GPU backend of runtime effects
Currently, only one of three uses (local variables) does this correctly.

Bug: skia:11716
Change-Id: Iad11e8e5998fcc7caee4d438e0558c5d4e2b1821
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/382277
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-03-09 23:26:00 +00:00
Ethan Nicholas
24c1772ea4 Fixed an issue with DSL includes
It turned out that everywhere we were using or testing DSL code either
directly or indirectly imported big chunks of the SkSL library. These
imports turned out to be necessary; code written using just DSL.h would
fail with various template instantiation errors.

Change-Id: Iae72d15b0d6ef14614ac1a4ff08c36bc1876cd4d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/381638
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2021-03-09 20:07:00 +00:00
John Stiles
06d600fb9d Add Convert/Make factory functions to FieldAccess.
Change-Id: Ib1f5296c017374b833654f988ff89d11d8f78b4d
Bug: skia:11342
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/380458
Reviewed-by: Brian Osman <brianosman@google.com>
2021-03-08 17:44:17 +00:00
Chris Dalton
9ff7eef906 Rename SampleCCPRGeometry.cpp -> SampleStrokeVerb.cpp
Also removes the CCPR stuff prior to its deletion.

Change-Id: I63db69ed4a66a11a2006c82e403d89c89af153eb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/380596
Reviewed-by: Tyler Denniston <tdenniston@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2021-03-08 16:37:09 +00:00
John Stiles
51d33982ad Add Convert/Make factory functions to IndexExpression.
Change-Id: I7a7874e58bf53978afce8a41b26092406b6490ed
Bug: skia:11342
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/380360
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-03-08 15:55:59 +00:00
Julia Lavrova
4414f87fa1 Revert the workaround for missing ICU API ubrk_safeClone
Bug: skia:11315
Change-Id: Iee619517b687dc722d99e73821954cadb790d98a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/378977
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2021-03-08 15:26:25 +00:00
John Stiles
28054added Optimize ternary tests that check a const variable.
This enables the ternary to be optimized away in code like:
   const bool SHINY = true;
   color = SHINY ? add_shine(x) : x; // to --> `color = add_shine(x);`

Without constant propagation.

Also, I added a unit test for ternary expression simplification; I
wasn't able to find an existing one.

When the optimization flag is disabled, this CL actually removes the
optimization of `true ? x : y` --> `x` entirely; previously, this
substitution would be made regardless of optimization settings.

Change-Id: I93a8b9d4027902d35f8a19cfd6417170b209d056
Bug: skia:11343
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/379297
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2021-03-05 21:41:05 +00:00
Brian Salomon
d63638bb7b Copy on write for wrapped backend texture surfaces.
Makes SkImage_Gpu backed by two proxies, an original and a copy. The
image uses the original until a new render task is bound to it at which
point further uses of the image will use the copy. If the image is ever
used off a GrDirectContext we fall over to the copy. If the copy is
never used and never can be used by the next flush then the render
task that populates it is marked "skipped" and we don't perform the
copy.

Bug: skia:11208

Change-Id: Id255f4a733acc608c8a53c1a5633207aeafc404b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/366282
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-03-05 19:50:05 +00:00
Herb Derby
bf2dd2af49 Reland "rename GrSDFTOptions to GrSDFTControl"
This is a reland of 40a9061203

Original change's description:
> rename GrSDFTOptions to GrSDFTControl
>
> Change-Id: Ie03fce7a99a9f71b18d54e3cd35e7675fb7f8912
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/379616
> Commit-Queue: Herb Derby <herb@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>

Change-Id: Iba0816159a8ef99448a0040c487e56700b96be5d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/379845
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2021-03-05 15:24:35 +00:00
Mike Reed
9edff53a73 Revert "rename GrSDFTOptions to GrSDFTControl"
This reverts commit 40a9061203.

Reason for revert: breaking chrome roll (android-pie)?

Original change's description:
> rename GrSDFTOptions to GrSDFTControl
>
> Change-Id: Ie03fce7a99a9f71b18d54e3cd35e7675fb7f8912
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/379616
> Commit-Queue: Herb Derby <herb@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>

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

Change-Id: I0483cbada23c76bdd5ccdb51936bb20a819343cb
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/379839
Reviewed-by: Mike Reed <reed@google.com>
2021-03-05 11:15:22 +00:00
Mike Reed
606a9ab831 Revert "add noexcept to GrAtlasTextOp delete"
This reverts commit 6ba242d2a2.

Reason for revert: breaking chrome roll (android-pie)?

Original change's description:
> add noexcept to GrAtlasTextOp delete
>
> Change-Id: Icb2d8ce9ac75454b89342aa737d563cf45eaba3e
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/379756
> Reviewed-by: Brian Osman <brianosman@google.com>
> Commit-Queue: Herb Derby <herb@google.com>

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

Change-Id: Ib42e19110c1221157d4245233f09a18401bd4f7d
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/379838
Reviewed-by: Mike Reed <reed@google.com>
2021-03-05 11:14:44 +00:00
Herb Derby
6ba242d2a2 add noexcept to GrAtlasTextOp delete
Change-Id: Icb2d8ce9ac75454b89342aa737d563cf45eaba3e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/379756
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2021-03-04 23:55:49 +00:00
John Stiles
b3dcbb12ef Detect functions that fail to return a value, without using CFG.
This check now runs at function finalization time, before constant
propagation has occurred; this affected the "DeadIfStatement" test.

Our detection isn't smart enough to realize that a loop will run zero
times, so it treats `for` and `while` loops as always running at least
once. This isn't strictly correct, but it actually mirrors how the CFG
implementation works anyway. The only downside is that we would not flag
code like `for (i=0; i<0; ++i) { return x; }` as an error.

Change-Id: I5e43a6ee3a3993045559f0fb0646d36112543a94
Bug: skia:11377
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/379056
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-03-04 22:47:05 +00:00
Ethan Nicholas
daed2592bb Made SkSL DSL into public API
In addition to the unsurprising changes to eliminate references to
src/, we also had to tighten up some C++17-isms as they are not
permitted in public headers.

Change-Id: Ie5005a33d7a135e69fb66beca5e7a5f960dbd453
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/378496
Reviewed-by: Brian Osman <brianosman@google.com>
2021-03-04 21:03:58 +00:00
Herb Derby
40a9061203 rename GrSDFTOptions to GrSDFTControl
Change-Id: Ie03fce7a99a9f71b18d54e3cd35e7675fb7f8912
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/379616
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-03-04 19:49:10 +00:00
John Stiles
2b6ec98a82 Disallow unscoped for blocks which declare a variable.
This should be legal, and we support this, but some versions of Android
do not: http://screen/3bkQewHF3xUMn5v There's no point in allowing
these shaders to exist; they can't compile on real-world clients, and
these vardecls are borderline meaningless (as the variables being
declared aren't reachable by any other statements).

Change-Id: Ie1351933c90caee9124eeab8983364ec030b2653
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/379584
Reviewed-by: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-03-04 17:04:40 +00:00
Robert Phillips
ae67c52933 Add GrThreadSafePipelineBuilder
GrThreadSafePipelineBuilder is the generic, base object the
GrContextThreadSafeProxy will hold. Each backend will create a
backend-specific version that is shared between the direct context
and the (possibly many) utility contexts.

Right now GrThreadSafePipelineBuilder just holds the pipeline
creation stats. Relatedly only GrGLGpu::ProgramCache and
GrVkResourceProvider::PipelineStateCache currently derive from
the new class (since they are the only backends that generate
pipeline stats).

Change-Id: I58f441c5c2b870bb5970c29cba19d1775864d52e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/378320
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2021-03-03 16:44:21 +00:00
Brian Salomon
6d25f9d068 Fix downsampled blur with clamp mode.
Ensure the extra border added to the downsampled image doesn't filter in
values from outside the source bounds.

Bug: chromium:1174354
Change-Id: I6c62eeaa57ce4e5341eab24985553f87ab0df666
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/378322
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2021-03-03 14:15:31 +00:00
John Stiles
e2aec43cfc Convert IRGenerator::convertBinaryExpr to BinaryExpr::Make.
Interestingly, this reduces the size of our dehydated data
significantly, because we were storing the result type of the binary
expression explicitly. Now the result type is deduced automatically from
the left and right types by the Make call.

Change-Id: Ic6187a5c36774f5a4ed2ec579e9cd13b331832b5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/377099
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-03-01 22:01:21 +00:00
John Stiles
0c2d14a1b9 Fix fuzzer-discovered error with inlining.
In http://review.skia.org/375776, an optimization was added to the
Inliner, causing it to skip generation of unnecessary temporary
variables. The fuzzer immediately discovered a flaw in this logic: the
"unnecessary" variable was actually used in the rare case that a
function failed to actually return a value. The inliner didn't detect
this case. Of course, this isn't a valid program either, so now we
report the error and cleanly fail.

Change-Id: I1f201cfd33f45cace3be93765a4e214e43a46e69
Bug: oss-fuzz:31469, oss-fuzz:31525
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/377101
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2021-03-01 20:06:50 +00:00
John Stiles
90518f72b9 Convert IRGenerator::convertTernaryExpr to TernaryExpr::Make.
Change-Id: I3a9e8b278709485de51dca18b19f6fc7768dde51
Bug: skia:11342
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/377098
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2021-03-01 14:20:30 +00:00
John Stiles
52d3b01da8 Convert IRGenerator::convertPostfixExpr to PostfixExpr::Make.
We have no optimizations on postfix-expressions at all so this is a very
straightforward cut-and-paste.

Change-Id: I73b3bc73ad833e668306301e6d6859e44230393a
Bug: skia:11342
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/376846
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-02-26 22:34:34 +00:00
Brian Osman
a654faaf7f Add permittedLayoutFlags to checkModifiers
For now, just use this to prevent *any* layout qualifiers from appearing
on functions, or their parameters.

Bug: skia:11301
Change-Id: I05d8118c7121048c6ef49695a54e3714a8f8687e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/376796
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2021-02-26 18:38:31 +00:00
Brian Osman
7b361499c9 Align SkSL const rules more closely with GLSL
This adds Analysis::IsConstantExpression, to determine if an expression
is a constant-expression. It now expands to cover 'const' local and
global variables, because we also enforce that the initializer on those
variables is - in turn - a constant expression.

This fixes 10837 - previously you could initialize a const variable with
a non-constant expression, and we'd emit GLSL that contained that same
pattern, which would fail to compile at the driver level. That should
not be possible any longer.

Bug: skia:10679
Bug: skia:10837
Change-Id: I517820ef4da57fff45768c0b04c55aebc18d3272
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/375856
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-02-26 17:44:11 +00:00
John Stiles
bb8542f086 Fix fuzzer-discovered error with ~ prefix on literals.
The expression `~123` was making a PrefixExpression of type $intLiteral.
It should be converted to type `int` when the ~ prefix is applied.

This change also changes the output from oss-fuzz:27614. Both programs
are essentially nonsense expressions with no real behavior, so this is
fine.

Change-Id: I586be149ce95136fabee72fdd3473814d54948cf
Bug: oss-fuzz:31410
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/376620
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-02-26 17:30:26 +00:00
John Stiles
ea5822ea27 Convert IRGenerator::convertDo to DoStatement::Make.
We currently don't have any optimizations for do-statements so the
primary benefit is moving code out of IRGenerator.

Change-Id: Ibc4d1ecd87ebef572e742dfdb15821cf4ac0f047
Bug: skia:11342
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/376179
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-02-26 17:08:01 +00:00
Michael Ludwig
1f57a0f1ae Remove unnecessary SkImageFilters.cpp
After having moved all other filter factory definitions into their
per-filter implementation files, all that remained was the
MatrixTransform factory, which is just moved into the
SkMatrixImageFilter CPP file.

Bug: skia:11230
Change-Id: Ifd7f3eb58ef1d05ed6d0aef0517ca9caa01436d8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/372121
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2021-02-26 15:31:51 +00:00
John Stiles
3e5871c498 Convert make_unique<ExpressionStatement> to ExpressionStatement::Make.
This allows for elimination expression-statements with no side effects
when they are first created, rather than later on in the control-flow
optimization pass.

Change-Id: I09ec8421a3af7fa37f98b0405657198c0a24f2ac
Bug: skia:11342, skia:11319
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/376136
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2021-02-26 14:58:31 +00:00
Mike Klein
1f77cd802c always work from fBitmap in table CF
No point holding two copies of our data, an SkBitmap and fStorage array.
The GPU backend wants a bitmap, so make the CPU backend work from that.

Updating the flattened format removed the last use of SkPackBits.

Change-Id: I97f75ebe9324ec5eed37dfe6282e10d0fe08711f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/376599
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Adlai Holler <adlai@google.com>
2021-02-26 14:48:19 +00:00
Ethan Nicholas
34c7e11492 Revert "Revert "SkSL DSL now reports the C++ line numbers of errors""
This reverts commit 3a4e19da8e.

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

Change-Id: I5ae97aba2df5b9c3b3dcca8e30da4e5ce9009109
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/376117
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2021-02-26 12:19:45 +00:00
John Stiles
b321a07f16 Convert IRGenerator::convertFor to ForStatement::Make.
Since while statements are implemented in terms of a for loop, also
added ForStatement::MakeWhile() which assumes null for the init-stmt and
the next-expr.

We currently don't have any optimizations for for-statements so the
primary benefit is moving code out of IRGenerator.

Change-Id: I4b3fc3482e28b7d28065e85670a6037b511847ff
Bug: skia:11342
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/375203
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2021-02-25 22:25:50 +00:00
John Stiles
cf3059e719 Convert IRGenerator::convertIf to IfStatement::Make.
This lets the Rehydrator and Inliner benefit from static optimization
opportunities, like converting `if (false) {...}` to a Nop.

Change-Id: I70b4fceab84c50ea270dc894b0d6fe0e7e2369eb
Bug: skia:11342
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/375777
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2021-02-25 19:28:59 +00:00
Michael Ludwig
6c406b8270 Remove deprecated tile filter header
Also removes the now-empty SkImageFilters::RegisterFlattenables()
function (was public, but is private-use only, so no one should be using
it anyways).

The remainder of SkImageFilters.cpp will be cleaned up in a follow-up CL

Bug: skia:11230
Change-Id: Ibdccff70d37e78e935cadcaff2ac90384e27c990
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/372120
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-02-25 19:09:49 +00:00
Michael Ludwig
f7272690d0 Remove deprecated picture image filter header
Bug: skia:11230
Change-Id: I63cbfe31e1f2fd2aa0fe4479061f9958841c8030
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/372016
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-02-25 17:46:59 +00:00
Brian Salomon
659e71f474 Reland "Fix issues with insetting and outsetting quads."
This is a reland of 4a281dc8ee

Original change's description:
> Fix issues with insetting and outsetting quads.
>
> Need more degrees of freedom when moving 3D points to project to 2D
> points that don't fall on the projected quad edges.
>
> Need to check geometry subset in shader to avoid positive coverage in
> outset quads with nearly parallel edges.
>
> Bug: chromium:1177833
> Change-Id: I0759382d9221ba44aacd537254e08d9f2716a6af
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/372196
> Reviewed-by: Michael Ludwig <michaelludwig@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>

Bug: chromium:1177833
Change-Id: Icf2b11334489c12f30e792526093c0d4bbaca5e0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/375058
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2021-02-25 17:44:12 +00:00
Florin Malita
3a4e19da8e Revert "SkSL DSL now reports the C++ line numbers of errors"
This reverts commit 8a43a2889e.

Reason for revert: Prereq revert for https://skia-review.googlesource.com/c/skia/+/375069

Original change's description:
> SkSL DSL now reports the C++ line numbers of errors
>
> This is done a best-effort basis. Positions will only be reported in
> Clang and GCC, and may not be reported in every possible situation.
>
> Change-Id: I7efb15781546b95e667fee34e488366174bb5f36
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/374600
> Reviewed-by: John Stiles <johnstiles@google.com>
> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>

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

Change-Id: I173cb355533d6f99c9561177b68f56924fe8a98f
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/375657
Reviewed-by: Florin Malita <fmalita@google.com>
Commit-Queue: Florin Malita <fmalita@google.com>
2021-02-25 13:17:59 +00:00
Ethan Nicholas
8a43a2889e SkSL DSL now reports the C++ line numbers of errors
This is done a best-effort basis. Positions will only be reported in
Clang and GCC, and may not be reported in every possible situation.

Change-Id: I7efb15781546b95e667fee34e488366174bb5f36
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/374600
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2021-02-24 22:20:31 +00:00
Brian Osman
029851d951 Remove fragmentProcessor field access
Change-Id: Iafeb13812851271a5262730e9c0642d4469c273f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/375020
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-02-24 21:33:36 +00:00
Brian Osman
a77ed8b382 Add flags for all layout qualifiers, check for duplicates
Now, even if a qualifier has a default value, we will know that it
appeared in the text. We can use that to check for redundant qualifiers
(as is being done here), and in the IR generator to prevent any use of
certain qualifiers, depending on context. (eg, runtime effects, wrong
shader stage, on a parameter declaration, etc.)

Bug: skia:11301
Change-Id: I2cd6ad35c2b4c4d6f87ade97e80aea84dc16ee4b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/374616
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2021-02-24 16:22:26 +00:00
Michael Ludwig
47b400bf7d Rename SkPaintImageFilter to SkShaderImageFilter
Bug: skia:11230
Change-Id: I4a90191d858265e60a817aa04c3e1aacf345a7f2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/371965
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-02-24 14:52:21 +00:00
Michael Ludwig
5ef07a4097 Remove deprecated offset filter header
Bug: skia:11230
Change-Id: I509a20b1b1ffa17b125289f9619692638a13a621
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/371964
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-02-24 00:34:30 +00:00