From e4503ad80f9353dad7218495520c4f6899e1d3a8 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Mon, 10 Apr 2023 20:46:25 +0200 Subject: [PATCH] tests: Add a test for SV_IsFrontFace. Signed-off-by: Nikolay Sivov --- Makefile.am | 1 + tests/hlsl-is-front-face.shader_test | 36 ++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 tests/hlsl-is-front-face.shader_test diff --git a/Makefile.am b/Makefile.am index a7abd56a..c7369398 100644 --- a/Makefile.am +++ b/Makefile.am @@ -94,6 +94,7 @@ vkd3d_shader_tests = \ tests/hlsl-initializer-struct.shader_test \ tests/hlsl-intrinsic-override.shader_test \ tests/hlsl-invalid.shader_test \ + tests/hlsl-is-front-face.shader_test \ tests/hlsl-ldexp.shader_test \ tests/hlsl-length.shader_test \ tests/hlsl-lerp.shader_test \ diff --git a/tests/hlsl-is-front-face.shader_test b/tests/hlsl-is-front-face.shader_test new file mode 100644 index 00000000..11447d26 --- /dev/null +++ b/tests/hlsl-is-front-face.shader_test @@ -0,0 +1,36 @@ +[require] +shader model >= 4.0 + +[input layout] +0 r32g32 float sv_position + +[vertex buffer 0] +-2.0 -2.0 + 2.0 -2.0 +-2.0 2.0 + 2.0 2.0 + +[vertex shader] +void main(inout float4 pos : sv_position) +{ +} + +[pixel shader] +float4 main(bool face : sv_isfrontface) : sv_target +{ + return face ? float4(1.0f, 2.0f, 1.0f, 2.0f) : float4(0.0f, 1.0f, 0.0f, 1.0f); +} + +[test] +draw triangle strip 4 +probe all rgba (0.0, 1.0, 0.0, 1.0) + +[vertex buffer 0] +-2.0 -2.0 +-2.0 2.0 + 2.0 -2.0 + 2.0 2.0 + +[test] +draw triangle strip 4 +probe all rgba (1.0, 2.0, 1.0, 2.0)