I refer to this 4 year old forum post, there a similar question is asked, but I still miss some information: https://developer.apple.com/forums/thread/105719
Post
Replies
Boosts
Views
Activity
I did found this on the forum, which helped me to lower the compiler iOS build version using '-mios-version-min', but no information on '-std=ios-metal' is given: https://developer.apple.com/forums/thread/105719
I found this post on the forum which gave me information on 'mios-version-min', but nothing was give on '-std': https://developer.apple.com/forums/thread/105719. However, the question about the documentation, I found on the forum that you can run xcrun metal -help and get an extensive list of flags: https://developer.apple.com/forums/thread/720556. Sadly the information on 'std=...' is limited.
I found this link: https://developer.apple.com/documentation/metal/mtldatatype. But still get an error when trying to use 'ulong'.
Invalid type 'device ulong *' (aka 'device unsigned long *') for buffer declaration
This is the buffer code in swift:
guard let buffer = device.makeBuffer(bytes: &array64Bit, length: MemoryLayout<UInt64>.stride * array64Bit.count) else {
throw InitError.bufferIsNil
}
self.bufferResult = buffer
[...]
commandEncoder.setBuffer(bufferResult, offset: 0, index: 0)
[...]
let bufferResultPtr = bufferResult.contents().assumingMemoryBound(to: UInt64.self)
let bufferResultArray = UnsafeMutableBufferPointer(start: bufferResultPtr, count: array64Bit.count)
This is the buffer code in metal:
kernel void shaderFunction(device ulong* result,
uint index [[thread_position_in_grid]])
{
result[index] = result[index] + 1;
}