CopySubTexture: Handle sRGB source in GL backend CopySubTexture should ignore the color encoding of both the source and destination. The implementation currently ignores the color encoding of the destination. The implementation does not always ignore the color encoding of the source. As an example of the consequences of this, an RGBA pixel value of 0xFF/80/00/FF, when copied from a GL_SRGB8_ALPHA8 texture to a GL_RGBA8 texture may result in a value of 0xFF/37/00/FF, if the copy was executed using a shader (in which case the sRGB-to-linear function was applied 0x80, resulting in the 0x37). Update the OpenGL and shaders that do this blit, adding an option to apply a linear-to-sRGB transformation to undo the transformation applied by the sampler. The linear-to-sRGB transformation must be applied on unpremultiplied values. Ensure that the sequence of operations in all shaders is first unpremultiply, then linear-to-sRGB, then premultiply. Also remove optimizations to have the unpremultiply and premultiply cancel each other out, if there is also a linear-to-sRGB being applied. Bug: angleproject:7907 Change-Id: Iad5537e6b98f75d32a33be419a320129493e53a0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4839262 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: ccameron chromium <ccameron@chromium.org>