- SkSLMemoryLayout now handles WGSL uniform and storage address space
memory alignment and size calculations.
- MemoryLayout::IsSupported is now an instance method that checks for
type support based on the specified language standard.
- Unit tests have been added for WGSL memory layout types.
Bug: skia:13092
Change-Id: I2fe161998a0b551ca7c3c1d118b6a8cc1ae95a5b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/545398
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Arman Uguray <armansito@google.com>
In a followup, I'll be making changes to this algorithm for skia:13378.
This CL migrates the code as-is.
Change-Id: I86cfddeb7c8eb6d4e191371944fb7c3707f13ba6
Bug: skia:13378
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/546418
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Arman Uguray <armansito@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
DSLType is now a simple wrapper around SkSL::Type*. Previously, its type
was determined through a combination of a Type* and a TypeConstant enum,
and fSkSLType == nullptr was used as a sentinel to mean "use the type
constant instead", which meant that we couldn't have a null DSLType
as it would fall back to the type-constant.
We can now return `DSLType(nullptr)` to indicate an error case in type
handling code, instead of needing to wrap the DSLType in an optional<>.
Change-Id: Iebaab86162b526a7fcb93d253367a7e4881ef6d0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/545781
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Move SubRunContainer, and all the associated classes used by it.
Change-Id: Ib61787f1e8442f0f8cc1354fbc04a867e3b6c670
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/545776
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Herb Derby <herb@google.com>
DSLType stored an `fPosition` which was only used in one place, when
reporting that a function is not allowed to return a particular type.
Those errors now highlight the type and function name together, which is
not really any worse than before. This allows us to shrink DSLType down
to its minimal form, just a pointer to an SkSL::Type and nothing else.
Change-Id: I4b430cb996472da0ae57bc2ab095cd123d2c3f51
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/546097
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
This CL removes the TypeConstant member from DSLType. The constructor
which takes a TypeConstant now sets the `fSkSLType` field immediately
instead of saving the value and deferring lookup until `skslType()` is
called.
This caused some ripple-effect issues in type setup code which were
fixable by replacing nullptr with Poison.
Change-Id: I8fa73cdf5f0bcd3de143c9a25ea43392d75c7dec
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/545780
Reviewed-by: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
With a hot Bazel cache, https://task-scheduler.skia.org/job/4XhwJfG1wR38Hp3dF1pI
took 59 seconds and did not have to wait 1-2 minutes
for TaskScheduler to schedule a prerequisite task
and Swarming to deduplicate said task, which is
the best case scenario for "all hot caches".
Change-Id: Ic86599e0b886ecded836641cceb19b623065a91e
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/546136
Reviewed-by: Eric Boren <borenet@google.com>
MSVC is a very marginal compiler for us (and we don't call SkPopCount that often) so we've deemed it not worth the extra complexity to handle the __popcnt intrinsic.
Change-Id: I1d838727eab503cd99a72d07e9787280d0948b29
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/545896
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
In general, SkSurfaceProps is only needed when rendering text. However,
there are several existing APIs that don't allow SkSurfaceProps to be
passed in by the user.
This change adds new SkSurfaceProps parameters to several public-facing
APIs:
1. SkRasterHandleAllocator::MakeCanvas
-- The props are used by the canvas whenever text is rendered.
2. SkImage::MakeFromPicture and SkImageGenerator::MakeFromPicture
-- The props are used to render any text in the SkPicture object.
Change-Id: Ic48e8a30bb12b3170415c644de1a007b5eefb818
Bug: skia:13369
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/545396
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Needed to fix the Dawn and Harfbuzz Bazel rules.
Change-Id: I21f63c970bdc972b97e42ef85d82d7f478bd45e2
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/545721
Reviewed-by: Eric Boren <borenet@google.com>
Organization v3.5, if we are keeping track :)
This splits the "srcs" filegroup into "srcs" and "private_hdrs",
and renames "hdrs" to "public_hdrs".
To assist with the split, I created the macro split_srcs_and_hdrs.
Rather than keep two separate lists of header and source files,
I figured it would be easiest, at least for the common case,
to keep one list of files and then have a for loop split them
apart. I've tried to be consistent with having the list
of files be named with a _FILES suffix - maybe we can use this
as a marker to generate .gni files in the future?
Suggested review order:
- //bazel/macros.bzl. Note this needs a corresponding
G3 change (http://cl/452279799) as well. The exports_files_legacy
change is the better approach to something I manually
handled yesterday when fixing the G3 roll.
- //BUILD.bazel to see the new target skia_internal and
the previous skia_core renamed to skia_public.
- //src/core/BUILD.bazel to see a typical usage of
split_srcs_and_hdrs.
- //include/... to see the change to public_hdrs and
private_hdrs
- //src/... to see many more usages of split_srcs_and_hdrs
- //tools/... to see changes to skia_internal where
appropriate.
- Everything else. Note that //modules/... might also need
to be built with skia_internal instead of skia_public,
but we can fix that up later, if necessary.
Change-Id: Ie1cc969455d97b029b2d77faa222c4a9bad70671
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/545716
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Leandro Lovisolo <lovisolo@google.com>
Currently there is no way to specify the data that is bound to them.
That will come in later changes.
Bug: skia:12720
Change-Id: I3301a825486469396a13a4095b66d9e0b81f183b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/543716
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
There are no functional changes to the rules, just a relocation.
Change-Id: I90af5ec792fc54ce2978b0bbb1afd2c932e183b4
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/545719
Reviewed-by: Ben Wagner <bungeman@google.com>
Booleans and structs/interface blocks that transitively contain a
boolean member are no longer allowed to be used as a uniform. This is
because SPIR-V and WGSL currently disallow OpTypeBool in host-shareable
storage classes.
Change-Id: I10315c7f261ff10a07636265968a91d9c421da55
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/542776
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Arman Uguray <armansito@google.com>
The cast of newly-allocated memory to T* is the only thing that triggers
a CFI error; we can let CFI instrument the rest of the code normally.
Change-Id: I0e6ab76dbddf031967bee34f5a05986ff58e6714
Bug: skia:13339
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/545676
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Some unused var and pessimizing move warnings, e.g.
../../experimental/sktext/src/Text.cpp:316:12: warning: moving a local object in a return statement prevents copy elision [-Wpessimizing-move]
return std::move(shapedText);
^
../../experimental/sktext/src/Text.cpp:316:12: note: remove std::move call here
return std::move(shapedText);
^~~~~~~~~~
Change-Id: Id5c220b7a850b2013e2bf065a87d4a296bd0369c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/542522
Reviewed-by: Julia Lavrova <jlavrova@google.com>
Commit-Queue: Florin Malita <fmalita@google.com>
Auto-Submit: Florin Malita <fmalita@chromium.org>
I had to copy some config_settings out of //bazel/common_config_settings
because these are now treated as separate entities and cannot
see that file.
For libpng, note that we use a genrule to create the
pnglibconf.h instead of pointing to one somewhere else.
This ended up being easier than other things I tried.
Another approach would be to not depend on the version
in third_party/externals, but to clone it via
new_git_repository [1] and apply a patch that creates
the configuration file.
[1] https://bazel.build/rules/lib/repo/git#new_git_repository
Bug: skia:12541
Change-Id: I9a284775dc0f2bdabb145518d5f0803c74fb99fa
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/545368
Reviewed-by: Ben Wagner <bungeman@google.com>
This reverts commit ef7c45a0fa.
Reason for revert: avoiding perf regression
Original change's description:
> Revert "Disable Control-Flow Integrity in SkTArray when casting buffer to T*."
>
> This reverts commit 0b1384de5a.
>
> Reason for revert: visible impact on performance: http://screen/4N7DNCQNSgtzzBohttp://go/crb/1330618
>
> Original change's description:
> > Disable Control-Flow Integrity in SkTArray when casting buffer to T*.
> >
> > We disable Control-Flow Integrity sanitization (go/cfi) when updating
> > the item-array buffer. CFI flags this code as dangerous because we are
> > casting `buffer` to a T* while the buffer's contents might still be
> > uninitialized memory. When T has a vtable, this is especially risky
> > because we could hypothetically access a virtual method on fItemArray
> > and jump to an unpredictable location in memory. Of course, SkTArray
> > won't actually use fItemArray in this way, and we don't want to
> > construct a T before the user requests one. There's no real risk here,
> > so disable CFI when doing these casts.
> >
> > Change-Id: I5708053339f4a600b12c841fcd38880f9932f7d6
> > Bug: skia:13339
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/542643
> > Commit-Queue: Ben Wagner <bungeman@google.com>
> > Auto-Submit: John Stiles <johnstiles@google.com>
> > Reviewed-by: Ben Wagner <bungeman@google.com>
>
> Bug: skia:13339
> Change-Id: I9f39100fc4a03359fa7712b0a8d8cbe3bc7de625
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/545365
> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> Auto-Submit: John Stiles <johnstiles@google.com>
Bug: skia:13339
Change-Id: I7629cb9045e0c7a804785f8c0ad569610e1c67e1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/545366
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Factor out the common code for handling SubRuns from Blobs and
Slugs. SubRunContainer will be moved to its own file in the
next CL to reduce the size of TextBlob.cpp.
Change-Id: I185336c5fa7a70841ef7b706fa194aa01649dacc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/544248
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Herb Derby <herb@google.com>
Mostly, this adds placeholder BUILD.bazel files corresponding to files
used in public.bzl
The exception is src/ports/BUILD.bazel, which adds an explicit
link command for dl, needed for dlopen etc.
Bug: skia:12541
Change-Id: Id3801a4c718cec37bc2aa3920a8d810f8a80a373
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/545359
Reviewed-by: Ben Wagner <bungeman@google.com>
(to fix non-monotonic glyph placement)
With Google3 test failure in Samples
showing that it's not SkParagraph fault but
rather a result of this fix.
Change-Id: I72e025cdaf806bae0e8a8337074f75af5af428b1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/544336
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
This reverts commit 0b1384de5a.
Reason for revert: visible impact on performance: http://screen/4N7DNCQNSgtzzBohttp://go/crb/1330618
Original change's description:
> Disable Control-Flow Integrity in SkTArray when casting buffer to T*.
>
> We disable Control-Flow Integrity sanitization (go/cfi) when updating
> the item-array buffer. CFI flags this code as dangerous because we are
> casting `buffer` to a T* while the buffer's contents might still be
> uninitialized memory. When T has a vtable, this is especially risky
> because we could hypothetically access a virtual method on fItemArray
> and jump to an unpredictable location in memory. Of course, SkTArray
> won't actually use fItemArray in this way, and we don't want to
> construct a T before the user requests one. There's no real risk here,
> so disable CFI when doing these casts.
>
> Change-Id: I5708053339f4a600b12c841fcd38880f9932f7d6
> Bug: skia:13339
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/542643
> Commit-Queue: Ben Wagner <bungeman@google.com>
> Auto-Submit: John Stiles <johnstiles@google.com>
> Reviewed-by: Ben Wagner <bungeman@google.com>
Bug: skia:13339
Change-Id: I9f39100fc4a03359fa7712b0a8d8cbe3bc7de625
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/545365
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Auto-Submit: John Stiles <johnstiles@google.com>