internal/graphicsdriver/opengl: Optimization: Avoid heap allocations

This commit is contained in:
Hajime Hoshi 2021-10-31 02:10:44 +09:00
parent 7b7791156c
commit b74a4a0275

View File

@ -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