44 float maxSampleRadius,
45 std::string_view childShaderNames[],
49 , fRuntimeEffectBuilder(
builder)
50 , fMaxSampleRadius(maxSampleRadius) {
53 for (
int i = 0;
i < inputCount;
i++) {
67 bool onAffectsTransparentBlack()
const override {
return true; }
80 std::optional<skif::LayerSpace<SkIRect>> onGetOutputLayerBounds(
89 bounds.outset(maxSampleRadius);
93 mutable SkSpinlock fRuntimeEffectLock;
96 float fMaxSampleRadius;
101 std::string_view childShaderName,
105 if (childShaderName.empty()) {
106 auto children =
builder.effect()->children();
107 if (children.size() != 1) {
110 childShaderName = children.front().name;
118 std::string_view childShaderNames[],
121 if (maxSampleRadius < 0.f) {
129 for (
int i = 0;
i < inputCount;
i++) {
130 std::string_view
name = childShaderNames[
i];
132 if (
name.empty() || !child_is_shader(
builder.effect()->findChild(
name))) {
137 for (
int j = 0; j <
i; j++) {
138 if (
name == childShaderNames[j]) {
163 if (!
buffer.validate(effect !=
nullptr)) {
169 if (!
buffer.validate(uniforms->
size() == effect->uniformSize())) {
178 for (
int i = 0;
i <
common.inputCount();
i++) {
179 buffer.readString(&childShaderNameStrings[
i]);
180 childShaderNames[
i] = childShaderNameStrings[
i].c_str();
187 std::string_view
name = child.name;
188 switch (child.type) {
204 float maxSampleRadius = 0.f;
206 maxSampleRadius =
buffer.readScalar();
219 fRuntimeEffectLock.acquire();
226 buffer.writeFlattenable(fRuntimeEffectBuilder.
children()[
x].flattenable());
228 fRuntimeEffectLock.release();
230 buffer.writeScalar(fMaxSampleRadius);
244 for (
int i = 0;
i < inputCount; ++
i) {
250 ShaderFlags::kNonTrivialSampling);
255 fRuntimeEffectLock.acquire();
256 for (
int i = 0;
i < inputCount;
i++) {
257 fRuntimeEffectBuilder.
child(fChildShaderNames[
i].c_str()) =
inputs[
i];
263 for (
int i = 0;
i < inputCount;
i++) {
264 fRuntimeEffectBuilder.
child(fChildShaderNames[
i].c_str()) =
nullptr;
266 fRuntimeEffectLock.release();
277 if (inputCount <= 0) {
282 this->applyMaxSampleRadius(mapping, desiredOutput);
293std::optional<skif::LayerSpace<SkIRect>> SkRuntimeImageFilter::onGetOutputLayerBounds(
static void Union(SkRegion *rgn, const SkIRect &rect)
#define SK_FLATTENABLE_HOOKS(type)
#define SK_REGISTER_FLATTENABLE(type)
#define SK_IMAGEFILTER_UNFLATTEN_COMMON(localVar, expectedCount)
sk_sp< SkRuntimeEffect > SkMakeCachedRuntimeEffect(SkRuntimeEffect::Result(*make)(SkString sksl, const SkRuntimeEffect::Options &), SkString sksl)
void SkRegisterRuntimeImageFilterFlattenable()
skif::LayerSpace< SkIRect > getChildInputLayerBounds(int index, const skif::Mapping &mapping, const skif::LayerSpace< SkIRect > &desiredOutput, std::optional< skif::LayerSpace< SkIRect > > contentBounds) const
void flatten(SkWriteBuffer &) const override
skif::FilterResult getChildOutput(int index, const skif::Context &ctx) const
skif::MatrixCapability MatrixCapability
static sk_sp< SkImageFilter > RuntimeShader(const SkRuntimeShaderBuilder &builder, std::string_view childShaderName, sk_sp< SkImageFilter > input)
@ kRuntimeImageFilterSampleRadius
static SkRect MakeLargeS32()
BuilderChild child(std::string_view name)
sk_sp< const SkData > uniforms() const
const SkRuntimeEffect * effect() const
SkSpan< const SkRuntimeEffect::ChildPtr > children() const
static Result MakeForShader(SkString sksl, const Options &)
const std::string & source() const
void flatten(SkWriteBuffer &) const override
SkRuntimeImageFilter(const SkRuntimeShaderBuilder &builder, float maxSampleRadius, std::string_view childShaderNames[], const sk_sp< SkImageFilter > inputs[], int inputCount)
SkRect computeFastBounds(const SkRect &src) const override
sk_sp< SkShader > makeShader(const SkMatrix *localMatrix=nullptr) const
void resize(size_t count)
void reserve_exact(int n)
const LayerSpace< SkIRect > & desiredOutput() const
Context withNewDesiredOutput(const LayerSpace< SkIRect > &desiredOutput) const
const Mapping & mapping() const
LayerSpace< T > paramToLayer(const ParameterSpace< T > ¶mGeometry) const
Optional< SkRect > bounds
SK_API sk_sp< SkShader > Empty()
DEF_SWITCHES_START aot vmservice shared library name
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size