mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 10:48:53 +01:00
internal/graphicsdriver/opengl: Avoid allocations by escaping to heap
This commit is contained in:
parent
a3eb8933e5
commit
7661147e31
@ -418,7 +418,9 @@ func (c *context) uniformFloats(p program, location string, v []float32, typ sha
|
||||
case shaderir.Mat4:
|
||||
gl.UniformMatrix4fv(l, len, false, (*float32)(gl.Ptr(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
|
||||
}
|
||||
|
@ -384,7 +384,9 @@ func (c *context) uniformFloats(p program, location string, v []float32, typ sha
|
||||
case shaderir.Mat4:
|
||||
c.ctx.UniformMatrix4fv(int32(l), false, 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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user