Sorry, can't see your images.
You should do all calculation in linear space and only convert it while reading it from the texture and writing it back to the framebuffer, and the current hardware is able to handle sRGB textures automatically (no need to transform it yourself), further infos are found here.
For testing purpose I would render three bars (greyscale 0...100%):
1. bar: linear texture (e.g. tga)
2. bar: sRGB texture (use sRGB texture format)
3. bar: shader which generate linear ramp
All bars should look the same and should be comparable to an according color ramp image seen in a browser/image processing tool.