Skip to content
Snippets Groups Projects

Implement hyperbolic trigonometry operations.

Merged Petrichor Park requested to merge petrathekat/vkd3d:hyperbolic-trig into master
4 unresolved threads

I'm working on adding all the intrinsics we haven't implemented yet. Here's sinh, cosh, and tanh.

Sinh/cosh are implemented in the same commit because they forward to the same backing function (because the identities used only differ by a plus or minus).

Merge request reports

Merge request pipeline #25233 skipped

Merge request pipeline skipped for 1fb9e752

Approved by

Merged by Alexandre JulliardAlexandre Julliard 1 year ago (Apr 15, 2024 8:22pm UTC)

Merge details

  • Changes merged into master with 1fb9e752.
  • Did not delete the source branch.

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
3025 static bool write_cosh_or_sinh(struct hlsl_ctx *ctx,
3026 const struct parse_initializer *params, const struct vkd3d_shader_location *loc, bool sinh_mode)
3027 {
3028 struct hlsl_ir_function_decl *func;
3029 struct hlsl_type *type;
3030 const char *fn_name, *combiner;
3031 char *body;
3032
3033 static const char template[] =
3034 "%s %s(%s x)\n"
3035 "{\n"
3036 " %s expPos, expNeg, combined;"
3037 " expPos = exp(x);\n"
3038 " expNeg = exp(-x);\n"
3039 " combined = %s;\n"
3040 " return combined / 2;\n"
  • Elizabeth Figura
    Elizabeth Figura @zfigura started a thread on an outdated change in commit 481ba3c7
  • 3033 static const char template[] =
    3034 "%s %s(%s x)\n"
    3035 "{\n"
    3036 " %s expPos, expNeg, combined;"
    3037 " expPos = exp(x);\n"
    3038 " expNeg = exp(-x);\n"
    3039 " combined = %s;\n"
    3040 " return combined / 2;\n"
    3041 "}\n";
    3042 static const char fn_name_sinh[] = "sinh";
    3043 static const char fn_name_cosh[] = "cosh";
    3044 static const char combiner_sinh[] = "expPos - expNeg";
    3045 static const char combiner_cosh[] = "expPos + expNeg";
    3046
    3047 type = params->args[0]->data_type;
    3048 type = hlsl_get_numeric_type(ctx, type->class, HLSL_TYPE_FLOAT, type->dimx, type->dimy);
  • Giovanni Mascellani
    Giovanni Mascellani @giomasce started a thread on an outdated change in commit 481ba3c7
  • 121 121
    122 122 [test]
    123 123 uniform 0 float4 -1.57079633 -0.54930614 0.54930614 1.57079633
    124 todo(sm<6) draw quad
    124 todo draw quad
    125 125 probe all rgba (-0.91715234, -0.5, 0.5, 0.91715234) 2
    126 126 uniform 0 float4 -10.0 -0.0 0.0 10.0
    127 todo(sm<6) draw quad
    127 todo draw quad
    • Comment on lines -124 to +127

      These two changes fail (i.e., unexpectedly succeed) on the CI and on every implementation I've got. Is it possible it's a mistake? Which hardware are you testing on?

    • Author Contributor

      I'm testing on KDE neon 6.0 on a ThinkPad E15 Gen 4. It does pass on my machine, except for the native implementation. Francisco and I were talking about how the local native failures are probably false negatives.

    • Please register or sign in to reply
  • Also tightens the TODOs on some of the tests.

    I don't think there is need to specify this, every time you add a feature you tighten the corresponding TODOs.

  • Petrichor Park added 46 commits

    added 46 commits

    Compare with previous version

  • Petrichor Park added 37 commits

    added 37 commits

    Compare with previous version

  • Petrichor Park added 2 commits

    added 2 commits

    • e81c1b95 - vkd3d-shader/hlsl: Implement hyperbolic sin and cos.
    • 64002ff4 - vkd3d-shader/hlsl: Implement tanh.

    Compare with previous version

  • Giovanni Mascellani approved this merge request

    approved this merge request

  • This MR introduces whitespace errors.

  • Petrichor Park added 30 commits

    added 30 commits

    Compare with previous version

    • +    static const char fn_name_sinh[] = "sinh";
      +    static const char fn_name_cosh[] = "cosh";
      +
      +    if (!(arg = intrinsic_float_convert_arg(ctx, params, params->args[0], loc)))
      +        return false;
      +    type = arg->data_type;
      +
      +    fn_name = sinh_mode ? fn_name_sinh : fn_name_cosh;
      +    combiner = sinh_mode ? "-" : "+";
      +
      +    if (!(body = hlsl_sprintf_alloc(ctx, template,
      +            type->name, fn_name, type->name,
      +            combiner)))
      +        return false;

      So

          type_name = arg->data_type->name;
          if (!(body = hlsl_sprintf_alloc(ctx, template, type_name,
                  sinh_mode ? "sinh" : "cosh", type_name,
                  sinh_mode ? "-" : "+")))
              return false;

      right?

    • Author Contributor

      Yes. I thought it would be better to write it out longhand (I've been told to be more verbose in the past) but I can fix that.

    • Please register or sign in to reply
  • Petrichor Park added 40 commits

    added 40 commits

    Compare with previous version

  • Author Contributor

    I kept the separate variable for the sinh/cosh function name because it's also used in creating the function object

  • Henri Verbeet approved this merge request

    approved this merge request

  • added 2 commits

    • c4182cc2 - vkd3d-shader/hlsl: Implement hyperbolic sin and cos.
    • 1fb9e752 - vkd3d-shader/hlsl: Implement tanh.

    Compare with previous version

  • Alexandre Julliard approved this merge request

    approved this merge request

  • Please register or sign in to reply
    Loading