 			// vertex buffer should be filled with vertexes then draw it
 
 			do {
+				let vertexCount = elements.map { $0.numberOfVertexes }.reduce (0, +)
 
 				let encoder = commandBuffer.makeRenderCommandEncoder(descriptor: context.renderPassDescriptor)
 				encoder.setRenderPipelineState(self.renderPipelineState)
 
 				encoder.setFrontFacing(.clockwise)
-				encoder.setVertexBuffer(vertexBuffer.buffer, offset: 0, at: 0)
+				encoder.setVertexBuffer(vertexBuffer, offset: 0, at: 0)
 				encoder.setVertexBuffer(uniformsBuffer, offset: 0, at: 1)
 
 				encoder.setFragmentTexture(texture, at: 0)
 				encoder.setFragmentSamplerState(self.colorSamplerState, at: 0)
 
-				encoder.drawPrimitives(type: .point, vertexStart: 0, vertexCount: vertexBuffer.count)
+				encoder.drawPrimitives(type: .point, vertexStart: 0, vertexCount: Int(vertexCount))
 				encoder.endEncoding()
 			}
 

		guard cgPaths.count > 0 else { return }

		let vertexCapacity = 10_000
		var elementsArray = [[BezierPathElement]]()
		let (w1, w2) = (32, 32)


		var uniforms = Uniforms(transform: transform, zoomScale: Float(context.zoomScale))
		let uniformsBuffer = device.makeBuffer(bytes: &uniforms, length: MemoryLayout<Uniforms>.size, options: MTLResourceOptions())

		let elementsBuffer = device.makeBuffer(length: MemoryLayout<BezierPathElement>.size * elementsCapacity, options: [.storageModeShared])
		let vertexBuffer = device.makeBuffer(length: MemoryLayout<Vertex>.size * vertexCapacity, options: [.storageModePrivate])

		for (index, elements) in elementsArray.enumerated() {
			print("pass = \(index)")

