5
$\begingroup$

I keep coming across the terms 'Metal' and 'Vulkan' on this site. Guessing this to be some CG software, I'm interested to know what these are exactly and what the intended and most common usage is.

A quick search shows me a video about why metal in CG looks fake: https://www.youtube.com/watch?v=NjbLYFXrfFU

Obviously not the answer, most answers talk about compute kernels. I'm familiar with kernel inversion in machine learning but not like Android kernels and the such. Hope you can help me out. Your input would be most valuable.

$\endgroup$
  • 2
    $\begingroup$ Regarding the second part, 'kernel' in graphics has a couple of meanings which are distinct from other uses (OS kernel etc.). A 'convolution kernel' is a 2D array of weights which describes how neighbouring pixels affect the current pixel, for doing blur, edge detection etc. A 'compute kernel' is just a chunk of code to be executed by a compute shader on GPU, using each shader instance to process a different data point. You can think of it as being the body of a parallel-for loop. $\endgroup$ – russ Oct 26 '18 at 14:40
15
$\begingroup$

Metal and Vulkan are low-level 3D graphics APIs, in much the same way that OpenGL and Direct3D are 3D graphics APIs. Metal is Apple's API, usable on iOS and MacOS. Vulkan was developed by the Khronos Group, who also oversees the various forms of OpenGL. Vulkan is directly usable on all non-Apple platforms, and there is the MoltenVK project which provides a translation layer from Vulkan to Metal (since the APIs are not that different), thus allowing Vulkan applications to run even on Apple platforms.

Metal, Vulkan, and Direct3D v12 represent a dramatic departure API-wise from prior low-level graphics APIs. They use a command-buffer-based interface, where you record rendering commands into a command buffer object, then execute those commands at some later period. The more immediate style of APIs like OpenGL and D3D-pre-12 have no intermediary command buffer. When you call a rendering function, it is given to the GPU "right then" and that's the end of it.

These styles of API are important because they allow threaded creation of rendering commands. In the immediate APIs, you can only effectively have one thread issuing rendering commands. In command-buffer APIs, multiple threads can build multiple CBs simultaneously, and then one thread submits them all as a single bunch of work. This allows better utilization of CPU resources for CPUs with lots of cores.

$\endgroup$
  • 4
    $\begingroup$ "When you call a rendering function, it is given to the GPU "right then" and that's the end of it." Or more specifically, given to the driver, to give to the GPU at some point between now and never. $\endgroup$ – Jherico Oct 24 '18 at 20:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.