diff options
author | Georg Lehmann <dadschoorse@gmail.com> | 2022-10-05 21:43:23 +0300 |
---|---|---|
committer | Hans-Kristian Arntzen <post@arntzen-software.no> | 2022-10-06 11:59:56 +0300 |
commit | 556c70a9b0e18f3c37b69fa297fbce9869fd3c90 (patch) | |
tree | 452bf8619a115a63995cde51c2f4bc84784c0230 | |
parent | 870c4ef10a771668d38ecdca7f954654d8f6e58a (diff) |
tests: Improve firstbithi tests.
Proves that vkd3d-shader currently doesn't handle the -1 case correctly.
The old test didn't show that because the code fxc inserts to convert the
index from MSB-first to LSB-first hides the bug.
Signed-off-by: Georg Lehmann <dadschoorse@gmail.com>
-rw-r--r-- | tests/d3d12_shaders.c | 38 |
1 files changed, 18 insertions, 20 deletions
diff --git a/tests/d3d12_shaders.c b/tests/d3d12_shaders.c index 534f7e8e..0f5c5594 100644 --- a/tests/d3d12_shaders.c +++ b/tests/d3d12_shaders.c @@ -1552,23 +1552,21 @@ void test_shader_instructions(void) uint4 main() : SV_Target { - return uint4(countbits(u), firstbitlow(u), firstbithigh(u), firstbithigh(i)); + return uint4(countbits(u), firstbitlow(u), u == 0 ? -1 : 31 - firstbithigh(u), firstbithigh(i)); } #endif - 0x43425844, 0x23fee911, 0x145287d1, 0xea904419, 0x8aa59a6a, 0x00000001, 0x000001b4, 0x00000003, + 0x43425844, 0xffc0a090, 0xe1e69913, 0xbae02533, 0xe42a6b73, 0x00000001, 0x0000016c, 0x00000003, 0x0000002c, 0x0000003c, 0x00000070, 0x4e475349, 0x00000008, 0x00000000, 0x00000008, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000001, 0x00000000, - 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x58454853, 0x0000013c, 0x00000050, 0x0000004f, + 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x58454853, 0x000000f4, 0x00000050, 0x0000003d, 0x0100086a, 0x04000059, 0x00208e46, 0x00000000, 0x00000001, 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000001, 0x06000089, 0x00100012, 0x00000000, 0x0020801a, 0x00000000, 0x00000000, 0x07000020, 0x00100022, 0x00000000, 0x0010000a, 0x00000000, 0x00004001, 0xffffffff, 0x0800001e, - 0x00100012, 0x00000000, 0x00004001, 0x0000001f, 0x8010000a, 0x00000041, 0x00000000, 0x09000037, + 0x00100012, 0x00000000, 0x8010000a, 0x00000041, 0x00000000, 0x00004001, 0x0000001f, 0x09000037, 0x00102082, 0x00000000, 0x0010001a, 0x00000000, 0x00004001, 0xffffffff, 0x0010000a, 0x00000000, - 0x06000087, 0x00100012, 0x00000000, 0x0020800a, 0x00000000, 0x00000000, 0x0800001e, 0x00100012, - 0x00000000, 0x00004001, 0x0000001f, 0x8010000a, 0x00000041, 0x00000000, 0x0a000037, 0x00102042, - 0x00000000, 0x0020800a, 0x00000000, 0x00000000, 0x0010000a, 0x00000000, 0x00004001, 0xffffffff, 0x06000086, 0x00102012, 0x00000000, 0x0020800a, 0x00000000, 0x00000000, 0x06000088, 0x00102022, - 0x00000000, 0x0020800a, 0x00000000, 0x00000000, 0x0100003e, + 0x00000000, 0x0020800a, 0x00000000, 0x00000000, 0x06000087, 0x00102042, 0x00000000, 0x0020800a, + 0x00000000, 0x00000000, 0x0100003e, }; static struct named_shader ps_bits = {"bits", ps_bits_code, sizeof(ps_bits_code)}; static const DWORD ps_ishr_code[] = @@ -2679,18 +2677,18 @@ void test_shader_instructions(void) {&ps_bfrev, {{{0xffff0000}}}, {{0x0000ffff, 0xffff0000, 0x00000000, 0xffff0000}}}, {&ps_bfrev, {{{0xffffffff}}}, {{0xffffffff, 0xffffffff, 0xffff0000, 0xffff0000}}}, - {&ps_bits, {{{ 0, 0}}}, {{ 0, ~0u, ~0u, ~0u}}}, - {&ps_bits, {{{ ~0u, ~0u}}}, {{32, 0, 31, ~0u}}}, - {&ps_bits, {{{0x7fffffff, 0x7fffffff}}}, {{31, 0, 30, 30}}}, - {&ps_bits, {{{0x80000000, 0x80000000}}}, {{ 1, 31, 31, 30}}}, - {&ps_bits, {{{0x00000001, 0x00000001}}}, {{ 1, 0, 0, 0}}}, - {&ps_bits, {{{0x80000001, 0x80000001}}}, {{ 2, 0, 31, 30}}}, - {&ps_bits, {{{0x88888888, 0x88888888}}}, {{ 8, 3, 31, 30}}}, - {&ps_bits, {{{0xcccccccc, 0xcccccccc}}}, {{16, 2, 31, 29}}}, - {&ps_bits, {{{0x11111111, 0x11111c11}}}, {{ 8, 0, 28, 28}}}, - {&ps_bits, {{{0x0000000f, 0x0000000f}}}, {{ 4, 0, 3, 3}}}, - {&ps_bits, {{{0x8000000f, 0x8000000f}}}, {{ 5, 0, 31, 30}}}, - {&ps_bits, {{{0x00080000, 0x00080000}}}, {{ 1, 19, 19, 19}}}, + {&ps_bits, {{{ 0, 0}}}, {{ 0, ~0u, ~0u, ~0u}}, false, false, true}, + {&ps_bits, {{{ ~0u, ~0u}}}, {{32, 0, 0, ~0u}}}, + {&ps_bits, {{{0x7fffffff, 0x7fffffff}}}, {{31, 0, 1, 30}}}, + {&ps_bits, {{{0x80000000, 0x80000000}}}, {{ 1, 31, 0, 30}}}, + {&ps_bits, {{{0x00000001, 0x00000001}}}, {{ 1, 0, 31, 0}}}, + {&ps_bits, {{{0x80000001, 0x80000001}}}, {{ 2, 0, 0, 30}}}, + {&ps_bits, {{{0x88888888, 0x88888888}}}, {{ 8, 3, 0, 30}}}, + {&ps_bits, {{{0xcccccccc, 0xcccccccc}}}, {{16, 2, 0, 29}}}, + {&ps_bits, {{{0x11111111, 0x11111c11}}}, {{ 8, 0, 3, 28}}}, + {&ps_bits, {{{0x0000000f, 0x0000000f}}}, {{ 4, 0, 28, 3}}}, + {&ps_bits, {{{0x8000000f, 0x8000000f}}}, {{ 5, 0, 0, 30}}}, + {&ps_bits, {{{0x00080000, 0x00080000}}}, {{ 1, 19, 12, 19}}}, {&ps_ishr, {{{0x00000000, 0x00000000, 0x00000000, 0x00000000}, {~0x1fu, 0, 32, 64}}}, {{0x00000000, 0x00000000, 0x00000000, 0x00000000}}}, |