It's just like programming: when you don't mind additional work, you can write everything yourself, without using any external function libraries. But normally, shaders are not done this way today. Shader programmers normally want to program only their effects and don't want to write 100 variants and branches for all different shader situations.