mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-01-28 13:05:02 -08:00
vkd3d-shader/hlsl: Support cos() intrinsic.
This commit is contained in:
parent
3239ea5ff1
commit
8d5f16d803
Notes:
Alexandre Julliard
2023-01-19 22:45:36 +01:00
Approved-by: Giovanni Mascellani (@giomasce) Approved-by: Zebediah Figura (@zfigura) Approved-by: Henri Verbeet (@hverbeet) Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/62
@ -2421,6 +2421,17 @@ static bool intrinsic_clamp(struct hlsl_ctx *ctx,
|
||||
return !!add_binary_arithmetic_expr(ctx, params->instrs, HLSL_OP2_MIN, max, params->args[2], loc);
|
||||
}
|
||||
|
||||
static bool intrinsic_cos(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_COS, arg, loc);
|
||||
}
|
||||
|
||||
static bool intrinsic_cross(struct hlsl_ctx *ctx,
|
||||
const struct parse_initializer *params, const struct vkd3d_shader_location *loc)
|
||||
{
|
||||
@ -2878,6 +2889,7 @@ intrinsic_functions[] =
|
||||
{"abs", 1, true, intrinsic_abs},
|
||||
{"asuint", -1, true, intrinsic_asuint},
|
||||
{"clamp", 3, true, intrinsic_clamp},
|
||||
{"cos", 1, true, intrinsic_cos},
|
||||
{"cross", 2, true, intrinsic_cross},
|
||||
{"dot", 2, true, intrinsic_dot},
|
||||
{"floor", 1, true, intrinsic_floor},
|
||||
|
@ -1698,6 +1698,11 @@ static void write_sm4_expr(struct hlsl_ctx *ctx,
|
||||
write_sm4_cast(ctx, buffer, expr);
|
||||
break;
|
||||
|
||||
case HLSL_OP1_COS:
|
||||
assert(type_is_float(dst_type));
|
||||
write_sm4_unary_op_with_two_destinations(buffer, VKD3D_SM4_OP_SINCOS, &expr->node, 1, arg1);
|
||||
break;
|
||||
|
||||
case HLSL_OP1_EXP2:
|
||||
assert(type_is_float(dst_type));
|
||||
write_sm4_unary_op(buffer, VKD3D_SM4_OP_EXP, &expr->node, arg1, 0);
|
||||
|
@ -4,7 +4,7 @@ void main(out float tex : texcoord, inout float4 pos : sv_position)
|
||||
tex = (pos.x + 1) * 320;
|
||||
}
|
||||
|
||||
[pixel shader todo]
|
||||
[pixel shader]
|
||||
float4 main(float tex : texcoord) : sv_target
|
||||
{
|
||||
tex = floor(tex + 0.25);
|
||||
@ -12,7 +12,7 @@ float4 main(float tex : texcoord) : sv_target
|
||||
}
|
||||
|
||||
[test]
|
||||
todo draw quad
|
||||
draw quad
|
||||
probe ( 0, 0) rgba ( 0.00000000, 1.00000000, 0.0, 0.0)
|
||||
probe ( 1, 0) rgba ( 0.84147098, 0.54030231, 0.0, 0.0) 1024
|
||||
probe ( 2, 0) rgba ( 0.90929743, -0.41614684, 0.0, 0.0) 1024
|
||||
@ -45,7 +45,7 @@ draw quad
|
||||
probe all rgba (0.0, 500.0, 500.0, 0.0)
|
||||
|
||||
|
||||
[pixel shader todo]
|
||||
[pixel shader]
|
||||
uniform float4 a;
|
||||
|
||||
float4 main() : sv_target
|
||||
@ -55,5 +55,5 @@ float4 main() : sv_target
|
||||
|
||||
[test]
|
||||
uniform 0 float4 0.0 0.78539816 1.57079632 2.35619449
|
||||
todo draw quad
|
||||
todo probe all rgba (1000.0, 707.0, -0.0, -707.0)
|
||||
draw quad
|
||||
probe all rgba (1000.0, 707.0, -0.0, -707.0)
|
||||
|
Loading…
x
Reference in New Issue
Block a user