Zebediah Figura (@zfigura) commented about libs/vkd3d-shader/hlsl.y:
- if (!(p_num = add_binary_arithmetic_expr(ctx, params->instrs, HLSL_OP2_ADD, x_arg, min_arg, loc)))
return false;
- if (!(p_denom = add_binary_arithmetic_expr(ctx, params->instrs, HLSL_OP2_ADD, max_arg, min_arg, loc)))
return false;
- if (!(one = hlsl_new_float_constant(ctx, 1.0, loc)))
return false;
- list_add_tail(params->instrs, &one->node.entry);
- if (!(p_denom = add_binary_arithmetic_expr(ctx, params->instrs, HLSL_OP2_DIV, &one->node, p_denom, loc)))
return false;
- if (!(p = add_binary_arithmetic_expr(ctx, params->instrs, HLSL_OP2_MUL, p_num, p_denom, loc)))
return false;
This seems redundant, shouldn't this just be a single div?