Commit Graph

10342 Commits

Author SHA1 Message Date
Julia Lavrova
455e580b9c Revert "Better Matrix/Scalar testing"
This reverts commit abb611550e.

Reason for revert: Build break
Original change's description:
> Better Matrix/Scalar testing
>
> Adding tests for matrix math and comparison
> bug: skia:12681
>
> Change-Id: Ia1537ee2e411383749456fd6ff938b7c9a2e1061
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/493416
> Reviewed-by: John Stiles <johnstiles@google.com>
> Commit-Queue: Julia Lavrova <jlavrova@google.com>

Change-Id: I70871b4b75c1f10e870dc5e884a42405a80fc0f9
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/494816
Reviewed-by: John Stiles <johnstiles@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2022-01-13 18:52:04 +00:00
Greg Daniel
b21c4af0f6 [graphite] Remove ref counting from Recorder.
Bug: skia:12794
Change-Id: Iefdc2d84991a542533d13c227051c372459564db
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/494241
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2022-01-13 16:27:29 +00:00
Julia Lavrova
abb611550e Better Matrix/Scalar testing
Adding tests for matrix math and comparison
bug: skia:12681

Change-Id: Ia1537ee2e411383749456fd6ff938b7c9a2e1061
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/493416
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2022-01-13 15:35:12 +00:00
Greg Daniel
106a57b5ac [graphite] Store back pointers of Device and Recorder to each other.
It is safe to store raw pointers to these objects since they are both
always accessed on the same thread we can safely invalidate their
back pointers when needed. This allows us to remove a ref of Recorder on
Device.

Bug: skia:12794
Change-Id: Icb5e079f7e820824520d52e48012b447e714a9ee
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/494239
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2022-01-13 15:29:19 +00:00
John Stiles
866db186fa Simplify control flow in switch test to unbreak iOS.
This looks like the GLSL driver in iOS generates wrong results when
returning a value from inside a switch.

Change-Id: I478a045c64c3dae9824f86f52e0c7f8f9685c9af
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/494476
Reviewed-by: Joe Gregorio <jcgregorio@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2022-01-13 14:49:06 +00:00
Robert Phillips
cc4d21f980 [graphite] Move ShaderCodeDictionary, SkPaintParamsKey, and UniquePaintParamsID to include/private
Since the SkShaders, etc will need access to SkPaintParamKeys and the SkShaderCodeDictionary they can't be buried in the skgpu namespace.

The currently planned signature for addToKey is:

void addToKey(SkShaderCodeDictionary*, SkBackend, SkPaintParamsKey*) const;

This CL doesn't modify the classes beyond what is needed to move them.

Bug: skia:12701
Change-Id: I18bbf6d6c3a768427112a3d19a9ccf2d46a23ad2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/494237
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2022-01-13 14:22:11 +00:00
John Stiles
8522bf910a Add test for switch-case folding.
Change-Id: I3dabd77890a73ea054bb57d466a6ed8273eae3e8
Bug: skia:12811
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/494196
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2022-01-12 22:24:55 +00:00
Robert Phillips
04e74196b0 [graphite] Replace Combination with SkPaintParamsKey
SkPaintParamsKey can be variable length and is thus the path forward for encapsulating/representing PaintParams.

Note: SkPaintParamsKey isn't in the skgpu namespace bc, ultimately, the individual SkShaders, etc will be responsible for adding their own information to the key.

Bug: skia:12701
Change-Id: I7472dc00706a4548bc3ffb4e287a941a2b8ffcae
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/492405
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2022-01-12 18:47:34 +00:00
John Stiles
44c00ae64a Add test for vector constant folding.
Change-Id: Iecf1313af5f2938cb899f2a3e750ffc04554bae0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/493977
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>
2022-01-12 17:23:20 +00:00
Ethan Nicholas
704007f5ed Fixed error handling with DSL runtime effects
Bug: skia:11862
Change-Id: Ia21fad6acb82a03c1ba8663be548bf58f5067b85
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/493636
Reviewed-by: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2022-01-12 15:37:45 +00:00
Herb Derby
30fdea3d8f track glyph scaling hints in min/max pairs
Track the scaling hints as the minimum of the maximum dimension and
the maximum of the maximum dimension. Having the range will allow
for better scaling choices in the drawing of last resort.

The next CL will start using this range to calculate scaling factors.

Bug: chromium:1280180

Change-Id: I2c07303d3303c71ede2a0b1133ee2e218f7bd84e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/493456
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2022-01-11 17:45:21 +00:00
Jim Van Verth
345587df72 [graphite] Use renderpassdesc to setup graphics pipelines
Bug: skia:12700
Change-Id: Icbd1ff6f98f5de8830b40b8a714e8092e40b1c97
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/485217
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2022-01-11 16:49:48 +00:00
Derek Sollenberger
8b2513a986 Build the NDK compliant shared library to be used by JNI in SkQP.
This CL creates a new build target with a customized set of GN
flags that enable the native components of SkQP to be built using
NDK APIs.

Bug: skia:12777
Change-Id: I8341eafa7fc794cfb759045b7c7238e69c29b0a3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/491447
Reviewed-by: Leon Scroggins <scroggo@google.com>
Commit-Queue: Derek Sollenberger <djsollen@google.com>
2022-01-10 17:11:48 +00:00
Greg Daniel
ff837f8358 Fix origin in SkImage_Lazy for GrAhardwareBufferImageGenerator.
Change-Id: I238f7c5669856b7d29a175dfdc27e12f3141f49c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/493016
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2022-01-10 16:09:20 +00:00
Robert Phillips
3e35c8a584 [graphite] Break PaintParams out into its own header
Bug: skia:12701
Change-Id: I8138633dee9eaf65077da8534600393196c7942e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/492404
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2022-01-07 18:02:49 +00:00
Julia Lavrova
a856f40086 Interface blocks no longer allow duplicate fields
bug: skia:12793
Change-Id: Idccdab5ee8f1c7792bdfe98efd379d0199a65377
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/492397
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2022-01-07 16:44:08 +00:00
Julia Lavrova
ae5f86ea1a Test: Interface blocks allow duplicate fields
bug: skia:12793
Change-Id: Ie47b1df381779ed24cab8b05b1ee6947bda82516
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/492396
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2022-01-07 15:55:58 +00:00
Robert Phillips
9fccec2b69 [graphite] Add UniquePaintParamsID
The core of this CL is replacing the Combination in GraphicsPipelineDesc with a uniqueID. All the other changes are just in support of that.

Bug: skia:12701

Change-Id: Id5fe9b39d1e497adbc879e7c933a2d9bdb788a58
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/491048
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2022-01-07 13:27:54 +00:00
Julia Lavrova
2f3891bf76 Duplicate field names in struct
bug: skia:12712
Change-Id: I61a4512c10bf91d6396c38f148a714492669a9e0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/491820
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2022-01-06 22:44:16 +00:00
Herb Derby
72412a8672 remove drawingType simplifying code
Encapsulate the direct/SDFT decisions in the bool functions
isDirect() and isSDFT().

Encapsulate the notion of glyph approximations in:
approximateTransformedTextSize().

Use these to replace drawingType through the code.

Bug: chromium:1280180

Change-Id: I8de7ee8bc4a24e576e79eeb1ed8670179a860aa9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/491448
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2022-01-06 21:35:40 +00:00
Julia Lavrova
ce49ff6520 Test: duplicate fields in the same struct allowed
As @johnstiles suggested I add the test first and the fix after.
bug: skia:12712

Change-Id: I9316cf40f71e756fc1730ee630bc0d0377f200d6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/491936
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2022-01-06 19:40:50 +00:00
John Stiles
3c233c7f73 Update comments in FirstClassArrays test.
We used to reject ES3-style array declarations in strict-ES2 mode, so
this test originally expected two errors.

Change-Id: I17f71630076cda4b37b7723225dcff951eba9dcc
Bug: skia:12410
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/491997
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2022-01-06 18:53:34 +00:00
Ethan Nicholas
4cd3ae4009 Revert "Fixed SkSL error reporting on array types"
This reverts commit 6e686b8b8b.

Reason for revert: After internal discussion, we established that nobody was actually sure why this had needed to be an error in the old parser in the first place, so there does not appear to be a reason to carry the behavior forward.

Original change's description:
> Fixed SkSL error reporting on array types
>
> The DSLParser was not reporting errors when the array type appeared
> before the variable name (float[2] x) as opposed to after (float x[2])
> in strict ES2 mode.
>
> Bug: skia:12410
>
> Change-Id: Ia388aa150f65916dc3ccc58f7680dbde0a636c5f
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/491819
> Reviewed-by: Brian Osman <brianosman@google.com>
> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>

Bug: skia:12410
Change-Id: I355fd1ad89e2e64b0377be7672b7f3f824eebac8
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/491996
Auto-Submit: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2022-01-06 16:53:17 +00:00
Ethan Nicholas
6e686b8b8b Fixed SkSL error reporting on array types
The DSLParser was not reporting errors when the array type appeared
before the variable name (float[2] x) as opposed to after (float x[2])
in strict ES2 mode.

Bug: skia:12410

Change-Id: Ia388aa150f65916dc3ccc58f7680dbde0a636c5f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/491819
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2022-01-06 16:28:47 +00:00
Ethan Nicholas
f393067c37 Made SkSL type aliases into first-class objects
Previously, type aliases ('vec2') were just an additional name which
could be used to refer to a type ('float2'). This was simple and worked,
except that error messages would be wrong - any type-related error
message would refer to the type as 'float2' rather than the 'vec2' that
the user actually typed.

This CL adds an AliasType class so that we can track which name was
used to refer to an aliased type and report messages using the correct
type name.

Bug: skia:12737

Change-Id: I40e234239ab47557033e0695e4fbbd5f01da354e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/490256
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2022-01-05 16:20:19 +00:00
Brian Salomon
c29454d1c9 Allow custom mesh to use positions for local coordinates.
This will make it possible for drawVertices and drawCustomMesh to share
implementation in Ganesh.

Bug: skia:12720
Change-Id: I8b84119a29b47071ef389879bb5287873629ed3e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/487978
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2022-01-04 18:01:47 +00:00
Brian Osman
735ff421bb Reject #extension in runtime-effect mode
Bug: oss-fuzz:43062
Change-Id: I10d8fa40c81c5b1595d30221d89c84f5cc3478fd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/490857
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2022-01-04 16:12:50 +00:00
John Stiles
65aae8a51a Disable SkSL optimization when SkRuntimeEffect::MakeTraced is called.
SkRuntimeEffect::MakeForXxxxx compiles its shaders before MakeTraced()
is invoked, with optimizations enabled. When MakeTraced() is called,
we recompile the shader with optimizations disabled; this allows us to
present the user with a shader that is as close to the original as
possible. (This obviously costs time, but debug trace generation isn't
focused on speed.)

Note that in some rare instances, disabling optimizations can cause
compilation to fail (e.g. optimization can simplify control flow and
eliminate "unreachable" paths). In those cases, we fall back to the
existing behavior of debugging an optimized shader.

Change-Id: Iba0f31bc42374c7048694fde5415b122177a9a68
Bug: skia:12666
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/489716
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2021-12-29 18:54:19 +00:00
John Stiles
d67f1f8f50 Provide bit-casted slot values from DebugTracePlayer.
Previously, the VariableData returned from a DebugTracePlayer contained
values in an int32_t, regardless of the slot's NumberKind. We had a
helper function which could stringize the bits, but otherwise the caller
was responsible for bit-casting the value manually.

Now, the DebugTracePlayer will automatically manage bit-casting for the
caller. The value returned in the VariableData is now a double (so it
is able to store an int32, uint32, or float at full precision).

This change was inspired by the recent Typescript port. (The value in
the Typescript VariableData uses a compound `number | boolean` type, so
it is able to fully represent any slot value natively.)

Change-Id: I5eec414236f76ad0ff51b0b19974e4a0025c4d62
Bug: skia:12666
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/489896
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-12-29 18:30:19 +00:00
John Stiles
bab224e1c2 Prevent interface block members from using invalid names.
Interface blocks now guard against naming their member variables with
built-in type names like "float" or "bool".

Change-Id: Ia767542ace76fb8fbc2d50c81772b7f54b1bf973
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/489616
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2021-12-28 20:57:18 +00:00
John Stiles
aa09c782a8 Add test for structs/interface-blocks with invalid member names.
Structs already handled this appropriately, but interface blocks did not
guard against naming their member variables built-in type names like
"float" or "bool".

Change-Id: I12ec054b3f158b83e35031449cf2a088ff8d0dc2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/489596
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-12-28 20:55:32 +00:00
John Stiles
f604efbeb4 Add support for anonymous function parameters in SkSL.
Anonymous function parameters are now automatically assigned a name,
"_skAnonymousParamN", where N is the parameter index.

Change-Id: I87adcd51ed025c76ae2b333317f21b523a4632b4
Bug: skia:12769
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/489538
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2021-12-28 20:47:05 +00:00
John Stiles
1c7d442b52 Add test containing anonymous function parameters.
SkSL will reject ES2-compatible code because function parameters always
require a name in SkSL. (A followup CL relaxes this restriction and
allows anonymous parameters in SkSL.)

Change-Id: Ifdcf0fcbe0f52d16007c018b545631ca4033a8c4
Bug: skia:12769
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/489537
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-28 20:08:56 +00:00
John Stiles
106776364d Prevent structs/interface-blocks from claiming builtin types.
Structs and interface blocks allow a trailing identifier which is added
to the symbol table. This identifier is now prohibited from
overlapping built-in types.

Change-Id: I33b9d6156a27ce017e6744a05979748c04a04767
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/489516
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2021-12-28 19:32:22 +00:00
John Stiles
48432e133e Add test demonstrating struct/interface-block name conflict.
Structs and interface blocks allow a trailing identifier which is added
to the symbol table. This identifier should be prohibited from
overlapping built-in types; at present, this is not checked. Add a test
demonstrating the issue.

Change-Id: I99aa915c1715c468cc369c97b7f12e031b86ea4a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/489496
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-12-28 19:26:17 +00:00
John Stiles
1a746070ac Fix overzealous debug trace generation.
When the SkVM interpreter is operating in "stride=1" mode, we should
only look at the first lane of the trace/execution masks. The other
lanes are not being actively used, but the "index" opcode still fills
all the lanes, so it's entirely possible for the trace coordinate to
match in an unused lane.

Change-Id: I7f04f5c59431b3c50b4b072bc3ea4f52f8aa1a1b
Bug: skia:12752
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/488796
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2021-12-28 15:39:16 +00:00
Greg Daniel
c1bc0205d9 [graphite] Move GrResourceKey to skgpu::ResourceKey.
We'll want to reuse this key class for Graphite resources as well. There
is nothing special about these keys that is Ganesh specific.

Bug: skia:12754
Change-Id: I39fe5a9968156985865bccbfc4978583120ac2e8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/487384
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2021-12-23 22:55:19 +00:00
John Stiles
87ced29082 Track line reachability on a step-by-step basis.
Since we know the entire flow of execution ahead of time, at any point
during trace playback, we can know if a line will be reached again or
not. We no longer highlight lines as reachable (or allow setting
breakpoints) if the line will not be reached again during trace
playback.

Change-Id: Iff563b13e2f6efb5d4f2ff37215f2ff4fb5945ed
Bug: skia:12666
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/486496
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2021-12-22 19:33:17 +00:00
Greg Daniel
fe995770fe Remove all unused uniqueKey support from SkPromiseImageTexture.
At this point SkPromiseImageTexture is not much more than a wrapper
around a GrBackendTexture. The next steps would be to switch to just
directly using GrBackendTexture in the fulfill procs and deleting
SkPromiseImageTexture.

Bug: skia:12758
Change-Id: Ic0526b869a0730c25b41b46fd6523604dedaba40
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/487382
Auto-Submit: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2021-12-21 21:32:43 +00:00
Michael Ludwig
bdc0bad2e2 [graphite] Implement inverse fills
Renderer::StencilAndFill() chooses between two instances based on fill
type (more to come when we add stencil pass). The inverse fill uses
different stencil settings and different geometry (hence why it must be
a distinct renderer, since stencil is part of the pipeline).

Also updates the command buffer asserts and types to support float3
attributes and has the fill bounds render step pre-transform vertices.
This matches the intended plan of device-space control points to
avoid matrix transform uniforms when no other coords are needed.

Makes DepthStencilSettings constexpr so they can be declared constants.

Cq-Include-Trybots: luci.skia.skia.primary:Test-Mac11-Clang-MacMini9.1-GPU-AppleM1-arm64-Release-All-Graphite,Test-Mac11-Clang-MacMini9.1-GPU-AppleM1-arm64-Debug-All-ASAN_Graphite,Build-Mac-Clang-arm64-Release-iOS_Graphite,Build-Mac-Clang-arm64-Release-Graphite,Build-Mac-Clang-arm64-Debug-iOS_Graphite,Build-Mac-Clang-arm64-Debug-Graphite_NoGpu,Build-Mac-Clang-arm64-Debug-Graphite,Build-Mac-Clang-arm64-Debug-ASAN_Graphite
Bug: skia:12703
Change-Id: I5be4151f533e4cc5c560baf96c59193162b48dab
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/484559
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2021-12-21 20:44:51 +00:00
Brian Osman
4c4cf43db4 Run SkVM Visualizer test on all platforms
Change-Id: Ibff6f08e569b5365732404a56fc3b9bf7c2fa1f9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/487377
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-12-21 20:07:39 +00:00
Julia Lavrova
20187a27b3 Reland "SkVM visualizer, version 0.1"
This reverts commit 372a36de75.

Relanding the change

Original change's description:
> Revert "SkVM visualizer, version 0.1"
>
> This reverts commit bf57843b01.
>
> Build break
>
> Original change's description:
> > SkVM visualizer, version 0.1
> >
> > Simplified - "no static instructions"
> > Added to skslc with .cpp -> .html
> >
> > Change-Id: I0b56ea0480f868ca4182acb7a23c03acf7f57519
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/473659
> > Reviewed-by: John Stiles <johnstiles@google.com>
> > Commit-Queue: Julia Lavrova <jlavrova@google.com>
>
> Change-Id: I938bbf7bb650d1636a0d9bd19e455b455a49ef27
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/487096
> Auto-Submit: Julia Lavrova <jlavrova@google.com>
> Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>

Change-Id: I15b5f6630de43138da2dc72c4fe708499bed63c3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/487216
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2021-12-21 16:37:20 +00:00
Brian Salomon
380d1aedf9 Reland "Start on custom mesh API"
This is a reland of e1e1c03229

Original change's description:
> Start on custom mesh API
>
> Bug: skia:12720
> Change-Id: I8ed0555f1c5b8b0e97e73a657635dac2c0df0ccf
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/482457
> Reviewed-by: Brian Osman <brianosman@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>

Bug: skia:12720
Change-Id: I5c54f37949d8bd45ea606264c439912b65158b79
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/487220
Commit-Queue: Brian Salomon <bsalomon@google.com>
Auto-Submit: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-12-21 16:08:49 +00:00
Brian Salomon
a88a627316 Revert "Start on custom mesh API"
This reverts commit e1e1c03229.

Reason for revert: broken w/ colorspace xform

Original change's description:
> Start on custom mesh API
>
> Bug: skia:12720
> Change-Id: I8ed0555f1c5b8b0e97e73a657635dac2c0df0ccf
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/482457
> Reviewed-by: Brian Osman <brianosman@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>

Bug: skia:12720
Change-Id: I897b84d6483da8c4bcf8a709e08c26d1dee65f00
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/487219
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-12-21 15:26:10 +00:00
Brian Salomon
e1e1c03229 Start on custom mesh API
Bug: skia:12720
Change-Id: I8ed0555f1c5b8b0e97e73a657635dac2c0df0ccf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/482457
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2021-12-21 14:37:59 +00:00
Julia Lavrova
372a36de75 Revert "SkVM visualizer, version 0.1"
This reverts commit bf57843b01.

Build break

Original change's description:
> SkVM visualizer, version 0.1
>
> Simplified - "no static instructions"
> Added to skslc with .cpp -> .html
>
> Change-Id: I0b56ea0480f868ca4182acb7a23c03acf7f57519
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/473659
> Reviewed-by: John Stiles <johnstiles@google.com>
> Commit-Queue: Julia Lavrova <jlavrova@google.com>

Change-Id: I938bbf7bb650d1636a0d9bd19e455b455a49ef27
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/487096
Auto-Submit: Julia Lavrova <jlavrova@google.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2021-12-21 02:54:12 +00:00
Julia Lavrova
bf57843b01 SkVM visualizer, version 0.1
Simplified - "no static instructions"
Added to skslc with .cpp -> .html

Change-Id: I0b56ea0480f868ca4182acb7a23c03acf7f57519
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/473659
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2021-12-21 00:59:52 +00:00
Greg Daniel
cdeb092655 [graphite] Move GrProcessorKeyBuilder to generic skgpu::KeyBuilder class.
This also allows the KeyBuilder class to be used in Graphite. In Graphite
I plan to use it for other keys besides building up shaders/processors
so I dropped that from the name. There was nothing special abouts its
implementation that made it specific to Processors anyways.

Bug: skia:12754
Change-Id: I1b25730b061f9342b61e3b2e4ac43328b8074d59
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/486897
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2021-12-20 20:41:17 +00:00
Brian Salomon
dd9ef457d9 Reland "Add support for explicit attribute offsets and strides."
This is a reland of 6927ab9311

Original change's description:
> Add support for explicit attribute offsets and strides.
>
> Previously attribute offsets were always computed based on their
> position in an attribute array and the stride was determined
> by the offset and size of the last attribute.
>
> Now a GP has the option to create attributes with explicit offsets
> and specify an explicit vertex stride. All attributes must either
> be implicit or explicit (enforced by assert).
>
> GrGeometryProcessor::AttributeSet is now responsible for handling
> implicitly determined attribute offsets and strides. The backends
> no longer compute them.
>
> Bug: skia:12720
> Change-Id: I0211673dc70d4797c2d66b2555d8f5fb430be056
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/484736
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Reviewed-by: Michael Ludwig <michaelludwig@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>

Bug: skia:12720
Change-Id: Ic4975b5b2e52f2d8213154da0e585eca6dfdd78d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/486098
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2021-12-20 14:50:20 +00:00
Leon Scroggins III
ec481097c2 Make it always possible to seek in SkWuffsCodec
Bug: b/195936927

On Android, we may need to be able to seek the stream, but the input may
not be seekable. Copy in SkWuffsCodec as needed.

Change-Id: I7d5742e478532943a90400267175da80411cacd9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/485636
Commit-Queue: Leon Scroggins <scroggo@google.com>
Auto-Submit: Leon Scroggins <scroggo@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
2021-12-20 13:32:56 +00:00
Brian Salomon
38d5328926 Revert "Add support for explicit attribute offsets and strides."
This reverts commit 6927ab9311.

Reason for revert: breaking roll?

Original change's description:
> Add support for explicit attribute offsets and strides.
>
> Previously attribute offsets were always computed based on their
> position in an attribute array and the stride was determined
> by the offset and size of the last attribute.
>
> Now a GP has the option to create attributes with explicit offsets
> and specify an explicit vertex stride. All attributes must either
> be implicit or explicit (enforced by assert).
>
> GrGeometryProcessor::AttributeSet is now responsible for handling
> implicitly determined attribute offsets and strides. The backends
> no longer compute them.
>
> Bug: skia:12720
> Change-Id: I0211673dc70d4797c2d66b2555d8f5fb430be056
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/484736
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Reviewed-by: Michael Ludwig <michaelludwig@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>

Bug: skia:12720
Change-Id: I938bc3776d598f0906465eb2677208c79676642f
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/486016
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-12-16 20:00:18 +00:00
John Stiles
be4ef31f9e Honor breakpoints while stepping over/out.
Users expect that breakpoints will be hit even when stepping over or
stepping out. Rather than have one step call which honors breakpoints,
now the trace holds an unordered_set of breakpoints which all step calls
will honor.

Change-Id: I4055fc008e8cce4c413f357f375ae4038a7bd2a9
Bug: skia:12747
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/485918
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-12-16 19:37:25 +00:00
John Stiles
abed06bb61 Implement 'stepToBreakpoint' in Trace player.
This allows the user to run up to a specified line (or until execution
is complete).

Change-Id: Ied34798d2df1b4a9e1d723c8d2eff3d579ca9b2d
Bug: skia:12747
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/485860
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-12-16 18:31:02 +00:00
Brian Salomon
6927ab9311 Add support for explicit attribute offsets and strides.
Previously attribute offsets were always computed based on their
position in an attribute array and the stride was determined
by the offset and size of the last attribute.

Now a GP has the option to create attributes with explicit offsets
and specify an explicit vertex stride. All attributes must either
be implicit or explicit (enforced by assert).

GrGeometryProcessor::AttributeSet is now responsible for handling
implicitly determined attribute offsets and strides. The backends
no longer compute them.

Bug: skia:12720
Change-Id: I0211673dc70d4797c2d66b2555d8f5fb430be056
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/484736
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2021-12-16 14:38:12 +00:00
Greg Daniel
fec9a3027c [graphite] Add support for creating wrapped SkSurfaces.
Bug: skia:12633
Change-Id: Ic1598bea37bae6f53e054de98093b3c049125b38
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/479063
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2021-12-15 20:22:25 +00:00
John Stiles
eff367ac83 Highlight reached/unreached lines differently in Debugger.
This is useful to know because breakpoints can only meaningfully be set
on a line of code which is reachable. In other words, we know the
entire execution path ahead of time, so we can tell you that some
branches aren't actually taken without needing to set a breakpoint at
all.

Change-Id: I72b2cddcf92fd6f75ea12d302230bae42b7112bc
Bug: skia:12666
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/485218
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-15 20:08:06 +00:00
John Stiles
b713d81f51 Hide variables which fall out-of-scope in SkSL debugger.
We now track each slot's scope depth when it is written, and when scopes
are closed, we remove variables from display which fall out of scope.

Note that we DON'T have a specific trace-op dedicated to setting a
variable's stack depth when it is first declared. This is okay because
the SkVM code generation always stores a zero to a variable's slots as
soon as the variable is declared. This will consistently initialize its
depth to the depth of its initial declaration.

Change-Id: I68f76dfe2930fcd415ba635206cce3d0b94d1aac
Bug: skia:12741
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/484564
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-15 19:09:59 +00:00
John Stiles
bbb4fe9ea7 Add variable falling-out-of-scope case to SkVM trace tests.
We didn't have any test cases where a loop variable (other than a loop
induction variable) fell out of scope. Now we have a demonstration of
the trouble behavior.

Change-Id: Iec070748c93aaeab1dc41a46c42e33c78b73d7f5
Bug: skia:12741
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/484560
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-12-15 15:05:24 +00:00
John Stiles
71f7880bb6 Emit trace_scope ops from SkVM code generation.
These will give the debugger enough information to discard variables as
they fall out of scope.

Change-Id: Ia400e82a3ca9cf0a51a72d819f897d346979226c
Bug: skia:12741
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/484556
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2021-12-15 01:05:34 +00:00
Brian Osman
fde20db7ca Rename SkSL's 2D cross product builtin function
Note that the 2D cross product isn't defined. There are at least two
possible interpretations of what that might mean. This name makes it
clearer that we're asking for the length of the resulting vector, if
we computed the 3D cross product (assuming Z == 0 for both vectors).

It also eliminates name overlap between builtin functions and actual
intrinsics.

Change-Id: I24e8bc0ab2ec91aaace20f0dd3e8565c10bd44a0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/484440
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-12-14 22:00:26 +00:00
John Stiles
09adf0bfc3 Add new SkVM trace op 'trace_scope' to track SkSL scope depth.
This CL adds the trace op and tests the builder commands, but it is not
yet hooked up to the SkVM code generator or debugger.

Change-Id: Iaa64293dfd0973e299eb480cb2b43672b0886c32
Bug: skia:12741
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/484439
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-12-14 21:56:41 +00:00
Julia Lavrova
f74c7893fc Introduce SkVM Op::duplicate to localize visualization code
Change-Id: Ic343b1dcddb74d31c768afa67ab78955af418c9d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/483603
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2021-12-14 18:51:41 +00:00
John Stiles
80d2a50d4b Move newly-updated variables to the top of the Variable list.
Previously, the variable pane listed variables in slot order, which was
not very helpful (other than usually mapping to a top-to-bottom order in
the original source code). Now, the variable pane sorts variables to the
top when they are modified, and maintains their relative order
throughout execution. This is much easier to follow.

http://screen/C9odSHV4asFSLZH

Change-Id: Id86adf745207451a38a4dc46756f316e8d86bf81
Bug: skia:12666
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/483958
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-12-14 15:53:14 +00:00
John Stiles
0745d19ae3 Hide function return values after a step.
Previously, return values like `[func].result` would stick around in the
Variables table indefinitely. This felt very counterintuitive. Now they
only appear for one step, then vanish.

Change-Id: Iedfc7d2ddf136111005b26aaefb380ffc6281d05
Bug: skia:12666
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/483605
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-12-13 22:14:35 +00:00
John Stiles
0385de0f88 Add helper method to get the human-readable value of a slot.
We already had this logic in SkVMDebugTrace::dump; it just needed to be
factored out so that it could be accessed directly.

Change-Id: Ib497b82a7722b8ac2285de74f1937379c2f9a51b
Bug: skia:12666
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/483600
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2021-12-13 19:57:28 +00:00
John Stiles
9247feb52c Report slot updates using a dirty mask.
By tracking slot writes using a dirty mask, and reporting these in the
VariableData, we will be able to highlight assigned-to variables in the
debugger.

Change-Id: I93a767095c9c1b6dedc55a08424649f83aa1c960
Bug: skia:12666
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/483598
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-12-13 19:26:43 +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
John Stiles
fbb743377a Add method to get the suffix for a trace's slot.
We already had this logic in SkVMDebugTrace::dump; it just needed to be
factored out so that it could be accessed directly.

Change-Id: Idd6c92d23ab4dddc60fdc3c7b1693a0d89b1c992
Bug: skia:12666
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/483517
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2021-12-13 16:54:33 +00:00
John Stiles
5d3060ed94 Add support for stepping out from a function.
Stepping out is extremely similar to stepping-over, so this was mostly
working already.

Change-Id: Ib1c1ba96b45a732500e72b6da4cbfe41a1f75307
Bug: skia:12666
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/483196
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2021-12-13 16:43:49 +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
John Stiles
b1a97caf71 Revert "Trace function return values after function-exit."
This reverts commit 85cc1bece7.

Reason for revert: ends up not being useful after all

Original change's description:
> Trace function return values after function-exit.
>
> This will allow function return values to be easily seen when stepping
> "over." This has the unexpected side benefit of generating slightly
> fewer ops when a function has unoptimizable conditional returns.
>
> Change-Id: I48d23de635d3caaddff91aa595593d0371dfcdcb
> Bug: skia:12708
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/481076
> Reviewed-by: Brian Osman <brianosman@google.com>
> Commit-Queue: John Stiles <johnstiles@google.com>
> Auto-Submit: John Stiles <johnstiles@google.com>

Bug: skia:12708
Change-Id: I61ebb175b60d2060f6ad21b170238b37557b80be
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/482458
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2021-12-10 18:06:04 +00:00
Michael Ludwig
b05732e102 Rewind farther on topology intersect mismatch
Also fixes recursion end point update in recursive_edge_intersect, which
was causing us to search in the wrong area of the lines and falsely
report no intersection when there should have been one (which is then
detected by the topology check in intersectEdgePair() and more less
accurately corrected for).

Bug: chromium:1245359
Change-Id: I1d21c934a23c9b99c3767849ee19bc2f6c551d3f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/482456
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2021-12-10 15:46:53 +00:00
John Stiles
83b5237b53 Fix assertion when debug-tracing a void-return function.
The debug-slot code didn't expect to encounter a void type.

Change-Id: Ied452b51e1cf90a0c0bc24770f82e711105b8e82
Bug: skia:12708
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/482461
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2021-12-10 14:39:05 +00:00
John Stiles
c962042ed2 Add field to SkVMSlotInfo indicating function return values.
Function return values exist at the boundary between stack frames and
will need slightly special treatment by the debugger.

Change-Id: I017b5713919f507074f072d040332325307c2e81
Bug: skia:12666
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/482459
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-12-10 14:10:57 +00:00
Robert Phillips
a964a72174 [graphite] Reenable linear gradient shading
Bug: skia:12701
Change-Id: I51bfad4ff61f2ab32753e532eb5b6ee46d765303
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/481737
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-12-09 21:16:00 +00:00
Brian Osman
3695bdb587 Refactor SkMatrixProvider slightly
There was only one virtual method, so switch that to a bool stored in
the base class. The derived types exist as hints for the reader, and an
easy way to adjust how the new localToDevice is constructed.

With this change, we don't need SkSimpleMatrixProvider. SkMatrixProvider
is concrete, so we can use it directly. SkOverrideDeviceMatrixProvider
no longer needs the original provider for anything, so remove that
parameter. It now exists solely to inhibit the hitsPixelCenters flag.

Fix a few spots (SkParticleBinding, some sites in SkRuntimeEffect) where
we used SkSimpleMatrixProvider, even though the local coordinates being
passed did not obey the hits-pixel-centers constraints.

Most importantly, document how localToDeviceHitsPixelCenters works.

Change-Id: Ibe9060bac0822d0edf52a507d390bd198d8e6dbd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/482176
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-12-09 20:10:58 +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
0ee3e0c959 Fix source repetition in debug traces.
This fix appeared in prior CL patchsets, but got lost through rebases
and CL splits.

Change-Id: I1befff3830b40740f1e52e3e88f74484122027ce
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/481680
Reviewed-by: Julia Lavrova <jlavrova@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2021-12-08 21:45:25 +00:00
Jim Van Verth
97f89808d1 [graphite] Set up depth/stencil attachment
Change-Id: I57233c89fb27f09ca22509edeab79ea6b158b3c3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/481281
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2021-12-08 21:38:28 +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
Robert Phillips
5f4867d992 [graphite] Switch from using raw MSL to using SkSL
Bug: skia:12701
Change-Id: If286f9398c099298b1a543a12d4a28ba70f7a20b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/479062
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-12-08 18:41:37 +00:00
John Stiles
3856a5854e Revert "Add SkVM op trace_done to indicate completion of debug tracing."
This reverts commit 062652067b.

Reason for revert: design change removes need for this op

Original change's description:
> Add SkVM op `trace_done` to indicate completion of debug tracing.
>
> This op can be used to invoke a callback function and dump the log to
> disk when it is ready. SkRuntimeEffect doesn't have any other viable
> mechanisms for detecting that a paint has completed, AFAIK. We can
> wait for ~SkRTShader to occur, but there's no guarantee that this will
> happen quickly, and the SkPaint with the SkRTShader shader can be reused
> over and over again.
>
> Unlike other trace ops, this only needs a trace mask, not an execution
> mask (we are unconditionally done at the end of main).
>
> Change-Id: I6f7ee41f2005b65940d36dee892279d4f245509f
> Bug: skia:12708
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/479876
> 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: Ic4c4f5dd72541195f07ca32035267a20a82536e7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/481577
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 17:49:56 +00:00
John Stiles
543b8681c7 Add SkRuntimeEffect::MakeTraced API for SkShader debugging.
Color filters and blenders are currently not supported for tracing,
because we don't have access to the pixel coordinate, and so there is
nothing to compare the debug-trace coordinate with.

Change-Id: I7fe7fb4955b002432046ceef61c6f0a4c721a581
Bug: skia:12708
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/481278
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-12-07 22:34:00 +00:00
Brian Osman
8c3d183cc2 Rename SkSL 'srgb_unpremul' to just 'color'
Added comments to explain the semantics (both what's expected when you
set the uniform, and what you see in the shader). The old name was
confusing, because it sounded like you got an sRGB color in the shader.
This is terse, but I think it's the cleanest syntax - and for embedding
clients, they can use C++ (etc.) API to require that color uniforms are
assigned from color types.

Bug: skia:10479
Change-Id: If00ea754060494aaa83001a5b357687953de8a5f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/480577
Reviewed-by: John Stiles <johnstiles@google.com>
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-12-07 17:56:27 +00:00
John Stiles
85cc1bece7 Trace function return values after function-exit.
This will allow function return values to be easily seen when stepping
"over." This has the unexpected side benefit of generating slightly
fewer ops when a function has unoptimizable conditional returns.

Change-Id: I48d23de635d3caaddff91aa595593d0371dfcdcb
Bug: skia:12708
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/481076
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2021-12-07 16:32:44 +00:00
John Stiles
4c5d2f550c Show vectors and matrices properly in debug traces.
Matrices now include [C][R] notation and vectors indicate .x/.y/.z/.w.
Previously this information was missing, so you couldn't tell which slot
of a variable was being altered.

Change-Id: I590614372b1fc98e95e8fb5ebc3d318c449a8ee1
Bug: skia:12708
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/480798
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2021-12-07 15:14:54 +00:00
Julia Lavrova
4388f16262 Fixing comparison for structs and arrays
Recursive comparison with tests

Bug: skia:12642
Change-Id: I344812a26f9af7b8a904c6faf6319df86ce57d03
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/472997
Commit-Queue: Julia Lavrova <jlavrova@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2021-12-06 20:46:41 +00:00
John Stiles
062652067b Add SkVM op trace_done to indicate completion of debug tracing.
This op can be used to invoke a callback function and dump the log to
disk when it is ready. SkRuntimeEffect doesn't have any other viable
mechanisms for detecting that a paint has completed, AFAIK. We can
wait for ~SkRTShader to occur, but there's no guarantee that this will
happen quickly, and the SkPaint with the SkRTShader shader can be reused
over and over again.

Unlike other trace ops, this only needs a trace mask, not an execution
mask (we are unconditionally done at the end of main).

Change-Id: I6f7ee41f2005b65940d36dee892279d4f245509f
Bug: skia:12708
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/479876
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-12-06 18:44:27 +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
Brian Osman
20c6a947af Add SkImage::makeRawShader
This creates SkImageShader instances that do not perform color space
conversion, nor do they premultiply their pixels (if they started out
unpremultiplied). These are useful for runtime shaders that want
non-color inputs (like normal maps or lookup tables).

Includes GM that demonstrates lack of color conversion, and lack of
premultiplication in the context of a lighting shader.

Bug: skia:10479
Change-Id: Ic07aa8b8d3407ae5f81bc075648fdcba6d4cce29
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/477299
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-12-03 20:40:41 +00:00
John Stiles
29af7d5971 Update SkVMDebugInfo::dump to emit a human-readable trace.
dump() now emits the most important part of the debug trace: the actual
trace itself. This will make tests easier to write and reason about.

Change-Id: I414e26b80a05c9f7ea21956d84c5a682a5f3c274
Bug: skia:12708
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/479703
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-12-03 20:14:43 +00:00
John Stiles
d4713ad528 Move trace hooks into the skvm::Builder.
I ran into a snag while trying to hook up SkRuntimeEffect with debug
tracing. Runtime effects only have access to a skvm::Builder, and are
never exposed to the full skvm::Program. SkVMBlitter is responsible for
assembling the full skvm::Program, but is oblivious to runtime effects
and nested skvm sub-programs. Additionally, multiple runtime effects can
(and often do) coexist within a paint.

This CL changes how debug traces are enabled. skvm::Program no longer
has a `attachDebugTrace` method. Instead, this method lives on the
skvm::Builder. Calling `attachDebugTrace` generates a "trace-hook ID"
(which is actually an index into a vector of TraceHook pointers).
Every trace opcode now includes this trace hook ID. When the Builder
assembles a final Program, it copies the TraceHooks into the Program.
The skvm interpreter uses the trace hook ID on the op to dispatch a
trace command to its associated TraceHook.

From a user perspective, this doesn't change very much, but it does
mean that the SkVM Code Generator now supplies a TraceHook for us
(since it adds trace ops to the Builder and needs to know the proper
trace-hook ID).

Change-Id: I8bd5fea24f477f81470fae8ba41be45f76949407
Bug: skia:12708
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/479597
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-12-03 20:09:22 +00:00
Brian Osman
85bd4dff59 In SkImage::MakeFromEncoded, support overriding alpha type
Use that to preserve the alpha type of (unpremul) SkImages when
serializing. This ensures that the new GM works correctly in
serialize-8888, and is required for an upcoming "raw" image feature.

Change-Id: I747803c2928cbb5872d4c97a421701248d8f6a51
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/478957
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Leon Scroggins <scroggo@google.com>
2021-12-02 22:31:26 +00:00
John Stiles
d7c3b21b79 Revert "Enable various switch tests in ES2 mode."
This reverts commit ffe365eb4d.

Reason for revert: crash inside IntelHD405 Vulkan driver
http://screen/6ugVDdjJpqDkxX6

Original change's description:
> Enable various switch tests in ES2 mode.
>
> switch is no longer an ES3-specific feature.
>
> Change-Id: Ic878a77268e517e17699c2e35a37da6b0a7765dd
> Bug: skia:12450
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/452320
> Auto-Submit: John Stiles <johnstiles@google.com>
> Commit-Queue: John Stiles <johnstiles@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>

Bug: skia:12450
Change-Id: Id6f32a084f1bc7b2b3a1e5fb0b82d2011e4ba780
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/479059
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-12-02 19:03:11 +00:00
John Stiles
2756b0ee02 Reduce the number of extra bit_and ops caused by SkVM traces.
Previously, the trace opcodes took a single mask argument, which was
computed as `execution mask & trace mask`. This led to extra bit_ands in
the output, as this value would be need to be recalculated every time
the execution mask changed.

To reduce this cost on program size, the trace ops now take two mask
arguments and require that both must be true. We have four register
slots at our disposal in an Op, which is more than we need, so this
doesn't really cost us anything.

(As an extra minor optimization, if one of the masks is "always-on", we
optimize it away. This avoids burning a register just to hold a ~0
immediate value.)

Change-Id: I9eb71292a1983e71b03c7ac842534beb3d6bbf17
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/478456
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-12-02 18:15:34 +00:00
John Stiles
6c32794d2b Add JSON serialization for trace info.
Add an array which represents the trace itself into the SkVMDebugInfo.
Since we expect complex programs to emit a lot of trace data, we try to
keep the JSON representation here compact. Ops and their data are
represented as a compact array of integers. Data fields can be left
unspecified; these are assumed to be zero.

Change-Id: Ia52ad280ab5989496eb495c4efb8b99aa72cda5f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/477983
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-12-02 18:12:47 +00:00
John Stiles
ffe365eb4d Enable various switch tests in ES2 mode.
switch is no longer an ES3-specific feature.

Change-Id: Ic878a77268e517e17699c2e35a37da6b0a7765dd
Bug: skia:12450
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/452320
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-12-02 17:17:43 +00:00