Commit Graph

1834 Commits

Author SHA1 Message Date
Jim Van Verth
454c04e8f3 [graphite] Add shader error handling
Change-Id: I21743290128140bef729eef967e841a65f9fdc67
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/482702
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2021-12-11 00:18:22 +00:00
Robert Phillips
a964a72174 [graphite] Reenable linear gradient shading
Bug: skia:12701
Change-Id: I51bfad4ff61f2ab32753e532eb5b6ee46d765303
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/481737
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-12-09 21:16:00 +00:00
Jim Van Verth
85d6190f60 [graphite] Use depthstencilflags in RenderStep and up
Bug: skia:12700
Change-Id: Ie20156e3a7a9dec4524b379a617724cca21402d4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/481998
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2021-12-09 16:30:00 +00:00
Jim Van Verth
97f89808d1 [graphite] Set up depth/stencil attachment
Change-Id: I57233c89fb27f09ca22509edeab79ea6b158b3c3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/481281
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2021-12-08 21:38:28 +00:00
Robert Phillips
5f4867d992 [graphite] Switch from using raw MSL to using SkSL
Bug: skia:12701
Change-Id: If286f9398c099298b1a543a12d4a28ba70f7a20b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/479062
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-12-08 18:41:37 +00:00
Jim Van Verth
d3276e503d [graphite] Revise stencil setup and set in pipeline
Bug: skia:12700
Change-Id: Iea26b6478ce7b23f69f7a39320a40f4cef8231bd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/480399
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2021-12-06 20:41:57 +00:00
Jim Van Verth
40ba900d2e [graphite] Set up depth/stencil in GraphicsPipeline from RenderStep
Bug: skia:12700
Change-Id: I66bc33c2888c94999dcae9f709a7199208c62af4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/479756
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-12-03 21:53:28 +00:00
Greg Daniel
9399d95f95 [graphite] Fix metal rtAdjust for NDC space flip.
Change-Id: I793495c2a0c220b919a9f8b2ead2c784548c0211
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/479757
Commit-Queue: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Auto-Submit: Greg Daniel <egdaniel@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
2021-12-03 19:10:59 +00:00
Greg Daniel
f278a8058e [graphite] Use correct uniform buffer alignment.
Change-Id: I0695614a68a0d05d3a30163b4da5a75486f1d0b5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/479060
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2021-12-02 20:18:57 +00:00
Greg Daniel
9d74c28e82 [graphite] Move Recorder and Recording to public include.
This also hides the ctors for the respective classes so you can't just
arbitrarily make one outside of the factories.

Change-Id: If31ac8ea9b54c9e10c162081251e77d7e9d07147
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/478956
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2021-12-02 16:49:12 +00:00
Michael Ludwig
3145cb8f4b [graphite] Add rtAdjust to metal program generation
With this CL, rt adjust is handled automatically by the backend of the
CommandBuffer when setViewport is called, so DrawPass and the
CommandBufferTest are updated to configure that (and the geometry of
command buffer test is rewritten to be in Skia's coord system instead
of NDC).

Currently, the metal command buffer uses push constants to set the
rtAdjust uniform. Hypothetically, D3D12 could use the root descriptor,
etc. There is some coupling here between the intrinsics the SkSL
programming environment operates in, and the backends configuring the
pipelines, but I don't think it's unreasonable and it seems cleaner
to me than having DrawPass bind and upload uniforms for all of the
intrinsics.

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-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,Build-Mac-Clang-arm64-Release-Graphite
Bug: skia:12466
Change-Id: Id91e9ffc31688886c5bf3ee6134567070820207a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/478656
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
2021-12-02 16:42:57 +00:00
Michael Ludwig
9a44a6bf4f [graphite] RenderStep handles local-to-device transforms
Passes the Transform for each draw to the RenderStep, to both
writeVertices and writeUniforms, since any given RenderStep could
choose to transform vertices on the CPU, pack the matrix as instance
attributes, or upload it as a uniform.

Also updates UniformManager to take the source data as const void*

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-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,Build-Mac-Clang-arm64-Release-Graphite
Bug: skia:12466
Change-Id: I7ac40af0b7c123d068478f5672dda455c0bbbfb5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/478376
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
2021-12-01 22:37:28 +00:00
Jim Van Verth
0f75cc70f5 [graphite] Only track command buffer work in debug builds
Bug: skia:12466
Change-Id: Id17222170984731eb36b8158c5c97b9880d3a814
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/478496
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2021-12-01 20:01:25 +00:00
Michael Ludwig
fc2eef845a [graphite] Add operator== to BindBufferInfo
DrawWriter was using == to compare buffer bindings, but that hadn't
actually been added yet.

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-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,Build-Mac-Clang-arm64-Release-Graphite
Bug: skia:12466
Change-Id: I769cd3cb9f58f9ffc1558da9f24b2b6000c27388
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/478262
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
2021-12-01 16:54:02 +00:00
Jim Van Verth
7e34f11733 [graphite] Set up resolve and stencil/depth renderpass info
Bug: skia:12466
Change-Id: I85d23e73a37a368ed68c81191d072014df110080
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/475645
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2021-12-01 16:50:02 +00:00
Michael Ludwig
adcf51cb52 [graphite] Record commands in DrawPass
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-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:12466
Change-Id: If1d4c29a434a1ad3445ceadb98bd7f3b8abb5ee4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/475639
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-12-01 16:18:29 +00:00
Kevin Lubick
1c4f5183f1 [debugger] Define SK_ENABLE_DUMP_GPU to fix audit trail
Change-Id: I9301059b3ecb6c72b5978b82724285452448521a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/478308
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2021-12-01 14:57:03 +00:00
Greg Daniel
5e0950e4dc [graphite] Add Context create/deleteBackendTexture calls.
Bug: skia:12633
Change-Id: Ida78c4145423376dc0267096a1d758b74144fd0c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/477139
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2021-11-30 21:36:23 +00:00
Kevin Lubick
6ba9f702ba [bazel] Try adding cc_binary rules that use generated rules
To make the atomic rules a bit easier to work with, in many
of the folders, this adds in cc_library rules to group
together the sources from that folder (and subfolders
where prudent). We only needs sources because those atoms
should have their headers as deps.

One issue that was pointed out is that there is currently
no way to restrict the inclusion of certain packages,
a la, `gn check`. For example, there is no mechanism from
stopping a dev from adding
#include "modules/canvaskit/WasmCommon.h"
to something in //src/core (except circular dependencies).
We can probably address that using Bazel's visibility
rules as needed:
https://docs.bazel.build/versions/main/visibility.html
https://docs.bazel.build/versions/main/be/functions.html#package_group

It is recommended to look at this CL patchset by patchset.
PS1: Update gazelle command to generate rules in more folders.
PS2: A few changes to make generation work better.
PS3: The result of running make generate in //bazel
PS4: Adding the rules to build sksllex, the simplest binary I
     could find in the Skia repo.
PS5: Adding the rules to build skdiff, a more complex binary.
     I tried a few approaches, but ended up gravitating back
     towards the layout where we have each folder/package
     group up the sources. I imagine at some point, we'll have
     skdiff depend on skia_core or something, which will
     have things like //src/core, //src/codecs, //src/pathops
     all bundled together.
PS7: Added in the groupings of sources, similar to what we had
     earlier. I liked these for readability. These helped fix
     up the //:skia_core build, and by extension, the CanvasKit
     build.

Change-Id: I3faa7c4e821c876b243617aacf0246efa524cbde
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/476219
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Leandro Lovisolo <lovisolo@google.com>
2021-11-30 18:18:53 +00:00
Michael Ludwig
660cc2a38f [graphite] Assign indices to pipeline descriptions
Also adds a helper class to upload uniform data the first time it's
seen, and then remember the BufferBindInfo for use after sorting.

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-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:12466
Change-Id: I922166a24c5f8417020c0a3288cddf6043573c79
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/475637
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
2021-11-30 14:49:48 +00:00
Michael Ludwig
0814e7fb6a [graphite] Add Combination to GraphicsPipelineDesc
Change-Id: I7fa9b4da48f993143ade3b8030e2c67831cf0ffd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/475257
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2021-11-29 18:53:54 +00:00
Greg Daniel
e2a038f956 [graphite] Add caps queries for texturable and renderable
Bug: skia:12633
Change-Id: I47310b08f76afc29db56968c4a1abe6567ee40c8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/477136
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2021-11-29 15:14:27 +00:00
Michael Ludwig
2044a348d5 [graphite] Add RenderStep to GraphicsPipelineDesc, provides vertex MSL
Bug: skia:12466
Change-Id: I84d017eda7964a19ddd36570cd46e8d98ba2f50f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/474936
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2021-11-24 20:29:40 +00:00
Michael Ludwig
ac2a40ecf7 [graphite] Add geometry uniforms to RenderStep
RenderSteps expose the uniforms they use for their portion of the
program, and assume will be bound independently of the other uniform
sets needed for the paint, etc.

This wires them up in DrawPass, although the RenderSteps currently don't
define any. At the moment this CL is really just laying out the API and
then it will be tested more thoroughly in a follow up when
CommandBufferTest moves its hard-coded test shaders into the RenderStep
paradigm.

Bug: skia:12466
Change-Id: I8287dadb9a458127ba9f376ba351ca1932788c71
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/474137
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2021-11-24 18:15:48 +00:00
Michael Ludwig
fe2acfb281 [graphite] Move id off of UniformData and into UniformCache
Also renames UniformCache::findOrCreate() to insert(), and has it return
the assigned id. ExtractCombo() now does not take a UniformCache, since
it just has to return the CPU data extracted from the PaintParams. The
caching/id assignment is the responsibility of the DrawPass.

Updates unit tests and DrawPass to use this instead.

Bug: skia:12466
Change-Id: Ib363fcad799f62d0ad31bb9d3e4c995e191cae80
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/475798
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
2021-11-24 17:11:06 +00:00
Kevin Lubick
cc9d0cd5a9 [bazel] Add go/gazelle to WORKSPACE and use c++ extension.
This adds a simple go program to test the installed go
toolchain, and a Make rule to codify the arguments to
our gazelle binary, built with extensions.

I could not figure out how to get the .json file to work
with the gazelle() Bazel rule, but this works ok for now.

Bug: skia:12541
Change-Id: I5067b15c7518951aeb69559d3871799d3b5745f4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/475716
Reviewed-by: Leandro Lovisolo <lovisolo@google.com>
2021-11-23 20:00:15 +00:00
Kevin Lubick
9488e0237d [infra] Experiment generating BUILD.bazel files
This uses the gazelle extension from
https://skia-review.googlesource.com/c/buildbot/+/473357

Review Tips:
 - Ignore any changes to .h or .cpp files. Those have been
   pulled out into their own CLs.
 - Start with bazel/macros.bzl.
 - Read the CL with the generation code, if you haven't already.
 - Look at third_party/file_map_for_bazel.json.
 - See experimental/bazel_test for an idea of how a cc_binary
   would be made.
 - Spot check one or two of the BUILD.bazel files.

This CL generates the "atomic" rules for src/, include/ and
modules/skshaper, as a starting point.

`bazel build --config clang //include/...` works

`bazel build --config clang //src/...` starts compiling,
(which verifies that the BUILD.bazel files are all valid),
but runs into errors because not all third_party deps have
been resolved, and there are some files missing from the
toolchain still (e.g. EGL headers).

Change-Id: Ib7e0fb0efdb9f08655f06cbc56e9bb4cf416294b
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/474240
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Leandro Lovisolo <lovisolo@google.com>
2021-11-23 18:53:16 +00:00
Jim Van Verth
2f6c53ff72 [graphite] Add SkSL compiler support
Bug: skia:12466
Change-Id: Ie7414d7417e88249dd9f6421f8069be898adaece
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/474217
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-11-22 23:13:11 +00:00
Michael Ludwig
1f224edb2c [graphite] Add vertex/instance attribute definition to RenderStep
Moves Attribute into its own header. I did not move AttributeSet/Iter
out of GraphicsPipelineDesc because RenderStep should be able to just
rely on SkSpan<Attribute>. Since they are fixed definitions, there
shouldn't be a need to support skipping over uninitialized attrs. Once
GraphicsPipelineDesc just points to a RenderStep, AttributeSet/Iter can
be deleted.

Bug: skia:12466
Change-Id: I3b01b6283669fc02dc9cd0521bb236a9d0daa5eb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/474136
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
2021-11-22 22:31:09 +00:00
Michael Ludwig
b8e36741e0 [graphite] Add DrawWriter type for auto merging consecutive vertex data into draws
Change-Id: I94ded218e822fe50687e1efff7d46bcc4c1f1293
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/471780
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2021-11-22 21:16:42 +00:00
Michael Ludwig
61c032ea1b [graphite] Keep baseVertex,baseInstance relative to offset specified when vertex buffers were bound
All of the draw variants except drawIndexed support all base arguments
as part of the draw call that is recorded. Updated drawIndexed to use
the "instance" version and draw 1 instance if the baseVertex is not 0.

Previously, if we bound the buffer at a non-zero offset, but then
passed in 0 for the base vertex/instance relative to that, it would
reset the vertex offset to 0. This also cuts down on the number of
commands recorded since draws will only correspond to one command.

Bug: skia:12466
Change-Id: I3eb95b02d33f2d1e9b36991a8b824012383bc192
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/474058
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
2021-11-22 16:55:12 +00:00
Michael Ludwig
940086c815 [graphite] Include offset in Writers returned by DrawBufferManager
Previously, while BindBufferInfo had the right offset for binding the
buffers, the writer would always overwrite the contents at the
beginning. Never encountered it because the CommandBufferTest made its
VertexWriters directly, and DrawPass isn't end-to-end yet.

Bug: skia:12466
Change-Id: Ib874006d80a7286fcc3710cd38b3c6141ff928ef
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/474057
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
2021-11-19 17:57:52 +00:00
Greg Daniel
6d1d2c0898 [graphite] Support wrapped Textures in the backends.
Bug: skia:12633
Change-Id: I3e4542e560a2c876b4b35bf340bdb949c4922c65
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/472556
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2021-11-17 16:56:04 +00:00
Brian Salomon
30970525fd At SkDevice level and below use SkBlender instead of SkBlendMode
Draws that take a primitive with colors (vertices, patch, atlas) allow
the user to specify how the primitive color is blended with SkShader.

At the public level the blend is specified as SkBlendMode. This change
moves the implementation at SkDevice level over to SkBlender.

Future changes to the existing APIs or future APIs could allow clients
to specify SkBlenders instead of SkBlendMode. THis would would allow for
programmable blending between shader and primitive color.

SkShader_Blend now recognizes if it was constructed with a Mode blender
and extracts the mode enum.

SkBlender_Base::asFragmentProcessor no longer assumes that the dstFP's
input color should be args.fDestColor. Instead the caller
must configure that if desired. (We don't want this for drawAtlas, etc).

Change-Id: I44085da4ec9f4873428f38d629565f7f42c6be91
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/470458
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2021-11-17 16:53:28 +00:00
Jim Van Verth
e136c31fe4 [graphite] Add rasterization state methods to CommandBuffer
Bug: skia:12466
Change-Id: Iafd680901e10d1007a16da0112e41af4bf2f2703
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/472445
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2021-11-17 15:45:07 +00:00
Michael Ludwig
78a0a2a93d [graphite] Move VertexAttribTypeSize to DrawTypes.h
Bug: skia:12466
Change-Id: I6d45f297db4be7e41158d87886ef03905e13eb66
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/472437
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
2021-11-16 20:11:34 +00:00
Robert Phillips
4f806e0e02 Add UniformSlot to CommandBuffer API
This is split out of Michael's CL:
https://skia-review.googlesource.com/c/skia/+/468459

The CommandBufferTest gets a bit shortchanged in this CL but most of those changes should wait until the GraphicsPipelineDesc is expanded anyways.

Bug: skia:12466
Change-Id: Idba20354a4ab158c2bc46f490da23b8f5fcd55b4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/472336
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-11-16 19:11:21 +00:00
Robert Phillips
80ee93d2f5 Add ShaderType::kSolidColor and make Combinations work w/ PaintParams
This is split out of Michael's CL:
https://skia-review.googlesource.com/c/skia/+/468459

Bug: skia:12466
Change-Id: Ic38ee577553cf2c0d4da8130e80a11422fa2b92e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/472177
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-11-16 16:31:09 +00:00
Greg Daniel
7b64e138b5 [graphite] Remove use of GraphiteTypesPriv and move to *Types in src.
We should only be using include/private for types that actually are
needed in include/ files. I moved everything that was just in src to
new src/*Types.h files. This actually left nothing in GraphiteTypesPriv
for now, so I deleted it. If we actually need private types that are
part of include/ we can add it back later.

Bug: skia:12466
Change-Id: I180fc2032afd47bc6c5e8b9ccd4954b5d2451fc7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/471758
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2021-11-15 20:57:23 +00:00
Greg Daniel
686ccec13f [graphite] Add BackendTexture abstraction for Graphite.
There are definitely some missing getters on other functions we'll need
on BackendTexture. But for this CL I just wanted to get the basics and
ctor working. Other functions can be added as they are needed.

Bug: skia:12633
Change-Id: I668828138df943a432efcec6b1134756e681a582
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/469820
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2021-11-15 18:03:40 +00:00
Jim Van Verth
300f51ac51 [graphite] Be explicit about pending draws on DrawContext destruction
Bug: skia:12466
Change-Id: I266ee1ae865e85f778191c7812b690e203bb4df4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/471096
Auto-Submit: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2021-11-13 00:52:05 +00:00
Jim Van Verth
23dafe81e0 [graphite] Implement fullscreen clear as LoadOp
Bug: skia:12466
Change-Id: Ie8bbacd22375b4cb4a5fe7e39055cdba3a3d0896
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/469519
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2021-11-12 21:20:37 +00:00
Jim Van Verth
5182ed33a9 [graphite] Revise RenderPassTask construction
RenderPassTask should only represent a single RenderPass with possible
subpasses (represented by DrawPasses). This reconstructs the RenderPass
setup to match this thinking. RenderPassDesc now stores TextureProxys for
the attachments, since we may not have instantiated the Textures by the
time we create the RenderPassTask.

Bug: skia:12466
Change-Id: I4f8cab77a297aaf76bea7dd1cc3afd00143b8103
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/470460
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2021-11-12 15:10:24 +00:00
Brian Salomon
384ba65b8d Remove GPU V2
Replaced by Graphite.

Change-Id: Iac0ba212b078904a591677c9ce839a90562d0240
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/470305
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2021-11-11 17:11:19 +00:00
Jim Van Verth
1c0d713153 [graphite] Add offsets to vertex buffers
Bug: skia:12466
Change-Id: Icf59f2412a66f3f339635014f4b1e4c44d3c1619
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/469523
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2021-11-10 15:13:30 +00:00
Jim Van Verth
9b353b90c6 [graphite] Add commands to CommandBuffer from Tasks
Bug: skia:12466
Change-Id: I1e92dcf66c117ca351cebf20722524672c88e5cd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/469178
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2021-11-09 15:10:22 +00:00
Kevin Lubick
1f8c31b101 [infra] Add initial Bazel rules and files
These rules can be used to build our GMs on WASM+WebGL and
libskia.a with just the CPU backend (and most other features
turned off).

This can be done with the following commands:
  - bazel build //modules/canvaskit:gm-bindings-wasm --gpu_backend=gl_backend --with_gl_standard=webgl_standard
  - bazel build :skia-core --config clang

This pivots slightly from http://review.skia.org/463517
by using config_settings [1] instead of platforms for
the optional features that we control. This pivot was
suggested in [2]

We have BUILD.bazel files in many of the subdirectories
that specify filegroups for the appropriate files. In
an effort to make //BUILD.bazel more readable, it is
the responsibility of these subfolders to deal with
conditionally including certain .h or .cpp files.
This is done using select statements and config_settings
or platform constraints as necessary.

For example, src/gpu/BUILD.bazel will different private
filegroups for each of the supported gpu backends [3]
and a more-visible filegroup called "srcs" that has
the right selection of the private files to be used
for compilation.

An effort has been made to avoid using glob() in our
BUILD.bazel files. These file lists were made by using
`ls -1` and some regex to add in quotes. We might want
to make a helper script to assist with that, if necessary.

To specify which options we have, the settings in
//bazel/common_config_settings/BUILD.bazel have been
redesigned. They make use of a macro `string_flag_with_values`
that removes the boilerplate. Patchset 36 shows what the
file looks like w/o the macro.

The top level BUILD.bazel file will still need to use
some logic to handle defines, because local_defines is
a list of strings, not a list of labels [4].

Suggested Review Order:
  - WORKSPACE.bazel to see the new dependencies on the
    emsdk toolchain and bazel_skylib
  - bazel/common_config_settings/* to see the few settings
    defined (we have more to define, see BUILD.gn and
    //gn/skia.gni for ideas)
  - BUILD.bazel to see the "skia-core" cc_library rule.
    See also "gms" and "tests"
  - modules/canvaskit/BUILD.bazel to see the use of
    the emscripten "wasm_cc_binary" rule, which depends
    on the "skia-core", "gms", and "tests" rule. Note that
    it only builds some of the gms as a proof of concept.
  - The other BUILD.bazel files. Some of these are not
    platform or feature dependent (e.g. pathops). Others
    are (e.g. gpu).
  - All other files.

[1] https://docs.bazel.build/versions/4.2.1/skylark/config.html#user-defined-build-settings
[2] https://github.com/emscripten-core/emsdk/pull/920
[3] In this CL, that's just the webgl one.
[4] https://docs.bazel.build/versions/main/be/c-cpp.html#cc_library.local_defines

Change-Id: Ieecf9c106d5e3a6ae97d13d66be06b4b3c207089
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/458637
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Leandro Lovisolo <lovisolo@google.com>
Owners-Override: Kevin Lubick <kjlubick@google.com>
2021-11-09 12:32:25 +00:00
Michael Ludwig
497ac0fe23 [graphite] Rename RenderPipeline[Desc] to GraphicsPipeline[Desc]
Also updates MtlRenderPipeline to be MtlGraphicsPipeline to match the
type it extends, although we could choose to have it stay matched with
the backend object (MTLRenderPipeline) that it wraps instead.

Bug: skia:12466
Change-Id: Ida118e68a93d737d21edca15a59f5e64e17b5fd0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/467780
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2021-11-05 18:58:15 +00:00
Robert Phillips
f2b5dc8aaf [graphite] Fix MSL FS generation
Bug: skia:12466
Change-Id: Icd23abfa9ab1197a03e5d0f177747ea77b6b77e8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/465391
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-11-04 16:56:02 +00:00
Jim Van Verth
6990ee0dad [graphite] Add RenderPassTask::execute
Bug: skia:12466
Change-Id: Id1e8311cbe5bfbc7a2c9aa9cc106ebef1d363e63
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/467459
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2021-11-03 20:00:21 +00:00
Greg Daniel
5e52389d5f Reland "[graphite] Fill in basic vertex and index buffers."
This is a reland of b95c83353f

Original change's description:
> [graphite] Fill in basic vertex and index buffers.
>
> Bug: skia:12466
> Change-Id: I2398fcabc6c797a0bfc2ebccc0289cbf8fd8c72f
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/466436
> Commit-Queue: Greg Daniel <egdaniel@google.com>
> Reviewed-by: Michael Ludwig <michaelludwig@google.com>

Bug: skia:12466
Change-Id: Iac083c75d15f46ede1c8337da2914ad0161909e0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/466774
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2021-11-02 16:57:14 +00:00
John Stiles
40d5fbb3c7 Add support for half-precision uniforms to Graphite.
If our shaders pass a halfN uniform to Metal, we need to put SkHalf data
into the uniform buffer.

Change-Id: I92324715e7fb64f3b342fdf2c6994ebb86ba1773
Bug: skia:12339
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/465756
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
2021-11-02 15:16:46 +00:00
John Stiles
6934766e60 Rename Uint to UInt.
Uint was inconsistent--we had UByte and UShort, so ints should be UInt.

Change-Id: I71fdc3db902cdf62ab1de705dca2b0d069e9effb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/466499
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
2021-11-02 15:05:52 +00:00
Robert Phillips
15f17c0576 Revert "[graphite] Fill in basic vertex and index buffers."
This reverts commit b95c83353f.

Reason for revert: Test-Mac11-Clang-MacMini9.1-GPU-AppleM1-arm64-Debug-All-ASAN_Graphite failure

Original change's description:
> [graphite] Fill in basic vertex and index buffers.
>
> Bug: skia:12466
> Change-Id: I2398fcabc6c797a0bfc2ebccc0289cbf8fd8c72f
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/466436
> Commit-Queue: Greg Daniel <egdaniel@google.com>
> Reviewed-by: Michael Ludwig <michaelludwig@google.com>

Bug: skia:12466
Change-Id: I2cd986ef78741e699087a23c4ac963e4ddaa61d4
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/466756
Auto-Submit: Robert Phillips <robertphillips@google.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2021-11-02 00:21:09 +00:00
Greg Daniel
b95c83353f [graphite] Fill in basic vertex and index buffers.
Bug: skia:12466
Change-Id: I2398fcabc6c797a0bfc2ebccc0289cbf8fd8c72f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/466436
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2021-11-01 20:36:51 +00:00
Herb Derby
83e99569bd add constrained_add
This adds check to make sure that the results in the last
add of the lerp are in range. Also, Smooth out types.

Change-Id: I853835e530f6b6790e16464db12964d68ab9ef8d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/453718
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Herb Derby <herb@google.com>
2021-11-01 17:30:16 +00:00
Ben Wagner
8e37086c50 Remove SK_SURFACE_COPY_ON_WRITE_CRASHES
This flag is no longer needed, so remove it and the code it protected.

Change-Id: I679eb3cb4cee81c4205309012931e134e108f232
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/465696
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2021-11-01 15:04:14 +00:00
John Stiles
9b9805959d Reland "Add support for half-precision types in Metal."
This reverts commit 9d24b02c2f.

Reason for revert: needs premul/unpremul conversion fix (http://review.skia.org/465798)

Original change's description:
> Revert "Add support for half-precision types in Metal."
>
> This reverts commit d90e09b1ae.
>
> Reason for revert: MacMini failing CompressedBackendAllocationTest
>
> Original change's description:
> > Add support for half-precision types in Metal.
> >
> > This will hopefully improve performance on lower-end GPUs.
> >
> > Change-Id: I9c2ee6dc31acd08bec0bfb5f59edc3cf90163f9e
> > Bug: skia:12339
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/465078
> > Auto-Submit: John Stiles <johnstiles@google.com>
> > Reviewed-by: Brian Osman <brianosman@google.com>
> > Commit-Queue: John Stiles <johnstiles@google.com>
>
> Bug: skia:12339
> Change-Id: Ic5aa4bef454ca67f5ce26c600444d9565e0158cb
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/465796
> Auto-Submit: Brian Osman <brianosman@google.com>
> Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>

Bug: skia:12339
Change-Id: I53a8a6fef299da15d206d884ba7029820ffcff43
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/465799
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-10-30 14:33:52 +00:00
Brian Osman
9d24b02c2f Revert "Add support for half-precision types in Metal."
This reverts commit d90e09b1ae.

Reason for revert: MacMini failing CompressedBackendAllocationTest

Original change's description:
> Add support for half-precision types in Metal.
>
> This will hopefully improve performance on lower-end GPUs.
>
> Change-Id: I9c2ee6dc31acd08bec0bfb5f59edc3cf90163f9e
> Bug: skia:12339
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/465078
> Auto-Submit: John Stiles <johnstiles@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>
> Commit-Queue: John Stiles <johnstiles@google.com>

Bug: skia:12339
Change-Id: Ic5aa4bef454ca67f5ce26c600444d9565e0158cb
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/465796
Auto-Submit: Brian Osman <brianosman@google.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2021-10-29 23:04:09 +00:00
Robert Phillips
60e456ecbb [graphite] Partially connect Recorder, DrawBufferManager, DrawPass, and UniformCache.
Additionally, the default clip state was quick rejecting all the draws.

Bug: skia:12466
Change-Id: I8eaa95418bf24af2a5718c8cf21e97cdd7f80a34
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/465476
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2021-10-29 22:31:34 +00:00
John Stiles
d90e09b1ae Add support for half-precision types in Metal.
This will hopefully improve performance on lower-end GPUs.

Change-Id: I9c2ee6dc31acd08bec0bfb5f59edc3cf90163f9e
Bug: skia:12339
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/465078
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-10-29 19:47:02 +00:00
Greg Daniel
50add5af1a [graphite] Add support for synchronous surface readpixels
Bug: skia:12466
Change-Id: Ia0da94fc300ab678712e9bb79a011694fea8595e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/464677
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
2021-10-29 17:43:04 +00:00
Robert Phillips
527d127719 [graphite] Partially connect DrawPass, UniformCache and ProgramCache
Bug: skia:12466
Change-Id: Ib23a501664ebba581376fa0cb1ce5c6537e5d349
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/465136
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
2021-10-29 15:58:30 +00:00
Jim Van Verth
b5450fb901 [graphite] Add index buffer support and instanced draws
Bug: skia:12466
Change-Id: I12c64396791d8e0b8891b82927b1c8811a6e164f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/464385
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2021-10-28 21:31:32 +00:00
Robert Phillips
db7f2c67c2 [graphite] Add lookup by unique ID to program and uniform caches
The SortKey will only hold the uniqueID of the program and uniform data. When actually executing the draw we will need to reconnect with the actual data.

Bug: skia:12466
Change-Id: Iea7f0a99d471ea7fe2a3864bdd60255b09289088
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/464926
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-10-28 19:43:00 +00:00
Jim Van Verth
762a01fd99 [graphite] Stub out details of DrawList->DrawPass algorithm
Bug: skia:12466
Change-Id: I3c3eda26d0c09a58108a5b7bdd1bca0e63973f17
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/462887
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-10-28 19:00:25 +00:00
Robert Phillips
8b49157aae [graphite] Move MSL creation into the ProgramInfo
Bug: skia:12466
Change-Id: If31d25a1f4a4805069f6556c6802f33fa0bdfcc1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/464380
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
2021-10-28 18:48:40 +00:00
Greg Daniel
391f941949 [graphite] Add a Graphite no Gpu (i.e. Ganesh) build bot
Make sure graphite compiles standalone and not just if ganesh is also
enabled.

Bug: skia:12466
Change-Id: Ic843881a2a88c8d4b62f3a2ea38a10b6a86a12d4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/464817
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2021-10-28 17:58:59 +00:00
Robert Phillips
1fe391f0dc [graphite] Add caches for uniformdata and programs
Bug: skia:12466
Change-Id: Id61b019b583357bb9474c58a81270b0b860c9c4f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/464120
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-10-28 17:02:57 +00:00
Michael Ludwig
8837686752 [graphite] Actually record draws in DrawList
Bug: skia:12466
Change-Id: I91e1e90900997ad1e16710b51fa3dcdde6861d38
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/462886
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-10-28 16:32:35 +00:00
Ben Wagner
4b38d9c437 Reland "Avoid crash when surface CoW allocation fails"
On low memory machines a common cause of crashes is when a draw
operation requires a large layer (or many large layers) because an
implementation of SkSurface_Base::onCopyOnWrite does not actually have
the resources available to do the copy when required by a draw. Allow
this method to fail and percolate up the call chain so that the draw
simply does not happen instead of crashing.

It appears some users are creating their own subclasses of
SkSurface_Base for their tests. Add SK_SURFACE_COPY_ON_WRITE_CRASHES to
keep the old crashy behavior until they can be updated.

Bug: chromium:1116362
Revert: 5b19ebe0c5.
Revert-Change-Id: I2873589f996ded9c9fd6d27b19155ca18d5b5326
Revert-Reviewed-on: https://skia-review.googlesource.com/c/skia/+/463956
Change-Id: Id06d1e6d3aacb409a3b00b9a862bd8ddd1aaa22f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/464456
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2021-10-28 16:32:29 +00:00
Jim Van Verth
66485f9268 [graphite] Add vertex and instance buffer support.
Adds Attributes and supporting types to RenderPipelineDesc so they can
be created for the RenderPipeline.

Bug: skia:12466
Change-Id: I7ed920ea6d44f27f7dace81d35cd967a8dea55de
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/464377
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2021-10-28 14:50:38 +00:00
Greg Daniel
5b19ebe0c5 Revert "Avoid crash when surface CoW allocation fails"
This reverts commit 2e228bb72c.

Reason for revert: breaks android roll

Original change's description:
> Avoid crash when surface CoW allocation fails
>
> On low memory machines a common cause of crashes is when a draw
> operation requires a large layer (or many large layers) because an
> implementation of SkSurface_Base::onCopyOnWrite does not actually have
> the resources available to do the copy when required by a draw. Allow
> this method to fail and percolate up the call chain so that the draw
> simply does not happen instead of crashing.
>
> Bug: chromium:1116362
> Change-Id: I2873589f996ded9c9fd6d27b19155ca18d5b5326
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/463956
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Reviewed-by: Herb Derby <herb@google.com>
> Commit-Queue: Ben Wagner <bungeman@google.com>

Bug: chromium:1116362
Change-Id: I5ab590b6fc14bcb6712c00dda75d1e7cdc931447
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/464077
Auto-Submit: Greg Daniel <egdaniel@google.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2021-10-28 01:51:09 +00:00
Ben Wagner
2e228bb72c Avoid crash when surface CoW allocation fails
On low memory machines a common cause of crashes is when a draw
operation requires a large layer (or many large layers) because an
implementation of SkSurface_Base::onCopyOnWrite does not actually have
the resources available to do the copy when required by a draw. Allow
this method to fail and percolate up the call chain so that the draw
simply does not happen instead of crashing.

Bug: chromium:1116362
Change-Id: I2873589f996ded9c9fd6d27b19155ca18d5b5326
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/463956
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2021-10-27 20:38:44 +00:00
Greg Daniel
6a02277fa2 [graphite] Add DrawBufferManager class.
This class will manage and suballocate all buffers used for draws. This
includes vertex, index, and uniform buffers.

Bug: skia:12466
Change-Id: I30f498fe3465e4cc693b974019dcef27efaa8073
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/462097
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2021-10-27 19:56:06 +00:00
Robert Phillips
b421a71f37 [graphite] Expand shader precompilation placeholder
Bug: skia:12466
Change-Id: If633ce39c8f45b1ee3c042b5b72d7e0f95ca5c19
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/459597
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-10-27 18:43:52 +00:00
Jim Van Verth
f44bc854bf [graphite] Track target TextureProxy for DrawContext and DrawPass
Bug: skia:12466
Change-Id: I3f29f403a3ac91e81f54b0ec3bad19df8dd58739
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/462885
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2021-10-27 13:57:10 +00:00
John Stiles
14c328247b Update Metal type sizes and alignments.
The original values assumed that `half` types would be sized the same as
a `float`. This is still the case (as skia:12339 is not yet fully
implemented) but this CL now contains the expected half values as well.

Change-Id: I94ff73446d29318f127600fb681c222a759936cc
Bug: skia:12339
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/463736
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2021-10-26 21:51:35 +00:00
Kevin Lubick
97284f255b [infra] Add initial platforms and constraint values
This makes use of Bazel's pre-defined platforms
https://github.com/bazelbuild/platforms
and some of our own defined values (see
//bazel/common_config_settings/BUILD.bazel) to customize
the build rules.

I verified this by building bazel_test locally for
linux x64 as well as using the third_party deps for
a WASM build (using build files not seen in this CL).

Suggested Review Order:
 - https://docs.bazel.build/versions/main/platforms.html if not
   already familiar with Bazel Platforms
 - third_party/BUILD.bazel to see that 1) all globs have
   been removed and 2) select() targets various
   platform constants or groups of constants to control
   sources, headers, and local_defines.
 - common_config_settings/ to see the groups of constraints
   created, as well as new constraint_settings defined
   (skdebug_impl)
 - supported_combinations/ to see how we can define supported
   sets of the constraint values (aka Bazel platforms).
   I imagine expanding this more, so we might have platforms
   named "linux_x64_emptyfontmgr_vulkan" or such.
 - //BUILD.bazel and bazel_test.cpp to see use of SkDebugf.
 - Everything else.

Change-Id: I49e4abdbcf7b76f0674efdbb1f53dc8823d110ee
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/463517
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Leandro Lovisolo <lovisolo@google.com>
Owners-Override: Kevin Lubick <kjlubick@google.com>
2021-10-26 18:27:13 +00:00
Robert Phillips
7898607697 Fix CL collision (rm SLType Byte type usage)
Change-Id: I47ff2b564f4ab785085657f84c095e2a97d65107
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/463737
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-10-26 17:56:38 +00:00
Jim Van Verth
215b48dc23 [graphite] Fix link error in DrawOrder.h
Bug: skia:12466
Change-Id: I1e7812e3600cacc8fe678e924d48c27fb8b88138
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/463716
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
Auto-Submit: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2021-10-26 16:54:10 +00:00
Robert Phillips
ef8907c69f [graphite] Rename UniformDataManager to UniformManager and update
Gerrit didn't do so well on this CL. What's changed in the UniformManager is:

a lot of unused stuff was pared out of the UniformDataManager
the Write methods now return the number of bytes written in the call (incl. padding)
all the "#ifdef SK_DEBUG" stuff is new to validate against the prior way of writing uniforms

Bug: skia:12466
Change-Id: I172a74273c774257f751750aef37f4bd4c4e7e7b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/463458
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-10-26 16:26:13 +00:00
John Stiles
f6fb3db1dc Remove GrSL byte types.
Byte types were removed from SkSL in http://review.skia.org/404219.

Change-Id: Iec726de0be2ce371a20e21638638a495fae282a0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/463498
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-10-26 15:48:09 +00:00
Jim Van Verth
c545aa5aa6 [graphite] Add uniform buffer support to command buffer
Bug: skia:12466
Change-Id: Ie4c1973427e96d84b77f28edb5a4d6f1d53ef8aa
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/463316
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2021-10-26 15:40:08 +00:00
Michael Ludwig
2a372177e8 [graphite] Max draw count in DrawList
Bug: skia:12466
Change-Id: Ic312ce41b5eb0ae0c20e6b76032b984d9a406d89
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/462884
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2021-10-26 15:17:14 +00:00
Michael Ludwig
04bff8ba6e [graphite] Consolidate ordering constraints into DrawOrder type
Bug: skia:12466
Change-Id: I734c3a9595948dfb74f8ec72684183fe743bfefb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/462883
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
2021-10-26 15:15:45 +00:00
Jim Van Verth
649e3c2f98 [graphite] Reorganize CommandBuffer a little
* Keep RenderPass-related routines together
* Rename setRenderPipeline to bindRenderPipeline
* Pass resources as const& to platform-specific routines, to avoid
  copies.

Bug: skia:12466
Change-Id: I4c3ea006263ace4a050b6c86f70163f5fd5e254a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/463336
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2021-10-26 14:07:04 +00:00
Greg Daniel
a21aacf7c7 [graphite] Allow graphite to compile without ganesh and add shared gn files.
With this you should be able to set skia_enable_gpu=false in your gn
args and still be able to compile and run graphite.

Bug: skia:12466
Change-Id: Ibffc8774a8c46afad3f717dabc54fa831338a807
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/463317
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
2021-10-26 01:25:05 +00:00
Michael Ludwig
1f27d9ad54 [graphite] Stub out Renderer and RenderStep
Bug: skia:12466
Change-Id: I8a31cd8480199a941dfc1d9d1092f8a1dafdb0da
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/462882
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
2021-10-26 00:57:40 +00:00
Michael Ludwig
8744f3b84d [graphite] Remove unused prior task depdency on RenderPassTask
Bug: skia:12466
Change-Id: I794de6af814ab1b3e9517e139582e06382ecf957
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/462881
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
2021-10-26 00:17:31 +00:00
Michael Ludwig
e167dda424 [graphite] Move TextureProxy ctor impl into to resolve forward decl
Bug: skia:12466
Change-Id: I273fbb51730d85cda6921747e72ace2b9d7601e1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/462880
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2021-10-25 20:08:45 +00:00
Michael Ludwig
18d0015c82 [graphite] Move some types to GraphiteTypesPriv
Bug: skia:12466
Change-Id: If90c17634de9caa2ac3a928187226339523d53eb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/462879
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
2021-10-25 19:18:32 +00:00
Greg Daniel
a98f6b57ec [graphite] Add copy texture to buffer task.
Bug: skia:12466
Change-Id: Ifd70300896504f8567e6395c3d3683f0d37c905b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/463056
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
2021-10-25 18:59:07 +00:00
Julia Lavrova
3941bcad32 Fixing Android build
Change-Id: I8e1b3f0cd9e18967f6f821f639e66efe3d59b20d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/462519
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2021-10-22 17:49:02 +00:00
Julia Lavrova
f997f82011 RTL
Change-Id: I5ff001f2c839c08b91dd50e4e813c4d3c885a857
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/456474
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2021-10-22 16:21:02 +00:00
Jim Van Verth
99b3d8f8ea [graphite] Move work and resource tracking to CommandBuffer base class.
Also adds test of texture copyback to CommandBufferTest, and
endEncoding() to BlitCommandEncoder.

Bug: skia:12466
Change-Id: I57e4646aacc1d950cc16b70d7feeced1a04e6867
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/462078
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2021-10-21 21:25:34 +00:00
Jim Van Verth
dbd3b1b04c [graphite] Add pipeline and draw support
Bug: skia:12466
Change-Id: I5c0c919d4523258a11b4545346093953a4f09c7e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/461597
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2021-10-21 19:34:26 +00:00
Julia Lavrova
dee9c2ae0c RTL done right (only WrappedText and VisualRun classes deal with it)
Jul started. It does not work yet.

Change-Id: Ie2c3d943f281dae86befff64f7342c097a5bc7b9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/455257
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2021-10-21 18:41:30 +00:00
Jim Van Verth
bb553eda93 [graphite] Implement remainder of RenderCommandEncoder methods
Bug: skia:12466
Change-Id: I7be58aca7eedf18e4157d9473216785eead8c89a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/461700
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-10-21 14:54:33 +00:00
Kevin Lubick
4d41304def [infra] Add hermetic toolchain for C/C++ using Clang+Musl
This can successfully build a C library:
   bazel build --config=clang //third_party:libpng

This can build and run a statically-linked executable:
   bazel test --config=clang //:bazel_test

For more verbose compile and linking output, add the
`--features diagnostic`
flag to a Bazel command (see _make_diagnostic_flags() in
toolchain/clang_toolchain_config.bzl. Similarly, a
`--features print_search_dirs` can be used to show where
clang is looking for libraries etc to link against.
These features are made available for easier debugging.

Suggested review order:
 - Read https://docs.bazel.build/versions/4.2.1/tutorial/cc-toolchain-config.html
   if unfamiliar with setting up C++ toolchains in Bazel
 - .bazelrc and WORKSPACE.bazel that configure use and download
   of the toolchain (Clang 13, musl 1.2.2)
 - toolchain/build_toolchain.bzl which downloads and assembles
   the toolchain (w/o installing anything on the host machine)
 - toolchain/BUILD.bazel and toolchain/*trampoline.sh to see
   the setup of the toolchain rules.
 - toolchain/clang_toolchain_config.bzl to see the configuration
   of the toolchain. Pay special attention to the various
   command line flags that are set.
 - See that tools/bazel_test.cc has made a new home in
   experimental/bazel_test/bazel_test.cpp, with a companion
   BUILD.bazel. Note the addition of some function calls
   that test use of the C++ standard library.
   The number being used to test the PNG library is the latest
   and greatest that verifies we are compiling the one brought
   in via DEPS (and not a local one).
 - third_party/* to see how png (and its dependent zlib) have
   been built. Pay special attention to the musl_compat hack
   to fix static linking (any idea what the real cause is?)
- //BUILD.bazel to see definition of the bazel_test executable.

Change-Id: I7b0922d0d45cb9be8df2fd5fa5a1f48492654d5f
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/461178
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Leandro Lovisolo <lovisolo@google.com>
2021-10-21 12:43:49 +00:00
Jim Van Verth
6dcb6b44e9 [graphite] Take two at fixing non-Metal build
Bug: skia:12466
Change-Id: I7eb240985ce0c267bbc7be040e0f812407d31435
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/461699
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
Auto-Submit: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2021-10-20 20:53:08 +00:00
Michael Ludwig
251e7e6bfd [graphite] Wire up BoundsManager for color/depth ordering
Except that applyClipToDraw doesn't actually evaluate any clip shapes,
and the BoundsManager is the slow/naive one, I think all the changes to
Device fully implement the tracking/work needed for color/depth sorting.

Bug: skia:12466
Change-Id: I74f38e56d34d822c2be35f1ebedfb7c00b87f04c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/460616
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2021-10-20 20:20:01 +00:00
Chris Dalton
8f6a229a71 [graphite] Add alignment directives to IntersectionTree arrays
Thise should have been aligned properly already due to their
placement, but it doesn't hurt to make it more explicit.

Change-Id: Idb6a03e93d86df7727324987f166d197d5e708a4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/461377
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2021-10-20 17:48:28 +00:00
Greg Daniel
ac29367c91 [graphite] Fix graphite iOS build.
Bug: skia:12466
Change-Id: Id0419836ca96d99836879d509ca2cd1c9244d76f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/461598
Commit-Queue: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Auto-Submit: Greg Daniel <egdaniel@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
2021-10-20 17:15:09 +00:00
Greg Daniel
8582724780 [graphite] Add copyTextureToBuffer call on CommandBuffer.
Bug: skia:12466
Change-Id: I44bd3899dea817318f83444f023c1c8adcfc2d1e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/459881
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
2021-10-20 14:12:28 +00:00
Michael Ludwig
40b143c174 [graphite] Add mapRect(skgpu::Rect) to Transform
While we won't be transforming shapes, we do need an accurate way to
transform bounding boxes to device space. Right now this just uses
SkM44's mapRect function and converts to/from an SkRect. However,
under the hood SkM44 uses a similar negation trick as skgpu::Rect so
I need to explore if using Rect's internal structure directly will let
us compute the bounding box with fewer operations.

Additionally, SkM44's mapRect clips to a fixed w=epsilon plane, and I
think Transform::mapRect should just do the right thing and handle
w clipping/projection as accurately as possible.

Bug: skia:12466
Change-Id: I08c9df6c40cbcdcd8f622baae222bdf361d59070
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/460578
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Chris Dalton <csmartdalton@google.com>
2021-10-20 00:03:58 +00:00
Michael Ludwig
3793335614 [graphite] Update Shape to use skgpu::Rect and float2
Switches Shape to store kRect types as skgpu::Rect instead of SkRect,
although it can be constructed or set from an SkRect. It returns a Rect
from rect() and bounds() now.

Also switches out the line to be constructed from float2's, and re-use
the fRect storage to store the first segment vertex in topLeft and
the second vertex in botRight.

Bug: skia:12466
Change-Id: I1032fb6f222b0853305186c0e34091b014ae0cea
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/460577
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2021-10-19 23:25:48 +00:00
Jim Van Verth
c9b9174475 [graphite] Use std::move when adding RenderPass attachment to CmdBuffer
This step was missing from the previous CL.

Bug: skia:12466
Change-Id: I3da0082efefbabf6008fc8962d706f75f0743ecc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/461176
Auto-Submit: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2021-10-19 23:07:02 +00:00
Chris Dalton
2fceb21cb7 [graphite] Add an IntersectionTree class
Implements a BSP tree with NEON/SSE optimizations that tracks
non-overlapping regions. This object can be used batch sets of paths
into non-overlapping draws. Performance on AppleM1 with our existing
benchmarks looks very promising:

    desk_motionmarkarcs.skp     1227 paths -> 69 draws    450us
    desk_motionmarksuits.skp    1417 paths -> 26 draws    201us
    desk_chalkboard.skp         1940 paths -> 11 draws     84us
    desk_ynevsvg.skp             859 paths -> 10 draws     31us
    desk_micrographygirl.skp     318 paths -> 29 draws     11us

Bug: skia:12466
Change-Id: I847a93ed726dea10cb403cb76e578bd81eb920d2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/460298
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2021-10-19 19:45:01 +00:00
Chris Dalton
e1bfa18fc5 [graphite] Rect::isEmptyOrNegative() -> Rect::isEmptyNegativeOrNan()
Bug: skia:12466
Change-Id: I89d41509b8158aabac5250f035115954e8ae7f4b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/460655
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2021-10-19 18:07:30 +00:00
Jim Van Verth
f3f2e75820 [graphite] Add RenderPass setup and test
Bug: skia:12466
Change-Id: Ibbb4894c6a46dd8853909214da85314f9abc3959
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/459880
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-10-19 17:34:03 +00:00
Robert Phillips
1f766792d5 [graphite] Copy UniformDataManager into Graphite and trim down
This attempts to salvage the reuseable portion of:

https://skia-review.googlesource.com/c/skia/+/440841 (New approach to GrProcessor uniforms)

It also removes the old code's Gr- dependencies.

Bug: skia:12466
Change-Id: I7f7f3a9f9b4f3e282af1caeb02d2b305e6756025
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/460556
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-10-18 23:58:59 +00:00
Chris Dalton
8fafb0f633 [graphite] Add setters to Rect
Bug: skia:12466
Change-Id: I69222b60d421d8deebcb977124ee0f5cb06f34dd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/460638
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2021-10-18 22:13:35 +00:00
Jim Van Verth
0c56bbaffe [graphite] Add command buffer test
Adds test of command buffer submission with GPU recording (if enabled).
Also adds programmatic GPU recording support.

Bug: skia:12466
Change-Id: I85aba9f7e5e09f62f2ddc7040d1ff84bb9b4ae09
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/460337
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2021-10-18 17:49:36 +00:00
Jim Van Verth
eda5ba1598 [graphite] Add resource tracking to CommandBuffer
Bug: skia:12466
Change-Id: I98acab4bbab2fdc1c359161956c3f0aa29ad7adc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/459884
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2021-10-18 14:06:02 +00:00
Michael Ludwig
4021b947f7 [graphite] Add Transform that wraps matrix, inverse, type and scale factors
Transform.h is named Transform_graphite.h to avoid collision with
Transform.h in skottie/src

Bug: skia:12466
Change-Id: I017eee2bffe1a0aad605221e67540f732c2ee6b9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/459719
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-10-16 00:06:32 +00:00
Greg Daniel
6a24fe4825 [graphite] Add call to ResourceProvider to get Buffer.
Bug: skia:12466
Change-Id: I4c80d5438d95562ef42531b4f66a9eaa6ff75d1f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/459877
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2021-10-15 16:40:17 +00:00
Greg Daniel
11c4d14d89 [graphite] Add getter for default MSAA TextureInfo.
Bug: skia:12466
Change-Id: I663bc5ce12fc15bb4783ab9cf13cd7ccbfd9f9be
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/459876
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2021-10-15 16:40:06 +00:00
Robert Phillips
a750dfcce2 [graphite] Rearrange internal Context/Recorder/Recording relationship
Bug: skia:12466
Change-Id: I6b15d099f3853b392f3763cd1100d89ff4e4fd1d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/459122
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-10-15 13:51:59 +00:00
Greg Daniel
b9924539bb [graphite] Add Buffer and MtlBuffer classes.
Bug: skia:12466
Change-Id: I3252f36c3f78642c55f127379ceba99b4845822e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/458717
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2021-10-13 18:28:12 +00:00
Brian Osman
558aff92f9 Move atlas -> shader conversion up to SkCanvas
This makes the SkDevice interface and code simpler, and also opens the
door to a version of drawAtlas that takes a more complex SkShader (on
the SkPaint), rather than just a single SkImage.

Bug: skia:11942
Change-Id: I557bd2f03b85940b29954cb994916d5566bd7747
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/458980
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2021-10-13 18:08:28 +00:00
Robert Phillips
297d096cfb [graphite] More testing infrastructure
With this CL we can run as:

     dm --src gm skp tests --config grmtl -v --nocpu --nogpu

and not get all the non-Graphite unit tests.

Bug: skia:12466
Change-Id: Ib3f04f315fe4b5731a54e4c72979a0c1e00baf24
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/457898
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2021-10-13 15:15:29 +00:00
Robert Phillips
76f61debc6 [graphite] Initial shader combination/precompile API
Bug: skia:12466
Change-Id: I49e1ec8308a0cde2b5d43901281d60a6f70be5c4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/457119
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-10-13 14:06:06 +00:00
Michael Ludwig
76fbbc89e9 [graphite] Device, DrawContext, and DrawList use Shape
Adds a line primitive back to geom::Shape since I just couldn't tolerate
drawPoints mallocing a path for every line. When Shape provides a path
like iterator, it will look equivalent to an SkPath that is a line, so
there won't be any reason to analyze an incoming path for a line, but
if we know we want a line, there's no reason to wrap it in a path.

DrawList and DrawContext now take Shapes for their path rendering funcs,
but are documented to use path rendering. It won't be like GrSDC that
tries to choose the algorithm under the hood from you.

Device has been heavily updated to funnel all the draw calls into a
new drawShape(), so the primitive functions do not malloc skpaths any
longer, even if they still end up using path renderering.

Additionally, instead of making new paints that have updated styles or
removed components, drawShape() takes an SkStrokeRec and ignores what's
on the paint, and has additional flags that tell it to ignore aspects
of the paint. This is used when it recurses, or for cases like drawPaint
where path effects and mask filters should be ignored (and eventually
other things like drawImage will ignore path effects and force a fill
style).

Bug: skia:12466
Change-Id: I4700c895ce3fefe2e437f3b4d329fd381593e037
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/457398
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-10-12 21:09:32 +00:00
Jim Van Verth
dc6a9e3e12 [graphite] Add command buffer submission and tracking
Bug: skia:12466
Change-Id: I965417fc1de471af33a31155abf2760d5d1b4f62
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/457317
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2021-10-12 20:04:29 +00:00
Chris Dalton
117596bc8a [graphite] Add a fast SIMD Rect type
Implements a Rect type whose standard operations use float4. The intent
of this class is to make calculations on draw bounds as fast as
possible.

Change-Id: I3bdb219b242bb7097809507c345b613670ff386e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/457136
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2021-10-12 18:42:07 +00:00
Kevin Lubick
262dfbafb4 [experimental] Add WebGPU demo (built with Bazel)
This uses the Bazel rule wasm_cc_binary, which is defined
in @emsdk [1]

Note that wasm_cc_binary does not have a linkopts argument
defined, so we instead put any emcc options in the cc_binary
target.

This works around a few bugs in the emsdk Bazel rules:
 - https://github.com/emscripten-core/emsdk/issues/907
 - https://github.com/emscripten-core/emsdk/issues/807

Prior to PS 5, this CL tried a different way to bring in
the toolchain, a more manual way outlined in [2].

A similar approach (modifying the .bazelrc and specifying
the toolchain directly) might be necessary at some point,
but can probably still be done using the @emsdk Bazel rules
and --config=wasm.

To update the version of emscripten used, we just need to
update the parameter in the WORKSPACE call to emsdk_emscripten_deps().

The example/index.html file in this CL does exactly the same
as [3], except the WebGPU calls are made from C++ via WASM.
I made heavy use of these examples [4], [5] while exploring
APIs. What was also useful was looking at the emscripten
source headers [6], [7], [8], [9].

I also learned a lot about WebGPU from [10].

[1] 3891e7b04b/bazel/emscripten_toolchain/wasm_cc_binary.bzl
[2] https://hackernoon.com/c-to-webassembly-using-bazel-and-emscripten-4him3ymc
[3] 206c1f3f7e/demos.skia.org/demos/webgpu/index.html
[4] https://github.com/kainino0x/webgpu-cross-platform-demo
[5] https://github.com/Twinklebear/wgpu-cpp-starter
[6] 5e6c74153b/system/include/emscripten/html5_webgpu.h
[7] 5e6c74153b/system/include/webgpu/webgpu.h
[8] 5e6c74153b/system/include/webgpu/webgpu_cpp.h
[9] 5e6c74153b/src/library_html5_webgpu.js (L24)
[10] https://alain.xyz/blog/raw-webgpu

Change-Id: Iff33b72e7265200b2caacbc03e5fcc06a650b56b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/457396
Reviewed-by: Leandro Lovisolo <lovisolo@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2021-10-12 18:34:55 +00:00
Chris Dalton
676e082284 [graphite] Remove the skpu::geom namespace
Just having an skpu namespace should be enough.

Change-Id: I3026ece828aee7a57f8c5de2252ebc79d97baf7a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/458636
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2021-10-12 17:55:07 +00:00
Brian Salomon
87a0078b89 Support building on clang with -std=c++14 but no C++17 extension warning.
Classes of issues addressed:

1. static constexpr class variables aren't automatically inline. Already handled in a separate CL

2. Lack of C++17 copy elision means classes of objects constructed at function return need a copy or move constructor even if RVO will mean it isn't called.

3. Nested braced init no longer allowed for base classes of subclasses without constructors.

4. template static constexpr var in template class throws error about redundant initialization. Adding inline and removing defn outside of class fixes it.

5. Some places that should have been including std headers now actually need to include them.

6. No auto template parameters.

7. No lambdas in constexpr funcs.


Bug: chromium:1257145
Change-Id: Icb24c6b4ed039287fb4cf27a21a1bb7dc9821728
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/457298
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2021-10-12 16:34:30 +00:00
Kevin Lubick
f32ad08ac4 [infra] Deduplicate serve.py
Change-Id: I25bd987faedd7e9c322bcec487ab07583bad6b9a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/458197
Reviewed-by: Erik Rose <erikrose@google.com>
2021-10-12 11:42:50 +00:00
Brian Salomon
9fa47cc1c6 Make class members that are static constexpr also be inline.
This is in prep for compiling with -std=c++14 and -Wno-c++17-extensions
when building with clang. Chrome has encountered problems with
third_party headers that are included both in Skia and other Chrome
sources that produce different code based on whether preprocessor macros
indicate a C++14 or C++17 compilation.

In C++17 they are already inline implicitly. When compiling with C++14
we can get linker errors unless they're explicitly inlined or defined
outside the class. With -Wno-c++17-extensions we can explicitly inline
them in the C++14 build because the warning that would be generated
about using a C++17 language extension is suppressed.

We cannot do this in public headers because we support compiling with
C++14 without suppressing the C++17 language extension warnings.

Bug: chromium:1257145
Change-Id: Iaf5f4c62a398f98dd4ca9b7dfb86f2d5cab21d66
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/457498
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2021-10-11 16:22:59 +00:00
Robert Phillips
3062759ffd [graphite] Set up unit testing system
Bug: skia:12466
Change-Id: I401a185d818a964327d323b9ebcd0850ec0b1c9b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/457318
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-10-11 16:18:05 +00:00
Jim Van Verth
89457e9237 [graphite] Some clean up in CommandBuffer creation
Makes the Make() method consistent with other methods by passing in
Gpu, and adds hooks for command buffer tracking.

Bug: skia:12466
Change-Id: If93c2126b1296dcbf788b5471916051fe90dafdf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/457319
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2021-10-08 19:54:37 +00:00
Chris Dalton
1ab7ff6abf [graphite] Clean up bitwise operators for enum masks
* Rename TFlagsMask<> to Mask<>
* Make Mask<> implicitly convertible to bool
* Rename SKGPU_MAKE_BITFIELD_CLASS_OPS to SKGPU_MAKE_MASK_OPS
* Remove the macro for non-class enums

Change-Id: I86059335d731f34c9c9c20a4cd6d5491543aa3b1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/456816
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2021-10-08 00:32:54 +00:00
Greg Daniel
e47c5d16aa [graphite] Add TextureProxy support.
With this change it should now be safe to start using Proxys and Textures
everywhere. There is no caching the Proxys/Textures will live as long as
someone holds a ref.

Bug: skia:12466
Change-Id: I3c657b65b44b9dca0a77a255d6a4fc89e3862124
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/456916
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-10-07 14:56:25 +00:00
Michael Ludwig
2aff315093 [graphite] Add Shape variant over path, rect, rrect, convex poly
This is basically GrShape except that I removed some of the API that
GrStyledShape used. I also changed the set of types that Shape can
represent to be better match what I imagine our final set will be in
graphite: {empty,point,line,rect,rrect,path,arc}
       -> {empty,rect,rrect,path,convex-polygon}

The convex polygon is used to store points and lines as well. I also
imagine that it will subsume the need for migrating GrQuad over.

I'm doing this on its own in preparation for moving the ClipStack over
and consolidating the draw handling in Device/DrawList, all of which
get a lot easier if there is a single type that stores the geometry.

For the first milestone, actual rendering will still likely use
Shape::asPath() for the path renderer, but it's not a lot of extra work
to preserve the logical type at the high level, so may as well do that.

There are a few functions internal to Shape that still need to be
implemented (converting a path to a list of vertices, and doing point
containment), but those can come in a later CL.

Bug: skia:12466
Change-Id: I1040c54e3b8004f3bc1767d72ded60b572b39596
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/456257
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-10-07 13:48:25 +00:00
Jim Van Verth
1190301c3d [graphite] Add ResourceProvider to Gpu
Bug: skia:12466
Change-Id: I1224ad193bb9d866439673161075e29adedc0008
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/456475
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2021-10-06 19:48:41 +00:00
Jim Van Verth
daa3c703b0 [graphite] Hook up Pipeline creation.
Adds in test pipeline state object creation and shader compilation
routine.

Bug: skia:12466
Change-Id: Ie8d99078a2cebf1da37576e5a50a798fc79c295b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/456472
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2021-10-06 19:45:22 +00:00
Robert Phillips
47da0ac577 [graphite] Add stub classes for Recorder, Recording and TaskGraph
Bug: skia:12466
Change-Id: I730c227a78040ea8747d11437032504527b3ee81
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/456463
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-10-06 16:32:52 +00:00
Greg Daniel
fbc64be806 [graphite] Add Caps getters for default TextureInfos
Bug: skia:12466
Change-Id: I9165e5f49e4b897f4b315662221b944e362b7b41
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/456456
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
2021-10-06 15:11:29 +00:00
Greg Daniel
d4ca5e11a1 Add Texture creation to ResourceProvider.
The caller to ResourceProvider should be passing in the TextureInfo
they want. Thus we don't need all the specialized factores on
mtl::Texture.

Also removes UsageFlags from Texture which aren't needed.

Bug: skia:12466
Change-Id: Iad51a7da6efe481382a3f5fbaefc6d2504d1c013
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/456236
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2021-10-05 21:13:53 +00:00
Jim Van Verth
52d1629048 [graphite] Update minimum Metal SDK required
Bug: skia:12466
Change-Id: I97d8743057199abd88948f0804cceb4180ad8b74
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/455997
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
Auto-Submit: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2021-10-05 15:53:22 +00:00
Jim Van Verth
efdb1f0a3b [graphite] Add pipeline cache to ResourceProvider
Copied from GrMtlResourceProvider, and stripped down to the barest minimum.

Bug: skia:12466
Change-Id: I63cb52ee4bbc4c6ce5a1de16312bd4c69911d32c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/455619
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-10-05 14:34:22 +00:00
Michael Ludwig
65e848d6b5 Reland "[graphite] SurfaceDrawContext -> DrawContext"
This reverts commit 9602a4fad0.

Reason for revert: fixed var ref

Original change's description:
> Revert "[graphite] SurfaceDrawContext -> DrawContext"
>
> This reverts commit a525fd141b.
>
> Reason for revert: missed updating sdc->dc in one spot
>
> Original change's description:
> > [graphite] SurfaceDrawContext -> DrawContext
> >
> > Bug: skia:12466
> > Change-Id: If4a06bc0ab8befab8a155276c316ba9378b90a48
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/455658
> > Commit-Queue: Michael Ludwig <michaelludwig@google.com>
> > Reviewed-by: Robert Phillips <robertphillips@google.com>
>
> Bug: skia:12466
> Change-Id: I60e316225d44d7046bc82c80fe42345d8941f99e
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/455662
> Auto-Submit: Michael Ludwig <michaelludwig@google.com>
> Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>

Bug: skia:12466
Change-Id: I693b1e39fd65fe20cd5bb3f36bcc5f3da011c6b3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/455663
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-10-04 21:43:52 +00:00
Michael Ludwig
9602a4fad0 Revert "[graphite] SurfaceDrawContext -> DrawContext"
This reverts commit a525fd141b.

Reason for revert: missed updating sdc->dc in one spot

Original change's description:
> [graphite] SurfaceDrawContext -> DrawContext
>
> Bug: skia:12466
> Change-Id: If4a06bc0ab8befab8a155276c316ba9378b90a48
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/455658
> Commit-Queue: Michael Ludwig <michaelludwig@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>

Bug: skia:12466
Change-Id: I60e316225d44d7046bc82c80fe42345d8941f99e
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/455662
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2021-10-04 20:36:17 +00:00
Michael Ludwig
a525fd141b [graphite] SurfaceDrawContext -> DrawContext
Bug: skia:12466
Change-Id: If4a06bc0ab8befab8a155276c316ba9378b90a48
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/455658
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-10-04 19:51:53 +00:00
Greg Daniel
e20b3ec822 [graphite] Add remaining factories to MtlTexture.
Adds factory for SampledTextures and MSAA textures

Bug: skia:12466
Change-Id: Ia8aa7fa874e8256fe4dea8a16ceb459dbb02547d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/455618
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
2021-10-04 19:14:28 +00:00
Jim Van Verth
4008c5a3b0 [graphite] Fix creation of command buffer for different SDK/OS versions
Bug: skia:12466
Change-Id: I9828c59f0406e457e723f78940b1f42ff343fa2e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/455500
Auto-Submit: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2021-10-04 19:06:34 +00:00
Michael Ludwig
0dc6445a46 [graphite] Define SortKey as part of DrawPass impl
Every command that's in a DrawList will produce 1-3 SortKeys (depending
on its type of draw and the number of steps involved). For example a
large non-convex path fill requires a stencil draw for the curves, a
stencil draw of its inner triangles, and a covering draw for shading.

Since the SortKeys are only temporary and can be discarded once the
list has finished being converted into the DrawPass itself, they are
defined in the cpp file. However, I could see exposing them if only so
that the conceptual model is more apparent, since this is a key part
of the new approach in graphite.

Related to the details of the SortKey, the DrawList and SDC APIs have
been updated to reflect the differences in stencil-and-fill path
rendering that needs to be ordered based on both its color-depth
intersections and stencil buffer intersections, and convex filled
paths that don't require stenciling at all.

As a little cleanup, these parameters have been named something to
reflect their semantics even though they stay uint16_t's.

Bug: skia:12466
Change-Id: I02d6361f2889c0a6b341623131e4abda00a11145
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/455216
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2021-10-04 18:07:22 +00:00
Greg Daniel
c2a7ae5ade [graphite] Add support for Mtl Stencil/Depth Textures.
Bug: skia:12466
Change-Id: I38f3469c53414c36b05f3bdbc266b50783cfa676
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/455496
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2021-10-04 14:37:22 +00:00
Jim Van Verth
1f9be54238 [graphite] Add CommandBuffer creation
Bug: skia:12466
Change-Id: I3a22d03e5042a94f2bf6d379b2fff17f0b48edb3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/455217
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2021-10-04 14:04:54 +00:00
John Stiles
1972b46ca8 Rewrite #includes to satisfy presubmit.
For reasons I don't understand, rewrite-includes suddenly started
detecting these experimental files as needing their includes rewritten.

Change-Id: Ie62e8861169dfb988840e74976248992633874e2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/455160
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2021-10-01 18:31:26 +00:00
Greg Daniel
8e29caf4c1 [graphite] Add support for UsageFlags on Texture.
Bug: skia:12466
Change-Id: Iee62164899742356abf15ae3bc3dec0e724a365d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/454743
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2021-10-01 16:34:54 +00:00
Greg Daniel
f69f21e601 Add MtlTexture class.
Bug: skia:12466
Change-Id: I6207af8bb34ccab28265ced733e1930f42e2db8b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/454776
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2021-09-30 18:24:48 +00:00
Robert Phillips
091694fe16 [graphite] Add ContextFactory
Bug: skia:12466
Change-Id: I3299940af72cffde3904cf5f6262955807d6d1bc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/453637
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-09-30 18:04:54 +00:00
Greg Daniel
b2d20e02e7 [graphite] Add basic Texture files.
Bug: skia:12466
Change-Id: If708d8a4bd00802e60a860215edcb64db179e573
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/454616
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
2021-09-30 15:29:50 +00:00
Jim Van Verth
0f833ca8ae [graphite] Add Metal trampoline.
Adds the interface between C++ and Objective-C code so we can create
the Gpu.

Bug: skia:12466
Change-Id: I0c4b5d21ddaa119c21682105dc84d75769f069f6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/453952
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2021-09-29 22:12:20 +00:00
Robert Phillips
d034db791d [graphite] Add GraphiteTestContext
Bug: skia:12466
Change-Id: I90ebec9ee744de3822bd82d474858015d2490d72
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/453636
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
2021-09-29 19:09:48 +00:00
Michael Ludwig
6abafd681e [graphite] fix assert in Device ctor
Bug: skia:12466
Change-Id: Ida0113701b7ba2b45b5bddcc76d2729c8658fb14
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/453948
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-09-29 18:24:20 +00:00
Jim Van Verth
b6b6ecf04e [graphite] Address nits from https://review.skia.org/453796
Bug: skia:12466
Change-Id: Ibe9f09c3801ca22a9b390b0e7a7623a6b73da162
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/453944
Auto-Submit: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2021-09-29 18:18:18 +00:00
Greg Daniel
d73cff0e2d [graphite] Add TextureInfo class.
Also adds the Mtl subclass as well

Bug: skia:12466
Change-Id: Ia3a81f33a00374a96765fde3a3442c5e13188ad1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/453719
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-09-29 16:31:27 +00:00
Jim Van Verth
8c7467c440 [graphite] Flesh out more of Metal Caps.
Allocates and initializes the caps with GpuFamily and Group info.

Bug: skia:12466
Change-Id: I7abb8b6df2acf2ac70f3fbe56e935f44815776dd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/453796
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2021-09-29 14:55:57 +00:00
Robert Phillips
e19164d9f4 [graphite] Move some basic include/gpu files over to Graphite
This is mainly to make make MtlBackendContext available.

GrTypes has to go to GraphiteTypes due to a name collision with Types.h in in sktext.

Bug: skia:12466
Change-Id: If073d5540c3dbf3fbfb404808d80deab42c40aa6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/453497
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
2021-09-28 21:11:25 +00:00
Michael Ludwig
949aebff35 [graphite] Fix build for DrawPass
Bug: skia:12466
Change-Id: I2ba1f1541c273ba90032c93a92ed3770dc5b0080
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/453756
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
2021-09-28 20:38:18 +00:00
Michael Ludwig
4a19f2c52e [graphite] Define DrawPass for SDC
Updates SDC's state to be a current DL and a list of pending passes,
RenderPassTask then takes over the DrawPasses.

Does not rename SDC to DrawContext as discussed in 9/27 meeting.

Bug: skia:12466
Change-Id: I358d15bc93663729438e5b6f7163eee22dc6769f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/453296
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
2021-09-28 17:46:53 +00:00
Jim Van Verth
47b6286e6e [graphite] Stub in more Metal classes
Bug: skia:12466
Change-Id: I83ebf7dbea0d67b3c121b011f62e7b729f5e5257
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/453577
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2021-09-28 17:46:28 +00:00
Chris Dalton
aaa81ab61e Specify DrawList as using a z test of "GREATER"
A test of GREATER, as opposed to GEQUAL, allows us to avoid double
blends during stroking.

Change-Id: I1d39b54416934ee354146fe42c58299f00f7a6e9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/453616
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2021-09-28 17:39:20 +00:00
Jim Van Verth
2045b981fb Graphite: Add stubs for Pipeline and PipelineDesc
Bug: skia:12466
Change-Id: Ie949a17166b3ab5c529b74a6762c8a6f8ca8052f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/453061
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2021-09-28 11:28:19 +00:00
Herb Derby
d9c17b4051 trunc bilerp 3.8% error rate
Change-Id: I79d240c84263af3d90347d366320799f93dc8b23
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/449179
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2021-09-27 20:31:20 +00:00
Julia Lavrova
282d5a051a Font resolution just started
Simple and incorrect font resoultion (based on CMAP only)

Change-Id: I1a0926f00c524b0e11659024ea5be6d9d0227523
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/449807
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2021-09-27 16:25:50 +00:00
Michael Ludwig
aeb5d4daed [graphite] Flesh out Device/SDC a bit more
Renames SDCTask -> RenderPassTask and adds comments describing its
purpose. Has SDC use a DrawList and expose similar drawing functions.
Stubs out all Device methods that will eventually need to be supported,
but groups them into in-scope and out-of-scope sections. Implements the
drawing functions in terms of drawPath() and has drawPath() invoke the
SDC functions (with untested support for path effects, hairline, etc.).

Bug: skia:12466
Change-Id: Id661fc987aeb35f0dfa536c0cb0b6210742cf32c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/452233
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-09-25 17:51:42 +00:00
Jim Van Verth
ff733b3f39 Graphite: add MtlGpu.
Bug: skia:12466
Change-Id: I51dc73a213e672578767b41c01c487c942465964
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/452722
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-09-25 00:51:15 +00:00
Jim Van Verth
8b85d7b429 Graphite: add ResourceProvider and CommandBuffer stubs
Bug: skia:12466
Change-Id: I30b53802d706406faf8045264c09a75ee3bf9126
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/452232
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-09-24 20:30:16 +00:00
Jim Van Verth
1e90b88e45 Graphite: Add stubs for Gpu and Caps
Bug: skia:12466
Change-Id: I1267d3a387e74dc510ee4d00925049a4e7ac9edd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/452557
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2021-09-24 16:19:43 +00:00
Robert Phillips
d6bf374c3c Graphite: Improve DM/Graphite connection
This makes "dm --config grgl --src gm skp" generate a lot of green pngs and adds a stub class for Image_Graphite.

Bug: skia:12466
Change-Id: Ia7cf891ad278434f473cf6c9c4673bf8fa085adf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/451740
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2021-09-22 21:34:09 +00:00
Michael Ludwig
01754ecf12 Graphite: Rough out DrawCommandList and BoundsManager
Device will own and manage a BoundsManager, which it will use to decide
the sort and test Z's that it passes to the DrawCommandList in its
draw() implementations.

DrawCommandList might end up being owned by the SDC, with the SDC
exposing a similar drawing API. There will need to be some mechanism to
end a DrawCommandList and start a new one (the list moves into an
SDCTask). This would either happen from an external flush call, or in
the rare case where the representable Z values are exhausted and we
have to insert a depth buffer clear and start a new task that depends
on the prior one.

Bug: skia:12466
Change-Id: I892b631037dc801eb94da2462683c9701afa281b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/451599
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-09-22 19:36:49 +00:00
Robert Phillips
5a6f1606cc Add more stub classes
Bug: skia:12466
Change-Id: Iaa8431bf6fbe20c30b34a90a5a55f6f89723aa30
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/451257
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-09-22 15:59:54 +00:00
Robert Phillips
f15c3ff9d3 Add SkSurface_Graphite stub
and fix up the #include guards

Bug: skia:12466
Change-Id: I865ebb00827001b2cf0f7d871e872a7be0f36c22
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/451156
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2021-09-21 20:28:40 +00:00
Julia Lavrova
9f6e4632f8 Fixing all clang errors...
Change-Id: If448c339c16359b53c31f181d3e3938ffbe30cef
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/450037
Reviewed-by: Jorge Betancourt <jmbetancourt@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2021-09-21 17:25:18 +00:00
Robert Phillips
755e00edec Update sprint to graphite name
Change-Id: Ice0826af0b64fa8dd92975f879af8ab0f71740fc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/451039
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-09-21 16:44:10 +00:00
Robert Phillips
1a4080add1 More beachhead
This should at least get something compiling.

Change-Id: I617fd4d6e4f0a3fdd6dedbe66f3a4448bb913b2c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/450976
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-09-21 14:44:32 +00:00
Robert Phillips
fab00952d3 Establish beachhead
Change-Id: Ib585bf93da5386c353c66baeb00027d31bdbec8f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/450480
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2021-09-20 22:03:07 +00:00
Julia Lavrova
40e5f545b2 Yet one more warning as an error coming from Android build
Change-Id: I64338cc3a8d5cb289a4bd730ca2372a8f2636cea
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/449850
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2021-09-17 18:31:17 +00:00
Julia Lavrova
d99e4f5b01 Fixing Android build bug
Change-Id: I9c38e47a009a480a9f4883076d118b4a892a431b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/449808
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2021-09-17 15:01:11 +00:00
John Stiles
2844d3d479 Fix redefined-macro warning on non-UNIX platforms.
Change-Id: Ib22d104212f5b728938a87baae43c4a0884bf6ff
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/449358
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Julia Lavrova <jlavrova@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-09-16 13:25:52 +00:00
Julia Lavrova
9d0d426028 Reland "The very first version of a new SkText API."
This reverts commit efb7ae16dd.

Reason for revert: Excluding all non-linux tests

Original change's description:
> Revert "The very first version of a new SkText API."
>
> This reverts commit 8a20cea604.
>
> Reason for revert: Breaking some tests
>
> Original change's description:
> > The very first version of a new SkText API.
> >
> > SkText public API added.
> > Interface.h updated.
> >
> > Change-Id: I82a87f33e6cf1394fa2520387f6895d33601376e
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/442003
> > Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> > Commit-Queue: Julia Lavrova <jlavrova@google.com>
>
> Change-Id: I879b198bc6fb44c46d11d967118f8d69eb74fee0
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/449296
> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> Reviewed-by: John Stiles <johnstiles@google.com>
> Commit-Queue: Julia Lavrova <jlavrova@google.com>

Change-Id: Ieb65b45532d8c7455f091cf7a9e21fa7dea47606
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/449297
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2021-09-15 21:39:56 +00:00
Julia Lavrova
efb7ae16dd Revert "The very first version of a new SkText API."
This reverts commit 8a20cea604.

Reason for revert: Breaking some tests

Original change's description:
> The very first version of a new SkText API.
>
> SkText public API added.
> Interface.h updated.
>
> Change-Id: I82a87f33e6cf1394fa2520387f6895d33601376e
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/442003
> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> Commit-Queue: Julia Lavrova <jlavrova@google.com>

Change-Id: I879b198bc6fb44c46d11d967118f8d69eb74fee0
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/449296
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2021-09-15 19:56:13 +00:00
Julia Lavrova
8a20cea604 The very first version of a new SkText API.
SkText public API added.
Interface.h updated.

Change-Id: I82a87f33e6cf1394fa2520387f6895d33601376e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/442003
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2021-09-15 17:57:50 +00:00
Julia Lavrova
398ef4487b Reland "Reland "Small changes for SkText that are not in experimental directory""
This reverts commit b51994990b.

Reason for revert: Fixed the test

Original change's description:
> Revert "Reland "Small changes for SkText that are not in experimental directory""
>
> This reverts commit ce32c8a074.
>
> Reason for revert: Skottie test is broken
>
> Original change's description:
> > Reland "Small changes for SkText that are not in experimental directory"
> >
> > This reverts commit 481a58dfe0.
> >
> > Reason for revert: Fixing the build
> >
> > Original change's description:
> > > Revert "Small changes for SkText that are not in experimental directory"
> > >
> > > This reverts commit 92f1bc0083.
> > >
> > > Reason for revert: Blocking Android roll.
> > >
> > > Original change's description:
> > > > Small changes for SkText that are not in experimental directory
> > > >
> > > > (also made utf 8<->16 conversion static on SkUnicode)
> > > >
> > > > Change-Id: Ie64d18ad21a35ec10bd0b350fb7887fb78a419d8
> > > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/448140
> > > > Reviewed-by: Mike Reed <reed@google.com>
> > > > Commit-Queue: Julia Lavrova <jlavrova@google.com>
> > >
> > > Change-Id: Ieb9eb0495dddfc0f9e9e74861b24efc0201fd520
> > > No-Presubmit: true
> > > No-Tree-Checks: true
> > > No-Try: true
> > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/448656
> > > Auto-Submit: Brian Osman <brianosman@google.com>
> > > Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> > > Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> >
> > Change-Id: I1e5859c9dd943c701d4c4e648bdc3e44412eca54
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/448676
> > Reviewed-by: Brian Osman <brianosman@google.com>
> > Commit-Queue: Julia Lavrova <jlavrova@google.com>
>
> Change-Id: Ib8e5ec05a5555f34106a0ee61878a8199b82bb82
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/448897
> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> Reviewed-by: Florin Malita <fmalita@google.com>
> Commit-Queue: Julia Lavrova <jlavrova@google.com>

Change-Id: I3bc103c0e1c495342a6673e80765b5f26862e8dc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/448898
Reviewed-by: Florin Malita <fmalita@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2021-09-15 15:31:14 +00:00
Julia Lavrova
b51994990b Revert "Reland "Small changes for SkText that are not in experimental directory""
This reverts commit ce32c8a074.

Reason for revert: Skottie test is broken

Original change's description:
> Reland "Small changes for SkText that are not in experimental directory"
>
> This reverts commit 481a58dfe0.
>
> Reason for revert: Fixing the build
>
> Original change's description:
> > Revert "Small changes for SkText that are not in experimental directory"
> >
> > This reverts commit 92f1bc0083.
> >
> > Reason for revert: Blocking Android roll.
> >
> > Original change's description:
> > > Small changes for SkText that are not in experimental directory
> > >
> > > (also made utf 8<->16 conversion static on SkUnicode)
> > >
> > > Change-Id: Ie64d18ad21a35ec10bd0b350fb7887fb78a419d8
> > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/448140
> > > Reviewed-by: Mike Reed <reed@google.com>
> > > Commit-Queue: Julia Lavrova <jlavrova@google.com>
> >
> > Change-Id: Ieb9eb0495dddfc0f9e9e74861b24efc0201fd520
> > No-Presubmit: true
> > No-Tree-Checks: true
> > No-Try: true
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/448656
> > Auto-Submit: Brian Osman <brianosman@google.com>
> > Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> > Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
>
> Change-Id: I1e5859c9dd943c701d4c4e648bdc3e44412eca54
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/448676
> Reviewed-by: Brian Osman <brianosman@google.com>
> Commit-Queue: Julia Lavrova <jlavrova@google.com>

Change-Id: Ib8e5ec05a5555f34106a0ee61878a8199b82bb82
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/448897
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Florin Malita <fmalita@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2021-09-14 20:32:02 +00:00
Julia Lavrova
ce32c8a074 Reland "Small changes for SkText that are not in experimental directory"
This reverts commit 481a58dfe0.

Reason for revert: Fixing the build

Original change's description:
> Revert "Small changes for SkText that are not in experimental directory"
>
> This reverts commit 92f1bc0083.
>
> Reason for revert: Blocking Android roll.
>
> Original change's description:
> > Small changes for SkText that are not in experimental directory
> >
> > (also made utf 8<->16 conversion static on SkUnicode)
> >
> > Change-Id: Ie64d18ad21a35ec10bd0b350fb7887fb78a419d8
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/448140
> > Reviewed-by: Mike Reed <reed@google.com>
> > Commit-Queue: Julia Lavrova <jlavrova@google.com>
>
> Change-Id: Ieb9eb0495dddfc0f9e9e74861b24efc0201fd520
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/448656
> Auto-Submit: Brian Osman <brianosman@google.com>
> Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>

Change-Id: I1e5859c9dd943c701d4c4e648bdc3e44412eca54
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/448676
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2021-09-14 14:30:22 +00:00
Brian Osman
481a58dfe0 Revert "Small changes for SkText that are not in experimental directory"
This reverts commit 92f1bc0083.

Reason for revert: Blocking Android roll.

Original change's description:
> Small changes for SkText that are not in experimental directory
>
> (also made utf 8<->16 conversion static on SkUnicode)
>
> Change-Id: Ie64d18ad21a35ec10bd0b350fb7887fb78a419d8
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/448140
> Reviewed-by: Mike Reed <reed@google.com>
> Commit-Queue: Julia Lavrova <jlavrova@google.com>

Change-Id: Ieb9eb0495dddfc0f9e9e74861b24efc0201fd520
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/448656
Auto-Submit: Brian Osman <brianosman@google.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2021-09-14 13:27:19 +00:00
Herb Derby
85dde4e315 add benchmarks for bilerp study
Change-Id: I6e69a902cc660154b56a82cae727751ec6f5e806
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/448273
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2021-09-13 21:14:18 +00:00
Julia Lavrova
92f1bc0083 Small changes for SkText that are not in experimental directory
(also made utf 8<->16 conversion static on SkUnicode)

Change-Id: Ie64d18ad21a35ec10bd0b350fb7887fb78a419d8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/448140
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2021-09-13 18:22:33 +00:00
Herb Derby
ec7b63a745 add baseline integer lerp
Add a lerp that uses full 32-bit resolution for the multiply.
This gives the same answers as the floating point, and
demonstrates the error introduced by using the faster
16-bit multiply.

Change-Id: I90c46b350fae09f74d9c9cf2af7ef3d3d1d0f202
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/448102
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2021-09-13 14:49:09 +00:00
Herb Derby
2505b2ca46 use higher res to check [-1, 1)
Because the [-1, 1) lerp can handle a higher sampling rate in t,
decrease the t step to ensure everything is covered. The
limit needs to be trimmed by a 1/65536 to allow the older lerps
to run properly.

Remove the scaled test cases. They no longer make sense.
Change-Id: Ida841d65ebe794ba5d0ae67dfb145268764ec6a2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/448101
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2021-09-13 14:13:25 +00:00
Herb Derby
fe678d9b1c change of parameter from [0, 1) to [-1, 1) for better lerp
Using the extra bit improves the difference rate from .38% to .19%.
I think this uses the full resolution of all the values, and there
is no more accuracy by trying to get more bits in use. The maximum
difference is still 1.

This gives the same answer with the neon_vqrdmulhq_s16 and
ssse3_mm_mulhrs_epi16 instructions.

Change-Id: Ie801b68aead408c5e1845aaf94ea660121e414b9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/447719
Reviewed-by: Brian Osman <brianosman@google.com>
2021-09-13 13:32:03 +00:00
Herb Derby
2b868d6b9a math and error rates for lerp
Study that compares scaled integer lerp to float lerp. This
shows an error rate of 0.38% with a max difference of 1.

Study to compare scaled values the would result as the
intermediate values of a bilerp. This shows an error rate
of 24% with a max difference of 1.

Change-Id: Id27b6baa9ce56efedb30f490a3f84ccf808315fa
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/447183
Reviewed-by: Brian Osman <brianosman@google.com>
2021-09-10 18:51:51 +00:00
Herb Derby
10d153ee21 improve quality of life
Change-Id: I75e93820bd1df57d076560f1b2991f1756ca5389
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/446996
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2021-09-09 17:23:57 +00:00
Herb Derby
0f2d2f0efd implement ARM saturating multiply using ssse3
Change-Id: I530373e9b53e76a7cd1c0b3a5a1b05354975790c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/446186
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2021-09-08 00:32:55 +00:00
Herb Derby
535f43d734 add simulation for arm rounding saturating multiply
Change-Id: I31dd90b2f09876d37c2c202d620cef4028af6266
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/446183
Reviewed-by: Herb Derby <herb@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2021-09-07 21:15:04 +00:00
Herb Derby
887230a36a basic experiments for understanding lowp
Change-Id: I5f0c36b44cd5bfd3f978d892a342a1d008baceb2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/446176
Reviewed-by: Herb Derby <herb@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2021-09-07 20:08:50 +00:00
Michael Ludwig
ebb451d730 Reland "Simplify SkRasterClip now that it's only intersect/diff"
This reverts commit 9a0302cd9d.

Reason for revert: layout tests suppressed

Original change's description:
> Revert "Simplify SkRasterClip now that it's only intersect/diff"
>
> This reverts commit 75bab9249d.
>
> Reason for revert: Experiment to see if blocking Chrome roll
>
> Original change's description:
> > Simplify SkRasterClip now that it's only intersect/diff
> >
> > Bug: skia:10205
> > Change-Id: Id29a63783bd38e5977e94bf8e8d7fbb4fe16cb51
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/442279
> > Reviewed-by: Mike Reed <reed@google.com>
> > Commit-Queue: Michael Ludwig <michaelludwig@google.com>
>
> TBR=reed@google.com,michaelludwig@google.com,skcq-be@skia-corp.google.com.iam.gserviceaccount.com
>
> Change-Id: I1ceeccf880a139dc9236b7df17e3599f8cae611f
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:10205
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/443414
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Commit-Queue: Robert Phillips <robertphillips@google.com>

# Not skipping CQ checks because this is a reland.

Bug: skia:10205
Change-Id: I13a49190c67e5e32431ea268312ede60c55798b2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/443897
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2021-08-31 18:16:31 +00:00
Kevin Lubick
29104528cc [infra] Port serve.py from Python2 to 3
These scripts are useful when testing WebAssembly locally
because the mimetype impacts how the binaries are loaded.

The porting was achieved by doing the following:
python -m lib2to3 -w -n serve.py


Change-Id: I09673fa881339a9b157c5fc993e190766efcd85e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/443884
Reviewed-by: Erik Rose <erikrose@google.com>
2021-08-31 15:28:19 +00:00
Robert Phillips
9a0302cd9d Revert "Simplify SkRasterClip now that it's only intersect/diff"
This reverts commit 75bab9249d.

Reason for revert: Experiment to see if blocking Chrome roll

Original change's description:
> Simplify SkRasterClip now that it's only intersect/diff
>
> Bug: skia:10205
> Change-Id: Id29a63783bd38e5977e94bf8e8d7fbb4fe16cb51
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/442279
> Reviewed-by: Mike Reed <reed@google.com>
> Commit-Queue: Michael Ludwig <michaelludwig@google.com>

TBR=reed@google.com,michaelludwig@google.com,skcq-be@skia-corp.google.com.iam.gserviceaccount.com

Change-Id: I1ceeccf880a139dc9236b7df17e3599f8cae611f
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:10205
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/443414
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-08-31 00:11:53 +00:00
Michael Ludwig
75bab9249d Simplify SkRasterClip now that it's only intersect/diff
Bug: skia:10205
Change-Id: Id29a63783bd38e5977e94bf8e8d7fbb4fe16cb51
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/442279
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2021-08-30 20:39:43 +00:00
Jorge Betancourt
c1727fc217 [JetSki] pass SkPaint into experimental SkText drawText calls
tests currently through jetski demo

Change-Id: I0847e98579b62104e5d9ddaa7ca008f5a75be5c7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/441427
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Jorge Betancourt <jmbetancourt@google.com>
2021-08-26 13:01:51 +00:00
Julia Lavrova
f8e69ca744 SkText: refactoring, also a bug fix
Bug: skia:12355
Also, tofu on \n fixed

Change-Id: I2b1b79eaade5c631f8a88da7dbf155b721eaa401
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/440157
Reviewed-by: Julia Lavrova <jlavrova@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2021-08-19 16:55:27 +00:00
Julia Lavrova
c87e9516c3 SkText: refactoring in process
Change-Id: Iac594eeba2e15549a6b2cea2489cf123f7440c79
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/438700
Reviewed-by: Julia Lavrova <jlavrova@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2021-08-17 14:57:15 +00:00
Julia Lavrova
8343e003ca SkText: implement select via styles
Change-Id: I047f7fc4027572892433d759f4098f5da9da4662
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/438657
Reviewed-by: Julia Lavrova <jlavrova@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2021-08-11 19:49:35 +00:00
Julia Lavrova
ad5944cf8d Refactoring Text Editor (in progress)
Insert/Delete/Backspace
Status line

Change-Id: I38727ddb86bf20cdd6c64363c33ffda03ab3c2c7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/431179
Reviewed-by: Julia Lavrova <jlavrova@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2021-08-09 15:06:56 +00:00
Brian Salomon
caa760e214 Fix -Wdeprecated-copy warnings
clang-14 has a new warning for deprecated implicit copy/assignment
if the other is written.

https://clang.llvm.org/docs/DiagnosticsReference.html#wdeprecated-copy

Change-Id: Iaeb23b2470ffa0be1953d1aed31bf0423c589893
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/435880
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2021-08-03 16:06:11 +00:00
Florin Malita
40f3db41af Reland "Experimental ICU runtime linking"
This is a reland of f4aab0584d

Original change's description:
> Experimental ICU runtime linking
>
> Introduce a build config option where ICU symbols are resolved at
> runtime, against existing system libs.
>
> Change-Id: I2325537438de0063fcc4a7c0f8411764cf550f09
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/431037
> Commit-Queue: Florin Malita <fmalita@chromium.org>
> Commit-Queue: Florin Malita <fmalita@google.com>
> Reviewed-by: Ben Wagner <bungeman@google.com>

Change-Id: I6f67a5eb842743d2486ccc4519e2d8cb9fac3458
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/433277
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Florin Malita <fmalita@google.com>
2021-07-27 19:51:31 +00:00
Florin Malita
6cce9615a0 Revert "Experimental ICU runtime linking"
This reverts commit f4aab0584d.

Reason for revert: build failures

Original change's description:
> Experimental ICU runtime linking
>
> Introduce a build config option where ICU symbols are resolved at
> runtime, against existing system libs.
>
> Change-Id: I2325537438de0063fcc4a7c0f8411764cf550f09
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/431037
> Commit-Queue: Florin Malita <fmalita@chromium.org>
> Commit-Queue: Florin Malita <fmalita@google.com>
> Reviewed-by: Ben Wagner <bungeman@google.com>

TBR=djsollen@google.com,bungeman@google.com,fmalita@chromium.org,fmalita@google.com,jlavrova@google.com,skcq-be@skia-corp.google.com.iam.gserviceaccount.com

Change-Id: Ic252af1d7ba0a72b3c596e61f86746c27a0685b7
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/433276
Reviewed-by: Florin Malita <fmalita@google.com>
Commit-Queue: Florin Malita <fmalita@google.com>
2021-07-27 12:13:39 +00:00
Florin Malita
f4aab0584d Experimental ICU runtime linking
Introduce a build config option where ICU symbols are resolved at
runtime, against existing system libs.

Change-Id: I2325537438de0063fcc4a7c0f8411764cf550f09
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/431037
Commit-Queue: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2021-07-26 21:18:17 +00:00
Julia Lavrova
c5c9dd86b0 Text Editor based on SkText: delete and backspace
Change-Id: I1152f83af724634f06e1a767ef39bef2afe70b33
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/430656
Reviewed-by: Julia Lavrova <jlavrova@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2021-07-21 13:45:06 +00:00
Julia Lavrova
d37bb6ae72 TextEditor: select a grapheme on a double click
Change-Id: Ibb322fdd6258e42650bfc90af502a9f53ad03abb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/430219
Reviewed-by: Julia Lavrova <jlavrova@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2021-07-20 13:42:17 +00:00
Robert Phillips
4d45e09202 Rename experimental app to 'sorttoy'
Bug: skia:11837
Change-Id: Id111281d0ec9ab0ebf93b9352a64eef9574bfcb0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/424040
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-07-01 19:11:26 +00:00
Robert Phillips
024668cf7f Rename gn options to skgpu_v1 and skgpu_v2
Bug: skia:11837
Change-Id: Ie9221d2cd8e42bebb6a8a9a8ef51ba4a488ce6ca
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/424036
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-07-01 17:09:33 +00:00
John Stiles
7bf799956d Reland "Add format-specifier warnings to SkDebugf."
This is a reland of e58831cd95

Original change's description:
> Add format-specifier warnings to SkDebugf.
>
> This CL fixes up many existing format-specifier violations in Skia.
> Note that GCC has a warning for formatting nothing, so existing calls to
> `SkDebugf("")` have been removed, or replaced with `SkDebugf("%s", "")`.
> These were apparently meant to be used as a place to set a breakpoint.
>
> Some of our clients also use SkDebug with bad format specifiers, so this
> check is currently only enabled when SKIA_IMPLEMENTATION is true.
>
> Change-Id: I8177a1298a624c6936adc24e0d8f481362a356d0
> Bug: skia:12143
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/420902
> Auto-Submit: John Stiles <johnstiles@google.com>
> Commit-Queue: Brian Osman <brianosman@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>

Bug: skia:12143
Change-Id: Id3c0c21436ebd13899908d5ed5d44c42a0e23921
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/421918
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-06-25 17:57:43 +00:00
Tyler Denniston
283dba5785 Revert "Add format-specifier warnings to SkDebugf."
This reverts commit e58831cd95.

Reason for revert: looks like breaking a few build bots

Original change's description:
> Add format-specifier warnings to SkDebugf.
>
> This CL fixes up many existing format-specifier violations in Skia.
> Note that GCC has a warning for formatting nothing, so existing calls to
> `SkDebugf("")` have been removed, or replaced with `SkDebugf("%s", "")`.
> These were apparently meant to be used as a place to set a breakpoint.
>
> Some of our clients also use SkDebug with bad format specifiers, so this
> check is currently only enabled when SKIA_IMPLEMENTATION is true.
>
> Change-Id: I8177a1298a624c6936adc24e0d8f481362a356d0
> Bug: skia:12143
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/420902
> Auto-Submit: John Stiles <johnstiles@google.com>
> Commit-Queue: Brian Osman <brianosman@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>

TBR=brianosman@google.com,ethannicholas@google.com,johnstiles@google.com

Change-Id: I07848c1bf8992925c9498e916744d0840355a077
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:12143
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/421917
Reviewed-by: Tyler Denniston <tdenniston@google.com>
Commit-Queue: Tyler Denniston <tdenniston@google.com>
2021-06-25 13:33:10 +00:00
John Stiles
e58831cd95 Add format-specifier warnings to SkDebugf.
This CL fixes up many existing format-specifier violations in Skia.
Note that GCC has a warning for formatting nothing, so existing calls to
`SkDebugf("")` have been removed, or replaced with `SkDebugf("%s", "")`.
These were apparently meant to be used as a place to set a breakpoint.

Some of our clients also use SkDebug with bad format specifiers, so this
check is currently only enabled when SKIA_IMPLEMENTATION is true.

Change-Id: I8177a1298a624c6936adc24e0d8f481362a356d0
Bug: skia:12143
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/420902
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-06-25 11:05:59 +00:00
Robert Phillips
c29810e882 [ngatoy] add ovals
Adding ovals reveals the clipping failure. The "actual" results with the
oval clips are currently incorrect.

Bug: skia:11837
Change-Id: I0789d5f758457425250ff6cecc0a5bb44f6e82ef
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/420637
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2021-06-23 14:06:05 +00:00
Robert Phillips
343588ddf0 [ngatoy] Remove duplicate rects array from ClipCmd
Bug: skia:11837
Change-Id: I76e1cfdf7d2f7ca649612c8155571425684cf2d0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/420236
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2021-06-22 18:13:15 +00:00
Robert Phillips
050a14ec4a [ngatoy] Record painter's order when clips are popped off the stack
Bug: skia:11837
Change-Id: I07c7b3e3b55be8b0340a012e965bd23b92d27e1d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/420218
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2021-06-22 17:45:15 +00:00
Chris Dalton
685e09b31a Reland "Purge ccpr"
This is a reland of 7bf6bc0d06

Original change's description:
> Purge ccpr
>
> Now that the clip atlas has been successfully migrated to
> tessellation, we don't need this code anymore!
>
> Change-Id: Ic97f50cff7c4ee59f4476f8410f0b30a32df4e90
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/419857
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>
> Commit-Queue: Chris Dalton <csmartdalton@google.com>

Change-Id: If0be86902e7cc4755eba91a89be1ec1a6a4b54b2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/419720
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2021-06-19 18:42:38 +00:00
Brian Osman
fe83ab6706 Revert "Purge ccpr"
This reverts commit 7bf6bc0d06.

Reason for revert: Android build references kCoverageCounting

Original change's description:
> Purge ccpr
>
> Now that the clip atlas has been successfully migrated to
> tessellation, we don't need this code anymore!
>
> Change-Id: Ic97f50cff7c4ee59f4476f8410f0b30a32df4e90
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/419857
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>
> Commit-Queue: Chris Dalton <csmartdalton@google.com>

TBR=robertphillips@google.com,brianosman@google.com,csmartdalton@google.com,michaelludwig@google.com

Change-Id: I01d99287978f848eb8bf900c07cba90ceb3b6edc
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/419898
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-06-19 15:13:19 +00:00
Chris Dalton
7bf6bc0d06 Purge ccpr
Now that the clip atlas has been successfully migrated to
tessellation, we don't need this code anymore!

Change-Id: Ic97f50cff7c4ee59f4476f8410f0b30a32df4e90
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/419857
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2021-06-18 21:46:36 +00:00
Robert Phillips
c3889e8f94 [ngatoy] Fix memory leaks
Bug: skia:11837
Change-Id: Icd80503b16776e821ae2a5491b554eea7094cd9a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/419362
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2021-06-18 12:10:29 +00:00
Robert Phillips
7c4aa813d3 [ngatoy] Remove old clipping system
Bug: skia:11837
Change-Id: I9f338279ce2648c788c4eb011639ac6d27c946ac
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/418696
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-06-17 20:28:53 +00:00
Kevin Lubick
be03ef1565 Remove ableist language
Change-Id: Ie9ef50a14906c9350adbe16720291dca944ad7fc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/418738
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Reviewed-by: Jorge Betancourt <jmbetancourt@google.com>
2021-06-16 21:37:21 +00:00
Robert Phillips
a5dde76252 [ngatoy] Add Save, Restore, and Clip Cmds
In this iteration none of these commands appear in the sorted Cmds (and
the Save and Restore Cmds never will) but it sets things up for ClipCmds
being sorted.

Bug: skia:11837
Change-Id: Ia8be433cb01215c55a8b61de2ec24f5c456a0b10
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/417416
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-06-15 13:00:22 +00:00
Julia Lavrova
1888466d6b Breaking lines by words, not by graphemes
Change-Id: I3729aa19c47265b5441a542d9e6193c73e910a22
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/417557
Reviewed-by: Julia Lavrova <jlavrova@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2021-06-10 21:40:34 +00:00
Julia Lavrova
ecc8e3bc04 CPP Text Editor
The very first version:
1. Moves cursort up, down, left, right by grapheme/glyph clusters
2. Breaks lines by grapheme/glyph cluster
3. Just started!

Change-Id: Ib2881794ff33af9e428828f3a9e2d3b54946fa8f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/417476
Commit-Queue: Julia Lavrova <jlavrova@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2021-06-10 19:15:04 +00:00
Robert Phillips
fdad22960e [ngatoy] Strictly differentiate between painter's order and the sort/draw Zs
Bug: skia:11837
Change-Id: I038aee81e41201668f891df9d589459553b757b2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/417259
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2021-06-10 12:37:39 +00:00
Robert Phillips
1f6ca3a950 [ngatoy] Make an explicit ID class and simplify Cmd class
Bug: skia:11837
Change-Id: I44b8f02555c1ed7e2f1bf0872bf41f78d1eb5d25
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/417003
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-06-10 12:32:20 +00:00
Robert Phillips
a4041a7d83 [ngatoy] Delegate creation of the sort key to the individual Cmds
Bug: skia:11837
Change-Id: I4fa19c46b38659d160de92de90e80a23ee8e5fcc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/415461
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-06-04 14:53:03 +00:00
Robert Phillips
4df7943d16 [ngatoy] Make RectCmd store a fake paint
Bug: skia:11837
Change-Id: I72dfef62f497af417d3f7248a58aad272f095398
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/415171
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-06-03 19:33:03 +00:00
Julia Lavrova
7856eb88ed Breaking functionality into separate steps
First try, all tests work.

Change-Id: Ifb1b102b3fc45d714d706e9c123d3ca0aeafd600
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/415156
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2021-06-03 18:45:47 +00:00
Nathaniel Nifong
2e76c84b8b Use WebGL2, not EGL, and don't use replace clip op.
Change-Id: I9e6ae22a646b9cf1f3c20857ffc50ecafe66174a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/414903
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2021-06-02 17:00:19 +00:00
Julia Lavrova
99e362f2be Simplification & separation
(split functionality)

Change-Id: Icd331900f964684faa5cd73e299586beba3552a3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/410478
Reviewed-by: Julia Lavrova <jlavrova@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2021-05-27 20:57:57 +00:00
Kevin Lubick
2e24270ece [debugger] Fix build after update to emsdk 2.0.20
Debugger had been including some egl code, which started throwing
an error about eglGetProcAddress not being linked in.

Change-Id: I2e930dc5064b6fc238d3399fe8aba5fe105a3097
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/412986
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2021-05-27 13:08:55 +00:00
Robert Phillips
77ecfc92e4 Add clip id to ngatoy's SortKey
Change-Id: Ic972dfcf13b9807669d0fb29c73dca8d6a9cd939
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/410816
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2021-05-24 19:43:15 +00:00
Robert Phillips
4b73228b07 NGA sorting playground
Change-Id: Ib73dd51f3f558aa6c6b98aa611da116d8906bf7f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/397284
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-05-24 17:49:57 +00:00
Ravi Mistry
e5be65e998 Update references to master branch
Change-Id: I1bfd1b655af6cdfbd64452b1e594a276425095fe
Bug: skia:11987
Docs-Preview: https://skia.org/?cl=410790
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/410790
Reviewed-by: Eric Boren <borenet@google.com>
Commit-Queue: Ravi Mistry <rmistry@google.com>
2021-05-21 15:18:16 +00:00
Julia Lavrova
10e7e77909 Reland "Switching SkText to UTF16"
This is a reland of a3262aa1d2

Original change's description:
> Switching SkText to UTF16
>
> Required some changes in SkUnicode to support it
> SkShaper still works on UTF8
>
> Change-Id: I76645668e1d9bf95eb4539a066deea2b24ecf5e9
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/406360
> Reviewed-by: Julia Lavrova <jlavrova@google.com>
> Commit-Queue: Julia Lavrova <jlavrova@google.com>

Change-Id: Ib21898d4acda8ab78e5e6fd1c7b9b0da41c3fa83
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/407396
Reviewed-by: Julia Lavrova <jlavrova@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2021-05-19 17:54:14 +00:00
Kevin Lubick
ed0c0ed028 [canvaskit] Add initial implementation of generating TS
This adds some initial features for generating the ambient
namespace files (the TS equivalent of .h files) for the
C++ binding files. There are a few tests and it works on
the sample code in tskit.

I split the bindings/ folder into bindings/ and interface/
(for C++ and TS code, respectively).

This can be tested locally by running
make generate && make debug && make serve
and verifying that everything compiles and runs in the browser.

One thing I changed for easier parsing was making a @type
annotation required, with an @optional tag for making a field
or constant optional.

Change-Id: If9c5a664e84fac4c734277cddd7774989a1f7bf8
Bug: skia:11826
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/407476
Reviewed-by: Nathaniel Nifong <nifong@google.com>
Reviewed-by: Leandro Lovisolo <lovisolo@google.com>
2021-05-17 13:56:31 +00:00
Robert Phillips
0c9962a7c8 Revert "Switching SkText to UTF16"
This reverts commit a3262aa1d2.

Reason for revert: I believe this is blocking the Flutter roll

Original change's description:
> Switching SkText to UTF16
>
> Required some changes in SkUnicode to support it
> SkShaper still works on UTF8
>
> Change-Id: I76645668e1d9bf95eb4539a066deea2b24ecf5e9
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/406360
> Reviewed-by: Julia Lavrova <jlavrova@google.com>
> Commit-Queue: Julia Lavrova <jlavrova@google.com>

TBR=bungeman@google.com,reed@google.com,jlavrova@google.com

Change-Id: I68b66dfbc4f3668a8fb765d5f557699e396cd3f5
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/407177
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-05-11 22:24:20 +00:00
Julia Lavrova
a3262aa1d2 Switching SkText to UTF16
Required some changes in SkUnicode to support it
SkShaper still works on UTF8

Change-Id: I76645668e1d9bf95eb4539a066deea2b24ecf5e9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/406360
Reviewed-by: Julia Lavrova <jlavrova@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2021-05-11 20:31:29 +00:00
Julia Lavrova
6d14195309 Multi line + LTR/RTL
Change-Id: I0859773c00b6a4bd19047d25b75ee7c6727bc470
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/403837
Reviewed-by: Julia Lavrova <jlavrova@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2021-05-11 18:20:29 +00:00