forked from joejulian/gio
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 {
|
for _, img := range g.drawOps.allImageOps {
|
||||||
expandPathOp(img.path, img.clip)
|
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) {
|
func (g *compute) Clear(col color.NRGBA) {
|
||||||
@@ -291,6 +281,17 @@ func (g *compute) Frame() error {
|
|||||||
defFBO := g.ctx.BeginFrame()
|
defFBO := g.ctx.BeginFrame()
|
||||||
defer g.ctx.EndFrame()
|
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 {
|
if err := g.encode(viewport); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user