From 554321a23cef87cd1a10a0039d374a6d0af73176 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B3zef=20Kucia?= Date: Thu, 20 Jul 2017 17:40:45 +0200 Subject: [PATCH] tests: Add test for frc instruction. --- tests/d3d12.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/tests/d3d12.c b/tests/d3d12.c index 69b5b07b..2b0fc0a3 100644 --- a/tests/d3d12.c +++ b/tests/d3d12.c @@ -4380,6 +4380,28 @@ static void test_shader_instructions(void) 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0100003e, }; static const D3D12_SHADER_BYTECODE ps_round = {ps_round_code, sizeof(ps_round_code)}; + static const DWORD ps_frc_code[] = + { +#if 0 + float src; + + void main(out float4 dst : SV_Target) + { + dst = 0; + dst.x = frac(src); + dst.y = frac(-src); + } +#endif + 0x43425844, 0xd52bc741, 0xda411d9a, 0x199054a2, 0x7461462d, 0x00000001, 0x000000f8, 0x00000003, + 0x0000002c, 0x0000003c, 0x00000070, 0x4e475349, 0x00000008, 0x00000000, 0x00000008, 0x4e47534f, + 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, + 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x58454853, 0x00000080, 0x00000050, 0x00000020, + 0x0100086a, 0x04000059, 0x00208e46, 0x00000000, 0x00000001, 0x03000065, 0x001020f2, 0x00000000, + 0x0600001a, 0x00102012, 0x00000000, 0x0020800a, 0x00000000, 0x00000000, 0x0700001a, 0x00102022, + 0x00000000, 0x8020800a, 0x00000041, 0x00000000, 0x00000000, 0x08000036, 0x001020c2, 0x00000000, + 0x00004002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0100003e, + }; + static const D3D12_SHADER_BYTECODE ps_frc = {ps_frc_code, sizeof(ps_frc_code)}; static const DWORD ps_bfi_code[] = { #if 0 @@ -4958,6 +4980,13 @@ static void test_shader_instructions(void) {&ps_round, {{ 3.0f}}, {{ 3.0f, 3.0f}}}, {&ps_round, {{ INFINITY}}, {{ INFINITY, INFINITY}}}, {&ps_round, {{-INFINITY}}, {{-INFINITY, -INFINITY}}}, + + {&ps_frc, {{ 0.0f}}, {{0.0f, 0.0f}}}, + {&ps_frc, {{-0.0f}}, {{0.0f, 0.0f}}}, + {&ps_frc, {{ 1.0f}}, {{0.0f, 0.0f}}}, + {&ps_frc, {{-1.0f}}, {{0.0f, 0.0f}}}, + {&ps_frc, {{ 0.5f}}, {{0.5f, 0.5f}}}, + {&ps_frc, {{-0.5f}}, {{0.5f, 0.5f}}}, }; static const struct