diff --git a/tests/hlsl/wave-ops-uint.shader_test b/tests/hlsl/wave-ops-uint.shader_test index c5d27359..5fdeb242 100644 --- a/tests/hlsl/wave-ops-uint.shader_test +++ b/tests/hlsl/wave-ops-uint.shader_test @@ -324,3 +324,306 @@ probe uav 1 (0) rui (29) probe uav 1 (1) rui (29) probe uav 1 (2) rui (29) probe uav 1 (3) rui (29) + + +[require] +shader model >= 6.0 +wave-ops +int64 +format r32g32b32a32-uint uav-load + +[uav 0] +format r32g32b32a32-uint +size (buffer, 4) + +1 8 16 0 +1 11 5 0 +2 15 4 0 +4 8 6 0 + +[uav 1] +format r32g32b32a32-uint +size (buffer, 16) + +0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 + +[compute shader] +RWBuffer u0; +RWBuffer u1; + + [numthreads(4, 1, 1)] +void main(uint id : SV_GroupIndex) +{ + uint64_t2 u = u0[id] + u0[id ^ 1]; + u1[id] = WaveReadLaneFirst(u); + u1[4 + id] = WaveReadLaneAt(u, 3); +} + +[test] +dispatch 4 1 1 +probe uav 1 (0) rgui64(0x1300000002, 21) +probe uav 1 (1) rgui64(0x1300000002, 21) +probe uav 1 (2) rgui64(0x1300000002, 21) +probe uav 1 (3) rgui64(0x1300000002, 21) +probe uav 1 (4) rgui64(0x1700000006, 10) +probe uav 1 (5) rgui64(0x1700000006, 10) +probe uav 1 (6) rgui64(0x1700000006, 10) +probe uav 1 (7) rgui64(0x1700000006, 10) + + +[compute shader] +RWBuffer u0; +RWBuffer u1; + + [numthreads(4, 1, 1)] +void main(uint id : SV_GroupIndex) +{ + u1[id] = WaveActiveSum(u0[id]); +} + +[test] +dispatch 4 1 1 +probe uav 1 (0) rgui64(0x2a00000008, 31) +probe uav 1 (1) rgui64(0x2a00000008, 31) +probe uav 1 (2) rgui64(0x2a00000008, 31) +probe uav 1 (3) rgui64(0x2a00000008, 31) + + +[compute shader] +RWBuffer u0; +RWBuffer u1; + + [numthreads(4, 1, 1)] +void main(uint id : SV_GroupIndex) +{ + u1[id] = WaveActiveProduct(u0[id]); +} + +[test] +dispatch 4 1 1 +probe uav 1 (0) rgui64(0xe400000008, 0x780) +probe uav 1 (1) rgui64(0xe400000008, 0x780) +probe uav 1 (2) rgui64(0xe400000008, 0x780) +probe uav 1 (3) rgui64(0xe400000008, 0x780) + + +[compute shader] +RWBuffer u0; +RWBuffer u1; + + [numthreads(4, 1, 1)] +void main(uint id : SV_GroupIndex) +{ + u1[id] = WaveActiveMin(u0[id]); +} + +[test] +dispatch 4 1 1 +probe uav 1 (0) rgui64(0x800000001, 4) +probe uav 1 (1) rgui64(0x800000001, 4) +probe uav 1 (2) rgui64(0x800000001, 4) +probe uav 1 (3) rgui64(0x800000001, 4) + + +[compute shader] +RWBuffer u0; +RWBuffer u1; + + [numthreads(4, 1, 1)] +void main(uint id : SV_GroupIndex) +{ + u1[id] = WaveActiveMax(u0[id]); +} + +[test] +dispatch 4 1 1 +probe uav 1 (0) rgui64(0xf00000002, 16) +probe uav 1 (1) rgui64(0xf00000002, 16) +probe uav 1 (2) rgui64(0xf00000002, 16) +probe uav 1 (3) rgui64(0xf00000002, 16) + + +[compute shader] +RWBuffer u0; +RWBuffer u1; + + [numthreads(4, 1, 1)] +void main(uint id : SV_GroupIndex) +{ + u1[id] = WavePrefixSum(u0[id]); +} + +[test] +dispatch 4 1 1 +probe uav 1 (0) rgui64(0, 0) +probe uav 1 (1) rgui64( 0x800000001, 16) +probe uav 1 (2) rgui64(0x1300000002, 21) +probe uav 1 (3) rgui64(0x2200000004, 25) + + +[compute shader] +RWBuffer u0; +RWBuffer u1; + + [numthreads(4, 1, 1)] +void main(uint id : SV_GroupIndex) +{ + u1[id] = WavePrefixProduct(u0[id]); +} + +[test] +dispatch 4 1 1 +probe uav 1 (0) rgui64(1, 1) +probe uav 1 (1) rgui64( 0x800000001, 16) +probe uav 1 (2) rgui64(0x1300000001, 80) +probe uav 1 (3) rgui64(0x3500000002, 320) + + +[compute shader] +RWBuffer u0; +RWBuffer u1; + + [numthreads(4, 1, 1)] +void main(uint id : SV_GroupIndex) +{ + u1[id] = WaveActiveBitAnd(u0[id]); +} + +[test] +dispatch 4 1 1 +probe uav 1 (0) rgui64(0x800000000, 0) +probe uav 1 (1) rgui64(0x800000000, 0) +probe uav 1 (2) rgui64(0x800000000, 0) +probe uav 1 (3) rgui64(0x800000000, 0) + + +[compute shader] +RWBuffer u0; +RWBuffer u1; + + [numthreads(4, 1, 1)] +void main(uint id : SV_GroupIndex) +{ + u1[id] = WaveActiveBitOr(u0[id]); +} + +[test] +dispatch 4 1 1 +probe uav 1 (0) rgui64(0xf00000007, 0x17) +probe uav 1 (1) rgui64(0xf00000007, 0x17) +probe uav 1 (2) rgui64(0xf00000007, 0x17) +probe uav 1 (3) rgui64(0xf00000007, 0x17) + + +[compute shader] +RWBuffer u0; +RWBuffer u1; + + [numthreads(4, 1, 1)] +void main(uint id : SV_GroupIndex) +{ + u1[id] = WaveActiveBitXor(u0[id]); +} + +[test] +dispatch 4 1 1 +probe uav 1 (0) rgui64(0x400000006, 0x17) +probe uav 1 (1) rgui64(0x400000006, 0x17) +probe uav 1 (2) rgui64(0x400000006, 0x17) +probe uav 1 (3) rgui64(0x400000006, 0x17) + + +[uav 0] +format r32g32b32a32-uint +size (buffer, 4) + + 1 2 3 4 + 5 6 7 8 + 9 10 11 12 +13 14 15 16 + +[compute shader] +RWBuffer u0; +RWBuffer u1; + + [numthreads(4, 1, 1)] +void main(uint id : SV_GroupIndex) +{ + uint i = WaveGetLaneIndex() % 4; + uint64_t2 u = u0[i]; + u1[i] = QuadReadAcrossX(u); +} + +[test] +dispatch 4 1 1 +probe uav 1 (0) rgui64(0x600000005, 0x800000007) +probe uav 1 (1) rgui64(0x200000001, 0x400000003) +probe uav 1 (2) rgui64(0xe0000000d, 0x100000000f) +probe uav 1 (3) rgui64(0xa00000009, 0xc0000000b) + + +[compute shader] +RWBuffer u0; +RWBuffer u1; + + [numthreads(4, 1, 1)] +void main(uint id : SV_GroupIndex) +{ + uint i = WaveGetLaneIndex() % 4; + uint64_t2 u = u0[i]; + u1[i] = QuadReadAcrossY(u); +} + +[test] +dispatch 4 1 1 +probe uav 1 (0) rgui64(0xa00000009, 0xc0000000b) +probe uav 1 (1) rgui64(0xe0000000d, 0x100000000f) +probe uav 1 (2) rgui64(0x200000001, 0x400000003) +probe uav 1 (3) rgui64(0x600000005, 0x800000007) + + +[compute shader] +RWBuffer u0; +RWBuffer u1; + + [numthreads(4, 1, 1)] +void main(uint id : SV_GroupIndex) +{ + uint i = WaveGetLaneIndex() % 4; + uint64_t2 u = u0[i]; + u1[i] = QuadReadAcrossDiagonal(u); +} + +[test] +dispatch 4 1 1 +probe uav 1 (0) rgui64(0xe0000000d, 0x100000000f) +probe uav 1 (1) rgui64(0xa00000009, 0xc0000000b) +probe uav 1 (2) rgui64(0x600000005, 0x800000007) +probe uav 1 (3) rgui64(0x200000001, 0x400000003) + + +[compute shader] +RWBuffer u0; +RWBuffer u1; + + [numthreads(4, 1, 1)] +void main(uint id : SV_GroupIndex) +{ + uint i = WaveGetLaneIndex() % 4; + uint64_t2 u = u0[i]; + u1[i] = QuadReadLaneAt(u, 2); +} + +[test] +dispatch 4 1 1 +probe uav 1 (0) rgui64(0xa00000009, 0xc0000000b) +probe uav 1 (1) rgui64(0xa00000009, 0xc0000000b) +probe uav 1 (2) rgui64(0xa00000009, 0xc0000000b) +probe uav 1 (3) rgui64(0xa00000009, 0xc0000000b) diff --git a/tests/shader_runner.c b/tests/shader_runner.c index 763bfce1..fce21930 100644 --- a/tests/shader_runner.c +++ b/tests/shader_runner.c @@ -1237,6 +1237,18 @@ static void parse_test_directive(struct shader_runner *runner, const char *line) todo_if(runner->is_todo) bug_if(runner->is_bug) check_readback_data_uint(rb, &box, expect, 0); } + else if (match_string(line, "rgui64", &line)) + { + struct u64vec2 v; + + if (*line != '(') + fatal_error("Malformed probe arguments '%s'.\n", line); + ++line; + read_uint64(&line, &v.x, false); + read_uint64(&line, &v.y, false); + line = close_parentheses(line); + todo_if(runner->is_todo) check_readback_data_u64vec2(rb, &rect, &v); + } else if (match_string(line, "rui64", &line) || (is_signed = match_string(line, "ri64", &line))) { uint64_t expect; diff --git a/tests/utils.h b/tests/utils.h index 753dc6eb..94221b5e 100644 --- a/tests/utils.h +++ b/tests/utils.h @@ -203,6 +203,12 @@ static inline bool compare_uvec4(const struct uvec4 *v1, const struct uvec4 *v2) return v1->x == v2->x && v1->y == v2->y && v1->z == v2->z && v1->w == v2->w; } +static inline bool compare_u64vec2(const struct u64vec2 *v1, const struct u64vec2 *v2) +{ + return compare_uint64(v1->x, v2->x, 0) + && compare_uint64(v1->y, v2->y, 0); +} + static inline bool compare_vec(const struct vec4 *v1, const struct vec4 *v2, unsigned int ulps, unsigned component_count) { @@ -278,6 +284,11 @@ static const struct uvec4 *get_readback_uvec4(const struct resource_readback *rb return get_readback_data(rb, x, y, 0, sizeof(struct uvec4)); } +static const struct u64vec2 *get_readback_u64vec2(const struct resource_readback *rb, unsigned int x, unsigned int y) +{ + return get_readback_data(rb, x, y, 0, sizeof(struct u64vec2)); +} + #define check_readback_data_float(a, b, c, d) check_readback_data_float_(__FILE__, __LINE__, a, b, c, d) static inline void check_readback_data_float_(const char *file, unsigned int line, const struct resource_readback *rb, const RECT *rect, float expected, unsigned int max_diff) @@ -493,6 +504,38 @@ static inline void check_readback_data_uvec4_(const char *file, unsigned int lin got.x, got.y, got.z, got.w, expected->x, expected->y, expected->z, expected->w, x, y); } +#define check_readback_data_i64vec2(a, b, c) \ + check_readback_data_u64vec2_(__FILE__, __LINE__, a, b, (const struct u64vec2 *)(c)) +#define check_readback_data_u64vec2(a, b, c) check_readback_data_u64vec2_(__FILE__, __LINE__, a, b, c) +static inline void check_readback_data_u64vec2_(const char *file, unsigned int line, + const struct resource_readback *rb, const RECT *rect, const struct u64vec2 *expected) +{ + RECT r = {0, 0, rb->width, rb->height}; + unsigned int x = 0, y = 0; + struct u64vec2 got = {0}; + bool all_match = true; + + if (rect) + r = *rect; + + for (y = r.top; y < r.bottom; ++y) + { + for (x = r.left; x < r.right; ++x) + { + got = *get_readback_u64vec2(rb, x, y); + if (!compare_u64vec2(&got, expected)) + { + all_match = false; + break; + } + } + if (!all_match) + break; + } + ok_(file, line)(all_match, "Got {0x%016"PRIx64", 0x%016"PRIx64"}, expected {0x%016"PRIx64", 0x%016"PRIx64"}" + " at (%u, %u).\n", got.x, got.y, expected->x, expected->y, x, y); +} + struct test_options { bool use_warp_device;