These changes reduce failing targets for skia_unittest when adding
"//build/config/compiler:prevent_unsafe_narrowing" to component("skia")
from 588 to 484 on my local Mac build.
Bug: chromium:1292951
Change-Id: Ice8210e1a2f038feb84184c88e6a34f52168952f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/552376
Commit-Queue: Greg Daniel <egdaniel@google.com>
Auto-Submit: Peter Boström <pbos@chromium.org>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
This change has the potential to break existing clients if they pass
nullptr as the childShaderName, which used to be supported. To fix
this breakage, pass the empty string instead of null.
Change-Id: I984ec0e12be5bb0a82ec5b719fec48ee7d577dc4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/557898
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Notes to reviewer:
- modules/canvaskit/npm_build/types/canvaskit-wasm-tests.ts
is not actual test code that is executed. It is parsed with
our types (index.d.ts) only, as a way to make sure the
declared types match up with how one would write code.
- MakeDisplacementMap looked a bit strange when I tried to
use it. It might be easiest to debug if we land as is,
so we can use jsfiddle to test dynamic parameters.
- modules/canvaskit/package-lock.json was updated by running
npm audit fix.
- There are two copies of the test cases, one for the old
way, and one for Bazel. Getting Bazel on the CI is currently
blocked (http://review.skia.org/547576)
- I am adding all the image filters in by default for now,
we can measure code size and adjust them if needed later.
Change-Id: I2f4eae71de7ee5d53f0c74147d0662f156522d18
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/555596
Owners-Override: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Change-Id: I294453bb18b9ecd46a84cdfaac831679437a4fe2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/557589
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
When allocating memory with malloc(), allocators can provide a larger
size than requested. SkArenaAlloc tries to guess what jemalloc would
return, and align its allocation requests on the to-be-provided
size. Some platforms (e.g. glibc or bionic with malloc_usable_size(),
macOS with malloc_size()) can provide the actual value.
This CL adds support to skia's malloc() wrappers to get this data, and
to SkArenaAlloc to use it. Note that as is, this is a no-op in skia
proper. Indeed, clients can (and do, for instance Chromium does)
override sk_malloc() (and friends), so Skia cannot assume that
sk_malloc() memory comes from malloc().
To implement this, a client needs to override sk_malloc_usable_size() to
return the actual value.
Bug: chromium:1335342
Change-Id: Id8ea177e9adccc9c4446fe379b6f05e726ea07ce
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/549516
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Change-Id: I07c0cb63286cb2c74853a49a44a9ee5ae7b994c9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/557102
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
SkSL versioning was originally based on a binary "strict ES2" versus
"everything else" split, but now we have an SkSL::Version enum which
gives us more fine-grained control.
Change-Id: Ic7e26381cc3c4c1868bd6ee48d4f44d704dae119
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/557378
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
This CL adds two new APIs to SkCanvas: getBaseProps, and getTopProps.
SkCavas::getBaseProps is functionally identical to getProps, but returns
the SkSurfaceProps by value, rather than via an 'out' parameter.
SkCanvas::getProps is now considered deprecated.
SkCanvas::getTopProps returns the 'currently active' SkSurfaceProps,
i.e., it returns the props from the "top device". This is useful
because the SkSurfaceProps can change when creating new layers.
Bug: skia:13483
Change-Id: Ia1d9a10ffdd929427f1f2c0a7c4ba6965d4bd3c0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/554736
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Auto-Submit: Ian Prest <iapres@microsoft.com>
Putting the dictionary in the Recorder itself was not very useful; the
recorder is inaccessible throughout the call chain of pipeline setup.
The ResourceProvider, on the other hand, is accessible everywhere we
need it, hangs directly off the Recorder, and has the right lifetime
for our purposes.
Change-Id: I0f494e5890845d73343a71359900598d63b66764
Bug: skia:13405
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/556917
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
This has been replaced by findOrCreateRuntimeEffectSnippet.
Change-Id: I26e1f85c74071b14b75ab86410e4cc30a81bf873
Bug: skia:13405
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/552716
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Pass an optional label parameter to GrBackendTexture and pass
it to MakeWrapped of GrGLTexture because almost all textures
that are coming clients are things where the client owns the
gl texture and passes it into Skia as a wrapped texture via a
GrBackendTexture.
Bug: chromium:1164111
Change-Id: I4bfddda956c72b53d0070595ef3268ee1a2b747f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/555597
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
SkTypes.h was found exporting <stddef.h> and <stdint.h>.
Thus if a Skia file includes SkTypes.h, it did not need
to include either of those files to use things like
size_t or uint8_t respectively. [1]
This also resulted in strange IWYU warnings like:
warning: size_t is defined in "include/core/SkTypes.h", which isn't directly #included.
Thus, this CL removes those additional exports, and as a result,
adds many more includes of <cstddef> and <cstdint>.
The second change this CL is to not use the default IWYU
mappings which are hard-coded into IWYU [2]. These defaults
are valid, but make suggestions for the C version of
headers and not the C++ ones (i.e. <stddef.h> over <cstddef>).
To make these recommendations align better with our preferred
style (the C++ ones), we use IWYU with --no_default_mappings
and then have to expand our existing mappings to better deal
with how IWYU would resolve some of these headers.
[1] https://codereview.chromium.org/1207893002/#msg49
[2] 4c0f396159/iwyu_include_picker.cc (L1221-L1234)
Change-Id: Iafebe190f8f3e86f252147b9f538c182bcc34af4
Bug: skia:13052
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/555516
Auto-Submit: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Also expose a size() function on the public IB and VB types.
Bug: skia:12720
Change-Id: Ibeccf6d2d6ba411e9e77be582d0cb1622bc76ccd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/555005
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Change-Id: I028bd133778d14edcb22ccef0c35c5a8e3d7d552
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/554516
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
This will make our Bazel rules in G3 easier to use.
We will have to clean up a lot of clients (and this still
might require a manual G3 roll to land to account for the
source files).
Eventually, we will be able to delete the old one
//include/third_party/skcms and //third_party/skcms
Bug: skia:12451, b/237076898
Change-Id: I9fd55607cbb7e1196d175aa8f140e99a73505c89
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/554056
Reviewed-by: Brian Salomon <bsalomon@google.com>
Bug: skia:13357
Change-Id: Ib2566e9c38f667368b20f18ed2b1851615602cad
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/548480
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
Bug: skia:13430
Change-Id: I6c577b459bc3a699e6c660d21d2b119643fe1f88
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/553877
Reviewed-by: Eric Boren <borenet@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Part of an ongoing effort to move chromium away from SkColor and towards SkColor4f: crbug.com/1308932
Many tests use SkBitmap::getColor to validate pixels, this means that we're now in a state where we draw using float colors but then have to validate the operation with the nearest integer color value. As can be seen in SoftwareRendererTest.SolidColorQuad.
Change-Id: Ic4493e578c8f4066c2439f1e793eef10eb4f4056
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/553797
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
This will keep the runtime effect alive and findable until we are ready
to paint it.
Change-Id: If047dfa8be1376a7a2a092211e0cbbdedfd2faf0
Bug: skia:13405
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/553579
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
We are on C++17 now and already use `if constexpr` where necessary.
Change-Id: Icc780b6e4db7ae6ccc648ea333a172f11bf0581c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/553584
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
The Context is going to have to be able to make some Resources when we
insert a recording onto it. Some examples of this will be discardable
MSAA and Stencil attachments that are shared by all Recordings.
Bug: skia:13357
Change-Id: I9d49f640404176d38416372fd208b591b032d599
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/553581
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
This CL is mostly moving the queue/command buffer systems off of Gpu and
Context and moving them to the QueueManagerClass.
Bug: skia:13357
Change-Id: I0ee5096c84b1210082745fafd2d38791fd9be52e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/549557
Reviewed-by: James Godfrey-Kittle <jamesgk@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
Graphite's uniforms (SkUniform) distinguish between "Float" and "Half"
as separate types, so we now preserve this information in a Uniform
flag. We didn't have any tests verifying the behavior of Uniform flags
in SkRuntimeEffect at all, so I added a test here.
Change-Id: If6323ce26eeca2ef7da6c7424ad7350c6a0b7362
Bug: skia:13405
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/553594
Reviewed-by: Brian Salomon <bsalomon@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Bug: skia:13118
Change-Id: I90aee8cff625ad822fa9d62f803a8badbe51925e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/552676
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Our SVG code depends on our XML code which depends on expat.
See also cl/457481999
Change-Id: I83b61f5d73570d0aa7e851a01ccd019b4b1019e4
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/553376
Reviewed-by: Florin Malita <fmalita@google.com>
Change-Id: Id58bf93098fa62f621614937a2d1524790f73f58
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/551708
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Enable passing in a feature-test function that returns a Boolean
with the intention of being able to use it in FreeType library
initialisation.
See also:
https://gitlab.freedesktop.org/freetype/freetype/-/merge_requests/168
Bug: skia:13448
Change-Id: I6c985201552b54f2fa99e911265b7303ff8b2897
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/551637
Commit-Queue: Dominik Röttsches <drott@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Florin Malita <fmalita@google.com>
Added changes for public.bzl
This is a reland of commit 4a375fe213
Original change's description:
> Move SkSubRun to src/text
>
> Change-Id: I5c1040b8236dc792de20495a3fea3c0be6e31c20
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/549847
> Reviewed-by: Brian Osman <brianosman@google.com>
> Commit-Queue: Herb Derby <herb@google.com>
Change-Id: I86e342a416a3c97bf972c496b93b37e35cd09c19
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/550496
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
According to https://en.cppreference.com/w/cpp/container/span/span (2),
it is undefined behavior if [first, first + count) is not a valid
range, so it is standards-conforming to assert on this span.
This caught one case in GlyphRun where we were creating an invalid
span (which was apparently harmless in practice).
Change-Id: Ia0661b3bd13c2c5773492960eea11b1a294072d5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/550499
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Will be used in SkMesh buffer update API and likely for unit testing of changes related to Issue 13427.
Bug: skia:13427
Bug: skia:12720
Change-Id: I487ee512d4b8bb61c533c7047bdbffcde9779885
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/549570
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
This was originally done with the intent of adding a third field
(number of pointers in the data) but we may be able to get away with
keeping the two-byte Header after all. Having the data in an actual
struct does make refactoring a lot easier, at any rate.
Change-Id: I25a4e46b45f3f9c93eb16bc4d51b6624d7e319ba
Bug: skia:13428
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/550183
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Bug: skia:12701
Change-Id: I53bbabb2aba44e3bfc215df81dae1ae59d149263
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/544319
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
[[maybe_unused]] is built in to C++17.
Change-Id: I5e49d0801878fd9fbca62ab28080aa856e33ca79
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/550500
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Herb Derby <herb@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Spent 10 minutes searching for this macro because I expected it to have
"pack" in the name, like __attribute__((packed)) or #pragma pack.
Adding a little lifeline for future me.
Change-Id: I8c4f8cbd4febdea6bcd5698d267a2673246295e9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/550184
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Change-Id: I5c1040b8236dc792de20495a3fea3c0be6e31c20
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/549847
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
This adds mostly-functional compute shader output to SkSL. This does not
add overall compute shader support to Skia; it still needs to be
integrated into the Skia pipeline before it is possible to actually use
compute shaders in practice.
Change-Id: Ic5c69863704f141d16bb191224a817e44f4a8565
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/539060
Reviewed-by: Arman Uguray <armansito@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Change-Id: I33121076bac3ceca19c81ff9fb47e4b024a14230
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/549838
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
Previously, we were storing sk_sp<SkRuntimeEffect> objects in static
variables. This would presumably lead to destructors executing during
atexit time, which is unnecessary and can lead to shutdown bugs. We no
longer attempt to free these objects.
Change-Id: I0b09d7ab3dc67c9b8fbc35c81d72ff57b0592c03
Bug: skia:13426
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/549658
Reviewed-by: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Use template guides for deducing the type needed by the CTOR.
This allows SkSpans to be deduced when things like vector,
array, A[], etc. are passed as parameters without using SkMakeSpan.
Change-Id: Ieedcbddc8d40281f819b0c798acd178a12a05891
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/549568
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
Change-Id: I7a4cd8e2c629ba53e40adc379ea92f86f70d11da
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/549857
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Auto-Submit: Jim Van Verth <jvanverth@google.com>
Bug: skia:13118
Change-Id: Icaf2b0914ce7943f57e1ab23e7778d1dcb811cc4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/548781
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Bug: skia:13118
Change-Id: I0d6e0a9f542680456d3de82a32376722c5b9cd1d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/549097
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Use std::size and std:data to get needed values.
Add a SkMakeSpan for initializer_list.
Change-Id: I43b4b2391323c84b3d6aad22ac4775487c6d5570
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/549565
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Herb Derby <herb@google.com>