Giovanni Mascellani (@giomasce) 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 * (((-0.019963376f\n"
" * abs_arg + 0.07612093f)\n"
" * abs_arg - 0.21274031f)\n"
" * abs_arg + 1.5707964f\n);"
/* Piecewise, (x >= 0) ? result : pi - result. */
" %s mask = x >= 0.0;\n"
" result = mask * result\n"
" + (1.0 - mask) * (3.14159265 - result);\n"
Please see https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/364#note_48247.