diff options
Diffstat (limited to 'tests/bugs')
| -rw-r--r-- | tests/bugs/generic-default-matrix.slang | 20 | ||||
| -rw-r--r-- | tests/bugs/generic-default-matrix.slang.expected.txt | 4 | ||||
| -rw-r--r-- | tests/bugs/generic-default-value.slang | 23 | ||||
| -rw-r--r-- | tests/bugs/generic-default-value.slang.expected.txt | 4 |
4 files changed, 51 insertions, 0 deletions
diff --git a/tests/bugs/generic-default-matrix.slang b/tests/bugs/generic-default-matrix.slang new file mode 100644 index 000000000..47fbe520e --- /dev/null +++ b/tests/bugs/generic-default-matrix.slang @@ -0,0 +1,20 @@ +//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer +RWStructuredBuffer<int> outputBuffer; + +struct Another<let W : int, let H : int> +{ + matrix<float, W, H> values; +}; + +[numthreads(4, 1, 1)] +void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) +{ + int index = dispatchThreadID.x; + + Another<2, 4> a = {}; + + outputBuffer[index] = index + a.values[0].x; +} + diff --git a/tests/bugs/generic-default-matrix.slang.expected.txt b/tests/bugs/generic-default-matrix.slang.expected.txt new file mode 100644 index 000000000..bc856dafa --- /dev/null +++ b/tests/bugs/generic-default-matrix.slang.expected.txt @@ -0,0 +1,4 @@ +0 +1 +2 +3 diff --git a/tests/bugs/generic-default-value.slang b/tests/bugs/generic-default-value.slang new file mode 100644 index 000000000..b3805e317 --- /dev/null +++ b/tests/bugs/generic-default-value.slang @@ -0,0 +1,23 @@ +//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer +RWStructuredBuffer<int> outputBuffer; + +/* Tests purpose is to confirm that use of `= {}` initialization +works with a generic */ + +struct Check<T> +{ + T v; +}; + +[numthreads(4, 1, 1)] +void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) +{ + int index = dispatchThreadID.x; + + Check<float> v = {}; + + outputBuffer[index] = index + v.v; +} + diff --git a/tests/bugs/generic-default-value.slang.expected.txt b/tests/bugs/generic-default-value.slang.expected.txt new file mode 100644 index 000000000..bc856dafa --- /dev/null +++ b/tests/bugs/generic-default-value.slang.expected.txt @@ -0,0 +1,4 @@ +0 +1 +2 +3 |
