a72eda6bfc
Previously, snippets held a single callback which had two separate responsibilities: 1 - If needed, emit helper functions into the preamble 2 - Return an expression that invokes the snippet This works great when you only call a snippet exactly one time, but poses a problem if you need to invoke a snippet more than once; the callback would also emit all of that snippet's helper functions again! This CL splits the callbacks into two pieces: a "preamble generator" and an "expression generator." The preamble generator is responsible for bullet point 1 above; the expression generator is responsible for bullet point 2. The preamble generator will run exactly once for every entry in a shader info, and is in charge of advancing the entry-index through the shader (a surprisingly non-trivial concern when children are involved!). The expression generator can be called any number of times for an entry, does not advance the entry index, and cannot change the preamble. At present, we do not actually have any use cases where we generate the expression for a given snippet more than once, but this is a feature that Runtime Shaders will need to leverage in a followup. Change-Id: I3b75fc894351ac459b13763331e8bf64694de1df Bug: skia:13508 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/558920 Commit-Queue: John Stiles <johnstiles@google.com> Reviewed-by: Robert Phillips <robertphillips@google.com> |
||
---|---|---|
bazel | ||
bench | ||
bin | ||
build/fuchsia | ||
build_overrides | ||
client_utils/android | ||
demos.skia.org | ||
dm | ||
docker | ||
docs/examples | ||
example | ||
experimental | ||
fuzz | ||
gm | ||
gn | ||
include | ||
infra | ||
modules | ||
platform_tools | ||
resources | ||
samplecode | ||
site | ||
specs | ||
src | ||
tests | ||
third_party | ||
toolchain | ||
tools | ||
.bazelrc | ||
.bazelversion | ||
.clang-format | ||
.clang-tidy | ||
.gitignore | ||
.gn | ||
.vpython | ||
AUTHORS | ||
BUILD.bazel | ||
BUILD.gn | ||
codereview.settings | ||
CONTRIBUTING | ||
CQ_COMMITTERS | ||
DEPS | ||
DIR_METADATA | ||
go_repositories.bzl | ||
go.mod | ||
go.sum | ||
LICENSE | ||
OWNERS | ||
OWNERS.android | ||
package-lock.json | ||
package.json | ||
PRESUBMIT.py | ||
public.bzl | ||
README | ||
README.chromium | ||
RELEASE_NOTES.txt | ||
requirements.txt | ||
whitespace.txt | ||
WORKSPACE.bazel |
Skia is a complete 2D graphic library for drawing Text, Geometries, and Images. See full details, and build instructions, at https://skia.org.