vkd3d-shader/hlsl: Add radians() and degrees() functions.
Merge request reports
Activity
3341 3341 return !!add_pow_expr(ctx, params->instrs, params->args[0], params->args[1], loc); 3342 3342 } 3343 3343 3344 static bool intrinsic_radians(struct hlsl_ctx *ctx, 3345 const struct parse_initializer *params, const struct vkd3d_shader_location *loc) 3346 { 3347 struct hlsl_ir_node *arg, *rad; 3348 3349 if (!(arg = intrinsic_float_convert_arg(ctx, params, params->args[0], loc))) 3350 return false; 3351 3352 /* 1 degree = pi/180 rad = 0.0174532925f rad */ 3353 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 usinghlsl_block_add_instr()
, as you can see in other uses ofhlsl_new_float_constant()
in the same file.More complex functions such as
intrinsic_float_convert_arg()
and those that start withadd_
do it themselves, so they don't require to callhlsl_block_add_instr()
afterwards.Edited by Francisco CasasOh, good catch! log/log10 also need this call to
hlsl_block_add_instr()
. I think it is just serendipity that compilation works without these nodes getting inserted in the instruction block.You can improve this MR with a commit adding those missing calls for the log/log10 functions. I don't think that an
add_float_constant()
helper is necessary though.I submitted a fix for log() !476 (merged).
- Resolved by Akihiro Sagawa
- Resolved by Akihiro Sagawa
added 15 commits
-
7b369b5b...88caf877 - 13 commits from branch
wine:master
- 1d5037d2 - vkd3d-shader/hlsl: Add radians() function.
- 2f2a1001 - vkd3d-shader/hlsl: Add degrees() function.
-
7b369b5b...88caf877 - 13 commits from branch