gpu: make Buffers immutable

The GPU implementation only uses immutable buffers so far, so let's
make it easy and performant for the backends.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2020-02-16 17:48:58 +01:00
parent 49365dbcc5
commit f62725ea77
4 changed files with 11 additions and 28 deletions
+2 -4
View File
@@ -143,8 +143,7 @@ func newStenciler(ctx Backend) *stenciler {
indices[i*6+4] = i*4 + 1
indices[i*6+5] = i*4 + 3
}
indexBuf := ctx.NewBuffer(BufferTypeIndices)
indexBuf.Upload(BufferUsageStaticDraw, gunsafe.BytesView(indices))
indexBuf := ctx.NewBuffer(BufferTypeIndices, gunsafe.BytesView(indices))
return &stenciler{
ctx: ctx,
defFBO: defFBO,
@@ -218,8 +217,7 @@ func (c *coverer) release() {
}
func buildPath(ctx Backend, p []byte) *pathData {
buf := ctx.NewBuffer(BufferTypeData)
buf.Upload(BufferUsageStaticDraw, p)
buf := ctx.NewBuffer(BufferTypeData, p)
return &pathData{
ncurves: len(p) / path.VertStride,
data: buf,