From aecd29325e5915797a791b56b3e4a80de5e883d0 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sat, 11 Jul 2020 21:46:21 +0900 Subject: [PATCH] shaderir: Bug fix: Wrong function names for some bulitin funcs --- internal/shaderir/glsl.go | 2 +- internal/shaderir/program.go | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/internal/shaderir/glsl.go b/internal/shaderir/glsl.go index 31125da6d..c45722fb6 100644 --- a/internal/shaderir/glsl.go +++ b/internal/shaderir/glsl.go @@ -307,7 +307,7 @@ func (p *Program) glslBlock(topBlock, block *Block, level int, localVarIndex int case StructMember: return fmt.Sprintf("M%d", e.Index) case BuiltinFuncExpr: - return string(e.BuiltinFunc) + return e.BuiltinFunc.Glsl() case SwizzlingExpr: if !isValidSwizzling(e.Swizzling) { return fmt.Sprintf("?(unexpected swizzling: %s)", e.Swizzling) diff --git a/internal/shaderir/program.go b/internal/shaderir/program.go index b15038e34..05598c977 100644 --- a/internal/shaderir/program.go +++ b/internal/shaderir/program.go @@ -307,3 +307,20 @@ func ParseBuiltinFunc(str string) (BuiltinFunc, bool) { } return "", false } + +func (f BuiltinFunc) Glsl() string { + switch f { + case LessThan: + return "lessThan" + case LessThanEqual: + return "lessThanEqual" + case GreaterThan: + return "greaterThan" + case GreaterThanEqual: + return "greaterThanEqual" + case NotEqual: + return "notEqual" + default: + return string(f) + } +}