Francisco Casas (@fcasas) commented about libs/vkd3d-shader/hlsl.y:
return !!add_pow_expr(ctx, params->instrs, params->args[0], params->args[1], loc);
}
+static bool intrinsic_radians(struct hlsl_ctx *ctx,
const struct parse_initializer *params, const struct vkd3d_shader_location *loc)
+{
- struct hlsl_ir_node *arg, *rad;
- if (!(arg = intrinsic_float_convert_arg(ctx, params, params->args[0], loc)))
return false;
- /* 1 degree = pi/180 rad = 0.0174532925f rad */
- if (!(rad = hlsl_new_float_constant(ctx, 0.0174532925f, loc)))
When creating a node using a `hlsl_new_*()` function you also have to add it to the instruction block using `hlsl_block_add_instr()`, as you can see in other uses of `hlsl_new_float_constant()` in the same file.
More complex functions such as `intrinsic_float_convert_arg()` and those that start with `add_` do it themselves, so they don't require to call `hlsl_block_add_instr()` afterwards.