Commit Graph

11461 Commits

Author SHA1 Message Date
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
Brian Osman
2f2977e19d SkSL: Add color transform intrinsics
These convert a color between the working color space and a known,
useful space (linear TF, sRGB gamut).

Bug: skia:10479
Change-Id: I3308e691beeaca5120ed0c2e30cf08661caa3684
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/481416
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-12-28 14:05:49 +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
Lei Zhang
7f99e8d824 Remove SkM44.h include from SkImage.h.
It is not needed there. Add it to files that do need it instead.

Change-Id: I2fa32d423972c4c91c4fbfe5508bd50323201714
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/463556
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Auto-Submit: Lei Zhang <thestig@chromium.org>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2021-12-23 13:45:20 +00:00
Brian Salomon
bc35172ce9 custom mesh produces color in user defined color space and alpha type
Bug: skia:12720
Change-Id: Icece250cd2642e63f9e04f139dc951f34f82c2ad
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/487383
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2021-12-22 16:22:44 +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
Brian Salomon
12532a3a8f Add indexed support to custom mesh drawing
Bug: skia:12720
Change-Id: Ia40f2325e565d2dfbbac285b45eec6efc2944532
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/486896
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2021-12-21 19:51:07 +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
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
Herb Derby
dc60ca197e cleanup TODOs, and warnings
The API for a remote glyph cache had a couple of TODO's left waiting
for Chromium to implement the functions. This happened three years
ago.

This is waiting for the Chromium CL to finish:
https://chromium-review.googlesource.com/c/chromium/src/+/3338117

Change-Id: If8e3de619f0f4be7044e6955204b599c5a42e802
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/484437
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2021-12-15 17:38:34 +00:00
Herb Derby
5d6e51dbec remove SK_EXPERIMENTAL_ADD_ATLAS_PADDING from Skia
As of the following Chromium CL the flag
SK_EXPERIMENTAL_ADD_ATLAS_PADDING is no longer used.

https://chromium-review.googlesource.com/c/chromium/src/+/3332838

Change-Id: I026b736dc26268fbe888fd3a8b56d056f4127e36
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/483597
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2021-12-13 18:52:03 +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
Herb Derby
c279e7640b add bilerp atlas support flag
Move the compile-time flag SK_EXPERIMENTAL_ADD_ATLAS_PADDING,
to a runtime flag in GrContextOptions.

Bug: chromium:1275890

Change-Id: I7e051cd4834ac44958b1431976535519e8bdaa3e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/482416
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2021-12-10 20:33:57 +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
Heather Miller
e3c1c4b589 Update Skia milestone to 99
Change-Id: Ifc671649da20706dbce9480dc60b4184a0bb8bf7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/482636
Reviewed-by: Eric Boren <borenet@google.com>
Commit-Queue: Heather Miller <hcm@google.com>
2021-12-10 14:47:56 +00:00
Lei Zhang
e4f148f09f Remove unneeded include from SkFloatingPoint.h.
The _POSIX_VERSION check was initially added in
https://skia.googlesource.com/skia/+/d3fbd34099, and its usage was
removed in https://skia.googlesource.com/skia/+/d7dc76f7e9. Since that's
long gone, remove the include associated with that. Then do IWYU to fix
the build.

Change-Id: Ic256d64a2e02bd8ada03513bb04b0e733576c474
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/482256
Auto-Submit: Lei Zhang <thestig@chromium.org>
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2021-12-09 22:45:23 +00:00
Brian Salomon
eb6851ab51 Make simple coord/size getters on Sk[I]Rect constexpr
Bug: skia:12720
Change-Id: I349a3dd8ae58eefcadbace7847798fbe57227a41
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/482008
Auto-Submit: Brian Salomon <bsalomon@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-12-09 22:17:30 +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
Brian Salomon
639256aa41 Update docs for drawVertices/Patch to reflect changes already made.
SkBlendMode always applies when colors are present. Also clarify what
"src" and "dst" are to blend.

Bug: skia:12662
Change-Id: I0a8be2cec2dd6b55e3c7de3f1879cc46cacf0822
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/481438
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2021-12-08 15:35:01 +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
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
Nigel Tao
8d95ffce92 Clarify SkCodec::getFrameInfo comment re animation
Change-Id: I7f20b850baf39fd01d7d5f817c52179920121e09
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/478716
Auto-Submit: Nigel Tao <nigeltao@google.com>
Reviewed-by: Leon Scroggins <scroggo@google.com>
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Derek Sollenberger <djsollen@google.com>
2021-12-06 14:46:58 +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
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
Kevin Lubick
4bd08c52c0 [infra] Add SkParagraph (harfbuzz, ICU) to Canvaskit Bazel build.
As a follow-up to https://skia-review.googlesource.com/c/skia/+/476219,
this sketches out how we can maybe use cc_library for the things
in //modules to make sure something in //src doesn't depend on
anything in //modules, for example.

The following succeeds:
bazel build //modules/skparagraph:skparagraph --config=clang \
  --shaper_backend=harfbuzz_shaper --with_icu

As does `make bazel_canvaskit_debug` in //modules/canvaskit

Suggested Review Order:
 - third_party/BUILD.bazel for ICU and harfbuzz rules. Pay
   special attention to the genrules used to call the python
   script for turning the icu .dat file into .S or .cpp.
 - bazelrc and bazel/ for new flags and defines that control
   use of ICU and harfbuzz. Unlike GN, with the public_defines
   that get added in automatically if icu or harfbuzz is
   depended upon, we need to set the defines at the top level.
   This necessity might go away if we change the atoms to
   depend on //modules/skshaper, which could define that flag.
 - Top level BUILD.bazel files in //modules/skparagraph,
   //modules/skshaper, //modules/skunicode, //modules/canvaskit
 - All other .bazel file changes are automatic.

Bug: skia:12541
Change-Id: I38a9e0a9261d7e142eeb271c2ddb23f362f91473
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/478116
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Leandro Lovisolo <lovisolo@google.com>
2021-11-30 21:01:06 +00:00
Kevin Lubick
6ba9f702ba [bazel] Try adding cc_binary rules that use generated rules
To make the atomic rules a bit easier to work with, in many
of the folders, this adds in cc_library rules to group
together the sources from that folder (and subfolders
where prudent). We only needs sources because those atoms
should have their headers as deps.

One issue that was pointed out is that there is currently
no way to restrict the inclusion of certain packages,
a la, `gn check`. For example, there is no mechanism from
stopping a dev from adding
#include "modules/canvaskit/WasmCommon.h"
to something in //src/core (except circular dependencies).
We can probably address that using Bazel's visibility
rules as needed:
https://docs.bazel.build/versions/main/visibility.html
https://docs.bazel.build/versions/main/be/functions.html#package_group

It is recommended to look at this CL patchset by patchset.
PS1: Update gazelle command to generate rules in more folders.
PS2: A few changes to make generation work better.
PS3: The result of running make generate in //bazel
PS4: Adding the rules to build sksllex, the simplest binary I
     could find in the Skia repo.
PS5: Adding the rules to build skdiff, a more complex binary.
     I tried a few approaches, but ended up gravitating back
     towards the layout where we have each folder/package
     group up the sources. I imagine at some point, we'll have
     skdiff depend on skia_core or something, which will
     have things like //src/core, //src/codecs, //src/pathops
     all bundled together.
PS7: Added in the groupings of sources, similar to what we had
     earlier. I liked these for readability. These helped fix
     up the //:skia_core build, and by extension, the CanvasKit
     build.

Change-Id: I3faa7c4e821c876b243617aacf0246efa524cbde
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/476219
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Leandro Lovisolo <lovisolo@google.com>
2021-11-30 18:18:53 +00:00
Herb Derby
705dce533a add SK_API to slug so chrome can use it
Change-Id: I848eca3a9ddfabadf82c86e4b3396aaa0e55757c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/478056
Commit-Queue: Herb Derby <herb@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Auto-Submit: Herb Derby <herb@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-11-30 17:27:54 +00:00
Derek Sollenberger
0612b52174 Reland "Add public API support for SkImageFilters::RuntimeShader"
This new image filter constructor enables SkRuntimeEffects to be
used as shaders within the ImageFilter DAG. The shader is created
lazily using the SkRuntimeShaderBuilder enabling the resulting
shader to consume the previous stage of the ImageFilter graph.

This relands commit ad9d774c1f after
fixing the threading issue found by the TSAN bot.

Change-Id: I06dc4cf6a304b14804c55531a5bc3f2afa34e219
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/477156
Auto-Submit: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-11-29 22:23:26 +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
Leandro Lovisolo
5f4055d03d Revert "Add public API support for SkImageFilters::RuntimeShader"
This reverts commit ad9d774c1f.

Reason for revert: Task Test-Debian10-Clang-NUC7i5BNK-GPU-IntelIris640-x86_64-Release-All-DDL3_TSAN has been failing since this CL landed.

Original change's description:
> Add public API support for SkImageFilters::RuntimeShader
>
> This new image filter constructor enables SkRuntimeEffects to be
> used as shaders within the ImageFilter DAG. The shader is created
> lazily using the SkRuntimeShaderBuilder enabling the resulting
> shader to consume the previous stage of the ImageFilter graph.
>
> Change-Id: I5d6917e34a8e5fdd053399f15a1e2cc7409e686f
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/470459
> Reviewed-by: Brian Osman <brianosman@google.com>
> Reviewed-by: Michael Ludwig <michaelludwig@google.com>
> Commit-Queue: Derek Sollenberger <djsollen@google.com>

Change-Id: I0367a5c480df109c6116eb168792fe3c2fc58807
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/475644
Auto-Submit: Leandro Lovisolo <lovisolo@google.com>
Reviewed-by: Leandro Lovisolo <lovisolo@google.com>
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Leandro Lovisolo <lovisolo@google.com>
2021-11-23 20:58:15 +00:00
Kevin Lubick
cc9d0cd5a9 [bazel] Add go/gazelle to WORKSPACE and use c++ extension.
This adds a simple go program to test the installed go
toolchain, and a Make rule to codify the arguments to
our gazelle binary, built with extensions.

I could not figure out how to get the .json file to work
with the gazelle() Bazel rule, but this works ok for now.

Bug: skia:12541
Change-Id: I5067b15c7518951aeb69559d3871799d3b5745f4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/475716
Reviewed-by: Leandro Lovisolo <lovisolo@google.com>
2021-11-23 20:00:15 +00:00
Kevin Lubick
9488e0237d [infra] Experiment generating BUILD.bazel files
This uses the gazelle extension from
https://skia-review.googlesource.com/c/buildbot/+/473357

Review Tips:
 - Ignore any changes to .h or .cpp files. Those have been
   pulled out into their own CLs.
 - Start with bazel/macros.bzl.
 - Read the CL with the generation code, if you haven't already.
 - Look at third_party/file_map_for_bazel.json.
 - See experimental/bazel_test for an idea of how a cc_binary
   would be made.
 - Spot check one or two of the BUILD.bazel files.

This CL generates the "atomic" rules for src/, include/ and
modules/skshaper, as a starting point.

`bazel build --config clang //include/...` works

`bazel build --config clang //src/...` starts compiling,
(which verifies that the BUILD.bazel files are all valid),
but runs into errors because not all third_party deps have
been resolved, and there are some files missing from the
toolchain still (e.g. EGL headers).

Change-Id: Ib7e0fb0efdb9f08655f06cbc56e9bb4cf416294b
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/474240
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Leandro Lovisolo <lovisolo@google.com>
2021-11-23 18:53:16 +00:00
Kevin Lubick
7f5b19bd69 More angle brackets for system includes for third_party deps
"In general anything in third_party should probably use angle brackets"

A follow-on from https://skia-review.googlesource.com/c/skia/+/474756

Change-Id: I4a2b07e1625952637c090a82971ab2ab426db034
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/475098
Reviewed-by: Brian Salomon <bsalomon@google.com>
2021-11-23 18:35:52 +00:00
Derek Sollenberger
ad9d774c1f Add public API support for SkImageFilters::RuntimeShader
This new image filter constructor enables SkRuntimeEffects to be
used as shaders within the ImageFilter DAG. The shader is created
lazily using the SkRuntimeShaderBuilder enabling the resulting
shader to consume the previous stage of the ImageFilter graph.

Change-Id: I5d6917e34a8e5fdd053399f15a1e2cc7409e686f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/470459
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Derek Sollenberger <djsollen@google.com>
2021-11-23 15:08:42 +00:00
Herb Derby
15ecccf0dd expand SkCanvas with doDrawSlug, etc.
Follow the ordinary pattern on SkCanvas for handling GrSlugs. This
should allow more flexibility in the future.

Change-Id: Ic498b5d081a1c7e44c2864439423910c452408b7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/474899
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2021-11-23 14:41:32 +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
Brian Salomon
90ef83af20 Remove drawPatch/Vertices helpers that don't take SkBlendMode
Bug: skia:12662
Change-Id: Ic18220668a4f87e7340a53b3f191887a7a016a04
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/473141
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2021-11-18 21:57:32 +00:00
Brian Osman
45bc991e5d Reland "Remove layer-coverage-tracking experiment"
This is a reland of 688cb15faa

Original change's description:
> Remove layer-coverage-tracking experiment
>
> This effectively reverts reviews.skia.org/122000
>
> Bug: skia:10987
> Change-Id: I989241110f17c0e3c2a896aea4bc2bc4cc8c910f
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/472801
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Brian Osman <brianosman@google.com>

Bug: skia:10987
Change-Id: I16493df8bd7942261d14c01747d0fdc91bbe5467
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/473143
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-11-18 19:34:39 +00:00
Brian Osman
1c3b75bf35 Zero-initialize uniform data in SkRuntimeEffectBuilder
Change-Id: Id7445c28fca3a74cb2716832e821d651be7bb883
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/473142
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-11-18 17:15:07 +00:00
Brian Osman
8d55cab6bd Revert "Remove layer-coverage-tracking experiment"
This reverts commit 688cb15faa.

Reason for revert: Android roll & CK bots

Original change's description:
> Remove layer-coverage-tracking experiment
>
> This effectively reverts reviews.skia.org/122000
>
> Bug: skia:10987
> Change-Id: I989241110f17c0e3c2a896aea4bc2bc4cc8c910f
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/472801
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Brian Osman <brianosman@google.com>

Bug: skia:10987
Change-Id: Id2becfff07e4d9d72231939fb415a34ff9d96ed8
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/473140
Auto-Submit: Brian Osman <brianosman@google.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2021-11-18 14:30:11 +00:00
Brian Osman
688cb15faa Remove layer-coverage-tracking experiment
This effectively reverts reviews.skia.org/122000

Bug: skia:10987
Change-Id: I989241110f17c0e3c2a896aea4bc2bc4cc8c910f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/472801
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-11-17 23:29:24 +00:00
Greg Daniel
2211c2c4bd Store whether or not a VkImage is from a swapchain and return it in drawable info.
This is done for webview which needs to know whether it is drawing
directly into the main window surface or in a layer.

Change-Id: I0a3f6f81bcf65907f9d51651035bae912c3a34ac
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/468616
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2021-11-16 21:14:59 +00:00
John Stiles
33fb008669 Add parser support for u suffix on literals.
Because SkSL is much more permissive than GLSL about literal types, we
don't actually need to treat values any differently when the `u` suffix
is added. That is, `uint x = 4000000000;` already worked fine. When we
encounter the `u`, we just ignore it. This also means that a literal
like `-100u` would be accepted without complaint (although you'd get a
range error if you tried `uint x = -100u;`).

The value-add here is that it removes a speed bump when porting GLSL
code to SkSL. The Filament example shader used the `u` suffix anywhere
that bitwise ops were present; finding and removing all of them was a
chore.

Also of note: the `u` suffix was only added to GLSL in ES3, but we
"support" it everywhere. (We could go out of our way to detect it in
ES2 and flag an error, but that benefits no one.)

Change-Id: I4bf643612c8cf17710e9bad50a0c16f5936bbe88
Bug: skia:12634
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/471756
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:50:14 +00:00
Kevin Lubick
ef3d6af042 [infra] Add POC Bazel rules for CanvasKit
Many things are not enabled currently (e.g. Skottie, Paragraph),
but we can render many APIs using WebGL.

To turn on Paragraph, etc, we'll need to tackle fonts, which
is a separate effort.

This also changes where the build artifacts go. ./build/ is
easier to deal with than the old way of sticking them in
./npm_build/bin

Change-Id: Ia377360af580a887d03630670438fea2e3157e90
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/470682
Reviewed-by: Leandro Lovisolo <lovisolo@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2021-11-12 21:38:46 +00:00