Post

Replies

Boosts

Views

Activity

Reply to using xcrun to compile .metal shader
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.
Mar ’23
Reply to Buffer declaration: why not uint64_t possible?
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; }
Mar ’23