     // pool: pool of textures to be reused for stack
     private var stack = [VSTexture]()
     private var pool = [VSTexture]()
-    private var source:MTLTexture?
+    private var source:VSTexture?
     
     init(device:MTLDevice, pixelFormat:MTLPixelFormat) {
         self.device = device

    func set(texture:MTLTexture) {
        assert(Thread.current == Thread.main)
        stack.removeAll() // HACK: for now
        source = texture
        
        if texture.width==width && texture.height==height {
            return


        threadGroupCount.width = (width + threadGroupSize.width - 1) / threadGroupSize.width
        threadGroupCount.height = (height + threadGroupSize.height - 1) / threadGroupSize.height
    }
    
    func pop() -> VSTexture {
        if let texture = stack.popLast() {
            return texture
        }
        return source!
    }
    
    func push(texture:VSTexture) {
