shaderir: Bug fix: Wrong function names for some bulitin funcs

This commit is contained in:
Hajime Hoshi 2020-07-11 21:46:21 +09:00
parent 776de77744
commit aecd29325e
2 changed files with 18 additions and 1 deletions

View File

@ -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)

View File

@ -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)
}
}