Zebediah Figura (@zfigura) commented about libs/vkd3d-shader/hlsl.y:
return !!add_unary_arithmetic_expr(ctx, params->instrs, HLSL_OP1_SAT, arg, loc);
}
+/* smoothstep(a, b, x) = saturate(p^2 (3 - 2p)), where p = (x - a)/(b - a) */ +static bool intrinsic_smoothstep(struct hlsl_ctx *ctx,
const struct parse_initializer *params, const struct vkd3d_shader_location *loc)
What you have here is instead "p^2 (3 - 2p), where p = saturate((x - a)/(b - a))". I haven't checked the math, but the discrepancy should probably be fixed.