diff options
| author | DarrelFW321 <60972474+DarrelFW321@users.noreply.github.com> | 2025-03-21 20:11:29 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-03-22 00:11:29 +0000 |
| commit | 7f72256bcf3e9a33feec641ce8bc98bc750b6297 (patch) | |
| tree | 118519b804cf1b9b0131f0feffc6dbff5d429a76 /tests | |
| parent | 969d101aff074675de32bdbe6b97baf744634f78 (diff) | |
Add GLSL array length syntax support (#6665)
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/glsl-intrinsic/array-length.slang | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/glsl-intrinsic/array-length.slang b/tests/glsl-intrinsic/array-length.slang new file mode 100644 index 000000000..e5b96a148 --- /dev/null +++ b/tests/glsl-intrinsic/array-length.slang @@ -0,0 +1,34 @@ +//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=BUF):-vk -compute -shaderobj -allow-glsl +//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=BUF):-slang -compute -shaderobj -render-feature hardware-device -allow-glsl +//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=BUF):-metal -compute -shaderobj -allow-glsl +//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=BUF):-cpu -compute -shaderobj -allow-glsl +//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=BUF):-wgpu -compute -shaderobj -allow-glsl +//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=BUF):-cuda -compute -g0 -allow-glsl + +//TEST_INPUT:ubuffer(data=[0 0 0 0 0], stride=4):out,name outputBuffer +RWStructuredBuffer<int> outputBuffer; + +// +// Tests GLSL array.length() syntax. +// + +[shader("compute")] +[numthreads(1, 1, 1)] +void computeMain() +{ + int myArray[4] = {4, 3, 2, 1}; + outputBuffer[0] = myArray[0]; + outputBuffer[1] = myArray[1]; + outputBuffer[2] = myArray[2]; + outputBuffer[3] = myArray[3]; + outputBuffer[4] = myArray.length(); + + // BUF: 4 + // BUF-NEXT: 3 + // BUF-NEXT: 2 + // BUF-NEXT: 1 + // BUF-NEXT: 4 +} + + + |
