app,app/internal/gpu: process frame in parallel

A frame ops buffers is tracersed twice: once for GPU commands,
and once for everything else. There is already a GPU goroutine for
concurrentl issuing of GPU commands; move the frame ops processing
to the goroutine as well. Both frame ops passed can then proceed
in parallel.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2019-11-08 13:50:49 +01:00
parent 1678f922e7
commit 1eaa5dd15e
2 changed files with 33 additions and 25 deletions
+3 -1
View File
@@ -122,7 +122,7 @@ func (w *Window) update(frame *op.Ops) {
}
func (w *Window) draw(frameStart time.Time, size image.Point, frame *op.Ops) {
w.gpu.Draw(w.queue.q.Profiling(), size, frame)
sync := w.gpu.Draw(w.queue.q.Profiling(), size, frame)
w.queue.q.Frame(frame)
switch w.queue.q.TextInputState() {
case input.TextInputOpen:
@@ -141,6 +141,8 @@ func (w *Window) draw(frameStart time.Time, size image.Point, frame *op.Ops) {
w.setNextFrame(t)
}
w.updateAnimation()
// Wait for the GPU goroutine to finish processing frame.
<-sync
}
// Invalidate the window such that a FrameEvent will be generated