diff options
Diffstat (limited to 'tests/compute')
| -rw-r--r-- | tests/compute/simple.slang | 1 | ||||
| -rw-r--r-- | tests/compute/structured-buffer-of-struct.slang | 37 | ||||
| -rw-r--r-- | tests/compute/texture-simpler.slang | 16 | ||||
| -rw-r--r-- | tests/compute/texture-simpler.slang.expected.txt | 5 |
4 files changed, 59 insertions, 0 deletions
diff --git a/tests/compute/simple.slang b/tests/compute/simple.slang index 0d4efc2e2..96cccc090 100644 --- a/tests/compute/simple.slang +++ b/tests/compute/simple.slang @@ -1,6 +1,7 @@ //TEST(smoke,compute):COMPARE_COMPUTE:-shaderobj //TEST(smoke,compute):COMPARE_COMPUTE:-dx12 -use-dxil -shaderobj //TEST(smoke,compute):COMPARE_COMPUTE:-cpu -shaderobj +//TEST(smoke,compute):COMPARE_COMPUTE:-vk -shaderobj //TEST(smoke,compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -shaderobj // CHECK: 0 diff --git a/tests/compute/structured-buffer-of-struct.slang b/tests/compute/structured-buffer-of-struct.slang new file mode 100644 index 000000000..7bfb38df8 --- /dev/null +++ b/tests/compute/structured-buffer-of-struct.slang @@ -0,0 +1,37 @@ +//TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -shaderobj + +// CHECK: 2 +// CHECK-NEXT: 1 +// CHECK-NEXT: 4 +// CHECK-NEXT: 3 +// CHECK-NEXT: 6 +// CHECK-NEXT: 5 +// CHECK-NEXT: 8 +// CHECK-NEXT: 7 + +struct S +{ + int a; + int b; +}; + +//TEST_INPUT:ubuffer(data=[1 2 3 4 5 6 7 8], stride=8):out,name=buf +RWStructuredBuffer<S> buf; + +S test(S s) +{ + s.a = s.a ^ s.b; + s.b = s.a ^ s.b; + s.a = s.a ^ s.b; + return s; +} + +[numthreads(4, 1, 1)] +// void computeMain(uint i : SV_GroupIndex) +// { +// buf[i] = test(buf[i]); +// } +void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) +{ + buf[dispatchThreadID.x] = test(buf[dispatchThreadID.x]); +} diff --git a/tests/compute/texture-simpler.slang b/tests/compute/texture-simpler.slang new file mode 100644 index 000000000..ce4b76f77 --- /dev/null +++ b/tests/compute/texture-simpler.slang @@ -0,0 +1,16 @@ +//TEST(compute, vulkan):COMPARE_COMPUTE:-vk -compute -shaderobj -output-using-type + +//TEST_INPUT: Texture2D(size=4, content = one):name t2D +Texture2D<float> t2D; +//TEST_INPUT: Sampler:name samplerState +SamplerState samplerState; + +//TEST_INPUT: ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer +RWStructuredBuffer<float> outputBuffer; + +[numthreads(4, 1, 1)] +void computeMain(uint i : SV_GroupIndex) +{ + float u = i * 0.25; + outputBuffer[i] = t2D.SampleLevel(samplerState, float2(u, u), 0); +} diff --git a/tests/compute/texture-simpler.slang.expected.txt b/tests/compute/texture-simpler.slang.expected.txt new file mode 100644 index 000000000..334dd67a8 --- /dev/null +++ b/tests/compute/texture-simpler.slang.expected.txt @@ -0,0 +1,5 @@ +type: float +1.000000 +1.000000 +1.000000 +1.000000 |
