We were using the shader wrapper's local matrix (which is
always identity), rather than the original (wrapped)
shader's local matrix.
Bug: skia:13047
Change-Id: I7c70d9a4d210746141633e3664cb7ba5841a732d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/519376
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: Brian Osman <brianosman@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
The motivation is that a future change will add a factory fn that
makes an aniso samplerstate. We don't want to support arbitrary
combinations of aniso with other knobs.
Bug: skia:13036
Change-Id: Id962f89019a37763961981990d0e49e298e16064
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/516816
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
PS1 regenerates BUILD.bazel files
I suggest reviewing the deltas between PS1 and the latest
PS to focus on the interesting bits.
The changes here allow for a Vulkan-only build of HelloWorld
based on sk_app. The toughest change was properly fetching
the VisualID after removing the gl calls that used to
fill that in.
There are a few changes that fix resolution of Dawn
header files, but those won't actually be built until
a follow-on CL.
Change-Id: I54fb58b5dd7ecd4313562aed401759b3eaed53c0
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/516999
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
PS1 is the automatic regenerated changes.
PS2-3 adds an #ifdef guard to the addToKey method on shaders.
The SkShaderCodeDictionary class helps generate SkSL and is
only necessary when we are building with SkSL (gpu builds and
cpu builds with SkVM).
Suggested Review order:
- Use Gerrit to diff PS 1 and the last PS
- src/core/BUILD.bazel adds some sources to the "only
necessary if sksl is enabled" bucket
- All the .cpp and .h files to see the #ifdef is added
correctly.
Change-Id: I4d4ce61a4957ef1e0840204acff08ce7e616f9cb
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/512157
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Bug: skia:12701
Change-Id: I648948875a2e9401c0c73cdf4c9c8053c9ba69af
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/510227
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
This reverts commit 10241484aa.
Reason for revert: Speculative revert for b/220676062
Original change's description:
> Fix dithering on drawImage[Rect] calls
>
> Bug: skia:12516
> Change-Id: Ibb68558e0f474143df3c6a5fb0fb3d4881529226
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/508677
> Reviewed-by: Brian Osman <brianosman@google.com>
> Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Bug: skia:12516
Change-Id: If496c6be355bbb026ffe478512f8a6334116bb66
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/511806
Commit-Queue: Brian Osman <brianosman@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Use the override index as intended instead of the index into the
override list as the palette entry index to override. Correct the bounds
check on the override index. Modify an existing test to exercise this.
Bug: skia:12576
Change-Id: Ide8327ff0536eee252c6a83e997ad540a98ba957
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/510596
Auto-Submit: Ben Wagner <bungeman@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Herb Derby <herb@google.com>
Co-authored with Ben Wagner, bungeman@google.com.
Similar to how we allow configuration of variable font configurations,
provide additional SkFontArguments to select a base palette and a set
of potentially sparse color overrides.
This is required for implementing CSS font-palette.
Modify the more_samples-glyf_colr_1.ttf to have two additional palettes,
and two additional test glyphs, one that draws with COLRv0 logic, one
that draws with COLRv1 logic and has a foreground palette index dot
in the middle. See [1] & [2] for the additions to the test font.
Add a GM which tests this on the SkFontMgr_custom using makeClone() and
makeFromStreamArgs(). The test displays the two glyphs in default
palette on the left, then with palette overrides (as in the title of the
test) on the right. The first row uses a typeface created with
makeFromStreamArgs(), the second uses one created with makeClone().
[1] https://github.com/googlefonts/color-fonts/pull/91
[2] https://github.com/googlefonts/color-fonts/pull/92
Bug: skia:12730, chromium:1170794
Cq-Include-Trybots: luci.skia.skia.primary:Test-Android-Clang-GalaxyS20-GPU-MaliG77-arm64-Release-All-Android_NativeFonts,Test-Debian10-Clang-GCE-CPU-AVX2-x86_64-Debug-All-NativeFonts
Change-Id: Ia1334f069240edc78fd4791969914e8a6f4fbaf9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/479616
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Bug: skia:12587, skia:10959
Change-Id: I43dea5f2d2f54c7db47e778ac9c7bac53ae4998d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/509176
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Bug: skia:12845
Change-Id: Ia03293c4efdad4c5381a713c9d7d4857b79530c7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/509398
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Bug: skia:12516
Change-Id: Ibb68558e0f474143df3c6a5fb0fb3d4881529226
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/508677
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
PS1 regenerates the BUILD.bazel files
This allows us to use closure to minify the JS in canvaskit.js
Change-Id: Ib8326d2e3a19cd2168b740b6946f9165a2810133
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/509177
Reviewed-by: Ben Wagner <bungeman@google.com>
Adds a new GM that draws text in an SkPicture, transformed by a
perspective matrix. When drawn directly with drawPicture() it looks
fine. When drawn calculating a scale factor manually from the matrix
and converting to an image (SkImage::MakeFromPicture + drawImageRect),
it looks nearly indistinguishable. However, when drawing using a picture
shader, the image resolution of the cached rasterization is far too low.
Originally, this is because SkPictureShader only relied on
SkMatrix::decomposeScale, which fails if there's perspective and
the picture shader's fallback is to switch to the identity scale. When
the source picture has relatively small local bounds compared to the
final destination, this results in severe sampling artifacts.
This CL switches the fallback to use SkMatrixPriv::DifferentialAreaScale,
which is what was used to compute the manual scale factor in the GM,
and is what image filters use when creating their device's coordinate
space when the canvas has perspective.
Change-Id: I856cd1277eb7cfcb43c766ff0d123ee1a667fe29
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/507917
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Bug: skia:12845
Change-Id: I8013b0068ab758e9a5e580344c62e4680f4fa48e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/506176
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
This is a reland of 3225c8cc46
Original change's description:
> Add kR8_unorm_SkColorType
>
> Change-Id: I97b5bc7f90715664f233ca7b7c41c0ecbfc29ac4
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/505679
> Reviewed-by: Michael Ludwig <michaelludwig@google.com>
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Commit-Queue: Brian Osman <brianosman@google.com>
Change-Id: I73fa17625d57e0e58da1b70e2e59ba200383cfe7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/506460
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Brian Osman <brianosman@google.com>
-Wformat-nonliteral does not work with variadic templates, and requires
a constant format string.
These changes uncovered one incorrect format string (%u -> %lu for a
DWORD in dm.cpp)
Change-Id: Id54a5d6cbcb607ff32c758f4a9d346a7aba70df3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/506616
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Bug: skia:12701
Change-Id: I743e4717f3716717bd35e1eea0f504a1f9ac6dc4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/506536
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Bug: skia:12643
Change-Id: I37e1718a20283dfb814c85260257d57bac2b7b34
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/506211
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: Brian Osman <brianosman@google.com>
PS 1 is re-generating existing BUILD.bazel files
PS 2 is generating BUILD.bazel files for tests/gms
PS 3+ makes modifications to build all of the gms and tests.
It is recommended to view this CL with just a diff between
PS 2 and the end, due to the large amount of generated changes
in PS 1 and 2.
We make a filegroup for the gms and tests because they need
to be compiled as one large blob in order for the registries
to work. Maybe in the future we will break these up, but at least
for WASM/JS, the overhead of starting a browser for each new
test would likely grind things to a halt, so we just group them
all together for now. It's also the most similar to what we
currently do.
In gm/BUILD.bazel and tests/BUILD.bazel, we add a cc_library
that encapsulates all of the deps of the tests, so we can
easily include that the build. These were discovered via
trial and error, not anything automatic or systematic.
The is_skia_dev_build config_setting is very similar to the
GN equivalent from which it was based.
The list of gms and tests to skip (e.g. which are incompatible
with WASM) was determined by building the wasm bundle:
modules/canvaskit$ make bazel_gms_release
tools/run-wasm-gm-tests$ make run_local_debug
# Don't forget to click the button on the screen after the
# browser loads
This way of invoking the tests will be replace soon with
`bazel test <something>`. As such, I didn't bother fully
documenting the current way.
Suggested review order:
- modules/canvaskit/BUILD.bazel taking note that we always
use profiling-funcs to make the stacktraces human readable.
- gm/BUILD.bazel and tests/BUILD.bazel to see the lists of
gms/tests. Notice the tests are roughly partitioned because
we don't support things like vulkan/PDF in the wasm build
and we will want a way to not build certain tests for
certain configurations
- tools/* noting some of the cc_libraries added to make
dependencies easier to add when needed.
- All other files.
Change-Id: I43059cd93c28af1c4c12b93d6ebd9c46a12d381f
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/506256
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Change-Id: I97b5bc7f90715664f233ca7b7c41c0ecbfc29ac4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/505679
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
This shook out a handful of formatting issues:
[SkVMVisualizer]
- We were passing plain text like "width:35%;" through printf.
- One particular opcode type was printing a string as a number.
[Skottie, SortToy]
- Used wrong integer type instead of %zu for size_t
This CL does not update print functions which take printf arguments via
variadic template, as __attribute__((format)) does not support this
style. These could be converted to va_list style, but that's not done in
this CL.
(For some reason, GCC requires the attribute to be set on a prototype
for freestanding functions, so a few of these now have a prototype
immediately followed by a declaration.)
Change-Id: I63a6c2486c785cc38563028fdf8df0662ec04935
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/504698
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Adding double-parens around an `if ((false))` squelches the warning.
In other cases, you can squelch the warning by assigning the
always-constant(-on-this-machine) check into a constexpr bool.
Change-Id: I5a344fb45779c5bd2865edb3cffaf839ba9a5d85
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/504597
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Bug: skia:12701
Change-Id: I1f0817096b5eb58087494f04162dcbe42585fa57
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/503816
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
This makes it so we don't trigger msaa in drawStrokedLine anymore.
Bug: skia:skia:12872
Change-Id: Id68b55ba9e3989f2a775affe9a1b20bf3186123c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/502816
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Christopher Dalton <csmartdalton@google.com>
The original drew text with a specific perspective matrix. After
minification, the real problem is the stroker, where having a large
enough resScale creates an incorrect filled version of the path.
Bug: skia:12866
Change-Id: I41a104edf932f54c2db40cd6a913d303cfaa9ba3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/500377
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
This is mostly mechanical. The only interesting bit is that GrSLType was in include/private while SkSLType is in src/core so some #include patterns changed.
Bug: skia:12701
Change-Id: I80bd86ee93796b145f86ded9b4cbf52f24fa59e5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/497607
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
The change in [1] is likely responsible for a regression in which we're
not taking into account P2 for gradient skewing anymore.
Fix that, and add a test case to the gradient set of test cases.
Source for test glyph, see here:
https://github.com/googlefonts/color-fonts/pull/90/files
[1] 2da029b28f
Cq-Include-Trybots: luci.skia.skia.primary:Test-Android-Clang-GalaxyS20-GPU-MaliG77-arm64-Release-All-Android_NativeFonts,Test-Debian10-Clang-GCE-CPU-AVX2-x86_64-Debug-All-NativeFonts
Bug: skia:12822, chromium:1287162
Change-Id: I8b790e2a5c6c04487118306b4b38b1d77349431d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/494676
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Dominik Röttsches <drott@google.com>
This is to be used in the PaintParamKey's block dumping methods.
Bug: skia:12701
Change-Id: I14de21d2d8b30e0fa69ac2e33fa975dc20f6656c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/493217
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Bug: skia:12766
Change-Id: I9dfe07a71961ab952c1593b9cc68c61191fbc13c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/489536
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
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>
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>
Makes the GM draw better in 1010102 configs
Bug: skia:12720
Change-Id: I587c542e602b6e2d972444a45aa222a646f8ff70
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/488176
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>
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>
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>
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>
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>
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>