mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-04 08:55:35 +00:00
gpu: rename NewBuffer to NewImmutableBuffer
Prepare for adding NewBuffer for mutable buffers. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+1
-1
@@ -22,7 +22,7 @@ type Backend interface {
|
|||||||
DefaultFramebuffer() Framebuffer
|
DefaultFramebuffer() Framebuffer
|
||||||
NilTexture() Texture
|
NilTexture() Texture
|
||||||
NewFramebuffer() Framebuffer
|
NewFramebuffer() Framebuffer
|
||||||
NewBuffer(typ BufferType, data []byte) Buffer
|
NewImmutableBuffer(typ BufferType, data []byte) Buffer
|
||||||
NewProgram(vertexShader, fragmentShader ShaderSources) (Program, error)
|
NewProgram(vertexShader, fragmentShader ShaderSources) (Program, error)
|
||||||
NewInputLayout(vertexShader ShaderSources, layout []InputDesc) (InputLayout, error)
|
NewInputLayout(vertexShader ShaderSources, layout []InputDesc) (InputLayout, error)
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -162,7 +162,7 @@ func (b *Backend) NewTexture(minFilter, magFilter gpu.TextureFilter) gpu.Texture
|
|||||||
return tex
|
return tex
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *Backend) NewBuffer(typ gpu.BufferType, data []byte) gpu.Buffer {
|
func (b *Backend) NewImmutableBuffer(typ gpu.BufferType, data []byte) gpu.Buffer {
|
||||||
obj := b.funcs.CreateBuffer()
|
obj := b.funcs.CreateBuffer()
|
||||||
var gltyp Enum
|
var gltyp Enum
|
||||||
switch typ {
|
switch typ {
|
||||||
|
|||||||
+1
-1
@@ -376,7 +376,7 @@ func newBlitter(ctx Backend) *blitter {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
quadVerts := ctx.NewBuffer(BufferTypeVertices,
|
quadVerts := ctx.NewImmutableBuffer(BufferTypeVertices,
|
||||||
gunsafe.BytesView([]float32{
|
gunsafe.BytesView([]float32{
|
||||||
-1, +1, 0, 0,
|
-1, +1, 0, 0,
|
||||||
+1, +1, 1, 0,
|
+1, +1, 1, 0,
|
||||||
|
|||||||
+2
-2
@@ -142,7 +142,7 @@ func newStenciler(ctx Backend) *stenciler {
|
|||||||
indices[i*6+4] = i*4 + 1
|
indices[i*6+4] = i*4 + 1
|
||||||
indices[i*6+5] = i*4 + 3
|
indices[i*6+5] = i*4 + 3
|
||||||
}
|
}
|
||||||
indexBuf := ctx.NewBuffer(BufferTypeIndices, gunsafe.BytesView(indices))
|
indexBuf := ctx.NewImmutableBuffer(BufferTypeIndices, gunsafe.BytesView(indices))
|
||||||
progLayout, err := ctx.NewInputLayout(shader_stencil_vert, []InputDesc{
|
progLayout, err := ctx.NewInputLayout(shader_stencil_vert, []InputDesc{
|
||||||
{Type: DataTypeShort, Size: 2, Offset: int(unsafe.Offsetof((*(*path.Vertex)(nil)).CornerX))},
|
{Type: DataTypeShort, Size: 2, Offset: int(unsafe.Offsetof((*(*path.Vertex)(nil)).CornerX))},
|
||||||
{Type: DataTypeFloat, Size: 1, Offset: int(unsafe.Offsetof((*(*path.Vertex)(nil)).MaxY))},
|
{Type: DataTypeFloat, Size: 1, Offset: int(unsafe.Offsetof((*(*path.Vertex)(nil)).MaxY))},
|
||||||
@@ -239,7 +239,7 @@ func (c *coverer) release() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func buildPath(ctx Backend, p []byte) *pathData {
|
func buildPath(ctx Backend, p []byte) *pathData {
|
||||||
buf := ctx.NewBuffer(BufferTypeVertices, p)
|
buf := ctx.NewImmutableBuffer(BufferTypeVertices, p)
|
||||||
return &pathData{
|
return &pathData{
|
||||||
ncurves: len(p) / path.VertStride,
|
ncurves: len(p) / path.VertStride,
|
||||||
data: buf,
|
data: buf,
|
||||||
|
|||||||
Reference in New Issue
Block a user