Go to file
Michael Ludwig e88320baec Update how sample(matrix) calls are invoked in SkSL
This removes the kMixed type of SkSL::SampleMatrix. All analysis of FP
sampling due to parent-child relationships is tracked in flags on
GrFragmentProcessor now.

The sample strategy is tracked as follows:
- An FP marks itself as using the local coordinate builtin directly (automatically done for .fp code based on reference to sk_TransformedCoords2D[0]).
- This state propagates up the parent towards the root, marking FPs as using coordinates indirectly. We stop the propagation when we hit a parent FP that explicitly samples the child because it becomes the source of the child's coordinates.
   - If that parent references its local coordinates directly, that kicks off its own upwards propagation.
- Being sampled explicitly propagates down to all children, and effectively disables vertex-shader evaluation of transforms.
   - A variable matrix automatically marks this flag as well, since it's essentially a shortcut to (matrix expression) * coords.
- The matrix type also propagates down, but right now that's only for whether or not there's perspective.
   - This doesn't affect FS coord evaluation since each FP applies its action independently.
   - But for VS-promoted transforms, the child's varying may inherit perspective (or other more general matrix types) from the parent and switch from a float2 to a float3.
- A SampleMatrix no longer tracks a base or owner, GrFragmentProcessor exposes its parent FP. An FP's sample matrix is always owned by its immediate parent.
   - This means that you can have a hierarchy from root to leaf like: [uniform, none, none, uses local coords], and that leaf will have a SampleMatrix of kNone type. However, because of parent tracking, the coordinate generation can walk up to the root and detect the proper transform expression it needs to produce, and automatically de-duplicate across children.

Currently, all FP's that are explicitly sampled have a signature of (color, float2 coord). FP's that don't use local coords, or whose coords are promoted to a varying have a signature of (color).
   - In this case, the shader builder either updates args.fLocalCoords to point to the varying directly, or adds a float2 local to the function body that includes the perspective divide.

GrFragmentProcessor automatically pretends it has an identity coord transform if the FP is marked as referencing the local coord builtin. This allows these FPs to still be processed as part of GrGLSLGeometryProcessor::collectTransforms, but removes the need for FP implementations to declare an identity GrCoordTransform.
   - To test this theory, GrTextureEffect and GrSkSLFP no longer have coord transforms explicitly.
   - Later CLs can trivially remove them from a lot of the other effects.
   - The coord generation should not change because it detects in both cases that the coord transform matrices were identity.

GrGLSLGeometryProcessor's collectTransforms and emitTransformCode has been completely overhauled to recurse up an FP's parent pointers and collect the expressions that affect the result. It de-duplicates expressions between siblings, and is able to produce a single varying for the base local coord (either when there are no intervening transforms, or the root FP needs an explicit coordinate to start off with).


This also adds the fp_sample_chaining GM from Brian, with a few more configurations to fill out the cells.

Bug: skia:10396
Change-Id: I86acc0c34c9f29d6371b34370bee9a18c2acf1c1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/297868
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-06-25 14:48:34 +00:00
animations first cut at a checkbox 2009-10-21 19:41:10 +00:00
bench Add an sk_sp API for DDLs with a macro for staging 2020-06-25 13:13:58 +00:00
bin Roll gn. 2020-06-18 19:33:04 +00:00
build/fuchsia [fuchsia] Fix fidlc command. 2020-06-10 03:29:24 +00:00
build_overrides Use Dawn's BUILD.gn instead of defining another one for Skia. 2020-04-13 23:26:31 +00:00
client_utils/android Remove SkBitmapRegionDecoder and SkBRDAllocator 2020-06-01 20:56:29 +00:00
demos.skia.org [demos] Move to subdir 2020-06-23 17:29:37 +00:00
dm Add an sk_sp API for DDLs with a macro for staging 2020-06-25 13:13:58 +00:00
docker Support specifying hash and patch_ref in skia-release & skia-wasm-release Dockerfiles 2020-05-06 20:39:04 +00:00
docs/examples Remove SkSurface::MakeFromBackendTextureAsRenderTarget from public API 2020-05-29 15:09:52 +00:00
example Revert "Revert "switch to new filltype for SkPath"" 2019-11-26 17:43:14 +00:00
experimental [skrive] Parse ellipse data 2020-06-24 02:17:30 +00:00
fuzz replace max_len with if statements 2020-06-16 17:26:30 +00:00
gm Update how sample(matrix) calls are invoked in SkSL 2020-06-25 14:48:34 +00:00
gn Update how sample(matrix) calls are invoked in SkSL 2020-06-25 14:48:34 +00:00
include Update how sample(matrix) calls are invoked in SkSL 2020-06-25 14:48:34 +00:00
infra Update Go Deps 2020-06-25 05:44:30 +00:00
modules [canvaskit] High performance Path APIs 2020-06-24 12:40:49 +00:00
platform_tools Revert "Implement Skottie vs Lottie perf tool" 2020-06-24 23:15:20 +00:00
resources Runtime effect implementation of color cube filter 2020-05-28 15:45:48 +00:00
samplecode Update complex clip GMs to only use supported clip ops 2020-06-25 14:15:25 +00:00
site Regularize selection of fontmgr. 2020-06-11 12:28:03 +00:00
specs Fix CanvasKit generated documentation to work with emscripten 1.39.16. 2020-05-27 12:23:32 +00:00
src Update how sample(matrix) calls are invoked in SkSL 2020-06-25 14:48:34 +00:00
tests Update how sample(matrix) calls are invoked in SkSL 2020-06-25 14:48:34 +00:00
third_party Roll dawn from 92379bff49c2 to 8ab3719fc486 (2 revisions) 2020-06-24 17:35:33 +00:00
tools Add an sk_sp API for DDLs with a macro for staging 2020-06-25 13:13:58 +00:00
.clang-format Disable BinPackParameters in .clang-format 2020-03-27 14:32:40 +00:00
.clang-tidy add google-build-namespaces to clang-tidy checks 2018-12-12 16:33:59 +00:00
.gitignore Reland the new module for skia lib for g3 2020-06-23 14:19:13 +00:00
.gn Basic standalone GN configs. 2016-07-21 12:25:45 -07:00
AUTHORS Fixing a bug in SkOpEdgeBuilder::walk that causes pathOps to fail when cubic segment is reducable 2020-04-21 16:56:54 +00:00
BUILD.gn Reland the new module for skia lib for g3 2020-06-23 14:19:13 +00:00
codereview.settings Make uploading to Gerrit the default for Skia 2016-11-09 19:07:56 +00:00
CONTRIBUTING Fix references to https://sites.google.com/site/skiadocs/. 2015-02-03 13:12:54 -02:00
CQ_COMMITTERS Moved committer list to chrome-infra-auth and deleted it from the repo 2015-09-02 13:37:54 -07:00
DEPS Roll ANGLE from 1496de215a39 to 6ef0387d581d (10 revisions) 2020-06-25 04:45:19 +00:00
go.mod Update Go Deps 2020-06-25 05:44:30 +00:00
go.sum Update Go Deps 2020-06-25 05:44:30 +00:00
LICENSE LICENSE file: clean up 2019-11-22 21:59:03 +00:00
OWNERS add OWNERS file 2017-12-01 19:50:19 +00:00
PRESUBMIT.py PRESUBMIT: Don't check formatting of deleted files 2020-04-08 10:36:09 +00:00
public.bzl Fix public.bzl formatting 2020-06-23 16:27:17 +00:00
README Fix references to https://sites.google.com/site/skiadocs/. 2015-02-03 13:12:54 -02:00
README.chromium Update README.chromium. 2015-06-11 13:19:24 -07:00
RELEASE_NOTES.txt Add GrContext::oomed() and implement for GL and VK. 2020-06-24 16:04:06 +00:00
whitespace.txt Whitespace change to re-trigger Mac/iOS tests 2020-02-23 20:55:01 +00:00

Skia is a complete 2D graphic library for drawing Text, Geometries, and Images.

See full details, and build instructions, at https://skia.org.