diff --git a/internal/graphicsdriver/opengl/context_js.go b/internal/graphicsdriver/opengl/context_js.go index ce44ff9eb..c14a6557f 100644 --- a/internal/graphicsdriver/opengl/context_js.go +++ b/internal/graphicsdriver/opengl/context_js.go @@ -517,7 +517,9 @@ func (c *context) uniformFloats(p program, location string, v []float32, typ sha gl.uniformMatrix4fv.Invoke(js.Value(l), false, arr.Call("subarray", 0, len(v))) } default: - panic(fmt.Sprintf("opengl: unexpected type: %s", typ.String())) + // Copy shaderir.Type value to avoid heap allocation of typ. + t := typ + panic(fmt.Sprintf("opengl: unexpected type: %s", t.String())) } return true