eval

The expression system: GLSL expressions declared, compiled and evaluated.

Group eval

Detailed description

libeval turns GLSL expressions into runnable programs. A caller declares input slots and output expressions on an eval::Graph and compiles it to an immutable eval::Program. eval::evaluate() does all of this in one call for a single expression.

Function documentation

evaluate

eval::Result<QVariant> eval::evaluate(const QString &expression, eval::Backend hint = Backend::Interpreted)

Parses, type-checks, compiles and evaluates expression, and returns its value or the diagnostics that stopped it.

hint selects the backend. The default, Backend::Interpreted, keeps a casual caller off the JIT's compile latency. Every call parses and compiles again, so a hot loop must hold an eval::Program instead.

evaluate (2)

eval::Result<QVariant> eval::evaluate(const QString &expression, const QHash<QString, QVariant> &inputs, eval::Backend hint = Backend::Interpreted)

Each entry in inputs becomes an input slot named by its key, set to its value, before expression is evaluated. The slot type follows the QVariant type: float, double, bool, uint, qint64 and quint64 keep their type, and any other type, int included, becomes a float slot.

This is an overloaded function.

Classes

Class What it is
Graph Edit-time form of an expression program: input slots and output expressions
Program An immutable compiled expression program, produced by an eval::Graph

Namespaces

Namespace What it is
internal Parts of libeval that the compile lanes share: values, slot layout, GLSL assembly and SPIR-V compilation
In this section