Commit Graph

3491 Commits

Author SHA1 Message Date
John Stiles
a106472197 Reland "Disallow constructors of ES3 types in ES2 code."
This is a reland of 36f53ec7e1

Original change's description:
> Disallow constructors of ES3 types in ES2 code.
>
> The fuzzer found that we constructed TypeReferences without first
> checking for disallowed tyoes. (In fact, TypeReference creation had no
> error checking at all; it didn't even have Convert/Make functions.)
>
> Added proper Convert/Make to TypeReference, and used those calls to
> report errors or cause assertions if trying to make a TypeReference to a
> type that the program did not support.
>
> (While tracking down this bug, I added strict-ES2 type assertions to our
> constructor IR nodes as well. This helped pinpoint the error and seem
> reasonable to leave in, just in case.)
>
> Change-Id: I896b68ae9d3d9e1f30d7eba9fa594617ab851c74
> Bug: oss-fuzz:39540
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/455498
> 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>

Bug: oss-fuzz:39540
Change-Id: Id8e323c22b18726214613b6061c08873048b7c69
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/455617
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2021-10-04 17:51:00 +00:00
John Stiles
e03f1c101c Revert "Disallow constructors of ES3 types in ES2 code."
This reverts commit 36f53ec7e1.

Reason for revert: breaks DS3Types test

Original change's description:
> Disallow constructors of ES3 types in ES2 code.
>
> The fuzzer found that we constructed TypeReferences without first
> checking for disallowed tyoes. (In fact, TypeReference creation had no
> error checking at all; it didn't even have Convert/Make functions.)
>
> Added proper Convert/Make to TypeReference, and used those calls to
> report errors or cause assertions if trying to make a TypeReference to a
> type that the program did not support.
>
> (While tracking down this bug, I added strict-ES2 type assertions to our
> constructor IR nodes as well. This helped pinpoint the error and seem
> reasonable to leave in, just in case.)
>
> Change-Id: I896b68ae9d3d9e1f30d7eba9fa594617ab851c74
> Bug: oss-fuzz:39540
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/455498
> 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>

Bug: oss-fuzz:39540
Change-Id: I1dc3ccca477fcb9fe3f39cfe8af1fd54dcb18d6b
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/455616
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2021-10-04 15:36:08 +00:00
John Stiles
36f53ec7e1 Disallow constructors of ES3 types in ES2 code.
The fuzzer found that we constructed TypeReferences without first
checking for disallowed tyoes. (In fact, TypeReference creation had no
error checking at all; it didn't even have Convert/Make functions.)

Added proper Convert/Make to TypeReference, and used those calls to
report errors or cause assertions if trying to make a TypeReference to a
type that the program did not support.

(While tracking down this bug, I added strict-ES2 type assertions to our
constructor IR nodes as well. This helped pinpoint the error and seem
reasonable to leave in, just in case.)

Change-Id: I896b68ae9d3d9e1f30d7eba9fa594617ab851c74
Bug: oss-fuzz:39540
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/455498
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-10-04 15:02:24 +00:00
John Stiles
906e9eb538 Emit qualifiers in the GLSL ES-required order.
This should fix a failure in the ES2 conformance suite's "const_in_int".

Change-Id: I8b5487749291ef57712b8fe6c3949dc7c3e76883
Bug: skia:12499
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/455157
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2021-10-01 19:09:43 +00:00
John Stiles
7e947ab4b6 Reland "Mark GLSL reserved names as reserved in SkSL grammar."
This reverts commit 5f15c695f9.

Reason for revert: landed http://ag/15959743 to fix Android roll

Original change's description:
> Revert "Mark GLSL reserved names as reserved in SkSL grammar."
>
> This reverts commit 57f3fc4cde.
>
> Reason for revert: breaking Android roll
>
> Original change's description:
> > Mark GLSL reserved names as reserved in SkSL grammar.
> >
> > We now reject every reserved name in the ES2 docs as an unexpected
> > token, except for the rule that all names beginning with `gl_` are
> > reserved. (Unfortunately, sksl_frag bends the rules by directly
> > declaring a builtin variable named `gl_SecondaryFragColorEXT`.)
> >
> > Change-Id: I5dcb40b754720ca97fe3d80e2f9072beaa39fcdb
> > Bug: skia:11115
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/454737
> > Auto-Submit: John Stiles <johnstiles@google.com>
> > Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
> > Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
>
> Bug: skia:11115
> Change-Id: Ica56f48dc76ef1e52780acaf59b8ad9143637637
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/454860
> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>

Bug: skia:11115
Change-Id: I012b8d4e03be7f9c888c26d912552412529b4fb6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/455159
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2021-10-01 18:31:50 +00:00
Ethan Nicholas
5f15c695f9 Revert "Mark GLSL reserved names as reserved in SkSL grammar."
This reverts commit 57f3fc4cde.

Reason for revert: breaking Android roll

Original change's description:
> Mark GLSL reserved names as reserved in SkSL grammar.
>
> We now reject every reserved name in the ES2 docs as an unexpected
> token, except for the rule that all names beginning with `gl_` are
> reserved. (Unfortunately, sksl_frag bends the rules by directly
> declaring a builtin variable named `gl_SecondaryFragColorEXT`.)
>
> Change-Id: I5dcb40b754720ca97fe3d80e2f9072beaa39fcdb
> Bug: skia:11115
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/454737
> Auto-Submit: John Stiles <johnstiles@google.com>
> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
> Reviewed-by: Ethan Nicholas <ethannicholas@google.com>

Bug: skia:11115
Change-Id: Ica56f48dc76ef1e52780acaf59b8ad9143637637
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/454860
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2021-10-01 14:53:12 +00:00
Ethan Nicholas
1e6e919a7e Moved findAndDeclareBuiltinVariables out of IRGenerator
No functional changes, just continuing the process of moving code out
of IRGenerator in hopes of its eventual disappearance.

Change-Id: I3507b85c5493c61812869c9bae53de8af89ee129
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/453941
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2021-09-30 20:02:44 +00:00
John Stiles
57f3fc4cde Mark GLSL reserved names as reserved in SkSL grammar.
We now reject every reserved name in the ES2 docs as an unexpected
token, except for the rule that all names beginning with `gl_` are
reserved. (Unfortunately, sksl_frag bends the rules by directly
declaring a builtin variable named `gl_SecondaryFragColorEXT`.)

Change-Id: I5dcb40b754720ca97fe3d80e2f9072beaa39fcdb
Bug: skia:11115
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/454737
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2021-09-30 19:55:47 +00:00
Greg Daniel
f69f21e601 Add MtlTexture class.
Bug: skia:12466
Change-Id: I6207af8bb34ccab28265ced733e1930f42e2db8b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/454776
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2021-09-30 18:24:48 +00:00
Greg Daniel
b2d20e02e7 [graphite] Add basic Texture files.
Bug: skia:12466
Change-Id: If708d8a4bd00802e60a860215edcb64db179e573
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/454616
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
2021-09-30 15:29:50 +00:00
Ethan Nicholas
58014fa9a6 Moved SkSL intrinsics from IRGenerator to Context
Moving stuff out of IRGenerator in preparation for its eventual
deletion.

Change-Id: Ib4290158670fecbca02bc71452b9bf4691094fe3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/453943
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2021-09-29 22:15:49 +00:00
Jim Van Verth
0f833ca8ae [graphite] Add Metal trampoline.
Adds the interface between C++ and Objective-C code so we can create
the Gpu.

Bug: skia:12466
Change-Id: I0c4b5d21ddaa119c21682105dc84d75769f069f6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/453952
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2021-09-29 22:12:20 +00:00
Greg Daniel
d73cff0e2d [graphite] Add TextureInfo class.
Also adds the Mtl subclass as well

Bug: skia:12466
Change-Id: Ia3a81f33a00374a96765fde3a3442c5e13188ad1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/453719
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-09-29 16:31:27 +00:00
Robert Phillips
e19164d9f4 [graphite] Move some basic include/gpu files over to Graphite
This is mainly to make make MtlBackendContext available.

GrTypes has to go to GraphiteTypes due to a name collision with Types.h in in sktext.

Bug: skia:12466
Change-Id: If073d5540c3dbf3fbfb404808d80deab42c40aa6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/453497
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
2021-09-28 21:11:25 +00:00
Michael Ludwig
949aebff35 [graphite] Fix build for DrawPass
Bug: skia:12466
Change-Id: I2ba1f1541c273ba90032c93a92ed3770dc5b0080
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/453756
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
2021-09-28 20:38:18 +00:00
Jim Van Verth
47b6286e6e [graphite] Stub in more Metal classes
Bug: skia:12466
Change-Id: I83ebf7dbea0d67b3c121b011f62e7b729f5e5257
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/453577
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2021-09-28 17:46:28 +00:00
Ethan Nicholas
791c0d36a6 Remove ASTNode and SkSLParser
Now that DSLParser is used for everything we can get rid of this
unused code.

Change-Id: I7b586a7d7a51ac9df7d2c52baa1f525233f489b9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/443076
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-09-28 13:36:49 +00:00
Jim Van Verth
2045b981fb Graphite: Add stubs for Pipeline and PipelineDesc
Bug: skia:12466
Change-Id: Ie949a17166b3ab5c529b74a6762c8a6f8ca8052f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/453061
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2021-09-28 11:28:19 +00:00
John Stiles
085ee36d91 Delete runtime_effect_image test.
Change-Id: I1affffe2fbc2f38a99d43485ec112a4809b8cac4
Bug: skia:12482
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/453141
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-09-27 20:12:20 +00:00
John Stiles
26c93442b5 Re-re-reland "Rewrite switch statements in GLSL strict-ES2 mode."
This reverts commit 6f06bab632.

Reason for revert: glslGeneration is more trustworthy than GR_GL_VER

Original change's description:
> Revert "Re-reland "Rewrite switch statements in GLSL strict-ES2 mode."""
>
> This reverts commit 64560c7cd5.
>
> Reason for revert: Nexus5, also
>
> Original change's description:
> > Re-reland "Rewrite switch statements in GLSL strict-ES2 mode.""
> >
> > This reverts commit c4c355940c.
> >
> > Reason for revert: disabled offending tests
> >
> > Original change's description:
> > > Revert "Reland "Rewrite switch statements in GLSL strict-ES2 mode.""
> > >
> > > This reverts commit c81edd0e8c.
> > >
> > > Reason for revert: ANGLE still unhappy
> > > Original change's description:
> > > > Reland "Rewrite switch statements in GLSL strict-ES2 mode."
> > > >
> > > > This reverts commit d26d0e6a47.
> > > >
> > > > Reason for revert: uses dedicated caps bit
> > > >
> > > > Original change's description:
> > > > > Revert "Rewrite switch statements in GLSL strict-ES2 mode."
> > > > >
> > > > > This reverts commit 45e3838006.
> > > > >
> > > > > Reason for revert: Also need to rewrite them in actual ES2 mode.
> > > > >
> > > > > Original change's description:
> > > > > > Rewrite switch statements in GLSL strict-ES2 mode.
> > > > > >
> > > > > > Once this lands, switch statements will work everywhere--Metal, SPIR-V,
> > > > > > GLSL, and SkVM.
> > > > > >
> > > > > > Change-Id: I2797d0a872de8be77bb9f7aa6acb93421d571d70
> > > > > > Bug: skia:12450
> > > > > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/452356
> > > > > > Commit-Queue: John Stiles <johnstiles@google.com>
> > > > > > Auto-Submit: John Stiles <johnstiles@google.com>
> > > > > > Reviewed-by: Brian Osman <brianosman@google.com>
> > > > >
> > > > > Bug: skia:12450
> > > > > Change-Id: I92656ed40289872405c0873f2c56a52b04e35b1d
> > > > > No-Presubmit: true
> > > > > No-Tree-Checks: true
> > > > > No-Try: true
> > > > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/452556
> > > > > Auto-Submit: Brian Osman <brianosman@google.com>
> > > > > Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> > > > > Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> > > >
> > > > Bug: skia:12450
> > > > Change-Id: I0d3b0969d2040dbb4ee808132146687767c97442
> > > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/452560
> > > > 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>
> > >
> > > Bug: skia:12450
> > > Change-Id: I869cf3e2c47fe94981aa2ffa6c1f0b3e4d6e6862
> > > No-Presubmit: true
> > > No-Tree-Checks: true
> > > No-Try: true
> > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/452717
> > > Auto-Submit: Brian Osman <brianosman@google.com>
> > > Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> > > Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> >
> > Bug: skia:12450
> > Change-Id: Ia0e23e20794ea707e54be50123b5323369354a03
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/452721
> > 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>
>
> Bug: skia:12450
> Change-Id: Id0c0cdfbf146000ec532e57e380c18ff391ca1da
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/452896
> Auto-Submit: Brian Osman <brianosman@google.com>
> Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>

Bug: skia:12450
Change-Id: I4bac3a468ae20967fe6ec372561dd44f67c6b730
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/452897
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-09-27 14:35:19 +00:00
Michael Ludwig
aeb5d4daed [graphite] Flesh out Device/SDC a bit more
Renames SDCTask -> RenderPassTask and adds comments describing its
purpose. Has SDC use a DrawList and expose similar drawing functions.
Stubs out all Device methods that will eventually need to be supported,
but groups them into in-scope and out-of-scope sections. Implements the
drawing functions in terms of drawPath() and has drawPath() invoke the
SDC functions (with untested support for path effects, hairline, etc.).

Bug: skia:12466
Change-Id: Id661fc987aeb35f0dfa536c0cb0b6210742cf32c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/452233
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-09-25 17:51:42 +00:00
Brian Osman
6f06bab632 Revert "Re-reland "Rewrite switch statements in GLSL strict-ES2 mode."""
This reverts commit 64560c7cd5.

Reason for revert: Nexus5, also

Original change's description:
> Re-reland "Rewrite switch statements in GLSL strict-ES2 mode.""
>
> This reverts commit c4c355940c.
>
> Reason for revert: disabled offending tests
>
> Original change's description:
> > Revert "Reland "Rewrite switch statements in GLSL strict-ES2 mode.""
> >
> > This reverts commit c81edd0e8c.
> >
> > Reason for revert: ANGLE still unhappy
> > Original change's description:
> > > Reland "Rewrite switch statements in GLSL strict-ES2 mode."
> > >
> > > This reverts commit d26d0e6a47.
> > >
> > > Reason for revert: uses dedicated caps bit
> > >
> > > Original change's description:
> > > > Revert "Rewrite switch statements in GLSL strict-ES2 mode."
> > > >
> > > > This reverts commit 45e3838006.
> > > >
> > > > Reason for revert: Also need to rewrite them in actual ES2 mode.
> > > >
> > > > Original change's description:
> > > > > Rewrite switch statements in GLSL strict-ES2 mode.
> > > > >
> > > > > Once this lands, switch statements will work everywhere--Metal, SPIR-V,
> > > > > GLSL, and SkVM.
> > > > >
> > > > > Change-Id: I2797d0a872de8be77bb9f7aa6acb93421d571d70
> > > > > Bug: skia:12450
> > > > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/452356
> > > > > Commit-Queue: John Stiles <johnstiles@google.com>
> > > > > Auto-Submit: John Stiles <johnstiles@google.com>
> > > > > Reviewed-by: Brian Osman <brianosman@google.com>
> > > >
> > > > Bug: skia:12450
> > > > Change-Id: I92656ed40289872405c0873f2c56a52b04e35b1d
> > > > No-Presubmit: true
> > > > No-Tree-Checks: true
> > > > No-Try: true
> > > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/452556
> > > > Auto-Submit: Brian Osman <brianosman@google.com>
> > > > Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> > > > Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> > >
> > > Bug: skia:12450
> > > Change-Id: I0d3b0969d2040dbb4ee808132146687767c97442
> > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/452560
> > > 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>
> >
> > Bug: skia:12450
> > Change-Id: I869cf3e2c47fe94981aa2ffa6c1f0b3e4d6e6862
> > No-Presubmit: true
> > No-Tree-Checks: true
> > No-Try: true
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/452717
> > Auto-Submit: Brian Osman <brianosman@google.com>
> > Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> > Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
>
> Bug: skia:12450
> Change-Id: Ia0e23e20794ea707e54be50123b5323369354a03
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/452721
> 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>

Bug: skia:12450
Change-Id: Id0c0cdfbf146000ec532e57e380c18ff391ca1da
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/452896
Auto-Submit: Brian Osman <brianosman@google.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2021-09-25 13:29:08 +00:00
Jim Van Verth
ff733b3f39 Graphite: add MtlGpu.
Bug: skia:12466
Change-Id: I51dc73a213e672578767b41c01c487c942465964
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/452722
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-09-25 00:51:15 +00:00
John Stiles
64560c7cd5 Re-reland "Rewrite switch statements in GLSL strict-ES2 mode.""
This reverts commit c4c355940c.

Reason for revert: disabled offending tests

Original change's description:
> Revert "Reland "Rewrite switch statements in GLSL strict-ES2 mode.""
>
> This reverts commit c81edd0e8c.
>
> Reason for revert: ANGLE still unhappy
> Original change's description:
> > Reland "Rewrite switch statements in GLSL strict-ES2 mode."
> >
> > This reverts commit d26d0e6a47.
> >
> > Reason for revert: uses dedicated caps bit
> >
> > Original change's description:
> > > Revert "Rewrite switch statements in GLSL strict-ES2 mode."
> > >
> > > This reverts commit 45e3838006.
> > >
> > > Reason for revert: Also need to rewrite them in actual ES2 mode.
> > >
> > > Original change's description:
> > > > Rewrite switch statements in GLSL strict-ES2 mode.
> > > >
> > > > Once this lands, switch statements will work everywhere--Metal, SPIR-V,
> > > > GLSL, and SkVM.
> > > >
> > > > Change-Id: I2797d0a872de8be77bb9f7aa6acb93421d571d70
> > > > Bug: skia:12450
> > > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/452356
> > > > Commit-Queue: John Stiles <johnstiles@google.com>
> > > > Auto-Submit: John Stiles <johnstiles@google.com>
> > > > Reviewed-by: Brian Osman <brianosman@google.com>
> > >
> > > Bug: skia:12450
> > > Change-Id: I92656ed40289872405c0873f2c56a52b04e35b1d
> > > No-Presubmit: true
> > > No-Tree-Checks: true
> > > No-Try: true
> > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/452556
> > > Auto-Submit: Brian Osman <brianosman@google.com>
> > > Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> > > Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> >
> > Bug: skia:12450
> > Change-Id: I0d3b0969d2040dbb4ee808132146687767c97442
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/452560
> > 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>
>
> Bug: skia:12450
> Change-Id: I869cf3e2c47fe94981aa2ffa6c1f0b3e4d6e6862
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/452717
> Auto-Submit: Brian Osman <brianosman@google.com>
> Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>

Bug: skia:12450
Change-Id: Ia0e23e20794ea707e54be50123b5323369354a03
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/452721
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-09-24 20:50:20 +00:00
Jim Van Verth
8b85d7b429 Graphite: add ResourceProvider and CommandBuffer stubs
Bug: skia:12466
Change-Id: I30b53802d706406faf8045264c09a75ee3bf9126
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/452232
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-09-24 20:30:16 +00:00
Michael Ludwig
397fdfdf18 Implement separate crop filter
Right now the crop image filter is hidden in src/ and is only used in
a new GM to test out its functionality. In later CLs the plan will be to
migrate individual filter effects away from the built-in crop rect to
composing themselves with this image filter.

Eventually, the crop filter will be made public as part of the
SkImageFilters factories so there can be independent control on input
and output cropping. Its features will also be expanded to support more
tile modes than just kDecal.

Once all other effects rely on this crop filter, the legacy system can
be deleted and the effects can be more easily updated to the rest of the
new image filter API. This crop filter is actually the first image
filter to be implemented only in terms of the new API (and skif coord
space types). This highlighted a few pain points that still exist in
terms of the API, where I have added comments to capture how they could
be improved. Unfortunately, they aren't addressable until the rest of
the implementations have been migrated.

Bug: skia:9296
Change-Id: I12e96b679c246a9ec4e1e61f640414a11f1b6bb5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/451597
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-09-24 20:18:36 +00:00
Brian Osman
c4c355940c Revert "Reland "Rewrite switch statements in GLSL strict-ES2 mode.""
This reverts commit c81edd0e8c.

Reason for revert: ANGLE still unhappy
Original change's description:
> Reland "Rewrite switch statements in GLSL strict-ES2 mode."
>
> This reverts commit d26d0e6a47.
>
> Reason for revert: uses dedicated caps bit
>
> Original change's description:
> > Revert "Rewrite switch statements in GLSL strict-ES2 mode."
> >
> > This reverts commit 45e3838006.
> >
> > Reason for revert: Also need to rewrite them in actual ES2 mode.
> >
> > Original change's description:
> > > Rewrite switch statements in GLSL strict-ES2 mode.
> > >
> > > Once this lands, switch statements will work everywhere--Metal, SPIR-V,
> > > GLSL, and SkVM.
> > >
> > > Change-Id: I2797d0a872de8be77bb9f7aa6acb93421d571d70
> > > Bug: skia:12450
> > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/452356
> > > Commit-Queue: John Stiles <johnstiles@google.com>
> > > Auto-Submit: John Stiles <johnstiles@google.com>
> > > Reviewed-by: Brian Osman <brianosman@google.com>
> >
> > Bug: skia:12450
> > Change-Id: I92656ed40289872405c0873f2c56a52b04e35b1d
> > No-Presubmit: true
> > No-Tree-Checks: true
> > No-Try: true
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/452556
> > Auto-Submit: Brian Osman <brianosman@google.com>
> > Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> > Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
>
> Bug: skia:12450
> Change-Id: I0d3b0969d2040dbb4ee808132146687767c97442
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/452560
> 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>

Bug: skia:12450
Change-Id: I869cf3e2c47fe94981aa2ffa6c1f0b3e4d6e6862
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/452717
Auto-Submit: Brian Osman <brianosman@google.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2021-09-24 18:58:15 +00:00
John Stiles
c81edd0e8c Reland "Rewrite switch statements in GLSL strict-ES2 mode."
This reverts commit d26d0e6a47.

Reason for revert: uses dedicated caps bit

Original change's description:
> Revert "Rewrite switch statements in GLSL strict-ES2 mode."
>
> This reverts commit 45e3838006.
>
> Reason for revert: Also need to rewrite them in actual ES2 mode.
>
> Original change's description:
> > Rewrite switch statements in GLSL strict-ES2 mode.
> >
> > Once this lands, switch statements will work everywhere--Metal, SPIR-V,
> > GLSL, and SkVM.
> >
> > Change-Id: I2797d0a872de8be77bb9f7aa6acb93421d571d70
> > Bug: skia:12450
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/452356
> > Commit-Queue: John Stiles <johnstiles@google.com>
> > Auto-Submit: John Stiles <johnstiles@google.com>
> > Reviewed-by: Brian Osman <brianosman@google.com>
>
> Bug: skia:12450
> Change-Id: I92656ed40289872405c0873f2c56a52b04e35b1d
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/452556
> Auto-Submit: Brian Osman <brianosman@google.com>
> Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>

Bug: skia:12450
Change-Id: I0d3b0969d2040dbb4ee808132146687767c97442
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/452560
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-09-24 16:43:42 +00:00
Jim Van Verth
1e90b88e45 Graphite: Add stubs for Gpu and Caps
Bug: skia:12466
Change-Id: I1267d3a387e74dc510ee4d00925049a4e7ac9edd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/452557
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2021-09-24 16:19:43 +00:00
Brian Osman
d26d0e6a47 Revert "Rewrite switch statements in GLSL strict-ES2 mode."
This reverts commit 45e3838006.

Reason for revert: Also need to rewrite them in actual ES2 mode.

Original change's description:
> Rewrite switch statements in GLSL strict-ES2 mode.
>
> Once this lands, switch statements will work everywhere--Metal, SPIR-V,
> GLSL, and SkVM.
>
> Change-Id: I2797d0a872de8be77bb9f7aa6acb93421d571d70
> Bug: skia:12450
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/452356
> Commit-Queue: John Stiles <johnstiles@google.com>
> Auto-Submit: John Stiles <johnstiles@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>

Bug: skia:12450
Change-Id: I92656ed40289872405c0873f2c56a52b04e35b1d
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/452556
Auto-Submit: Brian Osman <brianosman@google.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2021-09-24 13:11:05 +00:00
John Stiles
45e3838006 Rewrite switch statements in GLSL strict-ES2 mode.
Once this lands, switch statements will work everywhere--Metal, SPIR-V,
GLSL, and SkVM.

Change-Id: I2797d0a872de8be77bb9f7aa6acb93421d571d70
Bug: skia:12450
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/452356
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-09-23 21:22:09 +00:00
John Stiles
cb40008b43 Implement switch in SkVM.
SkVM implements switches as a pseudo-loop; breaks are handled with the
condition mask just like a for loop. Fallthrough is handled via a
scratch Value in a temporary slot. `writeStore` neeeded to be refactored
to support writing into slot(s) without an associated Variable.

At IR generation time, SwitchStatements are now emitted without error
even in strict-ES2 mode. The GLSL code generator currently reports these
as an error in strict-ES2 mode, but this will be fixed in a followup
coming shortly (the switch will be rewritten as ifs inside a one-shot
loop, similar to our IR-rewrite strategy).

Change-Id: I5507257246c42a35d2f46b4b9a89492a5ffeff9b
Bug: skia:12450
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/451421
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2021-09-23 19:58:55 +00:00
Robert Phillips
d6bf374c3c Graphite: Improve DM/Graphite connection
This makes "dm --config grgl --src gm skp" generate a lot of green pngs and adds a stub class for Image_Graphite.

Bug: skia:12466
Change-Id: Ia7cf891ad278434f473cf6c9c4673bf8fa085adf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/451740
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2021-09-22 21:34:09 +00:00
Michael Ludwig
01754ecf12 Graphite: Rough out DrawCommandList and BoundsManager
Device will own and manage a BoundsManager, which it will use to decide
the sort and test Z's that it passes to the DrawCommandList in its
draw() implementations.

DrawCommandList might end up being owned by the SDC, with the SDC
exposing a similar drawing API. There will need to be some mechanism to
end a DrawCommandList and start a new one (the list moves into an
SDCTask). This would either happen from an external flush call, or in
the rare case where the representable Z values are exhausted and we
have to insert a depth buffer clear and start a new task that depends
on the prior one.

Bug: skia:12466
Change-Id: I892b631037dc801eb94da2462683c9701afa281b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/451599
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-09-22 19:36:49 +00:00
Jerome Gaillard
6ee0018bfe Remove mssse3 flag of host builds for Android skia
This flag is not necessary, and it prevents users with CPUs that do not
support SSSE3 from using design tools in Android Studio.

Change-Id: Ia3b907c6f398e331f642256774116fbf720581da
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/445937
Reviewed-by: Leon Scroggins <scroggo@google.com>
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
2021-09-22 18:36:20 +00:00
Robert Phillips
5a6f1606cc Add more stub classes
Bug: skia:12466
Change-Id: Iaa8431bf6fbe20c30b34a90a5a55f6f89723aa30
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/451257
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-09-22 15:59:54 +00:00
Jim Van Verth
5480677cfc Fix CMAKE build
Change-Id: I4471903f20b8167b71f81db91748794c7fbfb94b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/451576
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2021-09-22 14:16:40 +00:00
Robert Phillips
f15c3ff9d3 Add SkSurface_Graphite stub
and fix up the #include guards

Bug: skia:12466
Change-Id: I865ebb00827001b2cf0f7d871e872a7be0f36c22
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/451156
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2021-09-21 20:28:40 +00:00
John Stiles
1c5eb4b371 Disallow continue inside a switch.
This fails on several platforms in practice, and is of very limited
real-world utility.

Change-Id: Ib476396fc33cb51af6bbcf7fe822d30703ed995d
Bug: skia:12467
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/450993
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-09-21 19:26:40 +00:00
John Stiles
35bd92638f Add tests for switch + loop constructs.
Change-Id: I17b5e21a28140b8e9313d87af9b1145674214fdb
Bug: skia:12450
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/450989
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-09-21 17:23:47 +00:00
Robert Phillips
755e00edec Update sprint to graphite name
Change-Id: Ice0826af0b64fa8dd92975f879af8ab0f71740fc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/451039
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-09-21 16:44:10 +00:00
John Stiles
e32309d771 Update switch-fallthrough test to run in dm.
Also, removed "switch containing dead code" test. This wasn't testing
anything meaningful. (When we had full CFG analysis, we could have
eliminated some of the assignments inside the switch body, but this is
not something we do anymore.)

Change-Id: Iaeb74ebee41a7f368113ede9a4e30c033b9de8ac
Bug: skia:12450
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/450985
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-09-21 15:41:37 +00:00
Robert Phillips
1a4080add1 More beachhead
This should at least get something compiling.

Change-Id: I617fd4d6e4f0a3fdd6dedbe66f3a4448bb913b2c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/450976
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-09-21 14:44:32 +00:00
John Stiles
b8f1651f9b Add workaround for switch() containing only a default case.
The Mac Radeon GLSL driver crashes when given a switch statement that
only contains a default case and returns a value. Adding a case works
around the crash, and doesn't affect the meaning of the switch.

Change-Id: Iabbd267e0e31e8df7d3b7e747a7204d50931d0be
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/450977
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2021-09-21 14:22:17 +00:00
Ethan Nicholas
2816dcfc67 Fixed fuzzer-discovered bug with interface blocks
While I was in this code, I realized that the setVariable method of
InterfaceBlock was unused and there was therefore no reason to be
storing a pointer instead of a reference.

Bug: oss-fuzz:39000
Change-Id: If7505ba87f4060370cfd32ca2e30c76648965101
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/450446
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2021-09-21 14:12:47 +00:00
John Stiles
ed2babaf94 Reland "Add switch statement support to PipelineStage."
This is a reland of be056f4f62

The Switch test has been restructured to dodge an iOS bug.

Original change's description:
> Add switch statement support to PipelineStage.
>
> This allows us to write SKSL_TEST_ES3 tests in SkSLTest and have them
> run properly. Previously, such a test would assert inside the pipeline-
> stage generator. In ES2 mode, we will rewrite switches as chained ifs,
> but in ES3 mode we will want to continue emitting them as-is (they will
> be faster than chained ifs on a modern GPU).
>
> `writeSwitchStatement` is adapted from GLSLCodeGenerator.
>
> Change-Id: I532ea5ed49869e7cdffced0cdcd0e353af8d4d79
> Bug: skia:12450
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/450478
> 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>

Bug: skia:12450
Change-Id: I5102081c636ef09cd23f5bc894e6c96e92a4c121
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/450757
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-09-21 13:07:50 +00:00
John Stiles
d288d8bc84 Revert "Add switch statement support to PipelineStage."
This reverts commit be056f4f62.

Reason for revert: apparently switch on iOS GLSL is extremely broken

Original change's description:
> Add switch statement support to PipelineStage.
>
> This allows us to write SKSL_TEST_ES3 tests in SkSLTest and have them
> run properly. Previously, such a test would assert inside the pipeline-
> stage generator. In ES2 mode, we will rewrite switches as chained ifs,
> but in ES3 mode we will want to continue emitting them as-is (they will
> be faster than chained ifs on a modern GPU).
>
> `writeSwitchStatement` is adapted from GLSLCodeGenerator.
>
> Change-Id: I532ea5ed49869e7cdffced0cdcd0e353af8d4d79
> Bug: skia:12450
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/450478
> 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>

Bug: skia:12450
Change-Id: If40c90023a64c608181285f6470b3e75303cc3cc
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/450756
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2021-09-20 21:57:09 +00:00
Greg Daniel
84261653c5 Reland "Add new GrSurfaceInfo class and related backend structs."
This is a reland of 6aac1193a7

Original change's description:
> Add new GrSurfaceInfo class and related backend structs.
>
> Bug: skia:12402
> Change-Id: I45b2f71dcfa5843e2a19a8de7d34196a4d552905
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/445176
> Commit-Queue: Greg Daniel <egdaniel@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>

Bug: skia:12402
Change-Id: Id540bea408d72ceba43ec4245c3748d630121926
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/450277
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2021-09-20 20:44:53 +00:00
John Stiles
be056f4f62 Add switch statement support to PipelineStage.
This allows us to write SKSL_TEST_ES3 tests in SkSLTest and have them
run properly. Previously, such a test would assert inside the pipeline-
stage generator. In ES2 mode, we will rewrite switches as chained ifs,
but in ES3 mode we will want to continue emitting them as-is (they will
be faster than chained ifs on a modern GPU).

`writeSwitchStatement` is adapted from GLSLCodeGenerator.

Change-Id: I532ea5ed49869e7cdffced0cdcd0e353af8d4d79
Bug: skia:12450
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/450478
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-09-20 18:55:09 +00:00
Ethan Nicholas
f62934b85a Fixed DSLParser error uncovered by ossfuzz
Missed one more case of Optional<Wrapper<Expression>>. This should be
the last one.

Bug: oss-fuzz:38944
Change-Id: Ic7f790cd99e2a3ee1c3874cc767a4702265d1723
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/450476
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2021-09-20 17:57:14 +00:00
Jim Van Verth
14a9b089b6 Reland "Revert "New approach to GrProcessor uniforms.""
This reverts commit a59925fb1d.

Reason for revert: Speculative revert for https://crbug.com/1251070

Original change's description:
> Revert "Revert "New approach to GrProcessor uniforms.""
>
> This reverts commit ae59426ea6.
>
> Bug: skia:12182
> Change-Id: I591a0a89ffad1a3d5d867dd247ceeec71b6041a4
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/449516
> Reviewed-by: Michael Ludwig <michaelludwig@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>

Bug: skia:12182
Change-Id: I2f37c7e9675dd35194791340012e1b4135b076a1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/450440
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2021-09-20 14:51:44 +00:00
Ethan Nicholas
c973d26854 Fixed DSLParser assertion error uncovered by fuzzer
Bug: oss-fuzz:38108
Change-Id: I0e055d837923f00b982bc395dbf29b6ff59a3b21
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/448896
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2021-09-20 13:48:41 +00:00
Jim Van Verth
2f7ee02577 Revert "Add new GrSurfaceInfo class and related backend structs."
This reverts commit 6aac1193a7.

Reason for revert: Breaking Mac bots in Chromium roll. Looks like
they depend on getVkImageInfo for an unknown reason, and it's 
hidden behind SK_VULKAN.

Original change's description:
> Add new GrSurfaceInfo class and related backend structs.
>
> Bug: skia:12402
> Change-Id: I45b2f71dcfa5843e2a19a8de7d34196a4d552905
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/445176
> Commit-Queue: Greg Daniel <egdaniel@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>

Bug: skia:12402
Change-Id: I3c9642354dae8c955bc58d281700536393f84519
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/450199
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2021-09-18 16:35:38 +00:00
Greg Daniel
6aac1193a7 Add new GrSurfaceInfo class and related backend structs.
Bug: skia:12402
Change-Id: I45b2f71dcfa5843e2a19a8de7d34196a4d552905
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/445176
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2021-09-18 00:41:07 +00:00
Ethan Nicholas
0dc1e0f797 Fixed DSLParser unary expression error handling
Missed a case when eliminating optional/wrapper in an earlier CL.

Change-Id: If7f80ea6e2172acadf7b0087fe1a05853ccae445
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/449838
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2021-09-17 17:55:13 +00:00
Brian Salomon
a59925fb1d Revert "Revert "New approach to GrProcessor uniforms.""
This reverts commit ae59426ea6.

Bug: skia:12182
Change-Id: I591a0a89ffad1a3d5d867dd247ceeec71b6041a4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/449516
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2021-09-17 16:02:01 +00:00
John Stiles
eb68973c2f Disallow matrix ctors which overflow a column.
The GLSL spec allows matrix constructors containing vectors that would
split between multiple columns of the matrix. However, in practice, this
does not actually work well on a lot of GPUs!

- "cast not allowed", "internal error":
	Tegra 3
	Quadro P400
	GTX 660
	GTX 960
- Compiles, but generates wrong result:
	RadeonR9M470X
	RadeonHD7770

Since this isn't a pattern we expect to see in user code, we now report
it as an error at compile time. mat2(vec4) is treated as an exceptional
case and still allowed.

Change-Id: Id6925984a2d1ec948aec4defcc790a197a96cf86
Bug: skia:12443
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/449518
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2021-09-16 22:14:49 +00:00
Robert Phillips
ef80d7b50a Move more classes to skgpu::v1 namespace
Bug: skia:11837
Change-Id: Iaa0349749a5d79d7915fb37ef1b30b46f0aa58d6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/448796
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-09-16 14:04:16 +00:00
John Stiles
a047e8bf4d Improve overflow checks in CheckProgramUnrolledSize.
The fuzzer discovered that it could overflow the program-size value.
Rewrote the logic to use SkSafeMath everywhere, and to early-exit as
soon as a statement manages to exceed the program size.

Change-Id: I01511b2201173c95ebc1ac602901410ac9d74d73
Bug: oss-fuzz:38697
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/449098
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2021-09-15 16:42:45 +00:00
Brian Osman
a81e7e2e71 Report an error if sk_LastFragColor is referenced without fbFetchSupport
Adjusted default caps in skslc to be consistent with runtime behavior,
and added optional settings mode to enable the feature. Tests for both
scenarios. (The error test crashed prior to the fix).

Bug: oss-fuzz:38726
Change-Id: I5270d4837ac982085d7baf5abd4b361f7bfb8562
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/449062
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-09-15 15:41:49 +00:00
Robert Phillips
de60d7a64d Move more classes to skgpu::v1 namespace
Bug: skia:11837
Change-Id: If0bfb3009693b203b2080a1d43cc3b1865c3ab9e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/448274
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-09-15 15:20:24 +00:00
Ethan Nicholas
fd1332f5a7 Reland "Fixed DSL assertion error on source files containing nulls"
This is a reland of db38ad7b14

Original change's description:
> Fixed DSL assertion error on source files containing nulls
>
> The assertion was there to make sure we weren't running off the end of
> the source, but naturally fails in the presence of legitimate embedded
> nulls.
>
> Change-Id: I3b80499e9b182c9ea046c479f35d7a965d548401
> Bug: oss-fuzz:38107
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/447182
> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
> Reviewed-by: John Stiles <johnstiles@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>

Bug: oss-fuzz:38107
Change-Id: Idb1a6b7c64d2bb954edadae828d6de808158fd3f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/448660
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2021-09-15 15:00:23 +00:00
John Stiles
857c7f9dc5 Add program-too-large test using for loops without blocks.
The fuzzer has discovered a bug in our program size-checking logic; for
loops that immediately contain another for loop (with no block) were not
counting the inner loop's iterations. This allowed it to exceed our
maximum program-size threshold (and time out during SkVM compilation).

This test demonstrates the issue. A followup will fix it.

Change-Id: I3b7d4c8a4f0ed04cf0aba3f1a32fdad7d6d784e7
Bug: oss-fuzz:37837
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/449096
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>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2021-09-15 14:19:00 +00:00
John Stiles
b701fa0ac0 Add non-square MatrixCompMult support to public SkSL in ES3 mode.
We already had a test case here, but it wasn't actually in operation.
The test has been split into ES2 (square) and ES3 (non-square) halves,
returns the color like a proper runtime effect, and it's now running in
dm.

Also, Metal doesn't natively support matrixCompMult, so it injects a
helper function; I tweaked the helper so it no longer requires an extra
result variable.

Change-Id: Ie79242768966fcbe879ad73461d17b4fb8e55670
Bug: skia:12202
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/448117
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-09-14 18:15:23 +00:00
Greg Daniel
2bc96d6771 Merge GrVkAttachment into GrVkImage.
Bug: skia:12402
Change-Id: I743724f66db8d7666d4d627d6945ce6bc3dc6bc3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/448261
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2021-09-14 13:34:17 +00:00
John Stiles
7d19065eef Add test of off-kilter matrix constructors.
This exposes a bug in the Metal code generator which will be resolved
in a followup CL.

Change-Id: If073835dbee474ea9a805eb92b42dc1fca2afbd0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/448378
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-09-14 13:01:26 +00:00
Brian Salomon
ae59426ea6 Revert "New approach to GrProcessor uniforms."
This reverts commit 10c9f36bdd.

Reason for revert:bad gms, maybe blocking chrome roll

Original change's description:
> New approach to GrProcessor uniforms.
>
> The important aspect is that it allows knowing the uniforms that will
> be used by a set of processors without having to create ProgramImpls.
>
> GrProcessor subclasses specify uniforms at creation time in a similar
> style to how GrGeometryProcessors already specify attributes. That is,
> they initialize a span of structs describing the uniform which may
> contain void uniforms that are skipped. Unlike attributes, the struct
> contains an offset into the processor where the data is stored.
>
> GrUniformAggregator is used to collect the uniforms from all processors
> that compose a draw and mangle their names. The ProgramImpl subclasses
> query the aggregator for their uniform names when emitting code.
>
> The old system for uniforms is left intact and only three processors,
> one GP, one FP, and one XP, are updated to use the new system.
>
> Some pieces that are missing before everything can be moved over:
> -support for uniforms not owned by GrProcessor (e.g. rt-adjust)
> -support for samplers
> -helpers for common patterns
>  (e.g. GrGeometryProcessor::ProgramImpl::setupUniformColor(),
>   and the various matrix helpers on ProgramImpl)
>
> Bug: skia:12182
>
> Change-Id: I21c1b7a8940eb9b8aad003f5a2569e43977a33d2
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/440841
> Reviewed-by: Michael Ludwig <michaelludwig@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>

Bug: skia:12182
Change-Id: I6cc508900a599d27124f8ba48597593192d5d807
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/448418
Auto-Submit: Brian Salomon <bsalomon@google.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2021-09-13 21:22:16 +00:00
Brian Salomon
10c9f36bdd New approach to GrProcessor uniforms.
The important aspect is that it allows knowing the uniforms that will
be used by a set of processors without having to create ProgramImpls.

GrProcessor subclasses specify uniforms at creation time in a similar
style to how GrGeometryProcessors already specify attributes. That is,
they initialize a span of structs describing the uniform which may
contain void uniforms that are skipped. Unlike attributes, the struct
contains an offset into the processor where the data is stored.

GrUniformAggregator is used to collect the uniforms from all processors
that compose a draw and mangle their names. The ProgramImpl subclasses
query the aggregator for their uniform names when emitting code.

The old system for uniforms is left intact and only three processors,
one GP, one FP, and one XP, are updated to use the new system.

Some pieces that are missing before everything can be moved over:
-support for uniforms not owned by GrProcessor (e.g. rt-adjust)
-support for samplers
-helpers for common patterns
 (e.g. GrGeometryProcessor::ProgramImpl::setupUniformColor(),
  and the various matrix helpers on ProgramImpl)

Bug: skia:12182

Change-Id: I21c1b7a8940eb9b8aad003f5a2569e43977a33d2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/440841
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2021-09-13 19:55:06 +00:00
John Stiles
7591d4b5ef Replace trio of XxxxLiteral types with a single Literal type.
Throughout SkSL we've begun using doubles as a convenient way to store
any SkSL value (int, float, bool) in a single type. This idea has now
been extended to literals. Rather than having three expression kinds for
integers, floats and boolean literals, we can have just one. These can
be accessed in a type-specific way (`floatValue`, `intValue`, and
`boolValue` return the expected type, or assert if it's not the
matching type), or in a type-agnostic way (`value` will return a double
and works on any type of Literal).

This allows us to remove a complex template trick (Literal<T> is gone),
removes two redundant Expression types, and and lets us reduce our code
size in ConstantFolder, FunctionCall, etc.

Most of the conversion process was pretty straightforward:
* `IntLiteral::Make` becomes `Literal::MakeInt`
* `x.is<IntLiteral>()` becomes `x.isIntLiteral()`
* `x.as<IntLiteral>.value()` becomes `x.as<Literal>.intValue()`

Change-Id: Ic328533611e4551669c7fc9d7f9c03e34699f3f6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/447836
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-09-13 17:32:34 +00:00
John Stiles
dc652564a7 Fix for-statement assertion detected by the fuzzer.
The fuzzer found that the `DetectVarDeclarationWithoutScope` check was
placed too late in the function, and could be skipped over by for-loops
containing multiple variables. This was caught in ForStatement::Make,
which mirrors the Convert postconditions with matching assertions.

Change-Id: I6e9d97c7c9ca969aba65e601bbcd9fe676105838
Bug: oss-fuzz:38560
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/448116
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-09-13 13:34:48 +00:00
Michael Ludwig
47d824415e Revert "Fixed DSL assertion error on source files containing nulls"
This reverts commit db38ad7b14.

Reason for revert: breaking g3 roll since it thinks the test case is "binary" not flagged as binary

Original change's description:
> Fixed DSL assertion error on source files containing nulls
>
> The assertion was there to make sure we weren't running off the end of
> the source, but naturally fails in the presence of legitimate embedded
> nulls.
>
> Change-Id: I3b80499e9b182c9ea046c479f35d7a965d548401
> Bug: oss-fuzz:38107
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/447182
> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
> Reviewed-by: John Stiles <johnstiles@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>

Bug: oss-fuzz:38107
Change-Id: I650d12d728b5d932bda79e81205b873d8b44771f
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/447936
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2021-09-11 18:13:13 +00:00
Ethan Nicholas
db38ad7b14 Fixed DSL assertion error on source files containing nulls
The assertion was there to make sure we weren't running off the end of
the source, but naturally fails in the presence of legitimate embedded
nulls.

Change-Id: I3b80499e9b182c9ea046c479f35d7a965d548401
Bug: oss-fuzz:38107
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/447182
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-09-10 18:44:22 +00:00
Ethan Nicholas
c9d65f0b8a Fixed duplicate function definition error discovered by fuzzer
Bug: oss-fuzz:38140
Change-Id: I76a1b3ef8289b3089192d043d173677c00741a54
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/445836
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-09-10 17:35:52 +00:00
Ethan Nicholas
bf4a7d5235 Fixed DSLParser crash with invalid swizzle
In response to a non-identifier token after a dot, DSLParser would
attempt to swizzle a zero-length field and fail an assertion.

The same basic code path exists in the old compiler, but the resulting
parse error causes the process to abort before it attempts to process
the zero-length swizzle.

Bug: oss-fuzz:38106
Change-Id: Ifd997ce1d564b5f6ef0a9a785d8d9e254785e600
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/446185
Reviewed-by: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-09-10 14:29:22 +00:00
John Stiles
8d0dd0d1c1 Add support for pack/unpackUnorm2x16 to public SkSL.
This includes compile-time optimization and tests.

The unit test is disabled in a followup CL
(http://review.skia.org/447057) because it exposes a Radeon 5300M bug
in OpenGL.

Change-Id: I8b2f0411358aeb68c4edfeb0bd7a2814c4be1f40
Bug: skia:12202
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/447056
Reviewed-by: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-09-09 18:59:15 +00:00
Robert Phillips
769b4884a9 Move some more Ops to skgpu::v1 namespace
Bug: skia:11837
Change-Id: I522636c6dbf977929b0d368e18beb9c3a01fdeb1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/446184
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-09-08 15:41:04 +00:00
Ethan Nicholas
a2c76c77c4 Fixed illegal interface block reporting
DSL was improperly allowing interface blocks in runtime shaders, which
caused PipelineStageGenerator to get upset.

Bug: oss-fuzz:38131
Change-Id: I593e68f2cab3db9151d606e65e2826ffa9c494e2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/446324
Commit-Queue: Ravi Mistry <rmistry@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2021-09-07 20:18:00 +00:00
John Stiles
3ff77f4862 Fix inliner bug discovered by fuzzer.
Intrinsic-call optimization can be triggered during inlining. In this
case, inlining turned `normalize(x)` into `normalize(constant-value)`.

DSL is used to implement optimizations for a handful of intrinsic calls,
including `normalize`, which internally relies on `length`.

The DSL expects that it can use the IRGenerator to handle function
calls. This was not working because we were finished with the initial
compilation pass, and the IRGenerator's symbol table is removed when
finish() was called.

We now temporarily give a symbol table back to the IRGenerator while
the inliner runs. We remove it again as soon as inlining is complete.

Change-Id: I6da98788d93749ffeb008c1f4c3f72b436e8ceeb
Bug: oss-fuzz:37994
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/445956
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-09-07 13:29:37 +00:00
Brian Osman
3099f798e7 SkSL: Add support for method calls on effect objects
Includes .eval() as a new alternative syntax for sample/shade.

Bug: skia:12302
Change-Id: Ia921c141b3eeeba7e5309d921967b941f9cd055e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/444756
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-09-03 14:53:33 +00:00
John Stiles
2af4b13925 Reject programs which exceed 50 stack frames during size analysis.
Our program-size analysis pass needs to recurse into called functions;
depending on the exact order of functions in the program, this recursion
can hypothetically be as deep as the deepest function-call chain. Set an
upper bound on recursion here, so we don't overflow the stack while
trying to check the program size. In practice, 50 frames is far deeper
than a regular shader should ever go.

Change-Id: I733ee48dad6f8053facdfd9f6d8a2b9b2a4af188
Bug: skia:12396
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/445279
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2021-09-03 02:41:34 +00:00
John Stiles
61e5e202a5 Enforce an upper bound on Runtime Effect program size.
The fuzzer is currently learning to make unboundedly-large programs by
nesting medium-size loops repeatedly. SkVM doesn't have a mechanism to
limit the ensuing explosion of code and ends up making unreasonably deep
stacks and/or unreasonably large programs.

SkSL now enforces an upper bound of approximately 100,000 IR nodes on a
fully-flattened, fully-inlined strict-ES2 program. The limit is picked
out of thin air, but this should be enough to prevent SkVM from going
haywire while still being large enough to handle any reasonable program.
We can definitely tune this value if we find that it is too large
(admitting dangerous code) or too small (rejecting good code).

Change-Id: I11735636175721fbc79460b4e194d8e4b42dc47d
Bug: skia:12396, oss-fuzz:37827, oss-fuzz:37837
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/444358
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-09-02 14:44:34 +00:00
Robert Phillips
fbf021492e Move more Ops to skgpu::v1 namespace
GrFillRRectOp
GrFillRectOp

Bug: skia:11837
Change-Id: Icdecc2ccd9def659b0d9402910b2072e02577a66
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/444817
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-09-02 13:25:29 +00:00
Robert Phillips
46d7bd56f6 Move more Ops to skgpu::v1 namespace (take 2)
GrClearOp
GrDashOp

Bug: skia:11837
Change-Id: I9ada76c061154e769e7f486e7c57a93fd1d74907
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/444636
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-09-01 18:57:02 +00:00
Robert Phillips
d2f53f9e3e Move more Ops to skgpu::v1 namespace
Bug: skia:11837
Change-Id: Ia79f76c18587741000367edba303c5f7c0c1087d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/444178
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-09-01 16:50:16 +00:00
Robert Phillips
5fe828accb Revert "Move more Ops to skgpu::v1 namespace"
This reverts commit f3158abda3.

Reason for revert: Broke Flutter build

Original change's description:
> Move more Ops to skgpu::v1 namespace
>
> GrClearOp
> GrDashOp
>
> Bug: skia:11837
> Change-Id: Ib65418952e7d4fb1e419e4942223823f22302b34
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/443518
> Reviewed-by: Michael Ludwig <michaelludwig@google.com>
> Commit-Queue: Robert Phillips <robertphillips@google.com>

TBR=robertphillips@google.com,michaelludwig@google.com,skcq-be@skia-corp.google.com.iam.gserviceaccount.com

Change-Id: Ic181ced7f5f2a8ff834fdcfb4e5265b99eef1666
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:11837
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/444365
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-09-01 14:44:46 +00:00
Robert Phillips
f3158abda3 Move more Ops to skgpu::v1 namespace
GrClearOp
GrDashOp

Bug: skia:11837
Change-Id: Ib65418952e7d4fb1e419e4942223823f22302b34
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/443518
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-09-01 14:03:55 +00:00
John Stiles
5cec187b36 Fix array timeout discovered by the fuzzer.
The fuzzer discovered that, when we attempt to verify that an array
doesn't contain any literal values that are out-of-range for its base
type, we pay a linear-time cost based on the size of the array. This
happens even when the array value isn't known at compile time; we still
iterate over its slot count and diligently discover that every single
constant-subexpression slot in the expression is "null".

We now have a helper function on Expression,
`allowsConstantSubexpressions`, which only returns true for expression
kinds that can contain constant subexpressions. We use this helper to
skip over this linear-per-subexpression check when the expression
cannot possibly contain a constant subexpression. In particular,
`AnyConstructor::compareConstant` and `Type::checkForOutOfRangeLiteral`
will now early-out for expressions that can't possibly contain a
constant subexpression.

Change-Id: Ia34e422afa67b478a8616acb0a0e9cd211b29698
Bug: oss-fuzz:37900
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/444136
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-08-31 19:55:45 +00:00
Greg Daniel
0e32aa8a3a Rename some GrD3DTypes* header files.
I want to free up GrD3DTypesPriv to actually be private types that
include real d3d objects.

Change-Id: Id38d6baae4fa68c19301b27d4f9d51eb1d9c5db0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/443676
Commit-Queue: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Auto-Submit: Greg Daniel <egdaniel@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2021-08-31 18:49:46 +00:00
Robert Phillips
cadd5dbded Move three Op-derived classes to the skgpu::v1 namespace
GrRegionOp
GrShadowRRectOp
GrStrokeRectOp

Bug: skia:11837
Change-Id: I0b573031acb13138e1549712c555337247e0a08e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/442836
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-08-30 21:16:11 +00:00
John Stiles
f89a8122a4 Fix flaws in minus-prefix optimization.
We had a logic bug when attempting to optimize the following code:
    const vecN x = vecN(a, b, c);
    -x;

The goal was to replace `-x` with `vecN(-a, -b, -c)` but we accidentally
tried to cast the `x` VariableReference to a Constructor. We
unfortunately didn't cover this in any of our test cases, but the fuzzer
managed to synthesize it by mixing and matching elements from its new
corpus.

This affected several different constructor types: splat, diagonal-
matrix, compound and array.

Change-Id: I10dd2460ab26ba3e820b0cff5db091368fb7e648
Bug: oss-fuzz:37764, oss-fuzz:37861
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/443407
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-08-30 20:40:17 +00:00
Robert Phillips
31f763190f Move GrAtlasTextOp to skgpu::v1 namespace
Bug: skia:11837
Change-Id: I3dde13940e57763d5a8224cb1a4b555e904351d7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/442716
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-08-30 14:56:55 +00:00
Robert Phillips
2145390fbe Move GrTextureOp to skgpu::v1 namespace
Bug: skia:11837
Change-Id: Ie99b1c512885404351d6917bbea751d99a2ca23e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/442797
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-08-30 14:14:14 +00:00
Brian Osman
99ddd2a98d Remove (unused) geometry shader support
Bug: skia:8451 skia:10827
Change-Id: I5b38a1d72cd4558f8e2a92aaf9b12f05efce0923
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/442683
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2021-08-27 19:41:10 +00:00
John Stiles
8d13084535 Migrate function-body finalization out of IRGenerator.
This is a first step towards replacing `finalizeFunction` with a
`FunctionDefinition::Convert` method living outside of the IRGenerator.

Previously this code would assert that we had no early returns from a
vertex-program main() method; this has been turned into an error.
(The original assertion was also tied to fRTFlip, because the *problem*
with early-returns in main is tied to the lack of RTFlip fixups, but
we fundamentally don't allow early returns, so it makes more sense to
just universally disallow it.)

Change-Id: Iba0742f7ef3cbc83995ea130fec1eb1ef2556c44
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/442691
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2021-08-27 18:51:52 +00:00
John Stiles
842ee5bd8d Fix assertion when calling a built-in function at global scope.
The fuzzer invented a much more elaborate example, but I was able to
winnow it down to a simple otherwise-normal test case. This also fixes
a latent DSL bug; DSL functions were not updating the list of referenced
intrinsics, so the compiler might emit finished programs that called
built-in functions that didn't exist in the code.

Change-Id: I095bb566b9db9f87cbe9460732c300b7973eb112
Bug: oss-fuzz:37659
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/442325
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-08-27 17:05:21 +00:00
John Stiles
bb8cf5804c Fix invalid variable ref-kind discovered by fuzzer.
No-op arithmetic simplification will convert expressions like `x += 0`
to `x`. When making this simplification, we will also downgrade the ref-
kind of `x` from "write" to "read" since the new expression is no longer
an assignment.

The fuzzer discovered that the ref-kind downgrade was too aggressive,
and would also traverse into nested subexpressions and downgrade them
as well. That is, for `x[y=z] += 0` would convert both `x` and `y`
into "read" references, which is incorrect; `y` is still being written
to.

The fuzzer managed to turn this mistake into an assertion by leveraging
a separate optimization. It added a leading, side-effect-less comma
expression for us to detect as worthless and eliminate. In doing so, we
clone the expression with the busted ref-kind, triggering an assertion.

Change-Id: I42fc31f6932f679ae875e2b49db2ad2f4e89e2cb
Bug: oss-fuzz:37677
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/442536
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-08-27 14:01:21 +00:00
Robert Phillips
fdafc0cbe4 Move GrAtlasRenderTask to gpu/ops and skgpu::v1 namespace
Bug: skia:11837
Change-Id: I29352c0e2c9e987b28be983c3d519a88b589baf1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/442022
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-08-25 21:39:11 +00:00
John Stiles
fbb905e70f Remove nearly-unused ASTNode description code.
The entire ASTNode is probably going away soon, but this is a decent
place to start. Checking the fuzzer logs, we had 0% coverage in here,
which makes sense because it's unreachable by any normal means.

Change-Id: I396464e3e613d46e990b629c4fc991c11f6110fa
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/442000
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-08-25 20:58:13 +00:00
Robert Phillips
3e87a8eda9 Move GrOpsTask to gpu/ops and the the skgpu::v1 namespace
Bug: skia:11837
Change-Id: I9ee6343b5144b02e8f455df0ea01b8199a8f14e1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/440837
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2021-08-25 18:32:17 +00:00
John Stiles
43ac7e6315 Fix parsing error with SPIR-V negating a uint.
Our SPIR-V code generator did not implement support for negating a uint.
However, this is something that GLSL allows (as does the rest of SkSL).
I checked glslang and it uses OpSNegate here. The SPIR-V docs indicate
that OpSNegate allows any type of integer, and the validator lets it
pass, so we now use OpSNegate here as well.

http://screen/33mkq92uxAT5Xu8
http://screen/4YBTh3gCWz8eZx7
http://screen/388HtXyytcN5vLZ

Change-Id: I8c142018fd5e162dcd051abe1bc5d69a6e034794
Bug: oss-fuzz:37627
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/441880
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2021-08-25 17:52:50 +00:00
John Stiles
2d3f5e8f25 Demonstrate parsing error with structs and arrays.
The fuzzer detected a serious parsing error; a struct containing a
vardecl with multiple declarations would interpret arrays incorrectly.
An array would be applied to ALL variables in the decl after its initial
appearance. That is, `int w, x[10], y, z;` would be interpreted as
`int w, x[10], y[10], z[10];`. The fuzzer caught this by putting two
arrayed variables in a row; the second variable was interpreted as a
nested array, which led to an assertion.

This CL contains a simple hand-written test case demonstrating the bug,
with the fix coming in a followup.

Change-Id: I42d7372ba77fa1528ae24eb8c29a2e5903784139
Bug: oss-fuzz:37622
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/441878
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-08-25 17:26:54 +00:00
John Stiles
f95048cc4d Report intermediate expressions as errors in For next-exprs.
We weren't coercing the expression because we don't care about its type,
but that allowed intermediate-expressions to pass through without
reporting an error. Now we coerce the expression to its present type,
which will always fail if the type is disallowed and succeed otherwise.

Change-Id: Ic0de0d17f0f5d56360575efe992ce4d74dec2a5a
Bug: oss-fuzz:37620
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/441876
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-08-25 17:26:21 +00:00
Michael Ludwig
c1ed11d909 Move GrBlockAllocator and GrTBlockList to src/core/
src/gpu/GrBlockAllocator -> src/core/SkBlockAllocator
src/gpu/GrTBlockList -> src/core/SkTBlockList

Tests and references also renamed.

Bug: skia:12330
Change-Id: I5fad05faa3dcecd89a0a478dcf30c090ea7589f5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/441477
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2021-08-25 13:21:32 +00:00
Brian Osman
b5282f0112 Migrate runtime effect sample tests to golden files
Much easier to maintain, especially with an upcoming change to the
sampling syntax.

Change-Id: I378811b7be0afcce5b7e68a942e7b46d96568155
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/441518
Commit-Queue: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2021-08-24 15:19:44 +00:00
John Stiles
d77dda5bd5 Fix inliner bug discovered by fuzzer.
The inliner contained a type error when attempting to inline a function
that takes an array as input. The scratch copy of the array was created
as `float[123] var;` instead of `float var[123];`. This led to an
assertion in VarDeclaration::Make.

Change-Id: I5128fe71462bb59a015a7b4e59c1a74800828b16
Bug: oss-fuzz:37466
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/441576
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-08-24 14:44:43 +00:00
Ethan Nicholas
553239bc12 Added reportPendingErrors to SkSL code generation
This fixes an assertion failure uncovered by the fuzzer.

Bug: oss-fuzz:37469
Change-Id: I626c003cfa8a0bc65851899df3a7695dbe29200b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/441311
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2021-08-23 20:54:40 +00:00
John Stiles
3f37322d71 Fix const function-parameter assertion discovered by fuzzer.
During constant-folding, we baked in an assertion stating that any
const-typed variable reference ought to have an initial value, because
you can't declare a const variable without assigning a value. However,
function parameters are an exception to this rule! They are variable
references and are allowed to be const, but will not have an initial
value. (In this case, `const` just means you can't alter the value.)

In this case, all we needed to do was remove the assertion; we already
treated this case defensively and with the appropriate care.

Change-Id: I61242c6d08c59886c6992898f195771e6334f2b4
Bug: oss-fuzz:37465
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/441239
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-08-23 19:28:29 +00:00
John Stiles
7253a201a3 Improve error-checking during array-size conversion.
The fuzzer noticed insufficient guards in IndexExpression::Convert when
converting an array size from an IntLiteral to a SKSL_INT. We had code
in IRGenerator which did this properly, so I moved our array-size
conversion logic into SkSLType and had IndexExpression share it.

Also, a variety of tests around similar error conditions were added.

Change-Id: I51529dea25f9029f81ae236511610069d66be29f
Bug: oss-fuzz:37462
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/441236
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-08-23 14:35:00 +00:00
John Stiles
8f633ef2b5 Fix assertion discovered by fuzzer.
We now stop processing a var-declaration if its array-size expression is
invalid. Previously, we'd pass a null array-size expression into
convertVar, which would assert (but would fail cleanly afterwards).

Change-Id: I976f3326e32afbc7045a86d73c0dcb28f418a6f4
Bug: oss-fuzz:37457
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/441079
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-08-23 14:23:46 +00:00
Robert Phillips
e453fa063d Move some v1-only gpu/tessellate files to gpu/ops
This CL just moves the files and renames them. It doesn't move them into the skgpu::v1 namespace.

Bug: skia:11837
Change-Id: Iab322d0dc5b5d1cfd32436785081539dc85c18d3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/440776
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Chris Dalton <csmartdalton@google.com>
2021-08-19 19:56:46 +00:00
Robert Phillips
db0ec08127 Move GrPathRenderer and GrPathRendererChain to skgpu::v1 namespace
Bug: skia:11837
Change-Id: I42abcd3724ac1e2c71d3bd13ff6295a4683af5e0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/440261
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-08-19 18:26:57 +00:00
Robert Phillips
43e70f1913 Move 2 path renderers to skgpu::v1 namespace
Bug: skia:11837
Change-Id: I71c8e5b7221e0eb84400e0ddc1a8126d820d24bb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/440538
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2021-08-19 16:16:23 +00:00
Robert Phillips
832f3fbcae Move GrTessellationPathFlags to their own header (GrTessTypes.h)
Having this enum on GrTessellationPathRenderer forced it to be over-#included and was blocking making GrTessellationPathRenderer.h v1-only.

Bug: skia:11837
Change-Id: I80660ed659946d7aa555057c9f4fd1136b44cca0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/440536
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-08-19 14:47:45 +00:00
Robert Phillips
9030a3b1f6 Move GrStencilMaskHelper and GrStencilClip to skgpu::v1 namespace
Bug: skia:11837
Change-Id: I6aee4b5fcdb39a669f1ce9adb143b4562c206e57
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/440263
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2021-08-18 15:59:14 +00:00
Robert Phillips
74b943237e Move GrClipStack to skgpu::v1 namespace
Bug: skia:11837
Change-Id: I42dfaf795ec6afe9d648b0715457a3a38ef8c7a4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/439943
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-08-18 13:58:45 +00:00
Robert Phillips
db857ce628 Make GrSmallPathAtlasMgr and GrSmallPathShapeData v1-only files
This is part of making everything in the gpu/ops directory be v1-only.

Bug: skia:11837
Change-Id: I9709ffc140a77d4d68f3838e3d30374df0913889
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/440156
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2021-08-17 23:42:26 +00:00
John Stiles
b0697081b5 Improve SPIR-V handling of RTFlip when running the fuzzer.
If the passed-in shader references RTFlip (i.e., sk_FragCoord is used),
the settings must contain RTFlip layout info; otherwise, an error
occurs. Originally, the fuzzer detected this as a problem because the
error was being delivered via SK_ABORT, but it's failing more cleanly
now that Ethan's new error handling code is in place (causing the fuzzer
to report that the bug was "fixed"). With this CL, the oss-fuzz shader
will actually compile successfully in SPIR-V instead of leading to an
error.

Change-Id: I3268e84bd8e01c95a25ed0845a37324e98033c4b
Bug: oss-fuzz:35916
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/439779
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-08-17 22:31:10 +00:00
Robert Phillips
461c539a04 Move several more PathRenderers to skgpu::v1 namespace
Bug: skia:11837
Change-Id: Ifa1da88aafcaa96e0e885facaeb849cc9963bcfe
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/439938
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2021-08-17 22:19:11 +00:00
Robert Phillips
41ebbd71b1 Move triangulators and tessellators into gpu/geometry
This is the other half of making everything in gpu/ops be v1-only.

Bug: skia:11837
Change-Id: I5d77a499ef02eba69208d5bd634650433d02f6fb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/440216
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-08-17 19:25:25 +00:00
Robert Phillips
17dc658f29 Move Software and Small PathRenderers to skgpu::v1 namespace
Bug: skia:11837
Change-Id: Ia34f1840aaa7360ea9a3ca40fef5cb96b68c6ca3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/439781
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2021-08-17 16:52:47 +00:00
John Stiles
059798f40e Test that Runtime Effects cannot use non-ES2 types.
Surprisingly, we didn't actually have a preexisting test covering this.
Error reporting is lackluster in this CL but will be improved in the
followup.

Change-Id: I0b1cdb5a82f066af6b9d3fd9c39748080c2e18c0
Bug: skia:12348
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/439996
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-08-17 15:10:02 +00:00
John Stiles
7d99ba2503 Enable variable-shadow warnings.
This will prevent us from reusing a variable name from an outer scope
within an inner scope; this is a common source of confusion or bugs.
There are two special cases where shadowing is still allowed.

- Constructor arguments that match class member variables, e.g.:

    MyCtor(int value) : value(value) {}

- Lambdas where the outside variable is not accessible in the inner
  scope, e.g.:

    void Fn(int x) {
        auto lambda = [] { int x = 123; };  /* outer x not captured */
    }

Change-Id: I073bdaf7c530fc958fc13ce68464cf345a2f5358
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/439497
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2021-08-16 18:06:06 +00:00
Brian Osman
eb0f29dba2 SkSL: Allow invoking children (shaders, etc) like functions
Previously, you would declare child objects (shaders, colorFilters, etc.)
and "sample" them like this:

    uniform shader input;
    uniform colorFilter filter;
    half4 main(float2 coord) {
        half4 inColor = sample(input, coord);
        return sample(filter, inColor);
    }

With the new syntax, those child objects become directly callable,
reflecting the way that Skia assembles all parts of the paint (as functions)
in the overall fragment shader:

    uniform shader input;
    uniform colorFilter filter;
    half4 main(float2 coord) {
        half4 inColor = input(coord);
        return filter(inColor);
    }

Bug: skia:12302
Change-Id: Ia12351964dc5d2300660187933188e738671cd83
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/436517
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2021-08-16 14:52:51 +00:00
Ethan Nicholas
da44b579f5 Removed missing file from sksl.gni
sksl.gni still had a reference to a now-deleted file, which is
presumably the cause of the current build failures.

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

Change-Id: I3a7d4514e338ca0810a21413e900248b1a2153e0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/439283
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2021-08-13 23:49:25 +00:00
Ethan Nicholas
4a5e22a8c8 Further unified error handling between SkSL and DSL
This eliminates the SkSL ErrorReporter class and funnels everything
through the DSL ErrorHandler. Since the DSL error handler can be
changed, this required a number of updates to ensure that things work
properly in the face of custom error handlers. There is probably more
work to be done in that area, but this at least passes all existing
tests.

Change-Id: Iaee27b79fc4ed426c484ccab257c09d28619ead5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/438116
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2021-08-13 22:26:10 +00:00
Robert Phillips
364ea352b0 Make remaining GrOp derived classes be skgpu::v1 only
I will follow up with a CL actually moving the newly V1-only files to their final homes and adding namespaces.

Bug: skia:11837
Change-Id: I0fed1a802ae93a4357c53cde2b665ad6ddb49a6f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/418996
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-08-13 20:21:15 +00:00
John Stiles
4e2494870d Allow derivatives in Runtime Effects when ES3 restrictions are off.
We can now add functions to sksl_public.sksl with an $es3 prefix. These
will be allowed in a Runtime Effect when strict-ES2 mode is disabled.
Note that the CPU backend still doesn't have support for these calls,
and will fail ungracefully (assertion, nonsense result) if these
intrinsics are used.

The testing here is limited, due to an unrelated bug in SPIR-V
(skia:12340)

Change-Id: I9c911bc2b77f5051e80844607e7fd08ad386ee56
Bug: skia:12202, skia:12340
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/439058
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2021-08-13 16:45:17 +00:00
John Stiles
efde90d973 Add $es3 modifier to SkSL.
This modifier is currently allowed on built-in functions only.

The presence of this modifier will be used to indicate intrinsics which
are ES3-specific (and therefore, not allowed in user code under typical
circumstances).

Change-Id: Ice6be8d9d1b2bf0c8f07f2a89f335bb2f90f6681
Bug: skia:12202
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/439057
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-08-13 14:07:40 +00:00
Robert Phillips
06273bcb8a Prepare headers for making all ops V1-only
Basically, ensure all the headers about to become V1-only only appear in contexts that are currently or will soon be V1-only.

This is almost all fallout from retracting some of the moving headers from other headers i.e.:

GrMeshDrawOp.h from GrOpFlushState.h
GrDrawOp.h from GrOpsRenderPass.h
GrDrawOp.h from GrOpsTask.h
GrSimpleMeshDrawOpHelper.h from GrTessellationShader.h


Bug: skia:11837
Change-Id: I939f5c82c3042e9ab00571b5796ab82dbe968085
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/438677
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-08-12 15:09:11 +00:00
Brian Salomon
4895946078 Move ProgramImpl definitions into Processor subclass headers.
Move ProgramImpl function definitions into Processor subclass cpp files.

Delete separate h/cpp files.

Modify GrGLSLVaryingHandler::addPassThroughAttribute to break #include
cycle. It now takes a ShaderVar rather than a GP::Attribute, making
it slightly more flexible as the input can be any variable defined
in the vertex shader.

Bug: skia:11358
Change-Id: I94ee8cd44d29e194216592ecae5fd28de785c975
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/438596
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2021-08-11 19:45:56 +00:00
John Stiles
26487162fe Add support for array-cast syntax in SkSL.
Compiling a program with "allow narrowing conversions" actually fixes up
narrowing casts in the program by inserting casts wherever they would be
needed for type-correctness. For instance, compiling the statement
    `half h = myFloat;`
inserts an appropriate narrowing cast:
    `half h = half(myFloat);`.

The Pipeline stage code generator relies on this behavior, as when it
re-emits a runtime effect into a complete SkSL program, the narrowing-
conversions flag will no longer be set, but that is okay, because the
emitted code now contains typecasts anywhere they would be necessary.

Logically, this implies that anything which supports narrowing
conversions must be castable between high and low precision. In GLSL and
SPIR-V, such a cast is trivial, because the types are the same and the
precision qualifiers are treated as individual hints on each variable.
In Metal, we dodge the issue by only emitting full-precision types. But
we also need to emit raw SkSL from an SkSL program (that is what the
Pipeline stage generator does).

SkSL already supported every typical cast, but GLSL lacked any syntax
for casting an array to a different type. This meant SkSL had no array
casting syntax as well. SkSL now has array-cast syntax, but it is only
allowed for casting low/high-precision arrays to the same base type.
(You can't cast an int array to float, or a signed array to unsigned.)

Change-Id: Ia20933541c3bd4a946c1ea38209f93008acdb9cb
Bug: skia:12248
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/437687
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2021-08-11 12:56:40 +00:00
Robert Phillips
53eaa64873 Rename GrSurfaceContext -> skgpu::SurfaceContext
Almost entirely mechanical.

Bug: skia:11837
Change-Id: I984339097fdeeae2eccb6c1d790d510020511961
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/438177
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-08-10 19:24:53 +00:00
Michael Ludwig
b23630c509 Reland "Remove SkTLList"
This reverts commit 14b1d56a2b.

Reason for revert: fix emplace_back() usage

Original change's description:
> Revert "Remove SkTLList"
>
> This reverts commit e1d523d70f.
>
> Reason for revert: breaking old stdlib versions (< c17)
>
> Original change's description:
> > Remove SkTLList
> >
> > Change-Id: I198678b5cb298cf51872fbb8d4fd5d705a6b684e
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/437339
> > Reviewed-by: Brian Osman <brianosman@google.com>
> > Commit-Queue: Michael Ludwig <michaelludwig@google.com>
>
> TBR=brianosman@google.com,michaelludwig@google.com,skcq-be@skia-corp.google.com.iam.gserviceaccount.com
>
> Change-Id: I8e02e4cd2f293e7530f842be783de10f69be2ef4
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/438078
> Reviewed-by: Michael Ludwig <michaelludwig@google.com>
> Commit-Queue: Michael Ludwig <michaelludwig@google.com>

# Not skipping CQ checks because this is a reland.

Change-Id: Ied33ce81a8312963ff0713c4660cdb8541a02180
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/438080
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-08-10 17:57:41 +00:00
Michael Ludwig
14b1d56a2b Revert "Remove SkTLList"
This reverts commit e1d523d70f.

Reason for revert: breaking old stdlib versions (< c17)

Original change's description:
> Remove SkTLList
>
> Change-Id: I198678b5cb298cf51872fbb8d4fd5d705a6b684e
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/437339
> Reviewed-by: Brian Osman <brianosman@google.com>
> Commit-Queue: Michael Ludwig <michaelludwig@google.com>

TBR=brianosman@google.com,michaelludwig@google.com,skcq-be@skia-corp.google.com.iam.gserviceaccount.com

Change-Id: I8e02e4cd2f293e7530f842be783de10f69be2ef4
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/438078
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2021-08-10 14:53:52 +00:00
Michael Ludwig
e1d523d70f Remove SkTLList
Change-Id: I198678b5cb298cf51872fbb8d4fd5d705a6b684e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/437339
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2021-08-10 14:36:07 +00:00
Michael Ludwig
e1d0040c54 Delete GrClipStackClip and GrReducedClip
Bug: skia:10205
Change-Id: Iafee804751d69e98241a7825664f3be04b20eb14
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/436566
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2021-08-09 18:53:58 +00:00
Ben Wagner
51d83abcd2 Ease HarfBuzz API change with feature detection
Skia has been using the not entirely public HarfBuzz subsetting API.
This API is changing for public release. In order to make the transition
from old to new build flags were added, which would require build
changes as HarfBuzz is updated downstream. Instead detect the existence
of the old or new API and use whichever is present automatically.

Change-Id: I0727f97ad7d394dfb24553076d4b383570cf0002
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/437121
Reviewed-by: Garret Rieger <grieger@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2021-08-06 17:22:22 +00:00
John Stiles
2195f94a0c Add unit test for array narrowing conversions.
Change-Id: Ibadda2a10e19984c7a0efb66fd3187f280666445
Bug: skia:12248
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/436996
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2021-08-06 13:05:35 +00:00
John Stiles
e3f85e07fa Add improved regression test for oss-fuzz:36655.
Most of the code generated by the fuzzer is nonsense, but there is a
method to its madness. The crash is only triggered under specific
conditions:
- The runtime effect has enough helper functions to mostly fill up the
  call graph hash-map. It won't rehash until it gets close to capacity.
- There must be several calls to built-in functions, in order to add
  elements to the call graph to force a rehash.

The fuzzer-generated code manages to satisfy both these requirements.

Change-Id: I9a1d7535557fedd4e9bfece3930ac86ede291ffe
Bug: oss-fuzz:36655
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/437118
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-08-06 13:03:32 +00:00
John Stiles
e3ae968f5f Enable comparison of arrays of different precision types.
GLSL allows an array of `lowp float` to be compared against `highp
float` seamlessly because the types are considered to be the same. SkSL,
however, treats these as different types, so we need to coerce the types
to allow this comparison to work.

In other words, these comparisons can cause an array to be implicitly
casted. The expression `myHalf2Array == float[2](a, b)` should be
allowed when narrowing conversions are enabled. To allow this to work,
we need a dedicated IR node representing this type coercion.

We now allow implicit coercion of array types when the array's component
types would be implicitly coercible, and have a new IR node representing
that implicit conversion.

This CL fixes array comparisons, but array assignment needs additional
fixes. It currently results in:
    "type mismatch: '=' cannot operate on (types)".

Bug: skia:12248
Change-Id: I99062486c081f748f65be4b36a3a52e95b559812
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/436571
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2021-08-06 12:57:10 +00:00
Garret Rieger
66684b17b3 Roll HarfBuzz from 2.6.4 to 2.8.2-147
3a74ee5282..368e957887

Additionally adds a build option that switches to the new
harfbuzz subsetting api which is coming in the next version
of harfbuzz.

Change-Id: I924a7b4978412d636d4c8d19f5c6021ea3c73d21
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/433737
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2021-08-06 02:54:40 +00:00
John Stiles
9ae6ea0711 Fix fuzzer-discovered error with swizzling matrices.
The optimization logic for swizzling a constructor assumed that every
argument to the constructor was a scalar or vector. When it was written,
this assumption was true. However, we recently added support for casting
mat2x2 to float4 which violates the assumption.

We now check every argument and do not attempt to optimize if a
non-scalar, non-vector arg is found.

Change-Id: Ia2b297bd62dfdf4af56712164fbc80c29c9611eb
Bug: oss-fuzz:36852
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/437017
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2021-08-05 21:59:23 +00:00
Robert Phillips
5ac7f33281 Add V2 SFC and SDC stubs
Bug: skia:11837
Change-Id: Id7aa117af3e026d71caeed3ee6489394e869eed1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/436568
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-08-05 21:54:18 +00:00
John Stiles
ded41aafb2 Fix fuzzer-discovered error with SPIR-V interface arrays.
OSSFuzz discovered a minor variation of oss-fuzz:36770 which tickled a
different bug in SPIR-V RTFlip handling; we did not properly handle the
case where the InterfaceBlock is an array. SPIR-V does not support this
at all, but the IRGenerator allows it, and we don't detect it an an
error until later in the compilation process.

Change-Id: I80bd67a13dad878717dc122462132a2ed675532d
Bug: oss-fuzz:36850
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/437018
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2021-08-05 21:44:16 +00:00
John Stiles
b806da4501 Honor lowp/mediump/highp precision qualifiers in IRGenerator.
This CL does not update the DSLParser to honor these precision
qualifiers; that will be done in a followup.

Change-Id: Ib629bc99c0e6c7afb550a381d4e3b6ccc26aa64e
Bug: skia:12248
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/436337
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2021-08-04 21:29:10 +00:00
John Stiles
020143148f Add parser support for highp/mediump Tokens in vardecls.
These parse into new modifier bits; the IR generator does not yet
support these bits. That's coming in a followup CL.

Change-Id: I362e9227694f9b862eaad100f6afca45a9b62a01
Bug: skia:12248
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/436336
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2021-08-04 21:11:14 +00:00
Robert Phillips
f3868628f9 Fission GrSurfaceFillContext into skgpu:: and skgpu::v1:: versions (take 2)
The only really interesting parts are:
  src/gpu/SurfaceFillContext.*
  src/gpu/v1/SurfaceFillContext.*

Everything else is mostly mechanical.

TBR=michaelludwig@google.com
Bug: skia:11837
Change-Id: Ia208e9a73d1529804c06d4f805d8ca3674851496
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/436558
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-08-04 19:40:55 +00:00
John Stiles
9fdcc517b2 Write test demonstrating bug with array narrowing conversions.
We don't currently support this. There's no explicit syntax to cast an
array's type, but it can be implicitly required in some situations, like
`halfArray == floatArray` (when fAllowNarrowingConversions is on).

Change-Id: I00fe0ddd4f2682b2950e828dd78bb941d5f0430e
Bug: skia:12248
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/436560
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-08-04 18:34:18 +00:00
Derek Sollenberger
40b82c6b5c Revert "Fission GrSurfaceFillContext into skgpu:: and skgpu::v1:: versions"
This reverts commit af844c79d5.

Reason for revert: breaking chrome roller

Original change's description:
> Fission GrSurfaceFillContext into skgpu:: and skgpu::v1:: versions
>
> The only really interesting parts are:
>   src/gpu/SurfaceFillContext.*
>   src/gpu/v1/SurfaceFillContext.*
>
> Everything else is mostly mechanical.
>
> Bug: skia:11837
> Change-Id: If2945f30dadd6ad0cccf6ff2b53e4a92b1dc6cbc
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/436099
> Commit-Queue: Robert Phillips <robertphillips@google.com>
> Reviewed-by: Michael Ludwig <michaelludwig@google.com>

TBR=robertphillips@google.com,michaelludwig@google.com,skcq-be@skia-corp.google.com.iam.gserviceaccount.com

Change-Id: I3b2d1d4a30e253a107f55dc3c5ecaaee5386e6e8
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:11837
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/436557
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Derek Sollenberger <djsollen@google.com>
2021-08-04 17:15:45 +00:00
Robert Phillips
af844c79d5 Fission GrSurfaceFillContext into skgpu:: and skgpu::v1:: versions
The only really interesting parts are:
  src/gpu/SurfaceFillContext.*
  src/gpu/v1/SurfaceFillContext.*

Everything else is mostly mechanical.

Bug: skia:11837
Change-Id: If2945f30dadd6ad0cccf6ff2b53e4a92b1dc6cbc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/436099
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2021-08-04 14:30:10 +00:00
Leon Scroggins III
86b2c952ae Update gn_to_bp_utils to support python3
Python2 is going away, so update the script to run with python3.

Change-Id: I8c1aad12ecf8ae1bde67a1ad5486bf6feb1c04d1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/436098
Reviewed-by: Ravi Mistry <rmistry@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
2021-08-03 17:52:43 +00:00
Robert Phillips
46eb3ab80d Make v1/SurfaceDrawContext V1-only
The GrFillRectOp and GrTextureOp guards are temporary - just until they are made V1-only.

The SkGlyphRunPainter and GrTextBlob guards are going to linger since both will probably exist in both versions.

The GrTextBlob guards mainly hide the draw and makeAtlasTextOp methods.

Bug: skia:11837
Change-Id: Icc19d664bb4d93962bf63386dc59fe176cc61ea1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/434044
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-08-03 16:07:22 +00:00
John Stiles
e9dcbfdaa1 Add test for Runtime Effects and narrowing conversions.
This code intentionally mixes half4s and float4s everywhere. Before
http://review.skia.org/435916 landed, this resulted in a compile error.

Change-Id: I852fef6ee99a8b78623e0e9ddeee2ad84a8c0504
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/436058
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-08-03 15:58:46 +00:00
Robert Phillips
a3f206e0b8 Non-substantive changes for making v1::SurfaceDrawContext V1-only
Bug: skia:11837
Change-Id: I60112e370c95e6f9d9bc12cb9b05d40dd2220bc9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/435279
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2021-08-02 19:22:58 +00:00
John Stiles
d7437eec2e Fix for fuzzer-discovered error in SPIR-V with RTFlip.
SPIR-V code generation synthesizes some extra variables that don't
actually exist in the Program. Checking the ProgramUsage of these
variables would fail; ProgramUsage::get doesn't know about these
variables, so it asserts (and would consider them as dead even if it
didn't assert). We now track our SPIR-V bonus variables in a separate
set, and always report them as live.

Change-Id: If2f681470654025abf7ca4b3ec8126de2eb01297
Bug: oss-fuzz:36770
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/435625
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-08-02 17:13:50 +00:00
John Stiles
68c9325263 Create test case to repro skia:12212.
Change-Id: I2dde12b262f51b00a95eb26f87b85c3f5a19b45b
Bug: skia:12212
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/428961
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2021-07-30 17:41:13 +00:00
Robert Phillips
1a2e7de8ea Update tests for a V1-only skgpu::v1::SurfaceDrawContext
Bug: skia:11837
Change-Id: If8dd864d6cd8bc5ab9569fbab40866e1810dbc27
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/434162
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-07-30 16:33:41 +00:00
John Stiles
131410a7d1 Add regression test for oss-fuzz:36655.
Change-Id: I7b53df1eae83a596c4d1f3620e7f9bd146f68af2
Bug: oss-fuzz:36655
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/434465
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-07-29 15:22:20 +00:00
Robert Phillips
4dca83162b Rename GrSurfaceDrawContext to skgpu::v1::SurfaceDrawContext
This CL is mostly mechanical. It:

replaces "src/gpu/GrSurfaceDrawContext.h" #includes with
         "src/gpu/v1/SurfaceDrawContext_v1.h" and reorders

replaces "class GrSurfaceDrawContext;" with
         "namespace skgpu { namespace v1 { class SurfaceDrawContext; }}"

replaces "GrSurfaceDrawContext*" with "auto" where possible
replaces "rtc" with "sdc"
replaces "surfaceDrawContext" with "sdc"
replaces GrSurfaceDrawContext with skgpu::v1::SurfaceDrawContext
reflows parameters as needed

This CL does not try to:

make skgpu::v1::SurfaceDrawContext V1-only
minimize the skgpu and/or skgpu::v1 prefixes

Those two tasks will be accomplished in follow up CLs. This CL is just trying to get the bulk of the mechanical changes comprehensibly landed.

Bug: skia:11837
Change-Id: I6fe59080249d585df8f5d27c6b67569cdc35842f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/433156
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2021-07-28 20:12:10 +00:00
Herb Derby
5992f9eb43 draw vertices: fast triangles using a shader
Introduce a new call to SkShaderBase to return an
SkUpdatableShader. An SkUpdatableShader is both a SkShaderBase
and has an update() method.

If the onUpdatableShader call returns !nullptr, then the
shader's specialized updatable shader is used. Otherwise,
the shader is wrapped in a TexCoordShader.

This scheme allows Shaders to have specialized updaters,
but also adds updaters for shaders that don't need
specialization.

orig  this  bench
771µs 779µs verts_textures_colors
217µs 335µs verts_textures
275µs 380µs verts_textures_persp

Bug=skia:11822

Change-Id: I11ba344eba96188c5631228cd5e91c5d834ea3d6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/429417
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2021-07-28 18:08:35 +00:00
Brian Osman
310178c7b7 Microbench for canvas save/restore calls
Change-Id: I0dbf1af17c3a7ec70437e0479cd8b6b6269d155c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/433476
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-07-27 21:08:11 +00:00
Chris Dalton
6966981ae0 Add a 'pathMatrix' to GrPathTessellator::prepare
The pathMatrix is applied on the CPU while the geometry is being
written out. It is a tool for batching, and is applied in addition to
the shader's on-GPU matrix. This CL also updates GrPathStencilCoverOp
do do all its path transformations with pathMatrix on the CPU side.
The next step will be for atlases to use the pathMatrix instead of
creating uber paths.

Bug: skia:12258
Change-Id: Ib924dfb06a2c0eed8f9045adc6ae9eefad510082
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/433236
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2021-07-27 20:31:57 +00:00
Robert Phillips
400f52e691 Retract GrSurfaceDrawContext.h a bit
This CL just pulls GrSurfaceDrawContext.h out of headers and .cpp files where possible.

TBR=brianosman@google.com
Bug: skia:11837
Change-Id: Ib96f3619e3a50091516f81ae48f956fe83c05aff
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/431384
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2021-07-26 18:28:04 +00:00
Jim Van Verth
6a54042bcd Add GrMtlRenderPipeline.
Creates a wrapper class just for id<MTLRenderPipelineState> so it can
be managed as a command buffer object.

Bug: skia:12253
Change-Id: Ibef833fda25d00e7b3110c17b59c5e760b523473
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/431040
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2021-07-26 15:11:41 +00:00
Robert Phillips
04f22eacaa Feed all top-level GPU accessors through skgpu::BaseDevice (take 2)
This pulls the GPU-specific accessors off of SkCanvas and SkDevice - moving them all to skgpu::BaseDevice and SkCanvasPriv.

This will allow us to more easily change the gpu class hierarchy (esp. changing GrSurfaceDrawContext to skgpu::v1:SurfaceDrawContext) w/o churning the public API.

TBR=brianosman@google.com
Bug: skia:11837
Change-Id: Ib69a3ea27c840fa7758bc3318395a27228c7ae9d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/431539
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-07-26 14:56:37 +00:00
John Stiles
bb2ef92d05 Add private blender type to SkSL built-in types.
This type will hold blender objects, similar to color filters and
shaders. Since the implementation is not yet complete, the type is
currently named `$blender` to indicate that it's private/inaccessible.
The $ will be removed once sampling is functional.

Many places which were conditioned on "is a color filter or shader" are
now conditioned on a helper method instead; if we ever add another
runtime effect type in the future, there should be less hunting for
places that need to be fixed.

Change-Id: I207219abf8764906c3612ce8896492c7a2af6ea1
Bug: skia:12257
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/432259
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-07-26 13:10:42 +00:00
Brian Osman
7da0657fda Explicitly detect static recursion in SkSL
This relaxes our rules to allow calls to declared (but not yet defined)
functions. With that rule change, we have to specifically detect static
recursion and produce an error.

Bug: skia:12137
Change-Id: I39cc281fcd73fb30014bc7b43043552623727e03
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/431537
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-07-24 00:01:15 +00:00
Chris Dalton
c3176002bc Lift the tessellation atlas into its own path renderer
Creates a new path renderer, GrAtlasPathRenderer, that handles all the
atlasing. Managing the atlas in its own path renderer gives us more
control over when atlasing happens in the chain, will allow us to more
easily use the atlas in kCoverage mode, and makes the clipping code
cleaner.

Bug: skia:12258
Change-Id: Ie0b669974936c23895c8ab794e2d97206ed140f8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/431896
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2021-07-23 23:02:58 +00:00
Robert Phillips
d91d2341b9 Revert "Feed all top-level GPU accessors through skgpu::BaseDevice"
This reverts commit 5de8b19504.

Reason for revert: blocking Android roll

Original change's description:
> Feed all top-level GPU accessors through skgpu::BaseDevice
>
> This pulls the GPU-specific accessors off of SkCanvas and SkDevice - moving them all to skgpu::BaseDevice and SkCanvasPriv.
>
> This will allow us to more easily change the gpu class hierarchy (esp. changing GrSurfaceDrawContext to skgpu::v1:SurfaceDrawContext) w/o churning the public API.
>
> Bug: skia:11837
> Change-Id: I4e205255706680ac58ffe40f714884c2ee7ac799
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/431036
> Reviewed-by: Brian Osman <brianosman@google.com>
> Reviewed-by: Michael Ludwig <michaelludwig@google.com>
> Commit-Queue: Robert Phillips <robertphillips@google.com>

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

Change-Id: I8a015be4edbe21d63db09d5593af13cc89df4217
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:11837
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/431538
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-07-22 18:56:51 +00:00
Robert Phillips
5de8b19504 Feed all top-level GPU accessors through skgpu::BaseDevice
This pulls the GPU-specific accessors off of SkCanvas and SkDevice - moving them all to skgpu::BaseDevice and SkCanvasPriv.

This will allow us to more easily change the gpu class hierarchy (esp. changing GrSurfaceDrawContext to skgpu::v1:SurfaceDrawContext) w/o churning the public API.

Bug: skia:11837
Change-Id: I4e205255706680ac58ffe40f714884c2ee7ac799
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/431036
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-07-22 16:47:30 +00:00
Brian Osman
fb212256ca Improve tests/comments, to prepare for calling functions before definition
Bug: skia:12137
Change-Id: I609dd2578bf39a30e036ea85281886f8c4554579
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/431038
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-07-22 13:19:39 +00:00
Mike Reed
aebe248575 SkFilterQuality is gone.
Bug: skia:11235
Change-Id: Iefa0156f542f217e687299f053768ee5b87f84d7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/430977
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2021-07-22 12:41:49 +00:00
Robert Phillips
7a0d3c3f12 Revise GM infrastructure to not rely on GrSurfaceDrawContext
The SDC will soon be V1-only. Remove it from the generic testing infrastructure and require each V1-specific GM to explicitly retrieve it.

Bug: skia:11837
Change-Id: I4c904b7e333333382062bde4b17a1f9f81bee6a9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/430425
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2021-07-21 20:59:37 +00:00
John Stiles
b6a7319f21 Add tokens for highp/mediump/lowp.
At present, they aren't hooked up to anything. They will be made
functional in followup CLs.

Change-Id: I4bfc25eb4e19fce4c36ea0b55494bf37b2a9ee23
Bug: skia:12248
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/430637
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2021-07-21 15:41:20 +00:00
Herb Derby
a7a9443104 rename the VM blitter to SkVMBlitter
Change-Id: I71ae924d32dc2268cc4a3db1920c08287533f9ae
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/430697
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2021-07-21 15:32:19 +00:00
Robert Phillips
259b46894d Reduce GrOnFlushResourceProvider's functionality
The main goal of this CL was to remove GrOnFlushResourceProvider::makeSurfaceDrawContext (which was only being used in the OnFlushCallbackTest) to allow simpler modifications to GrSurfaceDrawContext. It looks like there was a lot more unused stuff here though.

Bug: skia:11837
Change-Id: Idbc4001c58a4e8456bffcf1bac32150f2452fb56
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/430043
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-07-20 20:47:34 +00:00
Ethan Nicholas
dd2fdea9c2 Initial land of DSLParser
The DSLParser is an alternative to the existing SkSLParser which goes
directly to IR code using the SkSL DSL. It is substantially faster and
simpler than the existing parser->IRGenerator pipeline, but not yet
feature complete nor fully tested.

Change-Id: Iee45e9b527a3b88faa2ea74fc512051c8a38c5d4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/400622
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-07-20 20:28:54 +00:00
Jim Van Verth
960a4f89bb Add GrMtlFrameBuffer.
Sets up creation of the framebuffer object from the current render
target and adds it to the OpsRenderPass.

Bug: skia:12186
Change-Id: I08984553bcef2afcf3003d3f59e40c2fa9e383a9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/430042
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2021-07-20 19:22:01 +00:00
Robert Phillips
e40495da3d Untangle GrSurfaceDrawContext.h, GrTextureOp.h and GrFillRectOp.h
The dependencies between these headers made modifying the SDC and Ops separately somewhat difficult.

Bug: skia:11837
Change-Id: I0c3ca118ce206bf8db5b6753be1ef46531ae1f58
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/430041
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-07-20 17:09:21 +00:00
Brian Osman
946a4cb8ac First pass at a no-SkSL CPU build
This just disables everything that depends on SkSL today:

- Color filters:
  - HighContrast
  - Lerp
  - Luma
  - Overdraw
- Skottie effects:
  - BlackAndWhite
  - BrightnessContrast
  - DisplacementMap
  - FractalNoise
  - Sphere
  - Threshold
  - GradientColorFilter (indirectly, this uses ColorFilters::Lerp)

Cq-Include-Trybots: luci.skia.skia.primary:Canary-Android,Canary-Chromium,Canary-Flutter,Canary-G3
Bug: skia:12197
Change-Id: I26269bd4423897142b8f2fdcc4ab1b274e767cba
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/427376
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2021-07-19 21:19:51 +00:00
Mike Reed
01e6273c46 rm flutter support for filterquality
Change-Id: Ibcae9d2378d136ce15e3284f679e71b42f1ba32d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/429337
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2021-07-17 14:39:38 +00:00
Mike Reed
11a20bbbf4 rm getblendmode flag for flutter
Change-Id: Id578c5dbf7f0f4274d43b3ae8a7cfb50d3563cc3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/429376
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2021-07-17 13:53:45 +00:00
John Stiles
f2de1b8b4d Fix crash when drawing a GPU-backed surface onto raster.
We now null-check the result of recordingContext() before using it.

Thanks cqjjjzr2@gmail.com for the initial discovery and suggested fix.

Change-Id: Iafcf306f8cd9deb7147ef9c5c71a21907eedc01f
Bug: skia:12214
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/429098
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-07-16 15:12:43 +00:00
John Stiles
0397ae4e15 Reland "Add unit test confirming Runtime Blends match native blends."
This is a reland of 0b62a05d9a

Original change's description:
> Add unit test confirming Runtime Blends match native blends.
>
> We perform the same draw operation twice--once with a `setBlendMode`
> based blend, and then once more with `setBlender` and passing SkSL which
> is equivalent to the native blend op. If this test fails, it would
> indicate that Runtime Blends aren't being applied appropriately (or
> perhaps that a GPU's built-in blending modes are cutting corners?).
>
> Change-Id: I4ca1f9ed600d9ec733687cc6de7d3e2eb6e765c9
> Bug: skia:12080
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/428318
> Auto-Submit: John Stiles <johnstiles@google.com>
> Reviewed-by: Mike Reed <reed@google.com>
> Commit-Queue: John Stiles <johnstiles@google.com>

Bug: skia:12080
Change-Id: Idf4297314b133e5bce689a25d53063bff8469fac
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/428676
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-07-15 15:19:14 +00:00
Mike Reed
0547b914f6 Revert "Add unit test confirming Runtime Blends match native blends."
This reverts commit 0b62a05d9a.

Reason for revert: GetRuntimeBlendForBlendMode not found in google3

Does the new file that contains that not appear in google3's build?

Original change's description:
> Add unit test confirming Runtime Blends match native blends.
>
> We perform the same draw operation twice--once with a `setBlendMode`
> based blend, and then once more with `setBlender` and passing SkSL which
> is equivalent to the native blend op. If this test fails, it would
> indicate that Runtime Blends aren't being applied appropriately (or
> perhaps that a GPU's built-in blending modes are cutting corners?).
>
> Change-Id: I4ca1f9ed600d9ec733687cc6de7d3e2eb6e765c9
> Bug: skia:12080
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/428318
> Auto-Submit: John Stiles <johnstiles@google.com>
> Reviewed-by: Mike Reed <reed@google.com>
> Commit-Queue: John Stiles <johnstiles@google.com>

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

Change-Id: Idd5ca97cfc4b642d3f97fdbd1fe9bd108b56e3a6
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:12080
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/428617
Reviewed-by: Mike Reed <reed@google.com>
2021-07-15 00:50:14 +00:00
John Stiles
0b62a05d9a Add unit test confirming Runtime Blends match native blends.
We perform the same draw operation twice--once with a `setBlendMode`
based blend, and then once more with `setBlender` and passing SkSL which
is equivalent to the native blend op. If this test fails, it would
indicate that Runtime Blends aren't being applied appropriately (or
perhaps that a GPU's built-in blending modes are cutting corners?).

Change-Id: I4ca1f9ed600d9ec733687cc6de7d3e2eb6e765c9
Bug: skia:12080
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/428318
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-07-14 21:51:03 +00:00
Robert Phillips
a92913e169 Make GrAuditTrail V1-only
This CL has some rough edges since some classes that use it (e.g., GrOpsTask) aren't yet V1-only. That said, the big CL has to be broken up somehow.

Bug: skia:11837
Change-Id: I41ed9982ca4664f893e447ba23c7aec59f42c964
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/426416
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-07-13 13:56:53 +00:00
John Stiles
ce7cdcd7b4 Add test for SkSL vector-slice constructors.
SkSL does not support shrinking a vector via casting. Use a swizzle
instead.

Change-Id: Ieba78a05dad9c55f44c765924e28f0c7e1667a67
Bug: skia:12193
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/427198
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2021-07-12 20:33:44 +00:00
Mike Reed
5643e55f09 Add flag for filterquality in flutter
Change-Id: I8612d58efcfac82b7924c680fd8fa91b6d48614f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/426956
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2021-07-12 20:09:30 +00:00
John Stiles
7f56b41fc0 Add scalar-swizzling tests for int and bool types.
Boolean scalar-swizzling is currently not working.

Change-Id: Icd965e4b64a12311d098168f65622110d5fb3437
Bug: skia:12195
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/427038
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-07-12 19:54:40 +00:00
John Stiles
49c417621b Shore up matrix/vector conversion tests.
The tests now check bool4-mat2 conversions, which fortunately do work,
and the vector-to-matrix tests include int and bool conversions as well.

Change-Id: I971271838a93081b9258deb7c1d13b7732fb2440
Bug: skia:12067
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/426757
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2021-07-12 15:02:51 +00:00
John Stiles
f9ad6ec852 Add support for mat2-to-ivec4 conversions in SkSL.
The fuzzer quickly discovered that the newly introduced mat2-to-vec4
conversion code did not account for integer vectors. We now handle
`ivec4(mat2)` casts properly. This required some non-trivial
restructuring of the logic, but in the vast majority of cases, the types
will match and the end result will be identical.

Change-Id: If07c2fe4b4345bd767384b1802374910f65cd3f0
Bug: oss-fuzz:35998
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/426756
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-07-12 14:09:18 +00:00
Mike Reed
c98dbc6410 Hide deprecated SkPaint::getBlendMode
Callers should use asBlendMode or getBlendMode_or

Bug: skia:12173
Change-Id: I8b62527a2ae11c9bf0c1473c4fffa53b38aa7017
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/425756
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Yegor Jbanov <yjbanov@google.com>
2021-07-11 17:14:21 +00:00
Brian Osman
bc35495729 Fix python3 issue in compile_sksl_tests.py
Change-Id: I755364b84dabed40a3b54d2f0cc0bc5efde1451f
Bug: skia:12134
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/426537
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-07-09 20:54:07 +00:00
John Stiles
9191e813a0 Enforce consistency in swizzle domains.
GLSL disallows mixing swizzle domains within a single swizzle:
http://screen/93eHNQDbx35hMdk
SkSL now disallows it as well.

Change-Id: Ied2e11ee04285b143a864e28cac30335f01aad0e
Bug: skia:10621
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/426458
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-07-09 20:30:22 +00:00
John Stiles
6de2e1db03 Add support for matrix-to-vector conversions in SkSL.
GLSL supports casting vec4 into mat2 and vice versa, so SkSL should have
equivalent support. This CL allows the Compound constructor to take a
matrix as input, and fixes up backends to do the right thing when a
matrix shows up in the compound-constructor path.

Change-Id: I13289ad0a27ba59bddc3706093820594efebc693
Bug: skia:12067
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/426003
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-07-09 17:55:22 +00:00
Brian Osman
c9145f3402 Remove enum support from SkSL
Bug: skia:11296
Change-Id: I7d41614957d6fa535faadebbeca890b54b6977ac
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/425996
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2021-07-09 14:03:15 +00:00
John Stiles
5a825da698 Reland "Add tests for matrix-vector conversions."
This reverts commit f009db5b85.

Reason for revert: test disabled on Win10 + Intel 4400/6100

Original change's description:
> Revert "Add tests for matrix-vector conversions."
>
> This reverts commit a89781215a.
>
> Reason for revert: breakage on Windows
>
> Original change's description:
> > Add tests for matrix-vector conversions.
> >
> > GLSL supports casting vec4 into mat2 and vice versa, so SkSL should have
> > equivalent support. Adding tests as a starting point.
> >
> > Change-Id: If8bcbf99afcec94d948d5da9e6205cb4a232af18
> > Bug: skia:12067
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/425837
> > 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: I2563041f538b1b20074385f1b61af5fc506ffad5
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:12067
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/426057
> Reviewed-by: John Stiles <johnstiles@google.com>
> Commit-Queue: John Stiles <johnstiles@google.com>

Bug: skia:12067
Change-Id: I1379914ee39ce340f09b11b3754820db9c645378
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/426058
Reviewed-by: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-07-08 23:28:22 +00:00
Chris Dalton
b1fd64e82e Extract a GrAtlasInstancedHelper subclass
This helper will allow other GPs that use instancing to also clip
against an atlas.

Bug: chromium:928984
Change-Id: I5a3bb221220bace46c6c9d799c2db68e2a2c67b7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/425979
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-07-08 22:31:24 +00:00
John Stiles
f009db5b85 Revert "Add tests for matrix-vector conversions."
This reverts commit a89781215a.

Reason for revert: breakage on Windows 

Original change's description:
> Add tests for matrix-vector conversions.
>
> GLSL supports casting vec4 into mat2 and vice versa, so SkSL should have
> equivalent support. Adding tests as a starting point.
>
> Change-Id: If8bcbf99afcec94d948d5da9e6205cb4a232af18
> Bug: skia:12067
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/425837
> 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: I2563041f538b1b20074385f1b61af5fc506ffad5
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:12067
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/426057
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-07-08 21:46:40 +00:00
John Stiles
a89781215a Add tests for matrix-vector conversions.
GLSL supports casting vec4 into mat2 and vice versa, so SkSL should have
equivalent support. Adding tests as a starting point.

Change-Id: If8bcbf99afcec94d948d5da9e6205cb4a232af18
Bug: skia:12067
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/425837
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-07-08 18:36:07 +00:00
Robert Phillips
72354b0593 Move more gms and tests into the V1-only pile
Making GrDrawRandomOp and test_ops V1-only drags several GMs and tests with them. All the other GMs/tests explicitly require Ops.

Bug: skia:11837
Change-Id: I45c0a1054c3b1ec43f509595c6492581d10314cf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/425016
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-07-08 17:38:36 +00:00
Mike Reed
26ea975e6c Arithmetic blender
... to aid in removing special ArithmeticImageFilter.

Can we use something like this to reimpl the ArithmeticImageFilter
--> BlenderImageFilter?

I see some special checking in filterBounds for ArithIF -- is that
required? Is that generalizable for any BlenderImageFilter?
If we can generalize blend[er]imagefilter, let's just move this
logic into Chrome -- no need for Arithmetic to appear in Skia
in any form!

Re: https://skia-review.googlesource.com/c/skia/+/424436

Change-Id: Ifa0ff2fa25de6385f6f60505e73ecc28463a80b3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/424417
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2021-07-08 17:06:17 +00:00
Brian Osman
8c26479048 Remove large swaths of code related to .fp files
Change-Id: Id2061ebe7873aa8b9480a2d8b0133c2fb79e79bb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/424098
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-07-08 16:53:47 +00:00
Brian Osman
ed5181e7bf Remove .fp tests and build steps
Change-Id: I4066aafc5b6137bfaf38100ff237fd9833023f34
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/424097
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-07-08 16:47:40 +00:00
Brian Osman
07bf3881e7 Convert binary unrolled gradient colorizer to GrSkSLFP
Change-Id: I28eb4479476a531a7b45fbef0ce9da72a4d29dc1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/423997
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-07-08 13:48:05 +00:00
Brian Osman
4c886ee15a Revert "Revert "Convert GrConfigConversionEffect to a runtime FP""
This reverts commit 1c467774e5.

Change-Id: Iad409002ddd71f0c26117e5a0814bf021fba8178
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/425186
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-07-07 20:17:26 +00:00
Tyler Denniston
2dc2859c70 flutter: add build flag to stage stroking change
Bug: skia:11964
Change-Id: Ie7771ec2fd84f400a2360d81a7fd6c468f499dc5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/425179
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Tyler Denniston <tdenniston@google.com>
2021-07-07 17:54:12 +00:00
Jim Van Verth
758d81f715 Reland "Metal: Add labels to help with GPU Debugging"
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>

Bug: skia:12150

Change-Id: I4bc686b7fdb1b929dbfdb2dd12fb5170fc9b36a2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/425185
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2021-07-07 17:36:52 +00:00
Brian Salomon
d8d85b9b89 Reland "Don't key progams/pipelines on origin.""
Reland works around Adreno issue with this formulation of sk_Clockwise:
 (sk_RTFlip.y < 0.0 ? !gl_FrontFacing : gl_FrontFacing)

and instead adds this to the top of the function:
 bool sk_Clockwise = gl_FrontFacing;
 if (sk_RTFlip.y < 0.0) {
      sk_Clockwise = !sk_Clockwise;
 }

Original description:

SkSL language features that are origin sensitive now use a uniform
to conditionally flip their result rather than generating different
code.

Previously we would insert a "rt height" uniform if sk_FragCoord needed
to be flipped. sk_FragCoord,y was implemented as "realFragCoord.y" or
"rtHeight - realFragCoord.y" depending on SkSL::ProgramSettings::fFlipY.

Now we instead use a two component vector rtFlip and sk_FragCoord.y is
always "rtFlip.x + rtFlip.y*realFragCoord.y". We configure rtFlip as
either (0, 1) or (rtHeight, -1). sk_Clockwise and dFdy simiarly use
rtFlip.y to emit code that always works with either origin.

Bug: skia:12037
Change-Id: I3a2ad6f5667eb4dcd823b939abd5698f89b58929
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/425178
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2021-07-07 14:50:10 +00:00
Brian Salomon
40242241c3 Revert "Don't key progams/pipelines on origin."
This reverts commit 943108b0b2.

Reason for revert: clockwise GM bad on android.

Original change's description:
> Don't key progams/pipelines on origin.
>
> SkSL language features that are origin sensitive now use a uniform
> to conditionally flip their result rather than generating different
> code.
>
> Previously we would insert a "rt height" uniform if sk_FragCoord needed
> to be flipped. sk_FragCoord,y was implemented as "realFragCoord.y" or
> "rtHeight - realFragCoord.y" depending on SkSL::ProgramSettings::fFlipY.
>
> Now we instead use a two component vector rtFlip and sk_FragCoord.y is
> always "rtFlip.x + rtFlip.y*realFragCoord.y". We configure rtFlip as
> either (0, 1) or (rtHeight, -1). sk_Clockwise and dFdy simiarly use
> rtFlip.y to emit code that always works with either origin.
>
> Bug: skia:12037
>
> Change-Id: I7a09d0caac60a58d72b76645ff31bcabde4086b6
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/414796
> Commit-Queue: Brian Salomon <bsalomon@google.com>
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Reviewed-by: Ethan Nicholas <ethannicholas@google.com>

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

Change-Id: I91cc0d86be216f6c32e453a231de088c991be4b2
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:12037
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/425056
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2021-07-06 19:21:26 +00:00
Robert Phillips
cc44feb654 Start using skgpu::v1 and skgpu::v2 namespaces
Bug: skia:11837
Change-Id: I042775dae34c99c20048d6d70aa6f06b2a6a268b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/424117
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-07-06 18:28:54 +00:00
Brian Salomon
943108b0b2 Don't key progams/pipelines on origin.
SkSL language features that are origin sensitive now use a uniform
to conditionally flip their result rather than generating different
code.

Previously we would insert a "rt height" uniform if sk_FragCoord needed
to be flipped. sk_FragCoord,y was implemented as "realFragCoord.y" or
"rtHeight - realFragCoord.y" depending on SkSL::ProgramSettings::fFlipY.

Now we instead use a two component vector rtFlip and sk_FragCoord.y is
always "rtFlip.x + rtFlip.y*realFragCoord.y". We configure rtFlip as
either (0, 1) or (rtHeight, -1). sk_Clockwise and dFdy simiarly use
rtFlip.y to emit code that always works with either origin.

Bug: skia:12037

Change-Id: I7a09d0caac60a58d72b76645ff31bcabde4086b6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/414796
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2021-07-06 18:08:06 +00:00
Brian Osman
e9ab391765 Reland "Convert GrDitherEffect to a runtime FP"
This reverts commit 3dd52c758b.

Change-Id: Ie873ad570ffc57b3edd6ffe8612cbc2c73d40450
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/424259
Reviewed-by: Brian Osman <brianosman@google.com>
2021-07-02 17:33:15 +00:00
Brian Osman
1c467774e5 Revert "Convert GrConfigConversionEffect to a runtime FP"
This reverts commit 4a77813008.

Reason for revert: Memory regression in Chrome.

Original change's description:
> 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>

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

Change-Id: I05497295b88b378f0aa236f18118fe676bbf05c9
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/424256
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-07-02 13:11:40 +00:00
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