Francisco Casas (@fcasas) commented about libs/vkd3d-shader/hlsl.y:
return !!add_binary_arithmetic_expr(ctx, params->instrs, HLSL_OP2_ADD, mul2, mul1_neg, loc);
}
+static bool intrinsic_distance(struct hlsl_ctx *ctx,
const struct parse_initializer *params, const struct vkd3d_shader_location *loc)
+{
- struct hlsl_ir_node *neg, *add, *dot;
- if (!elementwise_intrinsic_float_convert_args(ctx, params, loc))
return false;
`distance()` seems to not be subjected to the type conversion rules of element-wise intrinsics (which makes sense, because it isn't one). For instance, using `distance(a, b)` with `a : float4x2` and `b : float2x4` isn't allowed.
It probably makes sense to remove these lines because the `add_binary_arithmetic_expr()` call should be taking care of converting to the right type checks, already. Still, I think it would be good to add tests for some combinations of matrices, vectors, and scalar, to check that this is indeed the case.