/* Grab the input color */
nir_ssa_def *c_nir = nir_ssa_for_src(&b, intr->src[1], 4);
+ /* Apply sRGB transform */
+
+ if (format_desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB) {
+ nir_ssa_def *rgb = nir_channels(&b, c_nir, 0x7);
+ nir_ssa_def *trans = nir_format_linear_to_srgb(&b, rgb);
+
+ nir_ssa_def *comp[4] = {
+ nir_channel(&b, trans, 0),
+ nir_channel(&b, trans, 1),
+ nir_channel(&b, trans, 2),
+ nir_channel(&b, c_nir, 3),
+ };
+
+ c_nir = nir_vec(&b, comp, 4);
+ }
+
/* Format convert */
nir_ssa_def *converted = nir_shader_to_native(&b, c_nir, format_desc, bits, homogenous_bits);