Hi,
In the iOS13 and macOS Catalina release notes it says:
Metal CIKernel instances now support arguments with arbitrarily structured data.
I've been trying to use this functionality in a CIKernel with mixed results. I'm particularly interested in passing data in the form of a dynamically sized array. It seems to work up to a certain size. Beyond the threshold excessive data is discarded and the kernel becomes unstable. I assume there is some kind of memory alignment issue going on, but I've tried various types in my array and always get a similar result.
I have not found any documentation or sample code regarding this. It would be great to know how this is intended to work and what the limitations are.
In the forums there are two similar unanswered questions about data arguments, so I'm sure there are a few out there with similar issues.
Thanks! Michael
Thank you for the reply and citing other posts.
The notifications feature has been buggy and hopefully that's sorted out now.
Re: "Ideally I need an arbitrary array size that works similarly to a MTLArgumentEncoder."
Please send an enhancement request.
In the meantime, I'm asking framework engineers for any additional suggestions they may have and will let you know if they do.
Re: "I get the expected behavior up to a certain data size (1-2 structs or around 4 floats in the array), afterwards excess data is discarded. As the size grows beyond the threshold the instability randomly increases with flickering and other unexpected results."
This is expected as there isn't a way to specify threadgroup or gird sizes in a CIKernel. Exceeding those bounds introduces random data in kernel calculations, and possibly memory corruption on write.