mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-05 17:35:36 +00:00
gpu,gpu/gl: specialize Buffer.Bind to Buffer.BindIndex
Direct3D can't support a generic Bind, and we don't need it now BindVertex was added. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+1
-1
@@ -116,7 +116,7 @@ type Uniform interface{}
|
|||||||
|
|
||||||
type Buffer interface {
|
type Buffer interface {
|
||||||
BindVertex(stride, offset int)
|
BindVertex(stride, offset int)
|
||||||
Bind()
|
BindIndex()
|
||||||
Release()
|
Release()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+6
-3
@@ -174,7 +174,7 @@ func (b *Backend) NewBuffer(typ gpu.BufferType, data []byte) gpu.Buffer {
|
|||||||
panic("unsupported buffer type")
|
panic("unsupported buffer type")
|
||||||
}
|
}
|
||||||
buf := &gpuBuffer{backend: b, obj: obj, typ: gltyp}
|
buf := &gpuBuffer{backend: b, obj: obj, typ: gltyp}
|
||||||
buf.Bind()
|
b.funcs.BindBuffer(gltyp, obj)
|
||||||
b.funcs.BufferData(gltyp, data, STATIC_DRAW)
|
b.funcs.BufferData(gltyp, data, STATIC_DRAW)
|
||||||
return buf
|
return buf
|
||||||
}
|
}
|
||||||
@@ -395,8 +395,11 @@ func (b *Backend) setupVertexArrays() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *gpuBuffer) Bind() {
|
func (b *gpuBuffer) BindIndex() {
|
||||||
b.backend.funcs.BindBuffer(b.typ, b.obj)
|
if b.typ != ELEMENT_ARRAY_BUFFER {
|
||||||
|
panic("not an index buffer")
|
||||||
|
}
|
||||||
|
b.backend.funcs.BindBuffer(ELEMENT_ARRAY_BUFFER, b.obj)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *gpuFramebuffer) IsComplete() error {
|
func (f *gpuFramebuffer) IsComplete() error {
|
||||||
|
|||||||
+1
-1
@@ -294,7 +294,7 @@ func (s *stenciler) begin(sizes []image.Point) {
|
|||||||
s.ctx.ClearColor(0.0, 0.0, 0.0, 0.0)
|
s.ctx.ClearColor(0.0, 0.0, 0.0, 0.0)
|
||||||
s.prog.Bind()
|
s.prog.Bind()
|
||||||
s.progLayout.Bind()
|
s.progLayout.Bind()
|
||||||
s.indexBuf.Bind()
|
s.indexBuf.BindIndex()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *stenciler) stencilPath(bounds image.Rectangle, offset f32.Point, uv image.Point, data *pathData) {
|
func (s *stenciler) stencilPath(bounds image.Rectangle, offset f32.Point, uv image.Point, data *pathData) {
|
||||||
|
|||||||
Reference in New Issue
Block a user