diff options
| author | Anders Leino <aleino@nvidia.com> | 2025-03-17 15:05:11 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-03-17 21:05:11 +0800 |
| commit | 98ff41989b04ce883e9dc9f4464c45290d30c560 (patch) | |
| tree | fc30afe14244da7d6063d4bbcf5eb343afe69a53 /tests | |
| parent | 3357b5549cebbcbd95c8762b2638efd9ea607013 (diff) | |
Add error diagnostic vectors and matrices with disallowed element types (#6596)
- Add the diagnostic messages, and code to emit them
- Add some tests
This helps to address issue #6183.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/compute/integer-matrix-diagnostic.slang | 22 | ||||
| -rw-r--r-- | tests/compute/integer-vector-diagnostic.slang | 20 | ||||
| -rw-r--r-- | tests/compute/matrix-layout.hlsl | 3 |
3 files changed, 44 insertions, 1 deletions
diff --git a/tests/compute/integer-matrix-diagnostic.slang b/tests/compute/integer-matrix-diagnostic.slang new file mode 100644 index 000000000..bd69c28e4 --- /dev/null +++ b/tests/compute/integer-matrix-diagnostic.slang @@ -0,0 +1,22 @@ +// Check that using matrices with integer floating point type yields the correct diagnostic + +//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK): -target glsl -entry computeMain -stage compute +//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK): -target metal -entry computeMain -stage compute +//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK): -target spirv -entry computeMain -stage compute +//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK): -target wgsl -entry computeMain -stage compute + +cbuffer MatrixBuffer +{ + // CHECK: error 38202 + int4x4 iMatrix; +} + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out, name=outputBuffer +RWStructuredBuffer<int4> outputBuffer; + +[numthreads(4, 1, 1)] +void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) +{ + uint index = dispatchThreadID.x; + outputBuffer[index] = iMatrix[0][0]; +}
\ No newline at end of file diff --git a/tests/compute/integer-vector-diagnostic.slang b/tests/compute/integer-vector-diagnostic.slang new file mode 100644 index 000000000..98ca881ff --- /dev/null +++ b/tests/compute/integer-vector-diagnostic.slang @@ -0,0 +1,20 @@ +//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK): -target wgsl -entry computeMain -stage compute + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out, name=outputBuffer +RWStructuredBuffer<int> outputBuffer; + +cbuffer VectorBuffer +{ + // CHECK: error 38203 + vector<int8_t, 2> int8Vector; + // CHECK: error 38203 + vector<int16_t, 2> int16Vector; + // CHECK: error 38203 + vector<int64_t, 3> int64Vector; +}; + +[numthreads(4, 1, 1)] +void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) +{ + outputBuffer[0] = int8Vector.x + int16Vector.y + int64Vector.z; +}
\ No newline at end of file diff --git a/tests/compute/matrix-layout.hlsl b/tests/compute/matrix-layout.hlsl index 4a2d3f014..f3ff7d76c 100644 --- a/tests/compute/matrix-layout.hlsl +++ b/tests/compute/matrix-layout.hlsl @@ -7,7 +7,8 @@ // This has a compatibility issue on Windows 10.0.10586 on Dx12 - dxcompiler will crash (can remove form tests with -exclude compatibility-issue) -//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -xslang -matrix-layout-row-major -shaderobj +//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -dx11 -xslang -matrix-layout-row-major -shaderobj +//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -dx12 -xslang -matrix-layout-row-major -shaderobj //TEST(compute,compatibility-issue):COMPARE_COMPUTE_EX:-slang -compute -dx12 -use-dxil -xslang -matrix-layout-row-major -shaderobj //DISABLE_TEST(compute):COMPARE_COMPUTE:-slang -shaderobj -mtl |
