On Sun, 1 May 2022 at 20:39, Stefan Dösinger <stefan(a)codeweavers.com> wrote:
+ for (i = 0; i < ARRAY_SIZE(float16_conv); ++i) + { + if (format_id != float16_conv[i]) + continue; + + switch(format->byte_count) + { + case 8: + ((short *)ret)[3] = float_32_to_16(&color->a); + ((short *)ret)[2] = float_32_to_16(&color->b); + /* fall through */ + case 4: + ((short *)ret)[1] = float_32_to_16(&color->g); + /* fall through */ + case 2: + ((short *)ret)[0] = float_32_to_16(&color->r); + break; + + default: + ERR("Unexpected byte count %u: Format %s\n", format->byte_count, debug_d3dformat(format_id)); + break; + } + + return; + }
Like 3/9, it seems preferable to check for WINED3DFMT_FLAG_FLOAT and component sizes. There's a missing space after "switch" here as well.