mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-05 17:35:36 +00:00
app: ensure the previous frame is complete before accepting another
It matters for end-to-end tests that rely on the window contents. Before this change, tests had to wait for 2 extra frames. This change ensures that the first completed FrameEvent.Frame call guarantees the previous frame is complete. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+7
-7
@@ -261,13 +261,6 @@ func (w *Window) run(opts *window.Options) {
|
|||||||
w.hasNextFrame = false
|
w.hasNextFrame = false
|
||||||
e2.Frame = w.update
|
e2.Frame = w.update
|
||||||
w.out <- e2.FrameEvent
|
w.out <- e2.FrameEvent
|
||||||
var frame *op.Ops
|
|
||||||
// Wait for either a frame or the ack event,
|
|
||||||
// which meant that the client didn't draw.
|
|
||||||
select {
|
|
||||||
case frame = <-w.frames:
|
|
||||||
case w.out <- ackEvent:
|
|
||||||
}
|
|
||||||
if w.gpu != nil {
|
if w.gpu != nil {
|
||||||
if e2.Sync {
|
if e2.Sync {
|
||||||
w.gpu.Refresh()
|
w.gpu.Refresh()
|
||||||
@@ -290,6 +283,13 @@ func (w *Window) run(opts *window.Options) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
var frame *op.Ops
|
||||||
|
// Wait for either a frame or the ack event,
|
||||||
|
// which meant that the client didn't draw.
|
||||||
|
select {
|
||||||
|
case frame = <-w.frames:
|
||||||
|
case w.out <- ackEvent:
|
||||||
|
}
|
||||||
w.draw(e2.Size, frame)
|
w.draw(e2.Size, frame)
|
||||||
if e2.Sync {
|
if e2.Sync {
|
||||||
if err := w.gpu.Flush(); err != nil {
|
if err := w.gpu.Flush(); err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user