Matteo Bruni (@Mystral) commented about dlls/d3dx9_36/d3dx_helpers.c:
vec->z = (vec->w == 0.0f) ? 0.0f : vec->z / vec->w; }
+static void apply_gamma_2_2(struct vec4 *vec) +{ + vec->x = powf(vec->x, 1.0f / 2.2f); + vec->y = powf(vec->y, 1.0f / 2.2f); + vec->z = powf(vec->z, 1.0f / 2.2f); +}
I seem to recall that you tried with the "accurate" piecewise sRGB definition previously (i.e. the one that's linear in the very low end and then uses a 2.4 exponent for the rest) but that didn't quite match as nicely? Maybe it makes sense to leave a small comment to that point, here or elsewhere. Separately, a bit of a nitpick. `apply_gamma_2_2()` might be slightly confusing: does it mean that gamma is applied to an sRGB color value to return the corresponding linear value or does it transform a linear color value into the corresponding sRGB value? In this case it's the latter, but you see the problem :slight_smile: Personally I'd just go with something like `srgb_from_linear()` and `linear_from_srgb()`, respectively. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10513#note_135310