#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 49 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()
Definition at line 142 of file SkRuntimeEffect.cpp.
142 {
144 case ChildType::kBlender: return "blender";
145 case ChildType::kColorFilter: return "color filter";
146 case ChildType::kShader: return "shader";
148 }
149}
◆ 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)
static const uint8_t buffer[]
◆ SetStableKey()
◆ StableKey()
static uint32_t SkRuntimeEffectPriv::StableKey |
( |
const SkRuntimeEffect & |
effect | ) |
|
|
inlinestatic |
◆ SupportsConstantOutputForConstantInput()
static bool SkRuntimeEffectPriv::SupportsConstantOutputForConstantInput |
( |
const SkRuntimeEffect * |
effect | ) |
|
|
inlinestatic |
Definition at line 69 of file SkRuntimeEffectPriv.h.
69 {
70
72 return false;
73 }
74 return true;
75 }
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 = [&]() {
181 if (!data) {
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)
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot 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}
static constexpr bool SkIsAlign4(T x)
#define SkAssertResult(cond)
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: