Skip to content
Snippets Groups Projects

vkd3d-shader/hlsl: Implement faceforward intrinsic.

Merged Petrichor Park requested to merge petrathekat/vkd3d:impl-faceforward into master
1 unresolved thread

Also adds tests for it.

The tests are marked todo(sm<4) because faceforward requires non-float expressions. I'm working on another MR in the background that implements that, but it looks like it'll take a while, so I thought I'd open this MR in the meantime.

Let me know if I should remove the comment on lines 3568-3569.

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
3555 3555 }
3556 3556
3557 static bool intrinsic_faceforward(struct hlsl_ctx *ctx,
3558 const struct parse_initializer *params, const struct vkd3d_shader_location *loc)
3559 {
3560 struct hlsl_ir_function_decl *func;
3561 struct hlsl_type *type;
3562 char *body;
3563
3564 static const char template[] =
3565 "%s faceforward(%s n, %s i, %s ng)\n"
3566 "{\n"
3567 " %s facing = sign(dot(i, ng));\n"
3568 /* sign(0) is not consistent across tests. Sometimes it returns 1, sometimes it returns 0.
3569 * Expected behavior for faceforward is to have orthagonal i and ng return -n, not +n. */
3570 " return -n * (facing == 0.0 ? 1.0 : facing);\n"
  • added 1 commit

    • 0d54a789 - vkd3d-shader/hlsl: Implement faceforward intrinsic.

    Compare with previous version

  • Elizabeth Figura approved this merge request

    approved this merge request

  • Henri Verbeet approved this merge request

    approved this merge request

  • Henri Verbeet added 49 commits

    added 49 commits

    Compare with previous version

  • Please register or sign in to reply
    Loading