8#ifndef SkRuntimeEffect_DEFINED
9#define SkRuntimeEffect_DEFINED
43class FunctionDefinition;
46struct ProgramSettings;
96 kHalfPrecision_Flag = 0x10,
107 size_t sizeInBytes()
const;
128 bool forceUnoptimized =
false;
136 bool allowPrivateAccess =
false;
138 uint32_t fStableKey = 0;
167 return MakeForColorFilter(std::move(sksl),
Options{});
172 static Result MakeForShader(
SkString sksl,
const Options&);
174 return MakeForShader(std::move(sksl),
Options{});
179 static Result MakeForBlender(
SkString sksl,
const Options&);
181 return MakeForBlender(std::move(sksl),
Options{});
195 std::optional<ChildType>
type()
const;
213 const SkMatrix* localMatrix =
nullptr)
const;
216 const SkMatrix* localMatrix =
nullptr)
const;
221 size_t childCount)
const;
247 const std::string&
source()
const;
251 size_t uniformSize()
const;
257 const Uniform* findUniform(std::string_view
name)
const;
260 const Child* findChild(std::string_view
name)
const;
267 static void RegisterFlattenables();
272 kUsesSampleCoords_Flag = 0x001,
273 kAllowColorFilter_Flag = 0x002,
274 kAllowShader_Flag = 0x004,
275 kAllowBlender_Flag = 0x008,
276 kSamplesOutsideMain_Flag = 0x010,
277 kUsesColorTransform_Flag = 0x020,
278 kAlwaysOpaque_Flag = 0x040,
279 kAlphaUnchanged_Flag = 0x080,
280 kDisableOptimization_Flag = 0x100,
286 std::vector<Uniform>&& uniforms,
287 std::vector<Child>&& children,
288 std::vector<SkSL::SampleUsage>&& sampleUsages,
295 static Result MakeInternal(std::unique_ptr<SkSL::Program> program,
301 uint32_t
hash()
const {
return fHash; }
302 bool usesSampleCoords()
const {
return (
fFlags & kUsesSampleCoords_Flag); }
303 bool samplesOutsideMain()
const {
return (
fFlags & kSamplesOutsideMain_Flag); }
304 bool usesColorTransform()
const {
return (
fFlags & kUsesColorTransform_Flag); }
305 bool alwaysOpaque()
const {
return (
fFlags & kAlwaysOpaque_Flag); }
306 bool isAlphaUnchanged()
const {
return (
fFlags & kAlphaUnchanged_Flag); }
320 std::unique_ptr<SkSL::Program> fBaseProgram;
321 std::unique_ptr<SkSL::RP::Program> fRPProgram;
322 mutable SkOnce fCompileRPProgramOnce;
324 std::vector<Uniform> fUniforms;
325 std::vector<Child> fChildren;
326 std::vector<SkSL::SampleUsage> fSampleUsages;
340 template <
typename T>
360 float*
data = SkTAddOffset<float>(
fOwner->writableUniformData(),
369 template <
typename T>
425 : fEffect(
std::move(effect))
426 , fUniforms(
SkData::MakeZeroInitialized(fEffect->uniformSize()))
427 , fChildren(fEffect->children().
size()) {}
429 : fEffect(
std::move(effect))
430 , fUniforms(
std::move(uniforms))
431 , fChildren(fEffect->children().
size()) {}
440 void* writableUniformData() {
441 if (!fUniforms->unique()) {
444 return fUniforms->writable_data();
449 std::vector<SkRuntimeEffect::ChildPtr> fChildren;
#define SkDEBUGFAIL(message)
static uint32_t hash(const SkShaderBase::GradientInfo &v)
SkSpan(Container &&) -> SkSpan< std::remove_pointer_t< decltype(std::data(std::declval< Container >()))> >
static constexpr bool SkToBool(const T &x)
static sk_sp< SkData > MakeWithCopy(const void *data, size_t length)
SkScalar get(int index) const
SkRuntimeBlendBuilder(const SkRuntimeBlendBuilder &)=delete
SkRuntimeBlendBuilder & operator=(const SkRuntimeBlendBuilder &)=delete
~SkRuntimeColorFilterBuilder()
SkRuntimeColorFilterBuilder(const SkRuntimeColorFilterBuilder &)=delete
SkRuntimeColorFilterBuilder & operator=(const SkRuntimeColorFilterBuilder &)=delete
SkRuntimeEffectBuilder & operator=(SkRuntimeEffectBuilder &&)=delete
BuilderUniform uniform(std::string_view name)
SkRuntimeEffectBuilder(sk_sp< SkRuntimeEffect > effect)
BuilderChild child(std::string_view name)
sk_sp< const SkData > uniforms() const
SkRuntimeEffectBuilder(const SkRuntimeEffectBuilder &)=default
SkRuntimeEffectBuilder(sk_sp< SkRuntimeEffect > effect, sk_sp< SkData > uniforms)
const SkRuntimeEffect * effect() const
SkSpan< const SkRuntimeEffect::ChildPtr > children() const
SkRuntimeEffectBuilder & operator=(const SkRuntimeEffectBuilder &)=delete
SkRuntimeEffectBuilder()=delete
SkRuntimeEffectBuilder(SkRuntimeEffectBuilder &&)=default
ChildPtr(sk_sp< SkBlender > b)
SkFlattenable * flattenable() const
ChildPtr(sk_sp< SkShader > s)
std::true_type sk_is_trivially_relocatable
ChildPtr(sk_sp< SkColorFilter > cf)
const Child * findChild(std::string_view name) const
SkSpan< const Child > children() const
bool allowColorFilter() const
~SkRuntimeEffect() override
bool allowBlender() const
static Result MakeForShader(SkString sksl)
static Result MakeForColorFilter(SkString sksl)
SkSpan< const Uniform > uniforms() const
static Result MakeForBlender(SkString sksl)
const Uniform * findUniform(std::string_view name) const
~SkRuntimeShaderBuilder()
SkRuntimeShaderBuilder(const SkRuntimeShaderBuilder &)=default
FlutterSemanticsFlag flags
DEF_SWITCHES_START aot vmservice shared library name
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
BuilderChild & operator=(sk_sp< T > val)
const SkRuntimeEffect::Child * fChild
SkRuntimeEffectBuilder * fOwner
BuilderChild & operator=(std::nullptr_t)
sk_sp< SkRuntimeEffect > effect
sk_sp< SkSL::DebugTrace > debugTrace
std::shared_ptr< const fml::Mapping > data