mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 07:35:40 +00:00
gpu: [compute] move timer initialization from Collect to Frame
GPU operations logically belong in the Frame method, and it's probably best to keep them inside BeginFrame/EndFrame as well. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+11
-10
@@ -264,16 +264,6 @@ func (g *compute) Collect(viewport image.Point, ops *op.Ops) {
|
||||
for _, img := range g.drawOps.allImageOps {
|
||||
expandPathOp(img.path, img.clip)
|
||||
}
|
||||
if g.drawOps.profile && g.timers.t == nil && g.ctx.Caps().Features.Has(driver.FeatureTimers) {
|
||||
t := &g.timers
|
||||
t.t = newTimers(g.ctx)
|
||||
t.elements = g.timers.t.newTimer()
|
||||
t.tileAlloc = g.timers.t.newTimer()
|
||||
t.pathCoarse = g.timers.t.newTimer()
|
||||
t.backdropBinning = g.timers.t.newTimer()
|
||||
t.coarse = g.timers.t.newTimer()
|
||||
t.kernel4 = g.timers.t.newTimer()
|
||||
}
|
||||
}
|
||||
|
||||
func (g *compute) Clear(col color.NRGBA) {
|
||||
@@ -291,6 +281,17 @@ func (g *compute) Frame() error {
|
||||
defFBO := g.ctx.BeginFrame()
|
||||
defer g.ctx.EndFrame()
|
||||
|
||||
if g.drawOps.profile && g.timers.t == nil && g.ctx.Caps().Features.Has(driver.FeatureTimers) {
|
||||
t := &g.timers
|
||||
t.t = newTimers(g.ctx)
|
||||
t.elements = g.timers.t.newTimer()
|
||||
t.tileAlloc = g.timers.t.newTimer()
|
||||
t.pathCoarse = g.timers.t.newTimer()
|
||||
t.backdropBinning = g.timers.t.newTimer()
|
||||
t.coarse = g.timers.t.newTimer()
|
||||
t.kernel4 = g.timers.t.newTimer()
|
||||
}
|
||||
|
||||
if err := g.encode(viewport); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user