Commit Graph

1586 Commits

Author SHA1 Message Date
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