Commit Graph

3375 Commits

Author SHA1 Message Date
Brian Osman
5ef3f98ead Do some renaming of "intrinsic" throughout SkSL
Trying to land on more consistent terminology:
- builtin: Any symbol or program element that's declared in the one of
           the modules/pre-includes.
- intrinsic: The specific functions that are declared, but not defined
             in the modules. These are implemented by the generators.
- builtin functions: Use this to refer to functions that are both
                     declared and defined in the modules. (eg unpremul)

Note that Module is still a term, and that may go away as well. This was
focused on reducing overloaded terminology around the elements
themselves (and not referring to things like "unpremul" as an intrinsic,
in the case of "referencedIntrinsics").

Change-Id: I2b55c4628e9263a7f7a4faad005a653592e9724c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/484677
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-12-15 18:47:03 +00:00
Herb Derby
5b9ecb9d8f Remove SkRemoteGlyphCache.h
SkRemoteGlyphCache has been moved to include/private/chromium, and
renamed SkChromeRemoteGlyphCache. As of Chromium CL:
https://chromium-review.googlesource.com/c/chromium/src/+/3335057,
src/core/SkRemoteGlyphCache.h is no longer used, and can be removed.

Change-Id: I5546c55d8edc41875fcfce05b33618a9cf6456e8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/484339
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2021-12-15 15:04:07 +00:00
Herb Derby
8dc9a337ab rename GrTextBlobCache to GrTextBlobRedrawCoordinator
Change-Id: Ib1ea2936f7a9431bc62c04b1931cf6da2c213b36
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/483496
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2021-12-13 17:38:00 +00:00
Jim Van Verth
db9f95c888 Move ShaderUtils out of Ganesh.
This will allow us to use ShaderUtils in both Ganesh and Graphite.

Change-Id: I78e34c4eb969a0d827c459d7fb945d17fdc22efa
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/482696
Reviewed-by: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2021-12-10 23:10:25 +00:00
John Stiles
5d5f24e814 Move SkVMDebugTrace into src/sksl/tracing.
Change-Id: Id4fc455f0eb23aa8d9b6f5474be7f6eba71c48de
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/482698
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-12-10 21:58:01 +00:00
John Stiles
f3b4617828 Create SkVMDebugTrace player class.
This class is responsible for interpreting a debug trace and allowing it
to be stepped through, like a debugger. It tracks the current line
number, call stack, slot values, and associates slots with stack frames.
It supports stepping forward or stepping over (i.e., stepping to the
next line in the current function, hiding function calls).

Change-Id: I2b7d90c3b38b0006bebdfbf65a7bf678d5227d56
Bug: skia:12666
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/482460
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-12-10 21:57:58 +00:00
Herb Derby
0f2390f7fb move SkRemoteGlyphCache.h to private
Chromium has been using the remote glyph cache for a few years now.
It's time to give it a proper home.

This is an intermediate CL. The old .h file includes the new .h file.
After I change the include paths in Chromium, I will delete the old
file.

Change-Id: Iaf00c46aa0698326c0bdec9a0eed218bcc3e334e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/482700
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2021-12-10 20:20:56 +00:00
Brian Osman
ca916f705f Remove canvas marker stack, marked matrices, etc...
This entire API existed, but was unused (no longer connected to
drawVertices or runtime effects).

In theory, we could further simplify some of the matrix providers, but
more importantly - I have serious doubts about the correctness of
localToDeviceHitsPixelsCenters for most of them.

Change-Id: If5af182015dd96e5ed3353a117223e8dbbe17097
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/481683
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-12-09 16:22:16 +00:00
John Stiles
bc5b9f6b53 Migrate SK_strcasecmp to SkStringUtils.h.
This will let us use it elsewhere.

Change-Id: I39a5dc0651bee8fbd5fa7302e34a3a79f7efbd3d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/481736
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-12-08 22:52:04 +00:00
Herb Derby
22960eb7b2 don't produce empty slugs!
The current system short circuits out when an SkTextBlob will draw
anything based on its bounds, the bounds of the clip, and the state
of the paint.

A similar thing needs to happen, but the clip needs to be ignored.
Return the nullptr if the SkTextBlob would never draw to signal that
the Slug can be ignored.

Bug: chromium:1277583

Change-Id: I2d6641e03c88ae5f160c479c9e715ad8dc9f65b3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/481592
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2021-12-08 20:34:41 +00:00
Brian Salomon
78fa6d23ef Make SkRuntimeEffect's compiler instance shareable.
No functional change.

Bug: skia:12720
Change-Id: I649bc258c9a6b4973cdd9d1727827cdaf89b43ad
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/481280
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2021-12-08 15:31:25 +00:00
John Stiles
5fb4753483 Revert "Remove newly-added SkSL::DebugTrace base class."
This reverts commit 873a39ebd1.

Reason for revert: rework #2 of trace design, DebugTrace is back

Original change's description:
> Remove newly-added SkSL::DebugTrace base class.
>
> Slight rework of the SkRuntimeEffect trace design means we won't expose
> any debug-trace class at the public level, so an interface base class
> doesn't add value after all.
>
> Change-Id: I82739e9c5ba5ce5c7a63793ec0c09a50ab19fbb3
> Bug: skia:12708
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/480776
> Auto-Submit: John Stiles <johnstiles@google.com>
> Commit-Queue: Brian Osman <brianosman@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>

Bug: skia:12708
Change-Id: I02d51f83c7a3384b1eaa74ecf1a80b5f6e4fd774
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/481196
Auto-Submit: John Stiles <johnstiles@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-12-07 16:25:17 +00:00
John Stiles
873a39ebd1 Remove newly-added SkSL::DebugTrace base class.
Slight rework of the SkRuntimeEffect trace design means we won't expose
any debug-trace class at the public level, so an interface base class
doesn't add value after all.

Change-Id: I82739e9c5ba5ce5c7a63793ec0c09a50ab19fbb3
Bug: skia:12708
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/480776
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-12-07 00:54:08 +00:00
John Stiles
dfc7f31bd1 Create a public base class for debug traces.
SkRuntimeEffect needs an API for generating debug traces. This means
that we will need references to debug traces inside a public header.
Rather than reference SkVMDebugInfo directly, we now have a simpler
base class for debug traces. This is better suited to landing in
include/.

I've also renamed SkVMDebugInfo to SkVMDebugTrace for consistency, since
it now contains all the trace data. (When it was first added, it only
had the slot info.)

Change-Id: Ibaa4dedf9a17b9462b4f233a28a7b875d0317892
Bug: skia:12708
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/480356
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-12-06 18:22:51 +00:00
Julia Lavrova
94f726ae62 Adding test files demonstrating type confusion for arrays/structs.
Change-Id: Iacd924471971c3c551648f75c1ecf0f1bfd3ed07
Bug: skia:12642
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/479061
Commit-Queue: Julia Lavrova <jlavrova@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2021-12-03 20:54:36 +00:00
Greg Daniel
d4c3495ba9 [graphite] Fix recorder gn.
Change-Id: I7f0998f159e0bc3f32f813f8150f4f12477760cb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/479056
Commit-Queue: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Auto-Submit: Greg Daniel <egdaniel@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-12-02 17:57:27 +00:00
Greg Daniel
9d74c28e82 [graphite] Move Recorder and Recording to public include.
This also hides the ctors for the respective classes so you can't just
arbitrarily make one outside of the factories.

Change-Id: If31ac8ea9b54c9e10c162081251e77d7e9d07147
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/478956
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2021-12-02 16:49:12 +00:00
Eric Boren
7bc4c9a8d1 [python3] Reland recipes -> python3 changes
This was enabled by moving the iPhones off of the old RPI2 hosts.

This reverts commit 04cd6fba97.
This reverts commit a726978ae7.

Bug: chromium:1256037
Change-Id: I35069089aa39baf62a18235c8d0514923f327c53
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/477987
Reviewed-by: Ravi Mistry <rmistry@google.com>
Commit-Queue: Eric Boren <borenet@google.com>
2021-12-01 13:04:03 +00:00
Greg Daniel
5e0950e4dc [graphite] Add Context create/deleteBackendTexture calls.
Bug: skia:12633
Change-Id: Ida78c4145423376dc0267096a1d758b74144fd0c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/477139
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2021-11-30 21:36:23 +00:00
Herb Derby
25c0e1a8dd GrSlug prototype
A GrSlug encapsulates an SkTextBlob at a certain origin, using a
given paint. Once a blob is converted to a slug, it can be drawn
through a canvas and will obey the canvas's mapping and clipping.

The glyphs encoded as mask will be transformed using bi-linear
interpolation. The other glyphs type will draw as they normally
would. This allows drawing an SkTextBlob using the original
glyph data from the cache.

Bug: chromium:1254726

Change-Id: I1b42c94966d22865922ce991ae6ed13b51360618
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/471157
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2021-11-29 21:48:31 +00:00
Michael Ludwig
0814e7fb6a [graphite] Add Combination to GraphicsPipelineDesc
Change-Id: I7fa9b4da48f993143ade3b8030e2c67831cf0ffd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/475257
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2021-11-29 18:53:54 +00:00
Brian Osman
00aa1a9259 Prevent 'binding' and 'set' on struct/interface block fields
I should have realized the fuzzer would find this assert when I added
it. Now the front-end rejects these layout qualifiers on both struct
fields and interface block fields. LayoutInInterfaceBlock.sksl is a
reformatted version of the fuzzer input. LayoutInStruct is hand-crafted
to trigger the same failure on a different code path. Both would
previously assert in the SPIRV generator. Now, neither one gets that
far.

Bug: oss-fuzz:41347
Change-Id: Iff69d8f5482da7b772e9331c4fd2d58e89813c46
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/476396
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-11-29 15:53:57 +00:00
Brian Salomon
3595c15c12 Rebind GrGLRenderTarget if there is a lazy stencil attachment change.
Bug: chromium:1271431
Change-Id: Ie5bef1a8f18d4d1e2d9a92afdf5c5305d3d9bdb2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/475256
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2021-11-22 23:08:11 +00:00
Michael Ludwig
1f224edb2c [graphite] Add vertex/instance attribute definition to RenderStep
Moves Attribute into its own header. I did not move AttributeSet/Iter
out of GraphicsPipelineDesc because RenderStep should be able to just
rely on SkSpan<Attribute>. Since they are fixed definitions, there
shouldn't be a need to support skipping over uninitialized attrs. Once
GraphicsPipelineDesc just points to a RenderStep, AttributeSet/Iter can
be deleted.

Bug: skia:12466
Change-Id: I3b01b6283669fc02dc9cd0521bb236a9d0daa5eb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/474136
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
2021-11-22 22:31:09 +00:00
Michael Ludwig
b8e36741e0 [graphite] Add DrawWriter type for auto merging consecutive vertex data into draws
Change-Id: I94ded218e822fe50687e1efff7d46bcc4c1f1293
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/471780
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2021-11-22 21:16:42 +00:00
Brian Salomon
e00afb0a1a drawVertices and drawPath apply blend between paint and primitive color.
Bug: skia:12662
Change-Id: Ic2924257fce3ea9a2df5e49d0ab26ad085693d30
Cq-Include-Trybots: luci.skia.skia.primary:Canary-Flutter
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/473676
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-11-22 19:09:33 +00:00
Herb Derby
2f64952d20 introduce the GrSlug API
Introduce the GrSlug that encapsulates an SkTextBlob along with
the origin, and paint to create a GrSlug. You can draw the slug
using the canvas, and it will obey the canvas's clip and mapping.

See the full working prototype at:
  https://skia-review.googlesource.com/c/skia/+/471157/17

Change-Id: I5731dce3dea316ad144baead154a68c8e4c5db9a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/474040
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2021-11-22 18:44:17 +00:00
Chris Dalton
fc0941003e Move tessellation-specific functions out of GrPathUtils
Bug: skia:12524
Change-Id: I2664c8ea707a40724bcf916e907fe28d1fa276d6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/474357
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2021-11-20 02:47:40 +00:00
John Stiles
626dbe195a Add test for commutative operations in SkVM.
SkVM should be able to optimize away these equivalent expressions:

	(intA & intB)   <->  (intB & intA)
	(intA ^ intB)   <->  (intB ^ intA)
	(intA | intB)   <->  (intB | intA)
	(intA + intB)   <->  (intB + intA)
	(intA * intB)   <->  (intB * intA)
	(intA == intB)  <->  (intB == intA)
	(intA != intB)  <->  (intB != intA)

These should be guaranteed by IEEE754 as well:

	(floatA + floatB)   <->  (floatB + floatA)
	(floatA * floatB)   <->  (floatB * floatA)

I've added a test to demonstrate existing behavior, which leaves these
optimizations on the table.

Change-Id: I01ce1d6f1cfadb3d77db405a83752c9dd52c99bd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/473238
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-11-18 21:16:48 +00:00
Chris Dalton
c7a849319f Make path pre-chopping more robust
Exceptionally large control points might require us to chop the path
very deeply. This CL converts the recursive chopping to loop with a
stack of control points on the heap, in order to avoid the risk of
stack overflow. It also adds a bail condition to avoid getting stuck
in endless recursion due to fp32 precision issues.

Bug: chromium:1266446
Change-Id: I005be4bc29de51d3c89f04b5d6c553a921a92aa3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/473197
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2021-11-18 16:42:19 +00:00
Jim Van Verth
d8a753a263 Move GLSLGeneration definition to SkSL
This is a first step in making GrShaderCaps more general so we can use
it in Graphite.

Change-Id: I7fc874e5df8dba2cef05421840a4019e5499ab59
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/473000
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2021-11-18 15:12:00 +00:00
John Stiles
bcd6d4901d Add test for construction of void.
This fails exactly as it should, but we had no test for it.

Change-Id: I0aa3307c444f2c9bc3512ff43b784a56a7c09856
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/472449
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-11-17 16:04:35 +00:00
John Stiles
504d57e9bd Add test for void type in struct.
Mysteriously, I had written a test which put arrays of void inside a
struct, but had neglected to include the non-array case. It causes an
okay-not-great error (referring to void as an "opaque type").

Change-Id: Id20a9d3512d29aecea81d46877dce708b7b2f973
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/472450
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2021-11-17 15:21:41 +00:00
Eric Boren
a726978ae7 Revert "[python3] More Recipes -> Python 3 fixes"
This reverts commit 12e786730f.

Reason for revert: missing CIPD package on armv6l

Original change's description:
> [python3] More Recipes -> Python 3 fixes
>
> - Set environment variables to force usage of Python 3 in more places
> - Fix more compatibility issues
> - Mark recipes as only supporting Python 3
> - Includes a roll of the infra code
>
> Change-Id: I24e3827a6402c454bdc9467d28864d360632f9e6
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/470303
> Reviewed-by: Ravi Mistry <rmistry@google.com>
> Commit-Queue: Eric Boren <borenet@google.com>

Change-Id: If7b6fcb7838ac053af2c5eb45a7a1ac4aed340a5
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/472736
Auto-Submit: Eric Boren <borenet@google.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2021-11-17 14:57:10 +00:00
John Stiles
fe3cfc1d4f Add test for variables of type void.
We should, of course, detect this and report an error.

Change-Id: I42b3be6e714a1f367d3251842506a384f2afe019
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/472447
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-11-17 14:51:52 +00:00
Eric Boren
12e786730f [python3] More Recipes -> Python 3 fixes
- Set environment variables to force usage of Python 3 in more places
- Fix more compatibility issues
- Mark recipes as only supporting Python 3
- Includes a roll of the infra code

Change-Id: I24e3827a6402c454bdc9467d28864d360632f9e6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/470303
Reviewed-by: Ravi Mistry <rmistry@google.com>
Commit-Queue: Eric Boren <borenet@google.com>
2021-11-17 13:51:08 +00:00
John Stiles
24e7ec7713 Implement serialization for SkVMDebugInfo traces.
This allows us to dump a trace to disk and read it back in again later.
This uses JSON to ensure a debug trace will stay readable across
platforms, builds, etc.

Change-Id: I4e5011b5023cf14f422ab130e9697c125c2b6e45
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/471765
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-11-16 15:49:24 +00:00
John Stiles
e10839f998 Add basic unit test for octal parsing support.
This is required by the ES2 standard: http://screen/Qysv4fPW5r5LA9e
This actually already worked fine because `strtoull` natively recognizes
octal values without any work on our part. However, we lacked a test.

Change-Id: I3033de899918abe99c63a9b7b79bd4c3374ee315
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/471716
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-11-16 13:49:41 +00:00
Greg Daniel
7b64e138b5 [graphite] Remove use of GraphiteTypesPriv and move to *Types in src.
We should only be using include/private for types that actually are
needed in include/ files. I moved everything that was just in src to
new src/*Types.h files. This actually left nothing in GraphiteTypesPriv
for now, so I deleted it. If we actually need private types that are
part of include/ we can add it back later.

Bug: skia:12466
Change-Id: I180fc2032afd47bc6c5e8b9ccd4954b5d2451fc7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/471758
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2021-11-15 20:57:23 +00:00
Greg Daniel
686ccec13f [graphite] Add BackendTexture abstraction for Graphite.
There are definitely some missing getters on other functions we'll need
on BackendTexture. But for this CL I just wanted to get the basics and
ctor working. Other functions can be added as they are needed.

Bug: skia:12633
Change-Id: I668828138df943a432efcec6b1134756e681a582
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/469820
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2021-11-15 18:03:40 +00:00
John Stiles
14a487fd54 Replace getConstantSubexpression with getConstantValue.
The only type of expressions that getConstantSubexpression could ever
return are Literal and nullptr. getConstantValue now returns an
optional<double>; nullopt indicates a non-constant value in the slot.
This simplifies most use cases, and allows us to get rid of some extra
"zero" and "one" Literal objects in some of our Constructor classes.

This change fixes a recent fuzzer issue. The fuzzer had discovered that
calling `getConstantSubexpression` on a ConstructorCompoundCast that
contained a compile-time-constant value would return literals of the
wrong type (the cast was not applied). By nesting repeated matrix casts,
this type confusion could be turned into an assertion.

Change-Id: Icee69219e6db2822ffdfab4e5ccdaff54584a4b6
Bug: oss-fuzz:41000
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/471376
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-11-15 14:46:21 +00:00
Brandon DeRosier
c0ff5a8560 Add flag that can be used to disable std::shared_mutex use in VMA.
This is needed for enabling Skia's Vulkan backend for Flutter on Windows and iOS 9, as the standard libraries in both of these contexts don't have `std::shared_mutex`.

When disabled on Windows, VMA falls back to using Win32 SRWLock.
The `vulkan.h` import in `vk_mem_alloc.h` which would normally import `windows.h` is commented out for Skia, and so the relevant symbols need to be declared before importing `vk_mem_alloc.h`.

Relevant Flutter Engine PR: https://github.com/flutter/engine/pull/29520

Change-Id: I2b1a621417155071b21e5c6d3b5ccc375c92a622
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/469207
Reviewed-by: Greg Daniel <egdaniel@google.com>
Auto-Submit: Brandon DeRosier <bdero@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2021-11-12 01:35:08 +00:00
Chris Dalton
08a971126e Reland "Implement batching for convex tessellated paths"
This is a reland of 9613060bdf

Original change's description:
> Implement batching for convex tessellated paths
>
> Moves the view matrix transformation onto the CPU (when local coords
> are not used), and plumbs a color attrib through the tessellation
> patches.
>
> Bug: skia:12524
> Change-Id: Ic4740048b4fc85cb18e7235a7754d57762db3daf
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/468997
> Reviewed-by: Michael Ludwig <michaelludwig@google.com>
> Commit-Queue: Chris Dalton <csmartdalton@google.com>

Bug: skia:12524
Change-Id: I77cd079d8921b224925bd2f7364c564822886d61
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/470436
Commit-Queue: Robert Phillips <robertphillips@google.com>
Auto-Submit: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-11-11 20:01:40 +00:00
John Stiles
107ea94139 Add support for clamp($genUType, ...) in SkSL.
We never used it internally, but the shaders used by Filament rely on
it. It doesn't exist in ES2 so this doesn't affect Runtime Effects.

Change-Id: Idb2afb15ff160b950ad02101bf6381a5d5c56468
Bug: skia:12635, skia:11209
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/470156
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-11-11 18:43:42 +00:00
Brian Salomon
384ba65b8d Remove GPU V2
Replaced by Graphite.

Change-Id: Iac0ba212b078904a591677c9ce839a90562d0240
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/470305
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2021-11-11 17:11:19 +00:00
Robert Phillips
954e81a170 Revert "Implement batching for convex tessellated paths"
This reverts commit 9613060bdf.

Reason for revert: assertion failure on ANGLE

Original change's description:
> Implement batching for convex tessellated paths
>
> Moves the view matrix transformation onto the CPU (when local coords
> are not used), and plumbs a color attrib through the tessellation
> patches.
>
> Bug: skia:12524
> Change-Id: Ic4740048b4fc85cb18e7235a7754d57762db3daf
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/468997
> Reviewed-by: Michael Ludwig <michaelludwig@google.com>
> Commit-Queue: Chris Dalton <csmartdalton@google.com>

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

Change-Id: Ie086376656777bb167075a9822d8c702cc7e41ec
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:12524
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/470296
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-11-11 13:30:09 +00:00
Chris Dalton
9613060bdf Implement batching for convex tessellated paths
Moves the view matrix transformation onto the CPU (when local coords
are not used), and plumbs a color attrib through the tessellation
patches.

Bug: skia:12524
Change-Id: Ic4740048b4fc85cb18e7235a7754d57762db3daf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/468997
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2021-11-11 00:34:00 +00:00
John Stiles
d92f9c2f8d Add tests for matrix constant-expressions.
We should support constant-expressions involving matrices (GLSL ES2
does, WebGL does). We currently don't. We do properly report out-of-
range indexing, but we don't optimize away valid matrix index
expressions or allow matrices to be indexed in a constant-expression
context.

Change-Id: If58aa4c5f15abef421a412957072f3617b4176df
Bug: skia:12472
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/469818
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-11-10 20:59:36 +00:00
John Stiles
0b84159e3b Improve array-indexing tests.
Previously, we didn't have tests which leveraged constant-evaluation of
array indexing (because we didn't support it), and our test files
commingled constant-indexing into vectors with constant-indexing into
arrays.

The test files now separate vector- and array-handling into separate
tests, and a ton of new cases have been added to ArrayFolding. The
ArrayFolding tests now require constant-evaluation of array indexing,
so they fail in this CL, but will be fixed in the followup CL.

Change-Id: I3b663e743d97d6db80627bc9b7808f88c99917a7
Bug: skia:12472
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/469528
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-11-10 18:31:28 +00:00
John Stiles
6e6ae1b762 Fix inlined out-of-range vector access.
Previously, this code assumed that IndexExpression::Convert had done
range checking and that it was safe to access the base expression at
the passed-in index. The inliner violates this assumption, because it
can replace unknowns (where out-of-range access is undefined but non-
fatal) with knowns (where out-of-range access is forbidden).

We now do range-checking inside IndexExpression::Make and report the
error cleanly, instead of asserting inside of Swizzle::Make due to an
invalid component index.

Change-Id: If0f31b1f694bcc2a875d124f70be311d6634c77b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/469535
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-11-10 14:44:38 +00:00