Tests have already been implemented in 92044d5e; this commit loosens some of the todos (because now they're implemented!).
I get what you're saying here, but I think the use of "loosens" here is slightly odd; you're narrowing the scope of the todo's, not broadening it.
+ const char *fn_name = asin_mode + ? fn_name_asin + : fn_name_acos;
Continuations get double indentation, like template[] above this code, and the hlsl_sprintf_alloc() call below this code. This could of course also simply go on a single line.
+ static const char* atan2_name = "atan2"; + static const char* atan_name = "atan";
We'll want ```c static const char atan2_name[] = "atan2"; static const char atan_name[] = "atan"; ``` here. That applies to "atan2_header_template" and "atan_header_template" as well.
+ if (!(buf = hlsl_get_string_buffer(ctx))) { + return false; + } + + if (atan2_mode) { + ok = vkd3d_string_buffer_printf(buf, atan2_header_template, + type->name, type->name, type->name, type->name); + } else { + ok = vkd3d_string_buffer_printf(buf, atan_header_template, + type->name, type->name, type->name); + } + if (ok < 0) + return false; + + ok = vkd3d_string_buffer_printf(buf, body_template, type->name); + if (ok < 0) + return false; + + func = hlsl_compile_internal_function(ctx, + atan2_mode ? atan2_name : atan_name, buf->buffer);
Couple of issues here: - "{" and "}" would go on their own line, but could also simply be omitted here. - Continuations get double indentation. - You're leaking "buf" on the error paths. - "ok" is an unusual name for the return code, it's more commonly called either "ret" or "rc". - There's a trailing space on the line containing the hlsl_compile_internal_function() call.