Metal has two major address spaces, device and constant.
And these are used like this in a shader function.
void foo(device int *data [[buffer(0)]]) { ... }
void bar(constant int *data [[buffer(0)]]) { ... }
I can understand what they are. But I cannot understand how to make them.
How to make a buffer in device(or constant) address space?
At first, I assume that MTLDevice.makeBuffer(length:options:)
will do it.
But it doesn't. There are no options for device or constant address space.
我很困惑.我错过了什么?
Thank you.
Sincerely.