From e2662a8af7aaf742844abc3ef1f30b25bdfc5228 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sun, 25 Aug 2024 18:58:05 +0900 Subject: [PATCH] internal/shader: bug fix: wrong indexing --- internal/shader/shader.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/shader/shader.go b/internal/shader/shader.go index 19c60b0d0..1aa6e7b1b 100644 --- a/internal/shader/shader.go +++ b/internal/shader/shader.go @@ -824,10 +824,11 @@ func (cs *compileState) parseFunc(block *block, d *ast.FuncDecl) (function, bool // The 0th inParams is a special variable for position and is not included in varying variables. if diff := len(cs.ir.Varyings) - (len(inParams) - 1); diff > 0 { // inParams is not enough when the vertex shader has more returning values than the fragment shader's arguments. + orig := len(inParams) - 1 for i := 0; i < diff; i++ { inParams = append(inParams, variable{ name: "_", - typ: cs.ir.Varyings[len(inParams)-1+i], + typ: cs.ir.Varyings[orig+i], }) } }