Zebediah Figura (@zfigura) commented about libs/vkd3d-shader/hlsl.y:
+ struct hlsl_type *type; + char *body; + + static const char template[] = + "%s %s(%s x)\n" + "{\n" + " %s abs_arg = abs(x);\n" + " %s correction = sqrt(1.0 - abs_arg);\n" + " %s result = correction * (\n" + " (3.14159265 / 2.0)\n" + " - (0.2127403136003234 * abs_arg)\n" + " + (0.07612092595257536 * abs_arg * abs_arg)\n" + " - (0.01996337677405357 * abs_arg * abs_arg * abs_arg)\n" + " );\n" + /* Piecewise, (x >= 0) ? result : pi - result. */ + " %s mask = %s(x >= 0.0);\n" HLSL has implicit casts, so you can drop this. I think there's another instance in atan2().
-- https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/364#note_47531