shaderir/metal: Better array initialization

Updates #1285
This commit is contained in:
Hajime Hoshi 2020-08-09 04:40:12 +09:00
parent a536b3ee25
commit febdc46ad5

View File

@ -196,15 +196,9 @@ func (c *compileContext) metalVarInit(p *shaderir.Program, t *shaderir.Type) str
case shaderir.None:
return "?(none)"
case shaderir.Array:
init := c.metalVarInit(p, &t.Sub[0])
es := make([]string, 0, t.Length)
for i := 0; i < t.Length; i++ {
es = append(es, init)
}
t := typeString(t, false, false)
return fmt.Sprintf("%s{%s}", t, strings.Join(es, ", "))
return "{}"
case shaderir.Struct:
panic("not implemented")
return "{}"
case shaderir.Bool:
return "false"
case shaderir.Int: