I have a following MTLBuffer created. How can I send INPUTVALUE to the memINPUT buffer? I need to send repeatedly in Objective-C.
// header file
@property id<MTLBuffer> memINPUT;
// main file
int length = 1000;
...
memINPUT = [_device newBufferWithLength:(sizeof(float)*length) options:0];
...
float INPUTVALUE[length];
for (int i=0; i < length; i++) {
INPUTVALUE[i] = (float)i;
}
// How to send to INPUTVALUE to memINPUT?
...
The following is Swift version. I am looking for Objective-c version.
memINPUT.contents().copyMemory(from: INPUTVALUE, byteCount: length * MemoryLayout<Float>.stride);