yum-mirror/slang

Making it easier to work with shaders

git clone https://git.yummers.dev/yum-mirror/slang

jsmall-nvidiaLanguage experiments (#2068)447b7e0e2

master
853 B35 linesraw
1//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj
2
3/* A test to use generics around resource/built in types. 
4
5This test shouldn't compile (wrong type for the Texture1D, but gives this error, which doesn't really explain the problem.
6
7.slang(19): error 30019: expected an expression of type 'Texture1D', got 'Texture1D'
8    a.tex = tex;
9 */
10
11//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer
12RWStructuredBuffer<int> outputBuffer;
13
14// NOTE! This is purposefully wrong to test tex type checking
15Texture1D<float> tex;
16
17struct Another<T>
18{
19    T z;
20    Texture1D<T> tex;
21};
22
23[numthreads(4, 1, 1)]
24void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
25{    
26    int index = dispatchThreadID.x;
27
28    Another<int> a;
29    
30    a.z = index;
31    a.tex = tex;
32    
33	outputBuffer[index] = a.z + a.tex.Load(index);
34}
35