diff options
Diffstat (limited to 'tests/compute')
| -rw-r--r-- | tests/compute/static-const-matrix-array.slang | 36 | ||||
| -rw-r--r-- | tests/compute/static-const-matrix-array.slang.expected.txt | 9 | ||||
| -rw-r--r-- | tests/compute/unbounded-array-of-array-syntax.slang | 1 |
3 files changed, 46 insertions, 0 deletions
diff --git a/tests/compute/static-const-matrix-array.slang b/tests/compute/static-const-matrix-array.slang new file mode 100644 index 000000000..2ac132121 --- /dev/null +++ b/tests/compute/static-const-matrix-array.slang @@ -0,0 +1,36 @@ +// static-const-array.slang + +//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -output-using-type +//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute -output-using-type +//TEST(compute):COMPARE_COMPUTE_EX:-cpu -slang -compute -output-using-type + +//TEST_INPUT:ubuffer(data=[0 0 0 0 0 0 0 0], stride=4):out, name outputBuffer +RWStructuredBuffer<float> outputBuffer; + + +static const matrix<float, 2, 3> kMatrix = { 1, 2, 4, -1, -2, -3 }; +static const float3 kVector = { -1, -2, -3 }; + +static const matrix<float, 2, 3> kArray[2] = +{ + matrix<float, 2, 3>(0, 1, 2, 3, 4, 5), + matrix<float, 2, 3>(float3(6, 7, 8), float3(9, 10, 11)), +}; + +float test(int inVal, int index) +{ + matrix<float, 2, 3> mat = kArray[index] + kMatrix; + mat[0] =+ kVector; + + float2 a = { inVal, inVal + 1}; + float3 v = mul(a, mat); + return v.x + v.y + v.z; +} + +[numthreads(8, 1, 1)] +void computeMain(uint3 tid : SV_DispatchThreadID) +{ + int inVal = tid.x; + float outVal = test(inVal, inVal & 1); + outputBuffer[inVal] = outVal; +}
\ No newline at end of file diff --git a/tests/compute/static-const-matrix-array.slang.expected.txt b/tests/compute/static-const-matrix-array.slang.expected.txt new file mode 100644 index 000000000..7c72762a0 --- /dev/null +++ b/tests/compute/static-const-matrix-array.slang.expected.txt @@ -0,0 +1,9 @@ +type: float +6.000000 +42.000000 +6.000000 +78.000000 +6.000000 +114.000000 +6.000000 +150.000000 diff --git a/tests/compute/unbounded-array-of-array-syntax.slang b/tests/compute/unbounded-array-of-array-syntax.slang index 21b05dc71..17bb5eb2e 100644 --- a/tests/compute/unbounded-array-of-array-syntax.slang +++ b/tests/compute/unbounded-array-of-array-syntax.slang @@ -2,6 +2,7 @@ //TEST(compute):COMPARE_COMPUTE_EX:-cpu -compute //TEST:CROSS_COMPILE:-target dxbc-assembly -entry computeMain -profile cs_5_1 //TEST:CROSS_COMPILE:-target spirv-assembly -entry computeMain -profile cs_5_1 +//TEST(compute):COMPARE_COMPUTE_EX:-cuda -compute //TEST_INPUT:ubuffer(data=[0 0 0 0 0 0 0 0], stride=4):out,name outputBuffer RWStructuredBuffer<int> outputBuffer; |
