mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader/hlsl: Implement the rcp() intrinisic.
SM1 already has the RCP opcode implemented; SM4 implementation is in the next commit.
This commit is contained in:
parent
3a49852075
commit
b3f0cd5788
Notes:
Henri Verbeet
2024-07-11 17:16:15 +02:00
Approved-by: Elizabeth Figura (@zfigura) Approved-by: Giovanni Mascellani (@giomasce) Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/822
@ -4065,6 +4065,17 @@ static bool intrinsic_radians(struct hlsl_ctx *ctx,
|
|||||||
return !!add_binary_arithmetic_expr(ctx, params->instrs, HLSL_OP2_MUL, arg, rad, loc);
|
return !!add_binary_arithmetic_expr(ctx, params->instrs, HLSL_OP2_MUL, arg, rad, loc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool intrinsic_rcp(struct hlsl_ctx *ctx,
|
||||||
|
const struct parse_initializer *params, const struct vkd3d_shader_location *loc)
|
||||||
|
{
|
||||||
|
struct hlsl_ir_node *arg;
|
||||||
|
|
||||||
|
if (!(arg = intrinsic_float_convert_arg(ctx, params, params->args[0], loc)))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return !!add_unary_arithmetic_expr(ctx, params->instrs, HLSL_OP1_RCP, arg, loc);
|
||||||
|
}
|
||||||
|
|
||||||
static bool intrinsic_reflect(struct hlsl_ctx *ctx,
|
static bool intrinsic_reflect(struct hlsl_ctx *ctx,
|
||||||
const struct parse_initializer *params, const struct vkd3d_shader_location *loc)
|
const struct parse_initializer *params, const struct vkd3d_shader_location *loc)
|
||||||
{
|
{
|
||||||
@ -4760,6 +4771,7 @@ intrinsic_functions[] =
|
|||||||
{"normalize", 1, true, intrinsic_normalize},
|
{"normalize", 1, true, intrinsic_normalize},
|
||||||
{"pow", 2, true, intrinsic_pow},
|
{"pow", 2, true, intrinsic_pow},
|
||||||
{"radians", 1, true, intrinsic_radians},
|
{"radians", 1, true, intrinsic_radians},
|
||||||
|
{"rcp", 1, true, intrinsic_rcp},
|
||||||
{"reflect", 2, true, intrinsic_reflect},
|
{"reflect", 2, true, intrinsic_reflect},
|
||||||
{"refract", 3, true, intrinsic_refract},
|
{"refract", 3, true, intrinsic_refract},
|
||||||
{"round", 1, true, intrinsic_round},
|
{"round", 1, true, intrinsic_round},
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
[pixel shader todo]
|
[pixel shader todo(sm>=4)]
|
||||||
uniform float4 f;
|
uniform float4 f;
|
||||||
|
|
||||||
float4 main() : sv_target
|
float4 main() : sv_target
|
||||||
@ -8,28 +8,28 @@ float4 main() : sv_target
|
|||||||
|
|
||||||
[test]
|
[test]
|
||||||
uniform 0 float4 1.0 2.0 3.0 4.0
|
uniform 0 float4 1.0 2.0 3.0 4.0
|
||||||
todo(sm<6) draw quad
|
todo(sm>=4 & sm<6) draw quad
|
||||||
probe (0, 0) rgba (1.0, 0.5, 0.3333333, 0.25) 8
|
probe (0, 0) rgba (1.0, 0.5, 0.3333333, 0.25) 8
|
||||||
|
|
||||||
uniform 0 float4 -1.0 -2.0 -3.0 -4.0
|
uniform 0 float4 -1.0 -2.0 -3.0 -4.0
|
||||||
todo(sm<6) draw quad
|
todo(sm>=4 & sm<6) draw quad
|
||||||
probe (0, 0) rgba (-1.0, -0.5, -0.3333333, -0.25) 8
|
probe (0, 0) rgba (-1.0, -0.5, -0.3333333, -0.25) 8
|
||||||
|
|
||||||
uniform 0 float4 12.34 56.78 -90.12 -34.56
|
uniform 0 float4 12.34 56.78 -90.12 -34.56
|
||||||
todo(sm<6) draw quad
|
todo(sm>=4 & sm<6) draw quad
|
||||||
probe (0, 0) rgba (0.081037275, 0.017611835, -0.011096316, -0.028935184) 8
|
probe (0, 0) rgba (0.081037275, 0.017611835, -0.011096316, -0.028935184) 8
|
||||||
|
|
||||||
uniform 0 float4 0.25 0.125 0.0625 0.3333333
|
uniform 0 float4 0.25 0.125 0.0625 0.3333333
|
||||||
todo(sm<6) draw quad
|
todo(sm>=4 & sm<6) draw quad
|
||||||
probe (0, 0) rgba (4.0, 8.0, 16.0, 3.0) 8
|
probe (0, 0) rgba (4.0, 8.0, 16.0, 3.0) 8
|
||||||
|
|
||||||
% Degenerate cases
|
% Degenerate cases
|
||||||
uniform 0 float4 0.0 -0.0 1.0e39 -1.0e39
|
uniform 0 float4 0.0 -0.0 1.0e39 -1.0e39
|
||||||
todo(sm<6) draw quad
|
todo(sm>=4 & sm<6) draw quad
|
||||||
probe (0, 0) rgba (1.0e39, -1.0e39, 0.0, -0.0) 8
|
probe (0, 0) rgba (1.0e39, -1.0e39, 0.0, -0.0) 8
|
||||||
|
|
||||||
|
|
||||||
[pixel shader todo]
|
[pixel shader todo(sm>=4)]
|
||||||
% Check invertibility
|
% Check invertibility
|
||||||
uniform float4 f;
|
uniform float4 f;
|
||||||
|
|
||||||
@ -40,19 +40,19 @@ float4 main() : sv_target
|
|||||||
|
|
||||||
[test]
|
[test]
|
||||||
uniform 0 float4 1.0 2.0 3.0 4.0
|
uniform 0 float4 1.0 2.0 3.0 4.0
|
||||||
todo(sm<6) draw quad
|
todo(sm>=4 & sm<6) draw quad
|
||||||
probe (0, 0) rgba (1.0, 2.0, 3.0, 4.0) 8
|
probe (0, 0) rgba (1.0, 2.0, 3.0, 4.0) 8
|
||||||
|
|
||||||
uniform 0 float4 7.604 3.1415 2.72 9.876
|
uniform 0 float4 7.604 3.1415 2.72 9.876
|
||||||
todo(sm<6) draw quad
|
todo(sm>=4 & sm<6) draw quad
|
||||||
probe (0, 0) rgba (7.604, 3.1415, 2.72, 9.876) 8
|
probe (0, 0) rgba (7.604, 3.1415, 2.72, 9.876) 8
|
||||||
|
|
||||||
uniform 0 float4 0.0 -0.0 1.0e39 -1.0e39
|
uniform 0 float4 0.0 -0.0 1.0e39 -1.0e39
|
||||||
todo(sm<6) draw quad
|
todo(sm>=4 & sm<6) draw quad
|
||||||
probe (0, 0) rgba (0.0, -0.0, 1.0e39, -1.0e39)
|
probe (0, 0) rgba (0.0, -0.0, 1.0e39, -1.0e39)
|
||||||
|
|
||||||
|
|
||||||
[pixel shader todo]
|
[pixel shader todo(sm>=4)]
|
||||||
% Make sure swizzling works
|
% Make sure swizzling works
|
||||||
uniform float4 f;
|
uniform float4 f;
|
||||||
|
|
||||||
@ -68,9 +68,9 @@ float4 main() : sv_target
|
|||||||
|
|
||||||
[test]
|
[test]
|
||||||
uniform 0 float4 1.0 2.0 3.0 4.0
|
uniform 0 float4 1.0 2.0 3.0 4.0
|
||||||
todo(sm<6) draw quad
|
todo(sm>=4 & sm<6) draw quad
|
||||||
probe (0, 0) rgba (1.0, 0.5, 0.3333333, 0.25) 8
|
probe (0, 0) rgba (1.0, 0.5, 0.3333333, 0.25) 8
|
||||||
|
|
||||||
uniform 0 float4 -1.0 -2.0 -3.0 -4.0
|
uniform 0 float4 -1.0 -2.0 -3.0 -4.0
|
||||||
todo(sm<6) draw quad
|
todo(sm>=4 & sm<6) draw quad
|
||||||
probe (0, 0) rgba (-1.0, -0.5, -0.3333333, -0.25) 8
|
probe (0, 0) rgba (-1.0, -0.5, -0.3333333, -0.25) 8
|
||||||
|
Loading…
Reference in New Issue
Block a user