No need to do this for every fragment.
Use a unified approach to write both vertex and fragment shader in the same file.