From 0cc0b68fb451a36c0abe8ebac5b1397da313ca9d Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Fri, 3 May 2024 14:32:31 +0200 Subject: [PATCH] vkd3d-shader/glsl: Implement VKD3DSIH_ROUND_NE. --- libs/vkd3d-shader/glsl.c | 3 +++ tests/hlsl/inverse-trig.shader_test | 10 +++++----- tests/hlsl/round.shader_test | 6 +++--- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/libs/vkd3d-shader/glsl.c b/libs/vkd3d-shader/glsl.c index 12954cdb..ddab6b3a 100644 --- a/libs/vkd3d-shader/glsl.c +++ b/libs/vkd3d-shader/glsl.c @@ -797,6 +797,9 @@ static void vkd3d_glsl_handle_instruction(struct vkd3d_glsl_generator *gen, case VKD3DSIH_RET: shader_glsl_ret(gen, ins); break; + case VKD3DSIH_ROUND_NE: + shader_glsl_intrinsic(gen, ins, "roundEven"); + break; case VKD3DSIH_ROUND_NI: shader_glsl_intrinsic(gen, ins, "floor"); break; diff --git a/tests/hlsl/inverse-trig.shader_test b/tests/hlsl/inverse-trig.shader_test index cf3bcbec..32f95f54 100644 --- a/tests/hlsl/inverse-trig.shader_test +++ b/tests/hlsl/inverse-trig.shader_test @@ -44,7 +44,7 @@ float4 main() : sv_target [test] uniform 0 float4 -1.0 0.0 0.0 0.0 -todo(glsl) draw quad +draw quad probe (0, 0) 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(glsl) draw quad +draw quad probe (0, 0) rgba (-10473.0, 0.0, 0.0, 0.0) uniform 0 float4 0.0 0.0 0.0 0.0 -todo(glsl) draw quad +draw quad probe (0, 0) rgba (1.0, 0.0, 0.0, 0.0) uniform 0 float4 0.5 0.0 0.0 0.0 -todo(glsl) draw quad +draw quad probe (0, 0) rgba (10473.0, 0.0, 0.0, 0.0) [require] @@ -88,7 +88,7 @@ probe (0, 0) rgba (10472.0, 0.0, 0.0, 0.0) 4096 [test] uniform 0 float4 1.0 0.0 0.0 0.0 -todo(glsl) draw quad +draw quad probe (0, 0) rgba (31416.0, 0.0, 0.0, 0.0) diff --git a/tests/hlsl/round.shader_test b/tests/hlsl/round.shader_test index 5c4b5c56..201acbdb 100644 --- a/tests/hlsl/round.shader_test +++ b/tests/hlsl/round.shader_test @@ -8,7 +8,7 @@ float4 main() : sv_target [test] uniform 0 float4 -0.4 -6.6 7.6 3.4 -todo(glsl) draw quad +draw quad probe (0, 0) rgba (0.0, -7.0, 8.0, 3.0) 4 @@ -26,7 +26,7 @@ float4 main() : sv_target [test] uniform 0 float4 -0.4 -6.6 7.6 3.4 -todo(glsl) draw quad +draw quad probe (0, 0) rgba (-7.0, 8.0, 0.0, 3.0) 4 @@ -42,5 +42,5 @@ float4 main() : sv_target [test] uniform 0 float4 -1 0 2 10 -todo(glsl) draw quad +draw quad probe (0, 0) rgba (-1.0, 0.0, 2.0, 10.0) 4