Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
vkd3d
Manage
Activity
Members
Labels
Plan
Wiki
Bugzilla
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
wine
vkd3d
Commits
aed2d142
Commit
aed2d142
authored
1 year ago
by
Akihiro Sagawa
Committed by
Alexandre Julliard
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
vkd3d-shader/hlsl: Add degrees() function.
parent
e4936271
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!475
vkd3d-shader/hlsl: Add radians() and degrees() functions.
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
libs/vkd3d-shader/hlsl.y
+17
-0
17 additions, 0 deletions
libs/vkd3d-shader/hlsl.y
tests/hlsl/angle-unit.shader_test
+14
-0
14 additions, 0 deletions
tests/hlsl/angle-unit.shader_test
with
31 additions
and
0 deletions
libs/vkd3d-shader/hlsl.y
+
17
−
0
View file @
aed2d142
...
...
@@ -2878,6 +2878,22 @@ static bool intrinsic_ddy_coarse(struct hlsl_ctx *ctx,
return !!add_unary_arithmetic_expr(ctx, params->instrs, HLSL_OP1_DSY_COARSE, arg, loc);
}
static bool intrinsic_degrees(struct hlsl_ctx *ctx,
const struct parse_initializer *params, const struct vkd3d_shader_location *loc)
{
struct hlsl_ir_node *arg, *deg;
if (!(arg = intrinsic_float_convert_arg(ctx, params, params->args[0], loc)))
return false;
/* 1 rad = 180/pi degree = 57.2957795 degree */
if (!(deg = hlsl_new_float_constant(ctx, 57.2957795f, loc)))
return false;
hlsl_block_add_instr(params->instrs, deg);
return !!add_binary_arithmetic_expr(ctx, params->instrs, HLSL_OP2_MUL, arg, deg, loc);
}
static bool intrinsic_ddy_fine(struct hlsl_ctx *ctx,
const struct parse_initializer *params, const struct vkd3d_shader_location *loc)
{
...
...
@@ -3865,6 +3881,7 @@ intrinsic_functions[] =
{"ddy", 1, true, intrinsic_ddy},
{"ddy_coarse", 1, true, intrinsic_ddy_coarse},
{"ddy_fine", 1, true, intrinsic_ddy_fine},
{"degrees", 1, true, intrinsic_degrees},
{"distance", 2, true, intrinsic_distance},
{"dot", 2, true, intrinsic_dot},
{"exp", 1, true, intrinsic_exp},
...
...
This diff is collapsed.
Click to expand it.
tests/hlsl/angle-unit.shader_test
+
14
−
0
View file @
aed2d142
...
...
@@ -10,3 +10,17 @@ float4 main() : sv_target
uniform 0 float4 0.0 30.0 150.0 180.0
draw quad
probe all rgba (0.0, 0.52359877, 2.61799387, 3.14159265)
[pixel shader]
uniform float4 a;
float4 main() : sv_target
{
return degrees(a);
}
[test]
uniform 0 float4 0.0 0.78539816 1.57079632 2.35619449
draw quad
probe all rgba (0.0, 45.0, 90.0, 135.0)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment