I am new to Metal. In which instances we use kernel statements in Shaders. What are the advantage of using that rather than normal vertex and fragment shaders
kernel void shadowShader
A compute or kernel shader is a general purpose computation pipeline. It is often used in image processing tasks. That is usually what comes up when you search with Google. But a kernel program can be used to do anything with the data you supply. The compute pipeline is separate from the rendering pipeline. You can see it is a GPU parallel way of doing computations. A compute pipeline can write back to device memory in an MTLBuffer
you provide or a texture. And you can use that output in your rendering pipeline.