Search code examples
imageopengltexturessrgb

Does OpenGL image load/store require manual sRGB to linear conversions?


Am I correct in assuming that you can only get SRGB conversions for free in modern GPU's on texture reads via samplers if an SRGB texture format is used?

So if I want to access the same SRGB textures via images with image load/store I will have to do any SRGB/linear conversions manually?

IE Doing something such as:

float LinearToSRGB(float value)
{ 
    if( value< 0.0031308 )
        value*= 12.92;
    else
        val = 1.055 * pow(value, 1.0/2.4) - 0.055;

    return value;
}

Solution

  • Exactly.
    As long as you're not using sRGB textures, OpenGL assumes all texture data is in linear space.