Commit Graph

1755 Commits

Author SHA1 Message Date
Michael Ludwig
35553cd3a7 Pull back PatchWriter from Tessellator APIs
This is pretty much just refactoring, condensing the virtual APIs of
PathTessellator and StrokeTessellator to not require exposing
PatchWriter. Once landed, this makes it easier to move PatchWriter to
a template where each Tessellator subclass has a different instantation.

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

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

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

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

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

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

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

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

Bug: skia:12701
Change-Id: I8d077b3d342e6ea16ac99227eb145d92e8247ea4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/517736
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2022-03-09 14:07:53 +00:00
Kevin Lubick
7ac7413f08 [bazel] Support Vulkan
PS1 regenerates BUILD.bazel files

I suggest reviewing the deltas between PS1 and the latest
PS to focus on the interesting bits.

The changes here allow for a Vulkan-only build of HelloWorld
based on sk_app. The toughest change was properly fetching
the VisualID after removing the gl calls that used to
fill that in.

There are a few changes that fix resolution of Dawn
header files, but those won't actually be built until
a follow-on CL.

Change-Id: I54fb58b5dd7ecd4313562aed401759b3eaed53c0
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/516999
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
2022-03-08 21:21:17 +00:00
Kevin Lubick
57c1541715 Remove old experiments
These are unowned and/or unused.

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

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

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

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

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

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

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

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

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

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

Change-Id: I32a90def41796ca94cf187d640cfff8e262f85f6
BUG: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/510737
Reviewed-by: Leandro Lovisolo <lovisolo@google.com>
2022-02-28 14:05:54 +00:00
Greg Daniel
6c370c9d82 [graphite] Fill out ResourceCache functions.
Bug: skia:12754
Change-Id: Ie012bce21597ef2f0f1555d1cc6302b7eda0dd56
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/507923
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2022-02-24 20:16:01 +00:00
Nathaniel Nifong
4040863fc8 fix makefile to reflect bazel build structure in buildbot
Change-Id: Ieb8a85f721e2c2c8894230eb98731b833de8f252
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/512777
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Nathaniel Nifong <nifong@google.com>
2022-02-24 18:59:53 +00:00
Kevin Lubick
b902658a1a [bazel] Fix Bazel build by guarding addToKey
PS1 is the automatic regenerated changes.
PS2-3 adds an #ifdef guard to the addToKey method on shaders.
The SkShaderCodeDictionary class helps generate SkSL and is
only necessary when we are building with SkSL (gpu builds and
cpu builds with SkVM).

Suggested Review order:
 - Use Gerrit to diff PS 1 and the last PS
 - src/core/BUILD.bazel adds some sources to the "only
   necessary if sksl is enabled" bucket
 - All the .cpp and .h files to see the #ifdef is added
   correctly.

Change-Id: I4d4ce61a4957ef1e0840204acff08ce7e616f9cb
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/512157
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
2022-02-24 18:10:40 +00:00
Robert Phillips
24f02a3e35 [graphite] Move backend specification into the SkPaintParamsBuilder
This should reduce any possibility of keys being built w/ mixed backend snippets. The decision of which backend the key is being created for is made once, when the builder is created.

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

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

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

This experiment is unused otherwise.

Change-Id: I78ab8c3936c7ac2b5e6e3af08e6f5b749d89265d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/509401
Reviewed-by: Florin Malita <fmalita@google.com>
Reviewed-by: Jorge Betancourt <jmbetancourt@google.com>
2022-02-15 22:40:08 +00:00
Kevin Lubick
7f568e968e [bazel] Update to use emsdk 3.1.4
PS1 regenerates the BUILD.bazel files

This allows us to use closure to minify the JS in canvaskit.js

Change-Id: Ib8326d2e3a19cd2168b740b6946f9165a2810133
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/509177
Reviewed-by: Ben Wagner <bungeman@google.com>
2022-02-15 17:47:03 +00:00
Robert Phillips
d184c1b12d [graphite] Add uniform name mangling and a uniform padding cheat
The name mangling is pretty simple. The uniform padding cheat is that all uniform blocks are now multiples of 16B so can always just be blindly concatenated.

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

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

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

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

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

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

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

Change-Id: I88465a234b48abf4b1ac97146c8adcf9638babd0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/506396
Reviewed-by: Brian Osman <brianosman@google.com>
2022-02-09 19:56:49 +00:00
Kevin Lubick
9cb74e9079 [bazel] Compile gms for wasm and WebGL
PS 1 is re-generating existing BUILD.bazel files
PS 2 is generating BUILD.bazel files for tests/gms
PS 3+ makes modifications to build all of the gms and tests.

It is recommended to view this CL with just a diff between
PS 2 and the end, due to the large amount of generated changes
in PS 1 and 2.

We make a filegroup for the gms and tests because they need
to be compiled as one large blob in order for the registries
to work. Maybe in the future we will break these up, but at least
for WASM/JS, the overhead of starting a browser for each new
test would likely grind things to a halt, so we just group them
all together for now. It's also the most similar to what we
currently do.

In gm/BUILD.bazel and tests/BUILD.bazel, we add a cc_library
that encapsulates all of the deps of the tests, so we can
easily include that the build. These were discovered via
trial and error, not anything automatic or systematic.

The is_skia_dev_build config_setting is very similar to the
GN equivalent from which it was based.

The list of gms and tests to skip (e.g. which are incompatible
with WASM) was determined by building the wasm bundle:

modules/canvaskit$ make bazel_gms_release
tools/run-wasm-gm-tests$ make run_local_debug
# Don't forget to click the button on the screen after the
# browser loads

This way of invoking the tests will be replace soon with
`bazel test <something>`. As such, I didn't bother fully
documenting the current way.

Suggested review order:
 - modules/canvaskit/BUILD.bazel taking note that we always
   use profiling-funcs to make the stacktraces human readable.
 - gm/BUILD.bazel and tests/BUILD.bazel to see the lists of
   gms/tests. Notice the tests are roughly partitioned because
   we don't support things like vulkan/PDF in the wasm build
   and we will want a way to not build certain tests for
   certain configurations
 - tools/* noting some of the cc_libraries added to make
   dependencies easier to add when needed.
 - All other files.

Change-Id: I43059cd93c28af1c4c12b93d6ebd9c46a12d381f
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/506256
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
2022-02-09 18:56:17 +00:00
Robert Phillips
61e7b64962 [graphite] Rearrange headers
There is no need for these headers to be in include/private:
SkPaintParamsKey.h
SkShaderCodeDictionary.h

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

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

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

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

Bug: skia:12701
Change-Id: I484ae30626dad64f2bce1e0948071380d9f8282e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/504596
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2022-02-08 15:54:35 +00:00
John Stiles
87aa7a9095 Add SK_PRINTF_LIKE to existing variadic print functions.
This shook out a handful of formatting issues:
[SkVMVisualizer]
- We were passing plain text like "width:35%;" through printf.
- One particular opcode type was printing a string as a number.
[Skottie, SortToy]
- Used wrong integer type instead of %zu for size_t

This CL does not update print functions which take printf arguments via
variadic template, as __attribute__((format)) does not support this
style. These could be converted to va_list style, but that's not done in
this CL.

(For some reason, GCC requires the attribute to be set on a prototype
for freestanding functions, so a few of these now have a prototype
immediately followed by a declaration.)

Change-Id: I63a6c2486c785cc38563028fdf8df0662ec04935
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/504698
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2022-02-07 14:55:39 +00:00
Greg Daniel
fc80c11138 [graphite] Don't initialize Recorder BufferManager until after initializing ResourceProvider.
Change-Id: Ic37b07919478af59fb775285dc2cfc932ce3f2b8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/504696
Commit-Queue: Greg Daniel <egdaniel@google.com>
Auto-Submit: Greg Daniel <egdaniel@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2022-02-04 22:43:39 +00:00
Robert Phillips
6c28bd97fe [graphite] Reorganize code snippets a bit
This inches us towards the model of the code snippets being subroutines that are then glued together in a main method.

Bug: skia:12701
Change-Id: I49c39636debd2dbe512c7d5f9bc401dd899df1dd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/504556
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2022-02-04 21:31:04 +00:00
Greg Daniel
324e00243f [graphite] Add RecorderPriv class
Change-Id: If2ef260cf015e7f7ae2ebc7de1a41a5ef52b8dd3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/504616
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2022-02-04 21:23:08 +00:00