2021-01-07 15:57:27 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2020 Google LLC
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef SKSL_DSL_CORE
|
|
|
|
#define SKSL_DSL_CORE
|
|
|
|
|
2021-04-09 19:33:53 +00:00
|
|
|
#include "include/private/SkSLProgramKind.h"
|
2021-02-09 20:22:57 +00:00
|
|
|
#include "include/private/SkTArray.h"
|
2021-03-04 19:30:25 +00:00
|
|
|
#include "include/sksl/DSLBlock.h"
|
|
|
|
#include "include/sksl/DSLCase.h"
|
|
|
|
#include "include/sksl/DSLErrorHandling.h"
|
|
|
|
#include "include/sksl/DSLExpression.h"
|
|
|
|
#include "include/sksl/DSLFunction.h"
|
|
|
|
#include "include/sksl/DSLStatement.h"
|
|
|
|
#include "include/sksl/DSLType.h"
|
|
|
|
#include "include/sksl/DSLVar.h"
|
2021-01-07 15:57:27 +00:00
|
|
|
|
|
|
|
namespace SkSL {
|
|
|
|
|
|
|
|
class Compiler;
|
|
|
|
|
|
|
|
namespace dsl {
|
|
|
|
|
2021-02-18 21:06:17 +00:00
|
|
|
// When users import the DSL namespace via `using namespace SkSL::dsl`, we want the SwizzleComponent
|
|
|
|
// Type enum to come into scope as well, so `Swizzle(var, X, Y, ONE)` can work as expected.
|
|
|
|
// `namespace SkSL::SwizzleComponent` contains only an `enum Type`; this `using namespace` directive
|
|
|
|
// shouldn't pollute the SkSL::dsl namespace with anything else.
|
|
|
|
using namespace SkSL::SwizzleComponent;
|
|
|
|
|
2021-01-07 15:57:27 +00:00
|
|
|
/**
|
|
|
|
* Starts DSL output on the current thread using the specified compiler. This must be called
|
2021-01-08 16:42:25 +00:00
|
|
|
* prior to any other DSL functions.
|
2021-01-07 15:57:27 +00:00
|
|
|
*/
|
2021-04-09 19:33:53 +00:00
|
|
|
void Start(SkSL::Compiler* compiler, SkSL::ProgramKind kind = SkSL::ProgramKind::kFragment);
|
2021-01-07 15:57:27 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Signals the end of DSL output. This must be called sometime between a call to Start() and the
|
|
|
|
* termination of the thread.
|
|
|
|
*/
|
|
|
|
void End();
|
|
|
|
|
2021-01-26 17:00:25 +00:00
|
|
|
/**
|
|
|
|
* Installs an ErrorHandler which will be notified of any errors that occur during DSL calls. If
|
|
|
|
* no ErrorHandler is installed, any errors will be fatal.
|
|
|
|
*/
|
|
|
|
void SetErrorHandler(ErrorHandler* errorHandler);
|
|
|
|
|
2021-01-28 15:02:43 +00:00
|
|
|
DSLVar sk_FragColor();
|
|
|
|
|
|
|
|
DSLVar sk_FragCoord();
|
|
|
|
|
2021-02-05 19:22:32 +00:00
|
|
|
/**
|
|
|
|
* break;
|
|
|
|
*/
|
|
|
|
DSLStatement Break();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* continue;
|
|
|
|
*/
|
|
|
|
DSLStatement Continue();
|
|
|
|
|
2021-01-22 20:18:25 +00:00
|
|
|
/**
|
2021-03-05 19:23:48 +00:00
|
|
|
* Creates a variable declaration statement.
|
2021-01-22 20:18:25 +00:00
|
|
|
*/
|
2021-03-05 19:23:48 +00:00
|
|
|
DSLStatement Declare(DSLVar& var, PositionInfo pos = PositionInfo());
|
2021-01-22 20:18:25 +00:00
|
|
|
|
2021-02-09 20:22:57 +00:00
|
|
|
/**
|
|
|
|
* default: statements
|
|
|
|
*/
|
|
|
|
template<class... Statements>
|
|
|
|
DSLCase Default(Statements... statements) {
|
|
|
|
return DSLCase(DSLExpression(), std::move(statements)...);
|
|
|
|
}
|
|
|
|
|
2021-02-05 19:22:32 +00:00
|
|
|
/**
|
|
|
|
* discard;
|
|
|
|
*/
|
|
|
|
DSLStatement Discard();
|
|
|
|
|
2021-01-22 20:18:25 +00:00
|
|
|
/**
|
|
|
|
* do stmt; while (test);
|
|
|
|
*/
|
2021-02-26 01:50:32 +00:00
|
|
|
DSLStatement Do(DSLStatement stmt, DSLExpression test, PositionInfo pos = PositionInfo());
|
2021-01-22 20:18:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* for (initializer; test; next) stmt;
|
|
|
|
*/
|
|
|
|
DSLStatement For(DSLStatement initializer, DSLExpression test, DSLExpression next,
|
2021-02-26 01:50:32 +00:00
|
|
|
DSLStatement stmt, PositionInfo pos = PositionInfo());
|
2021-01-22 20:18:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* if (test) ifTrue; [else ifFalse;]
|
|
|
|
*/
|
2021-02-26 01:50:32 +00:00
|
|
|
DSLStatement If(DSLExpression test, DSLStatement ifTrue, DSLStatement ifFalse = DSLStatement(),
|
|
|
|
PositionInfo pos = PositionInfo());
|
2021-01-22 20:18:25 +00:00
|
|
|
|
2021-01-28 15:02:43 +00:00
|
|
|
/**
|
|
|
|
* return [value];
|
|
|
|
*/
|
2021-02-26 01:50:32 +00:00
|
|
|
DSLStatement Return(DSLExpression value = DSLExpression(), PositionInfo pos = PositionInfo());
|
|
|
|
|
|
|
|
/**
|
|
|
|
* test ? ifTrue : ifFalse
|
|
|
|
*/
|
|
|
|
DSLExpression Select(DSLExpression test, DSLExpression ifTrue, DSLExpression ifFalse,
|
|
|
|
PositionInfo info = PositionInfo());
|
2021-01-28 15:02:43 +00:00
|
|
|
|
2021-03-04 19:30:25 +00:00
|
|
|
DSLPossibleStatement Switch(DSLExpression value, SkSL::ExpressionArray values,
|
|
|
|
SkTArray<StatementArray> statements);
|
|
|
|
|
2021-02-09 20:22:57 +00:00
|
|
|
/**
|
|
|
|
* switch (value) { cases }
|
|
|
|
*/
|
|
|
|
template<class... Cases>
|
2021-02-26 01:50:32 +00:00
|
|
|
DSLPossibleStatement Switch(DSLExpression value, Cases... cases) {
|
2021-02-09 20:22:57 +00:00
|
|
|
SkSL::ExpressionArray caseValues;
|
|
|
|
SkTArray<StatementArray> caseStatements;
|
|
|
|
caseValues.reserve_back(sizeof...(cases));
|
|
|
|
caseStatements.reserve_back(sizeof...(cases));
|
2021-03-04 19:30:25 +00:00
|
|
|
// yet more workarounds until we can rely on C++17 support
|
|
|
|
int unused1[] = {0, (static_cast<void>(caseValues.push_back(cases.fValue.release())), 0)...};
|
|
|
|
static_cast<void>(unused1);
|
|
|
|
int unused2[] = {0, (static_cast<void>(caseStatements.push_back(std::move(cases.fStatements))),
|
|
|
|
0)...};
|
|
|
|
static_cast<void>(unused2);
|
|
|
|
return Switch(std::move(value), std::move(caseValues), std::move(caseStatements));
|
2021-02-09 20:22:57 +00:00
|
|
|
}
|
|
|
|
|
2021-01-22 20:18:25 +00:00
|
|
|
/**
|
|
|
|
* while (test) stmt;
|
|
|
|
*/
|
2021-02-26 01:50:32 +00:00
|
|
|
DSLStatement While(DSLExpression test, DSLStatement stmt, PositionInfo info = PositionInfo());
|
2021-01-07 15:57:27 +00:00
|
|
|
|
2021-02-18 21:06:17 +00:00
|
|
|
/**
|
|
|
|
* expression.xyz1
|
|
|
|
*/
|
2021-02-26 01:50:32 +00:00
|
|
|
DSLExpression Swizzle(DSLExpression base,
|
|
|
|
SkSL::SwizzleComponent::Type a,
|
|
|
|
PositionInfo pos = PositionInfo());
|
2021-01-26 19:31:29 +00:00
|
|
|
|
2021-02-18 21:06:17 +00:00
|
|
|
DSLExpression Swizzle(DSLExpression base,
|
|
|
|
SkSL::SwizzleComponent::Type a,
|
2021-02-26 01:50:32 +00:00
|
|
|
SkSL::SwizzleComponent::Type b,
|
|
|
|
PositionInfo pos = PositionInfo());
|
2021-01-26 19:31:29 +00:00
|
|
|
|
2021-02-18 21:06:17 +00:00
|
|
|
DSLExpression Swizzle(DSLExpression base,
|
|
|
|
SkSL::SwizzleComponent::Type a,
|
|
|
|
SkSL::SwizzleComponent::Type b,
|
2021-02-26 01:50:32 +00:00
|
|
|
SkSL::SwizzleComponent::Type c,
|
|
|
|
PositionInfo pos = PositionInfo());
|
2021-01-26 19:31:29 +00:00
|
|
|
|
2021-02-18 21:06:17 +00:00
|
|
|
DSLExpression Swizzle(DSLExpression base,
|
|
|
|
SkSL::SwizzleComponent::Type a,
|
|
|
|
SkSL::SwizzleComponent::Type b,
|
|
|
|
SkSL::SwizzleComponent::Type c,
|
2021-02-26 01:50:32 +00:00
|
|
|
SkSL::SwizzleComponent::Type d,
|
|
|
|
PositionInfo pos = PositionInfo());
|
2021-01-26 19:31:29 +00:00
|
|
|
|
2021-01-07 15:57:27 +00:00
|
|
|
/**
|
2021-01-26 17:00:25 +00:00
|
|
|
* Returns the absolute value of x. If x is a vector, operates componentwise.
|
2021-01-07 15:57:27 +00:00
|
|
|
*/
|
2021-02-26 01:50:32 +00:00
|
|
|
DSLExpression Abs(DSLExpression x, PositionInfo pos = PositionInfo());
|
2021-01-26 17:00:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns true if all of the components of boolean vector x are true.
|
|
|
|
*/
|
2021-02-26 01:50:32 +00:00
|
|
|
DSLExpression All(DSLExpression x, PositionInfo pos = PositionInfo());
|
2021-01-26 17:00:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns true if any of the components of boolean vector x are true.
|
|
|
|
*/
|
2021-02-26 01:50:32 +00:00
|
|
|
DSLExpression Any(DSLExpression x, PositionInfo pos = PositionInfo());
|
2021-01-26 17:00:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns x rounded towards positive infinity. If x is a vector, operates componentwise.
|
|
|
|
*/
|
2021-02-26 01:50:32 +00:00
|
|
|
DSLExpression Ceil(DSLExpression x, PositionInfo pos = PositionInfo());
|
2021-01-26 17:00:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns x clamped to between min and max. If x is a vector, operates componentwise.
|
|
|
|
*/
|
2021-02-26 01:50:32 +00:00
|
|
|
DSLExpression Clamp(DSLExpression x, DSLExpression min, DSLExpression max,
|
|
|
|
PositionInfo pos = PositionInfo());
|
2021-01-26 17:00:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the cosine of x. If x is a vector, operates componentwise.
|
|
|
|
*/
|
2021-02-26 01:50:32 +00:00
|
|
|
DSLExpression Cos(DSLExpression x, PositionInfo pos = PositionInfo());
|
2021-01-26 17:00:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the cross product of x and y.
|
|
|
|
*/
|
2021-02-26 01:50:32 +00:00
|
|
|
DSLExpression Cross(DSLExpression x, DSLExpression y, PositionInfo pos = PositionInfo());
|
2021-01-26 17:00:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns x converted from radians to degrees. If x is a vector, operates componentwise.
|
|
|
|
*/
|
2021-02-26 01:50:32 +00:00
|
|
|
DSLExpression Degrees(DSLExpression x, PositionInfo pos = PositionInfo());
|
2021-01-26 17:00:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the distance between x and y.
|
|
|
|
*/
|
2021-02-26 01:50:32 +00:00
|
|
|
DSLExpression Distance(DSLExpression x, DSLExpression y, PositionInfo pos = PositionInfo());
|
2021-01-26 17:00:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the dot product of x and y.
|
|
|
|
*/
|
2021-02-26 01:50:32 +00:00
|
|
|
DSLExpression Dot(DSLExpression x, DSLExpression y, PositionInfo pos = PositionInfo());
|
2021-01-26 17:00:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a boolean vector indicating whether components of x are equal to the corresponding
|
|
|
|
* components of y.
|
|
|
|
*/
|
2021-02-26 01:50:32 +00:00
|
|
|
DSLExpression Equal(DSLExpression x, DSLExpression y, PositionInfo pos = PositionInfo());
|
2021-01-26 17:00:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns e^x. If x is a vector, operates componentwise.
|
|
|
|
*/
|
2021-02-26 01:50:32 +00:00
|
|
|
DSLExpression Exp(DSLExpression x, PositionInfo pos = PositionInfo());
|
2021-01-26 17:00:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns 2^x. If x is a vector, operates componentwise.
|
|
|
|
*/
|
2021-02-26 01:50:32 +00:00
|
|
|
DSLExpression Exp2(DSLExpression x, PositionInfo pos = PositionInfo());
|
2021-01-26 17:00:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* If dot(i, nref) >= 0, returns n, otherwise returns -n.
|
|
|
|
*/
|
2021-02-26 01:50:32 +00:00
|
|
|
DSLExpression Faceforward(DSLExpression n, DSLExpression i, DSLExpression nref,
|
|
|
|
PositionInfo pos = PositionInfo());
|
2021-01-26 17:00:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns x rounded towards negative infinity. If x is a vector, operates componentwise.
|
|
|
|
*/
|
2021-02-26 01:50:32 +00:00
|
|
|
DSLExpression Floor(DSLExpression x, PositionInfo pos = PositionInfo());
|
2021-01-26 17:00:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the fractional part of x. If x is a vector, operates componentwise.
|
|
|
|
*/
|
2021-02-26 01:50:32 +00:00
|
|
|
DSLExpression Fract(DSLExpression x, PositionInfo pos = PositionInfo());
|
2021-01-26 17:00:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a boolean vector indicating whether components of x are greater than the corresponding
|
|
|
|
* components of y.
|
|
|
|
*/
|
2021-02-26 01:50:32 +00:00
|
|
|
DSLExpression GreaterThan(DSLExpression x, DSLExpression y, PositionInfo pos = PositionInfo());
|
2021-01-26 17:00:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a boolean vector indicating whether components of x are greater than or equal to the
|
|
|
|
* corresponding components of y.
|
|
|
|
*/
|
2021-02-26 01:50:32 +00:00
|
|
|
DSLExpression GreaterThanEqual(DSLExpression x, DSLExpression y, PositionInfo pos = PositionInfo());
|
2021-01-26 17:00:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the 1/sqrt(x). If x is a vector, operates componentwise.
|
|
|
|
*/
|
2021-02-26 01:50:32 +00:00
|
|
|
DSLExpression Inversesqrt(DSLExpression x, PositionInfo pos = PositionInfo());
|
2021-01-26 17:00:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the inverse of the matrix x.
|
|
|
|
*/
|
2021-02-26 01:50:32 +00:00
|
|
|
DSLExpression Inverse(DSLExpression x, PositionInfo pos = PositionInfo());
|
2021-01-26 17:00:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the length of the vector x.
|
|
|
|
*/
|
2021-02-26 01:50:32 +00:00
|
|
|
DSLExpression Length(DSLExpression x, PositionInfo pos = PositionInfo());
|
2021-01-26 17:00:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a boolean vector indicating whether components of x are less than the corresponding
|
|
|
|
* components of y.
|
|
|
|
*/
|
2021-02-26 01:50:32 +00:00
|
|
|
DSLExpression LessThan(DSLExpression x, DSLExpression y, PositionInfo pos = PositionInfo());
|
2021-01-26 17:00:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a boolean vector indicating whether components of x are less than or equal to the
|
|
|
|
* corresponding components of y.
|
|
|
|
*/
|
2021-02-26 01:50:32 +00:00
|
|
|
DSLExpression LessThanEqual(DSLExpression x, DSLExpression y, PositionInfo pos = PositionInfo());
|
2021-01-26 17:00:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the log base e of x. If x is a vector, operates componentwise.
|
|
|
|
*/
|
2021-02-26 01:50:32 +00:00
|
|
|
DSLExpression Log(DSLExpression x, PositionInfo pos = PositionInfo());
|
2021-01-26 17:00:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the log base 2 of x. If x is a vector, operates componentwise.
|
|
|
|
*/
|
2021-02-26 01:50:32 +00:00
|
|
|
DSLExpression Log2(DSLExpression x, PositionInfo pos = PositionInfo());
|
2021-01-26 17:00:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the larger (closer to positive infinity) of x and y. If x is a vector, operates
|
|
|
|
* componentwise. y may be either a vector of the same dimensions as x, or a scalar.
|
|
|
|
*/
|
2021-02-26 01:50:32 +00:00
|
|
|
DSLExpression Max(DSLExpression x, DSLExpression y, PositionInfo pos = PositionInfo());
|
2021-01-26 17:00:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the smaller (closer to negative infinity) of x and y. If x is a vector, operates
|
|
|
|
* componentwise. y may be either a vector of the same dimensions as x, or a scalar.
|
|
|
|
*/
|
2021-02-26 01:50:32 +00:00
|
|
|
DSLExpression Min(DSLExpression x, DSLExpression y, PositionInfo pos = PositionInfo());
|
2021-01-26 17:00:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a linear intepolation between x and y at position a, where a=0 results in x and a=1
|
|
|
|
* results in y. If x and y are vectors, operates componentwise. a may be either a vector of the
|
|
|
|
* same dimensions as x and y, or a scalar.
|
|
|
|
*/
|
2021-02-26 01:50:32 +00:00
|
|
|
DSLExpression Mix(DSLExpression x, DSLExpression y, DSLExpression a,
|
|
|
|
PositionInfo pos = PositionInfo());
|
2021-01-26 17:00:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns x modulo y. If x is a vector, operates componentwise. y may be either a vector of the
|
|
|
|
* same dimensions as x, or a scalar.
|
|
|
|
*/
|
2021-02-26 01:50:32 +00:00
|
|
|
DSLExpression Mod(DSLExpression x, DSLExpression y, PositionInfo pos = PositionInfo());
|
2021-01-26 17:00:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the vector x normalized to a length of 1.
|
|
|
|
*/
|
2021-02-26 01:50:32 +00:00
|
|
|
DSLExpression Normalize(DSLExpression x, PositionInfo pos = PositionInfo());
|
2021-01-26 17:00:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a boolean vector indicating whether components of x are not equal to the corresponding
|
|
|
|
* components of y.
|
|
|
|
*/
|
2021-02-26 01:50:32 +00:00
|
|
|
DSLExpression NotEqual(DSLExpression x, DSLExpression y, PositionInfo pos = PositionInfo());
|
2021-01-26 17:00:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns x raised to the power y. If x is a vector, operates componentwise. y may be either a
|
|
|
|
* vector of the same dimensions as x, or a scalar.
|
|
|
|
*/
|
2021-02-26 01:50:32 +00:00
|
|
|
DSLExpression Pow(DSLExpression x, DSLExpression y, PositionInfo pos = PositionInfo());
|
2021-01-26 17:00:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns x converted from degrees to radians. If x is a vector, operates componentwise.
|
|
|
|
*/
|
2021-02-26 01:50:32 +00:00
|
|
|
DSLExpression Radians(DSLExpression x, PositionInfo pos = PositionInfo());
|
2021-01-26 17:00:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns i reflected from a surface with normal n.
|
|
|
|
*/
|
2021-02-26 01:50:32 +00:00
|
|
|
DSLExpression Reflect(DSLExpression i, DSLExpression n, PositionInfo pos = PositionInfo());
|
2021-01-26 17:00:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns i refracted across a surface with normal n and ratio of indices of refraction eta.
|
|
|
|
*/
|
2021-02-26 01:50:32 +00:00
|
|
|
DSLExpression Refract(DSLExpression i, DSLExpression n, DSLExpression eta,
|
|
|
|
PositionInfo pos = PositionInfo());
|
2021-01-26 17:00:25 +00:00
|
|
|
|
2021-04-09 19:33:53 +00:00
|
|
|
/**
|
|
|
|
* Samples the child processor at the current coordinates.
|
|
|
|
*/
|
|
|
|
DSLExpression Sample(DSLExpression fp, PositionInfo pos = PositionInfo());
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Implements the following functions:
|
|
|
|
* half4 sample(fragmentProcessor fp, float3x3 transform);
|
|
|
|
* half4 sample(fragmentProcessor fp, float2 coords);
|
|
|
|
* half4 sample(fragmentProcessor fp, half4 input);
|
|
|
|
*/
|
|
|
|
DSLExpression Sample(DSLExpression target, DSLExpression x, PositionInfo pos = PositionInfo());
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Implements the following functions:
|
2021-04-13 13:50:27 +00:00
|
|
|
* half4 sample(fragmentProcessor fp, float3x3 transform, half4 input);
|
|
|
|
* half4 sample(fragmentProcessor fp, float2 coords, half4 input);
|
2021-04-09 19:33:53 +00:00
|
|
|
*/
|
|
|
|
DSLExpression Sample(DSLExpression childProcessor, DSLExpression x, DSLExpression y,
|
|
|
|
PositionInfo pos = PositionInfo());
|
|
|
|
|
2021-01-26 17:00:25 +00:00
|
|
|
/**
|
|
|
|
* Returns x clamped to the range [0, 1]. If x is a vector, operates componentwise.
|
|
|
|
*/
|
2021-02-26 01:50:32 +00:00
|
|
|
DSLExpression Saturate(DSLExpression x, PositionInfo pos = PositionInfo());
|
2021-01-26 17:00:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns -1, 0, or 1 depending on whether x is negative, zero, or positive, respectively. If x is
|
|
|
|
* a vector, operates componentwise.
|
|
|
|
*/
|
2021-02-26 01:50:32 +00:00
|
|
|
DSLExpression Sign(DSLExpression x, PositionInfo pos = PositionInfo());
|
2021-01-26 17:00:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the sine of x. If x is a vector, operates componentwise.
|
|
|
|
*/
|
2021-02-26 01:50:32 +00:00
|
|
|
DSLExpression Sin(DSLExpression x, PositionInfo pos = PositionInfo());
|
2021-01-26 17:00:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a smooth interpolation between 0 (at x=edge1) and 1 (at x=edge2). If x is a vector,
|
|
|
|
* operates componentwise. edge1 and edge2 may either be both vectors of the same dimensions as x or
|
|
|
|
* scalars.
|
|
|
|
*/
|
2021-02-26 01:50:32 +00:00
|
|
|
DSLExpression Smoothstep(DSLExpression edge1, DSLExpression edge2, DSLExpression x,
|
|
|
|
PositionInfo pos = PositionInfo());
|
2021-01-26 17:00:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the square root of x. If x is a vector, operates componentwise.
|
|
|
|
*/
|
2021-02-26 01:50:32 +00:00
|
|
|
DSLExpression Sqrt(DSLExpression x, PositionInfo pos = PositionInfo());
|
2021-01-26 17:00:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns 0 if x < edge or 1 if x >= edge. If x is a vector, operates componentwise. edge may be
|
|
|
|
* either a vector of the same dimensions as x, or a scalar.
|
|
|
|
*/
|
2021-02-26 01:50:32 +00:00
|
|
|
DSLExpression Step(DSLExpression edge, DSLExpression x, PositionInfo pos = PositionInfo());
|
2021-01-26 17:00:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the tangent of x. If x is a vector, operates componentwise.
|
|
|
|
*/
|
2021-02-26 01:50:32 +00:00
|
|
|
DSLExpression Tan(DSLExpression x, PositionInfo pos = PositionInfo());
|
2021-01-26 17:00:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns x converted from premultipled to unpremultiplied alpha.
|
|
|
|
*/
|
2021-02-26 01:50:32 +00:00
|
|
|
DSLExpression Unpremul(DSLExpression x, PositionInfo pos = PositionInfo());
|
2021-01-07 15:57:27 +00:00
|
|
|
|
|
|
|
} // namespace dsl
|
|
|
|
|
|
|
|
} // namespace SkSL
|
|
|
|
|
|
|
|
#endif
|