diff options
Diffstat (limited to 'tests/experiments/generic/resource.slang')
| -rw-r--r-- | tests/experiments/generic/resource.slang | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/experiments/generic/resource.slang b/tests/experiments/generic/resource.slang new file mode 100644 index 000000000..51cd8a00f --- /dev/null +++ b/tests/experiments/generic/resource.slang @@ -0,0 +1,35 @@ +//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj + +/* A test to use generics around resource/built in types. + +This test shouldn't compile (wrong type for the Texture1D, but gives this error, which doesn't really explain the problem. + +.slang(19): error 30019: expected an expression of type 'Texture1D', got 'Texture1D' + a.tex = tex; + */ + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer +RWStructuredBuffer<int> outputBuffer; + +// NOTE! This is purposefully wrong to test tex type checking +Texture1D<float> tex; + +struct Another<T> +{ + T z; + Texture1D<T> tex; +}; + +[numthreads(4, 1, 1)] +void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) +{ + int index = dispatchThreadID.x; + + Another<int> a; + + a.z = index; + a.tex = tex; + + outputBuffer[index] = a.z + a.tex.Load(index); +} + |
