shaderir: Do not use () for the callees

This commit is contained in:
Hajime Hoshi 2020-05-23 18:06:50 +09:00
parent 7b960a2df4
commit 7937b302e3
2 changed files with 8 additions and 7 deletions

View File

@ -254,7 +254,8 @@ func (p *Program) glslBlock(b *Block, level int, localVarIndex int) []string {
for _, exp := range e.Exprs[1:] {
args = append(args, glslExpr(&exp))
}
return fmt.Sprintf("(%s)(%s)", glslExpr(&e.Exprs[0]), strings.Join(args, ", "))
// Using parentheses at the callee is illegal.
return fmt.Sprintf("%s(%s)", glslExpr(&e.Exprs[0]), strings.Join(args, ", "))
case FieldSelector:
return fmt.Sprintf("(%s).%s", glslExpr(&e.Exprs[0]), glslExpr(&e.Exprs[1]))
case Index:

View File

@ -456,12 +456,12 @@ varying vec3 V0;`,
},
},
GlslVS: `void F0(in float l0, in float l1, out vec2 l2) {
(F1)();
l2 = (F2)(l0, l1);
F1();
l2 = F2(l0, l1);
}`,
GlslFS: `void F0(in float l0, in float l1, out vec2 l2) {
(F1)();
l2 = (F2)(l0, l1);
F1();
l2 = F2(l0, l1);
}`,
},
{
@ -492,10 +492,10 @@ varying vec3 V0;`,
},
},
GlslVS: `void F0(in float l0, in float l1, out float l2) {
l2 = (min)(l0, l1);
l2 = min(l0, l1);
}`,
GlslFS: `void F0(in float l0, in float l1, out float l2) {
l2 = (min)(l0, l1);
l2 = min(l0, l1);
}`,
},
{