27 Nov
2022
27 Nov
'22
4:45 a.m.
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. -- https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/53#note_17584