I am new to Metal. I need to port OpenCL compute shader programs to Metal compute shaders. I am having trouble in finding sample codes in Metal and Swift, Objective-C. I can see examples with GPU buffer objects only. As in the following OpenCL shader function, I need to pass uniform constant float and integer values along with GPU buffer pointers. I only use compute shaders.
__kernel void testfunction (
float ratio1,
int opr1,
int opr2,
__global float *INPUT1,
__global float *INPUT2,
__global float *OUTPUT
} {
int peIndex = get_global_id(0);
// main compute block
}
How can I code these in Metal? And how can I set/pass these parameter values in Swift and Objective-c main programs?