// ES2 doesn't support first-class array types. if (context.fConfig->strictES2Mode()) {
context.fErrors->error(pos, "construction of array type '" + type.displayName() + "' is not supported"); return nullptr;
}
// An array of atomics cannot be constructed. if (type.isOrContainsAtomic()) {
context.fErrors->error(
pos,
String::printf("construction of array type '%s' with atomic member is not allowed",
type.displayName().c_str())); return nullptr;
}
// If there is a single argument containing an array of matching size and the types are // coercible, this is actually a cast. i.e., `half[10](myFloat10Array)`. This isn't a GLSL // feature, but the Pipeline stage code generator needs this functionality so that code which // was originally compiled with "allow narrowing conversions" enabled can be later recompiled // without narrowing conversions (we patch over these conversions with an explicit cast). if (args.size() == 1) { const Expression& expr = *args.front(); const Type& exprType = expr.type();
// Check that the number of constructor arguments matches the array size. if (type.columns() != args.size()) {
context.fErrors->error(pos, String::printf("invalid arguments to '%s' constructor " "(expected %d elements, but found %d)", type.displayName().c_str(), type.columns(),
args.size())); return nullptr;
}
// Convert each constructor argument to the array's component type. const Type& baseType = type.componentType(); for (std::unique_ptr<Expression>& argument : args) {
argument = baseType.coerceExpression(std::move(argument), context); if (!argument) { return nullptr;
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.