diff options
Diffstat (limited to 'tests')
9 files changed, 122 insertions, 15 deletions
diff --git a/tests/compute/byte-address-buffer.slang b/tests/compute/byte-address-buffer.slang index f2078b52d..96e100ae8 100644 --- a/tests/compute/byte-address-buffer.slang +++ b/tests/compute/byte-address-buffer.slang @@ -3,7 +3,7 @@ //TEST(compute):COMPARE_COMPUTE_EX:-cpu -compute //TEST(compute):COMPARE_COMPUTE_EX:-slang -compute //TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute -//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-d3d12 -compute +//TEST(compute):COMPARE_COMPUTE_EX:-d3d12 -compute // Confirm cross-compilation of `(RW)ByteAddressBuffer` // diff --git a/tests/diagnostics/single-target-intrinsic.slang b/tests/diagnostics/single-target-intrinsic.slang index e8ff0ed1a..94e1a2bae 100644 --- a/tests/diagnostics/single-target-intrinsic.slang +++ b/tests/diagnostics/single-target-intrinsic.slang @@ -9,6 +9,9 @@ T doThing<T>(T in) __target_intrinsic(hlsl, "doSomethingIntrinsically($0)") T doThing<T>(T in); +__target_intrinsic(hlsl, "letsRedefineIt($0)") +T doThing<T>(T in); + void test() { int a = 5; diff --git a/tests/diagnostics/single-target-intrinsic.slang.expected b/tests/diagnostics/single-target-intrinsic.slang.expected index 82068f17d..544cd2d3b 100644 --- a/tests/diagnostics/single-target-intrinsic.slang.expected +++ b/tests/diagnostics/single-target-intrinsic.slang.expected @@ -1,7 +1,7 @@ result code = -1 standard error = { -tests/diagnostics/single-target-intrinsic.slang(10): error 30201: function 'doThing' already has a body -tests/diagnostics/single-target-intrinsic.slang(4): note: see previous definition of 'doThing' +tests/diagnostics/single-target-intrinsic.slang(13): error 30201: function 'doThing' already has a body +tests/diagnostics/single-target-intrinsic.slang(10): note: see previous definition of 'doThing' } standard output = { } diff --git a/tests/preprocessor/inappropriate-once.slang b/tests/preprocessor/inappropriate-once.slang deleted file mode 100644 index 6b750ec77..000000000 --- a/tests/preprocessor/inappropriate-once.slang +++ /dev/null @@ -1,6 +0,0 @@ -//TEST:SIMPLE: -// #include support - -#pragma once - -int foo() { return 0; }
\ No newline at end of file diff --git a/tests/preprocessor/inappropriate-once.slang.expected b/tests/preprocessor/inappropriate-once.slang.expected deleted file mode 100644 index 04d7f7834..000000000 --- a/tests/preprocessor/inappropriate-once.slang.expected +++ /dev/null @@ -1,6 +0,0 @@ -result code = 0 -standard error = { -tests/preprocessor/inappropriate-once.slang(4): warning 15602: pragma once was ignored - this is typically because is not placed in an include -} -standard output = { -} diff --git a/tests/slang-extension/atomic-float-byte-address-buffer-cross.slang b/tests/slang-extension/atomic-float-byte-address-buffer-cross.slang new file mode 100644 index 000000000..e99494d5f --- /dev/null +++ b/tests/slang-extension/atomic-float-byte-address-buffer-cross.slang @@ -0,0 +1,27 @@ +// atomic-float-byte-address-buffer-cross.slang + +//TEST:CROSS_COMPILE: -profile cs_6_5 -entry computeMain -target spirv-assembly +// We can't do this test, because it relies on nvAPI +//DISABLE_TEST:CROSS_COMPILE: -profile cs_6_5 -entry computeMain -target dxil + +//TEST_INPUT:ubuffer(data=[0.1 0.2 0.3 0.4]):out,name=outputBuffer +RWByteAddressBuffer outputBuffer; + +//TEST_INPUT:ubuffer(data=[0.7 0.5 0.2 0.6]):name=anotherBuffer +RWStructuredBuffer<float> anotherBuffer; + +[numthreads(16, 1, 1)] +void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) +{ + uint tid = dispatchThreadID.x; + int idx = (tid & 3) ^ (tid >> 2); + + const float delta = anotherBuffer[idx & 3]; + + float previousValue = 0; + outputBuffer.InterlockedAddFp32((idx << 2), 1.0f, previousValue); + + // The sum of values in anotherBuffer should also be added + int anotherIdx = tid >> 2; + outputBuffer.InterlockedAddFp32(anotherIdx << 2, delta); +}
\ No newline at end of file diff --git a/tests/slang-extension/atomic-float-byte-address-buffer-cross.slang.glsl b/tests/slang-extension/atomic-float-byte-address-buffer-cross.slang.glsl new file mode 100644 index 000000000..9fd2f18f9 --- /dev/null +++ b/tests/slang-extension/atomic-float-byte-address-buffer-cross.slang.glsl @@ -0,0 +1,51 @@ +#version 450 +#extension GL_EXT_shader_atomic_float : require +layout(row_major) uniform; +layout(row_major) buffer; + +#line 10 "tests/slang-extension/atomic-float-byte-address-buffer-cross.slang" +layout(std430, binding = 1) buffer _S1 { + float _data[]; +} anotherBuffer_0; + +#line 60 "hlsl" +layout(std430, binding = 0) buffer _S2 { + float _data[]; +} _S3; + +#line 18 "tests/slang-extension/atomic-float-byte-address-buffer-cross.slang" +void RWByteAddressBuffer_InterlockedAddFp32_0(uint _S4, float _S5, out float _S6) +{ + uint _S7 = _S4 / uint(4); + float _S8 = (atomicAdd((((_S3)._data[(_S7)])), (_S5))); + _S6 = _S8; + return; +} + +void RWByteAddressBuffer_InterlockedAddFp32_1(uint _S9, float _S10) +{ + uint _S11 = _S9 / uint(4); + float _S12 = (atomicAdd((((_S3)._data[(_S11)])), (_S10))); + return; +} + + +#line 13 +layout(local_size_x = 16, local_size_y = 1, local_size_z = 1) in;void main() +{ + uint tid_0 = gl_GlobalInvocationID.x; + int idx_0 = int(tid_0 & uint(3) ^ tid_0 >> 2); + + float delta_0 = ((anotherBuffer_0)._data[(uint(idx_0 & 3))]); + + + uint _S13 = uint(idx_0 << 2); + +#line 21 + float _S14; + RWByteAddressBuffer_InterlockedAddFp32_0(_S13, 1.00000000000000000000, _S14); + RWByteAddressBuffer_InterlockedAddFp32_1(uint(int(tid_0 >> 2) << 2), delta_0); + +#line 13 + return; +}
\ No newline at end of file diff --git a/tests/slang-extension/atomic-float-byte-address-buffer.slang b/tests/slang-extension/atomic-float-byte-address-buffer.slang new file mode 100644 index 000000000..e6e2268ff --- /dev/null +++ b/tests/slang-extension/atomic-float-byte-address-buffer.slang @@ -0,0 +1,34 @@ +// byte-address-buffer.slang + +//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-cpu -compute +//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-slang -compute +// Disabled because crashes currently on vulkan +//DISABLE_TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute +// Disabled because requires nvapi to work +// Note for this feature we require dxc and we can force that with -use-dxil +//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-d3d12 -compute -use-dxil +//TEST(compute):COMPARE_COMPUTE_EX:-cuda -compute -use-dxil + +//TEST_INPUT:ubuffer(data=[0.1 0.2 0.3 0.4]):out,name=outputBuffer +RWByteAddressBuffer outputBuffer; + +//TEST_INPUT:ubuffer(data=[0.7 0.5 0.2 0.6]):name=anotherBuffer +RWStructuredBuffer<float> anotherBuffer; + +[numthreads(16, 1, 1)] +void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) +{ + uint tid = dispatchThreadID.x; + int idx = (tid & 3) ^ (tid >> 2); + + //const float delta = anotherBuffer[idx & 3]; + const float delta = 0.0f; + + float previousValue = 0; + outputBuffer.InterlockedAddFp32((idx << 2), 1.0f, previousValue); + //outputBuffer.InterlockedAddFp32((idx ^ 2) << 2, 2.0f + delta); + + // The sum of values in anotherBuffer should also be added + //int anotherIdx = tid >> 2; + //outputBuffer.InterlockedAddFp32(anotherIdx << 2, delta); +}
\ No newline at end of file diff --git a/tests/slang-extension/atomic-float-byte-address-buffer.slang.expected.txt b/tests/slang-extension/atomic-float-byte-address-buffer.slang.expected.txt new file mode 100644 index 000000000..4affc7d87 --- /dev/null +++ b/tests/slang-extension/atomic-float-byte-address-buffer.slang.expected.txt @@ -0,0 +1,4 @@ +40833333 +40866666 +4089999A +408CCCCD |
