No, shaders are always done by the 3d card =)
No, shaders are always done by the 3d card =)
https://blog.chromium.org/2016/06/universal-rendering-with-s...
Basically, I knew I was going to be slightly wrong about something somewhere.
I mean, effectively anything you can do with a GPU shader, can be done by the CPU, so it seemed reasonable to me that you could make something functionally equivalent for the CPU and call it a shader.
It started feeling like the difference between "programming language" and "scripting language" in my head.
Effectively, a shader is no different than any other bit of code you have. Anything you can do in a shader you can do on the main program thread (and vice versa). Now, things you typically want to do with a shader are better done by the GPU for various reasons. Better floating point math processor, pipelines more suited for the task, etc.
And you can make the shaders generic enough to reuse for multiple applications. Basically the shader says "Hey, here's where the light source is, here's the luminosity, here's the color, here's what it is shining on, here's how the color changes."
And being essentially dedicated number crunchers, people realized that not everything sent to a graphics card needed to actually render. You could make a shader to do something crazy, like solve complex equations more quickly than a generic CPU could. So if this was 8 years ago, you might decide to write a shader that could effectively mine bitcoins. Which is what people did and why good graphics cards have become crazy expensive.