Regeneration on ever 'n' now, but it gets scheduled on every frame in that semaphore group
This commit is contained in:
parent
11b9cba8ac
commit
1a5ed92c14
1 changed files with 7 additions and 3 deletions
|
@ -170,10 +170,13 @@ class Renderer: NSObject, MTKViewDelegate {
|
||||||
_ = inFlightSemaphore.wait(timeout: DispatchTime.distantFuture)
|
_ = inFlightSemaphore.wait(timeout: DispatchTime.distantFuture)
|
||||||
|
|
||||||
if let commandBuffer = commandQueue.makeCommandBuffer() {
|
if let commandBuffer = commandQueue.makeCommandBuffer() {
|
||||||
let semaphore = inFlightSemaphore
|
var didScheduleAlgorithmIteration = false
|
||||||
|
let inFlightSem = self.inFlightSemaphore
|
||||||
commandBuffer.addCompletedHandler { (_ commandBuffer)-> Swift.Void in
|
commandBuffer.addCompletedHandler { (_ commandBuffer)-> Swift.Void in
|
||||||
|
if didScheduleAlgorithmIteration && self.iterateTerrainAlgorithm {
|
||||||
self.iterateTerrainAlgorithm = false
|
self.iterateTerrainAlgorithm = false
|
||||||
semaphore.signal()
|
}
|
||||||
|
inFlightSem.signal()
|
||||||
}
|
}
|
||||||
|
|
||||||
self.updateDynamicBufferState()
|
self.updateDynamicBufferState()
|
||||||
|
@ -187,6 +190,7 @@ class Renderer: NSObject, MTKViewDelegate {
|
||||||
terrain.algorithm.encode(in: computeEncoder)
|
terrain.algorithm.encode(in: computeEncoder)
|
||||||
computeEncoder.popDebugGroup()
|
computeEncoder.popDebugGroup()
|
||||||
computeEncoder.endEncoding()
|
computeEncoder.endEncoding()
|
||||||
|
didScheduleAlgorithmIteration = true
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Delay getting the currentRenderPassDescriptor until we absolutely need it to avoid
|
/// Delay getting the currentRenderPassDescriptor until we absolutely need it to avoid
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue