internal/shader: change the naming convention: Num -> Count

This commit is contained in:
Hajime Hoshi 2022-07-13 01:50:19 +09:00
parent afed6a83c6
commit dce34d2306
2 changed files with 5 additions and 5 deletions

View File

@ -517,7 +517,7 @@ func (cs *compileState) parseExpr(block *block, expr ast.Expr, markLocalVariable
var outParams []int var outParams []int
for _, p := range f.ir.OutParams { for _, p := range f.ir.OutParams {
idx := block.totalLocalVariableNum() idx := block.totalLocalVariableCount()
block.vars = append(block.vars, variable{ block.vars = append(block.vars, variable{
typ: p, typ: p,
}) })
@ -736,7 +736,7 @@ func (cs *compileState) parseExpr(block *block, expr ast.Expr, markLocalVariable
t.Length = len(e.Elts) t.Length = len(e.Elts)
} }
idx := block.totalLocalVariableNum() idx := block.totalLocalVariableCount()
block.vars = append(block.vars, variable{ block.vars = append(block.vars, variable{
typ: t, typ: t,
}) })

View File

@ -95,10 +95,10 @@ type block struct {
ir *shaderir.Block ir *shaderir.Block
} }
func (b *block) totalLocalVariableNum() int { func (b *block) totalLocalVariableCount() int {
c := len(b.vars) c := len(b.vars)
if b.outer != nil { if b.outer != nil {
c += b.outer.totalLocalVariableNum() c += b.outer.totalLocalVariableCount()
} }
return c return c
} }
@ -354,7 +354,7 @@ func (cs *compileState) parseDecl(b *block, d ast.Decl) ([]shaderir.Stmt, bool)
} }
// base must be obtained before adding the variables. // base must be obtained before adding the variables.
base := b.totalLocalVariableNum() base := b.totalLocalVariableCount()
for _, v := range vs { for _, v := range vs {
b.addNamedLocalVariable(v.name, v.typ, d.Pos()) b.addNamedLocalVariable(v.name, v.typ, d.Pos())
} }