Wait on the semaphore and signal when the buffer is done
This commit is contained in:
		
							parent
							
								
									dd0306f67a
								
							
						
					
					
						commit
						f4a9f56fa7
					
				
					 1 changed files with 5 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -199,6 +199,11 @@ public class Renderer: NSObject, MTKViewDelegate {
 | 
			
		|||
 | 
			
		||||
        var didEncode = false
 | 
			
		||||
 | 
			
		||||
        // Make sure we attempt to enqueue more than one buffer at a time.
 | 
			
		||||
        inFlightSemaphore.wait()
 | 
			
		||||
        buffer.addCompletedHandler { _ in
 | 
			
		||||
            self.inFlightSemaphore.signal()
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        buffer.label = "Metaballs Command Buffer"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue