Skip to content
Snippets Groups Projects

vkd3d-shader/hlsl: Add fwidth() function.

Merged Nikolay Sivov requested to merge nsivov/vkd3d:fwidth into master
1 unresolved thread

Signed-off-by: Nikolay Sivov nsivov@codeweavers.com

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Giovanni Mascellani
    Giovanni Mascellani @giomasce started a thread on an outdated change in commit 7f5746a7
  • 2960 static bool intrinsic_fwidth(struct hlsl_ctx *ctx,
    2961 const struct parse_initializer *params, const struct vkd3d_shader_location *loc)
    2962 {
    2963 struct hlsl_ir_function_decl *func;
    2964 struct hlsl_type *type;
    2965 char *body;
    2966
    2967 static const char template[] =
    2968 "%s fwidth(%s x)\n"
    2969 "{\n"
    2970 " return abs(ddx(x)) + abs(ddy(x));\n"
    2971 "}";
    2972
    2973 if (!(type = elementwise_intrinsic_get_common_type(ctx, params, loc)))
    2974 return false;
    2975 type = hlsl_get_numeric_type(ctx, type->class, HLSL_TYPE_FLOAT, type->dimx, type->dimy);
    • As for the determinant, it is likely (though not necessarily true, so a test for that would be appropriate) that the right thing to do here is using elementwise_intrinsic_float_convert_args().

    • Author Developer

      I think the idea was to convert in add_user_call(), maybe it could be reworked.

    • Yes, but you still have to detect the correct type to convert to. It seems that the general philosophy behind the HLSL compiler is that for expressions that only make sense for floating point numbers you convert every integral type (int, uint and bool) to float, and everything else doesn't need conversion. That's what elementwise_intrinsic_float_convert_args() does. I would assume that here the same happens, unless there is evidence of the contrary.

    • We probably need to fix lit() too now that you mention it.

    • Nikolay Sivov changed this line in version 3 of the diff

      changed this line in version 3 of the diff

    • Author Developer

      It follows the same pattern for float vs half, I pushed suggested change.

    • Please register or sign in to reply
  • Nikolay Sivov added 57 commits

    added 57 commits

    Compare with previous version

  • Giovanni Mascellani approved this merge request

    approved this merge request

  • Elizabeth Figura approved this merge request

    approved this merge request

  • Henri Verbeet approved this merge request

    approved this merge request

  • Alexandre Julliard approved this merge request

    approved this merge request

  • Please register or sign in to reply
    Loading