vkd3d-shader/hlsl: Implement faceforward intrinsic.
1 unresolved thread
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
Activity
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" Isn't it the other way?
dot(i, ng) < 0 ? n : -n
. See https://blender.stackexchange.com/questions/279677/mathematically-what-does-faceforward-function-meanEdited by Petrichor Parkchanged this line in version 2 of the diff
added 1 commit
- 0d54a789 - vkd3d-shader/hlsl: Implement faceforward intrinsic.
added 49 commits
-
0d54a789...60c8a813 - 48 commits from branch
wine:master
- 746222b3 - vkd3d-shader/hlsl: Implement the faceforward() intrinsic.
-
0d54a789...60c8a813 - 48 commits from branch
Please register or sign in to reply