23521a8d69
SkSL IRNodes now have two different factory functions: XxxxxStatement::Convert -- this is the equivalent of IRGenerator::convertXxxxx. Type coercion is fully supported. Errors are reported via ErrorReporter. Failure is handled gracefully by returning null. XxxxxStatement::Make -- this is treated more like `new XxxxxStatement` but with optimizations applied. Types must already be correct. If the passed-in arguments don't make sense, errors are reported via SkASSERT. `Make` is always expected to return an IRNode-- either exactly what was passed in, or an equivalent simpler form. (In some rare exceptions, supporting Make was too difficult and is not handled in this CL. Constructor was the biggest edge case; it is extremely complicated [skia:11032], and supporting Make would require duplicating most of its logic. It was too much copy-and-paste for me.) Rationale for this change: Originally, when the Inliner or Rehydrator would create an IRNode, it would just allocate it via `new` or `make_unique` and take it as-is. No error-checking, no optimization. I decided to allow those callers to benefit from simple optimizations. This meant porting logic from the IRGenerator (e.g. `convertIf`, which removes empty branches) into widely available factory functions. However, the Inliner and Rehydrator don't need the type coercion, and we'd rather have them assert/succeed instead of getting a null and crashing (in the unexpected case that recreating an IRNode causes an error to be detected). Change-Id: I6949328e904258a627106524ed4134b524e012b6 Bug: skia:11342 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/377843 Auto-Submit: John Stiles <johnstiles@google.com> Commit-Queue: Ethan Nicholas <ethannicholas@google.com> Reviewed-by: Ethan Nicholas <ethannicholas@google.com> |
||
---|---|---|
animations | ||
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 | ||
tools | ||
.bazelignore | ||
.clang-format | ||
.clang-tidy | ||
.gitignore | ||
.gn | ||
AUTHORS | ||
BUILD.bazel | ||
BUILD.gn | ||
codereview.settings | ||
CONTRIBUTING | ||
CQ_COMMITTERS | ||
DEPS | ||
DIR_METADATA | ||
go.mod | ||
go.sum | ||
LICENSE | ||
PRESUBMIT.py | ||
public.bzl | ||
README | ||
README.chromium | ||
RELEASE_NOTES.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.