I'm coding my first Shader in my little game engine, and I have some questions about it's performance and common approaches.
Is the Shader code processed by the video card instead of the PC processor? Just so I know if it's possible to share some calculations to save some processor power.
Generally, should I do the math calculations in my code or the Shader? I could calculate them all (lightning for example) and just send the final values to be multiplied/used to the Shader, but what's the best approach?
Shaders as far as I could understand are the main party responsible for visual effects, so for example, if I want to add a "blur" effect to only one object on screen, should I use an if/switch statement in the Shader or should I have different Shader/ProgramIDs and I just switch the call glUseProgram(programID)?
Sorry if some questions seems stupid, and thanks for your time!