MTLBuffer on OS X Stopping at 16384

I have a Metal Framework that uses an MTLBuffer.


When I use the Framework with iOS and tvOS, the game runs perfectly. But when I compile it against OS X, my MTLBuffers all seem to stop accepting new data at index 16384 (2^14). I'm setting the buffer length to be much larger than that, somewhere around the 1000500 range (depending on window size).


Is there a maximum buffer size on Mac or some other way that MTLBuffer would operate differently on a Mac vs an iOS-based device?


Here's where I'm creating the MTLBuffers and assigning the content. Again, works perfectly on iOS and tvOS.


        vertexBuffer = device.newBufferWithLength(ConstantBufferSize * MaxBuffers * sizeof(Float) * 2, options: [])
        vertexBuffer.label = "vertices"
      
        colorBuffer = device.newBufferWithLength(ConstantBufferSize * MaxBuffers * sizeof(Float) * 3, options: [])
        colorBuffer.label = "colors"

        let pVertices = vertexBuffer.contents()
        var vertices = UnsafeMutablePointer<Float>(pVertices + ConstantBufferSize * bufferIndex * sizeof(Float) * 2)
       
        let pColor = colorBuffer.contents()
        var colors = UnsafeMutablePointer<Float>(pColor + ConstantBufferSize * bufferIndex * sizeof(Float) * 3)
       
        if let delegate = self.delegate {
            self.vertexCount = delegate.loadVertices(&vertices, andColors: &colors)
        }

There is a max buffer size (256 Mb)


You might be facing a situation of colors being RGBA on Mac and RGB on iOS.


This also might be related to different structure alignment rules between ARM and Intel, AMD, Nvidia. I always add explicit alignment to any structs

in the shader code to avoid these surprises.

MTLBuffer on OS X Stopping at 16384
 
 
Q