Matteo Bruni (@Mystral) commented about dlls/d3dx9_36/surface.c:
v = float_32_to_16(src_component); else if (format->type == FORMAT_ARGBF) v = *(DWORD *)&src_component; + else if (format->type == FORMAT_ARGB_SNORM) + { + const uint32_t max_value = (1 << (format->bits[c] - 1)) - 1; + float val = src_component; + + if (src_type == FORMAT_ARGB) + val = (val * 2.0f) - 1.0f;
This works, but I think it would be better if we stored the "range" (e.g. UNORM, SNORM, full range) as a property of the value itself (or, specifically, of each component) instead of having to bring around the source type as separate, additional data. So perhaps something like ``` struct d3dx_color { vec4 value; enum range range[4]; }; ``` which `format_to_vec4()` generates and `format_from_vec4()` consumes. I haven't really thought it through, so this might be all kinds of ugly or impractical. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/6360#note_80595