mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-02 07:57:29 +00:00
app/internal/d3d11,gpu/gl: simplify BeginFrame implementations
BeginFrame returns the output framebuffer, and need not be as general as the newly unexported currentFramebuffer methods. No functional change. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+3
-7
@@ -170,7 +170,8 @@ func NewBackend(ctx Context) (*Backend, error) {
|
||||
func (b *Backend) BeginFrame() backend.Framebuffer {
|
||||
// Assume GL state is reset between frames.
|
||||
b.state = glstate{}
|
||||
return b.currentFramebuffer()
|
||||
fboID := glimpl.Framebuffer(b.funcs.GetBinding(glimpl.FRAMEBUFFER_BINDING))
|
||||
return &gpuFramebuffer{backend: b, obj: fboID, foreign: true}
|
||||
}
|
||||
|
||||
func (b *Backend) EndFrame() {
|
||||
@@ -229,11 +230,6 @@ func (b *Backend) NewFramebuffer(tex backend.Texture, depthBits int) (backend.Fr
|
||||
return fbo, nil
|
||||
}
|
||||
|
||||
func (b *Backend) currentFramebuffer() backend.Framebuffer {
|
||||
fboID := glimpl.Framebuffer(b.funcs.GetBinding(glimpl.FRAMEBUFFER_BINDING))
|
||||
return &gpuFramebuffer{backend: b, obj: fboID, foreign: true}
|
||||
}
|
||||
|
||||
func (b *Backend) NewTexture(format backend.TextureFormat, width, height int, minFilter, magFilter backend.TextureFilter, binding backend.BufferBinding) (backend.Texture, error) {
|
||||
glErr(b.funcs)
|
||||
tex := &gpuTexture{backend: b, obj: b.funcs.CreateTexture(), width: width, height: height}
|
||||
@@ -803,7 +799,7 @@ func (f *gpuFramebuffer) Invalidate() {
|
||||
|
||||
func (f *gpuFramebuffer) Release() {
|
||||
if f.foreign {
|
||||
panic("framebuffer not created by NewBuffer")
|
||||
panic("framebuffer not created by NewFramebuffer")
|
||||
}
|
||||
f.backend.funcs.DeleteFramebuffer(f.obj)
|
||||
if f.hasDepth {
|
||||
|
||||
Reference in New Issue
Block a user