[glsl-in] support more math functions and builitns

This commit is contained in:
Frizi
2021-06-15 12:02:31 +02:00
committed by Dzmitry Malyshau
parent bff8b18a01
commit 7c8fbb4377
2 changed files with 13 additions and 1 deletions

View File

@@ -270,7 +270,7 @@ impl Program<'_> {
Ok(Some(ctx.add_expression(expr, body)))
}
"pow" | "dot" | "max" => {
"pow" | "dot" | "max" | "min" | "reflect" | "cross" => {
if args.len() != 2 {
return Err(ErrorKind::wrong_function_args(name, 2, args.len(), meta));
}
@@ -280,6 +280,9 @@ impl Program<'_> {
"pow" => MathFunction::Pow,
"dot" => MathFunction::Dot,
"max" => MathFunction::Max,
"min" => MathFunction::Min,
"reflect" => MathFunction::Reflect,
"cross" => MathFunction::Cross,
_ => unreachable!(),
},
arg: args[0].0,

View File

@@ -115,6 +115,15 @@ impl Program<'_> {
false,
PrologueStage::COMPUTE,
),
"gl_FrontFacing" => add_builtin(
TypeInner::Scalar {
kind: ScalarKind::Bool,
width: 1,
},
BuiltIn::FrontFacing,
false,
PrologueStage::FRAGMENT,
),
_ => Ok(None),
}
}