mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 18:58:54 +01:00
Revert "graphicsdriver/opengl: Reduce creation of Float32Array"
This reverts commit 3c28bcf3c4
.
Reason: Tests failed: https://github.com/hajimehoshi/ebiten/runs/1496602911
This commit is contained in:
parent
ce624ce134
commit
d4a2433643
@ -386,29 +386,24 @@ func (c *context) uniformFloats(p program, location string, v []float32, typ sha
|
||||
base = typ.Sub[0].Main
|
||||
}
|
||||
|
||||
arr8 := jsutil.TemporaryUint8Array(len(v) * 4)
|
||||
arr := js.Global().Get("Float32Array").New(arr8.Get("buffer"), arr8.Get("byteOffset"), len(v))
|
||||
jsutil.CopySliceToJS(arr, v)
|
||||
|
||||
switch base {
|
||||
case shaderir.Float:
|
||||
gl.Call("uniform1f", js.Value(l), v[0])
|
||||
gl.Call("uniform1fv", js.Value(l), arr)
|
||||
case shaderir.Vec2:
|
||||
gl.Call("uniform2f", js.Value(l), v[0], v[1])
|
||||
gl.Call("uniform2fv", js.Value(l), arr)
|
||||
case shaderir.Vec3:
|
||||
gl.Call("uniform3f", js.Value(l), v[0], v[1], v[2])
|
||||
gl.Call("uniform3fv", js.Value(l), arr)
|
||||
case shaderir.Vec4:
|
||||
gl.Call("uniform4f", js.Value(l), v[0], v[1], v[2], v[3])
|
||||
gl.Call("uniform4fv", js.Value(l), arr)
|
||||
case shaderir.Mat2:
|
||||
arr8 := jsutil.TemporaryUint8Array(len(v) * 4)
|
||||
arr := js.Global().Get("Float32Array").New(arr8.Get("buffer"), arr8.Get("byteOffset"), len(v))
|
||||
jsutil.CopySliceToJS(arr, v)
|
||||
gl.Call("uniformMatrix2fv", js.Value(l), false, arr)
|
||||
case shaderir.Mat3:
|
||||
arr8 := jsutil.TemporaryUint8Array(len(v) * 4)
|
||||
arr := js.Global().Get("Float32Array").New(arr8.Get("buffer"), arr8.Get("byteOffset"), len(v))
|
||||
jsutil.CopySliceToJS(arr, v)
|
||||
gl.Call("uniformMatrix3fv", js.Value(l), false, arr)
|
||||
case shaderir.Mat4:
|
||||
arr8 := jsutil.TemporaryUint8Array(len(v) * 4)
|
||||
arr := js.Global().Get("Float32Array").New(arr8.Get("buffer"), arr8.Get("byteOffset"), len(v))
|
||||
jsutil.CopySliceToJS(arr, v)
|
||||
gl.Call("uniformMatrix4fv", js.Value(l), false, arr)
|
||||
default:
|
||||
panic(fmt.Sprintf("opengl: unexpected type: %s", typ.String()))
|
||||
|
Loading…
Reference in New Issue
Block a user