Hi everyone,
I am new to metal and GPU programming and I hope you can help me with the following questions.
I would like to write a GPU kernel functions to process textures. Something like this:
encoder.setComputePipelineState(my_kernel_pipeline)
encoder.setTexture(input_texture.texture, at: 0)
encoder.setTexture(output_texture.texture, at: 1)
let threadsPerGroups = MTLSizeMake(8, 8, 1)
...
The pixelFormat of the "input_texture" is rgba8norm (8 bits RGBA color) and the pixelFormat of the "output_texture" is rgba16float (16 bits float). My kernel shaders code is:
kernel void my_kernel(texture2d<***, access::read> inTexture [[texture(0)]],
texture2d<YYY, access::write> outTexture [[texture(1)]],
uint2 gid [[thread_position_in_grid]]) {
....
}
Should *** and YYY be different? What exactly should *** and YYY be?
Thank you very much.
George