From 494f681bf6d9ce2f1b4500a844e0f42137ab86c1 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Tue, 17 Oct 2023 23:41:54 +0200 Subject: [PATCH] vkd3d-shader/tpf: Add support for ceil(). Signed-off-by: Nikolay Sivov --- libs/vkd3d-shader/tpf.c | 5 +++++ tests/hlsl/ceil.shader_test | 24 ++++++++++++------------ 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/libs/vkd3d-shader/tpf.c b/libs/vkd3d-shader/tpf.c index a9d89bd7..3c8096d5 100644 --- a/libs/vkd3d-shader/tpf.c +++ b/libs/vkd3d-shader/tpf.c @@ -4931,6 +4931,11 @@ static void write_sm4_expr(const struct tpf_writer *tpf, const struct hlsl_ir_ex write_sm4_cast(tpf, expr); break; + case HLSL_OP1_CEIL: + assert(type_is_float(dst_type)); + write_sm4_unary_op(tpf, VKD3D_SM4_OP_ROUND_PI, &expr->node, arg1, 0); + break; + case HLSL_OP1_COS: assert(type_is_float(dst_type)); write_sm4_unary_op_with_two_destinations(tpf, VKD3D_SM4_OP_SINCOS, &expr->node, 1, arg1); diff --git a/tests/hlsl/ceil.shader_test b/tests/hlsl/ceil.shader_test index 266a63db..0ff9938b 100644 --- a/tests/hlsl/ceil.shader_test +++ b/tests/hlsl/ceil.shader_test @@ -1,14 +1,14 @@ -[pixel shader todo] +[pixel shader] float4 main() : sv_target { return ceil(float4(-0.5, 6.5, 7.5, 3.4)); } [test] -todo(sm<6) draw quad -todo(sm<6) probe all rgba (0.0, 7.0, 8.0, 4.0) 4 +draw quad +probe all rgba (0.0, 7.0, 8.0, 4.0) 4 -[pixel shader todo] +[pixel shader] uniform float4 u; float4 main() : sv_target @@ -18,10 +18,10 @@ float4 main() : sv_target [test] uniform 0 float4 -0.5 6.5 7.5 3.4 -todo draw quad -todo probe all rgba (0.0, 7.0, 8.0, 4.0) 4 +todo(sm>=6) draw quad +probe all rgba (0.0, 7.0, 8.0, 4.0) 4 -[pixel shader todo] +[pixel shader] uniform float4 u; float4 main() : sv_target @@ -34,13 +34,13 @@ float4 main() : sv_target [test] uniform 0 float4 -0.5 6.5 7.5 3.4 -todo draw quad -todo probe all rgba (7.0, 8.0, 0.0, 4.0) 4 +todo(sm>=6) draw quad +probe all rgba (7.0, 8.0, 0.0, 4.0) 4 [require] shader model >= 4.0 -[pixel shader todo] +[pixel shader] uniform int4 u; float4 main() : sv_target @@ -53,5 +53,5 @@ float4 main() : sv_target [test] uniform 0 int4 -1 6 7 3 -todo draw quad -todo probe all rgba (6.0, 7.0, -1.0, 3.0) 4 +todo(sm>=6) draw quad +probe all rgba (6.0, 7.0, -1.0, 3.0) 4