Wondered if I could get a CRT curvature shader going using a texture, seems to work well enough. Smooth edges and it doesn’t hit my framerate all that hard, still above 700 fps on a potato.
It’s slower than the “dot(cc, cc) * distortion” method used in the cgwg CRT shaders and several others but it does allow for arbitrary displacements and warping. For example you could modify it to use a small warp texture that follows the mouse for a lightgun scope that zooms in with some distortion at the edges, or perhaps a projector aimed at an uneven surface, or separate it into 3 textures for individual RGB displacements and simulate a magnet on your simulated CRT.
Here’s a demo with aliaspider’s GLSLdev testing program and a quark shader. https://mega.nz/#!J0M0xSDB!JriDsvxNEUAEqIpm44F34OH7rDq4Ei3mjILORFwHB-s
libretro GLSL shaders are really unclear to me with all the bits and bobs everywhere, so this will mostly just serve as reference should anyone want to use the concept.