Giovanni Mascellani (@giomasce) commented about libs/vkd3d-shader/hlsl.y:
- hlsl_block_add_instr(params->instrs, three);
- if (!(res = add_binary_arithmetic_expr(ctx, params->instrs, HLSL_OP2_MUL, minus_two, p, loc)))
return false;
- struct hlsl_ir_function_decl *func;
- struct hlsl_type *type;
- char *name, *body;
- if (!(res = add_binary_arithmetic_expr(ctx, params->instrs, HLSL_OP2_ADD, three, res, loc)))
return false;
- static const char template[] =
"%s smoothstep_%s(%s low, %s high, %s x)\n"
"{\n"
" %s p = saturate((x - low) / (high - low));\n"
" return (p * p) * (3 - 2 * p);\n"
"}";
POSIX allows to use the `%m$` syntax and avoid repeat many times the same argument, but unfortunately the standard `printf()` doesn't...