mirror of
https://github.com/gfx-rs/wgpu.git
synced 2026-04-22 03:02:01 -04:00
[glsl-in] support more math functions and builitns
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user