29 if (
type.isScalar()) {
49 if (
type.isMatrix()) {
53 for (
int index = 0; index <
args.size(); ++index) {
56 if (
args[index]->
type().isScalar()) {
57 expr =
args[index].get();
58 }
else if (
args[index]->is<ConstructorSplat>()) {
65 splatExpression = expr;
75 return splatExpression;
85 SkASSERT(std::all_of(
args.begin(),
args.end(), [&](
const std::unique_ptr<Expression>& arg) {
86 const Type& argType = arg->type();
87 return (argType.isScalar() || argType.isVector() || argType.isMatrix()) &&
88 (argType.componentType().matches(type.componentType()));
93 std::accumulate(
args.begin(),
args.end(), (
size_t)0,
94 [](
size_t n,
const std::unique_ptr<Expression>& arg) {
95 return n + arg->type().slotCount();
103 return std::move(
args.front());
116 for (
const std::unique_ptr<Expression>& arg :
args) {
124 if (fields >
args.size()) {
127 for (std::unique_ptr<Expression>& arg :
args) {
135 for (std::unique_ptr<Expression>& innerArg : compositeCtor.
arguments()) {
136 flattened.
push_back(std::move(innerArg));
139 args = std::move(flattened);
145 for (std::unique_ptr<Expression>& arg :
args) {
156 return std::make_unique<ConstructorCompound>(
pos,
type, std::move(
args));
161 const Type& returnType,
162 const double value[]) {
166 for (
int index = 0; index < numSlots; ++index) {
#define SkASSERTF(cond, fmt,...)
static std::unique_ptr< Expression > MakeConstantValueForVariable(Position pos, std::unique_ptr< Expression > expr)
static std::unique_ptr< Expression > MakeFromConstants(const Context &context, Position pos, const Type &type, const double values[])
static std::unique_ptr< Expression > Make(const Context &context, Position pos, const Type &type, ExpressionArray args)
static std::unique_ptr< Expression > Make(const Context &context, Position pos, const Type &type, std::unique_ptr< Expression > arg)
const Type & type() const
static std::unique_ptr< Literal > Make(Position pos, double value, const Type *type)
ExpressionArray & arguments()
virtual bool isVector() const
bool isAllowedInES2(const Context &context) const
virtual const Type & componentType() const
bool matches(const Type &other) const
virtual bool isMatrix() const
virtual size_t slotCount() const
std::string description() const override
const Type * clone(const Context &context, SymbolTable *symbolTable) const
void reserve_exact(int n)
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
bool IsSameExpressionTree(const Expression &left, const Expression &right)
static const Expression * make_splat_from_arguments(const Type &type, const ExpressionArray &args)
static bool is_safe_to_eliminate(const Type &type, const Expression &arg)
ProgramSettings fSettings