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>
Several canvases in the npm_build/example.html demo now use WebGPU if it
is supported by the browser and the CanvasKit build in use.
The examples have been refactored to support both WebGPU and non-WebGPU
mode of usage. Two examples that currently rely on Surface.drawOnce
don't work correctly on WebGPU as the API call may draw to the wrong
swapchain texture ("paths" and "pathperson") and will benefit from a
`WebGPUCanvasContext.drawOnce` function.
Bug: skia:13427
Change-Id: I16dc06a9788cf78e86b2097f44c1f83ca0b2315a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/553637
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Arman Uguray <armansito@google.com>
* The native backend exposes a variant of _MakeGrContext that creates a
GrDirectContext backed by a Dawn wgpu::Device.
* The native backend currently exposes a single API function,
"_MakeGPUTextureSurface" which returns a SkSurface from Dawn backend
render target over a Dawn wgpu::Texture. This function can be used to
draw to any WebGPU texture, including offscreen textures or to a
canvas swapchain texture.
* The MakeGPUDeviceContext, MakeGPUCanvasContext, MakeGPUCanvasSurface
functions are implemented purely in JavaScript.
* The CanvasKit.webgpu property can be used to detect whether WebGPU
support has been compiled in.
Bug: skia:13427
Change-Id: I953f24ca58389d5989a108685abbc02e56d4e18b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/553636
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Arman Uguray <armansito@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>
Turns out sized arrays don't work currently; the path of least
resistance is simply disabling them for now. See bug for explanation.
Bug: skia:13471
Change-Id: I90e321ccae199ac5697d1d9a63f73e30554e2981
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/553583
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Arman Uguray <armansito@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 expects uniforms to be passed in as a span of SkUniforms.
When making a runtime effect, we now convert the SkRuntimeEffect's
`Uniform` data into SkUniforms as well.
I briefly looked at sharing a single uniform type, but
SkRuntimeEffect::Uniform is public API, so changing it is non-trivial,
and Uniform would not be usable as a direct replacement for SkUniform.
(Uniform is non-POD since it contains an SkString; SkUniform is POD
and we declare a bunch of them at global scope. Also, each class
represents types using a separate enum.)
Change-Id: Idef2141d3a4860529719382840a157b7b0c41643
Bug: skia:13457
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/553595
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
This will be used for pre-transformed Geometry such as DirectMaskSubRun.
Bug: skia:13118
Change-Id: I82e277acf786931c04a4667b2b93a6ccd8ae90fe
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/554036
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
The tests themselves are the same, just split up into their logical
groupings. http://go/unit-testing-overview#properties
"Focused. Above all, unit tests are narrow in scope, validating the
correctness of individual pieces of code rather than the correctness of
the system as a whole."
Change-Id: I6149536e84763abc98dfe243d4090bb25a555525
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/553592
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
GrDawnBuffer now implements GrGpuBuffer::onRelease in which it unmaps
the underlying wgpu::Buffer if it is mapped to main memory. This has to
be done explicitly to prevent unbounded growth in memory usage of
staging buffers.
Bug: skia:13475
Change-Id: I985cf090b3861b08e13a425dfeae53e01c784d2d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/553736
Commit-Queue: Arman Uguray <armansito@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
MSVC and clang-cl do not recognize -isystem, but do recognize
-I. Thus if those compilers use our rules, we want our copts
to be maximally compatible.
Some of these options didn't seem to do anything, so I removed
them rather than replace them.
Change-Id: I73feb63d5c682a6df646d731b10ca2509e105e6f
Bug: skia:12541, b/237076898
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/553878
Reviewed-by: Jorge Betancourt <jmbetancourt@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>
I don't know why none of the CQ bots don't run scaledemojiperspective,
but this was not found in the gold for the CL. Because it is
clearly wrong.
Take a best guess at the perspective size calculation by using
the matrix's getMaxScale() to estimate the scaling caused by
the perspective matrix.
Change-Id: I58258b18c0c427b39c56f16c7ee17b8b8d4e4e1c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/553593
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Herb Derby <herb@google.com>
Change-Id: I7abba20991482d72ca90b52a92034b9875be4098
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/553578
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Bug: skia:13118
Change-Id: I04d47d0cf3e2f6318d289b4f8d41fe9386bb4fad
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/553876
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Auto-Submit: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Change-Id: Id781d04f9ece7e27365e19c8ba509d28f3f4e186
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/553576
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Herb Derby <herb@google.com>
I'm switching to this two pass method because it will allow
simplifying the buffer structures in MakeInAlloc routine.
I need to simplify the buffer handling to rewrite the interface
to the SkStrikeForGPU to pass only the information the RemoteStrike
has. This will be many CLs to accomplish.
This seems to give the exact same results as the existing code.
Change-Id: I94a31549cbc1924adb1de44e0438996b902fdca8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/552682
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
The clang_linux and clang_mac Bazel configs were removed in
commit I515c114099d659639a808f74e47d489a68b7af62.
Bug: skia:12541
Change-Id: Ib42764686a19a73164efbcf3d72869574f747b8f
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/553590
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Chris Mumford <cmumford@google.com>
This reverts commit 64284e1482.
Reason for revert: unused code
Original change's description:
> experimental alternative isconvex
>
> Bug: skia:
> Change-Id: I55175a95d37aad9a656cd211fc6c7238bdb7d674
> Reviewed-on: https://skia-review.googlesource.com/c/173361
> Commit-Queue: Mike Reed <reed@google.com>
> Reviewed-by: Mike Reed <reed@google.com>
Change-Id: Ib00acfc0964ecfd2fe01689c0d46d0773d5c5258
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/553588
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
This can let us create versions of skia_public with certain settings
enabled in an easy way (i.e. not requiring clients to set the compile
flags themselves).
Change-Id: I909449c6186f4912ea80dd9d579fcd7cafb4775c
Bug: skia:12541 b/237076898
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/553377
Reviewed-by: Jorge Betancourt <jmbetancourt@google.com>
Change-Id: Id6efc88e2d048ade8aa2c0e7870c0bc73b1afcf5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/553537
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Reviewed-by: James Godfrey-Kittle <jamesgk@google.com>
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: James Godfrey-Kittle <jamesgk@google.com>
Suffixes already have a . in the beginning. Two dots does not
leave us with a valid URL.
Change-Id: Ia232d1b68a78450da7883e659fa6871b562db20f
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/553538
Reviewed-by: John Stiles <johnstiles@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>
In [1] SkGraphics was changed to receive a flag callback from Blink if
variable COLRv1 is enabled. Pass this flag down to the corresponding
FreeType property in order to be able to continuously land changes in
FreeType for COLRv1 until shipping it.
Roll FreeType to current head, to include property addition to FreeType
in [2].
[1] https://skia-review.googlesource.com/c/skia/+/551637
[2] 4b6f92e6b3
Bug: skia:13448
Change-Id: I296ec5c5b4093cb1af0300de7d1eadcc8e740a36
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/553436
Reviewed-by: Florin Malita <fmalita@google.com>
Commit-Queue: Dominik Röttsches <drott@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>
`findOrCreateRuntimeEffectSnippet` takes a pointer to the runtime effect
and returns a code-snippet ID associated with the runtime effect, with
matching uniform layout, etc. The SkShaderCodeDictionary will maintain a
persistent map from {sksl-hash, uniform set} to code-snippet ID.
http://go/runtime-effects-in-graphite
Change-Id: I9c51667aad96f850184899f3df00a8206a1fe354
Bug: skia:13405
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/552686
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Change-Id: I6c6aed7de0747c4fea720fc4aa8b18ae6ad7327e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/552685
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Herb Derby <herb@google.com>
In order to simplify buffer and strike handling eventually,
add a routine that will allow finding the maximum dimension of a
list of glyphs. In a future CL, I will use this to simplify
handling calculating the scale factor needed in the drawing of
last resort.
Change-Id: I8ac47328e1dfe59ea80499a83253bb166172a6b0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/552684
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Change-Id: I9a27b52bb0d3f96d296d712fe36a727f8ad5ded4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/552683
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Herb Derby <herb@google.com>
Graphite only needs a single token to manage DrawAtlases, which is
incremented after DrawAtlas uploads are issued.
Bug: skia:13118
Change-Id: I0adbee2870bb30f65ac98adc43e17ff191bf224f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/552681
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Also removes usage of SkMatrixProvider.
Bug: skia:13118
Change-Id: I3f8a90b3de2d3adc5742c72095f33acf2e9080ed
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/544246
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
These changes are necessary to use the toolchain on both the
M1 Mac and Intel Macs.
This adds a way to detect the host platform and choose different
compile options in the toolchain.
We cannot statically link in libc++.a from the clang zip because
it appears to be x64 only.
Finally, this fixes copts not being passed to objective c libraries.
Known issue:
- Intel Mac building has an error about the default CC toolchain.
Change-Id: Ie8e5e83dc41513563ac684e70a8a6947b36df445
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/552472
Reviewed-by: Jorge Betancourt <jmbetancourt@google.com>
unordered_map is much slower than SkTHashMap in practice, and it is
pretty straightforward in this case to replace.
Change-Id: I6d6bea6fa8c5c1ae6d23dfde05552db651975173
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/553016
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>