#include <SkRuntimeEffectPriv.h>
|
static sk_sp< SkShader > | MakeDeferredShader (const SkRuntimeEffect *effect, UniformsCallback uniformsCallback, SkSpan< const SkRuntimeEffect::ChildPtr > children, const SkMatrix *localMatrix=nullptr) |
|
static bool | SupportsConstantOutputForConstantInput (const SkRuntimeEffect *effect) |
|
static uint32_t | Hash (const SkRuntimeEffect &effect) |
|
static uint32_t | StableKey (const SkRuntimeEffect &effect) |
|
static const SkSL::Program & | Program (const SkRuntimeEffect &effect) |
|
static SkRuntimeEffect::Options | ES3Options () |
|
static void | AllowPrivateAccess (SkRuntimeEffect::Options *options) |
|
static void | SetStableKey (SkRuntimeEffect::Options *options, uint32_t stableKey) |
|
static SkRuntimeEffect::Uniform | VarAsUniform (const SkSL::Variable &, const SkSL::Context &, size_t *offset) |
|
static SkRuntimeEffect::Child | VarAsChild (const SkSL::Variable &var, int index) |
|
static const char * | ChildTypeToStr (SkRuntimeEffect::ChildType type) |
|
static sk_sp< const SkData > | TransformUniforms (SkSpan< const SkRuntimeEffect::Uniform > uniforms, sk_sp< const SkData > originalData, const SkColorSpaceXformSteps &) |
|
static sk_sp< const SkData > | TransformUniforms (SkSpan< const SkRuntimeEffect::Uniform > uniforms, sk_sp< const SkData > originalData, const SkColorSpace *dstCS) |
|
static SkSpan< const float > | UniformsAsSpan (SkSpan< const SkRuntimeEffect::Uniform > uniforms, sk_sp< const SkData > originalData, bool alwaysCopyIntoAlloc, const SkColorSpace *destColorSpace, SkArenaAlloc *alloc) |
|
static bool | CanDraw (const SkCapabilities *, const SkSL::Program *) |
|
static bool | CanDraw (const SkCapabilities *, const SkRuntimeEffect *) |
|
static bool | ReadChildEffects (SkReadBuffer &buffer, const SkRuntimeEffect *effect, skia_private::TArray< SkRuntimeEffect::ChildPtr > *children) |
|
static void | WriteChildEffects (SkWriteBuffer &buffer, SkSpan< const SkRuntimeEffect::ChildPtr > children) |
|
static bool | UsesColorTransform (const SkRuntimeEffect *effect) |
|
Definition at line 50 of file SkRuntimeEffectPriv.h.
◆ UniformsCallback
◆ AllowPrivateAccess()
◆ CanDraw() [1/2]
Definition at line 358 of file SkRuntimeEffect.cpp.
358 {
360 return CanDraw(caps, effect->fBaseProgram.get());
361}
static bool CanDraw(const SkCapabilities *, const SkSL::Program *)
◆ CanDraw() [2/2]
Definition at line 352 of file SkRuntimeEffect.cpp.
352 {
356}
SkSL::Version skslVersion() const
std::unique_ptr< ProgramConfig > fConfig
◆ ChildTypeToStr()
◆ ES3Options()
◆ Hash()
static uint32_t SkRuntimeEffectPriv::Hash |
( |
const SkRuntimeEffect & |
effect | ) |
|
|
inlinestatic |
◆ MakeDeferredShader()
Definition at line 800 of file SkRuntimeEffect.cpp.
804 {
806 return nullptr;
807 }
809 return nullptr;
810 }
811 if (!uniformsCallback) {
812 return nullptr;
813 }
814 return SkLocalMatrixShader::MakeWrapped<SkRuntimeShader>(localMatrix,
816 nullptr,
817 std::move(uniformsCallback),
818 children);
819}
sk_sp< T > sk_ref_sp(T *obj)
static bool verify_child_effects(const std::vector< SkRuntimeEffect::Child > &reflected, SkSpan< const SkRuntimeEffect::ChildPtr > effectPtrs)
◆ Program()
◆ ReadChildEffects()
If effect
is specified, then the number and type of child objects are validated against the children() of effect
. If it's nullptr, this is skipped, allowing deserialization of children, even when the effect could not be constructed (ie, due to malformed SkSL).
Definition at line 403 of file SkRuntimeEffect.cpp.
405 {
406 size_t childCount =
buffer.read32();
407 if (effect && !
buffer.validate(childCount == effect->
children().size())) {
408 return false;
409 }
410
413
414 for (
size_t i = 0;
i < childCount;
i++) {
418 return false;
419 }
421 }
422
423
424 if (effect) {
425 auto childInfo = effect->
children();
427 for (
size_t i = 0;
i < childCount;
i++) {
428 std::optional<ChildType> ct = (*children)[
i].type();
429 if (ct.has_value() && (*ct) != childInfo[
i].type) {
431 }
432 }
433 }
434
436}
static bool flattenable_is_valid_as_child(const SkFlattenable *f)
constexpr size_t SkToSizeT(S x)
SkSpan< const Child > children() const
void reserve_exact(int n)
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
◆ SetStableKey()
◆ StableKey()
static uint32_t SkRuntimeEffectPriv::StableKey |
( |
const SkRuntimeEffect & |
effect | ) |
|
|
inlinestatic |
◆ SupportsConstantOutputForConstantInput()
static bool SkRuntimeEffectPriv::SupportsConstantOutputForConstantInput |
( |
const SkRuntimeEffect * |
effect | ) |
|
|
inlinestatic |
Definition at line 70 of file SkRuntimeEffectPriv.h.
70 {
71
73 return false;
74 }
75 return true;
76 }
bool allowColorFilter() const
◆ TransformUniforms() [1/2]
Definition at line 159 of file SkRuntimeEffect.cpp.
162 {
163 if (!dstCS) {
164
165 return originalData;
166 }
170}
SkColorSpace * sk_srgb_singleton()
static sk_sp< const SkData > TransformUniforms(SkSpan< const SkRuntimeEffect::Uniform > uniforms, sk_sp< const SkData > originalData, const SkColorSpaceXformSteps &)
◆ TransformUniforms() [2/2]
Definition at line 172 of file SkRuntimeEffect.cpp.
175 {
178
180 auto writableData = [&]() {
183 }
184 return data->writable_data();
185 };
186
187 for (const auto& u : uniforms) {
188 if (u.flags & Flags::kColor_Flag) {
189 SkASSERT(u.type == Type::kFloat3 || u.type == Type::kFloat4);
191 float*
color = SkTAddOffset<float>(writableData(), u.offset);
192 if (u.type == Type::kFloat4) {
193
194 for (
int i = 0;
i < u.count; ++
i) {
197 }
198 } else {
199
200
201
203 for (
int i = 0;
i < u.count; ++
i) {
209 }
210 }
211 }
212 }
213 }
215}
static const uint32_t rgba[kNumPixels]
const void * data() const
static sk_sp< SkData > MakeWithCopy(const void *data, size_t length)
std::shared_ptr< const fml::Mapping > data
◆ UniformsAsSpan()
Definition at line 260 of file SkRuntimeEffect.cpp.
265 {
266
268 originalData,
269 destColorSpace);
270 if (alwaysCopyIntoAlloc || originalData != transformedData) {
271
272
273 int numBytes = transformedData->
size();
274 int numFloats = numBytes /
sizeof(
float);
276 memcpy(uniformsInAlloc, transformedData->
data(), numBytes);
277 return SkSpan{uniformsInAlloc, numFloats};
278 }
279
280 return SkSpan{
static_cast<const float*
>(originalData->
data()),
282}
T * makeArrayDefault(size_t count)
◆ UsesColorTransform()
static bool SkRuntimeEffectPriv::UsesColorTransform |
( |
const SkRuntimeEffect * |
effect | ) |
|
|
inlinestatic |
◆ VarAsChild()
Definition at line 151 of file SkRuntimeEffect.cpp.
151 {
156 return c;
157}
static ChildType child_type(const SkSL::Type &type)
std::string_view name() const
const Type & type() const
◆ VarAsUniform()
Definition at line 101 of file SkRuntimeEffect.cpp.
103 {
110
112 if (
type->isArray()) {
116 }
117
118 if (
type->hasPrecision() && !
type->highPrecision()) {
120 }
121
125 }
126
130 return uni;
131}
SkAssertResult(font.textToGlyphs("Hello", 5, SkTextEncoding::kUTF8, glyphs, std::size(glyphs))==count)
static constexpr bool SkIsAlign4(T x)
SkMeshSpecification::Uniform Uniform
static bool init_uniform_type(const SkSL::Context &ctx, const SkSL::Type *type, SkRuntimeEffect::Uniform *v)
ModifierFlags modifierFlags() const
virtual const Layout & layout() const
◆ WriteChildEffects()
Definition at line 438 of file SkRuntimeEffect.cpp.
439 {
441 for (const auto& child : children) {
442 buffer.writeFlattenable(child.flattenable());
443 }
444}
constexpr size_t size() const
The documentation for this class was generated from the following files: