shader: Indexing with non-consntat value should be allowed

This commit is contained in:
Hajime Hoshi 2020-08-09 22:50:53 +09:00
parent 5dc0d4e1a4
commit eacc9fac6a

View File

@ -513,11 +513,9 @@ func (cs *compileState) parseExpr(block *block, expr ast.Expr) ([]shaderir.Expr,
return nil, nil, nil, false
}
idx := exprs[0]
if idx.Type != shaderir.NumberExpr {
cs.addError(e.Pos(), fmt.Sprintf("an index must be a constant number"))
return nil, nil, nil, false
if idx.Type == shaderir.NumberExpr {
idx.ConstType = shaderir.ConstTypeInt
}
idx.ConstType = shaderir.ConstTypeInt
exprs, ts, ss, ok := cs.parseExpr(block, e.X)
if !ok {