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
+1 -7
View File
@@ -22,7 +22,7 @@ type Backend interface {
DefaultFramebuffer() Framebuffer
NilTexture() Texture
NewFramebuffer() Framebuffer
NewBuffer(typ BufferType) Buffer
NewBuffer(typ BufferType, data []byte) Buffer
NewProgram(vertexShader, fragmentShader string, attribMap []string) (Program, error)
SetupVertexArray(slot int, size int, dataType DataType, stride, offset int)
@@ -49,7 +49,6 @@ type TextureFilter uint8
type TextureFormat uint8
type BufferType uint8
type BufferUsage uint8
type DataType uint8
@@ -76,7 +75,6 @@ type Uniform interface{}
type Buffer interface {
Bind()
Upload(usage BufferUsage, data []byte)
Release()
}
@@ -116,10 +114,6 @@ const (
DataTypeShort
)
const (
BufferUsageStaticDraw BufferUsage = iota
)
const (
BufferTypeIndices BufferType = iota
BufferTypeData