Commit Graph

1851 Commits

Author SHA1 Message Date
Jim Van Verth
f151351f47 [graphite] Add format tables to MtlCaps
Bug: skia:12845
Change-Id: If3ac2b6ba2c8e28328ee5805a29fc83353220364
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/524756
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2022-03-28 14:10:29 +00:00
Kevin Lubick
aab019a15e [bazel] Fix build
Most of these are pretty mechanical generated changes.

IWYU noticed one issue with DSLCore.h, which was fixed here.

Change-Id: I5629565ad3c2817daa71907c62f932d93f9d78ab
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/524617
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2022-03-28 13:56:16 +00:00
Robert Phillips
55ec347276 [graphite] Set up SkSL portion of image shader
Bug: skia:12701
Change-Id: I4d1fc66307a5c4f98f5415f95670b1ebc1622f97
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/523859
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2022-03-25 19:10:07 +00:00
Robert Phillips
6475432767 [graphite] Add failure mode to Recorder::snap
Bug: skia:12701
Change-Id: Ib7e52f26b31cfed8fb4da1929755035a69951ca5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/524220
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2022-03-25 17:49:53 +00:00
Greg Daniel
00ce96456b [graphite] Add support for finished callbacks.
This also reworks a little bit about what we send to insertRecording
and what we store on Context.

Bug: skia:12974
Change-Id: I747a1cdd1559d4d5fbe928e689a23a734142557b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/524012
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2022-03-25 14:47:05 +00:00
Michael Ludwig
91b5f668e8 [graphite] Actually detect Transform type and scale factors
Bug: skia:12787
Change-Id: I5d061d535878df55ce57add7d0831e86caadc321
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/524009
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2022-03-25 13:46:15 +00:00
Robert Phillips
d67d52ec0f [graphite] Connect DrawPass and CommandBuffer levels together for Textures and Samplers
Bug: skia:12701
Change-Id: Ide780f9dac1b92855e634726d261630ef5d017fc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/523426
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2022-03-24 14:35:38 +00:00
Michael Ludwig
9aa9c14ffd [graphite] Send paint depth to GPU
Bug: skia:13086
Change-Id: I5276f44ee4101a05357408a206050a54ced19adc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/523428
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2022-03-24 00:45:35 +00:00
Michael Ludwig
357881bc95 [graphite] Groups params to RenderStep in DrawGeometry struct
Bug: skia:13086
Change-Id: I0fc3243fb3f3974a32726237358522171ae33c41
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/523419
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2022-03-23 21:13:08 +00:00
Robert Phillips
a7c2d73690 [graphite] Add TextureDataCache
This adds caching and uniquifying of SkTextureDataBlocks to parallel
our treatment of SkUniformDataBlocks.

Bug: skia:12701
Change-Id: Ib4474f48b9048daf4b848ccbb339cb42246f184b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/523418
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2022-03-23 19:03:21 +00:00
Michael Ludwig
0378307904 Move skgpu::v1-specific [Stroke|Path]Tessellators out of tessellate/
The static functionality for writing vertex buffers, constants, and
utility functions that were in the StrokeTessellator and PathTessellator
classes have been moved into Tessellation.h and a new
FixedCountBufferUtils.h.

The tessellator hierarchy has been moved into src/gpu/ops and all the
v1 guards are removed since they were already solely v1 after the static
functions were lifted out. The hierarchy and subclasses are preserved
but have been combined into just StrokeTessellator.h and
PathTessellator.h instead of separate files for the subclasses.

All the rest of the little changes are updating references and includes.

Bug: skia:13012
Change-Id: I90f2f53538349cf9ad1823a0c42fbdc772190a49
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/523189
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2022-03-22 16:04:13 +00:00
Jim Van Verth
54340beba7 [graphite] Add skgpu::Image::onReadPixels.
Creates a new shared routine ReadPixelsHelper used by this and
Device::readPixels(). Also added MakeBitmapProxyView to the
shared file and cleaned up some headers.

Bug: skia:12845
Change-Id: I05533d2f47688daf4f14c8171eb7cd7178b4c0ea
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/521958
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2022-03-22 15:37:23 +00:00
Robert Phillips
f8df8d8896 [graphite] Make PipelineDataCache templated
We are going to cache (and uniquify) the UniformBlocks and TextureBlocks
separate from each other.

Bug: skia:12701
Change-Id: I03837c4a38a9bdeb4224a697eab119fca24e8f8c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/522916
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2022-03-22 14:45:07 +00:00
Robert Phillips
82c3f91095 [graphite] Fuse texture and sampler binding together
We may re-split this later but, for now, this is simpler.

Bug: skia:12701
Change-Id: Ibb9c6fca8e6ca328c8c203c3b1399b6be7a45425
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/522917
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2022-03-22 14:12:18 +00:00
Michael Ludwig
86781bd10c [graphite] Implement convex wedge tessellating renderer
Cq-Include-Trybots: luci.skia.skia.primary:Test-Mac12-Clang-MacBookPro16.2-GPU-IntelIrisPlus-x86_64-Debug-All-Graphite,Test-Mac11-Clang-MacMini9.1-GPU-AppleM1-arm64-Release-All-Graphite,Test-Mac11-Clang-MacMini9.1-GPU-AppleM1-arm64-Debug-All-ASAN_Graphite,Test-Mac10.15.7-Clang-MacBookPro11.5-GPU-RadeonHD8870M-x86_64-Debug-All-Graphite,Perf-Mac11-Clang-MacMini9.1-GPU-AppleM1-arm64-Release-All-Graphite,Perf-Mac10.15.7-Clang-MacBookPro11.5-GPU-RadeonHD8870M-x86_64-Release-All-Graphite,Build-Mac-Clang-x86_64-Release-Graphite,Build-Mac-Clang-x86_64-Debug-Graphite,Build-Mac-Clang-arm64-Release-iOS_Graphite,Build-Mac-Clang-arm64-Release-Graphite,Build-Mac-Clang-arm64-Debug-iOS_Graphite,Build-Mac-Clang-arm64-Debug-Graphite_NoGpu,Build-Mac-Clang-arm64-Debug-Graphite,Build-Mac-Clang-arm64-Debug-ASAN_Graphite
Bug: skia:12703
Change-Id: If00b6b40ed40be42c4337f3c8ffe504c9f6e667f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/522097
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2022-03-22 01:47:08 +00:00
Michael Ludwig
3e34e5e9d3 [graphite] Standardize RenderStep naming
Cq-Include-Trybots: luci.skia.skia.primary:Test-Mac12-Clang-MacBookPro16.2-GPU-IntelIrisPlus-x86_64-Debug-All-Graphite,Test-Mac11-Clang-MacMini9.1-GPU-AppleM1-arm64-Release-All-Graphite,Test-Mac11-Clang-MacMini9.1-GPU-AppleM1-arm64-Debug-All-ASAN_Graphite,Test-Mac10.15.7-Clang-MacBookPro11.5-GPU-RadeonHD8870M-x86_64-Debug-All-Graphite,Perf-Mac11-Clang-MacMini9.1-GPU-AppleM1-arm64-Release-All-Graphite,Perf-Mac10.15.7-Clang-MacBookPro11.5-GPU-RadeonHD8870M-x86_64-Release-All-Graphite,Build-Mac-Clang-x86_64-Release-Graphite,Build-Mac-Clang-x86_64-Debug-Graphite,Build-Mac-Clang-arm64-Release-iOS_Graphite,Build-Mac-Clang-arm64-Release-Graphite,Build-Mac-Clang-arm64-Debug-iOS_Graphite,Build-Mac-Clang-arm64-Debug-Graphite_NoGpu,Build-Mac-Clang-arm64-Debug-Graphite,Build-Mac-Clang-arm64-Debug-ASAN_Graphite
Bug: skia:12703
Change-Id: I8c2809aeddf50a7b77bc3e7583b22475fce15330
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/522920
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2022-03-21 21:49:13 +00:00
Kevin Lubick
0364f7b80e [bazel] Fix/update rules
This regenerates the files and fixes the harfbuzz rule so CanvasKit
compiles.

Change-Id: I2db2bddaabf793f360e8a4fa1a6a2b96222dfdf8
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/522816
Reviewed-by: Ben Wagner <bungeman@google.com>
2022-03-21 17:19:54 +00:00
Kevin Lubick
08ece0c9a0 [includes] Enforce IWYU on sksl code
PS1 regenerates the Bazel files. Use it as the base change when
    comparing patchsets.

IWYU seems to do a good job of working with MyFile.cpp and
MyFile.h, but if there is just a MyHeader.h, it doesn't always
seem to throw errors if the includes aren't correct. This was
observed with include/sksl/DSL.h This might be due to the fact
that headers are not compiled on their own, so they are never
sent directly to the IWYU binary.

This change sets enforce_iwyu_on_package() on the all sksl
packages and then fixes the includes until all those checks
are happy. There were a few files that needed fixes outside
of the sksl folder. Examples include:
 - src/gpu/effects/GrConvexPolyEffect.cpp
 - tests/SkSLDSLTest.cpp

To really enforce this, we need to add a CI/CQ job that runs
bazel build //example:hello_world_gl --config=clang \
  --sandbox_base=/dev/shm --features skia_enforce_iwyu

If that failed, a dev could make the changes described in
the logs and/or run the command locally to see those
prescribed fixes.

I had to add several entries to toolchain/IWYU_mapping.imp
in order to fix some private includes and other atypical
choices. I tried adding a rule there to allow inclusion of
SkTypes.h to make sure defines like SK_SUPPORT_GPU, but
could not get it to work for all cases, so I deferred to
using the IWYU pragma: keep (e.g. SkSLPipelineStageCodeGenerator.h)

Change-Id: I4c3e536d8e69ff7ff2d26fe61a525a6c2e80db06
Bug: skia:13052
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/522256
Reviewed-by: John Stiles <johnstiles@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2022-03-21 12:43:02 +00:00
Michael Ludwig
c71ae51400 [graphite] Implement stencil wedge tessellated path rendering
Cq-Include-Trybots: luci.skia.skia.primary:Test-Mac12-Clang-MacBookPro16.2-GPU-IntelIrisPlus-x86_64-Debug-All-Graphite,Test-Mac11-Clang-MacMini9.1-GPU-AppleM1-arm64-Release-All-Graphite,Test-Mac11-Clang-MacMini9.1-GPU-AppleM1-arm64-Debug-All-ASAN_Graphite,Test-Mac10.15.7-Clang-MacBookPro11.5-GPU-RadeonHD8870M-x86_64-Debug-All-Graphite,Perf-Mac11-Clang-MacMini9.1-GPU-AppleM1-arm64-Release-All-Graphite,Perf-Mac10.15.7-Clang-MacBookPro11.5-GPU-RadeonHD8870M-x86_64-Release-All-Graphite,Build-Mac-Clang-x86_64-Release-Graphite,Build-Mac-Clang-x86_64-Debug-Graphite,Build-Mac-Clang-arm64-Release-iOS_Graphite,Build-Mac-Clang-arm64-Release-Graphite,Build-Mac-Clang-arm64-Debug-iOS_Graphite,Build-Mac-Clang-arm64-Debug-Graphite_NoGpu,Build-Mac-Clang-arm64-Debug-Graphite,Build-Mac-Clang-arm64-Debug-ASAN_Graphite
Bug: skia:12703
Change-Id: Iccdbc4f95c6d714d58f21fa5d23bdd14eb1f88ac
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/522096
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2022-03-21 01:16:04 +00:00
Michael Ludwig
d640b7e4e2 [graphite] Move stencil-and-cover RenderSteps into separate headers
Progress on exposing the RenderSteps used in the one renderer for
re-use with new renderers.

Cq-Include-Trybots: luci.skia.skia.primary:Test-Mac12-Clang-MacBookPro16.2-GPU-IntelIrisPlus-x86_64-Debug-All-Graphite,Test-Mac11-Clang-MacMini9.1-GPU-AppleM1-arm64-Release-All-Graphite,Test-Mac11-Clang-MacMini9.1-GPU-AppleM1-arm64-Debug-All-ASAN_Graphite,Test-Mac10.15.7-Clang-MacBookPro11.5-GPU-RadeonHD8870M-x86_64-Debug-All-Graphite,Perf-Mac11-Clang-MacMini9.1-GPU-AppleM1-arm64-Release-All-Graphite,Perf-Mac10.15.7-Clang-MacBookPro11.5-GPU-RadeonHD8870M-x86_64-Release-All-Graphite,Build-Mac-Clang-x86_64-Release-Graphite,Build-Mac-Clang-x86_64-Debug-Graphite,Build-Mac-Clang-arm64-Release-iOS_Graphite,Build-Mac-Clang-arm64-Release-Graphite,Build-Mac-Clang-arm64-Debug-iOS_Graphite,Build-Mac-Clang-arm64-Debug-Graphite_NoGpu,Build-Mac-Clang-arm64-Debug-Graphite,Build-Mac-Clang-arm64-Debug-ASAN_Graphite
Bug: skia:12703
Change-Id: I134c79c37f2cdee40558161c9e73dc3221188e67
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/521959
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2022-03-18 19:02:11 +00:00
Robert Phillips
42bc49d5d3 [graphite] Better encapsulate SkPipelineData's uniform data
We are going to cache the uniform data and the texture data separately.
Begin by making the uniform data something that could be cached on its own.

Bug: skia:12701
Change-Id: If3ea3a9b6050faf0810549d4076ae44732656a9e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/522178
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2022-03-18 18:00:38 +00:00
Robert Phillips
3965dd41f4 [graphite] Split out texture bindings w/in the SortKey
We're going to cache and uniquify texture bindings separate from
uniform bindings. Split up the 'fUniformKey' w/in the SortKey in
preparation.

Note that caching the uniforms separate from the texture bindings
should reduce some of the size pressure on the ShadingUniformField.

Bug: skia:12701
Change-Id: I8c7af5e5d5c796f5cc46cab168ee4800c92aba81
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/522257
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2022-03-18 17:24:36 +00:00
Michael Ludwig
df7c47a094 [graphite] Make stencil-and-cover stencil settings accessible
This is in preparation for additional tessellation-based RenderSteps.

Cq-Include-Trybots: luci.skia.skia.primary:Test-Mac12-Clang-MacBookPro16.2-GPU-IntelIrisPlus-x86_64-Debug-All-Graphite,Test-Mac11-Clang-MacMini9.1-GPU-AppleM1-arm64-Release-All-Graphite,Test-Mac11-Clang-MacMini9.1-GPU-AppleM1-arm64-Debug-All-ASAN_Graphite,Test-Mac10.15.7-Clang-MacBookPro11.5-GPU-RadeonHD8870M-x86_64-Debug-All-Graphite,Perf-Mac11-Clang-MacMini9.1-GPU-AppleM1-arm64-Release-All-Graphite,Perf-Mac10.15.7-Clang-MacBookPro11.5-GPU-RadeonHD8870M-x86_64-Release-All-Graphite,Build-Mac-Clang-x86_64-Release-Graphite,Build-Mac-Clang-x86_64-Debug-Graphite,Build-Mac-Clang-arm64-Release-iOS_Graphite,Build-Mac-Clang-arm64-Release-Graphite,Build-Mac-Clang-arm64-Debug-iOS_Graphite,Build-Mac-Clang-arm64-Debug-Graphite_NoGpu,Build-Mac-Clang-arm64-Debug-Graphite,Build-Mac-Clang-arm64-Debug-ASAN_Graphite
Bug: skia:12703
Change-Id: I497ea14802201be10535ee26147838b28ab6b34d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/521957
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2022-03-18 17:22:04 +00:00
Jim Van Verth
c5d130aac0 [graphite] Implement onAsView for Image_Raster
Bug: skia:12845
Change-Id: I46e37ae0c1a8b0587aee3eb9e8cad728d8f61783
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/520738
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2022-03-18 13:57:50 +00:00
John Stiles
0ac3ebbcfd Fix shadowed-variable error.
Change-Id: Ie7bc325af6280e7714798d0d418e045f798cc2fd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/521842
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2022-03-17 23:51:07 +00:00
Jim Van Verth
03044243cc [graphite] Revise UploadTask to allow creation from one UploadInstance
This allows us to create one-off UploadTasks to submit to the Recorder,
e.g. for makeTextureImage().

Also renames UploadCommand to UploadInstance to avoid confusion with
addCommand() method.

Bug: skia:12845
Change-Id: I6cad6f6df6406d1d790ecf6297996fb7ab376f54
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/521362
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2022-03-17 15:44:09 +00:00
Jim Van Verth
56ec512c78 [graphite] Add budgeted param to SkImage::asView(Recorder,...)
Bug: skia:12845
Change-Id: Iebaacfbb341554886fee1415aaf44fb0e44df723
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/521524
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2022-03-17 15:36:04 +00:00
Jim Van Verth
6916d3e90e [graphite] Don't delete MTLDepthStencilState until CommandBuffer is done
The MTLDepthStencilState objects are only refed in  MtlResourceProvider.
When we shut down, we tear down all the Recorders. That tears down their
resource providers, which in the Metal case deletes these DepthStencil
objects. But we can have a command buffer still in flight, so we need to
add a ref to keep those objects alive.

Bug: skia:13068
Change-Id: Ic2fb8fdd83c5323505fa4ccda509e28a8c7e3bfc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/521521
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2022-03-17 15:25:35 +00:00
Arman Uguray
4f3c1e5256 Bypass color transformation in shadow rendering via drawVertices
It is not necessary to convert the per-vertex color generated by a
tesselated shadow since the vertex colors are only used to generate an
alpha-gradient (with rgb=000) to modulate the actual "ambient" and
"spot" colors, which are already converted to the destination space on
the CPU.

This change removes this unnecessary extra step in both the CPU-raster
and GPU backends. This is done by introducing a "skipColorXform" flag to
SkDevice::drawVertices.

Tested the change by comparing GM_shadow_utils output in Rec. 2020 color
mode with the original output and observing no differences. Verfied
using viewer that the generated SkSL shaders used in the OpenGL and
Vulkan backends no longer inject color space transformation code for
shadows that use drawVertices as they did before.

Bug: skia:11848
Change-Id: Idfaf928eb3b6dada2940cba77861890cd38fe25b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/521616
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Arman Uguray <armansito@google.com>
2022-03-16 23:41:47 +00:00
Michael Ludwig
02ebd1a233 [graphite] Implement stenciled curves RenderStep
Cq-Include-Trybots: luci.skia.skia.primary:Build-Mac-Clang-arm64-Debug-ASAN_Graphite,Build-Mac-Clang-arm64-Debug-Graphite,Build-Mac-Clang-arm64-Debug-Graphite_NoGpu,Build-Mac-Clang-arm64-Debug-iOS_Graphite,Build-Mac-Clang-arm64-Release-Graphite,Build-Mac-Clang-arm64-Release-iOS_Graphite,Build-Mac-Clang-x86_64-Debug-Graphite,Build-Mac-Clang-x86_64-Release-Graphite,Perf-Mac10.15.7-Clang-MacBookPro11.5-GPU-RadeonHD8870M-x86_64-Release-All-Graphite,Perf-Mac11-Clang-MacMini9.1-GPU-AppleM1-arm64-Release-All-Graphite,Test-Mac10.15.7-Clang-MacBookPro11.5-GPU-RadeonHD8870M-x86_64-Debug-All-Graphite,Test-Mac11-Clang-MacMini9.1-GPU-AppleM1-arm64-Debug-All-ASAN_Graphite,Test-Mac11-Clang-MacMini9.1-GPU-AppleM1-arm64-Release-All-Graphite,Test-Mac12-Clang-MacBookPro16.2-GPU-IntelIrisPlus-x86_64-Debug-All-Graphite
Bug: skia:12703
Change-Id: Ie80d495f38614f9b5d0b09741ca0d24560ebe870
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/520976
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
2022-03-16 16:03:47 +00:00
Kevin Lubick
e253cc3e55 [bazel] Use toolchain features to opt files into being IWYU compliant.
PS1 regenerates the Bazel files.

It is recommended to review this CL with a diff from PS1.

Example output when a file does not pass the test:
    tools/sk_app/CommandSet.h should add these lines:
    #include "include/core/SkTypes.h"
    #include "include/private/SkTArray.h"
    #include "tools/skui/InputState.h"
    #include "tools/skui/Key.h"
    #include "tools/skui/ModifierKey.h"
    namespace sk_app { class Window; }

    tools/sk_app/CommandSet.h should remove these lines:
    - #include "tools/sk_app/Window.h"

    The full include-list for tools/sk_app/CommandSet.h:
    #include "include/core/SkString.h"
    #include "include/core/SkTypes.h"
    #include "include/private/SkTArray.h"
    #include "tools/skui/InputState.h"
    #include "tools/skui/Key.h"
    #include "tools/skui/ModifierKey.h"
    #include <functional>
    #include <vector>
    class SkCanvas;
    namespace sk_app { class Window; }
    ---

This makes use of Bazel's toolchain features
https://bazel.build/docs/cc-toolchain-config-reference#features
to allow us to configure compiler flags when compiling
individual files. This analysis is off by default, and can
be turned on with --features skia_enforce_iwyu. When enabled,
it will only be run for files that have opted in.
Example:
    bazelisk build //example:hello_world_gl --config=clang \
       --sandbox_base=/dev/shm --features skia_enforce_iwyu

There are two ways to opt files in:
 - Add enforce_iwyu = True to a generated_cc_atom rule
 - Add enforce_iwyu_on_package() to a BUILD.bazel file
   (which enforces IWYU for all rules in that file)

Note that Bazel does not propagate features to dependencies
or dependents, so trying to enable the feature on cc_library
or cc_executable targets will only impact any files listed in
srcs or hdrs, not deps. This may be counter-intuitive when
compared to things like defines.

IWYU supports a mapping file, which we supply to help properly
handle things system headers (//toolchain/IWYU_mapping.imp)

Suggested Review Order:
 - toolchain/build_toolchain.bzl to see how we get the IWYU
   binaries into the toolchain
 - toolchain/BUILD.bazel and toolchain/IWYU_mapping.imp
   to see how the mapping file is made available for
   all compile steps
 - toolchain/clang_toolchain_config.bzl, where we define the
   skia_enforce_iwyu feature to turn on any verification at
   all and skia_opt_file_into_iwyu to enable the check for
   specific files using a define.
 - toolchain/clang_trampoline.sh, which is the toolchain is
   configured to call instead of clang directly (see line 83
   of clang_toolchain_config.bzl). This bash script used to
   just forward all arguments directly onto clang. Now it
   inspects them and either calls clang directly (if
   it does not find the define in the arguments or we are
   linking [bazel sometimes links with clang instead of ld])
   or calls clang and then include-what-you-use. In all cases,
   the trampoline sends the arguments to clang and IWYU
   unchanged).
 - //tools/sk_app/... to see enforcement enabled (and fixed)
   for select files, as an example of that method.
 - //experimental/bazel_test/... to see enforcement enabled
   for all rules in a BUILD.bazel file.
 - all other files.

Change-Id: I60a2ea9d5dc9955b6a8f166bd449de9e2b81a233
Bug: skia:13052
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/519776
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Leandro Lovisolo <lovisolo@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
2022-03-16 13:09:46 +00:00
Michael Ludwig
a9bc6c6437 [graphite] Add getStaticBuffer()->BindBufferInfo to DrawBufferManager
This is a short term solution. The linked bug has more details about
where we want to land. As is, this doesn't use much of the resource key
system but ideally should be updated to do so if we can handle resource
tracking w/in the CommandBuffer efficiently.

Alternatively we may pursue a direction where that is moot because it's
cached globally or held directly by the RenderStep.

As-is, this is a simple approach and should produce equivalent behavior
from a GPU command perspective in the single Recorder situation we are
in currently.

Cq-Include-Trybots: luci.skia.skia.primary:Test-Mac12-Clang-MacBookPro16.2-GPU-IntelIrisPlus-x86_64-Debug-All-Graphite,Test-Mac11-Clang-MacMini9.1-GPU-AppleM1-arm64-Release-All-Graphite,Test-Mac11-Clang-MacMini9.1-GPU-AppleM1-arm64-Debug-All-ASAN_Graphite,Test-Mac10.15.7-Clang-MacBookPro11.5-GPU-RadeonHD8870M-x86_64-Debug-All-Graphite,Build-Mac-Clang-x86_64-Release-Graphite,Build-Mac-Clang-x86_64-Debug-Graphite,Build-Mac-Clang-arm64-Release-iOS_Graphite,Build-Mac-Clang-arm64-Release-Graphite,Build-Mac-Clang-arm64-Debug-iOS_Graphite,Build-Mac-Clang-arm64-Debug-Graphite_NoGpu,Build-Mac-Clang-arm64-Debug-Graphite,Build-Mac-Clang-arm64-Debug-ASAN_Graphite
Bug: skia:13059
Change-Id: I6a110fafe2b69a8bfbc3d859b02d916c973baf26
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/520737
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2022-03-16 00:36:23 +00:00
Michael Ludwig
ffb49630eb [graphite] Transform perspective paths to device space on CPU for now
Cq-Include-Trybots: luci.skia.skia.primary:Test-Mac12-Clang-MacBookPro16.2-GPU-IntelIrisPlus-x86_64-Debug-All-Graphite,Test-Mac11-Clang-MacMini9.1-GPU-AppleM1-arm64-Release-All-Graphite,Test-Mac11-Clang-MacMini9.1-GPU-AppleM1-arm64-Debug-All-ASAN_Graphite,Test-Mac10.15.7-Clang-MacBookPro11.5-GPU-RadeonHD8870M-x86_64-Debug-All-Graphite,Build-Mac-Clang-x86_64-Release-Graphite,Build-Mac-Clang-x86_64-Debug-Graphite,Build-Mac-Clang-arm64-Release-iOS_Graphite,Build-Mac-Clang-arm64-Release-Graphite,Build-Mac-Clang-arm64-Debug-iOS_Graphite,Build-Mac-Clang-arm64-Debug-Graphite,Build-Mac-Clang-arm64-Debug-ASAN_Graphite,Build-Mac-Clang-arm64-Debug-Graphite_NoGpu
Bug: skia:12703
Change-Id: Iea08a885565811c442e8177b3fa0c668db95fd0f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/521008
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2022-03-15 20:25:04 +00:00
Michael Ludwig
986324ed7b [graphite] Draw strokes as filled paths for now
Cq-Include-Trybots: luci.skia.skia.primary:Test-Mac12-Clang-MacBookPro16.2-GPU-IntelIrisPlus-x86_64-Debug-All-Graphite,Test-Mac11-Clang-MacMini9.1-GPU-AppleM1-arm64-Release-All-Graphite,Test-Mac11-Clang-MacMini9.1-GPU-AppleM1-arm64-Debug-All-ASAN_Graphite,Test-Mac10.15.7-Clang-MacBookPro11.5-GPU-RadeonHD8870M-x86_64-Debug-All-Graphite,Build-Mac-Clang-x86_64-Release-Graphite,Build-Mac-Clang-x86_64-Debug-Graphite,Build-Mac-Clang-arm64-Release-iOS_Graphite,Build-Mac-Clang-arm64-Release-Graphite,Build-Mac-Clang-arm64-Debug-iOS_Graphite,Build-Mac-Clang-arm64-Debug-Graphite,Build-Mac-Clang-arm64-Debug-ASAN_Graphite,Build-Mac-Clang-arm64-Debug-Graphite_NoGpu
Bug: skia:12703
Change-Id: Ic0faa0c264157a4ac4b35157151ddf346cb72b19
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/521007
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2022-03-15 20:20:16 +00:00
Michael Ludwig
384c982548 [graphite] DrawList is provided chosen Renderer
DrawList's recording functions that paralleled the defined Renderers are
removed in favor of a single recordDraw() call that takes a Renderer.

Device has to do too much logic around determining draw ordering that
is coupled with the selected Renderer's requirements (e.g. stencil)
that it is easier to have a Renderer selector that Device uses, and
then it can inspect the requirements of that Renderer and modify the
ordering tracking as needed.

Right now, this renderer selection process is just in Device, but I
can imagine it living in its own object that the Gpu exposes so that
all wrappers around DrawContext make consistent decisions. This will
also come in handy if Renderers are created per Gpu instead of static.

Bug: skia:12703
Change-Id: I73b5254b7c4183f4c4e54cf5e2993ab8143bd4bd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/521006
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2022-03-15 20:19:59 +00:00
Robert Phillips
9565f4bd90 [graphite] Plumb Recorder down into KeyHelpers
The KeyContext is used in the addToKey methods but must appear in the
AddToKey methods bc the latter can call the former.

Bug: skia:12701
Change-Id: I3143afec8337b1e3e12f1c3cc198714009ca6930
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/520539
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2022-03-15 18:06:05 +00:00
Jim Van Verth
bd11ec8eab [graphite] Unmap and track current draw buffers
For discrete GPUs the draw buffers need to be unmapped so that
didModifyRange: is called to updated the managed buffer. In addition,
they should be tracked on the CommandBuffer.

Bug: skia:13033
Change-Id: I931b1bfd438bc75652c04734219690506fad5ea6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/520537
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2022-03-14 18:26:48 +00:00
Robert Phillips
4ee8dab839 [graphite] Disallow empty SkUniformData objects
Bug: skia:12701
Change-Id: Iaec7cfbbd595b9382e4362c01d5d6897277d8d7d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/520496
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2022-03-14 15:55:16 +00:00
Robert Phillips
44263c5d08 [graphite] Add fixed-function blending support
Bug: skia:12701
Change-Id: I1fd8dede3eb216c28408bd613119448704c0e7c7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/512356
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2022-03-14 14:21:46 +00:00
Robert Phillips
35f435160c [graphite] Have the kSolidColorShader shader snippet's uniform be premul
This makes the fixed-function blending happier

Bug: skia:12701
Change-Id: I398977a3ce9c25949535f73a83b9eb774d2d1c35
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/519616
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2022-03-10 21:14:12 +00:00
Jim Van Verth
6cb3f3d2c7 [graphite] Add Recorder accessors to SkCanvas and SkSurface
Bug: skia:12845
Change-Id: Ic036dea6b58682a6463f8c34d915730c4bfe677b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/519617
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2022-03-10 20:47:02 +00:00
Michael Ludwig
02ea811ce8 [graphite] Add a DynamicInstances mode to DrawWriter
This changes the fTemplateCount field in DrawWriter to be just 'int'.
fTemplateCount == 0 remains the signal for vertex-only drawing, but
now "dynamic" instances are encoded as negative values (-count-1).

A dynamic instance is needed for curved path rendering where each
block of instances uses an index count based specifically on the
tessellation level chosen by Wang's formula. However, the shaders and
the vertex/index structure is designed so that if a subsequent instance
required higher tessellation, the other instances could still be
invoked with that draw call's higher index count and the shader will
produce degenerate triangles (a little extra work in the VS, but far
fewer draw flushes).

Cq-Include-Trybots: luci.skia.skia.primary:Test-Mac11-Clang-MacMini9.1-GPU-AppleM1-arm64-Release-All-Graphite,Test-Mac11-Clang-MacMini9.1-GPU-AppleM1-arm64-Debug-All-ASAN_Graphite,Build-Mac-Clang-arm64-Release-Graphite,Build-Mac-Clang-arm64-Release-iOS_Graphite,Build-Mac-Clang-arm64-Debug-iOS_Graphite,Build-Mac-Clang-arm64-Debug-Graphite_NoGpu,Build-Mac-Clang-arm64-Debug-Graphite,Build-Mac-Clang-arm64-Debug-ASAN_Graphite
Bug: skia:12703
Change-Id: I96387daf86a53aa4861e253250bac7e500e3d53c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/498317
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2022-03-10 17:03:05 +00:00
Nathaniel Nifong
ee4f34edd3 delete experimental/wasm-skp-debugger
Change-Id: I3188e08f0f451938b16af0f3326607ea4d47ba92
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/519319
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Nathaniel Nifong <nifong@google.com>
2022-03-10 16:30:16 +00:00
Michael Ludwig
841906a850 [graphite] Don't reset uniform bindings on pipeline change
This is pulled from https://skia-review.googlesource.com/c/skia/+/492400

I noticed this when trying to determine pipeline changes in graphite on
the motionmark SKPs. Resetting the uniform bindings to invalid when we
switched pipelines because of a stencil-only pass meant a lot of extra
re-binding. Additionally, with graphite splitting bindings between
geometry and shading, this potentially avoids a rebind when a program
has a compatible shading snippet, or a compatible RenderStep.

Cq-Include-Trybots: luci.skia.skia.primary:Test-Mac11-Clang-MacMini9.1-GPU-AppleM1-arm64-Release-All-Graphite,Test-Mac11-Clang-MacMini9.1-GPU-AppleM1-arm64-Debug-All-ASAN_Graphite,Build-Mac-Clang-arm64-Release-Graphite,Build-Mac-Clang-arm64-Release-iOS_Graphite,Build-Mac-Clang-arm64-Debug-iOS_Graphite,Build-Mac-Clang-arm64-Debug-Graphite_NoGpu,Build-Mac-Clang-arm64-Debug-Graphite,Build-Mac-Clang-arm64-Debug-ASAN_Graphite
Change-Id: I42e60194a09b30b717d814acb4584c3f1eb884d7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/519079
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2022-03-10 16:21:21 +00:00
Michael Ludwig
f4f8bbb577 [graphite] Support reserving and returning vertex data in DrawWriter
Cq-Include-Trybots: luci.skia.skia.primary:Test-Mac11-Clang-MacMini9.1-GPU-AppleM1-arm64-Release-All-Graphite,Test-Mac11-Clang-MacMini9.1-GPU-AppleM1-arm64-Debug-All-ASAN_Graphite,Build-Mac-Clang-arm64-Release-Graphite,Build-Mac-Clang-arm64-Release-iOS_Graphite,Build-Mac-Clang-arm64-Debug-iOS_Graphite,Build-Mac-Clang-arm64-Debug-Graphite_NoGpu,Build-Mac-Clang-arm64-Debug-Graphite,Build-Mac-Clang-arm64-Debug-ASAN_Graphite
Bug: skia:12703
Change-Id: I5f1221ff7a51ca8b5935f6f46dd5d5a364cfec45
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/498316
Reviewed-by: Christopher Dalton <csmartdalton@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2022-03-10 15:40:53 +00:00
Florin Malita
3e8d2d286b Fix SkVideoDecoder build
Missing headers after
https://skia-review.googlesource.com/c/skia/+/518277.

Change-Id: I28c2a925846348f769f2774061eef756e268f680
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/519316
Commit-Queue: Florin Malita <fmalita@chromium.org>
Auto-Submit: Florin Malita <fmalita@chromium.org>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
2022-03-10 14:21:44 +00:00
Michael Ludwig
35553cd3a7 Pull back PatchWriter from Tessellator APIs
This is pretty much just refactoring, condensing the virtual APIs of
PathTessellator and StrokeTessellator to not require exposing
PatchWriter. Once landed, this makes it easier to move PatchWriter to
a template where each Tessellator subclass has a different instantation.

Bug: skia:13012
Change-Id: I1211a707f3e6ac6b3543cf17a3d3af0372221ce4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/517978
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2022-03-09 17:13:27 +00:00
Robert Phillips
6a6dea778b [graphite] Plumb PaintParamsKey's data payload down to glue code generators
The main change here is having the SkShaderInfo hold BlockReaders instead of ShaderSnippet entries.

Bug: skia:12701
Change-Id: I90f72d5a5b9735c5ce8342bee004f7adeb76ccff
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/517976
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2022-03-09 15:26:46 +00:00
Robert Phillips
5891d67871 [graphite] Plumb through the BlendInfo
The general flow of the blendInfo is:

It is created/filled in during the PaintParamsKey creation
   - it is currently stored on the SkPipelineData to get it
     out of the creation phase

Ownership is "transferred" to the ShaderCodeDictionary::Entry
when the PaintParamsKey is converted to a uniqueKey
   - this makes sense bc the blendInfo depends pretty directly
     on the PaintParamsKey

When a FS is generated by a backend the BlendInfo is retrieved
(from the SCD::Entry) and placed in the SkShaderInfo
   - the backend can then use the BlendInfo to set up the
     fixed-function blending

Note:
   The duplication of the BlendInfo in the SkPipelineData and the
   SCD::Entry is unfortunate but may go away in the future. We
   are faced with the general problem of the pre-compilation pass
   needing to get both the structure of the uniforms a program
   requires and the BlendInfo but _not_ the uniforms. So, in the
   future, an SkPipelineData may always be passed in to collect
   data but then disassembled (e.g., the uniformBlock is cached,
   the blendInfo goes into the SCD::Entry, etc.)

Bug: skia:12701
Change-Id: I5571809981cefa6770f69a4c1b8361db14afc44b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/517876
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2022-03-09 14:39:12 +00:00
Robert Phillips
88f90513a9 [graphite] Make CreateKey work more like ExtractPaintData
ExtractPaintData currently returns:
  std::tuple<SkUniquePaintParamsID, std::unique_ptr<SkPipelineData>>

SkShaderCodeDictionary::findOrCreate is going to change in an upcoming CL and this sets up to better isolate those changes.

Bug: skia:12701
Change-Id: I8d077b3d342e6ea16ac99227eb145d92e8247ea4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/517736
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2022-03-09 14:07:53 +00:00
Kevin Lubick
7ac7413f08 [bazel] Support Vulkan
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>
2022-03-08 21:21:17 +00:00
Kevin Lubick
57c1541715 Remove old experiments
These are unowned and/or unused.

Change-Id: I2ca871be712a7bf990ff89acc23b6a519bb19374
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/517996
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Florin Malita <fmalita@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
2022-03-08 19:07:00 +00:00
Greg Daniel
3c254e1d3b [Graphite] Support caching of buffers.
Bug: skia:12754
Change-Id: I8b74fadabee2ec90c20f9b53ff4946a3e2062cd3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/515956
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2022-03-08 18:14:47 +00:00
Robert Phillips
335a1d0454 [graphite] Split SkPipelineData out into its own file(s)
SkPipelineData is evolving into a big deal - it deserves it owns files.

Bug: skia:12701
Change-Id: I78b4100f1b90fa10f2b264e6d13fca6f15bba39b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/516157
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2022-03-08 16:04:35 +00:00
Greg Daniel
0cab38e81a [graphite] Add support for caching scratch textures.
Bug: skia:12754
Change-Id: I666bda6a192e3c3dc95953e5a36fbabbf65171ec
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/515857
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2022-03-07 23:27:47 +00:00
Greg Daniel
11206c3faf [graphite] Add support for caching discardable msaa textures
Bug: skia:12754
Change-Id: I66f5f64dc6d27f3bd9bf936fd5989531e33ecdc7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/515856
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2022-03-04 17:47:11 +00:00
Greg Daniel
2e7a5061b0 [graphite] Use ResourceCache for stencil attachments.
Bug: skia:12754
Change-Id: Iec046dedb088f226e5928712222fa786426b2689
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/515517
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2022-03-04 15:44:45 +00:00
Robert Phillips
b2ba7ee497 [graphite] Move SkShaderInfo::SnippetEntry to SkShaderSnippet
In a following CL the ShaderSnippet will need to shared between the SkPaintParamsKey and the SkShaderDictionary.

Bug: skia:12701
Change-Id: I69935765a32a5a0eb61a23178037ab6be3d110b3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/515357
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2022-03-03 20:09:24 +00:00
Greg Daniel
5bec818c1f [graphite] Add validation checks to ResourceCache
Bug: skia:12754
Change-Id: Ie88290f18864d61138964eb618dc6ac2d6ff4fe0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/508916
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2022-03-03 14:59:11 +00:00
Jim Van Verth
e43d00a219 [graphite] Add isGaneshBacked and isGraphiteBacked
Bug: skia:12845
Change-Id: Ib0b87966b1559b368759ce69c48f0fd27597503a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/514836
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2022-03-02 23:35:16 +00:00
Jim Van Verth
5d6e655004 [graphite] Add SkImage::makeTextureImage for Graphite.
Also adds in asView for texture-backed Image as well as stubs for
other Image types.

Bug: skia:12845
Change-Id: I58a90068d4d151ad35f411b08c8484c740253722
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/507336
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2022-03-02 21:30:10 +00:00
Greg Daniel
a025a1b17e [graphite] Fix ResourceCache thread safety when purging resources.
Because it is possible for a Resource to get added to a ReturnQueue
after we've decided to purge it from the Cache (see comments in change
for scenarios), the current ResourceCache could end up deleting the
Resource while something is still trying to use it. This CL fixes those
issues with a few key changes:

1) We don't allow a Resource to be added to the ReturnQueue multiple
times.
2) We make use of a third ref, fCacheRef, to track a Resource being
held in the Cache or Cache's ReturnQueue.

Bug: skia:12754
Change-Id: I9ab2b5967057daa5a83dc24a9f5bf255218b46cb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/514119
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2022-03-02 19:21:47 +00:00
Robert Phillips
b61366b54f [graphite] Rename SkUniformBlock to SkPipelineData
and:
 UniformCache -> PipelineDataCache
 UniformCacheTest -> PipelineDataCacheTest

Bug: skia:12701
Change-Id: Ia28c223edb8d741d15fa9fa83695ac6b99284d5e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/514156
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2022-03-02 17:01:07 +00:00
Kevin Lubick
acab911351 [bazel] Make use of test_on_env to spin up server for gms
In order to extract the PNG files produced by our CanvasKit gms,
we need our JS tests to POST them to a server which can write to
disk. The easiest way to do this is to use the test_on_env
rule defined in the Skia Infra repo for exactly this purpose.

This required https://skia-review.googlesource.com/c/buildbot/+/510717
to be able to configure the binary correctly and
https://skia-review.googlesource.com/c/buildbot/+/511862, for nicer
debugging so the skia-infra dep was updated via the following commands:
$ go get go.skia.org/infra@d8a552a29e
$ go mod download
$ make -C infra/bots train
$ make -C bazel gazelle_update_repo
This caused many automated changes to infra/bots/tasks.json

The flow is:
1. User types bazelisk test :hello_world_test_with_env
2. The test_on_env rule starts gold_test_env and waits
   for the file defined in $ENV_READY_FILE to be created.
3. gold_test_env starts a web server on a random port. It
   writes this port number to $ENV_DIR/port. Then, it
   creates $ENV_READY_FILE to signal ready.
4. test_on_env sees the ready file and then starts the
   karma_test rule. (Reminder: this is a bash script
   which starts karma using the Bazel-bundled chromium).
5. The karma_test rule runs the karma.bazel.js file (which
   has been injected with some JS code to fill in Bazel
   paths and settings) using Bazel-bundled node. This reads
   in the port file and sets up a Karma proxy to redirect
   /gold_rpc/report to http://localhost:PORT/report
6. The JS tests run via Karma (and do assertions via Jasmine).
   Some tests, the gms, make POST requests to the proxy.
7. gold_test_env gets these POST requests writes the images
   to a special Bazel folder on disk as defined by
   $TEST_UNDECLARED_OUTPUTS_DIR.
8. test_on_env identifies that the tests finish (because the
   karma_test script returns 0). It sends SIGINT to gold_test_env.
9. gold_test_env stops the webserver. The special Bazel folder
   will zip up anything inside it and make it available for
   future rules (e.g. a rule that will upload to Gold via goldctl).

Suggested Review Order:
 - bazel/karma_test.bzl to see the test_on_env rule bundled into
   the karma_test macro. I chose to put it there because it might
   be confusing to have to define both a karma_test and test_on_env
   rule in the same package but not be able to call one because it
   will fail to talk to the server.
 - gold_test_env.go to see how the appropriate files are written
   to signal the environment is ready and the handlers are set up.
 - karma.bazel.js to see how we make our own proxy given the
   port from the env binary. The fact that we could not create
   our own proxy with the existing karma_test rule was why the
   chain ending in https://skia-review.googlesource.com/c/skia/+/508797
   had to be abandoned.
 - tests/*.js to see how the environment is probed via /healthz
   and then used to make POST requests with data.
 - Everything else.

Change-Id: I32a90def41796ca94cf187d640cfff8e262f85f6
BUG: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/510737
Reviewed-by: Leandro Lovisolo <lovisolo@google.com>
2022-02-28 14:05:54 +00:00
Greg Daniel
6c370c9d82 [graphite] Fill out ResourceCache functions.
Bug: skia:12754
Change-Id: Ie012bce21597ef2f0f1555d1cc6302b7eda0dd56
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/507923
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2022-02-24 20:16:01 +00:00
Nathaniel Nifong
4040863fc8 fix makefile to reflect bazel build structure in buildbot
Change-Id: Ieb8a85f721e2c2c8894230eb98731b833de8f252
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/512777
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Nathaniel Nifong <nifong@google.com>
2022-02-24 18:59:53 +00:00
Kevin Lubick
b902658a1a [bazel] Fix Bazel build by guarding addToKey
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>
2022-02-24 18:10:40 +00:00
Robert Phillips
24f02a3e35 [graphite] Move backend specification into the SkPaintParamsBuilder
This should reduce any possibility of keys being built w/ mixed backend snippets. The decision of which backend the key is being created for is made once, when the builder is created.

Bug: skia:12701
Change-Id: I070330627450501eb93ed98271659e1441aaa935
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/511804
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2022-02-23 20:18:09 +00:00
Brian Osman
fe6cca4958 Add SK_BUILD_FOR_DEBUGGER define when compiling WASM SKP debugger
Change-Id: Ib9ade4c80595716c4c2f9ef803decfe3c7726f68
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/512142
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Nathaniel Nifong <nifong@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2022-02-23 18:50:28 +00:00
Robert Phillips
99ba004574 [graphite] Add blendMode uniform to blend/compose shader
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>
2022-02-23 18:21:05 +00:00
Greg Daniel
9608bbe95a [graphite] Initialze bound buffer tracking in render encoder.
Change-Id: I682e6cd5e02b7b43740c51caf59451da9e789a75
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/511799
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2022-02-22 21:23:15 +00:00
Robert Phillips
02f1bcf6d1 [graphite] Update memory handling between keybuilder and the key
This updates the key builder system so the builder can be used in a tight loop with the memory backing the key being reused.

Bug: skia:12701
Change-Id: I79a72ca26570dcfea9aa45b0fbad8e598688ee98
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/510016
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2022-02-18 21:00:42 +00:00
Robert Phillips
c4f1d16390 [graphite] Switch PaintParamsKey over to a builder/result model
This will leave the PaintParamsKeys more clearly immutable and manage more of the cruft of key creation (e.g., beginBlock/endBlock pairing).

Bug: skia:12701
Change-Id: I1944397465f845e974e950f47cedb90c3f1895b1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/506881
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2022-02-17 17:48:01 +00:00
Jim Van Verth
1729710b51 [graphite] Add TextureProxyView class.
Bug: skia:12845
Change-Id: I2cf5074f85242f51b3798c59d4450c043a99afee
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/509916
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2022-02-17 15:22:40 +00:00
Kevin Lubick
eec8edb660 Remove skottiekit experiment
Takeaway: A specific skottie WASM build *would* improve load time and
code size

This experiment is unused otherwise.

Change-Id: I78ab8c3936c7ac2b5e6e3af08e6f5b749d89265d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/509401
Reviewed-by: Florin Malita <fmalita@google.com>
Reviewed-by: Jorge Betancourt <jmbetancourt@google.com>
2022-02-15 22:40:08 +00:00
Kevin Lubick
7f568e968e [bazel] Update to use emsdk 3.1.4
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>
2022-02-15 17:47:03 +00:00
Robert Phillips
d184c1b12d [graphite] Add uniform name mangling and a uniform padding cheat
The name mangling is pretty simple. The uniform padding cheat is that all uniform blocks are now multiples of 16B so can always just be blindly concatenated.

Bug: skia:12701
Change-Id: I738b0669d13b11ad22096caf73af3e0c52fc0585
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/506879
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2022-02-15 16:22:44 +00:00
Greg Daniel
e39cebef73 [graphite] Merge Resource and ResourceRef together.
There really isn't anything we are gaining from keeping these class
separate. Originally the model was copied when porting over from Ganesh,
but I believe even in Ganesh the split mostly exists because GrResource
use to be public and we friended classes in it.. Since Resource is
internal and there are no plans to friend classes, the split is not
adding much value and just adds extra coding hopes.

Bug: skia:12754
Change-Id: I2e94b459d82b9295fa8450a94c612c593337fb98
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/508676
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2022-02-15 14:48:54 +00:00
Jim Van Verth
e03b9d14a1 [graphite] Store isFBOnly flag in samplesKey
Change-Id: I409dbac3d8548551722e74e86e67bc7b3620f506
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/507838
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2022-02-11 18:28:45 +00:00
Jim Van Verth
9af3a919ce [graphite] Hook up Surface::writePixels
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>
2022-02-11 16:37:41 +00:00
Greg Daniel
7caeb1bdb1 [graphite] Add calcuating of graphtie resource key for Textures in Caps
Bug: skia:12754
Change-Id: Ib4f1a9ac4ef16805cf8ca4e4c0eea0b3922ca28a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/506465
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2022-02-11 16:03:46 +00:00
Jim Van Verth
74ce095463 [graphite] Rename skgpu::Surface_Graphite to skgpu::Surface
This to match the naming convention for skgpu::Device and the future
skgpu::Image.

Change-Id: Ide0448633f14cfcba583a24eaaceb24da8a58e90
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/507317
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2022-02-10 21:50:41 +00:00
John Stiles
2122f40c4b Update REPORTER_ASSERT/ERRORF to check format strings.
Previously, REPORTER_ASSERT/ERRORF relied on a helper function named
`reporter_string` which papered over zero-argument and one-argument
messages (where one-argument messages are assumed to ignore printf
formatting rules entirely, and just forward the message as-is).

Replacing this helper with a direct call to `SkStringPrintf` allows
the compiler to check format arguments for correctness, but sacrifices
the one-argument special case. In practice the one-argument special
case was very rarely used, so it's not a significant sacrifice,
and this did uncover several real errors in assertion format strings
(including some cases where the wrong number of arguments was passed).

Change-Id: I4378c43b16fd8fdbf4c78d849a9f2f0a254f7abc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/506617
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2022-02-10 16:37:05 +00:00
Robert Phillips
4b583185ff [graphite] Fix two bugs wrt uniform uploading
Namely:
  we were always uploading uniforms to the front of the uniform buffer
  the gradient colors are stored as float4s - not half4s

Bug: skia:12701
Change-Id: Ic7a669566454d2c00b499cabf8f659ba08b0cedc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/506159
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2022-02-10 14:01:41 +00:00
Jim Van Verth
6d7d508667 [graphite] Add buffer setup for texture uploads
Takes the given texture data and destination rectangle, copies it into
a buffer, and stores the destination textureProxy, buffer, and
associated BufferTextureCopyData into an UploadCommand.

Bug: skia:12845
Change-Id: Icba8b9e56ac0d79083c54fe529bd7e35ddb6e23d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/505798
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2022-02-09 19:58:44 +00:00
Kevin Lubick
0fac7baa61 Remove experimental/xform
Requires cr/427505724 to land also.

Change-Id: I88465a234b48abf4b1ac97146c8adcf9638babd0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/506396
Reviewed-by: Brian Osman <brianosman@google.com>
2022-02-09 19:56:49 +00:00
Kevin Lubick
9cb74e9079 [bazel] Compile gms for wasm and WebGL
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>
2022-02-09 18:56:17 +00:00
Robert Phillips
61e7b64962 [graphite] Rearrange headers
There is no need for these headers to be in include/private:
SkPaintParamsKey.h
SkShaderCodeDictionary.h

Added the new header:
src/core/SkBuiltInCodeSnippetID.h

Bug: skia:12701
Change-Id: I413e9a21bc26d5df48765d16dd7390e324006368
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/505197
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2022-02-08 19:07:34 +00:00
Greg Daniel
1048287b5d [graphite] Add GraphiteResourceKey class.
Bug: skia:12754
Change-Id: I29a33224941e92504fe4f47fca3b923e6983ac26
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/505137
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2022-02-08 18:28:43 +00:00
Jim Van Verth
d67c266b73 [graphite] Add UploadList and UploadTask.
Sets up the internal framework for Uploads by adding an UploadList
to the DrawContext that is accumulated until we choose to snap off
an UploadTask.

Bug: skia:12845
Change-Id: Ibde03fba263bb158344b50c7477233266868c35d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/503820
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2022-02-08 18:25:29 +00:00
Robert Phillips
3bdff6b354 [graphite] Add a means of accumulating multiple code snippets
Namely, SkShaderInfo. This doesn't do anything interesting yet. The ShaderCodeDictionary stores the snippets and then a PaintParamsKey can be traversed to collect the snippets in an SkShaderInfo. Gluing them together will be next-ish.

Bug: skia:12701
Change-Id: Icb4b41716592fc119778ae08f84565da9acaf202
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/503822
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2022-02-08 16:46:50 +00:00
Robert Phillips
07b639da6f [graphite] Consolidate functionality in the SkShaderCodeDictionary
At some point we'll need to go through the dictionary for user provided SkSL

Bug: skia:12701
Change-Id: I484ae30626dad64f2bce1e0948071380d9f8282e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/504596
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2022-02-08 15:54:35 +00:00
John Stiles
87aa7a9095 Add SK_PRINTF_LIKE to existing variadic print functions.
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>
2022-02-07 14:55:39 +00:00
Greg Daniel
fc80c11138 [graphite] Don't initialize Recorder BufferManager until after initializing ResourceProvider.
Change-Id: Ic37b07919478af59fb775285dc2cfc932ce3f2b8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/504696
Commit-Queue: Greg Daniel <egdaniel@google.com>
Auto-Submit: Greg Daniel <egdaniel@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2022-02-04 22:43:39 +00:00
Robert Phillips
6c28bd97fe [graphite] Reorganize code snippets a bit
This inches us towards the model of the code snippets being subroutines that are then glued together in a main method.

Bug: skia:12701
Change-Id: I49c39636debd2dbe512c7d5f9bc401dd899df1dd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/504556
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2022-02-04 21:31:04 +00:00
Greg Daniel
324e00243f [graphite] Add RecorderPriv class
Change-Id: If2ef260cf015e7f7ae2ebc7de1a41a5ef52b8dd3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/504616
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2022-02-04 21:23:08 +00:00
Greg Daniel
94f0b94a3d [graphite] Fix unused member warning in Release build.
Change-Id: Ib995ebae0ad54d6ce672ce4afe61f67c4247bd9d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/504540
Commit-Queue: Greg Daniel <egdaniel@google.com>
Auto-Submit: Greg Daniel <egdaniel@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2022-02-04 21:22:45 +00:00
Robert Phillips
c2cb2d9ae2 [graphite] Split up Mtl uniform generation a bit
GetMtlUniforms will allow fusing uniforms from a set of code snippets.

Bug: skia:12701
Change-Id: Idf9767135acca6f918590b13fe7189bcf85b927a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/504536
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2022-02-04 21:17:41 +00:00
Greg Daniel
92c2ace930 [graphite] Add basic stubs for ResourceCache.
This also moves the creation of the ResourceProvider from Context into
Recorder so that we can share the SingleOwner object.

Bug: skia:12754
Change-Id: I97f5c8bf86f86835582a78250acb929722f26688
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/504478
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2022-02-04 19:25:11 +00:00
Kevin Lubick
e94b52c442 [canvaskit] Add skottie to Bazel build
PS 1 regenerates existing Bazel files
PS 2 adds generated Bazel files to skottie and its dependencies,
as well as incorporating it into CanvasKit.

This changes the version of Bazel we use to 5.0.0 (recently
released).We had been using a pre-release of 6.0 because we
wanted the new features in one of the 5.0 release candidates,
but not the regression that was there (and reverted before the
full 5.0 release). I'd like to stick to the latest stable Bazel
release where possible.

Suggested Review Order:
 - //modules/skottie/BUILD.bazel (this was hand written
   to encapsulate the skottie library). The files in the
   deps are based on skottie.gni.
 - //modules/skresources/BUILD.bazel and //modules/sksg/BUILD.bazel
   which expose all sources
 - //third_party/file_map_for_bazel.json which ignores the
   ffmpeg libraries (we won't actually build the SkVideoDecoder
   stuff because HAVE_VIDEO_DECODER is not set).
 - //modules/canvaskit/BUILD.bazel which makes use of the skottie
   library and includes the interface skottie.js file.
 - .bazelversion which changes the Bazel version used (e.g. by
   Bazelisk).
 - All other changes should be auto-generated or related to
   deleted files.

Change-Id: Ic26f9a9dea5310f2cbd9cda7d701847924a39a22
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/503828
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Jorge Betancourt <jmbetancourt@google.com>
2022-02-04 19:18:27 +00:00