From 172cb758720a3d1c264c184241e1d611bf6d0e58 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Mon, 5 Dec 2022 20:46:22 -0600 Subject: [PATCH] vkd3d-shader/spirv: Implement VKD3DSIH_ABS. --- libs/vkd3d-shader/spirv.c | 2 ++ tests/hlsl/abs.shader_test | 4 ++-- tests/hlsl/float-comparison.shader_test | 2 +- tests/hlsl/fwidth.shader_test | 12 ++++++------ tests/hlsl/inverse-trig.shader_test | 20 ++++++++++---------- tests/hlsl/ternary.shader_test | 4 ++-- 6 files changed, 23 insertions(+), 21 deletions(-) diff --git a/libs/vkd3d-shader/spirv.c b/libs/vkd3d-shader/spirv.c index 51b114ce..76856bd4 100644 --- a/libs/vkd3d-shader/spirv.c +++ b/libs/vkd3d-shader/spirv.c @@ -7123,6 +7123,7 @@ static enum GLSLstd450 spirv_compiler_map_ext_glsl_instruction( } glsl_insts[] = { + {VKD3DSIH_ABS, GLSLstd450FAbs}, {VKD3DSIH_ACOS, GLSLstd450Acos}, {VKD3DSIH_ASIN, GLSLstd450Asin}, {VKD3DSIH_ATAN, GLSLstd450Atan}, @@ -9814,6 +9815,7 @@ static int spirv_compiler_handle_instruction(struct spirv_compiler *compiler, case VKD3DSIH_ISFINITE: spirv_compiler_emit_isfinite(compiler, instruction); break; + case VKD3DSIH_ABS: case VKD3DSIH_ACOS: case VKD3DSIH_ASIN: case VKD3DSIH_ATAN: diff --git a/tests/hlsl/abs.shader_test b/tests/hlsl/abs.shader_test index fe28ae74..003504eb 100644 --- a/tests/hlsl/abs.shader_test +++ b/tests/hlsl/abs.shader_test @@ -8,8 +8,8 @@ float4 main() : sv_target [test] uniform 0 float4 0.1 0.7 0.0 0.0 -todo(sm<4 | glsl) draw quad +todo(glsl) draw quad probe all rgba (0.1, 0.7, 0.4, 0.4) uniform 0 float4 -0.7 0.1 0.0 0.0 -todo(sm<4 | glsl) draw quad +todo(glsl) draw quad probe all rgba (0.7, 0.1, 1.2, 0.4) diff --git a/tests/hlsl/float-comparison.shader_test b/tests/hlsl/float-comparison.shader_test index 1f481e31..84c09c12 100644 --- a/tests/hlsl/float-comparison.shader_test +++ b/tests/hlsl/float-comparison.shader_test @@ -107,7 +107,7 @@ float4 main() : sv_target [test] uniform 0 float4 1e-37 1e-37 1e+38 1e+38 uniform 4 float4 0 -1e-37 1e+38 -1e+38 -todo(sm<4) draw quad +draw quad probe all rgba (0.0, 0.0, 1.0, 0.0) diff --git a/tests/hlsl/fwidth.shader_test b/tests/hlsl/fwidth.shader_test index 3ba116a5..0c682d17 100644 --- a/tests/hlsl/fwidth.shader_test +++ b/tests/hlsl/fwidth.shader_test @@ -18,9 +18,9 @@ float4 main(float4 pos : sv_position) : sv_target } [test] -todo(sm<4 | glsl) draw quad -probe (10, 10) rgba (8.0, 8.0, 8.0, 8.0) -probe (11, 10) rgba (8.0, 8.0, 8.0, 8.0) -probe (12, 10) rgba (10.0, 10.0, 10.0, 10.0) -probe (16, 16) rgba (12.0, 12.0, 12.0, 12.0) -probe (150, 150) rgba (92.0, 92.0, 92.0, 92.0) +todo(glsl) draw quad +todo(sm<4) probe (10, 10) rgba (8.0, 8.0, 8.0, 8.0) +todo(sm<4) probe (11, 10) rgba (8.0, 8.0, 8.0, 8.0) +todo(sm<4) probe (12, 10) rgba (10.0, 10.0, 10.0, 10.0) +todo(sm<4) probe (16, 16) rgba (12.0, 12.0, 12.0, 12.0) +todo(sm<4) probe (150, 150) rgba (92.0, 92.0, 92.0, 92.0) diff --git a/tests/hlsl/inverse-trig.shader_test b/tests/hlsl/inverse-trig.shader_test index 4fad189b..31af0cee 100644 --- a/tests/hlsl/inverse-trig.shader_test +++ b/tests/hlsl/inverse-trig.shader_test @@ -13,23 +13,23 @@ float4 main() : sv_target [test] uniform 0 float4 -1.0 0.0 0.0 0.0 -todo(sm<4 | glsl) draw quad +todo(glsl) draw quad probe all rgba (3.14159274, 0.0, 0.0, 0.0) 128 uniform 0 float4 -0.5 0.0 0.0 0.0 -todo(sm<4 | glsl) draw quad +todo(glsl) draw quad probe all rgba (2.094441441, 0.0, 0.0, 0.0) 256 uniform 0 float4 0.0 0.0 0.0 0.0 -todo(sm<4 | glsl) draw quad +todo(glsl) draw quad probe all rgba (1.57072878, 0.0, 0.0, 0.0) 1024 uniform 0 float4 0.5 0.0 0.0 0.0 -todo(sm<4 | glsl) draw quad +todo(glsl) draw quad probe all rgba (1.04715133, 0.0, 0.0, 0.0) 512 uniform 0 float4 1.0 0.0 0.0 0.0 -todo(sm<4 | glsl) draw quad +todo(glsl) draw quad probe all rgba (0.0, 0.0, 0.0, 0.0) 128 [pixel shader] @@ -44,7 +44,7 @@ float4 main() : sv_target [test] uniform 0 float4 -1.0 0.0 0.0 0.0 -todo(sm<4 | glsl) draw quad +todo(glsl) draw quad probe all rgba (-31416.0, 0.0, 0.0, 0.0) [require] @@ -52,15 +52,15 @@ shader model < 6.0 [test] uniform 0 float4 -0.5 0.0 0.0 0.0 -todo(sm<4 | glsl) draw quad +todo(glsl) draw quad probe all rgba (-10473.0, 0.0, 0.0, 0.0) uniform 0 float4 0.0 0.0 0.0 0.0 -todo(sm<4 | glsl) draw quad +todo(glsl) draw quad probe all rgba (1.0, 0.0, 0.0, 0.0) uniform 0 float4 0.5 0.0 0.0 0.0 -todo(sm<4 | glsl) draw quad +todo(glsl) draw quad probe all rgba (10473.0, 0.0, 0.0, 0.0) [require] @@ -88,7 +88,7 @@ probe all rgba (10472.0, 0.0, 0.0, 0.0) 4096 [test] uniform 0 float4 1.0 0.0 0.0 0.0 -todo(sm<4 | glsl) draw quad +todo(glsl) draw quad probe all rgba (31416.0, 0.0, 0.0, 0.0) diff --git a/tests/hlsl/ternary.shader_test b/tests/hlsl/ternary.shader_test index 5890b25d..c075b1e5 100644 --- a/tests/hlsl/ternary.shader_test +++ b/tests/hlsl/ternary.shader_test @@ -67,7 +67,7 @@ float4 main() : sv_target uniform 0 float4 0.0 1.0 0.0 -3.0 uniform 4 float4 1.0 2.0 3.0 4.0 uniform 8 float4 5.0 6.0 7.0 8.0 -todo(sm<4 | glsl) draw quad +todo(glsl) draw quad probe all rgba (5.0, 2.0, 7.0, 4.0) @@ -295,7 +295,7 @@ float4 main() : sv_target uniform 0 float4 1.0 0.0 1.0 0.0 uniform 4 float4 1.0 2.0 3.0 4.0 uniform 8 float4 5.0 6.0 7.0 8.0 -todo(sm<4 | glsl) draw quad +todo(glsl) draw quad probe all rgba (1.0, 5.0, 1.0, 5.0)