From 4d20da9bc0a4a7a3e778df186c866e45f5baec12 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Mon, 10 Aug 2020 02:02:26 +0900 Subject: [PATCH] shader: Refactoring --- internal/shader/shader.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/shader/shader.go b/internal/shader/shader.go index c6c612a2c..f84642b15 100644 --- a/internal/shader/shader.go +++ b/internal/shader/shader.go @@ -673,10 +673,10 @@ func (cs *compileState) parseBlock(outer *block, fname string, stmts []ast.Stmt, offset = 0 case outer.outer == nil: offset = len(inParams) + len(outParams) - case outer.outer.outer == nil: - offset = len(outer.outer.vars) + len(outer.vars) default: - offset = outer.ir.LocalVarIndexOffset + len(outer.vars) + for b := outer; b != nil; b = b.outer { + offset += len(b.vars) + } } block := &block{