     }
     
     func setupMetal() {
-        _device = MTLCreateSystemDefaultDevice()
-        _metalLayer = CAMetalLayer()
-        _metalLayer.device = _device
-//        _metalLayer.frame = self.frame
-        _metalLayer.pixelFormat = MTLPixelFormat.BGRA8Unorm
+        _device                     = MTLCreateSystemDefaultDevice()
+        _metalLayer                 = CAMetalLayer()
+        _metalLayer.device          = _device
+        //        _metalLayer.frame = self.frame
+        _metalLayer.pixelFormat     = MTLPixelFormat.BGRA8Unorm
         _metalLayer.framebufferOnly = true
         
         self.layer.addSublayer(_metalLayer)

    
    func makeBuffers() {
        let triangle = [SSVertex(position: vector_float4(0, 0.5, 0, 1), color: vector_float4(1.0, 0.0, 0.0, 1.0)),
        SSVertex(position: vector_float4(-0.5, -0.5, 0, 1), color: vector_float4(0.0, 1.0, 0.0, 1.0)),
        SSVertex(position: vector_float4(0.5, -0.5, 0, 1), color: vector_float4(0.0, 0.0, 1.0, 1.0))]
        _vertexBuffer = _device.newBufferWithBytes(triangle, length: triangle.count * sizeof(SSVertex), options: MTLResourceOptions.CPUCacheModeDefaultCache)
    }
    

    
    func makePipeline() {
        let lib = _device.newDefaultLibrary()!
        let vertexFunc   = lib.newFunctionWithName("vertexMain")
        let fragmentFunc = lib.newFunctionWithName("fragmentMain")
        
        let renderPipelineDesc                             = MTLRenderPipelineDescriptor()
        renderPipelineDesc.vertexFunction                  = vertexFunc
        renderPipelineDesc.fragmentFunction                = fragmentFunc
        renderPipelineDesc.colorAttachments[0].pixelFormat = MTLPixelFormat.BGRA8Unorm
        
        do {
