Commit Graph

5374 Commits

Author SHA1 Message Date
John Stiles
1d0d1e9f16 Update iOS test apps to require C++17.
Fixes these build breaks: http://screen/5kZxPUFhoSrwpZ8

Change-Id: Ib4c92c0c33c9b0fdd639092e901f475e6f6bc655
Bug: skia:12882
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/502307
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2022-01-31 23:17:15 +00:00
John Stiles
0f6baf469d Update CommaSideEffects test to run on GPU.
Change-Id: Ia218fb2249abd479db9d27527b965fd0b8ad3367
Bug: skia:12858
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/501276
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2022-01-31 21:35:13 +00:00
Derek Sollenberger
3034776433 Cleanup SkQP build scripts
Change-Id: Ie226bc605baad4788976ad4c37dc455d36b11793
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/494136
Reviewed-by: Nathaniel Nifong <nifong@google.com>
Commit-Queue: Derek Sollenberger <djsollen@google.com>
2022-01-31 15:43:48 +00:00
John Stiles
a458b86c31 Enable Swiftshader for Vulkan testing on Mac.
This allows dm to run basic Vulkan tests, albeit without GPU
acceleration.

Change-Id: Idb738125ad302054be290d50f92b494d6fc6a84c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/501686
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Christopher Dalton <csmartdalton@google.com>
Commit-Queue: Christopher Dalton <csmartdalton@google.com>
2022-01-28 19:14:56 +00:00
John Stiles
952bcb0732 Re-enable SkSL tests in CanvasKit/wasm.
We can disable SkSL tests on a case-by-case basis via the skip list in
`run-wasm-gm-tests.html`. This doesn't allow us to exclude by GPU, but
in practice the Golo machines tend to all have a uniform setup (with
Quadro P400s) so we can just work around failures as they come up.

Change-Id: I46f709691282e576d00d5191e9dbd46b740e4a5f
Bug: skia:12876
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/501682
Reviewed-by: Joe Gregorio <jcgregorio@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2022-01-28 16:22:33 +00:00
John Stiles
f07421bcbd Remove unnecessary ctors now that we have C++17 copy-elision.
This CL backs out C++14 compatibility changes from
http://review.skia.org/457298 :

"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."

Change-Id: I33a833d33b221e757bf6a6459835a7215b4e6b66
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/501240
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2022-01-27 20:26:54 +00:00
Robert Phillips
1042c00130 [graphite] Replace GrSLType with SkSLType
This is mostly mechanical. The only interesting bit is that GrSLType was in include/private while SkSLType is in src/core so some #include patterns changed.

Bug: skia:12701
Change-Id: I80bd86ee93796b145f86ded9b4cbf52f24fa59e5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/497607
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2022-01-26 17:30:12 +00:00
Florin Malita
fb6d8929b2 Remove some unused vars from skqp
Change-Id: I5c3d04c17628f46c01814db6eead0337ebe68e16
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/500276
Commit-Queue: Florin Malita <fmalita@chromium.org>
Auto-Submit: Florin Malita <fmalita@chromium.org>
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Derek Sollenberger <djsollen@google.com>
2022-01-26 17:29:42 +00:00
Nathaniel Nifong
9eb1679b77 Add regular expression capability to SKQP unittest filter
Current behavior, as an example, is to run every test not matching ".+ES3"
but this is subject to change based on Brian Osman's input

Bug: skia:12796
Change-Id: Ib798a6a6e6323ae0cf349010fce3f5982f2038bf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/498976
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Nathaniel Nifong <nifong@google.com>
2022-01-25 21:39:44 +00:00
Dominik Röttsches
013397884c [tools] Add git.bat to search list
On Windows, with depot_tools, git might be a batch file called
git.bat. Add that to the default search list to make it easier
to find a git command.

Change-Id: I825432e0f7fc72c37a1f2394a68e2f3f3e65f958
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/497056
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Dominik Röttsches <drott@google.com>
2022-01-20 17:33:21 +00:00
Greg Daniel
7022d74567 [graphite] Hook up viewer
Bug: skia:12633
Change-Id: Id0bd892375e3a3e2886714f19b7fd8da2232e4e2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/479736
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2022-01-18 15:49:51 +00:00
Chris Dalton
fb1b30b346 Update existing SwiftShader jobs to use Vulkan instead of OpenGL
The SwiftShader OpenGL frontend is officially unsupported. They strictly
support their Vulkan frontend only.

Bug: skia:12218
Bug: skia:12820
Bug: skia:12826
Bug: skia:12829
Change-Id: Ib2e43783e18fcabfa2df9268c29bcd610350e5a2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/437149
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Christopher Dalton <csmartdalton@google.com>
2022-01-14 18:05:37 +00:00
Greg Daniel
6658fd1584 In vulkan tests, use vkGetInstanceProcAddr to get vkGetDeviceProcAddr.
We've run into drivers a few times now that have bugs where they only
expose vkGetInstaneProcAddr and not vkGetDeviceProcAddr. The latest
being swiftshader (which is getting fixed). To avoid this issue in the
future we can just have our tests use vkGetInstanceProcAddr to get
vkGetDeviceProcAddr.

Change-Id: I6d73abde507519c145b873042393f50ce6c4527c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/494822
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2022-01-14 17:04:16 +00:00
Robert Phillips
bf489abbf6 [graphite] Add SkTileModeToStr
This is to be used in the PaintParamKey's block dumping methods.

Bug: skia:12701
Change-Id: I14de21d2d8b30e0fa69ac2e33fa975dc20f6656c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/493217
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2022-01-11 16:19:53 +00:00
Corentin Wallez
41e994f735 Replace uses of deprecated dawn_native::BackendType
Bug: dawn:824
Change-Id: I261c3329e53de62df83b4cca10aa9e909dd293df
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/492456
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@google.com>
Commit-Queue: Stephen White <senorblanco@google.com>
2022-01-11 15:12:45 +00:00
Kevin Lubick
7a14f783bd [bazel] Sketching out HelloWorld sk_app using GL
bazel run //example:hello_world --config=clang
causes a window to open and draws a circle and a square.
Text to follow in a future CL.

To make this work, I had to get rid of musl and use glibc.
All the shared libraries (.so files) that were pre-built
and available for download (e.g. from https://packages.debian.org/bullseye/amd64/libgl1/download)
were compiled against glibc. When I tried to run a
program statically linked with musl and dynamically linked
against things using glibc, I got a segmentation fault
on things like calloc().

Initial attempts to use glibc had failed because it was thought
that the libc.so.6 file could only be referred to by absolute
path (and thus Bazel would not be happy about it). As it turns out,
that was simply a misconfiguration of the builtin_sysroot
parameter to cc_common.create_cc_toolchain_config_info
(see //toolchain/clang_toolchain_config.bzl). By setting that
to `external/clang_linux_amd64` and not
`external/clang_linux_amd64/usr`, the libc binary which had
been extracted to `external/clang_linux_amd64/lib/x86_64-linux-gnu`
was perfectly reachable from
`external/clang_linux_amd64/usr/usr/lib/x86_64-linux-gnu/libc.so`

To bring in the shared libraries to link against (e.g. X11, GL)
I made build_toolchain.bzl easier to modify in that we simply need
to add a debian download url and sha256 hash to a list (rather than
having to plumb this through via arguments).

Recommended Review Order:
 - example/BUILD.bazel (not sure if we always want to set bare
   link arguments like that or if we want to use "features" to
   pass those along to the toolchain).
 - tools/sk_app/BUILD.bazel to see initial cc_library for
   wrapping sk_app code.
 - toolchain/build_toolchain.bzl to see removal of musl and
   new list of debs.
 - toolchain/clang_toolchain_config.bzl (where use of the
   no-canonical-prefixes was key to compilation success).
   Notice also that we statically linked libc++ (I did not
   have any shared libraries for it locally, so I guessed
   a typical developer might not either).
 - Rest of toolchain/ for trivial renames.
 - bazel/Makefile to see extra docs on those targets and
   a new target that compiles all the exes so far for a
   quick way to test the build.
 - third_party/BUILD.bazel and src/gpu/BUILD.bazel which have
   non-generated changes. (all other BUILD.bazel files do).
 - go.mod, which needed to update the infra repo version in
   order to pick up http://review.skia.org/491736).

Change-Id: I8687bd227353040eca2dffa9465798d8bd395027
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/492117
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Leandro Lovisolo <lovisolo@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
2022-01-11 13:06:19 +00:00
Brian Salomon
8a85ab0d96 Reland "drawVertices in GPU backend uses drawVustomMesh implementation."
This is a reland of 73657689b6

Original change's description:
> drawVertices in GPU backend uses drawVustomMesh implementation.
>
> This still allows batching across view matrix changes but does not batch
> across SkVertices that have different attributes.
>
> Bug: skia:12720
> Change-Id: I34b58e2ae3aa7330b1fe3280b9448197e2bb68b0
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/491047
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>

Bug: skia:12720
Change-Id: I24230e2a284b98ce71ccf034ff71d903896f1da1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/492357
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2022-01-10 23:06:15 +00:00
Derek Sollenberger
8b2513a986 Build the NDK compliant shared library to be used by JNI in SkQP.
This CL creates a new build target with a customized set of GN
flags that enable the native components of SkQP to be built using
NDK APIs.

Bug: skia:12777
Change-Id: I8341eafa7fc794cfb759045b7c7238e69c29b0a3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/491447
Reviewed-by: Leon Scroggins <scroggo@google.com>
Commit-Queue: Derek Sollenberger <djsollen@google.com>
2022-01-10 17:11:48 +00:00
Brian Osman
90263a14b5 Revert "Spruce up SkSL slide with a much nicer editor"
This reverts commit 88c5af7ecd.

Reason for revert: Various input bugs in the new editor make it somewhat unusable.

Original change's description:
> Spruce up SkSL slide with a much nicer editor
>
> Pulls in a new GitHub repo that implements a syntax-highlighting code
> editor ImGui widget.
>
> Change-Id: I968e5eb827c226259eaaad2996eeaad9de592e37
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/491444
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Brian Osman <brianosman@google.com>

Change-Id: Ifa5bc87327785d107956201c4d866c7259006ec2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/492359
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2022-01-07 15:56:16 +00:00
Brian Osman
5bb80e1ee0 Revert "drawVertices in GPU backend uses drawVustomMesh implementation."
This reverts commit 73657689b6.

Reason for revert: Many bad GMs.

Original change's description:
> drawVertices in GPU backend uses drawVustomMesh implementation.
>
> This still allows batching across view matrix changes but does not batch
> across SkVertices that have different attributes.
>
> Bug: skia:12720
> Change-Id: I34b58e2ae3aa7330b1fe3280b9448197e2bb68b0
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/491047
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>

Bug: skia:12720
Change-Id: I2aa0a62323e54cb999cc89eccd72cf9b93dccba9
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/492356
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>
2022-01-07 14:12:16 +00:00
Brian Salomon
73657689b6 drawVertices in GPU backend uses drawVustomMesh implementation.
This still allows batching across view matrix changes but does not batch
across SkVertices that have different attributes.

Bug: skia:12720
Change-Id: I34b58e2ae3aa7330b1fe3280b9448197e2bb68b0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/491047
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2022-01-06 21:05:33 +00:00
Kevin Lubick
048545d249 Set up basic hello world sk_app
Change-Id: I233e7653eadcce87067def841b2f28c700f96045
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/492096
Reviewed-by: Brian Salomon <bsalomon@google.com>
2022-01-06 20:29:35 +00:00
Kevin Lubick
96e4053be7 Update Bazel files
- Use latest emscripten toolchain (3.1.0)
 - Autogenerate the atoms and manually fix some of the file lists.
 - Add a known_good_builds target to bazel/Makefile to help
   check the things we expect to work with Bazel.

Change-Id: Ia5f51e7b9eb5c108386820ad59180c8f862f5a70
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/491438
Reviewed-by: Ben Wagner <bungeman@google.com>
2022-01-06 18:10:57 +00:00
Brian Osman
88c5af7ecd Spruce up SkSL slide with a much nicer editor
Pulls in a new GitHub repo that implements a syntax-highlighting code
editor ImGui widget.

Change-Id: I968e5eb827c226259eaaad2996eeaad9de592e37
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/491444
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2022-01-05 20:19:49 +00:00
Derek Sollenberger
1afa5fb64b Reduce scope of SkQP to pass/fail runs of GMs and UnitTests
Going forward specific GMs can be added to the rendertest.txt
in order to do a basic pass/fail run based on whether the GM
can successfully complete without crashing.

The output of the executable was also updated to print one test
per line in order to make following its execution more readable.

Bug: skia:12777
Change-Id: I98f6fa7af765130ddf68203d62c972659fd4e325
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/489617
Reviewed-by: Leon Scroggins <scroggo@google.com>
Commit-Queue: Derek Sollenberger <djsollen@google.com>
2022-01-04 18:07:48 +00:00
John Stiles
d67f1f8f50 Provide bit-casted slot values from DebugTracePlayer.
Previously, the VariableData returned from a DebugTracePlayer contained
values in an int32_t, regardless of the slot's NumberKind. We had a
helper function which could stringize the bits, but otherwise the caller
was responsible for bit-casting the value manually.

Now, the DebugTracePlayer will automatically manage bit-casting for the
caller. The value returned in the VariableData is now a double (so it
is able to store an int32, uint32, or float at full precision).

This change was inspired by the recent Typescript port. (The value in
the Typescript VariableData uses a compound `number | boolean` type, so
it is able to fully represent any slot value natively.)

Change-Id: I5eec414236f76ad0ff51b0b19974e4a0025c4d62
Bug: skia:12666
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/489896
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-12-29 18:30:19 +00:00
John Stiles
81134a7a62 Add checkbox to disable Shadertoy uniform support.
Generally these are harmless, but in some cases, they get in the way.
(e.g. when trying to make a minimal debug trace)

Change-Id: I2218e68c70fdbf85c3e10df232955038e2aaed29
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/488376
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-12-28 15:04:50 +00:00
John Stiles
87ced29082 Track line reachability on a step-by-step basis.
Since we know the entire flow of execution ahead of time, at any point
during trace playback, we can know if a line will be reached again or
not. We no longer highlight lines as reachable (or allow setting
breakpoints) if the line will not be reached again during trace
playback.

Change-Id: Iff563b13e2f6efb5d4f2ff37215f2ff4fb5945ed
Bug: skia:12666
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/486496
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2021-12-22 19:33:17 +00:00
Greg Daniel
cdeb092655 [graphite] Move GrProcessorKeyBuilder to generic skgpu::KeyBuilder class.
This also allows the KeyBuilder class to be used in Graphite. In Graphite
I plan to use it for other keys besides building up shaders/processors
so I dropped that from the name. There was nothing special abouts its
implementation that made it specific to Processors anyways.

Bug: skia:12754
Change-Id: I1b25730b061f9342b61e3b2e4ac43328b8074d59
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/486897
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2021-12-20 20:41:17 +00:00
Brian Salomon
dd9ef457d9 Reland "Add support for explicit attribute offsets and strides."
This is a reland of 6927ab9311

Original change's description:
> Add support for explicit attribute offsets and strides.
>
> Previously attribute offsets were always computed based on their
> position in an attribute array and the stride was determined
> by the offset and size of the last attribute.
>
> Now a GP has the option to create attributes with explicit offsets
> and specify an explicit vertex stride. All attributes must either
> be implicit or explicit (enforced by assert).
>
> GrGeometryProcessor::AttributeSet is now responsible for handling
> implicitly determined attribute offsets and strides. The backends
> no longer compute them.
>
> Bug: skia:12720
> Change-Id: I0211673dc70d4797c2d66b2555d8f5fb430be056
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/484736
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Reviewed-by: Michael Ludwig <michaelludwig@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>

Bug: skia:12720
Change-Id: Ic4975b5b2e52f2d8213154da0e585eca6dfdd78d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/486098
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2021-12-20 14:50:20 +00:00
John Stiles
44a8392620 Add breakpoint support in SkSL debugger.
Line numbers were previously Text. They are now SmallButtons; clicking
them sets and clears breakpoints. The set of active breakpoints is
stored in an unordered_set of line numbers. Breakpoints are visualized
by setting the color of the SmallButton controls to red.

We now also have "Reset" (start over) and "Run to Breakpoint" buttons.

http://screen/8rtenW2vszxDgCp

Change-Id: I30a79bb09811e1d8a4e4e8535cbe62020f20f111
Bug: skia:12747
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/485861
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2021-12-16 20:46:56 +00:00
Brian Salomon
38d5328926 Revert "Add support for explicit attribute offsets and strides."
This reverts commit 6927ab9311.

Reason for revert: breaking roll?

Original change's description:
> Add support for explicit attribute offsets and strides.
>
> Previously attribute offsets were always computed based on their
> position in an attribute array and the stride was determined
> by the offset and size of the last attribute.
>
> Now a GP has the option to create attributes with explicit offsets
> and specify an explicit vertex stride. All attributes must either
> be implicit or explicit (enforced by assert).
>
> GrGeometryProcessor::AttributeSet is now responsible for handling
> implicitly determined attribute offsets and strides. The backends
> no longer compute them.
>
> Bug: skia:12720
> Change-Id: I0211673dc70d4797c2d66b2555d8f5fb430be056
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/484736
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Reviewed-by: Michael Ludwig <michaelludwig@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>

Bug: skia:12720
Change-Id: I938bc3776d598f0906465eb2677208c79676642f
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/486016
Auto-Submit: Brian Salomon <bsalomon@google.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2021-12-16 20:00:18 +00:00
Brian Salomon
6927ab9311 Add support for explicit attribute offsets and strides.
Previously attribute offsets were always computed based on their
position in an attribute array and the stride was determined
by the offset and size of the last attribute.

Now a GP has the option to create attributes with explicit offsets
and specify an explicit vertex stride. All attributes must either
be implicit or explicit (enforced by assert).

GrGeometryProcessor::AttributeSet is now responsible for handling
implicitly determined attribute offsets and strides. The backends
no longer compute them.

Bug: skia:12720
Change-Id: I0211673dc70d4797c2d66b2555d8f5fb430be056
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/484736
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2021-12-16 14:38:12 +00:00
John Stiles
eff367ac83 Highlight reached/unreached lines differently in Debugger.
This is useful to know because breakpoints can only meaningfully be set
on a line of code which is reachable. In other words, we know the
entire execution path ahead of time, so we can tell you that some
branches aren't actually taken without needing to set a breakpoint at
all.

Change-Id: I72b2cddcf92fd6f75ea12d302230bae42b7112bc
Bug: skia:12666
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/485218
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-12-15 20:08:06 +00:00
John Stiles
457f1b9f41 Show the variables pane even when it is empty.
The widget layout shouldn't change when there are no variables.

Change-Id: Iedb48642486944127fa800072c1f4c57a574b513
Bug: skia:12666
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/484836
Reviewed-by: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-12-15 18:13:26 +00:00
Herb Derby
dc60ca197e cleanup TODOs, and warnings
The API for a remote glyph cache had a couple of TODO's left waiting
for Chromium to implement the functions. This happened three years
ago.

This is waiting for the Chromium CL to finish:
https://chromium-review.googlesource.com/c/chromium/src/+/3338117

Change-Id: If8e3de619f0f4be7044e6955204b599c5a42e802
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/484437
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2021-12-15 17:38:34 +00:00
John Stiles
708f28f4b1 Show the stack trace in the Debugger slide.
Right now it is non-interactible, but it's still useful for keeping
track of the flow of execution.

http://screen/4b6WMGdw6j32AGc

Change-Id: I978d9b441c15674c6cae508b123579021c2ecc46
Bug: skia:12666
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/484076
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-12-14 15:56:44 +00:00
John Stiles
0745d19ae3 Hide function return values after a step.
Previously, return values like `[func].result` would stick around in the
Variables table indefinitely. This felt very counterintuitive. Now they
only appear for one step, then vanish.

Change-Id: Iedfc7d2ddf136111005b26aaefb380ffc6281d05
Bug: skia:12666
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/483605
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-12-13 22:14:35 +00:00
John Stiles
49cb6d7668 Add a Variables pane to the SkSL debugger.
The currently-active stack frame is always shown. Values which were
modified during the last step action are highlighted.

http://screen/4E4BLXYJsDR5bhk

Change-Id: I521d92fa6c1eabd64aaeeb188c71f04a79f827f5
Bug: skia:12666
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/483602
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-12-13 20:29:26 +00:00
Herb Derby
8dc9a337ab rename GrTextBlobCache to GrTextBlobRedrawCoordinator
Change-Id: Ib1ea2936f7a9431bc62c04b1931cf6da2c213b36
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/483496
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2021-12-13 17:38:00 +00:00
John Stiles
5d3060ed94 Add support for stepping out from a function.
Stepping out is extremely similar to stepping-over, so this was mostly
working already.

Change-Id: Ib1c1ba96b45a732500e72b6da4cbfe41a1f75307
Bug: skia:12666
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/483196
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2021-12-13 16:43:49 +00:00
John Stiles
a26ba3e51b Improve the debugger code view.
The raw text has been replaced with a proper table. Stepping through
code now scrolls properly to focus on the current line. The ASCII "->"
arrow has been replaced by a focus highlight. The top controls no longer
scroll away when browsing code.

http://screen/BnTa3thYzUgTTdG

Change-Id: Ieaa3a479099bbd09d9ba2cb5552befdd5307f9c5
Bug: skia:12666
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/483156
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2021-12-13 16:43:23 +00:00
John Stiles
00b3fcccdf Create Debugger slide for Viewer.
This is a very rough first draft which provides the bare minimum. Shader
source is dumped to the window as static text, along with an arrow
tracking the current trace line. Two buttons allow for single-step and
step-over. There aren't yet any GUI affordances for the stack or
variables.

http://screen/44WAnxchjy8MPjM

Change-Id: Ifad4a146b54d334113b02132eec2238af4fd8580
Bug: skia:12666
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/481681
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-12-13 16:28:06 +00:00
Jim Van Verth
db9f95c888 Move ShaderUtils out of Ganesh.
This will allow us to use ShaderUtils in both Ganesh and Graphite.

Change-Id: I78e34c4eb969a0d827c459d7fb945d17fdc22efa
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/482696
Reviewed-by: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2021-12-10 23:10:25 +00:00
Herb Derby
0f2390f7fb move SkRemoteGlyphCache.h to private
Chromium has been using the remote glyph cache for a few years now.
It's time to give it a proper home.

This is an intermediate CL. The old .h file includes the new .h file.
After I change the include paths in Chromium, I will delete the old
file.

Change-Id: Iaf00c46aa0698326c0bdec9a0eed218bcc3e334e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/482700
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2021-12-10 20:20:56 +00:00
John Stiles
1786647583 Improve debug trace generation speed by clipping the paint.
When generating a debug trace, we disable most optimizations, pessimize
the SkVM code with many additional instructions, and run the interpreter
instead of the SkVM JIT. Additionally, while under development, viewer
is generally compiled in -O0. All of these changes made it painfully
slow to generate the debug trace of a complex shader, even though we
only care about tracing a single pixel of the paint.

Now, when taking a debug trace, we clip the paint to a small 4x4 area
surrounding the trace coordinate for a single frame. This makes debug
traces run very quickly, even on a modest laptop CPU.

Change-Id: Ibcadc20a8d83a3a241e05408b8af31d61cf03d4c
Bug: skia:12666
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/482701
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-12-10 20:13:00 +00:00
John Stiles
45c9eab786 Update ImGui to v1.85.
Change-Id: Ia490c514722b3d23cbf54a5905d301272e7ef161
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/481856
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Jorge Betancourt <jmbetancourt@google.com>
Commit-Queue: Jorge Betancourt <jmbetancourt@google.com>
2021-12-09 15:10:31 +00:00
John Stiles
4898ac10f0 Sort GM/sample slides in Viewer.
Previously, GMs were displayed in a chaotic somewhat-alphabetical order,
and samples were displayed in a reverse somewhat-alphabetical order. Now
we actually sort them by name.

Additionally, switched to sk_make_sp to make sk_sp (in the spirit of
go/totw/126).

Change-Id: I94abd52d6f0ba65b6e23108f9f6aeed1c7ddf08f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/481678
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2021-12-08 22:52:58 +00:00
John Stiles
bc5b9f6b53 Migrate SK_strcasecmp to SkStringUtils.h.
This will let us use it elsewhere.

Change-Id: I39a5dc0651bee8fbd5fa7302e34a3a79f7efbd3d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/481736
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-12-08 22:52:04 +00:00
John Stiles
97119e5b3c Add "Write Debug Trace/Dump" buttons to SkSL slide in Viewer.
Click these buttons to trace execution of the current SkSL program.
This demonstrates end-to-end debug trace functionality in
SkRuntimeEffect.

Change-Id: I684099e337d1d275e444eb33dfa3a9e99343bb17
Bug: skia:12708
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/481336
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-12-08 16:17:26 +00:00
Ben Wagner
668995122f Fix when a glyph has a path
Always call generateMetrics before generatePath so that generateMetrics
can determine which glyph representation to use and if that glyph
representation can be modeled as a path.

Pass an allocator into generateMetrics so that it can set the path to
not existing. This allows generatePath to continue to work as it used
to, creating a path if any path is available. However, generateMetrics
may first set the path to not existing.

Update getPath and internalGetPath to use the path on the glyph if it
has already been set. Update makeGlyph and internalMakeGlyph to always
call generateMetrics first (which is now more like initGlyph).

Update the SkGlyph::PathData to indicate that it is a dev-path and not a
user-path. A user-path will have effects applied to it. A dev-path is
always a resolved path which is always filled -- unless it is hairline.

Update everything else for the knock on effects and to take advantage of
this information.

Bug: chromium:1266022
Change-Id: Id3f3cf5a534ab99f3a5779c910c1d1e191e68b1e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/478658
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2021-12-07 14:58:29 +00:00
Florin Malita
800aa13913 [viewer] Add color histogram
Change-Id: Ib3a4041a40de5925ebf98b325122acb3261a9d92
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/479436
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Florin Malita <fmalita@google.com>
2021-12-03 15:49:14 +00:00
Leandro Lovisolo
5a7d91c35b bloaty_treemap.py: Fix path/symbol name collisions; make symbols unique with _1, _2, ... instead of _x, _x_x, ...
This prevents google.visualization.TreeView errors I encountered while visualizing the output of bloaty against a debug build of dm.

This CL also changes the unique symbol naming scheme to use number suffixes for more human-friendly symbol names.

These changes will be reflected in the Golang port of bloaty_treemap.py (see https://skia-review.googlesource.com/c/buildbot/+/478216).

Bug: skia:12151
Change-Id: I798a8556cab4ecbcc22d960733b88eac990aa78e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/478636
Commit-Queue: Leandro Lovisolo <lovisolo@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: Leandro Lovisolo <lovisolo@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-12-01 21:38:55 +00:00
Kevin Lubick
6ba9f702ba [bazel] Try adding cc_binary rules that use generated rules
To make the atomic rules a bit easier to work with, in many
of the folders, this adds in cc_library rules to group
together the sources from that folder (and subfolders
where prudent). We only needs sources because those atoms
should have their headers as deps.

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

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

Change-Id: I3faa7c4e821c876b243617aacf0246efa524cbde
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/476219
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Leandro Lovisolo <lovisolo@google.com>
2021-11-30 18:18:53 +00:00
Nigel Tao
8c6df8cd99 Fix convert-to-NIA stillImage check
For example, this GIF image:
https://github.com/google/wuffs/blob/e44920d/test/data/artificial-gif/pixel-data-too-much-bad-lzw.gif
which is 'disassembled' here:
https://github.com/google/wuffs/blob/e44920d/test/data/artificial-gif/pixel-data-too-much-bad-lzw.gif.make-artificial.txt
only has one frame, regardless of how the GIF codec implementation deals
with the LZW-compression error. It is not an animated image.
Nonetheless, frameInfos.size() returns 1, not 0, so prior to this
commit, "stillImage = frameInfos.empty()" assigned false, not true.

See also this Wuffs (not Skia) commit:
3a9933f2a0

Bug: None
Change-Id: Ia69a486abe5c2caa7488c55a37c403e7660ff168
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/475436
Commit-Queue: Leon Scroggins <scroggo@google.com>
Reviewed-by: Leon Scroggins <scroggo@google.com>
2021-11-24 16:45:43 +00:00
Kevin Lubick
0260471f60 [infra] Update templates to use angle brackets
Change-Id: Ica3843fb71aea536bcf8647deaaf2df4f6005785
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/475717
Reviewed-by: Leandro Lovisolo <lovisolo@google.com>
2021-11-23 19:32:23 +00:00
Kevin Lubick
7f5b19bd69 More angle brackets for system includes for third_party deps
"In general anything in third_party should probably use angle brackets"

A follow-on from https://skia-review.googlesource.com/c/skia/+/474756

Change-Id: I4a2b07e1625952637c090a82971ab2ab426db034
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/475098
Reviewed-by: Brian Salomon <bsalomon@google.com>
2021-11-23 18:35:52 +00:00
Kevin Lubick
d4bcb486ef Change relative includes to be absolute
Having all includes to skia source will make generating
BAZEL rules easier.

Change-Id: I318dfc88e736a62da151098bebbee8d7b357d963
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/474736
Reviewed-by: Ben Wagner <bungeman@google.com>
2021-11-22 17:03:26 +00:00
Chris Dalton
9f1719f7f7 Move GrVertexColor to skgpu::VertexColor
Bug: skia:12524
Change-Id: Iac60a99331fefe9e997b61c4b2b329e39b95ae6e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/470197
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2021-11-20 02:48:28 +00:00
Brian Salomon
90ef83af20 Remove drawPatch/Vertices helpers that don't take SkBlendMode
Bug: skia:12662
Change-Id: Ic18220668a4f87e7340a53b3f191887a7a016a04
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/473141
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2021-11-18 21:57:32 +00:00
Kevin Lubick
888d4efa77 [canvaskit] Add Freetype/Fonts to Bazel Build
This re-works src/ports/BUILD.bazel to work like our other
BUILD files, i.e. one rule "srcs" that brings in the necessary
private filegroups.

To work around an abort with LLVM [1], we have to go back to an
earlier version of emscripten (temporarily?).

Future work should look at using transitions [2] to allow various
executables (e.g. CanvasKit, DM) to set their own set of Bazel
flags, w/o the build invokers having to specify them.

These transitions might be able to handle more complex cases
that we currently use if statements in GN to deal with.

The Freetype build rule was created by taking the BUILD.gn
rule, adding in all the sources listed there and then playing
compile-whack-a-mole to add in all the headers and included
.c files.

Suggested Review Order:
 - third_party/BUILD.bazel to see freetype build rules
 - bazel/common_config_settings/ to see treatment of fontmgr
   like codecs (many possible) and fontmgr_factory (only one).
 - src/ports/BUILD.bazel
 - BUILD.bazel
 - modules/canvaskit/BUILD.bazel. Take note of the gen_rule that
   calls tools/embed_resources.py to produce the .cpp file
   containing the embedded font data.
 - Everything else.

[1] https://github.com/emscripten-core/emscripten/issues/15528
[2] https://github.com/bazelbuild/examples/tree/main/rules/starlark_configurations/cc_binary_selectable_copts
Bug: skia:12541
Change-Id: I08dab82a901d80507007b354ca20cbfad2c2388f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/471636
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Leandro Lovisolo <lovisolo@google.com>
2021-11-17 13:06:35 +00:00
Kevin Lubick
0566f5d93a [infra] Make git-sync-deps truncate directory from beginning
Instead of seeing something not super helpful like:
/home/kjlubick/skia/skia/third_pa... @ 169895d529dfce00390a20e69c2f516066fe7a3b

With this change, that becomes:
...rd_party/externals/d3d12allocator @ 169895d529dfce00390a20e69c2f516066fe7a3b

Change-Id: Ie5483a5540f408719f797efdcb50d24b97b568fd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/471456
Reviewed-by: Ben Wagner <bungeman@google.com>
2021-11-15 15:36:07 +00:00
Brian Salomon
384ba65b8d Remove GPU V2
Replaced by Graphite.

Change-Id: Iac0ba212b078904a591677c9ce839a90562d0240
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/470305
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2021-11-11 17:11:19 +00:00
Brian Osman
a583a0fdcc In SkRuntimeEffect, replace ConstIterable with SkSpan
Change-Id: Ibeea56ebd5dce53af1252ca3ecf6cc6f010bd461
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/469902
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-11-10 21:09:58 +00:00
Brian Osman
a45c93c505 Add a color-spin control to Viewer
This cycles the primaries, just like SkColorSpace::makeColorSpin.
Helpful for debugging more exotic color space issues.

Change-Id: I3434c7a9f24642f13be0ac3513599a15247d1f6f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/469360
Auto-Submit: Brian Osman <brianosman@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2021-11-09 21:15:04 +00:00
Kevin Lubick
1f8c31b101 [infra] Add initial Bazel rules and files
These rules can be used to build our GMs on WASM+WebGL and
libskia.a with just the CPU backend (and most other features
turned off).

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

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

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

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

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

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

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

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

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

Change-Id: Ieecf9c106d5e3a6ae97d13d66be06b4b3c207089
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/458637
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Leandro Lovisolo <lovisolo@google.com>
Owners-Override: Kevin Lubick <kjlubick@google.com>
2021-11-09 12:32:25 +00:00
Kevin Lubick
54ab0dcfed Fix #ifdef SK_SUPPORT_GPU to be #if
We define this to be 1 or 0, so #ifdef is not what
was intended.

Change-Id: I0182718980c39dced98bf90255703a6f080f9cac
Bug: skia:12584
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/468956
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
2021-11-08 15:14:28 +00:00
Brian Osman
f8b3e0c50e Add disassembly to skvm debug panel
Change-Id: Ic110ea129cf902d8d1a87c6133e71a1fdeb366f6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/468376
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Julia Lavrova <jlavrova@google.com>
2021-11-05 17:09:44 +00:00
Brian Osman
88117ab843 Improve the skvm debug panel
Use SkVMBlitter::DebugName for the string. This is easier to read, and
has some actually useful information about the blitter.

Added magenta highlight of the hovered element, similar to the GPU.

Change-Id: Ic9b5a0f61e092c8aa555f375d5d2f2de22cc45fe
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/467977
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-11-04 21:02:21 +00:00
Brian Osman
fa6e45f261 Add an SkVM panel to viewer's debug UI
Caveats:
  - You want to run viewer with `--skvm` to see much/anything
  - The cache is LRU, and doesn't get flushed automatically. Hitting
    'Clear' will flush it, so it will pick up only the blitters used
    on the current slide. (Otherwise they accumulate as you navigate).
  - No way to determine which blitter is for which primitive, yet.
    I'd like to do the GPU-style magenta highlight, but that may be
    tricky, because we need to preserve the semantics of the original
    blitter (including destination color type, most importantly).

Change-Id: I2df763fdb697d87471ca0816a3b7087ffb4fc4e4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/467783
Reviewed-by: Herb Derby <herb@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-11-04 16:49:53 +00:00
Dominik Röttsches
8be6332748 Serialize foreground color caching requirement specialisation
Add a getter to SkTypeface to provide information on whether it
needs access to the foreground color (in COLR fonts) so that the
strike cache can determine caching requirements.

Since remote SkTypefaces do not have access to table information,
implement this as a serializable flag, with font-blob backed
implementations being able to return this based on whether they
have a COLR table or not, starting with FreeType.

Preparation for supporting foreground color in FreeType COLR
rasterisation.

Bug: skia:12576
Change-Id: I7e71b0ec12e17f652ab7b43adffc43bc780ce2e7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/466936
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2021-11-03 19:56:47 +00:00
Kevin Lubick
3a9a7991c4 Move sk_memset* from SkUtils to SkOpts
This is a (hopefully) more careful reland of parts of
https://skia-review.googlesource.com/c/skia/+/464876

Change-Id: I32dd6777a70d983d8a66a4bf9557cab6e3d7ebc2
Bug: skia:12584
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/467124
Reviewed-by: Greg Daniel <egdaniel@google.com>
2021-11-03 17:03:21 +00:00
Kevin Lubick
e0ee095fa2 Move UTF16 helpers from SkUtils to SkUTF
Also delete the unused/deprecated functions
 - SkUTF8_NextUnichar
 - SkUTF16_NextUnichar
 - SkUTFN_CountUnichars
 - SkUTFN_Next

Change-Id: Icbcc6961cbc3112af6794742af03adb14369c45d
Bug: skia:12584
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/467123
Reviewed-by: Ben Wagner <bungeman@google.com>
2021-11-03 17:03:21 +00:00
Kevin Lubick
3b9113f110 Only include SkJSONWriter when SK_ENABLE_DUMP_GPU defined
Also fix some missing includes in:
 - src/gpu/effects/GrPorterDuffXferProcessor.cpp
 - src/gpu/GrDirectContext.cpp
 - tools/DDLPromiseImageHelper.h

Change-Id: I1b30827e1442fd01534427b52549f8775300b365
Bug: skia:12584
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/466876
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
2021-11-02 16:17:17 +00:00
Greg Daniel
b3ecd560a2 Revert "Move GR_MAKE_BITFIELD_OPS and GrAlignTo to non-GPU files"
This reverts commit 65a726bb49.

Reason for revert: You cannot include a src file in an include file. This ends up using c++17 features in our includes. Breaks rolls.

Original change's description:
> Move GR_MAKE_BITFIELD_OPS and GrAlignTo to non-GPU files
>
> These have been renamed SK_MAKE_BITFIELD_OPS and SkAlignTo
> because nothing seemed particularly GPU/Ganesh specific to them.
>
> I moved the latter to SkTypes.h because we have other align
> code there and former to src/SkUtils.h because I didn't know
> where else it should go.
>
> The primary motivation was removing the GrTypesPriv.h
> include from src/core/SkBlockAllocator.h. I had attempted
> some amount of #if SK_SUPPORT_GPU, but that's not as clean
> here because both our CPU and GPU backends use the
> SkBlockAllocator (as far as I could tell).
>
> This also moves sk_memset* from SkUtils.h to SkOpts.h, because
> SkOpts.h requires bringing in RasterPipeline, which seemed
> like overkill.
>
> Change-Id: I5163ef5064ad3840a15b7e873930d60e2620bf9d
> Bug: skia:12584
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/464876
> Reviewed-by: Brian Osman <brianosman@google.com>

Bug: skia:12584
Change-Id: I1b772bbbc6f150d737bb53fa4e5f45d1581929fa
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/465376
Auto-Submit: Greg Daniel <egdaniel@google.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2021-10-29 12:50:09 +00:00
Kevin Lubick
65a726bb49 Move GR_MAKE_BITFIELD_OPS and GrAlignTo to non-GPU files
These have been renamed SK_MAKE_BITFIELD_OPS and SkAlignTo
because nothing seemed particularly GPU/Ganesh specific to them.

I moved the latter to SkTypes.h because we have other align
code there and former to src/SkUtils.h because I didn't know
where else it should go.

The primary motivation was removing the GrTypesPriv.h
include from src/core/SkBlockAllocator.h. I had attempted
some amount of #if SK_SUPPORT_GPU, but that's not as clean
here because both our CPU and GPU backends use the
SkBlockAllocator (as far as I could tell).

This also moves sk_memset* from SkUtils.h to SkOpts.h, because
SkOpts.h requires bringing in RasterPipeline, which seemed
like overkill.

Change-Id: I5163ef5064ad3840a15b7e873930d60e2620bf9d
Bug: skia:12584
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/464876
Reviewed-by: Brian Osman <brianosman@google.com>
2021-10-28 18:18:47 +00:00
Robert Phillips
b421a71f37 [graphite] Expand shader precompilation placeholder
Bug: skia:12466
Change-Id: If633ce39c8f45b1ee3c042b5b72d7e0f95ca5c19
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/459597
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-10-27 18:43:52 +00:00
Greg Daniel
c75e0ef2b3 [graphite] Add IndexWriter and UniformWriter classes.
This also adds a base class BufferWriter which Vertex, Index, and
Uniform Writers inherit from

Bug: skia:12466
Change-Id: Icbac1210fbbd07321f9d88728ddde1e761fe4bb0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/463496
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Chris Dalton <csmartdalton@google.com>
2021-10-27 00:20:38 +00:00
Chris Dalton
52aee23ded GrVertexWriter -> skgpu::VertexWriter
This class can now be shared with Graphite.

Bug: skia:12524
Change-Id: I7841410b3e8e111a12298efe0a1898a33295873a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/462556
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2021-10-25 17:25:02 +00:00
Kevin Lubick
7ce380e967 [canvaskit] Remove deprecated MakeTypefaceFromData and RefDefault
Change-Id: I0072fa5c11834a6250f2f5b9290ecea0d30f2128
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/462177
Reviewed-by: Leandro Lovisolo <lovisolo@google.com>
2021-10-21 16:45:42 +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
John Stiles
b19be63810 Fix ODR violation in Metal code.
In places where we use GR_METAL_SDK_VERSION to determine the contents of
a class, it's important to consistently #include the header which sets
the value of GR_METAL_SDK_VERSION.

Change-Id: Ic4824ff36c982d3493ebec03dd38465bb90b287a
Bug: skia:12513
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/461836
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2021-10-20 21:33:32 +00:00
Chris Dalton
aa0600136c Extract ToolUtils::sniff_paths
Makes the path sniffing code from BisectSlide reusable.

Change-Id: I21c1e752590359c557c35804e5d5044d8041a308
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/460637
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2021-10-19 17:39:11 +00:00
Michael Ludwig
75310f0c3f Experimental support for lower-resolution backdrop filter eval
Bug: b/197774543
Change-Id: Ic441387a5a48a4bea7eb508cf53e7f88851ec5f2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/453316
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-10-18 14:46:05 +00:00
Kevin Lubick
8f4e560871 Use CommonFlags namespace for other flags/functions
This consolidates tools/flags/CommonFlagsFontMgr.h into
tools/flags/CommonFlags.h and adds all those common
flags into the CommonFlags namespace.

I also cleaned up a few unused includes in DM.cpp

Change-Id: I1d1bf6598dfb87619b6abbb9faa1e24631f76fb4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/459476
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
2021-10-14 14:34:21 +00:00
Kevin Lubick
237dd2d94d Move --nativeFonts to CommonFlags file
Also noticed while trying to build GMs in WASM with
Bazel.

Change-Id: I33d467a0da0893c1a5e376f4fd1a6096dad48af3
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/459198
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2021-10-14 12:57:29 +00:00
Kevin Lubick
f541ddf785 Move ToolUtils::make_big_path() to bench/
The ToolUtils file is getting a bit bloated, IMO. I noticed this when
working on Bazel includes.

Including non-header files is a small nuisance in Bazel, so it
is probably better to just make it its own compilation unit.

Change-Id: I06ca3808a37ebef6478f5afa3f14086429899590
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/459197
Reviewed-by: Ben Wagner <bungeman@google.com>
2021-10-14 12:57:29 +00:00
Jim Van Verth
9467361423 [graphite] Fix commandqueue memory leak
Bug: skia:12466
Change-Id: Icbd4fd6098c8a50164613e630db476bf8ea41517
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/459177
Auto-Submit: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-10-13 19:42:51 +00:00
Robert Phillips
c005895e76 Name Test struct's member variables consistently
Change-Id: Ie853618fb496a77ffb79d6669f87048260df68b7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/458979
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-10-13 17:37:39 +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
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
7bb0ff05ce [graphite] Add support to Mac Viewer.
Adds a type enum to WindowContext to determine which kind of
GPU context (GrDirectContext or skgpu::Context) we're using.

Bug: skia:12466
Change-Id: I288878740392a43cd9e82c925fbe2c372d140dc5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/454699
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2021-09-30 21:38:25 +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
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
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
Greg Daniel
84261653c5 Reland "Add new GrSurfaceInfo class and related backend structs."
This is a reland of 6aac1193a7

Original change's description:
> Add new GrSurfaceInfo class and related backend structs.
>
> Bug: skia:12402
> Change-Id: I45b2f71dcfa5843e2a19a8de7d34196a4d552905
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/445176
> Commit-Queue: Greg Daniel <egdaniel@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>

Bug: skia:12402
Change-Id: Id540bea408d72ceba43ec4245c3748d630121926
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/450277
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2021-09-20 20:44:53 +00:00
Jim Van Verth
2f7ee02577 Revert "Add new GrSurfaceInfo class and related backend structs."
This reverts commit 6aac1193a7.

Reason for revert: Breaking Mac bots in Chromium roll. Looks like
they depend on getVkImageInfo for an unknown reason, and it's 
hidden behind SK_VULKAN.

Original change's description:
> Add new GrSurfaceInfo class and related backend structs.
>
> Bug: skia:12402
> Change-Id: I45b2f71dcfa5843e2a19a8de7d34196a4d552905
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/445176
> Commit-Queue: Greg Daniel <egdaniel@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>

Bug: skia:12402
Change-Id: I3c9642354dae8c955bc58d281700536393f84519
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/450199
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2021-09-18 16:35:38 +00:00
Greg Daniel
6aac1193a7 Add new GrSurfaceInfo class and related backend structs.
Bug: skia:12402
Change-Id: I45b2f71dcfa5843e2a19a8de7d34196a4d552905
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/445176
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2021-09-18 00:41:07 +00:00
Eric Boren
14cc21fd99 [sk] Update asset download references to use SK
Change-Id: If3e838f22f1b99fd7a3b1c6bca0affd39f5573b0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/449843
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Eric Boren <borenet@google.com>
2021-09-17 16:55:53 +00:00
John Stiles
e7830650cb Update bloaty treemap to work on Python < 3.9.
`removeprefix` was only added to Python in March 2020. It isn't
available on Python 3.8.2, which is the default macOS Python installed
version.
https://www.python.org/dev/peps/pep-0616/

Change-Id: I7b8db0dfc55f1448cc72f41ba9a6ad5f099d48ef
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/448259
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-09-13 17:20:49 +00:00
Florin Malita
2e4dc863da Fix skottie2movie gpu async crash
We need to ensure all async reads are completed before we finish
encoding -- otherwise late reads will fire from the GrContext destructor
and crash because the encoder is no longer valid.

Change-Id: I0065561d2411ddd202897e625a187592e40ced87
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/447184
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2021-09-11 15:49:19 +00:00
Michael Ludwig
ecc555540b Only terminate egl display once
Unblocks angle roller into skia that was triggering an assert in
EGLImageTest. In that test, there were two egl contexts created that
shared the same egl display. The child context was destroyed first,
and ANGLEGLContext's destroyGLContext() implementation always called
eglTerminate on the display. According to the egl spec you're not
supposed to do anything with the terminated display other than call
makeCurrent() to release any active context.

In this case, the child context's termination would cause the display
to be deferred until the parent context was destroyed. This triggered
a bug in ANGLE's D3D backend, leading to the assert. However, with
that fixed, we then trigger critical error messages about calling
eglDestroySurface, etc. in the parent context's destroyGLContext()
function since the display was terminated out from beneath it.

This change adds a rudimentary ownership tracking mechanism to the
ANGLEGLContext so that when a child context is cleaned up it won't
call eglTerminate on its display. This happens to avoid the bug in
ANGLE's D3D backend as well as silencing the critical warnings if it
were fixed.

Bug: skia:12413
Change-Id: I31f64189315a1921adbee204d11138272d4b40af
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/446182
Commit-Queue: Robert Phillips <robertphillips@google.com>
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-09-07 23:48:46 +00:00
Brian Osman
cbfa34a58c Convert internal SkSL to use .eval()
Also update RELEASE_NOTES to describe new syntax.

Change-Id: I2666551b98f80b61ae3a48c92a9e306cdc7242b0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/444735
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2021-09-03 15:54:54 +00:00
Robert Phillips
46d7bd56f6 Move more Ops to skgpu::v1 namespace (take 2)
GrClearOp
GrDashOp

Bug: skia:11837
Change-Id: I9ada76c061154e769e7f486e7c57a93fd1d74907
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/444636
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-09-01 18:57:02 +00:00
Robert Phillips
2af13c135b Reland "Fix compilation w/ "skia_enable_svg = false" (take 2)"
This reverts commit 44b7568c8a.

Reason for revert: Google 3 CL has landed

Original change's description:
> Revert "Fix compilation w/ "skia_enable_svg = false" (take 2)"
>
> This reverts commit 30a6b101f4.
>
> Reason for revert: Maybe blocking G3 roll?
>
> Original change's description:
> > Fix compilation w/ "skia_enable_svg = false" (take 2)
> >
> > Change-Id: I036ae171809af56cc9594704b44705ebd095ec80
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/443898
> > Reviewed-by: Florin Malita <fmalita@chromium.org>
> > Commit-Queue: Robert Phillips <robertphillips@google.com>
>
> TBR=robertphillips@google.com,fmalita@chromium.org,fmalita@google.com,skcq-be@skia-corp.google.com.iam.gserviceaccount.com
>
> Change-Id: Ibee3819e073b04efdf9736058c1f9b288249620c
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/444216
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Commit-Queue: Robert Phillips <robertphillips@google.com>

# Not skipping CQ checks because this is a reland.

Change-Id: Idf73d864108067ee1c34e88ee4e5236847abd582
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/444501
Reviewed-by: Florin Malita <fmalita@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-09-01 17:54:08 +00:00
Robert Phillips
5fe828accb Revert "Move more Ops to skgpu::v1 namespace"
This reverts commit f3158abda3.

Reason for revert: Broke Flutter build

Original change's description:
> Move more Ops to skgpu::v1 namespace
>
> GrClearOp
> GrDashOp
>
> Bug: skia:11837
> Change-Id: Ib65418952e7d4fb1e419e4942223823f22302b34
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/443518
> Reviewed-by: Michael Ludwig <michaelludwig@google.com>
> Commit-Queue: Robert Phillips <robertphillips@google.com>

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

Change-Id: Ic181ced7f5f2a8ff834fdcfb4e5265b99eef1666
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:11837
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/444365
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-09-01 14:44:46 +00:00
Robert Phillips
f3158abda3 Move more Ops to skgpu::v1 namespace
GrClearOp
GrDashOp

Bug: skia:11837
Change-Id: Ib65418952e7d4fb1e419e4942223823f22302b34
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/443518
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-09-01 14:03:55 +00:00
Robert Phillips
44b7568c8a Revert "Fix compilation w/ "skia_enable_svg = false" (take 2)"
This reverts commit 30a6b101f4.

Reason for revert: Maybe blocking G3 roll?

Original change's description:
> Fix compilation w/ "skia_enable_svg = false" (take 2)
>
> Change-Id: I036ae171809af56cc9594704b44705ebd095ec80
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/443898
> Reviewed-by: Florin Malita <fmalita@chromium.org>
> Commit-Queue: Robert Phillips <robertphillips@google.com>

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

Change-Id: Ibee3819e073b04efdf9736058c1f9b288249620c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/444216
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-08-31 22:31:00 +00:00
Robert Phillips
30a6b101f4 Fix compilation w/ "skia_enable_svg = false" (take 2)
Change-Id: I036ae171809af56cc9594704b44705ebd095ec80
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/443898
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-08-31 18:28:25 +00:00
Robert Phillips
31f763190f Move GrAtlasTextOp to skgpu::v1 namespace
Bug: skia:11837
Change-Id: I3dde13940e57763d5a8224cb1a4b555e904351d7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/442716
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-08-30 14:56:55 +00:00
Robert Phillips
2145390fbe Move GrTextureOp to skgpu::v1 namespace
Bug: skia:11837
Change-Id: Ie99b1c512885404351d6917bbea751d99a2ca23e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/442797
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-08-30 14:14:14 +00:00
Brian Osman
99ddd2a98d Remove (unused) geometry shader support
Bug: skia:8451 skia:10827
Change-Id: I5b38a1d72cd4558f8e2a92aaf9b12f05efce0923
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/442683
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2021-08-27 19:41:10 +00:00
Chris Dalton
2a26c50a62 Store the correct number of samples in GrProgramInfo
Bug: skia:11396
Change-Id: I9480b89635bd7a6bdff8ab4876c8eeafdbc27c8b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/442096
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2021-08-26 17:24:47 +00:00
Kevin Lubick
f611404816 [canvaskit] Remove the need for users to keep track of contexts.
We'll switch to the correct context when necessary (e.g. before
calls that talk to the GPU). This is achieved by adding in
calls at the JS layer to switch the context before making a call
that is known to talk to the GPU (e.g. draw calls on SkCanvas).

Another implementation that was considered was to add a C++
shim in GrGLInterface that would switch the context before
every call in the GPU - however, that seemed too difficult
and would add extra overhead if a single draw* call talks
to the GPU multiple times.

Bug: skia:12255
Change-Id: I96e4c6b41a5bfcc9913aeaca7ccb125358048ad3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/432136
Reviewed-by: Brian Salomon <bsalomon@google.com>
2021-08-25 18:23:06 +00:00
Robert Phillips
24d622d6f9 Move the GrTessellationPathRenderer into the skgpu::v1 namespace
Bug: skia:11837
Change-Id: Ic445e99adbe2d2ada64f98f9f516c198a247ef09
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/440876
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-08-25 17:16:28 +00:00
Greg Daniel
1e16937f47 Add more flexibility to GrVkRT to support DMSAA.
Support is added so we can differentiate between using discardable
msaa for normal msaa draws and using it for DMSAA. Before this
many asserts and checks throughout GrVk* assumed we could only have
discardable msaa if the actual render target was msaa.

After this change the only thing missing to enable DMSAA on Vulkan
is to fix GrProgramInfo to store the actual sample count the program
will use instead of the same count of the GrRenderTarget.

Change-Id: Ifdb9a3beb641f96f6dfebe3241ccc5a2c8770bb3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/441517
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2021-08-25 14:09:27 +00:00
Brian Osman
293497e77f Convert internal sample() calls to shade/filter/blend
Bug: skia:12302
Change-Id: I8cf958acf9214d0de903a4097647afd74f2a659e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/441541
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-08-24 21:03:44 +00:00
Brian Osman
9f1e06aef9 Reland "Add sRGB 8888 colortype"
This is a reland of 0f7c10ef56

Original change's description:
> Add sRGB 8888 colortype
>
> A color type that linearizes just after loading, and re-encodes to sRGB
> just before storing, mimicking the GPU formats that work the same way.
>
> Notes:
>   - No mipmap support
>   - No SkPngEncoder support (HashAndEncode's .pngs are ok, though?)
>   - Needs better testing
>
> This is a re-creation of reviews.skia.org/392990
>
> Change-Id: I4739c2280211e7176aae98ba0a8476a7fe5efa72
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/438219
> Commit-Queue: Brian Osman <brianosman@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>

Change-Id: I5b6bb28c4c1faa6c97fcad7552d12c331535714d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/441402
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-08-24 12:56:32 +00:00
Brian Osman
405eb7b72f Revert "Add sRGB 8888 colortype"
This reverts commit 0f7c10ef56.

Reason for revert: Unhappy rollers

Original change's description:
> Add sRGB 8888 colortype
>
> A color type that linearizes just after loading, and re-encodes to sRGB
> just before storing, mimicking the GPU formats that work the same way.
>
> Notes:
>   - No mipmap support
>   - No SkPngEncoder support (HashAndEncode's .pngs are ok, though?)
>   - Needs better testing
>
> This is a re-creation of reviews.skia.org/392990
>
> Change-Id: I4739c2280211e7176aae98ba0a8476a7fe5efa72
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/438219
> Commit-Queue: Brian Osman <brianosman@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>

TBR=bsalomon@google.com,robertphillips@google.com,brianosman@google.com,reed@google.com,skcq-be@skia-corp.google.com.iam.gserviceaccount.com

Change-Id: Ie199535b9b65ec7c7fef3c773452ea06bdbd2d9c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/441376
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-08-23 17:38:05 +00:00
Brian Osman
0f7c10ef56 Add sRGB 8888 colortype
A color type that linearizes just after loading, and re-encodes to sRGB
just before storing, mimicking the GPU formats that work the same way.

Notes:
  - No mipmap support
  - No SkPngEncoder support (HashAndEncode's .pngs are ok, though?)
  - Needs better testing

This is a re-creation of reviews.skia.org/392990

Change-Id: I4739c2280211e7176aae98ba0a8476a7fe5efa72
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/438219
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2021-08-23 15:14:41 +00:00
Robert Phillips
e453fa063d Move some v1-only gpu/tessellate files to gpu/ops
This CL just moves the files and renames them. It doesn't move them into the skgpu::v1 namespace.

Bug: skia:11837
Change-Id: Iab322d0dc5b5d1cfd32436785081539dc85c18d3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/440776
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Chris Dalton <csmartdalton@google.com>
2021-08-19 19:56:46 +00:00
Robert Phillips
43e70f1913 Move 2 path renderers to skgpu::v1 namespace
Bug: skia:11837
Change-Id: I71c8e5b7221e0eb84400e0ddc1a8126d820d24bb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/440538
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2021-08-19 16:16:23 +00:00
Robert Phillips
832f3fbcae Move GrTessellationPathFlags to their own header (GrTessTypes.h)
Having this enum on GrTessellationPathRenderer forced it to be over-#included and was blocking making GrTessellationPathRenderer.h v1-only.

Bug: skia:11837
Change-Id: I80660ed659946d7aa555057c9f4fd1136b44cca0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/440536
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-08-19 14:47:45 +00:00
Brian Osman
fcb5023819 Remove old color space configs from tools
This centralizes the new color-space parsing into SkCommandLineConfig,
and then wires that up in DM, nanobench, and skpbench. It also removes
all of the old config names that encoded both color type and space.

Change-Id: I9a63a97f1d153e7636a1fb974cc4071f5ada3184
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/438377
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-08-18 14:34:44 +00:00
John Stiles
4498aa8ac7 Fix rewrite_includes to work in both Python 2 and 3.
This is patterned after http://review.skia.org/439776, but uses the
`six` library for Python 2/3 cross-compatibility.

Change-Id: If64c48c35d86b83c77316bb5536be6e7bd24c967
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/439936
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2021-08-17 11:53:50 +00:00
Brian Osman
9ded59bbad Revert "Update rewrite_includes.py for python3"
This reverts commit bd40fb55bb.

Reason for revert: I give up.

Original change's description:
> Update rewrite_includes.py for python3
>
> Change-Id: Ib1b6f8c17554f8121bd2351b5b214e1b2a79f758
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/439776
> Reviewed-by: Kevin Lubick <kjlubick@google.com>
> Commit-Queue: Brian Osman <brianosman@google.com>

TBR=kjlubick@google.com,brianosman@google.com,skcq-be@skia-corp.google.com.iam.gserviceaccount.com

Change-Id: I6be08249f805cce00d35e28e457fe5628b447629
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/439940
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-08-16 21:31:04 +00:00
Brian Osman
bd40fb55bb Update rewrite_includes.py for python3
Change-Id: Ib1b6f8c17554f8121bd2351b5b214e1b2a79f758
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/439776
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-08-16 19:07:20 +00:00
John Stiles
13c9f6690e Fix additional cases of variable shadowing.
These changes will allow us to enable shadowed-variable warnings.

Change-Id: I24ee7e198c1c77b58836237c37557c00452680e1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/439476
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2021-08-16 17:47:14 +00:00
Greg Daniel
0e9d34d33c Reland "Remove GrBackendFormat's textureType use from isFormatTexturable call."
This reverts commit d90777ada3.

Reason for revert: relanding with fix to GrBackendTexture

Original change's description:
> Revert "Remove GrBackendFormat's textureType use from isFormatTexturable call."
>
> This reverts commit 832c817bc8.
>
> Reason for revert: uninitialized value in GrBackendTexture
>
> Original change's description:
> > Remove GrBackendFormat's textureType use from isFormatTexturable call.
> >
> > The goal of this change was to remove the use of GrBackendFormat::textureType()
> > from GrCaps::isFormatTexturable call. Instead we will always pass in a
> > GrTextureType into this call.
> >
> > To do this a lot of plumbing of GrTextureType was added to various call
> > sites. However, this CL halts the plubming up at the proxy level where we
> > get it from the GrBackendFormat still. Future CLs will continue removing
> > these call sites and others that use GrBackendFormat::textureType().
> >
> > Bug: skia:12342
> > Change-Id: Ic0f02b9c7f7402405623b8aa31aa32a9a7c22297
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/439277
> > Commit-Queue: Greg Daniel <egdaniel@google.com>
> > Reviewed-by: Brian Salomon <bsalomon@google.com>
>
> TBR=egdaniel@google.com,bsalomon@google.com,skcq-be@skia-corp.google.com.iam.gserviceaccount.com
>
> Change-Id: I354bbbf00be7a86c480009f3e7b36a8777a6bf3a
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:12342
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/439338
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Commit-Queue: Greg Daniel <egdaniel@google.com>

# Not skipping CQ checks because this is a reland.

Bug: skia:12342
Change-Id: I151196f149f9e191d2975b8fe81334f4f8720744
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/439339
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2021-08-13 22:37:13 +00:00
Robert Phillips
364ea352b0 Make remaining GrOp derived classes be skgpu::v1 only
I will follow up with a CL actually moving the newly V1-only files to their final homes and adding namespaces.

Bug: skia:11837
Change-Id: I0fed1a802ae93a4357c53cde2b665ad6ddb49a6f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/418996
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-08-13 20:21:15 +00:00
Greg Daniel
d90777ada3 Revert "Remove GrBackendFormat's textureType use from isFormatTexturable call."
This reverts commit 832c817bc8.

Reason for revert: uninitialized value in GrBackendTexture

Original change's description:
> Remove GrBackendFormat's textureType use from isFormatTexturable call.
>
> The goal of this change was to remove the use of GrBackendFormat::textureType()
> from GrCaps::isFormatTexturable call. Instead we will always pass in a
> GrTextureType into this call.
>
> To do this a lot of plumbing of GrTextureType was added to various call
> sites. However, this CL halts the plubming up at the proxy level where we
> get it from the GrBackendFormat still. Future CLs will continue removing
> these call sites and others that use GrBackendFormat::textureType().
>
> Bug: skia:12342
> Change-Id: Ic0f02b9c7f7402405623b8aa31aa32a9a7c22297
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/439277
> Commit-Queue: Greg Daniel <egdaniel@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>

TBR=egdaniel@google.com,bsalomon@google.com,skcq-be@skia-corp.google.com.iam.gserviceaccount.com

Change-Id: I354bbbf00be7a86c480009f3e7b36a8777a6bf3a
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:12342
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/439338
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2021-08-13 20:05:32 +00:00
Greg Daniel
832c817bc8 Remove GrBackendFormat's textureType use from isFormatTexturable call.
The goal of this change was to remove the use of GrBackendFormat::textureType()
from GrCaps::isFormatTexturable call. Instead we will always pass in a
GrTextureType into this call.

To do this a lot of plumbing of GrTextureType was added to various call
sites. However, this CL halts the plubming up at the proxy level where we
get it from the GrBackendFormat still. Future CLs will continue removing
these call sites and others that use GrBackendFormat::textureType().

Bug: skia:12342
Change-Id: Ic0f02b9c7f7402405623b8aa31aa32a9a7c22297
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/439277
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2021-08-13 19:03:21 +00:00
Robert Phillips
06273bcb8a Prepare headers for making all ops V1-only
Basically, ensure all the headers about to become V1-only only appear in contexts that are currently or will soon be V1-only.

This is almost all fallout from retracting some of the moving headers from other headers i.e.:

GrMeshDrawOp.h from GrOpFlushState.h
GrDrawOp.h from GrOpsRenderPass.h
GrDrawOp.h from GrOpsTask.h
GrSimpleMeshDrawOpHelper.h from GrTessellationShader.h


Bug: skia:11837
Change-Id: I939f5c82c3042e9ab00571b5796ab82dbe968085
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/438677
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-08-12 15:09:11 +00:00
Greg Daniel
f4e176b98e Update Skia's internal vulkan headers to 1.2.
This is needed so we can support VK_EXT_image_drm_format_modifier. These
headers are just used internally in Skia so this should have no effect
on anyone using Skia.

Bug: skia:12336
Change-Id: I502f8e7dbbeb8e48ff03fb7ef0e5db3e8bcbb40d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/438737
Reviewed-by: Brian Salomon <bsalomon@google.com>
2021-08-12 14:58:05 +00:00
Brian Salomon
4895946078 Move ProgramImpl definitions into Processor subclass headers.
Move ProgramImpl function definitions into Processor subclass cpp files.

Delete separate h/cpp files.

Modify GrGLSLVaryingHandler::addPassThroughAttribute to break #include
cycle. It now takes a ShaderVar rather than a GP::Attribute, making
it slightly more flexible as the input can be any variable defined
in the vertex shader.

Bug: skia:11358
Change-Id: I94ee8cd44d29e194216592ecae5fd28de785c975
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/438596
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2021-08-11 19:45:56 +00:00
Brian Salomon
bab2d11891 Improve consistency of GP::ProgramImpl subclasses
Named "Impl" and nested in GP or makeProgramImpl definition.

Remove unused INHERITED typedefs.

Remove GenKey pattern.

Bug: skia:11358
Change-Id: Icb4d5a0844184f51d92135de6cee6f6e77f57a5e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/438478
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2021-08-11 16:52:09 +00:00
John Stiles
488654b839 Fix cases of variable shadowing in /tools/.
If we manage to fix all the existing cases of variable shadowing, we
could enable -Wshadow.

(Turtle.cpp is #included from a cpp in the tools directory.)

Change-Id: I1685086ec0ceae1d51efa7daa0f46137b535ce77
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/438476
Reviewed-by: Jorge Betancourt <jmbetancourt@google.com>
Commit-Queue: Jorge Betancourt <jmbetancourt@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2021-08-11 16:05:52 +00:00
Ben Wagner
160cd4b53c Fix leaks in skdiff
The skdiff code leaks some file names. Instead of augmenting the
existing manual ownership, give everything an owner.

Change-Id: I8bc2cb39ad4176bb3be645710ae28271f5b12ff9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/437000
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2021-08-11 14:52:41 +00:00
Robert Phillips
53eaa64873 Rename GrSurfaceContext -> skgpu::SurfaceContext
Almost entirely mechanical.

Bug: skia:11837
Change-Id: I984339097fdeeae2eccb6c1d790d510020511961
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/438177
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-08-10 19:24:53 +00:00
Brian Osman
68556bc798 Move canvas helper structs to header
This is necessary cleanup before changing the type of the matrix and
clip stack. That work has landed and reverted several times, so landing
this piece separately, first.

Change-Id: I147e4cc4260fa5e07a0712503f879da120f8466a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/435278
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-08-10 17:53:16 +00:00
Brian Salomon
f95940bc23 Rename GrGLSLGeometryProcessor to GrGeometryProcessor::ProgramImpl
return from GrGP by unique_ptr, rename factory function to
makeProgramImpl()

Bug: skia:11358

Change-Id: I61dd36f770d2fc0b54de0e0e7b78ac4d3fbd119a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/437741
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2021-08-10 14:36:40 +00:00
Michael Ludwig
49914e5813 Avoid unnecessary setting of display params in Viewer
I noticed Viewer lagging significantly when interacting with certain
sliders (such as transform state). It turns out that the UI tracking
would trigger calling Window::setRequestedDisplayParams and that in
turn can trigger a full context recreation, depending on backend.

I'd recently changed GPUs in my machine and apparently its context
creation is substantially slower than my previous one. Historically
I noticed minor jank when interacting, but it was never a deal
breaker.

This splits the parameter tracking into two categories so that lighter
weight widgets can still trigger window invalidation / re-rendering,
without triggering the context creation.

Change-Id: I3eb4c15b802f8b8ea8d8eca386de5dcee22ba9ec
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/437685
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2021-08-09 17:38:28 +00:00
Brian Salomon
13b287386a Remove GLSL from name of functions that builds GrProcessor keys.
Bug: skia:11358
Change-Id: Ie70e45b18c12126c8e86700ad1040bc319be385a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/436998
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2021-08-09 14:01:13 +00:00
Michael Ludwig
a0438e6604 Remove SK_SUPPORT_DEPRECATED_CLIPOPS and expanding clip op defs
Bug: skia:10209
Change-Id: I72639b7e768742dcdec810a5a714ce21ff0f6e0a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/436565
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2021-08-06 19:15:13 +00:00
Brian Salomon
54fd96b5fa Fix Wunused-but-set-variable warnings
Change-Id: I0e093fd35b11e9a765ef9c09f3b6346086ff66bf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/435983
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2021-08-05 21:49:18 +00:00
Ben Wagner
a3f996c70d Fix skia_use_gl = false build
Fix a number of warnings as errors about unused private methods when
skia_use_gl is set to false and SK_GL is not set.

Change-Id: Idcc08a1434ec11a6ce9c8df034c9fa472bf08d08
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/436822
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2021-08-05 21:34:04 +00:00
Michael Ludwig
2f6e2f8410 Use SkClipOp::kFoo instead of kFoo_SkClipOp from SkClipOpPriv
The SkClipOpPriv.h header will be going away soon, but a number of
places still use its kIntersect_SkClipOp definitions instead of the
equivalent SkClipOp::kIntersect. Besides updating these references,
a number of unnecessary includes to SkClipOpPriv.h are removed and
some test cases exercising expanding clip ops are deleted since they
will be unnecessary shortly.

Bug: skia:10208
Change-Id: I2bbdd6bb39869134c6a80ef2b4482e6cabdeb0b7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/436157
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2021-08-03 18:08:21 +00:00