             buffer = b
             _filterBufferData = UnsafePointer<Void>(b.contents())
             _filterBufferSize = size
-            _count=count
             for i in 0..<count {
                 if let element = (T.self as T.Type)(base: _filterBufferData + size * i, size: size) {
                     element.setContents(arguments)

                }
            }
        } else {
            return nil
        }
    }
    
    subscript (element:Int) -> T {
        get {
            assert(element >= 0 && element < _count, "Index out of range")
            return _members[element]
        }
    }

    func bufferAndOffsetForElement(element:Int) -> (MTLBuffer, Int){
        assert(element >= 0 && element < _count, "Index out of range")
        return (buffer!,_filterBufferSize * element)
    }
    
    func offsetForElement(element:Int) -> Int {
        assert(element >= 0 && element < _count, "Index out of range")
        return _filterBufferSize * element
    }
    
    var count:Int {
        return _count
    }
}

// type takes in a UIColor or CGFloats and writes them out as an
// 8-bit per channel RGBA vector
struct Color {
    private var _base:UnsafeMutablePointer<UInt8> = nil
    init(buffer:UnsafeMutablePointer<UInt8>) {
        _base = buffer
    }

// it is a column-major matrix where each column is aligned on
// 4 byte boundaries
struct Matrix3x3 {
    private let _base:UnsafeMutablePointer<Float32>
    init(buffer:UnsafeMutablePointer<Float32>) {
        _base = buffer
    }
