mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 07:35:40 +00:00
app/headless: bind output framebuffer at render, not creation
Bind the framebuffer as late as possible to lessen the risk of
confusing global state (current framebuffer). Commit
25a19481e3 removed the assumption
that the framebuffer current at gpu.New would always be the output
framebuffer
Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -62,7 +62,6 @@ func NewWindow(width, height int) (*Window, error) {
|
||||
fboTex.Release()
|
||||
return err
|
||||
}
|
||||
dev.BindFramebuffer(fbo)
|
||||
gp, err := gpu.New(dev)
|
||||
if err != nil {
|
||||
fbo.Release()
|
||||
@@ -109,6 +108,7 @@ func (w *Window) Release() {
|
||||
// operation list.
|
||||
func (w *Window) Frame(frame *op.Ops) error {
|
||||
return contextDo(w.ctx, func() error {
|
||||
w.backend.BindFramebuffer(w.fbo)
|
||||
w.gpu.Clear(color.NRGBA{A: 0xff, R: 0xff, G: 0xff, B: 0xff})
|
||||
w.gpu.Collect(w.size, frame)
|
||||
return w.gpu.Frame()
|
||||
|
||||
Reference in New Issue
Block a user