From 7c8fbb43772cc8a5efd2ceca071d553cc55d7e45 Mon Sep 17 00:00:00 2001 From: Frizi Date: Tue, 15 Jun 2021 12:02:31 +0200 Subject: [PATCH] [glsl-in] support more math functions and builitns --- src/front/glsl/functions.rs | 5 ++++- src/front/glsl/variables.rs | 9 +++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/front/glsl/functions.rs b/src/front/glsl/functions.rs index 9e7655e4bb..9bddc953db 100644 --- a/src/front/glsl/functions.rs +++ b/src/front/glsl/functions.rs @@ -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, diff --git a/src/front/glsl/variables.rs b/src/front/glsl/variables.rs index fc54c5daff..9636281cef 100644 --- a/src/front/glsl/variables.rs +++ b/src/front/glsl/variables.rs @@ -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), } }