Commit Graph

1832 Commits

Author SHA1 Message Date
Kevin Lubick
b98328a27b [bazel] Add license to all our BUILD.bazel files
find -name "BUILD.bazel" -exec sed -i -e '1i licenses(["notice"])\n' {} +

Change-Id: Ie48f163b7d8d6ede9ba5f952e87232dd5c9fa8e6
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/529808
Reviewed-by: Ben Wagner <bungeman@google.com>
2022-04-13 19:50:29 +00:00
Jim Van Verth
42f710f3fa Reland "[graphite] Move Graphite into Skia base directories."
This is a reland of commit ae5e846047

Original change's description:
> [graphite] Move Graphite into Skia base directories.
>
> Change-Id: Ie0fb74f3766a8b33387c145bd1151344c25808cb
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/528708
> Reviewed-by: Kevin Lubick <kjlubick@google.com>
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Commit-Queue: Jim Van Verth <jvanverth@google.com>

Change-Id: Ia575fd49206ad0b665a6a9153317e738bb321446
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/529059
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2022-04-11 18:37:20 +00:00
Michael Ludwig
b1be53d4b3 [graphite] Track draw usage per clip element
Bug: skia:12698
Change-Id: I326a4bc34fde675e9fc7ad7835558ce6f307d268
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/527842
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2022-04-11 15:20:06 +00:00
Jim Van Verth
ab4d4ae9e2 Revert "[graphite] Move Graphite into Skia base directories."
This reverts commit ae5e846047.

Reason for revert: Breaking Google3

Original change's description:
> [graphite] Move Graphite into Skia base directories.
>
> Change-Id: Ie0fb74f3766a8b33387c145bd1151344c25808cb
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/528708
> Reviewed-by: Kevin Lubick <kjlubick@google.com>
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Commit-Queue: Jim Van Verth <jvanverth@google.com>

Change-Id: Ia57992a22c42b17216b40fd29452865f957fb802
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/528653
Auto-Submit: Jim Van Verth <jvanverth@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2022-04-09 01:02:26 +00:00
Jim Van Verth
ae5e846047 [graphite] Move Graphite into Skia base directories.
Change-Id: Ie0fb74f3766a8b33387c145bd1151344c25808cb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/528708
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2022-04-08 20:46:40 +00:00
Jim Van Verth
3871479bdb [graphite] Move all graphite classes under skgpu::graphite.
Change-Id: I484067cb1f6025dc9e6770c51c99bfc2c5925652
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/528365
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2022-04-08 00:42:37 +00:00
Greg Daniel
719239cd69 Move all Ganesh source files into ganesh subdirectory.
Change-Id: I238d29ba0250224fa593845ae65192653f58faff
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/528156
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2022-04-07 21:06:50 +00:00
Jim Van Verth
5200b52fd5 [graphite] Rename Metal classes to skgpu::graphite::Mtl<Class>
Change-Id: I76a01cf18583fab619459f258119b780ff978be5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/527840
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2022-04-07 16:21:32 +00:00
Robert Phillips
2a04ac3ee1 [graphite] Move the UniformManager into the SkPipelineDataGatherer
This means that the UniformManager w/in the SkPipelineDataGatherer will
now collect all the uniforms into a single block of memory.

Bug: skia:12701
Change-Id: I504a014d37662619191d9b519b4e1add69eac8bb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/527837
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2022-04-06 19:31:56 +00:00
Robert Phillips
01a9dc1378 [graphite] Make UniformManager write uniforms 1-by-1
This removes the use of the dubious void* 'srcs' array.

Bug: skia:12701
Change-Id: I5078d48c119d4e84e83a78b10d0bd4a9a1d8cd8c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/527777
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2022-04-06 19:06:05 +00:00
Robert Phillips
62b38b8659 [graphite] Make UniformManager internally allocate
This is moving to the world where the SkPipelineDataGatherer holds
a UniformManager. In that world the UniformManager will need to
incrementally allocate the uniforms it is collecting.

Bug: skia:12701
Change-Id: I6ed26948d7d0f2979130c4908d0c34c32604cd75
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/527736
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2022-04-06 16:16:46 +00:00
Michael Ludwig
91923c3a77 [graphite] Move clip application function to ClipStack
Bug: skia:12698
Change-Id: I3744b281a3d22bde5adeea4f909ca65e4e4d3cfe
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/527279
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2022-04-06 15:48:15 +00:00
Robert Phillips
1341b906f6 [graphite] Update PipelineDataCache to support different storage methods
With UniformData being stored in a arena and TextureData still being
held by unique pointer, the PipelineDataCache needs to be able to handle
both.

Longer term, TextureData will also be held in an arena and this
split will go away.

Bug: skia:12701
Change-Id: Iab6c6542fbce4f886410f985e6c93ddaa125152e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/527504
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2022-04-06 15:19:19 +00:00
Michael Ludwig
759deb9ec2 [graphite] Implement onClip-related functions in Device
The clip isn't actually applied, but clip stack manipulation is wired
up. This may have a slight impact on how things draw because the device
clip bounds now reflect the clip actions, and that is currently used as
each draw's scissor.

Bug: skia:12698
Change-Id: I1d2e9cea49762dbfaa008c7c6af6034387b62519
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/526917
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2022-04-05 20:08:06 +00:00
Robert Phillips
9fbd4984c8 [graphite] Begin making UniformManager more incremental
Once the UniformManager is moved into the SkPipelineDataGatherer, it
will need to be reset-able and write{Uniforms} will need to be able
to be called repeatedly. This CL starts setting up for that future.

Bug: skia:12701
Change-Id: Ia652c05b4eb508dce12c66b2298930d799d1e445
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/527280
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2022-04-04 19:58:03 +00:00
Michael Ludwig
57ca232731 [graphite] Consolidate and improve accuracy of contains/intersect for clip shapes
The internal ClipGeometry enum is moved to SimplifyResult in header.
The internal get_clip_geometry is renamed to Simplify and declared
header. This was so that the internal types (SaveRecord, Element, etc)
and TransformedShape could easily interoperate.

TransformedShape is a view that bundles references together instead
of requiring that all the internal types have some magical set of
functions that get_clip_geometry used.

The contains and intersect logic has all been consolidated into
TransformedShape instead of spread across many different contains()
functions. Intersect() is also more detailed because it can take
coordinate systems into account the coordinate systems, which will be
particularly useful when draw checking is added in a follow-up patch.

Bug: skia:12698
Change-Id: Ifac41a40715c7b0369fe31c273f12edc1efa956a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/526736
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2022-04-04 18:02:15 +00:00
Robert Phillips
f8b1ba0410 [graphite] Make the SkPipelineDataGatherer be the source of the Layout
The SkPipelineDataGatherer is going to subsume all the UniformManagers
scattered across the code so it will need the Layout in its ctor and
be plumbed where ever there is a UniformManager (in order to replace it).

Bug: skia:12701
Change-Id: I4f42bf50023e9e66c90f9a14833b976e214e1cc1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/526275
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2022-04-04 16:30:16 +00:00
Robert Phillips
2921f7df36 [graphite] No longer store the offsets w/in SkUniformData
These aren't currently used (we recompute them from the PaintParamsKey)
and are only getting in the way as we change how we accumulate uniforms.

We can always re-add them if the recomputation becomes a hot spot.

Bug: skia:12701
Change-Id: Id91ea0d27543666c75c154fc585d954c5f89aded
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/526270
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2022-04-01 19:44:04 +00:00
Michael Ludwig
10a3cc545c [graphite] ClipStack bounds use skgpu::Rect
Bounds are stored as floats, preserving exact coords instead of trying
to round in or out for pixel bounds. This is the major functional
implication that now differentiates behavior from v1::ClipStack.

Most of the changes are just updating to the appropriate API. One thing
to note is that Rect::intersect() outputs an empty/negative rectangle
if the inputs do not intersect, which is what we want in ClipStack but
had to be explicitly checked for with SkRect/SkIRect's behavior.

Bug: skia:12698
Change-Id: I94e8c67eba5091406f8722f7f8b76938db9eac3c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/526458
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2022-04-01 14:07:31 +00:00
Kevin Lubick
5e8f45faf1 [includes] Prepare for moving SkColorSpace to forward declare
This updates all our callsites in preparation for removing
the #include "include/core/SkColorSpace.h" from SkImageInfo.h

According to go/chrome-includes [1], this will save ~150MB
(0.07%) from the compilation size. I think SkColorSpace is
a big include because it loads the skcms header, which is
big.

The follow-on CL will remove that link, once clients have
been updated as well.

[1] https://commondatastorage.googleapis.com/chromium-browser-clang/chrome_includes_2022-03-31_124042.html#view=edges&filter=%5Ethird_party%2Fskia%2Finclude%2Fcore%2FSkImageInfo%5C.h%24&sort=asize&reverse=&includer=%5Ethird_party%2Fskia%2Finclude%2Fcore%2FSkImageInfo%5C.h%24&included=&limit=1000

Change-Id: I1b5ff491ac495317b0e5af3a2082b080d43697ae
Bug: skia:13052
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/525639
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Florin Malita <fmalita@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
2022-03-31 19:50:10 +00:00
Greg Daniel
6b52f372c3 [graphite] Add a result param to graphite callbacks.
Bug: skia:12974
Change-Id: Ie10ef5c8ab4e04647233a6039d22a2eb6437d6bf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/526022
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2022-03-31 19:26:28 +00:00
Michael Ludwig
7b04832cbe [graphite] Initial ClipStack paired down from v1::ClipStack
PS1 is the exact contents of src/gpu/v1/ClipStack.* copied to
experimental/graphite/src.

PS2+ shows all the changes to remove v1-only features and update some of
the types over to what graphite uses. The major changes are:
1. FragmentProcessors, clip atlases, stencil mask writing, and SW mask
   writing are gone.
2. SW mask caching and tracking are gone.
3. Graphite is effectively in the "forceAA" mode that the original clip
   stack supported. So branches that focused on non-AA, or comparing AA
   or handling cases where elements' AA mismatched could all be removed.
4. Updated to use Graphite's Shape and Transform classes. Did not go as
   far as moving the bounds from SkIRect to Rect, but since everything
   is AA, it will be much simpler to switch to comparing float bounds
   directly and not worry about rounding in or out. That's a more
   substantial change so will come later.
5. The original ClipStack had a "Draw" type that was used to compute
   clip interactions between SaveRecords and Elements. It was always
   just device-space bounds because of limitations of the GrClip API.
   In Graphite, we can use the exact same set of info for Draws and
   Elements, making interaction tests share code and be more accurate.
   Since that's a more involved change, I just removed the simpler Draw
   type from this version for now.
6. Tried to add TODOs for what logic and extra state will need to be
   added to actually apply graphite's clip stack as depth-only draws.

Bug: skia:12698
Change-Id: I418703e8f759cd5e1ddd1e302a864bf2204cf040
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/525516
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2022-03-31 16:45:58 +00:00
Robert Phillips
0ec0c38e2e [graphite] Add ExtractRenderStepData
This doesn't reuse memory w/in the gatherer but sets us up to do so.

Bug: skia:12701
Change-Id: If5ed962e73609b113581ed2bd681e872fe3214c0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/526029
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2022-03-31 14:45:54 +00:00
Jim Van Verth
0c50659cfe [graphite] Move writePixels logic up into Device
Following the philosophy that DrawContext should be as simple as
possible, the work that sets up the upload should be done higher up.
If we need to share the code, that can be handled by a helper class or
function.

Bug: skia:12845
Change-Id: Ib0308ce816e545ccffb5ddbe3d9bcc302349397f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/526025
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2022-03-31 14:04:37 +00:00
Kevin Lubick
7c6a1526f7 Free FontChains after test completes
ASAN detected this leak.

Change-Id: I7f54cbe35ac36d288d2fa676cf0192a793686ba1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/526077
Reviewed-by: Julia Lavrova <jlavrova@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
2022-03-30 21:02:55 +00:00
Robert Phillips
2e9bc4700a [graphite] Set up to use fewer allocations when collecting uniforms
This doesn't actually change the memory allocation but sets up to do so.
90% of the CL is just renaming SkPipelineData to SkPipelineDataGatherer.
The main interesting changes are those to:
    ExtractPaintData
    in DrawPass.cpp
and SkPipelineData.h/.cpp

Bug: skia:12701
Change-Id: I3e18f9b3f16166649de1bf1f4399d5521d817eb3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/524763
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2022-03-30 14:44:41 +00:00
Jim Van Verth
d9c178ac9a [graphite] Add get{Read|Write}Swizzle support
Bug: skia:12845
Change-Id: I8e9d7dcfaf4f356b65638f0f8490edd8b0dd2644
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/525177
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2022-03-28 21:55:39 +00:00
Greg Daniel
5d67b1797a [graphite] Use finished callbacks in nanobench to manage frames.
In nanobench we want to try and simulate a GPUs swapbuffering and not
get too far ahead on the CPU. Thus we use finished callbacks to know if
we get more than 3 frames ahead of the GPU. This CL adds support for
Graphite to do this.

Bug: skia:12974
Change-Id: I8be505c5769399dcc0f5954f9f999f4448633647
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/525186
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
2022-03-28 20:14:30 +00:00
John Stiles
116b0d564f Use diagonal-matrix constructor for an identity matrix.
This simplifies the IR and emits cleaner Metal code; Metal does not
directly support matrix-construction from a list of scalars.

Change-Id: I0f2415e4c84d4f999aaaeaec3623f0eae41c24dc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/525179
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2022-03-28 18:48:32 +00:00
Kevin Lubick
e7c76234e8 [bazel] Regenerate and fix IWYU
Steps to run:
make -C bazel generate
bazelisk build //example:hello_world_gl --config=linux-rbe \
    --features skia_enforce_iwyu
# manual fixes of the .h and .cpp files
make -C bazel generate

This will be followed up by a CQ job that checks the generated
Bazel files.

Bug: skia:12541
Change-Id: I7651f885e182a60177839cd78a2d4047e73a676a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/525181
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2022-03-28 17:40:18 +00:00
Jim Van Verth
ecd4b09bb6 [graphite] Some cleanup for makeTextureImage and Caps CLs
* Removes unnecessary static function (it's been copied elsewhere).
* Uses Caps info for colorTypeToFormat.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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