You could just define your own function in the shader that does what you want. I think something along the lines of this should work
more info here: https://www.khronos.org/opengl/wiki/Core_Language_(GLSL)#Functions
Code:
vec3 convert(vec4 src) {
return src.xyx/src.w;
}more info here: https://www.khronos.org/opengl/wiki/Core_Language_(GLSL)#Functions
