yum-mirror/slang

Making it easier to work with shaders

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

ArielG-NVCapability System: Implicit capability upgrade warning/error (#4241)8813c6105

master
2.0 KiB71 linesraw
1//TEST:SIMPLE(filecheck=CHECK_HLSL): -target hlsl -entry main -stage compute -capability _sm_5_1
2//TEST:SIMPLE(filecheck=CHECK_GLSL1): -target glsl -entry main -stage compute -capability _GLSL_420
3//TEST:SIMPLE(filecheck=CHECK_GLSL1): -target glsl -entry main -stage compute -capability _GLSL_420
4//TEST:SIMPLE(filecheck=CHECK_GLSL2): -target glsl -entry main -stage compute -capability _GLSL_330
5//TEST:SIMPLE(filecheck=CHECK_GLSL2_NO_UPGRADE): -target glsl -entry main -stage compute -capability _GLSL_330 -DTURN_OFF_LARGER_GLSL_TARGETS 
6//TEST:SIMPLE(filecheck=CHECK_METAL): -target cpp -entry main -stage compute -capability image_loadstore
7//TEST:SIMPLE(filecheck=CHECK_WILL_ERROR1): -target glsl -entry main -stage compute -capability image_loadstore -DWILL_ERROR1
8//TEST:SIMPLE(filecheck=CHECK_WILL_ERROR2): -target glsl -entry main -stage compute -capability _GLSL_130 -DWILL_ERROR2
9//TEST:SIMPLE(filecheck=CHECK_GLSL3): -target glsl -entry main -stage compute -capability _GLSL_130
10
11RWTexture1D<int> tex;
12
13//CHECK_HLSL: {{.*}}21{{.*}};
14
15//CHECK_GLSL1: {{.*}}13{{.*}}
16
17//CHECK_GLSL2: {{.*}}11{{.*}}
18
19//CHECK_GLSL2_NO_UPGRADE-NOT: warning 41012
20//CHECK_GLSL2_NO_UPGRADE-NOT: error 41012
21
22//CHECK_METAL: {{.*}}30{{.*}}
23
24//CHECK_WILL_ERROR1: error 36109
25//CHECK_WILL_ERROR2: error 41011
26
27//CHECK_GLSL3: {{.*}}30{{.*}}
28
29int specialize()
30{
31    __target_switch
32    {
33    case spirv_1_0:
34        return 1; 
35    case spirv_1_1:
36        return 2;
37    case spirv_1_2:
38        return 3;
39
40    case _GLSL_150:
41        return 10;
42    case _GLSL_330:
43        return 11;
44#ifndef TURN_OFF_LARGER_GLSL_TARGETS
45    case _GLSL_400:
46        return 12;
47    case _GLSL_410:
48        return 13;
49#endif
50#ifdef WILL_ERROR1
51    case image_loadstore:
52        return 14;
53#endif
54    case _sm_5_0:
55        return 20;
56    case _sm_5_1:
57        return 21;
58    case _sm_6_0:
59        return 21;
60#ifndef WILL_ERROR2
61    default:
62        return 30;
63#endif
64    }
65}
66
67[numthreads(1,1,1)] 
68void main()
69{
70    tex[0] = specialize();
71}